]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix 'openssl req' to correctly use the algorithm from '-newkey algo:nnnn'
authorRichard Levitte <levitte@openssl.org>
Fri, 25 Jun 2021 06:36:30 +0000 (08:36 +0200)
committerRichard Levitte <levitte@openssl.org>
Sat, 26 Jun 2021 08:31:04 +0000 (10:31 +0200)
We used the original string, which meant fetching for, for example,
'rsa:2048'.  That was, of course, doomed to fail.

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15912)

apps/req.c

index d0c620438bc912804bb8ad0ba5688a61d2e27e32..eb286f8a8e150c12f8eb53f7c85a78f7393cb633 100644 (file)
@@ -1615,14 +1615,14 @@ static EVP_PKEY_CTX *set_keygen_ctx(const char *gstr,
         EVP_PKEY_free(param);
     } else {
         if (keygen_engine != NULL) {
-            int pkey_id = get_legacy_pkey_id(app_get0_libctx(), keytype,
+            int pkey_id = get_legacy_pkey_id(app_get0_libctx(), *pkeytype,
                                              keygen_engine);
 
             if (pkey_id != NID_undef)
                 gctx = EVP_PKEY_CTX_new_id(pkey_id, keygen_engine);
         } else {
             gctx = EVP_PKEY_CTX_new_from_name(app_get0_libctx(),
-                                              keytype, app_get0_propq());
+                                              *pkeytype, app_get0_propq());
         }
     }