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: Sat, 15 Sep 2018 10:44:04 -0400 Message-ID: <87va76rfbf.fsf@gmail.com> References: <83y3d7ipcw.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1537022593 31043 195.159.176.226 (15 Sep 2018 14:43:13 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 15 Sep 2018 14:43:13 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) Cc: 32446@debbugs.gnu.org, Ted Zlatanov , Gavin Smith To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Sep 15 16:43:08 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 1g1Bmr-0007rV-8b for geb-bug-gnu-emacs@m.gmane.org; Sat, 15 Sep 2018 16:43:05 +0200 Original-Received: from localhost ([::1]:55735 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1Box-0000x0-Fn for geb-bug-gnu-emacs@m.gmane.org; Sat, 15 Sep 2018 10:45:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35144) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1Bon-0000vh-ME for bug-gnu-emacs@gnu.org; Sat, 15 Sep 2018 10:45:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1Bok-0000WJ-GP for bug-gnu-emacs@gnu.org; Sat, 15 Sep 2018 10:45:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:37450) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g1Bok-0000VE-Ae for bug-gnu-emacs@gnu.org; Sat, 15 Sep 2018 10:45:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1g1Bok-0004Tl-37 for bug-gnu-emacs@gnu.org; Sat, 15 Sep 2018 10:45: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: Sat, 15 Sep 2018 14:45:02 +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: Original-Received: via spool by 32446-submit@debbugs.gnu.org id=B32446.153702265717147 (code B ref 32446); Sat, 15 Sep 2018 14:45:02 +0000 Original-Received: (at 32446) by debbugs.gnu.org; 15 Sep 2018 14:44:17 +0000 Original-Received: from localhost ([127.0.0.1]:41708 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g1Bo0-0004SQ-Ip for submit@debbugs.gnu.org; Sat, 15 Sep 2018 10:44:16 -0400 Original-Received: from mail-io1-f66.google.com ([209.85.166.66]:38110) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g1Bnv-0004S5-Og; Sat, 15 Sep 2018 10:44:12 -0400 Original-Received: by mail-io1-f66.google.com with SMTP id y3-v6so8242066ioc.5; Sat, 15 Sep 2018 07:44:11 -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=SShCHW1tHNjiRfnVLfRz0db4n214P54LKKHJ1i0KfEQ=; b=FDXc9Gz88/aU0AR2hWMsyqZNVtpPwLoIcUtoJvm5V4qi3BKbuMQN4NnY2qiveFNGRz C65TcRx5dT9RRWopM5+NYsDrvTaeE1rUVBCWf5HCR6TvZFBUPQ6Zs4ZJVaY+MPYzzy1n 4eCQpm9c6Cfx88ZG+JSHMEGbfA68u7IL9m4CDxVKsN92JV1GzWZJX1qecGs83JmX8mCM T9XioiGtDOadshzb6H6ETIGbDJF+mYgrUno25iYNL+ESnptlwBF1+C39/Bc6S30AsvDI Hwxfa9PAjW186uhtrOMM26NZkE7GkA44CD43ZIaxUoAGrRdzqMtvkIvZbvgmiRc9+bZX OR8A== 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=SShCHW1tHNjiRfnVLfRz0db4n214P54LKKHJ1i0KfEQ=; b=toX157YmbsENxxbAGCN+9tENge2JKX2DwTpgRJLHLEq4PhhwEsTiJ4qvgyNoiEatBs iF5iz5RAa1KK8/BQWVb8WF2P2MJmzua4nhZedSUmpkwQ+CfYCr2jNjov/DXPsNe1f82N wu7qdiyKkEaZqbsd7/SI740l5mov+58lgBtabmt9BPImi7Uff6e/mbxXRJCs/Amu6Zts qaUdy7fLDvu14bjUDlLiWeEoREU/bTfvilI+GCuSNrMsHkvvsXY3rqtXlAVnWvWt4q6C rc3A/tymzpbeADmAHUgD7fgu568JyxVi96RfY5YDKjF4x/EzMrIfgq2uYgW/6IuId+op LxOQ== X-Gm-Message-State: APzg51AKDJdEZsDmHNzuhD4ui4o3yfuNpt2h1gS/Ubue3KG0RLYGk+/x 9zXQLaVaO4BmUny7v6VbvTLNlp8M X-Google-Smtp-Source: ANB0VdYVCEa3kNmUpjcizu56TKYVxsXJiTJQmRKeBmnbn4rzCg28G/XFycpl6yWPubqa7g/I0VcUpA== X-Received: by 2002:a5e:da49:: with SMTP id o9-v6mr14258819iop.215.1537022646155; Sat, 15 Sep 2018 07:44:06 -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 g198-v6sm970534itg.4.2018.09.15.07.44.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Sep 2018 07:44:05 -0700 (PDT) In-Reply-To: <83y3d7ipcw.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 15 Aug 2018 19:09:03 +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:150335 Archived-At: --=-=-= Content-Type: text/plain tags 32446 + patch quit Eli Zaretskii writes: >> I'd guess that the required version in 'configure' needs to be increased. > > The problem is not with the minimum required version, because we have > additional version-dependent cpp conditions in gnutls.c. The problem > is that we assumed these functions were available since GnuTLS 3.0.0, > which is false. > > Ted, what would you propose to do with this issue? Disable the > relevant functionality for versions of GnuTLS that don't have these > APIs? I think we can keep most of the functionality: the missing APIs only make a difference for AEAD ciphers, which are already disabled for versions before 3.5. --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=v1-0001-Fix-build-with-gnutls-versions-3.0-to-3.2-Bug-324.patch Content-Description: patch >From 14efb9e7826e06c25e495f9d17d3b3179f380c6a Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sat, 15 Sep 2018 10:25:11 -0400 Subject: [PATCH v1] 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 | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 51 insertions(+), 4 deletions(-) diff --git a/src/gnutls.c b/src/gnutls.c index 461260e27f..83c3e79cbf 100644 --- a/src/gnutls.c +++ b/src/gnutls.c @@ -38,6 +38,29 @@ your option) any later version. So, require 3.5.1. */ #if GNUTLS_VERSION_NUMBER >= 0x030501 # define HAVE_GNUTLS_AEAD +/* gnutls_cipher_get_tag_size was introduced in 3.2.0, but it's only + relevant for AEAD ciphers. */ +# define HAVE_GNUTLS_CIPHER_GET_TAG_SIZE +#else +# define gnutls_cipher_get_tag_size(cipher) 0 +#endif + +/* gnutls_cipher_get_iv_size was introduced in 3.2.0. */ +#if GNUTLS_VERSION_NUMBER >= 0x030200 +# define HAVE_GNUTLS_CIPHER_GET_IV_SIZE +#else +/* 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 + +/* gnutls_digest_list and gnutls_digest_get_name were added in 3.2.2. */ +#if GNUTLS_VERSION_NUMBER >= 0x030202 +# define HAVE_GNUTLS_DIGEST_LIST +# define HAVE_GNUTLS_DIGEST_GET_NAME +#else +/* 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 +228,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)); +# ifdef HAVE_GNUTLS_DIGEST_LIST DEF_DLL_FN (const gnutls_digest_algorithm_t *, gnutls_digest_list, (void)); +# endif +# ifdef HAVE_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)); +# ifdef HAVE_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)); +# ifdef HAVE_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 +370,21 @@ init_gnutls_functions (void) LOAD_DLL_FN (library, gnutls_mac_get_nonce_size); # endif LOAD_DLL_FN (library, gnutls_mac_get_key_size); +# ifdef HAVE_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); +# ifdef HAVE_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); +# ifdef HAVE_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 +494,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 +# ifdef HAVE_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 +# ifdef HAVE_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 +# ifdef HAVE_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 --=-=-=--