|
|
76fb5c |
From 6b36a341c372f3dcec13c5ddee52fdb907a255a9 Mon Sep 17 00:00:00 2001
|
|
|
76fb5c |
From: Jakub Jelen <jjelen@redhat.com>
|
|
|
76fb5c |
Date: Wed, 12 Apr 2017 17:42:54 +0200
|
|
|
76fb5c |
Subject: [PATCH 1/2] Make sure the lock is released when returning
|
|
|
76fb5c |
|
|
|
76fb5c |
---
|
|
|
76fb5c |
src/pkcs11/framework-pkcs15.c | 12 ++++++++----
|
|
|
76fb5c |
1 file changed, 8 insertions(+), 4 deletions(-)
|
|
|
76fb5c |
|
|
|
76fb5c |
diff --git a/src/pkcs11/framework-pkcs15.c b/src/pkcs11/framework-pkcs15.c
|
|
|
76fb5c |
index 2f78a63..3441b99 100644
|
|
|
76fb5c |
--- a/src/pkcs11/framework-pkcs15.c
|
|
|
76fb5c |
+++ b/src/pkcs11/framework-pkcs15.c
|
|
|
76fb5c |
@@ -487,12 +487,16 @@ CK_RV C_GetTokenInfo(CK_SLOT_ID slotID, CK_TOKEN_INFO_PTR pInfo)
|
|
|
76fb5c |
goto out;
|
|
|
76fb5c |
}
|
|
|
76fb5c |
|
|
|
76fb5c |
- if (slot->p11card == NULL)
|
|
|
76fb5c |
- return CKR_TOKEN_NOT_PRESENT;
|
|
|
76fb5c |
+ if (slot->p11card == NULL) {
|
|
|
76fb5c |
+ rv = CKR_TOKEN_NOT_PRESENT;
|
|
|
76fb5c |
+ goto out;
|
|
|
76fb5c |
+ }
|
|
|
76fb5c |
|
|
|
76fb5c |
fw_data = (struct pkcs15_fw_data *) slot->p11card->fws_data[slot->fw_data_idx];
|
|
|
76fb5c |
- if (!fw_data)
|
|
|
76fb5c |
- return sc_to_cryptoki_error(SC_ERROR_INTERNAL, "C_GetTokenInfo");
|
|
|
76fb5c |
+ if (!fw_data) {
|
|
|
76fb5c |
+ rv = sc_to_cryptoki_error(SC_ERROR_INTERNAL, "C_GetTokenInfo");
|
|
|
76fb5c |
+ goto out;
|
|
|
76fb5c |
+ }
|
|
|
76fb5c |
p15card = fw_data->p15_card;
|
|
|
76fb5c |
|
|
|
76fb5c |
/* User PIN flags are cleared before re-calculation */
|
|
|
76fb5c |
|
|
|
76fb5c |
From 8e8f0ffdcc959f9dd7ea9036aea887917e961bd1 Mon Sep 17 00:00:00 2001
|
|
|
76fb5c |
From: Jakub Jelen <jjelen@redhat.com>
|
|
|
76fb5c |
Date: Wed, 12 Apr 2017 17:43:32 +0200
|
|
|
76fb5c |
Subject: [PATCH 2/2] pkcs11-tool: Do not use unitialized data when
|
|
|
76fb5c |
C_GetTokenInfo() failed
|
|
|
76fb5c |
|
|
|
76fb5c |
---
|
|
|
76fb5c |
src/tools/pkcs11-tool.c | 3 +++
|
|
|
76fb5c |
1 file changed, 3 insertions(+)
|
|
|
76fb5c |
|
|
|
76fb5c |
diff --git a/src/tools/pkcs11-tool.c b/src/tools/pkcs11-tool.c
|
|
|
76fb5c |
index ef5d2a6..555029d 100644
|
|
|
76fb5c |
--- a/src/tools/pkcs11-tool.c
|
|
|
76fb5c |
+++ b/src/tools/pkcs11-tool.c
|
|
|
76fb5c |
@@ -1105,6 +1105,9 @@ static void show_token(CK_SLOT_ID slot)
|
|
|
76fb5c |
if (rv == CKR_TOKEN_NOT_RECOGNIZED) {
|
|
|
76fb5c |
printf(" (token not recognized)\n");
|
|
|
76fb5c |
return;
|
|
|
76fb5c |
+ } else if (rv != CKR_OK) {
|
|
|
76fb5c |
+ printf("C_GetTokenInfo() failed: rv = %s\n", CKR2Str(rv));
|
|
|
76fb5c |
+ return;
|
|
|
76fb5c |
}
|
|
|
76fb5c |
if (!(info.flags & CKF_TOKEN_INITIALIZED) && (!verbose)) {
|
|
|
76fb5c |
printf(" token state: uninitialized\n");
|