From: Matt Caswell Date: Tue, 1 Apr 2025 09:31:33 +0000 (+0100) Subject: Fix a segfault in the pkeyutl command line app X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3f0f723b521b5138f9ac77ede45a77dc46a734d4;p=thirdparty%2Fopenssl.git Fix a segfault in the pkeyutl command line app Don't attempt to deref a pkey that is NULL Fixes #27156 Reviewed-by: Dmitry Belyavskiy Reviewed-by: Paul Dale Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/27228) --- diff --git a/apps/pkeyutl.c b/apps/pkeyutl.c index d72b82fd0b3..2d3fd631447 100644 --- a/apps/pkeyutl.c +++ b/apps/pkeyutl.c @@ -318,6 +318,10 @@ int pkeyutl_main(int argc, char **argv) } pkey = get_pkey(kdfalg, inkey, keyform, key_type, passinarg, pkey_op, e); + if (key_type != KEY_NONE && pkey == NULL) { + BIO_printf(bio_err, "%s: Error loading key\n", prog); + goto end; + } if (pkey_op == EVP_PKEY_OP_VERIFYRECOVER && !EVP_PKEY_is_a(pkey, "RSA")) { BIO_printf(bio_err, "%s: -verifyrecover can be used only with RSA\n", prog);