X509_ATTRIBUTE *X509_REQ_delete_attr(X509_REQ *req, int loc)
{
- return X509at_delete_attr(req->req_info.attributes, loc);
+ X509_ATTRIBUTE *attr = X509at_delete_attr(req->req_info.attributes, loc);
+
+ if (attr != NULL)
+ req->req_info.enc.modified = 1;
+ return attr;
}
int X509_REQ_add1_attr(X509_REQ *req, X509_ATTRIBUTE *attr)
{
- if (X509at_add1_attr(&req->req_info.attributes, attr))
- return 1;
- return 0;
+ if (!X509at_add1_attr(&req->req_info.attributes, attr))
+ return 0;
+ req->req_info.enc.modified = 1;
+ return 1;
}
int X509_REQ_add1_attr_by_OBJ(X509_REQ *req,
const ASN1_OBJECT *obj, int type,
const unsigned char *bytes, int len)
{
- if (X509at_add1_attr_by_OBJ(&req->req_info.attributes, obj,
- type, bytes, len))
- return 1;
- return 0;
+ if (!X509at_add1_attr_by_OBJ(&req->req_info.attributes, obj,
+ type, bytes, len))
+ return 0;
+ req->req_info.enc.modified = 1;
+ return 1;
}
int X509_REQ_add1_attr_by_NID(X509_REQ *req,
int nid, int type,
const unsigned char *bytes, int len)
{
- if (X509at_add1_attr_by_NID(&req->req_info.attributes, nid,
- type, bytes, len))
- return 1;
- return 0;
+ if (!X509at_add1_attr_by_NID(&req->req_info.attributes, nid,
+ type, bytes, len))
+ return 0;
+ req->req_info.enc.modified = 1;
+ return 1;
}
int X509_REQ_add1_attr_by_txt(X509_REQ *req,
const char *attrname, int type,
const unsigned char *bytes, int len)
{
- if (X509at_add1_attr_by_txt(&req->req_info.attributes, attrname,
- type, bytes, len))
- return 1;
- return 0;
+ if (!X509at_add1_attr_by_txt(&req->req_info.attributes, attrname,
+ type, bytes, len))
+ return 0;
+ req->req_info.enc.modified = 1;
+ return 1;
}
long X509_REQ_get_version(const X509_REQ *req)
int X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md)
{
+ x->req_info.enc.modified = 1;
return ASN1_item_sign_ex(ASN1_ITEM_rptr(X509_REQ_INFO), &x->sig_alg, NULL,
x->signature, &x->req_info, NULL,
pkey, md, x->libctx, x->propq);
int X509_REQ_sign_ctx(X509_REQ *x, EVP_MD_CTX *ctx)
{
+ x->req_info.enc.modified = 1;
return ASN1_item_sign_ctx(ASN1_ITEM_rptr(X509_REQ_INFO),
&x->sig_alg, NULL, x->signature, &x->req_info,
ctx);