Blame SOURCES/0010-p11sak-Fix-segfault-when-dilithium-version-is-not-sp.patch

447573
From bea2552c40339d9013eaaa55b13491c7e36fbadf Mon Sep 17 00:00:00 2001
447573
From: Ingo Franzki <ifranzki@linux.ibm.com>
447573
Date: Tue, 8 Nov 2022 15:49:22 +0100
447573
Subject: [PATCH 10/34] p11sak: Fix segfault when dilithium version is not
447573
 specified with generate-key
447573
447573
Command 'p11sak generate-key ibm-dilithium' segfaults because the dilithium
447573
version is not specified, but the code does not check for a NULL pointer.
447573
447573
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
447573
---
447573
 usr/sbin/p11sak/p11sak.c | 6 ++++++
447573
 1 file changed, 6 insertions(+)
447573
447573
diff --git a/usr/sbin/p11sak/p11sak.c b/usr/sbin/p11sak/p11sak.c
447573
index b399c88a..8cfcb21d 100644
447573
--- a/usr/sbin/p11sak/p11sak.c
447573
+++ b/usr/sbin/p11sak/p11sak.c
447573
@@ -1843,6 +1843,12 @@ static CK_RV check_args_gen_key(p11sak_kt *kt, CK_ULONG keylength,
447573
     case kt_3DES:
447573
         break;
447573
     case kt_IBM_DILITHIUM:
447573
+        if (dilithium_ver == NULL) {
447573
+            fprintf(stderr,
447573
+                    "Cipher key type [%d] supported but Dilithium version not set in arguments. Try adding argument <r2_65>\n",
447573
+                    *kt);
447573
+            return CKR_ARGUMENTS_BAD;
447573
+        }
447573
         if (strcasecmp(dilithium_ver, "r2_65") == 0) {
447573
             break;
447573
         } else {
447573
-- 
447573
2.16.2.windows.1
447573