Hello,

when an ENGINE implements the RSA key generation the current implementation of the 'genrsa' command doesn't use the funcion reference of that ENGINE for this. This reference should be stored in the RSA struct and is passed to the RSA_generate_key_ex() function. The problem is that the RSA strcut is initialized via RSA_new() with the default function before the ENGINE interface was set up properly. The patch below fixes this.

Regards,
Ralf Vennemann

@@ -105,9 +105,9 @@
        char *inrand=NULL;
        BIO *out=NULL;
        BIGNUM *bn = BN_new();
-       RSA *rsa = RSA_new();
+       RSA *rsa = NULL;

-       if(!bn || !rsa) goto err;
+       if(!bn) goto err;

        apps_startup();
        BN_GENCB_set(&cb, genrsa_cb, bio_err);
@@ -266,6 +266,9 @@
        BIO_printf(bio_err,"Generating RSA private key, %d bit long modulus\n",
                num);

+       rsa = RSA_new();
+       if(!rsa) goto err;
+
        if(!BN_set_word(bn, f4) || !RSA_generate_key_ex(rsa, num, bn, &cb))
                goto err;
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       openssl-dev@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to