提交 28ddfc61 编写于 作者: D Dr. Stephen Henson

X509V3_add_i2d() needs to be able to allocate a

STACK_OF(X509_EXTENSION) so it should be passed
STACK_OF(X509_EXTENSION) ** in the first argument.

Modify wrappers appropriately.
上级 725c8887
......@@ -104,7 +104,7 @@ void *X509_CRL_get_ext_d2i(X509_CRL *x, int nid, int *crit, int *idx)
int X509_CRL_add1_ext_i2d(X509_CRL *x, int nid, void *value, int crit,
unsigned long flags)
{
return X509V3_add1_i2d(x->crl->extensions, nid, value, crit, flags);
return X509V3_add1_i2d(&x->crl->extensions, nid, value, crit, flags);
}
int X509_CRL_add_ext(X509_CRL *x, X509_EXTENSION *ex, int loc)
......@@ -155,7 +155,7 @@ void *X509_get_ext_d2i(X509 *x, int nid, int *crit, int *idx)
int X509_add1_ext_i2d(X509 *x, int nid, void *value, int crit,
unsigned long flags)
{
return X509V3_add1_i2d(x->cert_info->extensions, nid, value, crit,
return X509V3_add1_i2d(&x->cert_info->extensions, nid, value, crit,
flags);
}
......@@ -203,7 +203,7 @@ void *X509_REVOKED_get_ext_d2i(X509_REVOKED *x, int nid, int *crit, int *idx)
int X509_REVOKED_add1_ext_i2d(X509_REVOKED *x, int nid, void *value, int crit,
unsigned long flags)
{
return X509V3_add1_i2d(x->extensions, nid, value, crit, flags);
return X509V3_add1_i2d(&x->extensions, nid, value, crit, flags);
}
IMPLEMENT_STACK_OF(X509_EXTENSION)
......
......@@ -228,7 +228,7 @@ void *X509V3_get_d2i(STACK_OF(X509_EXTENSION) *x, int nid, int *crit, int *idx)
* 'value' arguments (if relevant) are the extensions internal structure.
*/
int X509V3_add1_i2d(STACK_OF(X509_EXTENSION) *x, int nid, void *value,
int X509V3_add1_i2d(STACK_OF(X509_EXTENSION) **x, int nid, void *value,
int crit, unsigned long flags)
{
int extidx = -1;
......@@ -240,7 +240,7 @@ int X509V3_add1_i2d(STACK_OF(X509_EXTENSION) *x, int nid, void *value,
* look for existing extension.
*/
if(ext_op != X509V3_ADD_APPEND)
extidx = X509v3_get_ext_by_NID(x, nid, -1);
extidx = X509v3_get_ext_by_NID(*x, nid, -1);
/* See if extension exists */
if(extidx >= 0) {
......@@ -254,7 +254,7 @@ int X509V3_add1_i2d(STACK_OF(X509_EXTENSION) *x, int nid, void *value,
}
/* If delete, just delete it */
if(ext_op == X509V3_ADD_DELETE) {
if(!sk_X509_EXTENSION_delete(x, extidx)) return -1;
if(!sk_X509_EXTENSION_delete(*x, extidx)) return -1;
return 1;
}
} else {
......@@ -281,13 +281,14 @@ int X509V3_add1_i2d(STACK_OF(X509_EXTENSION) *x, int nid, void *value,
/* If extension exists replace it.. */
if(extidx >= 0) {
extmp = sk_X509_EXTENSION_value(x, extidx);
extmp = sk_X509_EXTENSION_value(*x, extidx);
X509_EXTENSION_free(extmp);
if(!sk_X509_EXTENSION_set(x, extidx, ext)) return -1;
if(!sk_X509_EXTENSION_set(*x, extidx, ext)) return -1;
return 1;
}
if(!sk_X509_EXTENSION_push(x, ext)) return -1;
if(!*x && !(*x = sk_X509_EXTENSION_new_null())) return -1;
if(!sk_X509_EXTENSION_push(*x, ext)) return -1;
return 1;
......
......@@ -500,7 +500,7 @@ void *X509V3_get_d2i(STACK_OF(X509_EXTENSION) *x, int nid, int *crit, int *idx);
X509_EXTENSION *X509V3_EXT_i2d(int ext_nid, int crit, void *ext_struc);
int X509V3_add1_i2d(STACK_OF(X509_EXTENSION) *x, int nid, void *value, int crit, unsigned long flags);
int X509V3_add1_i2d(STACK_OF(X509_EXTENSION) **x, int nid, void *value, int crit, unsigned long flags);
char *hex_to_string(unsigned char *buffer, long len);
unsigned char *string_to_hex(char *str, long *len);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册