unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#32446: Configure-time requirement for gnutls is too old
@ 2018-08-15 11:12 Gavin Smith
  2018-08-15 16:09 ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Gavin Smith @ 2018-08-15 11:12 UTC (permalink / raw)
  To: 32446

I downloaded and tried to build Emacs 26.1. I ran "./configure" and
"make", but after a while there is an error. With "make V=1":

gcc -std=gnu11 -Demacs  -I. -I. -I../lib -I../lib   -pthread
-I/usr/local/include -I/usr/include/gtk-3.0 -I/usr/include/atk-1.0
-I/usr/include/at-spi2-atk/2.0 -I/usr/include/pango-1.0
-I/usr/include/gio-unix-2.0/ -I/usr/include/cairo
-I/usr/include/gdk-pixbuf-2.0 -I/usr/include/glib-2.0
-I/usr/lib/glib-2.0/include -I/usr/include/harfbuzz
-I/usr/include/freetype2 -I/usr/include/pixman-1
-I/usr/include/libpng14 -I/usr/include/libdrm
-I/usr/include/freetype2    -I/usr/include/alsa   -pthread
-I/usr/local/include -I/usr/include/librsvg-2.0
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
-I/usr/include/gdk-pixbuf-2.0 -I/usr/include/cairo
-I/usr/include/libpng14 -I/usr/include/pixman-1
-I/usr/include/freetype2 -I/usr/include/libdrm
-DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16
-I/usr/include/ImageMagick-6   -I/usr/include/libpng14
-I/usr/include/libxml2   -I/usr/include/dbus-1.0
-I/usr/lib/dbus-1.0/include        -pthread -I/usr/include/glib-2.0
-I/usr/lib/glib-2.0/include   -I/usr/include/glib-2.0
-I/usr/lib/glib-2.0/include   -I/usr/include/freetype2      -MMD -MF
deps/.d -MP  -I/usr/include/p11-kit-1       -g3 -O2  -Wl,-znocombreloc
  \
  -o temacs  vm-limit.o dispnew.o frame.o scroll.o xdisp.o menu.o
xmenu.o window.o charset.o coding.o category.o ccl.o character.o
chartab.o bidi.o cm.o term.o terminal.o xfaces.o xterm.o xfns.o
xselect.o xrdb.o xsmfns.o xsettings.o gtkutil.o emacsgtkfixed.o
dbusbind.o emacs.o keyboard.o macros.o keymap.o sysdep.o buffer.o
filelock.o insdel.o marker.o minibuf.o fileio.o dired.o cmds.o
casetab.o casefiddle.o indent.o search.o regex.o undo.o alloc.o data.o
doc.o editfns.o callint.o eval.o floatfns.o fns.o font.o print.o
lread.o  syntax.o unexelf.o bytecode.o process.o gnutls.o callproc.o
region-cache.o sound.o atimer.o doprnt.o intervals.o textprop.o
composite.o xml.o lcms.o inotify.o  profiler.o decompress.o thread.o
systhread.o      xfont.o ftfont.o xftfont.o ftxfont.o  fontset.o
fringe.o image.o xgselect.o  terminfo.o lastfile.o
../lib/libgnu.a       -ltiff -ljpeg -L/usr/lib -lpng14 -lgif -lXpm
-lgtk-3 -lgdk-3 -latk-1.0 -lgio-2.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0
-lcairo-gobject -lpango-1.0 -lcairo -lgobject-2.0 -lglib-2.0   -lSM
-lICE -lX11 -lX11-xcb -lxcb -lXrender -lXft   -lasound   -lrsvg-2 -lm
-lgio-2.0 -lgdk_pixbuf-2.0 -lcairo -lgobject-2.0 -lglib-2.0
-lMagickWand-6.Q16 -lMagickCore-6.Q16   -lacl     -lrt -ldbus-1
-lXrandr   -lXinerama   -lXfixes   -lXext -lxml2   -lgpm   -lncurses
-lgio-2.0 -lgobject-2.0 -lglib-2.0   -lgobject-2.0 -lglib-2.0
-lfreetype   -lfontconfig     -lgnutls   -lpthread -lanl -llcms2  -lm
-lz
gnutls.o: In function `Fgnutls_ciphers':
/home/g/extsrc/emacs-26.1/src/gnutls.c:1889: undefined reference to
`gnutls_cipher_get_tag_size'
/home/g/extsrc/emacs-26.1/src/gnutls.c:1892: undefined reference to
`gnutls_cipher_get_iv_size'
gnutls.o: In function `Fgnutls_digests':
/home/g/extsrc/emacs-26.1/src/gnutls.c:2242: undefined reference to
`gnutls_digest_list'
/home/g/extsrc/emacs-26.1/src/gnutls.c:2248: undefined reference to
`gnutls_digest_get_name'
gnutls.o: In function `gnutls_symmetric':
/home/g/extsrc/emacs-26.1/src/gnutls.c:2062: undefined reference to
`gnutls_cipher_get_iv_size'
/home/g/extsrc/emacs-26.1/src/gnutls.c:2079: undefined reference to
`gnutls_cipher_get_tag_size'
collect2: error: ld returned 1 exit status
make[1]: *** [temacs] Error 1
make[1]: Leaving directory `/home/g/extsrc/emacs-26.1/src'
make: *** [src] Error 2

I looked to see which symbols were in the gnutls library:

$ nm -D /usr/lib/libgnutls.so.28.21.5 | grep cipher
00043760 T gnutls_cipher_add_auth
00043880 T gnutls_cipher_decrypt
00043940 T gnutls_cipher_decrypt2
000439c0 T gnutls_cipher_deinit
00043830 T gnutls_cipher_encrypt
000438f0 T gnutls_cipher_encrypt2
0003d550 T gnutls_cipher_get
000b8dc0 T gnutls_cipher_get_block_size
000b8fd0 T gnutls_cipher_get_id
000b8ed0 T gnutls_cipher_get_key_size
000b8f90 T gnutls_cipher_get_name
000435e0 T gnutls_cipher_init
000b9020 T gnutls_cipher_list
000437f0 T gnutls_cipher_set_iv
00028f30 T gnutls_cipher_set_priority
000b9270 T gnutls_cipher_suite_get_name
000b9320 T gnutls_cipher_suite_info
000436d0 T gnutls_cipher_tag
000b95a0 T gnutls_priority_get_cipher_suite_index

"gnutls_cipher_get_tag_size" is not there.

According to https://www.gnutls.org/abi-tracker/changelog/gnutls/3.4.10/log.html,
gnutls_cipher_get_tag_size was added in version 3.2.2. However, the
configure script for Emacs did not detect that I had an out-of-date
gnutls. From config.log:

configure:13176: checking for LIBGNUTLS
configure:13183: $PKG_CONFIG --exists --print-errors "gnutls >= 2.12.2"
configure:13186: $? = 0
configure:13200: $PKG_CONFIG --exists --print-errors "gnutls >= 2.12.2"
configure:13203: $? = 0
configure:13241: result: yes

The check is for an older version of gnutls, which my system passes:

$ pkg-config --modversion gnutls
3.1.25

I'd guess that the required version in 'configure' needs to be increased.





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

* bug#32446: Configure-time requirement for gnutls is too old
  2018-08-15 11:12 bug#32446: Configure-time requirement for gnutls is too old Gavin Smith
@ 2018-08-15 16:09 ` Eli Zaretskii
  2018-08-21  2:08   ` Glenn Morris
  2018-09-15 14:44   ` Noam Postavsky
  0 siblings, 2 replies; 12+ messages in thread
From: Eli Zaretskii @ 2018-08-15 16:09 UTC (permalink / raw)
  To: Gavin Smith, Ted Zlatanov; +Cc: 32446

> From: Gavin Smith <gavinsmith0123@gmail.com>
> Date: Wed, 15 Aug 2018 12:12:10 +0100
> 
> According to https://www.gnutls.org/abi-tracker/changelog/gnutls/3.4.10/log.html,
> gnutls_cipher_get_tag_size was added in version 3.2.2. However, the
> configure script for Emacs did not detect that I had an out-of-date
> gnutls. From config.log:
> 
> configure:13176: checking for LIBGNUTLS
> configure:13183: $PKG_CONFIG --exists --print-errors "gnutls >= 2.12.2"
> configure:13186: $? = 0
> configure:13200: $PKG_CONFIG --exists --print-errors "gnutls >= 2.12.2"
> configure:13203: $? = 0
> configure:13241: result: yes
> 
> The check is for an older version of gnutls, which my system passes:
> 
> $ pkg-config --modversion gnutls
> 3.1.25
> 
> 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?

Thanks.





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

* bug#32446: Configure-time requirement for gnutls is too old
  2018-08-15 16:09 ` Eli Zaretskii
@ 2018-08-21  2:08   ` Glenn Morris
  2018-09-15 14:44   ` Noam Postavsky
  1 sibling, 0 replies; 12+ messages in thread
From: Glenn Morris @ 2018-08-21  2:08 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 32446, Ted Zlatanov, Gavin Smith


Looks like relevant discussion in https://debbugs.gnu.org/27708 .





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

* bug#32446: Configure-time requirement for gnutls is too old
  2018-08-15 16:09 ` Eli Zaretskii
  2018-08-21  2:08   ` Glenn Morris
@ 2018-09-15 14:44   ` Noam Postavsky
  2018-09-15 15:26     ` Eli Zaretskii
  1 sibling, 1 reply; 12+ messages in thread
From: Noam Postavsky @ 2018-09-15 14:44 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 32446, Ted Zlatanov, Gavin Smith

[-- Attachment #1: Type: text/plain, Size: 681 bytes --]

tags 32446 + patch
quit

Eli Zaretskii <eliz@gnu.org> 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.


[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 5372 bytes --]

From 14efb9e7826e06c25e495f9d17d3b3179f380c6a Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
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


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

* bug#32446: Configure-time requirement for gnutls is too old
  2018-09-15 14:44   ` Noam Postavsky
@ 2018-09-15 15:26     ` Eli Zaretskii
  2018-09-15 15:55       ` Gavin Smith
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2018-09-15 15:26 UTC (permalink / raw)
  To: gavinsmith0123, Noam Postavsky; +Cc: 32446, tzz

> From: Noam Postavsky <npostavs@gmail.com>
> Cc: Gavin Smith <gavinsmith0123@gmail.com>,  Ted Zlatanov <tzz@lifelogs.com>,  32446@debbugs.gnu.org
> Date: Sat, 15 Sep 2018 10:44:04 -0400
> 
> 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.

Thanks.

Gavin, can you test this with your version of GnuTLS?





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

* bug#32446: Configure-time requirement for gnutls is too old
  2018-09-15 15:26     ` Eli Zaretskii
@ 2018-09-15 15:55       ` Gavin Smith
  2018-09-15 16:17         ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Gavin Smith @ 2018-09-15 15:55 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 32446, tzz, Noam Postavsky

On Sat, Sep 15, 2018 at 06:26:51PM +0300, Eli Zaretskii wrote:
> Gavin, can you test this with your version of GnuTLS?

I applied Noam's patch, reconfigured to enable GnuTLS, and ran "make", 
and the build completed successfully.





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

* bug#32446: Configure-time requirement for gnutls is too old
  2018-09-15 15:55       ` Gavin Smith
@ 2018-09-15 16:17         ` Eli Zaretskii
  2018-09-16 20:31           ` Noam Postavsky
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2018-09-15 16:17 UTC (permalink / raw)
  To: Gavin Smith; +Cc: 32446, tzz, npostavs

> From: Gavin Smith <gavinsmith0123@gmail.com>
> Date: Sat, 15 Sep 2018 16:55:09 +0100
> Cc: Noam Postavsky <npostavs@gmail.com>, tzz@lifelogs.com,
>         32446@debbugs.gnu.org
> 
> On Sat, Sep 15, 2018 at 06:26:51PM +0300, Eli Zaretskii wrote:
> > Gavin, can you test this with your version of GnuTLS?
> 
> I applied Noam's patch, reconfigured to enable GnuTLS, and ran "make", 
> and the build completed successfully.

Thanks.

The patch LGTM as well, so, Noam, please push eto emacs-26, and
thanks.





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

* bug#32446: Configure-time requirement for gnutls is too old
  2018-09-15 16:17         ` Eli Zaretskii
@ 2018-09-16 20:31           ` Noam Postavsky
  2018-09-17 23:29             ` Noam Postavsky
  0 siblings, 1 reply; 12+ messages in thread
From: Noam Postavsky @ 2018-09-16 20:31 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 32446, tzz, Gavin Smith

[-- Attachment #1: Type: text/plain, Size: 993 bytes --]

Eli Zaretskii <eliz@gnu.org> 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


[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 5142 bytes --]

From f7d6e2b5b6c4cc24d935d1eee84df4dfc6ded7c8 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
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


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

* bug#32446: Configure-time requirement for gnutls is too old
  2018-09-16 20:31           ` Noam Postavsky
@ 2018-09-17 23:29             ` Noam Postavsky
  2018-09-18 10:28               ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Noam Postavsky @ 2018-09-17 23:29 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 32446, tzz, Gavin Smith

tags 32446 fixed
close 32446 26.2
quit

Noam Postavsky <npostavs@gmail.com> writes:

> I'll push it tomorrow after double checking the updated version on
> Windows.

> +#   ifdef HAVE_GNUTLS_DIGEST_GET_NAME
>    LOAD_DLL_FN (library, gnutls_digest_get_name);

> +#  ifdef HAVE_GNUTLS_DIGEST_GET_NAME
> +#   define gnutls_digest_get_name fn_gnutls_digest_get_name

Fixed those two ifdef checks, and pushed to emacs-26.

[1: b5bee6bf48]: 2018-09-17 17:54:32 -0400
  Fix build with gnutls versions 3.0 to 3.2 (Bug#32446)
  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=b5bee6bf489d8c54a5e39baed4d578ada54c99bf





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

* bug#32446: Configure-time requirement for gnutls is too old
  2018-09-17 23:29             ` Noam Postavsky
@ 2018-09-18 10:28               ` Eli Zaretskii
  2018-09-18 13:14                 ` Noam Postavsky
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2018-09-18 10:28 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: 32446, tzz, gavinsmith0123

> From: Noam Postavsky <npostavs@gmail.com>
> Cc: 32446@debbugs.gnu.org,  tzz@lifelogs.com,  Gavin Smith <gavinsmith0123@gmail.com>
> Date: Mon, 17 Sep 2018 19:29:29 -0400
> 
> > I'll push it tomorrow after double checking the updated version on
> > Windows.
> 
> > +#   ifdef HAVE_GNUTLS_DIGEST_GET_NAME
> >    LOAD_DLL_FN (library, gnutls_digest_get_name);
> 
> > +#  ifdef HAVE_GNUTLS_DIGEST_GET_NAME
> > +#   define gnutls_digest_get_name fn_gnutls_digest_get_name
> 
> Fixed those two ifdef checks, and pushed to emacs-26.
> 
> [1: b5bee6bf48]: 2018-09-17 17:54:32 -0400
>   Fix build with gnutls versions 3.0 to 3.2 (Bug#32446)
>   https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=b5bee6bf489d8c54a5e39baed4d578ada54c99bf

This caused Emacs with GnuTLS 3.4.15 to crash in the test suite.  The
problem is that the test suite avoids trying AEAD-capable ciphers when
AEAD is unavailable, but one of the changes in the above made _all_
ciphers look like not AEAD-capable.

I fixed it by allowing gnutls_cipher_get_tag_size for versions above
3.2.2, as it should at least allow use to continue skipping
AEAD-capable ciphers based on this assumption, and it shouldn't affect
GnuTLS 2.x.





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

* bug#32446: Configure-time requirement for gnutls is too old
  2018-09-18 10:28               ` Eli Zaretskii
@ 2018-09-18 13:14                 ` Noam Postavsky
  2018-09-18 14:08                   ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Noam Postavsky @ 2018-09-18 13:14 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 32446, Ted Zlatanov, Gavin Smith

On 18 September 2018 at 06:28, Eli Zaretskii <eliz@gnu.org> wrote:

> This caused Emacs with GnuTLS 3.4.15 to crash in the test suite.  The
> problem is that the test suite avoids trying AEAD-capable ciphers when
> AEAD is unavailable, but one of the changes in the above made _all_
> ciphers look like not AEAD-capable.

Oh, you mean using an AEAD cipher with the non-AEAD codepath crashes?

> I fixed it by allowing gnutls_cipher_get_tag_size for versions above
> 3.2.2, as it should at least allow use to continue skipping
> AEAD-capable ciphers based on this assumption, and it shouldn't affect
> GnuTLS 2.x.

Right, makes sense.





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

* bug#32446: Configure-time requirement for gnutls is too old
  2018-09-18 13:14                 ` Noam Postavsky
@ 2018-09-18 14:08                   ` Eli Zaretskii
  0 siblings, 0 replies; 12+ messages in thread
From: Eli Zaretskii @ 2018-09-18 14:08 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: 32446, tzz, gavinsmith0123

> From: Noam Postavsky <npostavs@gmail.com>
> Date: Tue, 18 Sep 2018 09:14:46 -0400
> Cc: 32446@debbugs.gnu.org, Ted Zlatanov <tzz@lifelogs.com>, 
> 	Gavin Smith <gavinsmith0123@gmail.com>
> 
> On 18 September 2018 at 06:28, Eli Zaretskii <eliz@gnu.org> wrote:
> 
> > This caused Emacs with GnuTLS 3.4.15 to crash in the test suite.  The
> > problem is that the test suite avoids trying AEAD-capable ciphers when
> > AEAD is unavailable, but one of the changes in the above made _all_
> > ciphers look like not AEAD-capable.
> 
> Oh, you mean using an AEAD cipher with the non-AEAD codepath crashes?

More like "with non-AEAD capable gnutls.c".  It's arguably a bug in
the test suite, but given the available attributes of the ciphgers, I
couldn't find any alternative way of filtering out the AEAD ciphers.





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

end of thread, other threads:[~2018-09-18 14:08 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-15 11:12 bug#32446: Configure-time requirement for gnutls is too old Gavin Smith
2018-08-15 16:09 ` Eli Zaretskii
2018-08-21  2:08   ` Glenn Morris
2018-09-15 14:44   ` Noam Postavsky
2018-09-15 15:26     ` Eli Zaretskii
2018-09-15 15:55       ` Gavin Smith
2018-09-15 16:17         ` Eli Zaretskii
2018-09-16 20:31           ` Noam Postavsky
2018-09-17 23:29             ` Noam Postavsky
2018-09-18 10:28               ` Eli Zaretskii
2018-09-18 13:14                 ` Noam Postavsky
2018-09-18 14:08                   ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).