Geoff Thorpe wrote:
>
> Hi y'all,
>
> Quick question about RSA_new() I wanted to run by interested parties;
> namely, RSA_new() does a bunch of initialisations of a new RSA structure
> prior to calling the RSA_METHOD's "init()" handler to do any tweaking to
> the new RSA structure that it may choose to do. However, the final few
> lines go something like this;
>
> if ((meth->init != NULL) && !meth->init(ret))
> {
> OPENSSL_free(ret);
> ret=NULL;
> }
> else
> CRYPTO_new_ex_data(rsa_meth,ret,&ret->ex_data);
> return(ret);
>
> Why doesn't CRYPTO_new_ex_data(...) get called *prior* to the RSA_METHOD's
> "init()" handler - isn't the ex_data member of an RSA structure a perfect
> place for a custom method place information? By this scheme, the ex_data
> member of the structure is uninitialised when the init() handler is
> called, and even if the handler initialised it, it would be erased by the
> following CRYPTO_new_ex_data() call.
>
An application could always use the ex_data callback new_func() to do
the initialization.
> Would fixing this break anything that anyone is aware of? (Ie. putting the
> CRYPTO_new_ex_data() prior to the meth->init() call).
>
Not that I'm aware of no.
However neither the meth->init() nor ex_data new_func() is particularly
useful because at this point the parent RSA structure doesn't contain
anything useful like keying material when it is called.
Steve.
--
Dr Stephen N. Henson. http://www.drh-consultancy.demon.co.uk/
Personal Email: [EMAIL PROTECTED]
Senior crypto engineer, Celo Communications: http://www.celocom.com/
Core developer of the OpenSSL project: http://www.openssl.org/
Business Email: [EMAIL PROTECTED] PGP key: via homepage.
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]