[PATCH] genrsa with ENGINE - Openssl

This is a discussion on [PATCH] genrsa with ENGINE - Openssl ; 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 ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: [PATCH] genrsa with ENGINE

  1. [PATCH] genrsa with ENGINE

    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 majordomo@openssl.org


  2. [openssl.org #1677] [PATCH] genrsa with ENGINE

    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 majordomo@openssl.org

    __________________________________________________ ____________________
    OpenSSL Project http://www.openssl.org
    Development Mailing List openssl-dev@openssl.org
    Automated List Manager majordomo@openssl.org


+ Reply to Thread