all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#19231: 25.0.50; [PATCH] Fix recent GnuTLS change for MinGW-w64
@ 2014-11-30 19:17 Chris Zheng
  2014-12-01 17:46 ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 6+ messages in thread
From: Chris Zheng @ 2014-11-30 19:17 UTC (permalink / raw)
  To: 19231

Dear maintainers,
Two recent changes to gnutls.c breaks GnuTLS support in a
MSYS2/MinGW-w64 build.  The first is:
a859504   Add functions to gnutls.c for exporting certificate details.
In GnuTLS v3.3.10 from MinGW-w64, the `gnutls_sign_algorithm_get_name'
is defined as a macro, so it can't be loaded by the macro
`LOAD_GNUTLS_FN'.  This leads to `nil' from `(gnutls-available-p)'.  The second is:
ccae04f | * gnutls.c (Fgnutls_boot): Send the server name over
where `gnutls_server_name_set' is not loaded in Windows.  This cause
Emacs to crash.  I think the following patch fixes these bugs.  I have
tested it with MSYS2/MinGW-w64 combination, where GnuTLS version is
3.3.10.  Can it be applied?  Thanks.


From 3b747a7bc4d05a41f53ecc1fdbd4a45838bc9d5a Mon Sep 17 00:00:00 2001
From: Chris Zheng <chriszheng99@gmail.com>
Date: Mon, 1 Dec 2014 02:13:04 +0800
Subject: [PATCH] Fix recent GnuTLS change for MinGW-w64.

* src/gnutls.c: In MinGW-w64, `gnutls_sign_algorithm_get_name' is
  defined as a macro to `gnutls_sign_get_name', so use
  `gnutls_sign_get_name' directly.
  (init_gnutls_functions): Load missing `gnutls_server_name_set'.
  (init_gnutls_functions): Use `gnutls_sign_get_name'.
  (gnutls_certificate_details): Use `fn_gnutls_sign_get_name'.
---
 src/gnutls.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/src/gnutls.c b/src/gnutls.c
index 752df3c..92333c5 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -185,8 +185,15 @@ DEF_GNUTLS_FN (int, gnutls_x509_crt_get_key_id,
 	       (gnutls_x509_crt_t, unsigned int,
 		unsigned char *, size_t *_size));
 DEF_GNUTLS_FN (const char*, gnutls_sec_param_get_name, (gnutls_sec_param_t));
+/* Use `gnutls_sign_get_name' instead of
+   `gnutls_sign_algorithm_get_name' for MinGW-w64.  */
+#if defined(MINGW_W64) && defined(gnutls_sign_algorithm_get_name)
+DEF_GNUTLS_FN (const char*, gnutls_sign_get_name,
+	       (gnutls_sign_algorithm_t));
+#else
 DEF_GNUTLS_FN (const char*, gnutls_sign_algorithm_get_name,
 	       (gnutls_sign_algorithm_t));
+#endif
 DEF_GNUTLS_FN (int, gnutls_server_name_set, (gnutls_session_t,
 					     gnutls_server_name_type_t,
 					     const void *, size_t));
@@ -265,7 +272,14 @@ init_gnutls_functions (void)
   LOAD_GNUTLS_FN (library, gnutls_x509_crt_get_signature);
   LOAD_GNUTLS_FN (library, gnutls_x509_crt_get_key_id);
   LOAD_GNUTLS_FN (library, gnutls_sec_param_get_name);
+  /* Use `gnutls_sign_get_name' instead of
+     `gnutls_sign_algorithm_get_name' for MinGW-w64.  */
+#if defined(MINGW_W64) && defined(gnutls_sign_algorithm_get_name)
+  LOAD_GNUTLS_FN (library, gnutls_sign_get_name);
+#else
   LOAD_GNUTLS_FN (library, gnutls_sign_algorithm_get_name);
+#endif
+  LOAD_GNUTLS_FN (library, gnutls_server_name_set);
 
   max_log_level = global_gnutls_log_level;
 
@@ -928,7 +942,13 @@ gnutls_certificate_details (gnutls_x509_crt_t cert)
     err = fn_gnutls_x509_crt_get_signature_algorithm (cert);
     if (err >= GNUTLS_E_SUCCESS)
       {
+/* Use `gnutls_sign_get_name' instead of
+   `gnutls_sign_algorithm_get_name' for MinGW-w64.  */
+#if defined(MINGW_W64) && defined(gnutls_sign_algorithm_get_name)
+	const char *name = fn_gnutls_sign_get_name (err);
+#else
 	const char *name = fn_gnutls_sign_algorithm_get_name (err);
+#endif
 	if (name)
 	  res = nconc2 (res, list2 (intern (":signature-algorithm"),
 				    build_string (name)));
-- 
2.2.0









^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-12-03 14:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-30 19:17 bug#19231: 25.0.50; [PATCH] Fix recent GnuTLS change for MinGW-w64 Chris Zheng
2014-12-01 17:46 ` Lars Magne Ingebrigtsen
2014-12-02 13:03   ` Chris Zheng
2014-12-02 16:37     ` Lars Magne Ingebrigtsen
2014-12-03  4:37       ` Chris Zheng
2014-12-03 14:40         ` Lars Magne Ingebrigtsen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.