[openssl-commits] [openssl] master update

Andy Polyakov appro at openssl.org
Thu Nov 23 20:08:50 UTC 2017


The branch master has been updated
       via  e44480cc26c9bdf4227d963d84ae271a1efaccd9 (commit)
      from  88ac224cdaf65c3c3a08beddccb694706a311336 (commit)


- Log -----------------------------------------------------------------
commit e44480cc26c9bdf4227d963d84ae271a1efaccd9
Author: Andy Polyakov <appro at openssl.org>
Date:   Tue Nov 21 22:34:50 2017 +0100

    rsa/rsa_gen.c: ensure backward compatibility with external rsa->meth.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/4770)

-----------------------------------------------------------------------

Summary of changes:
 crypto/rsa/rsa_gen.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/crypto/rsa/rsa_gen.c b/crypto/rsa/rsa_gen.c
index f7f6075..b092bba 100644
--- a/crypto/rsa/rsa_gen.c
+++ b/crypto/rsa/rsa_gen.c
@@ -42,9 +42,22 @@ int RSA_generate_multi_prime_key(RSA *rsa, int bits, int primes,
                                  BIGNUM *e_value, BN_GENCB *cb)
 {
     /* multi-prime is only supported with the builtin key generation */
-    if (rsa->meth->rsa_multi_prime_keygen != NULL)
+    if (rsa->meth->rsa_multi_prime_keygen != NULL) {
         return rsa->meth->rsa_multi_prime_keygen(rsa, bits, primes,
                                                  e_value, cb);
+    } else if (rsa->meth->rsa_keygen != NULL) {
+        /*
+         * However, if rsa->meth implements only rsa_keygen, then we
+         * have to honour it in 2-prime case and assume that it wouldn't
+         * know what to do with multi-prime key generated by builtin
+         * subroutine...
+         */
+        if (primes == 2)
+            return rsa->meth->rsa_keygen(rsa, bits, e_value, cb);
+        else
+            return 0;
+    }
+
     return rsa_builtin_keygen(rsa, bits, primes, e_value, cb);
 }
 


More information about the openssl-commits mailing list