Blame SOURCES/0011-EP11-remove-dead-code-and-unused-variables.patch

447573
From ee3464dff7536c98fd64c80d87c765f703dff0f0 Mon Sep 17 00:00:00 2001
447573
From: Ingo Franzki <ifranzki@linux.ibm.com>
447573
Date: Fri, 18 Nov 2022 10:44:56 +0100
447573
Subject: [PATCH 11/34] EP11: remove dead code and unused variables
447573
447573
Some variables are declared and initialized to NULL, but never used or set.
447573
The attempt to free them at the end of the function is dead code.
447573
447573
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
447573
---
447573
 usr/lib/ep11_stdll/ep11_specific.c | 28 ----------------------------
447573
 1 file changed, 28 deletions(-)
447573
447573
diff --git a/usr/lib/ep11_stdll/ep11_specific.c b/usr/lib/ep11_stdll/ep11_specific.c
447573
index 9e320503..1dbfe0f5 100644
447573
--- a/usr/lib/ep11_stdll/ep11_specific.c
447573
+++ b/usr/lib/ep11_stdll/ep11_specific.c
447573
@@ -3575,7 +3575,6 @@ static CK_RV import_IBM_Dilithium_key(STDLL_TokData_t *tokdata, SESSION *sess,
447573
     unsigned char *ep11_pin_blob = NULL;
447573
     CK_ULONG ep11_pin_blob_len = 0;
447573
     ep11_session_t *ep11_session = (ep11_session_t *) sess->private_data;
447573
-    CK_BYTE *pubkey = NULL;
447573
 
447573
     memcpy(iv, "1234567812345678", AES_BLOCK_SIZE);
447573
 
447573
@@ -3734,9 +3733,6 @@ static CK_RV import_IBM_Dilithium_key(STDLL_TokData_t *tokdata, SESSION *sess,
447573
     }
447573
 
447573
 done:
447573
-
447573
-    if (pubkey)
447573
-        free(pubkey);
447573
     if (data) {
447573
         OPENSSL_cleanse(data, data_len);
447573
         free(data);
447573
@@ -5486,7 +5482,6 @@ static CK_RV dh_generate_keypair(STDLL_TokData_t *tokdata,
447573
     CK_ATTRIBUTE *opaque_attr = NULL;
447573
     CK_ATTRIBUTE *value_attr = NULL;
447573
     CK_ATTRIBUTE *attr = NULL;
447573
-    CK_ATTRIBUTE *pPublicKeyTemplate_new = NULL;
447573
     CK_ATTRIBUTE_PTR dh_pPublicKeyTemplate = NULL;
447573
     CK_ULONG dh_ulPublicKeyAttributeCount = 0;
447573
     CK_ATTRIBUTE_PTR dh_pPrivateKeyTemplate = NULL;
447573
@@ -5746,7 +5741,6 @@ static CK_RV dh_generate_keypair(STDLL_TokData_t *tokdata,
447573
     }
447573
 
447573
 dh_generate_keypair_end:
447573
-    free(pPublicKeyTemplate_new);
447573
     if (dh_pgs.pg != NULL)
447573
         free(dh_pgs.pg);
447573
     if (dh_pPublicKeyTemplate)
447573
@@ -5778,7 +5772,6 @@ static CK_RV dsa_generate_keypair(STDLL_TokData_t *tokdata,
447573
     CK_ATTRIBUTE *opaque_attr = NULL;
447573
     CK_ATTRIBUTE *value_attr = NULL;
447573
     CK_ATTRIBUTE *attr = NULL;
447573
-    CK_ATTRIBUTE *pPublicKeyTemplate_new = NULL;
447573
     CK_BYTE *key;
447573
     CK_BYTE *data, *oid, *parm;
447573
     CK_ULONG data_len, field_len, bit_str_len, oid_len, parm_len;
447573
@@ -6047,7 +6040,6 @@ static CK_RV dsa_generate_keypair(STDLL_TokData_t *tokdata,
447573
     }
447573
 
447573
 dsa_generate_keypair_end:
447573
-    free(pPublicKeyTemplate_new);
447573
     if (dsa_pqgs.pqg != NULL)
447573
         free(dsa_pqgs.pqg);
447573
     if (dsa_pPublicKeyTemplate)
447573
@@ -6080,10 +6072,6 @@ static CK_RV rsa_ec_generate_keypair(STDLL_TokData_t *tokdata,
447573
     CK_BYTE *data, *oid, *parm;
447573
     CK_ULONG data_len, oid_len, parm_len;
447573
     CK_ULONG field_len;
447573
-    CK_ATTRIBUTE_PTR new_pPublicKeyTemplate = NULL;
447573
-    CK_ULONG new_ulPublicKeyAttributeCount = 0;
447573
-    CK_ATTRIBUTE_PTR new_pPrivateKeyTemplate = NULL;
447573
-    CK_ULONG new_ulPrivateKeyAttributeCount = 0;
447573
     CK_ULONG ktype;
447573
     unsigned char *ep11_pin_blob = NULL;
447573
     CK_ULONG ep11_pin_blob_len = 0;
447573
@@ -6399,12 +6387,6 @@ static CK_RV rsa_ec_generate_keypair(STDLL_TokData_t *tokdata,
447573
     }
447573
 
447573
 error:
447573
-    if (new_pPrivateKeyTemplate)
447573
-        free_attribute_array(new_pPrivateKeyTemplate,
447573
-                             new_ulPrivateKeyAttributeCount);
447573
-    if (new_pPublicKeyTemplate)
447573
-        free_attribute_array(new_pPublicKeyTemplate,
447573
-                             new_ulPublicKeyAttributeCount);
447573
     if (new_publ_attrs)
447573
         free_attribute_array(new_publ_attrs, new_publ_attrs_len);
447573
     if (new_priv_attrs)
447573
@@ -6432,10 +6414,6 @@ static CK_RV ibm_dilithium_generate_keypair(STDLL_TokData_t *tokdata,
447573
     CK_BYTE *data, *oid, *parm;
447573
     CK_ULONG data_len, oid_len, parm_len;
447573
     CK_ULONG field_len;
447573
-    CK_ATTRIBUTE_PTR new_pPublicKeyTemplate = NULL;
447573
-    CK_ULONG new_ulPublicKeyAttributeCount = 0;
447573
-    CK_ATTRIBUTE_PTR new_pPrivateKeyTemplate = NULL;
447573
-    CK_ULONG new_ulPrivateKeyAttributeCount = 0;
447573
     CK_ULONG ktype = CKK_IBM_PQC_DILITHIUM;
447573
     unsigned char *ep11_pin_blob = NULL;
447573
     CK_ULONG ep11_pin_blob_len = 0;
447573
@@ -6679,12 +6657,6 @@ static CK_RV ibm_dilithium_generate_keypair(STDLL_TokData_t *tokdata,
447573
     }
447573
 
447573
 error:
447573
-    if (new_pPrivateKeyTemplate)
447573
-        free_attribute_array(new_pPrivateKeyTemplate,
447573
-                             new_ulPrivateKeyAttributeCount);
447573
-    if (new_pPublicKeyTemplate)
447573
-        free_attribute_array(new_pPublicKeyTemplate,
447573
-                             new_ulPublicKeyAttributeCount);
447573
     if (new_publ_attrs)
447573
         free_attribute_array(new_publ_attrs, new_publ_attrs_len);
447573
     if (new_priv_attrs)
447573
-- 
447573
2.16.2.windows.1
447573