From 580c4f77e279d75ddaaa218bd9285fbf65d7786a Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Fri, 12 Feb 2021 12:14:15 +0100 Subject: [PATCH] Added upstream patch, a slot ID has nothing to do with the number of slots --- ...76cbb4183bcb8a0f7b4d7f649d84a731dd43.patch | 42 +++++++++++++++++++ opencryptoki.spec | 7 +++- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 opencryptoki-3.15.1-f1f176cbb4183bcb8a0f7b4d7f649d84a731dd43.patch diff --git a/opencryptoki-3.15.1-f1f176cbb4183bcb8a0f7b4d7f649d84a731dd43.patch b/opencryptoki-3.15.1-f1f176cbb4183bcb8a0f7b4d7f649d84a731dd43.patch new file mode 100644 index 0000000..c1668ad --- /dev/null +++ b/opencryptoki-3.15.1-f1f176cbb4183bcb8a0f7b4d7f649d84a731dd43.patch @@ -0,0 +1,42 @@ +From f1f176cbb4183bcb8a0f7b4d7f649d84a731dd43 Mon Sep 17 00:00:00 2001 +From: Patrick Steuer +Date: Tue, 19 Jan 2021 14:29:57 +0100 +Subject: [PATCH] A slot ID has nothing to do with the number of slots + +Signed-off-by: Patrick Steuer +--- + usr/sbin/pkcscca/pkcscca.c | 14 -------------- + 1 file changed, 14 deletions(-) + +diff --git a/usr/sbin/pkcscca/pkcscca.c b/usr/sbin/pkcscca/pkcscca.c +index f268f1be..d0bb3160 100644 +--- a/usr/sbin/pkcscca/pkcscca.c ++++ b/usr/sbin/pkcscca/pkcscca.c +@@ -1980,7 +1980,6 @@ int migrate_wrapped_keys(CK_SLOT_ID slot_id, char *userpin, int masterkey) + { + CK_FUNCTION_LIST *funcs; + CK_KEY_TYPE key_type = 0; +- CK_ULONG slot_count; + CK_SESSION_HANDLE sess; + CK_RV rv; + struct key_count count = { 0, 0, 0, 0, 0, 0, 0 }; +@@ -1992,19 +1991,6 @@ int migrate_wrapped_keys(CK_SLOT_ID slot_id, char *userpin, int masterkey) + return 2; + } + +- rv = funcs->C_GetSlotList(TRUE, NULL_PTR, &slot_count); +- if (rv != CKR_OK) { +- p11_error("C_GetSlotList", rv); +- exit_code = 3; +- goto finalize; +- } +- +- if (slot_id >= slot_count) { +- print_error("%lu is not a valid slot ID.", slot_id); +- exit_code = 4; +- goto finalize; +- } +- + rv = funcs->C_OpenSession(slot_id, CKF_RW_SESSION | + CKF_SERIAL_SESSION, NULL_PTR, NULL_PTR, &sess); + if (rv != CKR_OK) { diff --git a/opencryptoki.spec b/opencryptoki.spec index 998ac9b..c729d07 100644 --- a/opencryptoki.spec +++ b/opencryptoki.spec @@ -1,7 +1,7 @@ Name: opencryptoki Summary: Implementation of the PKCS#11 (Cryptoki) specification v2.11 Version: 3.15.1 -Release: 4%{?dist} +Release: 5%{?dist} License: CPL URL: https://github.com/opencryptoki/opencryptoki Source0: https://github.com/opencryptoki/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz @@ -20,6 +20,8 @@ Patch1: opencryptoki-3.11.0-lockdir.patch Patch200: opencryptoki-3.15.1-error_message_handling_for_p11sak_remove-key_command.patch # https://github.com/opencryptoki/opencryptoki/commit/2d16f003911ceee50967546f4b3c7cac2db9ba86 Patch201: opencryptoki-3.15.1-fix_compiling_with_c++.patch +# https://github.com/opencryptoki/opencryptoki/commit/f1f176cbb4183bcb8a0f7b4d7f649d84a731dd43.patch +Patch202: opencryptoki-3.15.1-f1f176cbb4183bcb8a0f7b4d7f649d84a731dd43.patch Requires(pre): coreutils BuildRequires: gcc @@ -325,6 +327,9 @@ fi %changelog +* Fri Feb 12 2021 Than Ngo - 3.15.1-5 +- Added upstream patch, a slot ID has nothing to do with the number of slots + * Tue Jan 26 2021 Fedora Release Engineering - 3.15.1-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild