From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chris Zheng Newsgroups: gmane.emacs.bugs Subject: bug#19231: 25.0.50; [PATCH] Fix recent GnuTLS change for MinGW-w64 Date: Mon, 01 Dec 2014 03:17:48 +0800 Message-ID: <20141201.031748.1767411492928916984.chriszheng99@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1417375175 31877 80.91.229.3 (30 Nov 2014 19:19:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 30 Nov 2014 19:19:35 +0000 (UTC) To: 19231@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Nov 30 20:19:27 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XvA1l-0004B6-Ar for geb-bug-gnu-emacs@m.gmane.org; Sun, 30 Nov 2014 20:19:25 +0100 Original-Received: from localhost ([::1]:51494 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XvA1k-0005Oa-Rh for geb-bug-gnu-emacs@m.gmane.org; Sun, 30 Nov 2014 14:19:24 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36975) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XvA1X-0005OQ-Ft for bug-gnu-emacs@gnu.org; Sun, 30 Nov 2014 14:19:20 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XvA1O-0006Wj-Ec for bug-gnu-emacs@gnu.org; Sun, 30 Nov 2014 14:19:11 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:52921) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XvA1O-0006Wf-BK for bug-gnu-emacs@gnu.org; Sun, 30 Nov 2014 14:19:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XvA1O-0002P8-5V for bug-gnu-emacs@gnu.org; Sun, 30 Nov 2014 14:19:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Chris Zheng Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 30 Nov 2014 19:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 19231 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.14173751089182 (code B ref -1); Sun, 30 Nov 2014 19:19:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 30 Nov 2014 19:18:28 +0000 Original-Received: from localhost ([127.0.0.1]:50134 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XvA0p-0002O2-Be for submit@debbugs.gnu.org; Sun, 30 Nov 2014 14:18:27 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:35120) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XvA0n-0002Nu-L6 for submit@debbugs.gnu.org; Sun, 30 Nov 2014 14:18:26 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XvA0e-0006Mx-BH for submit@debbugs.gnu.org; Sun, 30 Nov 2014 14:18:25 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:54106) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XvA0e-0006Mt-8V for submit@debbugs.gnu.org; Sun, 30 Nov 2014 14:18:16 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36773) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XvA0V-0005Lj-4E for bug-gnu-emacs@gnu.org; Sun, 30 Nov 2014 14:18:16 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XvA0M-0006JR-2o for bug-gnu-emacs@gnu.org; Sun, 30 Nov 2014 14:18:07 -0500 Original-Received: from mail-pa0-x235.google.com ([2607:f8b0:400e:c03::235]:48336) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XvA0L-0006J4-Rw for bug-gnu-emacs@gnu.org; Sun, 30 Nov 2014 14:17:58 -0500 Original-Received: by mail-pa0-f53.google.com with SMTP id kq14so9635507pab.12 for ; Sun, 30 Nov 2014 11:17:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:message-id:to:subject:from:mime-version:content-type :content-transfer-encoding; bh=Q8ZOuJlRLkugs9Lp3d1RIXjOAAAmlKwJhnPR9vFEjeY=; b=s4/ONVgSv+dwSSndCbl5SS1cz1kc7x2Dn28HOovp70Xxl9xxX5BHkgCP/sdSf7ES5i zqmyfao/26T6tPcHtHwrIryISGfXdyKAawc/a1dB8xLrQpEigZOWU2qzR30/sSnc6i5B ul9KDBU3U/7IJdGz+mIJbB8DixZQwRgUpyEpBAkt0LCGuegjuvA0xVAf5aYqrO0N408S A2+1xs5pKw9Jthr/uTRGGEGQknSJ5RbAYSuSIxPd9PzTPKCEe0Bh/uSBRWySbr1L81Q1 UcuXY3QQvuiOMguRYN/Ys+tkOrib8C3vd7vgBe30b0yGXT20nF9JBH8Py1b7q3U3iu3B dQoQ== X-Received: by 10.68.189.136 with SMTP id gi8mr93796994pbc.54.1417375076107; Sun, 30 Nov 2014 11:17:56 -0800 (PST) Original-Received: from localhost ([180.201.223.129]) by mx.google.com with ESMTPSA id vy1sm15588243pac.20.2014.11.30.11.17.53 for (version=SSLv3 cipher=RC4-SHA bits=128/128); Sun, 30 Nov 2014 11:17:55 -0800 (PST) X-Mailer: Mew version 6.6 on Emacs 25.0.50 / Mule 6.0 (HANACHIRUSATO) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:96760 Archived-At: 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 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