From 79aa04ef27f69a1149d4d0e72d2d2953b6241ef0 Mon Sep 17 00:00:00 2001 From: Geoff Thorpe Date: Sat, 1 Sep 2001 20:02:13 +0000 Subject: Make the necessary changes to work with the recent "ex_data" overhaul. See the commit log message for that for more information. NB: X509_STORE_CTX's use of "ex_data" support was actually misimplemented (initialisation by "memset" won't/can't/doesn't work). This fixes that but requires that X509_STORE_CTX_init() be able to handle errors - so its prototype has been changed to return 'int' rather than 'void'. All uses of that function throughout the source code have been tracked down and adjusted. --- crypto/asn1/x_x509.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'crypto/asn1/x_x509.c') diff --git a/crypto/asn1/x_x509.c b/crypto/asn1/x_x509.c index b0d859d38b..b50167ce43 100644 --- a/crypto/asn1/x_x509.c +++ b/crypto/asn1/x_x509.c @@ -63,9 +63,6 @@ #include #include -static int x509_meth_num = 0; -static STACK_OF(CRYPTO_EX_DATA_FUNCS) *x509_meth = NULL; - ASN1_SEQUENCE(X509_CINF) = { ASN1_EXP_OPT(X509_CINF, version, ASN1_INTEGER, 0), ASN1_SIMPLE(X509_CINF, serialNumber, ASN1_INTEGER), @@ -96,7 +93,7 @@ static int x509_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it) ret->skid = NULL; ret->akid = NULL; ret->aux = NULL; - CRYPTO_new_ex_data(x509_meth, ret, &ret->ex_data); + CRYPTO_new_ex_data(CRYPTO_EX_INDEX_X509, ret, &ret->ex_data); break; case ASN1_OP_D2I_POST: @@ -105,7 +102,7 @@ static int x509_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it) break; case ASN1_OP_FREE_POST: - CRYPTO_free_ex_data(x509_meth,ret,&ret->ex_data); + CRYPTO_free_ex_data(CRYPTO_EX_INDEX_X509, ret, &ret->ex_data); X509_CERT_AUX_free(ret->aux); ASN1_OCTET_STRING_free(ret->skid); AUTHORITY_KEYID_free(ret->akid); @@ -142,10 +139,8 @@ ASN1_METHOD *X509_asn1_meth(void) int X509_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func) { - if(CRYPTO_get_ex_new_index(x509_meth_num, &x509_meth, argl, argp, - new_func, dup_func, free_func) < 0) - return -1; - return (x509_meth_num++); + return CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_X509, argl, argp, + new_func, dup_func, free_func); } int X509_set_ex_data(X509 *r, int idx, void *arg) -- cgit v1.2.3