Blob Blame History Raw
From 993274f7b968caa908bdc3bf560ece55e40c875a Mon Sep 17 00:00:00 2001
From: Ingo Franzki <ifranzki@linux.ibm.com>
Date: Fri, 21 Oct 2022 10:03:40 +0200
Subject: [PATCH 03/34] EP11: Do not pass empty CKA_PUBLIC_KEY_INFO to EP11
 host library

Newer EP11 host library versions do not like empty (zero length)
attributes of type CKA_PUBLIC_KEY_INFO. Filter them out when building
the attribute list passed to the EP11 host library

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
---
 usr/lib/ep11_stdll/ep11_specific.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/usr/lib/ep11_stdll/ep11_specific.c b/usr/lib/ep11_stdll/ep11_specific.c
index 737b373b..d3688c56 100644
--- a/usr/lib/ep11_stdll/ep11_specific.c
+++ b/usr/lib/ep11_stdll/ep11_specific.c
@@ -1968,6 +1968,11 @@ static CK_RV build_ep11_attrs(STDLL_TokData_t * tokdata, TEMPLATE *template,
         case CKA_NEVER_EXTRACTABLE:
         case CKA_LOCAL:
             break;
+        /* EP11 does not like empty (zero length) attributes of that types */
+        case CKA_PUBLIC_KEY_INFO:
+            if (attr->ulValueLen == 0)
+                break;
+            /* Fallthrough */
         default:
             if (attr->ulValueLen > 0 && attr->pValue == NULL)
                 return CKR_ATTRIBUTE_VALUE_INVALID;
-- 
2.16.2.windows.1