[pkg-opensc-commit] [pkcs11-helper] 18/253: More unwrap fixes

Eric Dorland eric at moszumanska.debian.org
Fri Jan 6 23:39:00 UTC 2017


This is an automated email from the git hooks/post-receive script.

eric pushed a commit to branch master
in repository pkcs11-helper.

commit 575093c83c1cfb46338254fa26b075f856b1da09
Author: Alon Bar-Lev <alon.barlev at gmail.com>
Date:   Wed Nov 29 06:32:55 2006 +0000

    More unwrap fixes
---
 lib/pkcs11h-certificate.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/lib/pkcs11h-certificate.c b/lib/pkcs11h-certificate.c
index 8613082..f3e0095 100644
--- a/lib/pkcs11h-certificate.c
+++ b/lib/pkcs11h-certificate.c
@@ -784,11 +784,13 @@ __pkcs11h_certificate_doPrivateOperation (
 	};
 
 	CK_BBOOL wrap_attrs_false = CK_FALSE;
+	CK_BBOOL wrap_attrs_true = CK_TRUE;
 	CK_OBJECT_CLASS class = CKO_SECRET_KEY;
 	CK_KEY_TYPE keytype = CKK_GENERIC_SECRET;
 	CK_ATTRIBUTE wrap_attrs[] = {
 		{CKA_CLASS, &class, sizeof (class)}, 
-		{CKA_KEY_TYPE, &keytype, sizeof (keytype)}
+		{CKA_KEY_TYPE, &keytype, sizeof (keytype)},
+		{CKA_EXTRACTABLE, &wrap_attrs_true, sizeof (wrap_attrs_true)}
 /* OpenSC fail!	{CKA_TOKEN, &wrap_attrs_false, sizeof (wrap_attrs_false)} */
 	};
 	CK_ATTRIBUTE wrap_value[] = {
@@ -884,6 +886,11 @@ __pkcs11h_certificate_doPrivateOperation (
 			);
 		}
 
+		/*
+		 * Assume one call operation
+		 */
+		certificate->operation_active = FALSE;
+
 		if (rv == CKR_OK) {
 			CK_ULONG size = *p_target_size;
 
@@ -956,12 +963,11 @@ __pkcs11h_certificate_doPrivateOperation (
 				rv == CKR_OK
 			)
 		) {
-			certificate->operation_active = TRUE;
+			if (op != _pkcs11h_private_op_unwrap) {
+				certificate->operation_active = TRUE;
+			}
 			rv = CKR_OK;
 		}
-		else {
-			certificate->operation_active = FALSE;
-		}
 
 		if (rv == CKR_OK) {
 			op_succeed = TRUE;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opensc/pkcs11-helper.git



More information about the pkg-opensc-commit mailing list