diff options
author | Geoff Thorpe <geoff@openssl.org> | 2001-09-01 20:02:13 +0000 |
---|---|---|
committer | Geoff Thorpe <geoff@openssl.org> | 2001-09-01 20:02:13 +0000 |
commit | 79aa04ef27f69a1149d4d0e72d2d2953b6241ef0 (patch) | |
tree | 28eb317ea6bcd7f391cffe2fe694e92224ce1ff8 /crypto/rsa | |
parent | 3a0799977bcb154d044828e96a25a01eb478de51 (diff) | |
download | openssl-79aa04ef27f69a1149d4d0e72d2d2953b6241ef0.tar.gz |
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.
Diffstat (limited to 'crypto/rsa')
-rw-r--r-- | crypto/rsa/rsa_lib.c | 14 | ||||
-rw-r--r-- | crypto/rsa/rsa_test.c | 1 |
2 files changed, 6 insertions, 9 deletions
diff --git a/crypto/rsa/rsa_lib.c b/crypto/rsa/rsa_lib.c index 3accf013f3..e3368c1ee5 100644 --- a/crypto/rsa/rsa_lib.c +++ b/crypto/rsa/rsa_lib.c @@ -67,8 +67,6 @@ const char *RSA_version="RSA" OPENSSL_VERSION_PTEXT; static const RSA_METHOD *default_RSA_meth=NULL; -static int rsa_meth_num=0; -static STACK_OF(CRYPTO_EX_DATA_FUNCS) *rsa_meth=NULL; RSA *RSA_new(void) { @@ -198,10 +196,10 @@ RSA *RSA_new_method(ENGINE *engine) ret->blinding=NULL; ret->bignum_data=NULL; ret->flags=meth->flags; - CRYPTO_new_ex_data(rsa_meth,ret,&ret->ex_data); + CRYPTO_new_ex_data(CRYPTO_EX_INDEX_RSA, ret, &ret->ex_data); if ((meth->init != NULL) && !meth->init(ret)) { - CRYPTO_free_ex_data(rsa_meth, ret, &ret->ex_data); + CRYPTO_free_ex_data(CRYPTO_EX_INDEX_RSA, ret, &ret->ex_data); OPENSSL_free(ret); ret=NULL; } @@ -233,7 +231,7 @@ void RSA_free(RSA *r) meth->finish(r); ENGINE_finish(r->engine); - CRYPTO_free_ex_data(rsa_meth,r,&r->ex_data); + CRYPTO_free_ex_data(CRYPTO_EX_INDEX_RSA, r, &r->ex_data); if (r->n != NULL) BN_clear_free(r->n); if (r->e != NULL) BN_clear_free(r->e); @@ -267,10 +265,8 @@ int RSA_up(RSA *r) int RSA_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(rsa_meth_num, &rsa_meth, argl, argp, - new_func, dup_func, free_func) < 0) - return -1; - return (rsa_meth_num++); + return CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_RSA, argl, argp, + new_func, dup_func, free_func); } int RSA_set_ex_data(RSA *r, int idx, void *arg) diff --git a/crypto/rsa/rsa_test.c b/crypto/rsa/rsa_test.c index 2c0a1d5c4a..5dee24b001 100644 --- a/crypto/rsa/rsa_test.c +++ b/crypto/rsa/rsa_test.c @@ -307,6 +307,7 @@ int main(int argc, char *argv[]) RSA_free(key); } + CRYPTO_cleanup_all_ex_data(); ERR_remove_state(0); CRYPTO_mem_leaks_fp(stdout); |