[pkg-opensc-commit] [pkcs11-helper] 208/253: rename win32 to cryptoapi

Eric Dorland eric at moszumanska.debian.org
Fri Jan 6 23:39:20 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 31f4647ff7ddac6547a631e7851efba7663ca0fd
Author: Alon Bar-Lev <alon.barlev at gmail.com>
Date:   Mon Oct 24 23:41:28 2011 +0000

    rename win32 to cryptoapi
---
 ChangeLog                                   |  5 +++
 configure.ac                                | 37 ++++++++++++++-------
 include/pkcs11-helper-1.0/pkcs11h-core.h    |  7 +++-
 include/pkcs11-helper-1.0/pkcs11h-engines.h |  7 +++-
 lib/_pkcs11h-crypto-cryptoapi.c             | 50 ++++++++++++++---------------
 lib/_pkcs11h-crypto-gnutls.c                |  2 +-
 lib/_pkcs11h-crypto-nss.c                   |  2 +-
 lib/_pkcs11h-crypto-openssl.c               |  2 +-
 lib/_pkcs11h-crypto-polarssl.c              |  2 +-
 lib/pkcs11h-crypto.c                        | 26 +++++++--------
 10 files changed, 85 insertions(+), 55 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 571eb23..341a4ca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,11 @@ $Id$
 ????-??-?? - Version 1.10
 
  * PolarSSL crypto engine by Adriaan de Jong
+ * build: --disable-crypto-engine-win32 renamed to --disable-crypto-engine-cryptoapi 
+ * api: PKCS11H_FEATURE_MASK_ENGINE_CRYPTO_WIN32 renamed to
+   PKCS11H_FEATURE_MASK_ENGINE_CRYPTO_CRYPTOAPI.
+ * api: PKCS11H_ENGINE_CRYPTO_WIN32 renamed to
+   PKCS11H_ENGINE_CRYPTO_CRYPTOAPI
 
 2011-08-16 - Version 1.09
 
diff --git a/configure.ac b/configure.ac
index bd212ec..3115b41 100644
--- a/configure.ac
+++ b/configure.ac
@@ -208,10 +208,10 @@ AC_ARG_ENABLE(
 )
 
 AC_ARG_ENABLE(
-	[crypto-engine-win32],
-	[AS_HELP_STRING([--disable-crypto-engine-win32],[disable win32 native crypto engine on win32 systems])],
+	[crypto-engine-cryptoapi],
+	[AS_HELP_STRING([--disable-crypto-engine-cryptoapi],[disable cryptoapi native crypto engine on windows systems])],
 	,
-	[enable_crypto_engine_win32="yes"]
+	[enable_crypto_engine_cryptoapi="yes"]
 )
 
 AC_ARG_ENABLE(
@@ -358,9 +358,9 @@ else
 fi
 
 AC_MSG_CHECKING([Win32 crypto engine])
-if test "${WIN32}" = "yes" -a "${enable_crypto_engine_win32}" = "yes"; then
+if test "${WIN32}" = "yes" -a "${enable_crypto_engine_cryptoapi}" = "yes"; then
 	AC_MSG_RESULT([yes])
-	AC_DEFINE([ENABLE_PKCS11H_ENGINE_WIN32], [1], [Enable win32 crypto engine])
+	AC_DEFINE([ENABLE_PKCS11H_ENGINE_CRYPTOAPI], [1], [Enable cryptoapi crypto engine])
 else
 	AC_MSG_RESULT([no])
 fi
@@ -470,12 +470,27 @@ if test "${enable_openssl}" = "yes"; then
 	AC_DEFINE([ENABLE_PKCS11H_OPENSSL], [1], [Enable openssl interface])
 	PKCS11H_FEATURES="${PKCS11H_FEATURES} openssl"
 fi
-if test \
-	"${enable_crypto_engine_openssl}" = "yes" -o \
-	"${enable_crypto_engine_gnutls}" = "yes" -o \
-	"${enable_crypto_engine_nss}" = "yes" -o \
-	"${enable_crypto_engine_polarssl}" = "yes" -o \
-	"${enable_crypto_engine_win32}" = "yes"; then
+if test "${enable_crypto_engine_openssl}" = "yes"; then
+	crypto_engine=1
+	PKCS11H_FEATURES="${PKCS11H_FEATURES} engine_crypto_openssl"
+fi
+if test "${enable_crypto_engine_nss}" = "yes"; then
+	crypto_engine=1
+	PKCS11H_FEATURES="${PKCS11H_FEATURES} engine_crypto_nss"
+fi
+if test "${enable_crypto_engine_polarssl}" = "yes"; then
+	crypto_engine=1
+	PKCS11H_FEATURES="${PKCS11H_FEATURES} engine_crypto_polarssl"
+fi
+if test "${enable_crypto_engine_cryptoapi}" = "yes"; then
+	crypto_engine=1
+	PKCS11H_FEATURES="${PKCS11H_FEATURES} engine_crypto_cryptoapi"
+fi
+if test "${enable_crypto_engine_gnutls}" = "yes"; then
+	crypto_engine=1
+	PKCS11H_FEATURES="${PKCS11H_FEATURES} engine_crypto_gnutls"
+fi
+if test -n "${crypto_engine}"; then
 	PKCS11H_FEATURES="${PKCS11H_FEATURES} engine_crypto"
 fi
 
diff --git a/include/pkcs11-helper-1.0/pkcs11h-core.h b/include/pkcs11-helper-1.0/pkcs11h-core.h
index 28f0f2f..2cb445f 100644
--- a/include/pkcs11-helper-1.0/pkcs11h-core.h
+++ b/include/pkcs11-helper-1.0/pkcs11h-core.h
@@ -88,7 +88,12 @@ extern "C" {
 #define PKCS11H_FEATURE_MASK_ENGINE_CRYPTO_OPENSSL	(1<< 0)
 /** Engine GNUTLS is enabled. */
 #define PKCS11H_FEATURE_MASK_ENGINE_CRYPTO_GNUTLS	(1<< 1)
-/** Engine GNUTLS is enabled. */
+/** Engine CryptoAPI is enabled. */
+#define PKCS11H_FEATURE_MASK_ENGINE_CRYPTO_CRYPTOAPI	(1<< 2)
+/**
+ * Engine CryptoAPI is enabled.
+ * @deprecated
+ */
 #define PKCS11H_FEATURE_MASK_ENGINE_CRYPTO_WIN32	(1<< 2)
 /** Debugging (logging) is enabled. */
 #define PKCS11H_FEATURE_MASK_DEBUG			(1<< 3)
diff --git a/include/pkcs11-helper-1.0/pkcs11h-engines.h b/include/pkcs11-helper-1.0/pkcs11h-engines.h
index bd9ba66..415d84b 100644
--- a/include/pkcs11-helper-1.0/pkcs11h-engines.h
+++ b/include/pkcs11-helper-1.0/pkcs11h-engines.h
@@ -204,7 +204,12 @@ typedef struct pkcs11h_crypto_engine_s {
 #define PKCS11H_ENGINE_CRYPTO_OPENSSL	((pkcs11h_engine_crypto_t *)1)
 /** Select GnuTLS. */
 #define PKCS11H_ENGINE_CRYPTO_GNUTLS	((pkcs11h_engine_crypto_t *)2)
-/** Select Win32. */
+/** Select CryptoAPI. */
+#define PKCS11H_ENGINE_CRYPTO_CRYPTOAPI	((pkcs11h_engine_crypto_t *)3)
+/**
+ * Select CryptoAPI.
+ * @deprecated
+ */
 #define PKCS11H_ENGINE_CRYPTO_WIN32	((pkcs11h_engine_crypto_t *)3)
 /** Select NSS. */
 #define PKCS11H_ENGINE_CRYPTO_NSS	((pkcs11h_engine_crypto_t *)4)
diff --git a/lib/_pkcs11h-crypto-cryptoapi.c b/lib/_pkcs11h-crypto-cryptoapi.c
index a28e304..0e9d2a0 100644
--- a/lib/_pkcs11h-crypto-cryptoapi.c
+++ b/lib/_pkcs11h-crypto-cryptoapi.c
@@ -56,7 +56,7 @@
 #include "_pkcs11h-sys.h"
 #include "_pkcs11h-crypto.h"
 
-#if defined(ENABLE_PKCS11H_ENGINE_WIN32)
+#if defined(ENABLE_PKCS11H_ENGINE_CRYPTOAPI)
 #include <wincrypt.h>
 #if !defined(CRYPT_VERIFY_CERT_SIGN_SUBJECT_CERT)
 #define CRYPT_VERIFY_CERT_SIGN_SUBJECT_CERT	0x02
@@ -94,20 +94,20 @@ typedef BOOL (WINAPI *__CryptVerifyCertificateSignatureEx_t) (
 	void* pvReserved
 );
 
-typedef struct __crypto_win32_data_s {
+typedef struct __crypto_cryptoapi_data_s {
 	HMODULE handle;
 	__CertCreateCertificateContext_t p_CertCreateCertificateContext;
 	__CertFreeCertificateContext_t p_CertFreeCertificateContext;
 	CertNameToStrW_t p_CertNameToStrW;
 	__CryptVerifyCertificateSignatureEx_t p_CryptVerifyCertificateSignatureEx;
-} *__crypto_win32_data_t;
+} *__crypto_cryptoapi_data_t;
 
 static
 int
-__pkcs11h_crypto_win32_uninitialize (
+__pkcs11h_crypto_cryptoapi_uninitialize (
 	IN void * const global_data
 ) {
-	__crypto_win32_data_t data = (__crypto_win32_data_t)global_data;
+	__crypto_cryptoapi_data_t data = (__crypto_cryptoapi_data_t)global_data;
 
 	_PKCS11H_ASSERT (global_data!=NULL);
 
@@ -116,21 +116,21 @@ __pkcs11h_crypto_win32_uninitialize (
 		data->handle = NULL;
 	}
 
-	memset (data, 0, sizeof (struct __crypto_win32_data_s));
+	memset (data, 0, sizeof (struct __crypto_cryptoapi_data_s));
 
 	return 1;
 }
 
 static
 int
-__pkcs11h_crypto_win32_initialize (
+__pkcs11h_crypto_cryptoapi_initialize (
 	IN void * const global_data
 ) {
-	__crypto_win32_data_t data = (__crypto_win32_data_t)global_data;
+	__crypto_cryptoapi_data_t data = (__crypto_cryptoapi_data_t)global_data;
 
 	_PKCS11H_ASSERT (global_data!=NULL);
 
-	__pkcs11h_crypto_win32_uninitialize (data);
+	__pkcs11h_crypto_cryptoapi_uninitialize (data);
 
 	data->handle = LoadLibraryA ("crypt32.dll");
 	if (data->handle == NULL) {
@@ -160,7 +160,7 @@ __pkcs11h_crypto_win32_initialize (
 		data->p_CertNameToStrW == NULL ||
 		data->p_CryptVerifyCertificateSignatureEx == NULL
 	) {
-		__pkcs11h_crypto_win32_uninitialize (data);
+		__pkcs11h_crypto_cryptoapi_uninitialize (data);
 		return 0;
 	}
 
@@ -169,13 +169,13 @@ __pkcs11h_crypto_win32_initialize (
 
 static
 int
-__pkcs11h_crypto_win32_certificate_get_expiration (
+__pkcs11h_crypto_cryptoapi_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
 ) {
-	__crypto_win32_data_t data = (__crypto_win32_data_t)global_data;
+	__crypto_cryptoapi_data_t data = (__crypto_cryptoapi_data_t)global_data;
 	PCCERT_CONTEXT cert = NULL;
 	PKCS11H_BOOL ok = FALSE;
 	SYSTEMTIME ust, st;
@@ -226,14 +226,14 @@ cleanup:
 
 static
 int
-__pkcs11h_crypto_win32_certificate_get_dn (
+__pkcs11h_crypto_cryptoapi_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
 ) {
-	__crypto_win32_data_t data = (__crypto_win32_data_t)global_data;
+	__crypto_cryptoapi_data_t data = (__crypto_cryptoapi_data_t)global_data;
 	PCCERT_CONTEXT cert = NULL;
 	PKCS11H_BOOL ok = TRUE;
 	DWORD wsize;
@@ -308,14 +308,14 @@ cleanup:
 
 static
 int
-__pkcs11h_crypto_win32_certificate_is_issuer (
+__pkcs11h_crypto_cryptoapi_certificate_is_issuer (
 	IN void * const global_data,
 	IN const unsigned char * const issuer_blob,
 	IN const size_t issuer_blob_size,
 	IN const unsigned char * const cert_blob,
 	IN const size_t cert_blob_size
 ) {
-	__crypto_win32_data_t data = (__crypto_win32_data_t)global_data;
+	__crypto_cryptoapi_data_t data = (__crypto_cryptoapi_data_t)global_data;
 	PCCERT_CONTEXT cert_issuer = NULL;
 	PCCERT_CONTEXT cert_cert = NULL;
 	PKCS11H_BOOL issuer = FALSE;
@@ -369,14 +369,14 @@ 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
+static struct __crypto_cryptoapi_data_s s_cryptoapi_data = { NULL };
+const pkcs11h_engine_crypto_t _g_pkcs11h_crypto_engine_cryptoapi = {
+	&s_cryptoapi_data,
+	__pkcs11h_crypto_cryptoapi_initialize,
+	__pkcs11h_crypto_cryptoapi_uninitialize,
+	__pkcs11h_crypto_cryptoapi_certificate_get_expiration,
+	__pkcs11h_crypto_cryptoapi_certificate_get_dn,
+	__pkcs11h_crypto_cryptoapi_certificate_is_issuer
 };
 
-#endif				/* ENABLE_PKCS11H_ENGINE_WIN32 */
+#endif				/* ENABLE_PKCS11H_ENGINE_CRYPTOAPI */
diff --git a/lib/_pkcs11h-crypto-gnutls.c b/lib/_pkcs11h-crypto-gnutls.c
index a7e5109..3c8b959 100644
--- a/lib/_pkcs11h-crypto-gnutls.c
+++ b/lib/_pkcs11h-crypto-gnutls.c
@@ -287,7 +287,7 @@ cleanup:
 	return is_issuer;
 }
 
-static const pkcs11h_engine_crypto_t _g_pkcs11h_crypto_engine_gnutls = {
+const pkcs11h_engine_crypto_t _g_pkcs11h_crypto_engine_gnutls = {
 	NULL,
 	__pkcs11h_crypto_gnutls_initialize,
 	__pkcs11h_crypto_gnutls_uninitialize,
diff --git a/lib/_pkcs11h-crypto-nss.c b/lib/_pkcs11h-crypto-nss.c
index 19bcdb9..8b07e0e 100644
--- a/lib/_pkcs11h-crypto-nss.c
+++ b/lib/_pkcs11h-crypto-nss.c
@@ -236,7 +236,7 @@ cleanup:
 }
 
 static int s_nss_data = 0;
-static const pkcs11h_engine_crypto_t _g_pkcs11h_crypto_engine_nss = {
+const pkcs11h_engine_crypto_t _g_pkcs11h_crypto_engine_nss = {
 	&s_nss_data,
 	__pkcs11h_crypto_nss_initialize,
 	__pkcs11h_crypto_nss_uninitialize,
diff --git a/lib/_pkcs11h-crypto-openssl.c b/lib/_pkcs11h-crypto-openssl.c
index 14f29f1..eb11149 100644
--- a/lib/_pkcs11h-crypto-openssl.c
+++ b/lib/_pkcs11h-crypto-openssl.c
@@ -300,7 +300,7 @@ cleanup:
 	return is_issuer;
 }
 
-static const pkcs11h_engine_crypto_t _g_pkcs11h_crypto_engine_openssl = {
+const pkcs11h_engine_crypto_t _g_pkcs11h_crypto_engine_openssl = {
 	NULL,
 	__pkcs11h_crypto_openssl_initialize,
 	__pkcs11h_crypto_openssl_uninitialize,
diff --git a/lib/_pkcs11h-crypto-polarssl.c b/lib/_pkcs11h-crypto-polarssl.c
index d5c2929..2f6bf3b 100644
--- a/lib/_pkcs11h-crypto-polarssl.c
+++ b/lib/_pkcs11h-crypto-polarssl.c
@@ -210,7 +210,7 @@ cleanup:
 	return is_issuer;
 }
 
-static const pkcs11h_engine_crypto_t _g_pkcs11h_crypto_engine_polarssl = {
+const pkcs11h_engine_crypto_t _g_pkcs11h_crypto_engine_polarssl = {
 	NULL,
 	__pkcs11h_crypto_polarssl_initialize,
 	__pkcs11h_crypto_polarssl_uninitialize,
diff --git a/lib/pkcs11h-crypto.c b/lib/pkcs11h-crypto.c
index c064ee3..d91cee5 100644
--- a/lib/pkcs11h-crypto.c
+++ b/lib/pkcs11h-crypto.c
@@ -56,20 +56,20 @@
 #include "_pkcs11h-sys.h"
 #include "_pkcs11h-crypto.h"
 
-#if defined(ENABLE_PKCS11H_ENGINE_WIN32)
-extern pkcs11h_engine_crypto_t _g_pkcs11h_crypto_engine_win32;
+#if defined(ENABLE_PKCS11H_ENGINE_CRYPTOAPI)
+extern const pkcs11h_engine_crypto_t _g_pkcs11h_crypto_engine_cryptoapi;
 #endif
 #if defined(ENABLE_PKCS11H_ENGINE_OPENSSL)
-extern pkcs11h_engine_crypto_t _g_pkcs11h_crypto_engine_openssl;
+extern const pkcs11h_engine_crypto_t _g_pkcs11h_crypto_engine_openssl;
 #endif
 #if defined(ENABLE_PKCS11H_ENGINE_NSS)
-extern pkcs11h_engine_crypto_t _g_pkcs11h_crypto_engine_nss;
+extern const pkcs11h_engine_crypto_t _g_pkcs11h_crypto_engine_nss;
 #endif
 #if defined(ENABLE_PKCS11H_ENGINE_POLARSSL)
-extern pkcs11h_engine_crypto_t _g_pkcs11h_crypto_engine_polarssl;
+extern const pkcs11h_engine_crypto_t _g_pkcs11h_crypto_engine_polarssl;
 #endif
 #if defined(ENABLE_PKCS11H_ENGINE_GNUTLS)
-extern pkcs11h_engine_crypto_t _g_pkcs11h_crypto_engine_gnutls;
+extern const pkcs11h_engine_crypto_t _g_pkcs11h_crypto_engine_gnutls;
 #endif
 
 pkcs11h_engine_crypto_t _g_pkcs11h_crypto_engine = {
@@ -91,8 +91,8 @@ pkcs11h_engine_setCrypto (
 	/*_PKCS11H_ASSERT (engine!=NULL); Not required */
 
 	if (engine == PKCS11H_ENGINE_CRYPTO_AUTO) {
-#if defined(ENABLE_PKCS11H_ENGINE_WIN32)
-		_engine = &_g_pkcs11h_crypto_engine_win32;
+#if defined(ENABLE_PKCS11H_ENGINE_CRYPTOAPI)
+		_engine = &_g_pkcs11h_crypto_engine_cryptoapi;
 #elif defined(ENABLE_PKCS11H_ENGINE_OPENSSL)
 		_engine = &_g_pkcs11h_crypto_engine_openssl;
 #elif defined(ENABLE_PKCS11H_ENGINE_NSS)
@@ -107,8 +107,8 @@ pkcs11h_engine_setCrypto (
 #endif
 	}
 	else if (engine ==  PKCS11H_ENGINE_CRYPTO_GPL) {
-#if defined(ENABLE_PKCS11H_ENGINE_WIN32)
-		_engine = &_g_pkcs11h_crypto_engine_win32;
+#if defined(ENABLE_PKCS11H_ENGINE_CRYPTOAPI)
+		_engine = &_g_pkcs11h_crypto_engine_cryptoapi;
 #elif defined(ENABLE_PKCS11H_ENGINE_POLARSSL)
 		_engine = &_g_pkcs11h_crypto_engine_polarssl;
 #elif defined(ENABLE_PKCS11H_ENGINE_GNUTLS)
@@ -118,9 +118,9 @@ pkcs11h_engine_setCrypto (
 		goto cleanup;
 #endif
 	}
-	else if (engine == PKCS11H_ENGINE_CRYPTO_WIN32) {
-#if defined(ENABLE_PKCS11H_ENGINE_WIN32)
-		_engine = &_g_pkcs11h_crypto_engine_win32;
+	else if (engine == PKCS11H_ENGINE_CRYPTO_CRYPTOAPI) {
+#if defined(ENABLE_PKCS11H_ENGINE_CRYPTOAPI)
+		_engine = &_g_pkcs11h_crypto_engine_cryptoapi;
 #else
 		rv = CKR_ATTRIBUTE_VALUE_INVALID;
 		goto cleanup;

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