From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#49055: 28.0.50; [PATCH] De-obfuscate gnutls_handshake loop Date: Sat, 19 Jun 2021 16:47:58 +0300 Message-ID: <83h7huvucx.fsf@gnu.org> References: <87zgvqd35s.fsf@dick> <87zgvmyost.fsf@gnus.org> <83im2avuuu.fsf@gnu.org> <87o8c2vupo.fsf@gnus.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22761"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 49055@debbugs.gnu.org, dick.r.chiang@gmail.com To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jun 19 15:48:10 2021 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 1lubKT-0005iq-Iu for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 19 Jun 2021 15:48:09 +0200 Original-Received: from localhost ([::1]:58320 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lubKS-0004UN-K7 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 19 Jun 2021 09:48:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45142) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lubKM-0004Rb-70 for bug-gnu-emacs@gnu.org; Sat, 19 Jun 2021 09:48:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47298) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lubKL-0004Ge-Vl for bug-gnu-emacs@gnu.org; Sat, 19 Jun 2021 09:48:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lubKL-00014U-Qo for bug-gnu-emacs@gnu.org; Sat, 19 Jun 2021 09:48:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 19 Jun 2021 13:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49055 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 49055-submit@debbugs.gnu.org id=B49055.16241104764107 (code B ref 49055); Sat, 19 Jun 2021 13:48:01 +0000 Original-Received: (at 49055) by debbugs.gnu.org; 19 Jun 2021 13:47:56 +0000 Original-Received: from localhost ([127.0.0.1]:58844 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lubKG-00014A-Dq for submit@debbugs.gnu.org; Sat, 19 Jun 2021 09:47:56 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:47368) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lubKF-00010r-DA for 49055@debbugs.gnu.org; Sat, 19 Jun 2021 09:47:55 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:36732) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lubKA-00046p-4j; Sat, 19 Jun 2021 09:47:50 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:2879 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lubK9-0004nq-PO; Sat, 19 Jun 2021 09:47:50 -0400 In-Reply-To: <87o8c2vupo.fsf@gnus.org> (message from Lars Ingebrigtsen on Sat, 19 Jun 2021 15:40:19 +0200) 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:208741 Archived-At: > From: Lars Ingebrigtsen > Cc: dick.r.chiang@gmail.com, 49055@debbugs.gnu.org > Date: Sat, 19 Jun 2021 15:40:19 +0200 > > Eli Zaretskii writes: > > >> I think that makes sense, so I've now applied your patch to Emacs 28. > > > > The code wasn't really 100% equivalent, though. > > No -- it looped in two different ways, but staring at the code, I > convinced myself that it should be functionally equivalent. > > I may be misreading the code, though. What bothers me: . the gnutls_error_is_fatal call is missing from the new code . the negative values of 'ret' (if they are significant) aren't tested anymore . the condition of GNUTLS_E_INTERRUPTED is tested only once, and immediately causes the outer while-loop to be abandoned I'd love to see some rationale for these differences. For example, the last difference seems to have a potential of causing failure of handshaking if the user happens to type some input (in GUI sessions), or C-g in text-mode sessions, at some opportune moment.