GNU bug report logs - #42998
27.1; gnutls-symmetric-encrypt slow when providing cipher as symbol

Previous Next

Package: emacs;

Reported by: Vasilij Schneidermann <mail <at> vasilij.de>

Date: Sun, 23 Aug 2020 16:44:02 UTC

Severity: normal

Tags: fixed

Found in version 27.1

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 42998 <at> debbugs.gnu.org, mail <at> vasilij.de
Subject: bug#42998: 27.1; gnutls-symmetric-encrypt slow when providing cipher as symbol
Date: Mon, 24 Aug 2020 16:28:21 +0200
OK, I've redone this as a file-local variable, but I'm not totally sure
that I'm putting this inside the correct #ifdefs.  :-/

gnutls.c is a mess if #ifdefs -- does Emacs have a command that lists
all the #ifdefs that are in effect at the current point?

diff --git a/src/gnutls.c b/src/gnutls.c
index 416fb15470..0010553a9d 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -2298,6 +2298,8 @@ gnutls_symmetric_aead (bool encrypting, gnutls_cipher_algorithm_t gca,
 # endif
 }
 
+static Lisp_Object cipher_cache;
+
 static Lisp_Object
 gnutls_symmetric (bool encrypting, Lisp_Object cipher,
                   Lisp_Object key, Lisp_Object iv,
@@ -2329,7 +2331,9 @@ gnutls_symmetric (bool encrypting, Lisp_Object cipher,
 
   if (SYMBOLP (cipher))
     {
-      info = Fassq (cipher, Fgnutls_ciphers ());
+      if (NILP (cipher_cache))
+	cipher_cache = Fgnutls_ciphers ();
+      info = Fassq (cipher, cipher_cache);
       if (!CONSP (info))
 	xsignal2 (Qerror,
 		  build_string ("GnuTLS cipher is invalid or not found"),
@@ -2914,6 +2918,9 @@ syms_of_gnutls (void)
   defsubr (&Sgnutls_hash_digest);
   defsubr (&Sgnutls_symmetric_encrypt);
   defsubr (&Sgnutls_symmetric_decrypt);
+
+  cipher_cache = Qnil;
+  staticpro (&cipher_cache);
 #endif
 
   DEFVAR_INT ("gnutls-log-level", global_gnutls_log_level,


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





This bug report was last modified 4 years and 313 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.