Blame SOURCES/0003-EP11-Do-not-pass-empty-CKA_PUBLIC_KEY_INFO-to-EP11-h.patch

1f6f0c
From 993274f7b968caa908bdc3bf560ece55e40c875a Mon Sep 17 00:00:00 2001
1f6f0c
From: Ingo Franzki <ifranzki@linux.ibm.com>
1f6f0c
Date: Fri, 21 Oct 2022 10:03:40 +0200
1f6f0c
Subject: [PATCH 03/34] EP11: Do not pass empty CKA_PUBLIC_KEY_INFO to EP11
1f6f0c
 host library
1f6f0c
1f6f0c
Newer EP11 host library versions do not like empty (zero length)
1f6f0c
attributes of type CKA_PUBLIC_KEY_INFO. Filter them out when building
1f6f0c
the attribute list passed to the EP11 host library
1f6f0c
1f6f0c
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
1f6f0c
---
1f6f0c
 usr/lib/ep11_stdll/ep11_specific.c | 5 +++++
1f6f0c
 1 file changed, 5 insertions(+)
1f6f0c
1f6f0c
diff --git a/usr/lib/ep11_stdll/ep11_specific.c b/usr/lib/ep11_stdll/ep11_specific.c
1f6f0c
index 737b373b..d3688c56 100644
1f6f0c
--- a/usr/lib/ep11_stdll/ep11_specific.c
1f6f0c
+++ b/usr/lib/ep11_stdll/ep11_specific.c
1f6f0c
@@ -1968,6 +1968,11 @@ static CK_RV build_ep11_attrs(STDLL_TokData_t * tokdata, TEMPLATE *template,
1f6f0c
         case CKA_NEVER_EXTRACTABLE:
1f6f0c
         case CKA_LOCAL:
1f6f0c
             break;
1f6f0c
+        /* EP11 does not like empty (zero length) attributes of that types */
1f6f0c
+        case CKA_PUBLIC_KEY_INFO:
1f6f0c
+            if (attr->ulValueLen == 0)
1f6f0c
+                break;
1f6f0c
+            /* Fallthrough */
1f6f0c
         default:
1f6f0c
             if (attr->ulValueLen > 0 && attr->pValue == NULL)
1f6f0c
                 return CKR_ATTRIBUTE_VALUE_INVALID;
1f6f0c
-- 
1f6f0c
2.16.2.windows.1
1f6f0c