You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pkcs11-helper/0001-certificate-ignore-cer...

47 lines
1.2 KiB

From 8d81cf6b460c0443c64605fe9ab0137c12c1ccba Mon Sep 17 00:00:00 2001
From: Alon Bar-Lev <alon.barlev@gmail.com>
Date: Mon, 30 Dec 2013 20:17:13 +0200
Subject: [PATCH] certificate: ignore certificates without CKA_ID
we won't be able to retrieve them anyway.
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
---
ChangeLog | 1 +
lib/pkcs11h-certificate.c | 19 ++++++++++++++++++-
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/lib/pkcs11h-certificate.c b/lib/pkcs11h-certificate.c
index 086e22d..6eb95e2 100644
--- a/lib/pkcs11h-certificate.c
+++ b/lib/pkcs11h-certificate.c
@@ -2383,7 +2383,24 @@ _pkcs11h_certificate_enumSessionCertificates (
objects[i],
attrs,
sizeof (attrs) / sizeof (CK_ATTRIBUTE)
- )) != CKR_OK ||
+ )) != CKR_OK
+ ) {
+ goto retry1;
+ }
+
+ /*
+ * skip objects without CKA_ID as we
+ * won't be able to retrieve them.
+ */
+ if (
+ attrs[0].pValue == NULL ||
+ attrs[0].ulValueLen == 0
+ ) {
+ rv = CKR_OK;
+ goto retry1;
+ }
+
+ if (
(rv = _pkcs11h_certificate_newCertificateId (&certificate_id)) != CKR_OK ||
(rv = pkcs11h_token_duplicateTokenId (
&certificate_id->token_id,
--
2.1.0