summaryrefslogtreecommitdiff
path: root/src/gnutls.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2017-10-20 22:44:13 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2017-10-20 22:44:13 -0700
commit3155cb1585da7235145d76791feaf6170d8be0f1 (patch)
tree19b655867f27bb630b182f4bdb00a2e2d5ee6427 /src/gnutls.c
parentcb29f41624e5163a0aea4bfc98591e683807a2f8 (diff)
parent11bd8aa24b347f75e674528dd1a94b0a4037105e (diff)
downloademacs-3155cb1585da7235145d76791feaf6170d8be0f1.tar.gz
Merge from origin/emacs-26
11bd8aa24b Fix flymake's loading of subr-x b500e06f4d Fix Bug#28896 d815de017b Skip a Flymake test for old gcc versions fd3d8610b2 Make :align-to account for display-line-numbers 831eafc8ae Augment Flymake API for third-party extensions ddd547fada Improve treatment of Fortran's "class default" 234b1e3864 Flymake backends must check proc obsoleteness in source bu... 3ea6a4d4ba Skip an rsync test in tramp-tests.el 25f83fa7c5 ; Indentation fixes 4d578d432d On Windows default a frame's border width to zero (Bug#28873) 6f1dea5c74 Spelling fixes b8433b0954 Use pop-to-buffer-same-window instead of switch-to-buffer 2f7163fb72 Fix the MSDOS build. 2551d28fe8 Fix line number display after 'widen' dc8812829b Remove resizable attribute on macOS undecorated frames (bu... b970a4a52a Fix handling of `border-width' in `frameset--restore-frame... 445e92658f Mention how to send CC to > 1 address in a bug report 8ca6fa585a Improve format-time-string doc 2e1b3522b8 Improve documentation of 'line-number-display-width' 5b6e59cfdb Implement vc-default-dir-extra-headers for vc-rcs 22adeca42a In NEWS give advice on use of `switch-to-buffer' (Bug#28645) 2c3e6f1ddc Dont update primary selection with winner-undo b38724ab67 Work around ImageMagick bug 825 20cc68e871 Document rectangle-preview option more (Bug#27974) a0b7b301dd Do not reject https://gnu.org in commit messages fb4200a875 Fix Edebug spec for cl-defun (bug#24255) db68cefe72 Fix errors in kmacro.el post-command-hook c63b344c3d Fix range-error in image-dired.el 081d2187c4 Fix 'line-number-display-width' in hscrolled windows 16e85456e7 Fix error in tramp-smb-handle-insert-directory 613db8d35c Don't reject PBM header whitespace unnecessarily 3205b12a78 Fix regression in display of PPM images 1ca9ae7069 Require subr-x when compiling nnimap.el de60992053 Fix ert-test finding by symbol (Bug#28849) 51615a8082 Don't remember old debugger window (Bug#17882) 5980de3727 Disable python native completion on w32 (Bug#28580) 616b4c5956 Let select-frame-by-name choose any frame when called from... 8eb3c01dbd * lisp/dired-aux.el (dired-create-directory): Doc fix. 325dfdae13 Avoid compilation warnings in optimized builds f79382819c ; * src/composite.c (Fclear_composition_cache): Fix last c... f95cd5cd70 Improve customization of arabic-shaper-ZWNJ-handling. a7f154688d Improve customization type of 'mouse-drag-and-drop-region' 864734d112 ; Prefer https: to http: in GNU URLs 3c78960a47 Encourage https: in commit messages def9715282 ; Cleanup of etc/NEWS 4e59ecc646 Fix wording in Elisp manual's child frames section (Bug#28... eda9f5018c Another fix for C mode fontification of w32 source files 05aadd8990 Fix fontification of ALIGN_STACK functions aa0c38f358 Make sure thread stack is properly aligned on MS-Windows d7038020aa Do not under-align pseudovectors ff33053012 Fix indentation bug in multi-line CSS selectors 8968be822e ; * etc/NEWS: Grammar and spelling fixes 716b84034d gnutls_mac_get_nonce_size has been added in gnutls 3.3 55e313f7be ; * CONTRIBUTE: More suggestions for using US English. 622c675648 * CONTRIBUTE: Suggest American English. # Conflicts: # etc/NEWS # msdos/sed2v2.inp
Diffstat (limited to 'src/gnutls.c')
-rw-r--r--src/gnutls.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/src/gnutls.c b/src/gnutls.c
index b55d1b9289f..36f65c4acb3 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -26,7 +26,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#include "coding.h"
#include "buffer.h"
-#if 0x030014 <= GNUTLS_VERSION_NUMBER
+#if GNUTLS_VERSION_NUMBER >= 0x030014
# define HAVE_GNUTLS_X509_SYSTEM_TRUST
#endif
@@ -36,10 +36,16 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
The relevant fix seems to have been made in GnuTLS 3.5.1; see:
https://gitlab.com/gnutls/gnutls/commit/568935848dd6b82b9315d8b6c529d00e2605e03d
So, require 3.5.1. */
-#if 0x030501 <= GNUTLS_VERSION_NUMBER
+#if GNUTLS_VERSION_NUMBER >= 0x030501
# define HAVE_GNUTLS_AEAD
#endif
+/* gnutls_mac_get_nonce_size was added in GnuTLS 3.2.0, but was
+ exported only since 3.3.0. */
+#if GNUTLS_VERSION_NUMBER >= 0x030300
+# define HAVE_GNUTLS_MAC_GET_NONCE_SIZE
+#endif
+
#ifdef HAVE_GNUTLS
# ifdef WINDOWSNT
@@ -187,7 +193,9 @@ DEF_DLL_FN (const char *, gnutls_mac_get_name, (gnutls_mac_algorithm_t));
# ifdef HAVE_GNUTLS3
DEF_DLL_FN (int, gnutls_rnd, (gnutls_rnd_level_t, void *, size_t));
DEF_DLL_FN (const gnutls_mac_algorithm_t *, gnutls_mac_list, (void));
+# ifdef HAVE_GNUTLS_MAC_GET_NONCE_SIZE
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));
DEF_DLL_FN (const gnutls_digest_algorithm_t *, gnutls_digest_list, (void));
DEF_DLL_FN (const char *, gnutls_digest_get_name, (gnutls_digest_algorithm_t));
@@ -316,7 +324,9 @@ init_gnutls_functions (void)
# ifdef HAVE_GNUTLS3
LOAD_DLL_FN (library, gnutls_rnd);
LOAD_DLL_FN (library, gnutls_mac_list);
+# ifdef HAVE_GNUTLS_MAC_GET_NONCE_SIZE
LOAD_DLL_FN (library, gnutls_mac_get_nonce_size);
+# endif
LOAD_DLL_FN (library, gnutls_mac_get_key_size);
LOAD_DLL_FN (library, gnutls_digest_list);
LOAD_DLL_FN (library, gnutls_digest_get_name);
@@ -427,7 +437,9 @@ init_gnutls_functions (void)
# ifdef HAVE_GNUTLS3
# define gnutls_rnd fn_gnutls_rnd
# define gnutls_mac_list fn_gnutls_mac_list
-# define gnutls_mac_get_nonce_size fn_gnutls_mac_get_nonce_size
+# ifdef HAVE_GNUTLS_MAC_GET_NONCE_SIZE
+# 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
@@ -442,10 +454,10 @@ init_gnutls_functions (void)
# define gnutls_cipher_decrypt2 fn_gnutls_cipher_decrypt2
# define gnutls_cipher_deinit fn_gnutls_cipher_deinit
# ifdef HAVE_GNUTLS_AEAD
-# define gnutls_aead_cipher_encrypt fn_gnutls_aead_cipher_encrypt
-# define gnutls_aead_cipher_decrypt fn_gnutls_aead_cipher_decrypt
-# define gnutls_aead_cipher_init fn_gnutls_aead_cipher_init
-# define gnutls_aead_cipher_deinit fn_gnutls_aead_cipher_deinit
+# define gnutls_aead_cipher_encrypt fn_gnutls_aead_cipher_encrypt
+# define gnutls_aead_cipher_decrypt fn_gnutls_aead_cipher_decrypt
+# define gnutls_aead_cipher_init fn_gnutls_aead_cipher_init
+# define gnutls_aead_cipher_deinit fn_gnutls_aead_cipher_deinit
# endif
# define gnutls_hmac_init fn_gnutls_hmac_init
# define gnutls_hmac_get_len fn_gnutls_hmac_get_len
@@ -2178,6 +2190,10 @@ name. */)
/* A symbol representing the GnuTLS MAC algorithm. */
Lisp_Object gma_symbol = intern (gnutls_mac_get_name (gma));
+ size_t nonce_size = 0;
+#ifdef HAVE_GNUTLS_MAC_GET_NONCE_SIZE
+ nonce_size = gnutls_mac_get_nonce_size (gma);
+#endif
Lisp_Object mp = listn (CONSTYPE_HEAP, 11, gma_symbol,
QCmac_algorithm_id, make_number (gma),
QCtype, Qgnutls_type_mac_algorithm,
@@ -2189,7 +2205,7 @@ name. */)
make_number (gnutls_mac_get_key_size (gma)),
QCmac_algorithm_noncesize,
- make_number (gnutls_mac_get_nonce_size (gma)));
+ make_number (nonce_size));
mac_algorithms = Fcons (mp, mac_algorithms);
}