diff options
author | Dr. Stephen Henson <steve@openssl.org> | 1999-10-11 01:30:04 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 1999-10-11 01:30:04 +0000 |
commit | 56a3fec1b12d9a95f9b79ce7918fe619488caa9a (patch) | |
tree | 3fb749ffd956c6f2e25b9eb905dcfc017be45499 /crypto/asn1/x_x509.c | |
parent | 4654ef985b58e2cf7c153057ffc6fda8ab186543 (diff) |
Add EX_DATA support to X509.
Fix a bug in the X509_get_d2i() functions which didn't check if crit was NULL.
Diffstat (limited to 'crypto/asn1/x_x509.c')
-rw-r--r-- | crypto/asn1/x_x509.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/crypto/asn1/x_x509.c b/crypto/asn1/x_x509.c index 7abf6b2a6b..c428997c00 100644 --- a/crypto/asn1/x_x509.c +++ b/crypto/asn1/x_x509.c @@ -62,6 +62,9 @@ #include <openssl/asn1_mac.h> #include <openssl/x509.h> +static int x509_meth_num = 0; +static STACK *x509_meth = NULL; + static ASN1_METHOD meth={ (int (*)()) i2d_X509, (char *(*)())d2i_X509, @@ -117,6 +120,7 @@ X509 *X509_new(void) M_ASN1_New(ret->cert_info,X509_CINF_new); M_ASN1_New(ret->sig_alg,X509_ALGOR_new); M_ASN1_New(ret->signature,ASN1_BIT_STRING_new); + CRYPTO_new_ex_data(x509_meth, (char *)ret, &ret->ex_data); return(ret); M_ASN1_New_Error(ASN1_F_X509_NEW); } @@ -140,7 +144,7 @@ void X509_free(X509 *a) } #endif - /* CRYPTO_free_ex_data(bio_meth,(char *)a,&a->ex_data); */ + CRYPTO_free_ex_data(x509_meth,(char *)a,&a->ex_data); X509_CINF_free(a->cert_info); X509_ALGOR_free(a->sig_alg); ASN1_BIT_STRING_free(a->signature); @@ -149,3 +153,21 @@ void X509_free(X509 *a) Free((char *)a); } +int X509_get_ex_new_index(long argl, char *argp, int (*new_func)(), + int (*dup_func)(), void (*free_func)()) + { + x509_meth_num++; + return(CRYPTO_get_ex_new_index(x509_meth_num-1, + &x509_meth,argl,argp,new_func,dup_func,free_func)); + } + +int X509_set_ex_data(X509 *r, int idx, char *arg) + { + return(CRYPTO_set_ex_data(&r->ex_data,idx,arg)); + } + +char *X509_get_ex_data(X509 *r, int idx) + { + return(CRYPTO_get_ex_data(&r->ex_data,idx)); + } + |