Backfit a bugfix from 0.9.7-dev to 0.9.6-stable. init() and finish()

handlers were previously getting called before (and after, respectively)
the "ex_data" structures - this meant init() had very little that it
could initialise, and finish() had very little it could cleanup.
This commit is contained in:
Geoff Thorpe
2001-02-24 17:32:34 +00:00
parent 75090e0365
commit 4910cbf6db
4 changed files with 18 additions and 12 deletions

View File

@@ -145,13 +145,13 @@ RSA *RSA_new_method(RSA_METHOD *meth)
ret->blinding=NULL;
ret->bignum_data=NULL;
ret->flags=ret->meth->flags;
CRYPTO_new_ex_data(rsa_meth,ret,&ret->ex_data);
if ((ret->meth->init != NULL) && !ret->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);
}
@@ -174,11 +174,11 @@ void RSA_free(RSA *r)
}
#endif
CRYPTO_free_ex_data(rsa_meth,r,&r->ex_data);
if (r->meth->finish != NULL)
r->meth->finish(r);
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);