diff options
author | Geoff Thorpe <geoff@openssl.org> | 2000-11-26 18:34:45 +0000 |
---|---|---|
committer | Geoff Thorpe <geoff@openssl.org> | 2000-11-26 18:34:45 +0000 |
commit | 7abe8305016609939ee5ff0429c9e26d089c321e (patch) | |
tree | 6c6b348dc1740c68a82913fd24b04086ffff51fb /crypto | |
parent | 5acaa49504153ecdd9734ac80aeb9153fde94e48 (diff) |
Ensure that the "ex_data" member of an RSA structure is initialised before
the RSA_METHOD's "init()" handler is called, and is cleaned up after the
RSA_METHOD's "finish()" handler is called. Custom RSA_METHODs may wish to
initialise contexts and other specifics in the RSA structure upon creation
and that was previously not possible - "ex_data" is where that stuff
should go and it was being initialised too late for it to be used.
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/rsa/rsa_lib.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/crypto/rsa/rsa_lib.c b/crypto/rsa/rsa_lib.c index 6ebb0b552a..d09dbd4a33 100644 --- a/crypto/rsa/rsa_lib.c +++ b/crypto/rsa/rsa_lib.c @@ -191,13 +191,13 @@ 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); if ((meth->init != NULL) && !meth->init(ret)) { + CRYPTO_free_ex_data(rsa_meth, ret, &ret->ex_data); OPENSSL_free(ret); ret=NULL; } - else - CRYPTO_new_ex_data(rsa_meth,ret,&ret->ex_data); return(ret); } @@ -221,13 +221,13 @@ void RSA_free(RSA *r) } #endif - CRYPTO_free_ex_data(rsa_meth,r,&r->ex_data); - meth = ENGINE_get_RSA(r->engine); if (meth->finish != NULL) meth->finish(r); ENGINE_finish(r->engine); + CRYPTO_free_ex_data(rsa_meth,r,&r->ex_data); + if (r->n != NULL) BN_clear_free(r->n); if (r->e != NULL) BN_clear_free(r->e); if (r->d != NULL) BN_clear_free(r->d); |