- Rebase to 3.16.0
This commit is contained in:
parent
c05764d844
commit
785153759b
1
.gitignore
vendored
1
.gitignore
vendored
@ -27,3 +27,4 @@ opencryptoki-2.3.1.tar.gz
|
||||
/opencryptoki-3.14.0.tar.gz
|
||||
/opencryptoki-3.15.0.tar.gz
|
||||
/opencryptoki-3.15.1.tar.gz
|
||||
/opencryptoki-3.16.0.tar.gz
|
||||
|
@ -1,118 +0,0 @@
|
||||
diff -up opencryptoki-3.15.1/usr/sbin/p11sak/p11sak.c.orig opencryptoki-3.15.1/usr/sbin/p11sak/p11sak.c
|
||||
--- opencryptoki-3.15.1/usr/sbin/p11sak/p11sak.c.orig 2020-11-26 13:25:41.679655774 +0100
|
||||
+++ opencryptoki-3.15.1/usr/sbin/p11sak/p11sak.c 2020-11-26 13:26:00.170892352 +0100
|
||||
@@ -2192,10 +2192,8 @@ static CK_RV confirm_destroy(char **user
|
||||
while (1){
|
||||
nread = getline(user_input, &buflen, stdin);
|
||||
if (nread == -1) {
|
||||
- printf("User input failed (error code 0x%lX: %s)\n",
|
||||
- rc, p11_get_ckr(rc));
|
||||
- rc = -1;
|
||||
- return rc;
|
||||
+ printf("User input: EOF\n");
|
||||
+ return CKR_CANCEL;
|
||||
}
|
||||
|
||||
if (user_input_ok(*user_input)) {
|
||||
@@ -2210,17 +2208,16 @@ static CK_RV confirm_destroy(char **user
|
||||
return rc;
|
||||
}
|
||||
|
||||
-
|
||||
static CK_RV finalize_destroy_object(char *label, CK_SESSION_HANDLE *session,
|
||||
- CK_OBJECT_HANDLE *hkey)
|
||||
+ CK_OBJECT_HANDLE *hkey, CK_BBOOL *boolDestroyFlag)
|
||||
{
|
||||
char *user_input = NULL;
|
||||
CK_RV rc = CKR_OK;
|
||||
|
||||
rc = confirm_destroy(&user_input, label);
|
||||
if (rc != CKR_OK) {
|
||||
- printf("User input failed (error code 0x%lX: %s)\n",
|
||||
- rc, p11_get_ckr(rc));
|
||||
+ printf("Skip deleting Key. User input %s\n", p11_get_ckr(rc));
|
||||
+ rc = CKR_CANCEL;
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -2232,9 +2229,11 @@ static CK_RV finalize_destroy_object(cha
|
||||
label, rc, p11_get_ckr(rc));
|
||||
goto done;
|
||||
}
|
||||
+ *boolDestroyFlag = CK_TRUE;
|
||||
printf("DONE - Destroy Object with Label: %s\n", label);
|
||||
} else if (strncmp(user_input, "n", 1) == 0) {
|
||||
printf("Skip deleting Key\n");
|
||||
+ *boolDestroyFlag = CK_FALSE;
|
||||
} else {
|
||||
printf("Please just enter (y) for yes or (n) for no.\n");
|
||||
}
|
||||
@@ -2254,6 +2253,8 @@ static CK_RV delete_key(CK_SESSION_HANDL
|
||||
CK_OBJECT_HANDLE hkey;
|
||||
char *keytype = NULL;
|
||||
char *label = NULL;
|
||||
+ CK_BBOOL boolDestroyFlag = CK_FALSE;
|
||||
+ CK_BBOOL boolSkipFlag = CK_FALSE;
|
||||
CK_RV rc = CKR_OK;
|
||||
|
||||
rc = tok_key_list_init(session, kt, label);
|
||||
@@ -2290,6 +2291,7 @@ static CK_RV delete_key(CK_SESSION_HANDL
|
||||
if (*forceAll) {
|
||||
if ((strcmp(rm_label, "") == 0) || (strcmp(rm_label, label) == 0)) {
|
||||
printf("Destroy Object with Label: %s\n", label);
|
||||
+
|
||||
rc = funcs->C_DestroyObject(session, hkey);
|
||||
if (rc != CKR_OK) {
|
||||
printf(
|
||||
@@ -2297,14 +2299,18 @@ static CK_RV delete_key(CK_SESSION_HANDL
|
||||
label, rc, p11_get_ckr(rc));
|
||||
goto done;
|
||||
}
|
||||
- printf("DONE - Destroy Object with Label: %s\n", label);
|
||||
+ boolDestroyFlag = CK_TRUE;
|
||||
}
|
||||
} else {
|
||||
if ((strcmp(rm_label, "") == 0) || (strcmp(rm_label, label) == 0)) {
|
||||
- rc = finalize_destroy_object(label, &session, &hkey);
|
||||
+ rc = finalize_destroy_object(label, &session, &hkey, &boolDestroyFlag);
|
||||
if (rc != CKR_OK) {
|
||||
goto done;
|
||||
}
|
||||
+
|
||||
+ if (!boolDestroyFlag) {
|
||||
+ boolSkipFlag = CK_TRUE;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2321,6 +2327,16 @@ static CK_RV delete_key(CK_SESSION_HANDL
|
||||
|
||||
done:
|
||||
|
||||
+ if (strlen(rm_label) > 0) {
|
||||
+ if (boolDestroyFlag) {
|
||||
+ printf("Object with Label: %s found and destroyed \n", rm_label);
|
||||
+ } else if (boolSkipFlag) {
|
||||
+ printf("Object with Label: %s not deleted\n", rm_label);
|
||||
+ } else if (rc == CKR_OK) {
|
||||
+ printf("Object with Label: %s not found\n", rm_label);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if (rc != CKR_OK) {
|
||||
free(label);
|
||||
free(keytype);
|
||||
@@ -2494,8 +2510,11 @@ int main(int argc, char *argv[])
|
||||
/* Execute command */
|
||||
rc = execute_cmd(session, slot, cmd, kt, keylength, exponent, ECcurve,
|
||||
label, attr_string, long_print, &forceAll);
|
||||
- if (rc != CKR_OK) {
|
||||
- printf("Failed to execute p11sak command (error code 0x%lX: %s)\n", rc,
|
||||
+ if (rc == CKR_CANCEL) {
|
||||
+ printf("Cancel execution: p11sak %s command (error code 0x%lX: %s)\n", cmd2str(cmd), rc,
|
||||
+ p11_get_ckr(rc));
|
||||
+ } else if (rc != CKR_OK) {
|
||||
+ printf("Failed to execute p11sak %s command (error code 0x%lX: %s)\n", cmd2str(cmd), rc,
|
||||
p11_get_ckr(rc));
|
||||
goto done;
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
From f1f176cbb4183bcb8a0f7b4d7f649d84a731dd43 Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Steuer <patrick.steuer@de.ibm.com>
|
||||
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 <patrick.steuer@de.ibm.com>
|
||||
---
|
||||
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) {
|
@ -1,13 +0,0 @@
|
||||
diff -up opencryptoki-3.15.1/usr/include/pkcs11types.h.me opencryptoki-3.15.1/usr/include/pkcs11types.h
|
||||
--- opencryptoki-3.15.1/usr/include/pkcs11types.h.me 2020-11-26 18:33:58.707979547 +0100
|
||||
+++ opencryptoki-3.15.1/usr/include/pkcs11types.h 2020-11-26 18:35:22.428095872 +0100
|
||||
@@ -1483,7 +1483,7 @@ typedef CK_FUNCTION_LIST_3_0_PTR CK_PTR
|
||||
|
||||
typedef struct CK_IBM_FUNCTION_LIST_1_0 CK_IBM_FUNCTION_LIST_1_0;
|
||||
typedef struct CK_IBM_FUNCTION_LIST_1_0 CK_PTR CK_IBM_FUNCTION_LIST_1_0_PTR;
|
||||
-typedef struct CK_IBM_FUNCTION_LIST_1_0_PTR CK_PTR CK_IBM_FUNCTION_LIST_1_0_PTR_PTR;
|
||||
+typedef CK_IBM_FUNCTION_LIST_1_0_PTR CK_PTR CK_IBM_FUNCTION_LIST_1_0_PTR_PTR;
|
||||
|
||||
typedef CK_RV (CK_PTR CK_C_Initialize) (CK_VOID_PTR pReserved);
|
||||
typedef CK_RV (CK_PTR CK_C_Finalize) (CK_VOID_PTR pReserved);
|
||||
diff -up opencryptoki-3.15.1/usr/sbin/pkcstok_migrate/pkcstok_migrate.c.me opencryptoki-3.15.1/usr/sbin/pkcstok_migrate/pkcstok_migrate.c
|
@ -1,7 +1,7 @@
|
||||
Name: opencryptoki
|
||||
Summary: Implementation of the PKCS#11 (Cryptoki) specification v2.11
|
||||
Version: 3.15.1
|
||||
Release: 6%{?dist}
|
||||
Version: 3.16.0
|
||||
Release: 1%{?dist}
|
||||
License: CPL
|
||||
URL: https://github.com/opencryptoki/opencryptoki
|
||||
Source0: https://github.com/opencryptoki/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz
|
||||
@ -15,16 +15,9 @@ Patch1: opencryptoki-3.11.0-lockdir.patch
|
||||
# Use --no-undefined to debug missing symbols
|
||||
#Patch100: %%{name}-3.2-no-undefined.patch
|
||||
|
||||
# upstream fixes
|
||||
# https://github.com/opencryptoki/opencryptoki/commit/eef7049ce857ee5d5ec64e369a10e05e8bb5c4dd
|
||||
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
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: openssl-devel
|
||||
%if 0%{?tmptok}
|
||||
BuildRequires: trousers-devel
|
||||
@ -327,6 +320,9 @@ fi
|
||||
|
||||
|
||||
%changelog
|
||||
* Wed Mar 31 2021 Dan Horák <dan[at]danny.cz> - 3.16.0-1
|
||||
- Rebase to 3.16.0
|
||||
|
||||
* Tue Mar 02 2021 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 3.15.1-6
|
||||
- Rebuilt for updated systemd-rpm-macros
|
||||
See https://pagure.io/fesco/issue/2583.
|
||||
|
2
sources
2
sources
@ -1 +1 @@
|
||||
SHA512 (opencryptoki-3.15.1.tar.gz) = fb1dfba09bd78ed02eab58c86728f0face29513a2940cf1670722aa584ee2da6965304be4359f7bb32279f6531b980403bb873fb1e3d9ad56e5f6b83d6ff22f2
|
||||
SHA512 (opencryptoki-3.16.0.tar.gz) = e7f54653bf8b57f7fb713c03aafe07e44a028d7ca10f68a3049e0353014c379a0c1aeda19329f5da4974cc6f2f7c906f4964586abd682cc867eccecc05f134a4
|
||||
|
Loading…
Reference in New Issue
Block a user