diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2000-12-27 13:42:43 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2000-12-27 13:42:43 +0000 |
commit | 28ddfc61dc90ec257810ee089e2639196afa589f (patch) | |
tree | a57a7dbceb0f0ceeff6c67bbcda1dd2b90b0de50 /crypto | |
parent | 725c88879c1e76f2b7e5242a7b87df9e9cd58518 (diff) | |
download | openssl-28ddfc61dc90ec257810ee089e2639196afa589f.tar.gz |
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')
-rw-r--r-- | crypto/x509/x509_ext.c | 6 | ||||
-rw-r--r-- | crypto/x509v3/v3_lib.c | 13 | ||||
-rw-r--r-- | crypto/x509v3/x509v3.h | 2 |
3 files changed, 11 insertions, 10 deletions
diff --git a/crypto/x509/x509_ext.c b/crypto/x509/x509_ext.c index 9b602581ef..e7fdacb5e4 100644 --- a/crypto/x509/x509_ext.c +++ b/crypto/x509/x509_ext.c @@ -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) 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; diff --git a/crypto/x509v3/x509v3.h b/crypto/x509v3/x509v3.h index 6678db33c4..8bf67bcbe0 100644 --- a/crypto/x509v3/x509v3.h +++ b/crypto/x509v3/x509v3.h @@ -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); |