Hi there,

On Thu, 26 Apr 2001, Richard Levitte - VMS Whacker wrote:

> It was noted, not long ago, that the engine code doesn't look at
> OPENSSL_NO_* macros, and therefore fails to compile if any of the
> algorithms RSA, DSA or DH have been disabled.
> 
> So, checking for those macros and disabling a number of functions
> isn't very hard, but I'm wondering about the thoughts behind that.
> 
> The way this currently works is that if RSA is disabled
> (OPENSSL_NO_RSA is defined), you can't even include rsa.h, and the RSA
> functions are completely missing.  This is absolutely fine as long as
> we only live within OpenSSL itself.
> 
> Enters the ENGINE, which provides and interface to external devices
> which might have RSA functionality.  The way things are done in
> OpenSSL, if RSA is disabled, it will not only be disabled within
> OpenSSL, but also in the interface to the external crypto device, thus
> rendering it useless.

I think this is actually quite easy to fix, only I was a bit stupid to have not
included it before now. Binary compatibility can be maintained quite
straightforwardly too (with ENGINE anyway) - the ENGINE's internal structure
stays the same, but at the top of engine.h and/or engine_int.h we declare the
RSA_METHOD, DSA_METHOD, DH_METHOD (etc) types as dummies if we're compiling with
the appropriate "OPENSSL_NO_***" symbol. That way, the ENGINE structure will
still have an (RSA_METHOD*) value. Internally to OpenSSL, the ENGINE_set_RSA()
will not exist, but even if an ENGINE is loaded and initialised entirely from a
shared-library that was built *with* an RSA-enabled OpenSSL, the
ENGINE_set_RSA() code it runs on the (ENGINE*) passed to it will merely populate
a dummy variable that isn't touched inside the OpenSSL-based code that loads it.

This works because even if ENGINE has an (RSA_METHOD*) pointer, if OpenSSL
itself is compiled with OPENSSL_NO_RSA then no RSA key loads will ever attempt
to get a handle to an ENGINE's RSA_METHOD. Also the setting of default ENGINEs
for the various algorithms will bypass setting a default ENGINE for RSA in this
case too. It won't be crypto with a hook, because OpenSSL itself will still
expose no RSA functionality or symbols for that matter, and even if a dummy
RSA_METHOD pointer is somehow populated by a willing "ENGINE", nothing inside
the OpenSSL code will touch it.

I think. :-) Does that make sense to you Richard?

Cheers,
Geoff


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to