From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs Subject: bug#32446: Configure-time requirement for gnutls is too old Date: Sun, 16 Sep 2018 16:31:16 -0400 Message-ID: <87sh29qj57.fsf@gmail.com> References: <83y3d7ipcw.fsf@gnu.org> <87va76rfbf.fsf@gmail.com> <83musiixxg.fsf@gnu.org> <20180915155509.GA750@darkstar> <83k1nmivll.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1537129813 26561 195.159.176.226 (16 Sep 2018 20:30:13 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 16 Sep 2018 20:30:13 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) Cc: 32446@debbugs.gnu.org, tzz@lifelogs.com, Gavin Smith To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Sep 16 22:30:09 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g1dgE-0006lG-0X for geb-bug-gnu-emacs@m.gmane.org; Sun, 16 Sep 2018 22:30:06 +0200 Original-Received: from localhost ([::1]:60172 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1diK-0002Wc-AN for geb-bug-gnu-emacs@m.gmane.org; Sun, 16 Sep 2018 16:32:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40937) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1diA-0002Uj-Lk for bug-gnu-emacs@gnu.org; Sun, 16 Sep 2018 16:32:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1di6-0006J8-AI for bug-gnu-emacs@gnu.org; Sun, 16 Sep 2018 16:32:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:38079) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g1di6-0006IZ-5R for bug-gnu-emacs@gnu.org; Sun, 16 Sep 2018 16:32:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1g1di5-0003gt-Va for bug-gnu-emacs@gnu.org; Sun, 16 Sep 2018 16:32:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 16 Sep 2018 20:32:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32446 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 32446-submit@debbugs.gnu.org id=B32446.153712988712688 (code B ref 32446); Sun, 16 Sep 2018 20:32:01 +0000 Original-Received: (at 32446) by debbugs.gnu.org; 16 Sep 2018 20:31:27 +0000 Original-Received: from localhost ([127.0.0.1]:42337 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g1dhW-0003Hy-BB for submit@debbugs.gnu.org; Sun, 16 Sep 2018 16:31:26 -0400 Original-Received: from mail-io1-f66.google.com ([209.85.166.66]:37958) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g1dhT-0003CR-R4 for 32446@debbugs.gnu.org; Sun, 16 Sep 2018 16:31:24 -0400 Original-Received: by mail-io1-f66.google.com with SMTP id y3-v6so9869869ioc.5 for <32446@debbugs.gnu.org>; Sun, 16 Sep 2018 13:31:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=CTS9LmsLRc+cyAxiD2pJZlWlUk3eN9G19Qyzmxd3HcI=; b=G5oPnsOr1eF0VVJiZObJ5jjdK/Gc9PNrv2x87CxXh2U7uL5TzJOZ8hMb/B/YltuqSB EXjaqW4OVvL0wOgy3kyMRrW5mjv2vDzeAOaljQrqt2bBIpcfbm6ZsuQCxnS4LBUNTkHZ 3vyxeCGQiOQaeqeUymHnSDQRwW1IaBzLbBI76KJeCZuGRI/3n+4GgA4u5jGTPUwVcg5e mkdp/W1eKJVzpmcJmHIDLflWiRRbrnhmFRQ+eQ10kAS0GqfPrHw8To0NRKHnNFaxtzx9 UgbDGqQETG6yU/wv6GKd4UwSIMrvC8ZLkDKZGSzMLKOgmHOCOfKXsLLixml77yblfpcw jVfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=CTS9LmsLRc+cyAxiD2pJZlWlUk3eN9G19Qyzmxd3HcI=; b=lnOHuK7Y9MmJ0vwTQXI0abh02lpJoMM2knsbbtaZ1wBVP++XwpmsFpWhXYIcAH4fer fQJ/D31qqEACWeg05VUwasCn+ZrzgoAPbO1v1mJi17x1plj2Gf4xbf6YAk3+BRTPL4gB /+WiokAOjjBlJLa3tA+lUYiu0HNioJR3oddRx2LtJgNfLV6KhozEh3e9BeIN51qNahAl yCrcB3s0pik7n4WPefaA1wBcOi7ud++rRbxABLsyCpwsYj8iBgGrn4pEiy4YgeKM8Zvq QIaKWlERfiChnTdJGjeC094v2ZBPY5hEQ3H0vwmRI3oVyeRRQ0CI+gnigMXwJ4hCjUvm lATw== X-Gm-Message-State: APzg51Ad/TklHZ0C1aMVMAm/4Gcy/xyD5sYLSQh9S3G9Y1Pv8qVJI+Ss K4misYgsySFad8Y1bs0POb0= X-Google-Smtp-Source: ANB0VdZXOi0JFUZo3HEnrH7o/XrDitKcEBTbfrc4667VSqgswy7gzlTquv9uu6Lq86fPgz2Vq1bnQA== X-Received: by 2002:a5e:c705:: with SMTP id f5-v6mr18406887iop.197.1537129878168; Sun, 16 Sep 2018 13:31:18 -0700 (PDT) Original-Received: from zebian (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.googlemail.com with ESMTPSA id w8-v6sm4283385iom.15.2018.09.16.13.31.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 16 Sep 2018 13:31:17 -0700 (PDT) In-Reply-To: <83k1nmivll.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 15 Sep 2018 19:17:10 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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" Xref: news.gmane.org gmane.emacs.bugs:150354 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: > The patch LGTM as well, so, Noam, please push eto emacs-26, and > thanks. Ah, minor problem, I had initially written this on Windows, but it turns out on GNU/Linux when the '#ifdef WINDOWSNT' part is skipped, gcc gives a few warnings. I've adjusted the patch to avoid this (see attached); I'll push it tomorrow after double checking the updated version on Windows. CC gnutls.o ../../src/gnutls.c:59:0: warning: macro "HAVE_GNUTLS_DIGEST_GET_NAME" is not used [-Wunused-macros] # define HAVE_GNUTLS_DIGEST_GET_NAME ../../src/gnutls.c:43:0: warning: macro "HAVE_GNUTLS_CIPHER_GET_TAG_SIZE" is not used [-Wunused-macros] # define HAVE_GNUTLS_CIPHER_GET_TAG_SIZE ../../src/gnutls.c:50:0: warning: macro "HAVE_GNUTLS_CIPHER_GET_IV_SIZE" is not used [-Wunused-macros] # define HAVE_GNUTLS_CIPHER_GET_IV_SIZE ../../src/gnutls.c:58:0: warning: macro "HAVE_GNUTLS_DIGEST_LIST" is not used [-Wunused-macros] # define HAVE_GNUTLS_DIGEST_LIST --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=v2-0001-Fix-build-with-gnutls-versions-3.0-to-3.2-Bug-324.patch Content-Description: patch >From f7d6e2b5b6c4cc24d935d1eee84df4dfc6ded7c8 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sat, 15 Sep 2018 10:25:11 -0400 Subject: [PATCH v2] Fix build with gnutls versions 3.0 to 3.2 (Bug#32446) We previously used functions available only in 3.2+ for all 3.x versions. * src/gnutls.c [GNUTLS_VERSION_NUMBER < 0x030501]: Replace calls to gnutls_cipher_get_tag_size with 0. [GNUTLS_VERSION_NUMBER < 0x030200]: Alias gnutls_cipher_get_iv_size to gnutls_cipher_get_block_size, gnutls_digest_list to gnutls_mac_list, and gnutls_digest_get_name to gnutls_mac_get_name. [WINDOWSNT]: Adjust DLL function definitions and declarations accordingly. --- src/gnutls.c | 49 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/src/gnutls.c b/src/gnutls.c index 461260e27f..2a834d9391 100644 --- a/src/gnutls.c +++ b/src/gnutls.c @@ -38,6 +38,23 @@ your option) any later version. So, require 3.5.1. */ #if GNUTLS_VERSION_NUMBER >= 0x030501 # define HAVE_GNUTLS_AEAD +#else +/* gnutls_cipher_get_tag_size was introduced in 3.2.0, but it's only + relevant for AEAD ciphers. */ +# define gnutls_cipher_get_tag_size(cipher) 0 +#endif + +#if GNUTLS_VERSION_NUMBER < 0x030200 +/* gnutls_cipher_get_iv_size was introduced in 3.2.0. For the ciphers + available in previous versions, block size is equivalent. */ +#define gnutls_cipher_get_iv_size(cipher) gnutls_cipher_get_block_size (cipher) +#endif + +#if GNUTLS_VERSION_NUMBER < 0x030202 +/* gnutls_digest_list and gnutls_digest_get_name were added in 3.2.2. + For previous versions, the mac algorithms are equivalent. */ +# define gnutls_digest_list() ((const gnutls_digest_algorithm_t *) gnutls_mac_list ()) +# define gnutls_digest_get_name(id) gnutls_mac_get_name ((gnutls_mac_algorithm_t) id) #endif /* gnutls_mac_get_nonce_size was added in GnuTLS 3.2.0, but was @@ -205,13 +222,21 @@ DEF_DLL_FN (const gnutls_mac_algorithm_t *, gnutls_mac_list, (void)); DEF_DLL_FN (size_t, gnutls_mac_get_nonce_size, (gnutls_mac_algorithm_t)); # endif DEF_DLL_FN (size_t, gnutls_mac_get_key_size, (gnutls_mac_algorithm_t)); +# ifndef gnutls_digest_list DEF_DLL_FN (const gnutls_digest_algorithm_t *, gnutls_digest_list, (void)); +# endif +# ifndef gnutls_digest_get_name DEF_DLL_FN (const char *, gnutls_digest_get_name, (gnutls_digest_algorithm_t)); +# endif DEF_DLL_FN (gnutls_cipher_algorithm_t *, gnutls_cipher_list, (void)); +# ifndef gnutls_cipher_get_iv_size DEF_DLL_FN (int, gnutls_cipher_get_iv_size, (gnutls_cipher_algorithm_t)); +# endif DEF_DLL_FN (size_t, gnutls_cipher_get_key_size, (gnutls_cipher_algorithm_t)); DEF_DLL_FN (int, gnutls_cipher_get_block_size, (gnutls_cipher_algorithm_t)); +# ifndef gnutls_cipher_get_tag_size DEF_DLL_FN (int, gnutls_cipher_get_tag_size, (gnutls_cipher_algorithm_t)); +# endif DEF_DLL_FN (int, gnutls_cipher_init, (gnutls_cipher_hd_t *, gnutls_cipher_algorithm_t, const gnutls_datum_t *, const gnutls_datum_t *)); @@ -339,13 +364,21 @@ init_gnutls_functions (void) LOAD_DLL_FN (library, gnutls_mac_get_nonce_size); # endif LOAD_DLL_FN (library, gnutls_mac_get_key_size); +# ifndef gnutls_digest_list LOAD_DLL_FN (library, gnutls_digest_list); +# endif +# ifdef HAVE_GNUTLS_DIGEST_GET_NAME LOAD_DLL_FN (library, gnutls_digest_get_name); +# endif LOAD_DLL_FN (library, gnutls_cipher_list); +# ifndef gnutls_cipher_get_iv_size LOAD_DLL_FN (library, gnutls_cipher_get_iv_size); +# endif LOAD_DLL_FN (library, gnutls_cipher_get_key_size); LOAD_DLL_FN (library, gnutls_cipher_get_block_size); +# ifndef gnutls_cipher_get_tag_size LOAD_DLL_FN (library, gnutls_cipher_get_tag_size); +# endif LOAD_DLL_FN (library, gnutls_cipher_init); LOAD_DLL_FN (library, gnutls_cipher_set_iv); LOAD_DLL_FN (library, gnutls_cipher_encrypt2); @@ -455,13 +488,21 @@ init_gnutls_functions (void) # define gnutls_mac_get_nonce_size fn_gnutls_mac_get_nonce_size # endif # define gnutls_mac_get_key_size fn_gnutls_mac_get_key_size -# define gnutls_digest_list fn_gnutls_digest_list -# define gnutls_digest_get_name fn_gnutls_digest_get_name +# ifndef gnutls_digest_list +# define gnutls_digest_list fn_gnutls_digest_list +# endif +# ifdef HAVE_GNUTLS_DIGEST_GET_NAME +# define gnutls_digest_get_name fn_gnutls_digest_get_name +# endif # define gnutls_cipher_list fn_gnutls_cipher_list -# define gnutls_cipher_get_iv_size fn_gnutls_cipher_get_iv_size +# ifndef gnutls_cipher_get_iv_size +# define gnutls_cipher_get_iv_size fn_gnutls_cipher_get_iv_size +# endif # define gnutls_cipher_get_key_size fn_gnutls_cipher_get_key_size # define gnutls_cipher_get_block_size fn_gnutls_cipher_get_block_size -# define gnutls_cipher_get_tag_size fn_gnutls_cipher_get_tag_size +# ifndef gnutls_cipher_get_tag_size +# define gnutls_cipher_get_tag_size fn_gnutls_cipher_get_tag_size +# endif # define gnutls_cipher_init fn_gnutls_cipher_init # define gnutls_cipher_set_iv fn_gnutls_cipher_set_iv # define gnutls_cipher_encrypt2 fn_gnutls_cipher_encrypt2 -- 2.11.0 --=-=-=--