[pkg-opensc-commit] [pkcs11-helper] 103/253: Allow GPL engine selection

Eric Dorland eric at moszumanska.debian.org
Fri Jan 6 23:39:09 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 14a612e768b308381a09d9a9eb26d3825bb4f181
Author: Alon Bar-Lev <alon.barlev at gmail.com>
Date:   Tue May 15 14:28:59 2007 +0000

    Allow GPL engine selection
---
 include/pkcs11-helper-1.0/pkcs11h-engines.h |  2 ++
 lib/pkcs11h-crypto.c                        | 27 +++++++++++++++++++++++----
 2 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/include/pkcs11-helper-1.0/pkcs11h-engines.h b/include/pkcs11-helper-1.0/pkcs11h-engines.h
index 5960ce9..0360f81 100644
--- a/include/pkcs11-helper-1.0/pkcs11h-engines.h
+++ b/include/pkcs11-helper-1.0/pkcs11h-engines.h
@@ -206,6 +206,8 @@ typedef struct pkcs11h_crypto_engine_s {
 #define PKCS11H_ENGINE_CRYPTO_GNUTLS	((pkcs11h_engine_crypto_t *)2)
 /** Select Win32. */
 #define PKCS11H_ENGINE_CRYPTO_WIN32	((pkcs11h_engine_crypto_t *)3)
+/** Auto select GPL enigne. */
+#define PKCS11H_ENGINE_CRYPTO_GPL	((pkcs11h_engine_crypto_t *)10)
 /** @} */
 
 /**
diff --git a/lib/pkcs11h-crypto.c b/lib/pkcs11h-crypto.c
index 267d789..8b521c9 100644
--- a/lib/pkcs11h-crypto.c
+++ b/lib/pkcs11h-crypto.c
@@ -337,15 +337,34 @@ pkcs11h_engine_setCrypto (
 #elif defined(ENABLE_PKCS11H_ENGINE_GNUTLS)
 		_engine = &_g_pkcs11h_crypto_engine_gnutls;
 #else
-		rv = CKR_FUNCTION_FAILED;
+		rv = CKR_ATTRIBUTE_VALUE_INVALID;
 		goto cleanup;
 #endif
 	}
+	else if (engine ==  PKCS11H_ENGINE_CRYPTO_GPL) {
+#if defined(_WIN32)
+#if defined(ENABLE_PKCS11H_ENGINE_WIN32)
+		_engine = &_g_pkcs11h_crypto_engine_win32;
+#elif defined(ENABLE_PKCS11H_ENGINE_GNUTLS)
+		_engine = &_g_pkcs11h_crypto_engine_gnutls;
+#else
+		rv = CKR_ATTRIBUTE_VALUE_INVALID;
+		goto cleanup;
+#endif
+#else
+#if defined(ENABLE_PKCS11H_ENGINE_GNUTLS)
+		_engine = &_g_pkcs11h_crypto_engine_gnutls;
+#else
+		rv = CKR_ATTRIBUTE_VALUE_INVALID;
+		goto cleanup;
+#endif
+#endif
+	}
 	else if (engine == PKCS11H_ENGINE_CRYPTO_WIN32) {
 #if defined(ENABLE_PKCS11H_ENGINE_WIN32)
 		_engine = &_g_pkcs11h_crypto_engine_win32;
 #else
-		rv = CKR_FUNCTION_FAILED;
+		rv = CKR_ATTRIBUTE_VALUE_INVALID;
 		goto cleanup;
 #endif
 	}
@@ -353,7 +372,7 @@ pkcs11h_engine_setCrypto (
 #if defined(ENABLE_PKCS11H_ENGINE_OPENSSL)
 		_engine = &_g_pkcs11h_crypto_engine_openssl;
 #else
-		rv = CKR_FUNCTION_FAILED;
+		rv = CKR_ATTRIBUTE_VALUE_INVALID;
 		goto cleanup;
 #endif
 	}
@@ -361,7 +380,7 @@ pkcs11h_engine_setCrypto (
 #if defined(ENABLE_PKCS11H_ENGINE_GNUTLS)
 		_engine = &_g_pkcs11h_crypto_engine_gnutls;
 #else
-		rv = CKR_FUNCTION_FAILED;
+		rv = CKR_ATTRIBUTE_VALUE_INVALID;
 		goto cleanup;
 #endif
 	}

-- 
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