Rename X509_att*() stuff to X509at_*(), add X509_REQ wrappers.
[openssl.git] / crypto / x509 / x509_req.c
index b20305c6eeef6a8295b003e105e8c1f867d17221..849b43766c8ce2e74138de9e15a03c48fad63119 100644 (file)
@@ -214,3 +214,65 @@ int X509_REQ_add_extensions(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts)
 {
        return X509_REQ_add_extensions_nid(req, exts, NID_ext_req);
 }
+
+/* Request attribute functions */
+
+int X509_REQ_get_attr_count(const X509_REQ *req)
+{
+       return X509at_get_attr_count(req->req_info->attributes);
+}
+
+int X509_REQ_get_attr_by_NID(const X509_REQ *req, int nid,
+                         int lastpos)
+{
+       return X509at_get_attr_by_NID(req->req_info->attributes, nid, lastpos);
+}
+
+int X509_REQ_get_attr_by_OBJ(const X509_REQ *req, ASN1_OBJECT *obj,
+                         int lastpos)
+{
+       return X509at_get_attr_by_OBJ(req->req_info->attributes, obj, lastpos);
+}
+
+X509_ATTRIBUTE *X509_REQ_get_attr(const X509_REQ *req, int loc)
+{
+       return X509at_get_attr(req->req_info->attributes, loc);
+}
+
+X509_ATTRIBUTE *X509_REQ_delete_attr(X509_REQ *req, int loc)
+{
+       return X509at_delete_attr(req->req_info->attributes, loc);
+}
+
+int X509_REQ_radd_attr(X509_REQ *req, X509_ATTRIBUTE *attr)
+{
+       if(X509at_radd_attr(&req->req_info->attributes, attr)) return 1;
+       return 0;
+}
+
+int X509_REQ_radd_attr_by_OBJ(X509_REQ *req,
+                       ASN1_OBJECT *obj, int type,
+                       unsigned char *bytes, int len)
+{
+       if(X509at_radd_attr_by_OBJ(&req->req_info->attributes, obj,
+                               type, bytes, len)) return 1;
+       return 0;
+}
+
+int X509_REQ_radd_attr_by_NID(X509_REQ *req,
+                       int nid, int type,
+                       unsigned char *bytes, int len)
+{
+       if(X509at_radd_attr_by_NID(&req->req_info->attributes, nid,
+                               type, bytes, len)) return 1;
+       return 0;
+}
+
+int X509_REQ_radd_attr_by_txt(X509_REQ *req,
+                       char *attrname, int type,
+                       unsigned char *bytes, int len)
+{
+       if(X509at_radd_attr_by_txt(&req->req_info->attributes, attrname,
+                               type, bytes, len)) return 1;
+       return 0;
+}