[pkg-opensc-commit] [pkcs11-helper] 113/253: Fix rpm spec file, thanks to Todd Denniston

Eric Dorland eric at moszumanska.debian.org
Fri Jan 6 23:39:10 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 b27cea2da2a53ad08abb98124878831c57a78418
Author: Alon Bar-Lev <alon.barlev at gmail.com>
Date:   Fri Jun 15 17:46:00 2007 +0000

    Fix rpm spec file, thanks to Todd Denniston
---
 configure.ac                     |   8 +-
 distro/rpm/pkcs11-helper.spec.in |   2 +-
 lib/pkcs11h-crypto.c             | 476 ++++++++++++---------------------------
 3 files changed, 149 insertions(+), 337 deletions(-)

diff --git a/configure.ac b/configure.ac
index 4a0fe6c..10e846e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -258,7 +258,7 @@ fi
 AC_MSG_CHECKING([Win32 crypto engine])
 if test "${WIN32}" = "yes" -a "${enable_crypto_engine_win32}" = "yes"; then
 	AC_MSG_RESULT([yes])
-	AC_DEFINE([ENABLE_PKCS11H_ENGINE_WIN32], [1], [Use win32 crypto engine])
+	AC_DEFINE([ENABLE_PKCS11H_ENGINE_WIN32], [1], [Enable win32 crypto engine])
 else
 	AC_MSG_RESULT([no])
 fi
@@ -267,7 +267,7 @@ AC_MSG_CHECKING([OpenSSL crypto engine])
 if test "${enable_crypto_engine_openssl}" = "yes"; then
 	if test "${have_openssl}" = "yes"; then
 		AC_MSG_RESULT([yes])
-		AC_DEFINE([ENABLE_PKCS11H_ENGINE_OPENSSL], [1], [Use OpenSSL crypto engine])
+		AC_DEFINE([ENABLE_PKCS11H_ENGINE_OPENSSL], [1], [Enable OpenSSL crypto engine])
 
 		# don't add this twice
 		if test "${enable_openssl}" != "yes"; then
@@ -285,7 +285,7 @@ AC_MSG_CHECKING([GnuTLS crypto engine])
 if test "${enable_crypto_engine_gnutls}" = "yes"; then
 	if test "${have_gnutls}" = "yes"; then
 		AC_MSG_RESULT([yes])
-		AC_DEFINE([ENABLE_PKCS11H_ENGINE_GNUTLS], [1], [Use GnuTLS crypto engine])
+		AC_DEFINE([ENABLE_PKCS11H_ENGINE_GNUTLS], [1], [Enable GnuTLS crypto engine])
 		CFLAGS="${CFLAGS} ${GNUTLS_CFLAGS}"
 		LIBS="${LIBS} ${GNUTLS_LIBS}"
 	else
@@ -299,7 +299,7 @@ AC_MSG_CHECKING([NSS crypto engine])
 if test "${enable_crypto_engine_nss}" = "yes"; then
 	if test "${have_nss}" = "yes"; then
 		AC_MSG_RESULT([yes])
-		AC_DEFINE([ENABLE_PKCS11H_ENGINE_NSS], [1], [Use NSS crypto engine])
+		AC_DEFINE([ENABLE_PKCS11H_ENGINE_NSS], [1], [Enable NSS crypto engine])
 		CFLAGS="${CFLAGS} ${NSS_CFLAGS}"
 		LIBS="${LIBS} ${NSS_LIBS}"
 	else
diff --git a/distro/rpm/pkcs11-helper.spec.in b/distro/rpm/pkcs11-helper.spec.in
index e669bba..0ad57d8 100644
--- a/distro/rpm/pkcs11-helper.spec.in
+++ b/distro/rpm/pkcs11-helper.spec.in
@@ -62,7 +62,7 @@ if [ -d $RPM_BUILD_ROOT ]; then rm -rf $RPM_BUILD_ROOT; fi
 %defattr(-,root,root)
 %{_libdir}/libpkcs11-helper.*
 %{_mandir}/*
-%{_docdir}/%{name}/COPYING.*
+%{_docdir}/%{name}/COPYING*
 %{_docdir}/%{name}/README
 
 %files devel
diff --git a/lib/pkcs11h-crypto.c b/lib/pkcs11h-crypto.c
index 01ebab8..b722f33 100644
--- a/lib/pkcs11h-crypto.c
+++ b/lib/pkcs11h-crypto.c
@@ -116,141 +116,6 @@ typedef const unsigned char *__pkcs11_openssl_d2i_t;
 
 #endif
 
-#if defined(ENABLE_PKCS11H_ENGINE_OPENSSL)
-
-static
-int
-__pkcs11h_crypto_openssl_initialize (
-	IN void * const global_data
-);
-
-static
-int
-__pkcs11h_crypto_openssl_uninitialize (
-	IN void * const global_data
-);
-
-static
-int
-__pkcs11h_crypto_openssl_certificate_get_expiration (
-	IN void * const global_data,
-	IN const unsigned char * const blob,
-	IN const size_t blob_size,
-	OUT time_t * const expiration
-);
-
-static
-int
-__pkcs11h_crypto_openssl_certificate_get_dn (
-	IN void * const global_data,
-	IN const unsigned char * const blob,
-	IN const size_t blob_size,
-	OUT char * const dn,
-	IN const size_t dn_max
-);
-
-static
-int
-__pkcs11h_crypto_openssl_certificate_is_issuer (
-	IN void * const global_data,
-	IN const unsigned char * const signer_blob,
-	IN const size_t signer_blob_size,
-	IN const unsigned char * const cert_blob,
-	IN const size_t cert_blob_size
-);
-
-#endif
-
-#if defined(ENABLE_PKCS11H_ENGINE_GNUTLS)
-
-static
-int
-__pkcs11h_crypto_gnutls_initialize (
-	IN void * const global_data
-);
-
-static
-int
-__pkcs11h_crypto_gnutls_uninitialize (
-	IN void * const global_data
-);
-
-static
-int
-__pkcs11h_crypto_gnutls_certificate_get_expiration (
-	IN void * const global_data,
-	IN const unsigned char * const blob,
-	IN const size_t blob_size,
-	OUT time_t * const expiration
-);
-
-static
-int
-__pkcs11h_crypto_gnutls_certificate_get_dn (
-	IN void * const global_data,
-	IN const unsigned char * const blob,
-	IN const size_t blob_size,
-	OUT char * const dn,
-	IN const size_t dn_max
-);
-
-static
-int
-__pkcs11h_crypto_gnutls_certificate_is_issuer (
-	IN void * const global_data,
-	IN const unsigned char * const signer_blob,
-	IN const size_t signer_blob_size,
-	IN const unsigned char * const cert_blob,
-	IN const size_t cert_blob_size
-);
-
-#endif
-
-#if defined(ENABLE_PKCS11H_ENGINE_NSS)
-
-static
-int
-__pkcs11h_crypto_nss_initialize (
-	IN void * const global_data
-);
-
-static
-int
-__pkcs11h_crypto_nss_uninitialize (
-	IN void * const global_data
-);
-
-static
-int
-__pkcs11h_crypto_nss_certificate_get_expiration (
-	IN void * const global_data,
-	IN const unsigned char * const blob,
-	IN const size_t blob_size,
-	OUT time_t * const expiration
-);
-
-static
-int
-__pkcs11h_crypto_nss_certificate_get_dn (
-	IN void * const global_data,
-	IN const unsigned char * const blob,
-	IN const size_t blob_size,
-	OUT char * const dn,
-	IN const size_t dn_max
-);
-
-static
-int
-__pkcs11h_crypto_nss_certificate_is_issuer (
-	IN void * const global_data,
-	IN const unsigned char * const signer_blob,
-	IN const size_t signer_blob_size,
-	IN const unsigned char * const cert_blob,
-	IN const size_t cert_blob_size
-);
-
-#endif
-
 #if defined(ENABLE_PKCS11H_ENGINE_WIN32)
 
 typedef PCCERT_CONTEXT (WINAPI *__CertCreateCertificateContext_t) (
@@ -287,187 +152,7 @@ typedef struct __crypto_win32_data_s {
 	__CryptVerifyCertificateSignatureEx_t p_CryptVerifyCertificateSignatureEx;
 } *__crypto_win32_data_t;
 
-static
-int
-__pkcs11h_crypto_win32_initialize (
-	IN void * const global_data
-);
-
-static
-int
-__pkcs11h_crypto_win32_uninitialize (
-	IN void * const global_data
-);
-
-static
-int
-__pkcs11h_crypto_win32_certificate_get_expiration (
-	IN void * const global_data,
-	IN const unsigned char * const blob,
-	IN const size_t blob_size,
-	OUT time_t * const expiration
-);
-
-static
-int
-__pkcs11h_crypto_win32_certificate_get_dn (
-	IN void * const global_data,
-	IN const unsigned char * const blob,
-	IN const size_t blob_size,
-	OUT char * const dn,
-	IN const size_t dn_max
-);
-
-static
-int
-__pkcs11h_crypto_win32_certificate_is_issuer (
-	IN void * const global_data,
-	IN const unsigned char * const signer_blob,
-	IN const size_t signer_blob_size,
-	IN const unsigned char * const cert_blob,
-	IN const size_t cert_blob_size
-);
-
-#endif
-
-#if defined(ENABLE_PKCS11H_ENGINE_OPENSSL)
-static const pkcs11h_engine_crypto_t _g_pkcs11h_crypto_engine_openssl = {
-	NULL,
-	__pkcs11h_crypto_openssl_initialize,
-	__pkcs11h_crypto_openssl_uninitialize,
-	__pkcs11h_crypto_openssl_certificate_get_expiration,
-	__pkcs11h_crypto_openssl_certificate_get_dn,
-	__pkcs11h_crypto_openssl_certificate_is_issuer
-};
-#endif
-#if defined(ENABLE_PKCS11H_ENGINE_GNUTLS)
-static const pkcs11h_engine_crypto_t _g_pkcs11h_crypto_engine_gnutls = {
-	NULL,
-	__pkcs11h_crypto_gnutls_initialize,
-	__pkcs11h_crypto_gnutls_uninitialize,
-	__pkcs11h_crypto_gnutls_certificate_get_expiration,
-	__pkcs11h_crypto_gnutls_certificate_get_dn,
-	__pkcs11h_crypto_gnutls_certificate_is_issuer
-};
-#endif
-#if defined(ENABLE_PKCS11H_ENGINE_NSS)
-static int s_nss_data = 0;
-static const pkcs11h_engine_crypto_t _g_pkcs11h_crypto_engine_nss = {
-	&s_nss_data,
-	__pkcs11h_crypto_nss_initialize,
-	__pkcs11h_crypto_nss_uninitialize,
-	__pkcs11h_crypto_nss_certificate_get_expiration,
-	__pkcs11h_crypto_nss_certificate_get_dn,
-	__pkcs11h_crypto_nss_certificate_is_issuer
-};
-#endif
-#if defined(ENABLE_PKCS11H_ENGINE_WIN32)
-static struct __crypto_win32_data_s s_win32_data = { NULL };
-static const pkcs11h_engine_crypto_t _g_pkcs11h_crypto_engine_win32 = {
-	&s_win32_data,
-	__pkcs11h_crypto_win32_initialize,
-	__pkcs11h_crypto_win32_uninitialize,
-	__pkcs11h_crypto_win32_certificate_get_expiration,
-	__pkcs11h_crypto_win32_certificate_get_dn,
-	__pkcs11h_crypto_win32_certificate_is_issuer
-};
-#endif
-
-pkcs11h_engine_crypto_t _g_pkcs11h_crypto_engine = {
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	NULL
-};
-
-CK_RV
-pkcs11h_engine_setCrypto (
-	IN const pkcs11h_engine_crypto_t * const engine
-) {
-	const pkcs11h_engine_crypto_t *_engine = NULL;
-	CK_RV rv = CKR_FUNCTION_FAILED;
-
-	/*_PKCS11H_ASSERT (engine!=NULL); Not required */
-
-	if (engine == PKCS11H_ENGINE_CRYPTO_AUTO) {
-#if defined(ENABLE_PKCS11H_ENGINE_WIN32)
-		_engine = &_g_pkcs11h_crypto_engine_win32;
-#elif defined(ENABLE_PKCS11H_ENGINE_OPENSSL)
-		_engine = &_g_pkcs11h_crypto_engine_openssl;
-#elif defined(ENABLE_PKCS11H_ENGINE_NSS)
-		_engine = &_g_pkcs11h_crypto_engine_nss;
-#elif defined(ENABLE_PKCS11H_ENGINE_GNUTLS)
-		_engine = &_g_pkcs11h_crypto_engine_gnutls;
-#else
-		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_ATTRIBUTE_VALUE_INVALID;
-		goto cleanup;
-#endif
-	}
-	else if (engine == PKCS11H_ENGINE_CRYPTO_OPENSSL) {
-#if defined(ENABLE_PKCS11H_ENGINE_OPENSSL)
-		_engine = &_g_pkcs11h_crypto_engine_openssl;
-#else
-		rv = CKR_ATTRIBUTE_VALUE_INVALID;
-		goto cleanup;
-#endif
-	}
-	else if (engine == PKCS11H_ENGINE_CRYPTO_GNUTLS) {
-#if defined(ENABLE_PKCS11H_ENGINE_GNUTLS)
-		_engine = &_g_pkcs11h_crypto_engine_gnutls;
-#else
-		rv = CKR_ATTRIBUTE_VALUE_INVALID;
-		goto cleanup;
-#endif
-	}
-	else if (engine == PKCS11H_ENGINE_CRYPTO_NSS) {
-#if defined(ENABLE_PKCS11H_ENGINE_NSS)
-		_engine = &_g_pkcs11h_crypto_engine_nss;
-#else
-		rv = CKR_ATTRIBUTE_VALUE_INVALID;
-		goto cleanup;
 #endif
-	}
-	else {
-		_engine = engine;
-	}
-
-	memmove (&_g_pkcs11h_crypto_engine, _engine, sizeof (pkcs11h_engine_crypto_t));
-
-	rv = CKR_OK;
-
-cleanup:
-
-	return rv;
-}
 
 #if defined(ENABLE_PKCS11H_ENGINE_OPENSSL)
 
@@ -530,7 +215,6 @@ __pkcs11h_crypto_openssl_certificate_get_expiration (
 				notAfter->length >= 12
 			) {
 				struct tm tm1;
-				time_t now = time (NULL);
 
 				memset (&tm1, 0, sizeof (tm1));
 				tm1.tm_year = (notAfter->data[ 0] - '0') * 10 + (notAfter->data[ 1] - '0') + 100;
@@ -540,9 +224,8 @@ __pkcs11h_crypto_openssl_certificate_get_expiration (
 				tm1.tm_min  = (notAfter->data[ 8] - '0') * 10 + (notAfter->data[ 9] - '0');
 				tm1.tm_sec  = (notAfter->data[10] - '0') * 10 + (notAfter->data[11] - '0');
 
-				tm1.tm_sec += (int)(mktime (localtime (&now)) - mktime (gmtime (&now)));
-
 				*expiration = mktime (&tm1);
+				*expiration += (int)(mktime (localtime (expiration)) - mktime (gmtime (expiration)));
 			}
 		}
 
@@ -677,6 +360,15 @@ cleanup:
 	return is_issuer;
 }
 
+static const pkcs11h_engine_crypto_t _g_pkcs11h_crypto_engine_openssl = {
+	NULL,
+	__pkcs11h_crypto_openssl_initialize,
+	__pkcs11h_crypto_openssl_uninitialize,
+	__pkcs11h_crypto_openssl_certificate_get_expiration,
+	__pkcs11h_crypto_openssl_certificate_get_dn,
+	__pkcs11h_crypto_openssl_certificate_is_issuer
+};
+
 /*======================================================================*
  * FIXUPS
  *======================================================================*/
@@ -892,6 +584,15 @@ cleanup:
 	return is_issuer;
 }
 
+static const pkcs11h_engine_crypto_t _g_pkcs11h_crypto_engine_gnutls = {
+	NULL,
+	__pkcs11h_crypto_gnutls_initialize,
+	__pkcs11h_crypto_gnutls_uninitialize,
+	__pkcs11h_crypto_gnutls_certificate_get_expiration,
+	__pkcs11h_crypto_gnutls_certificate_get_dn,
+	__pkcs11h_crypto_gnutls_certificate_is_issuer
+};
+
 #endif				/* ENABLE_PKCS11H_ENGINE_GNUTLS */
 
 #if defined(ENABLE_PKCS11H_ENGINE_NSS)
@@ -944,8 +645,6 @@ __pkcs11h_crypto_nss_certificate_get_expiration (
 	PRTime pr_notBefore, pr_notAfter;
 	time_t notBefore, notAfter;
 	time_t now = time (NULL);
-	int tm_isdst = localtime (&now)->tm_isdst;
-	struct tm *tm1;
 
 	(void)global_data;
 
@@ -966,12 +665,10 @@ __pkcs11h_crypto_nss_certificate_get_expiration (
 	notBefore = pr_notBefore/1000000;
 	notAfter = pr_notAfter/1000000;
 
-	tm1 = gmtime (&notBefore);
-	tm1->tm_isdst = tm_isdst;
-	notBefore = mktime (tm1);
-	tm1 = gmtime (&notAfter);
-	tm1->tm_isdst = tm_isdst;
-	notAfter = mktime (tm1);
+	notBefore = mktime (gmtime (&notBefore));
+	notBefore += (int)(mktime (localtime (&notBefore)) - mktime (gmtime (&notBefore)));
+	notAfter = mktime (gmtime (&notAfter));
+	notAfter += (int)(mktime (localtime (&notAfter)) - mktime (gmtime (&notAfter)));
 
 	if (
 		now >= notBefore &&
@@ -1074,7 +771,17 @@ cleanup:
 	return is_issuer;
 }
 
-#endif				/* ENABLE_PKCS11H_ENGINE_GNUTLS */
+static int s_nss_data = 0;
+static const pkcs11h_engine_crypto_t _g_pkcs11h_crypto_engine_nss = {
+	&s_nss_data,
+	__pkcs11h_crypto_nss_initialize,
+	__pkcs11h_crypto_nss_uninitialize,
+	__pkcs11h_crypto_nss_certificate_get_expiration,
+	__pkcs11h_crypto_nss_certificate_get_dn,
+	__pkcs11h_crypto_nss_certificate_is_issuer
+};
+
+#endif				/* ENABLE_PKCS11H_ENGINE_NSS */
 
 #if defined(ENABLE_PKCS11H_ENGINE_WIN32)
 
@@ -1154,8 +861,7 @@ __pkcs11h_crypto_win32_certificate_get_expiration (
 	__crypto_win32_data_t data = (__crypto_win32_data_t)global_data;
 	PCCERT_CONTEXT cert = NULL;
 	PKCS11H_BOOL ok = FALSE;
-	time_t now = time (NULL);
-	SYSTEMTIME st;
+	SYSTEMTIME ust, st;
 	struct tm tm1;
 
 	_PKCS11H_ASSERT (global_data!=NULL);
@@ -1172,12 +878,13 @@ __pkcs11h_crypto_win32_certificate_get_expiration (
 		)) == NULL ||
 		!FileTimeToSystemTime (
 			&cert->pCertInfo->NotAfter,
-			&st
+			&ust
 		)
 	) {
 		goto cleanup;
 	}
 
+	SystemTimeToTzSpecificLocalTime (NULL, &ust, &st);
 	memset (&tm1, 0, sizeof (tm1));
 	tm1.tm_year = st.wYear - 1900;
 	tm1.tm_mon  = st.wMonth - 1;
@@ -1186,8 +893,6 @@ __pkcs11h_crypto_win32_certificate_get_expiration (
 	tm1.tm_min  = st.wMinute;
 	tm1.tm_sec  = st.wSecond;
 
-	tm1.tm_sec += (int)(mktime (localtime (&now)) - mktime (gmtime (&now)));
-
 	*expiration = mktime (&tm1);
 
 	ok = TRUE;
@@ -1347,4 +1052,111 @@ cleanup:
 	return issuer != FALSE;
 }
 
+static struct __crypto_win32_data_s s_win32_data = { NULL };
+static const pkcs11h_engine_crypto_t _g_pkcs11h_crypto_engine_win32 = {
+	&s_win32_data,
+	__pkcs11h_crypto_win32_initialize,
+	__pkcs11h_crypto_win32_uninitialize,
+	__pkcs11h_crypto_win32_certificate_get_expiration,
+	__pkcs11h_crypto_win32_certificate_get_dn,
+	__pkcs11h_crypto_win32_certificate_is_issuer
+};
+
 #endif				/* ENABLE_PKCS11H_ENGINE_WIN32 */
+
+pkcs11h_engine_crypto_t _g_pkcs11h_crypto_engine = {
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	NULL
+};
+
+CK_RV
+pkcs11h_engine_setCrypto (
+	IN const pkcs11h_engine_crypto_t * const engine
+) {
+	const pkcs11h_engine_crypto_t *_engine = NULL;
+	CK_RV rv = CKR_FUNCTION_FAILED;
+
+	/*_PKCS11H_ASSERT (engine!=NULL); Not required */
+
+	if (engine == PKCS11H_ENGINE_CRYPTO_AUTO) {
+#if defined(ENABLE_PKCS11H_ENGINE_WIN32)
+		_engine = &_g_pkcs11h_crypto_engine_win32;
+#elif defined(ENABLE_PKCS11H_ENGINE_OPENSSL)
+		_engine = &_g_pkcs11h_crypto_engine_openssl;
+#elif defined(ENABLE_PKCS11H_ENGINE_NSS)
+		_engine = &_g_pkcs11h_crypto_engine_nss;
+#elif defined(ENABLE_PKCS11H_ENGINE_GNUTLS)
+		_engine = &_g_pkcs11h_crypto_engine_gnutls;
+#else
+		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_ATTRIBUTE_VALUE_INVALID;
+		goto cleanup;
+#endif
+	}
+	else if (engine == PKCS11H_ENGINE_CRYPTO_OPENSSL) {
+#if defined(ENABLE_PKCS11H_ENGINE_OPENSSL)
+		_engine = &_g_pkcs11h_crypto_engine_openssl;
+#else
+		rv = CKR_ATTRIBUTE_VALUE_INVALID;
+		goto cleanup;
+#endif
+	}
+	else if (engine == PKCS11H_ENGINE_CRYPTO_GNUTLS) {
+#if defined(ENABLE_PKCS11H_ENGINE_GNUTLS)
+		_engine = &_g_pkcs11h_crypto_engine_gnutls;
+#else
+		rv = CKR_ATTRIBUTE_VALUE_INVALID;
+		goto cleanup;
+#endif
+	}
+	else if (engine == PKCS11H_ENGINE_CRYPTO_NSS) {
+#if defined(ENABLE_PKCS11H_ENGINE_NSS)
+		_engine = &_g_pkcs11h_crypto_engine_nss;
+#else
+		rv = CKR_ATTRIBUTE_VALUE_INVALID;
+		goto cleanup;
+#endif
+	}
+	else {
+		_engine = engine;
+	}
+
+	memmove (&_g_pkcs11h_crypto_engine, _engine, sizeof (pkcs11h_engine_crypto_t));
+
+	rv = CKR_OK;
+
+cleanup:
+
+	return rv;
+}
+

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