From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#42998: 27.1; gnutls-symmetric-encrypt slow when providing cipher as symbol Date: Mon, 24 Aug 2020 16:28:21 +0200 Message-ID: <87o8n09kze.fsf@gnus.org> References: <20200823164330.GA72308@odonien.localdomain> <87y2m4ci5u.fsf@gnus.org> <835z986ugv.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8367"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: mail@vasilij.de, 42998@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 24 16:29:17 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kADTH-00020R-RZ for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 24 Aug 2020 16:29:15 +0200 Original-Received: from localhost ([::1]:38748 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kADTG-0007lQ-RS for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 24 Aug 2020 10:29:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42670) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kADT6-0007lI-2V for bug-gnu-emacs@gnu.org; Mon, 24 Aug 2020 10:29:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47231) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kADT4-0002Ye-6i for bug-gnu-emacs@gnu.org; Mon, 24 Aug 2020 10:29:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kADT4-0001ZO-1A for bug-gnu-emacs@gnu.org; Mon, 24 Aug 2020 10:29:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 24 Aug 2020 14:29:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42998 X-GNU-PR-Package: emacs Original-Received: via spool by 42998-submit@debbugs.gnu.org id=B42998.15982793146000 (code B ref 42998); Mon, 24 Aug 2020 14:29:01 +0000 Original-Received: (at 42998) by debbugs.gnu.org; 24 Aug 2020 14:28:34 +0000 Original-Received: from localhost ([127.0.0.1]:58776 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kADSc-0001Yi-BQ for submit@debbugs.gnu.org; Mon, 24 Aug 2020 10:28:34 -0400 Original-Received: from quimby.gnus.org ([95.216.78.240]:58324) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kADSa-0001YV-L6 for 42998@debbugs.gnu.org; Mon, 24 Aug 2020 10:28:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=7Dk15lGpMK/Eou0qZkRxwoLFMcqNawt4G+XMFZjxfFw=; b=PHFnECrTh1gyctpj5Jk/EY0IU8 eS2Y5vOGFFtz4pUv3mUUw7H13X49zHMx4EmXoQQWCTD4VeLz866aFPiTpBs75ltS32lbb4ifhdtP8 3THIrT6FJ9RzOu5jFkCD6xMpX21MKNoN2Xrxu7DaEXS+9Zn9Z8ZHAGuu3xrKWeYBxqj0=; Original-Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kADSR-0007R2-D1; Mon, 24 Aug 2020 16:28:26 +0200 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAIVBMVEXKEBrSESPYKC6Z EBVSCxEfBwttCxJoKimMSkh8Q0D////HQmIzAAAAAWJLR0QKaND0VgAAAAd0SU1FB+QIGA4aHT1p fI0AAAGoSURBVDjLdZNNTuQwEIUTBbGGuQFzgkYevG6JcnyAuGALStpodiyC3KxnpE7fIMedqvJP wqR5y/flxVXPSVX/zPpxd3e7qMqqb7/oplrpC6u+ixS7Ump3CTRg0N1fAAZJbrcB9QEdsW4LHtB+ oHu5AJ5PAY9/6s0ZV8/zMUzj63YPO0/TOTxuwXma5umvfd3sEebpPI2w/x8ofZzP8yWgfp9CGO37 FryFED5PoV65jVKN9wOCDca+LH2Tr67bASy60YZ9tnfsMzABnQ1jt7ycpR1Iv4BdtAqQclldcgqA DJoV6L03mIFagKZZC3hSugDvOZH0pL28u4r+Cqg+JbSAwwKUoIpdAD+4hFx80BMYAKDlrmLCZ8A+ RbxPiQIAEonnQwYDZNEhDrH1IKdWxW8hJpIWAHQIvc1tQKsRf3VmDWK8v3YG3KGAPBXsmv7B0E9C O0WQ9EiArkuATCUul0NA8S4yIAEpV+rkkgaZigIt30evpekCWtlcyieg+4FLNm6IzclFSYA+OR4I U6VpKr5gwwa46OdxOePTs6ldAPkA45KytjGyIH6jf75JBbLZywoVAAAAJXRFWHRkYXRlOmNyZWF0 ZQAyMDIwLTA4LTI0VDE0OjI2OjI5KzAwOjAw2kmn/wAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMC0w OC0yNFQxNDoyNjoyOSswMDowMKsUH0MAAAAASUVORK5CYII= X-Now-Playing: Sevdaliza's _ISON_: "Marilyn Monroe" In-Reply-To: <835z986ugv.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 24 Aug 2020 16:31:44 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:186156 Archived-At: 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