gnutls-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU gnutls branch, gnutls_3_1_x, updated. gnutls_3_1_1-13-g32619a1


From: Nikos Mavrogiannopoulos
Subject: [SCM] GNU gnutls branch, gnutls_3_1_x, updated. gnutls_3_1_1-13-g32619a1
Date: Sat, 15 Sep 2012 11:44:20 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU gnutls".

http://git.savannah.gnu.org/cgit/gnutls.git/commit/?id=32619a1eacf11c1bc6e0c86ac2a8399bdac43813

The branch, gnutls_3_1_x has been updated
       via  32619a1eacf11c1bc6e0c86ac2a8399bdac43813 (commit)
      from  6c7ac1511f936111828e4d512bb20d1e8d47ad8e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 32619a1eacf11c1bc6e0c86ac2a8399bdac43813
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Sat Sep 15 13:43:28 2012 +0200

    mingw32 support. Based on patch by LRN.

-----------------------------------------------------------------------

Summary of changes:
 lib/gnutls_global.c |    8 ++++++++
 lib/system.c        |   50 ++++++++++++++++++++++++++++++++++++++++++--------
 lib/system.h        |    3 +++
 3 files changed, 53 insertions(+), 8 deletions(-)

diff --git a/lib/gnutls_global.c b/lib/gnutls_global.c
index 8b84f46..4c9eabf 100644
--- a/lib/gnutls_global.c
+++ b/lib/gnutls_global.c
@@ -270,6 +270,13 @@ gnutls_global_init (void)
       goto out;
     }
 
+  result = gnutls_system_global_init ();
+  if (result < 0)
+    {
+      gnutls_assert ();
+      goto out;
+    }
+
 #ifdef ENABLE_PKCS11
   gnutls_pkcs11_init (GNUTLS_PKCS11_FLAG_AUTO, NULL);
 #endif
@@ -302,6 +309,7 @@ gnutls_global_deinit (void)
       asn1_delete_structure (&_gnutls_pkix1_asn);
       _gnutls_crypto_deregister ();
       _gnutls_cryptodev_deinit ();
+      gnutls_system_global_deinit ();
 #ifdef ENABLE_PKCS11
       gnutls_pkcs11_deinit ();
 #endif
diff --git a/lib/system.c b/lib/system.c
index 067f189..b22e07d 100644
--- a/lib/system.c
+++ b/lib/system.c
@@ -31,6 +31,11 @@
 #ifdef _WIN32
 # include <windows.h>
 # include <wincrypt.h>
+#  if defined(__MINGW32__) && !defined(__MINGW64__) && __MINGW32_MAJOR_VERSION 
<= 3 && __MINGW32_MINOR_VERSION <= 20
+typedef PCCRL_CONTEXT WINAPI (*Type_CertEnumCRLsInStore) (HCERTSTORE 
hCertStore, PCCRL_CONTEXT pPrevCrlContext);
+static Type_CertEnumCRLsInStore Loaded_CertEnumCRLsInStore;
+static HMODULE Crypt32_dll;
+#  endif
 
 #else
 # ifdef HAVE_PTHREAD_LOCKS
@@ -51,10 +56,7 @@
 /* System specific function wrappers.
  */
 
-/* wrappers for write() and writev()
- */
 #ifdef _WIN32
-
 int
 system_errno (gnutls_transport_ptr p)
 {
@@ -150,9 +152,6 @@ int fd = GNUTLS_POINTER_TO_INT(ptr);
 /* Thread stuff */
 
 #ifdef HAVE_WIN32_LOCKS
-
-
-/* FIXME: win32 locks are untested */
 static int
 gnutls_system_mutex_init (void **priv)
 {
@@ -285,6 +284,41 @@ mutex_deinit_func gnutls_mutex_deinit = 
gnutls_system_mutex_deinit;
 mutex_lock_func gnutls_mutex_lock = gnutls_system_mutex_lock;
 mutex_unlock_func gnutls_mutex_unlock = gnutls_system_mutex_unlock;
 
+int
+gnutls_system_global_init ()
+{
+#ifdef _WIN32
+# if defined(__MINGW32__) && !defined(__MINGW64__) && __MINGW32_MAJOR_VERSION 
<= 3 && __MINGW32_MINOR_VERSION <= 20
+  HMODULE crypto;
+  crypto = LoadLibraryA ("Crypt32.dll");
+
+  if (crypto == NULL)
+    return GNUTLS_E_CRYPTO_INIT_FAILED;
+
+  Loaded_CertEnumCRLsInStore = (Type_CertEnumCRLsInStore) GetProcAddress 
(crypto, "CertEnumCRLsInStore");
+  if (Loaded_CertEnumCRLsInStore == NULL)
+    {
+      FreeLibrary (crypto);
+      return GNUTLS_E_CRYPTO_INIT_FAILED;
+    }
+
+  Crypt32_dll = crypto;
+# endif
+#endif
+  return 0;
+}
+
+void
+gnutls_system_global_deinit ()
+{
+#ifdef _WIN32
+# if defined(__MINGW32__) && !defined(__MINGW64__) && __MINGW32_MAJOR_VERSION 
<= 3 && __MINGW32_MINOR_VERSION <= 20
+  FreeLibrary (Crypt32_dll);
+# endif
+#endif
+}
+
+
 #define CONFIG_PATH ".gnutls"
 
 /* Returns a path to store user-specific configuration
@@ -392,7 +426,7 @@ 
gnutls_x509_trust_list_add_system_trust(gnutls_x509_trust_list_t list,
     if (store == NULL) return GNUTLS_E_FILE_ERROR;
 
     cert = CertEnumCertificatesInStore(store, NULL);
-    crl = CertEnumCRLsInStore(store, NULL);
+    crl = Loaded_CertEnumCRLsInStore(store, NULL);
 
     while(cert != NULL) 
       {
@@ -414,7 +448,7 @@ 
gnutls_x509_trust_list_add_system_trust(gnutls_x509_trust_list_t list,
             data.size = crl->cbCrlEncoded;
             gnutls_x509_trust_list_add_trust_mem(list, NULL, &data, 
GNUTLS_X509_FMT_DER, tl_flags, tl_vflags);
           }
-        crl = CertEnumCRLsInStore(store, crl);
+        crl = Loaded_CertEnumCRLsInStore(store, crl);
       }
     CertCloseStore(store, 0);
   }
diff --git a/lib/system.h b/lib/system.h
index 0178bd5..0afbdd2 100644
--- a/lib/system.h
+++ b/lib/system.h
@@ -71,4 +71,7 @@ struct timespec ts;
 
 int _gnutls_find_config_path(char* path, size_t max_size);
 
+int gnutls_system_global_init ();
+void gnutls_system_global_deinit ();
+
 #endif /* SYSTEM_H */


hooks/post-receive
-- 
GNU gnutls



reply via email to

[Prev in Thread] Current Thread [Next in Thread]