To avoid having to override every RSA function, I could fill my engine's custom RSA_METHOD with methods from RSA_PKCS1_SSLeay. Alternatively I could have my functions wrap the internal OpenSSL functions. For instance: int myEngineRsaModExp(BIGNUM *r0,const BIGNUM *I,RSA *rsa,BN_CTX *ctx) { int rc = 0; ... // do some custom work here // now call internal method rc = RSA_PKCS1_SSLeay()->rsa_mod_exp(r0, I, rsa, cts);
// do some more customized work return rc; } However, I can't do that with "rsa_keygen". For some reason this pointer is null (actually there could be more of these -- so far I have come across this one only). The source code for RSA_generate_key_ex which calls the builtin "rsa_builtin_kegen" has a comment including the following: /* this wrapper would normally be placed in ... the ... * implementation would probably be in rsa_eay.c. * Nonetheless, is kept here so * that we don't introduce a new linker dependency. Could this be fixed with so that RSA_PKCS1_SSLeay() has a pointer to the builtin implementation. Since i don't have access to the original, declared-as-static method I have to come up unsafe hacks like this (a very crude version): int rc = 0; RSA_METHOD *myEnginesMethod = rsa->meth; rsa->meth = RSA_null_method(); rc = RSA_generate_key_ex(rsa, bits, e, cb); rsa->meth = myEnginesMethod; return rc; This email contains Morega Systems Inc. Privileged and Confidential information. ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org