[pkg-opensc-commit] [pkcs11-helper] 16/253: win32 crypto engine cleanups

Eric Dorland eric at moszumanska.debian.org
Fri Jan 6 23:38:59 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 0915c9a54f3106d53fef38c77cecb4496cdc8e52
Author: Alon Bar-Lev <alon.barlev at gmail.com>
Date:   Tue Nov 28 06:07:14 2006 +0000

    win32 crypto engine cleanups
---
 lib/pkcs11h-crypto.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/pkcs11h-crypto.c b/lib/pkcs11h-crypto.c
index 1db40a5..1c5768b 100644
--- a/lib/pkcs11h-crypto.c
+++ b/lib/pkcs11h-crypto.c
@@ -343,7 +343,7 @@ pkcs11h_engine_crypto_t g_pkcs11h_crypto_engine = {
 	__pkcs11h_crypto_gnutls_certificate_is_issuer
 };
 #elif defined(ENABLE_PKCS11H_ENGINE_WIN32)
-static struct __crypto_win32_data_s s_win32_data;
+static struct __crypto_win32_data_s s_win32_data = { NULL };
 pkcs11h_engine_crypto_t g_pkcs11h_crypto_engine = {
 	&s_win32_data,
 	__pkcs11h_crypto_win32_initialize,
@@ -917,7 +917,7 @@ __pkcs11h_crypto_win32_initialize (
 
 	PKCS11H_ASSERT (global_data!=NULL);
 
-	memset (data, 0, sizeof (struct __crypto_win32_data_s));
+	__pkcs11h_crypto_win32_uninitialize (data);
 
 	data->handle = LoadLibraryA ("crypt32.dll");
 	if (data->handle == NULL) {
@@ -952,8 +952,7 @@ __pkcs11h_crypto_win32_initialize (
 		data->p_CryptDecodeObject == NULL ||
 		data->p_CryptVerifyCertificateSignatureEx == NULL
 	) {
-		FreeLibrary (data->handle);
-		data->handle = NULL;
+		__pkcs11h_crypto_win32_uninitialize (data);
 		return 0;
 	}
 
@@ -974,6 +973,8 @@ __pkcs11h_crypto_win32_uninitialize (
 		data->handle = NULL;
 	}
 
+	memset (data, 0, sizeof (struct __crypto_win32_data_s));
+
 	return 1;
 }
 

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