summaryrefslogtreecommitdiffstats
path: root/crypto/x509v3/v3_lib.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2000-12-27 13:42:43 +0000
committerDr. Stephen Henson <steve@openssl.org>2000-12-27 13:42:43 +0000
commit28ddfc61dc90ec257810ee089e2639196afa589f (patch)
treea57a7dbceb0f0ceeff6c67bbcda1dd2b90b0de50 /crypto/x509v3/v3_lib.c
parent725c88879c1e76f2b7e5242a7b87df9e9cd58518 (diff)
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.
Diffstat (limited to 'crypto/x509v3/v3_lib.c')
-rw-r--r--crypto/x509v3/v3_lib.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/crypto/x509v3/v3_lib.c b/crypto/x509v3/v3_lib.c
index 844cee1c14..d8301a67bd 100644
--- a/crypto/x509v3/v3_lib.c
+++ b/crypto/x509v3/v3_lib.c
@@ -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;