Changes between 0.9.6 and 0.9.6a [xx XXX 2001]
+ *) Initialise "ex_data" member of RSA/DSA/DH structures prior to calling
+ the method-specific "init()" handler. Also clean up ex_data after
+ calling the method-specific "finish()" handler. Previously, this was
+ happening the other way round.
+ [Geoff Thorpe]
+
*) Avoid coredump with unsupported or invalid public keys by checking if
X509_get_pubkey() fails in PKCS7_verify(). Fix memory leak when
PKCS7_verify() fails with non detached data.
ret->method_mont_p=NULL;
ret->references = 1;
ret->flags=ret->meth->flags;
+ CRYPTO_new_ex_data(dh_meth,ret,&ret->ex_data);
if ((ret->meth->init != NULL) && !ret->meth->init(ret))
{
+ CRYPTO_free_ex_data(dh_meth,ret,&ret->ex_data);
OPENSSL_free(ret);
ret=NULL;
}
- else
- CRYPTO_new_ex_data(dh_meth,ret,&ret->ex_data);
return(ret);
}
}
#endif
- CRYPTO_free_ex_data(dh_meth, r, &r->ex_data);
-
if(r->meth->finish) r->meth->finish(r);
+ CRYPTO_free_ex_data(dh_meth, r, &r->ex_data);
+
if (r->p != NULL) BN_clear_free(r->p);
if (r->g != NULL) BN_clear_free(r->g);
if (r->q != NULL) BN_clear_free(r->q);
ret->references=1;
ret->flags=ret->meth->flags;
+ CRYPTO_new_ex_data(dsa_meth,ret,&ret->ex_data);
if ((ret->meth->init != NULL) && !ret->meth->init(ret))
{
+ CRYPTO_free_ex_data(dsa_meth,ret,&ret->ex_data);
OPENSSL_free(ret);
ret=NULL;
}
- else
- CRYPTO_new_ex_data(dsa_meth,ret,&ret->ex_data);
return(ret);
}
}
#endif
- CRYPTO_free_ex_data(dsa_meth, r, &r->ex_data);
-
if(r->meth->finish) r->meth->finish(r);
+ CRYPTO_free_ex_data(dsa_meth, r, &r->ex_data);
+
if (r->p != NULL) BN_clear_free(r->p);
if (r->q != NULL) BN_clear_free(r->q);
if (r->g != NULL) BN_clear_free(r->g);
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);
}
}
#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);