[openssl-dev] [openssl.org #4518] OpenSSL-1.1.0-pre5 RSA_set0_key and related RSA_get0_*, RSA_set0_*, DSA_set0_* and DSA_get0_* problems

Richard Levitte levitte at openssl.org
Thu Apr 28 04:31:02 UTC 2016


In message <5720FD7D.3050900 at gmail.com> on Wed, 27 Apr 2016 12:57:17 -0500, Douglas E Engert <deengert at gmail.com> said:

deengert> You can call it a documentation problem. The problem only showed up
deengert> with trying to update d
deengert> in an existing rsa key. RSA_set0_key requires n, e, and d == NULL OR
deengert> n, e, and d to all be set at the same time.

Not any more, just the first time (and then only n and e, d can be
left NULL).  So that makes this particular sequence perfectly legal:

    RSA_set0_key(rsa, n, e, NULL);
    /* calculate d */
    RSA_set0_key(rsa, NULL, NULL, d);

(sloppy code, btw...  return codes should really be checked)

Cheers,
Richard

-- 
Richard Levitte         levitte at openssl.org
OpenSSL Project         http://www.openssl.org/~levitte/


More information about the openssl-dev mailing list