From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.bugs Subject: bug#50507: New function in Emacs GnuTLS implementation Date: Fri, 30 Sep 2022 16:32:16 +0200 Message-ID: <87a66haq6n.fsf@gmail.com> References: <83ee9wiozc.fsf@gnu.org> <87sflkgy49.fsf@gnus.org> <87edwd15ck.fsf@gnus.org> <87tu4u8kjv.fsf@gnus.org> <878rm69hop.fsf@gmail.com> <87v8p7d4oq.fsf@gmail.com> <87a66id03q.fsf@gmail.com> <875yh6cly4.fsf@gmail.com> <83ill5dtqt.fsf@gnu.org> <837d1ldlv3.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8160"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 50507@debbugs.gnu.org, Eli Zaretskii , larsi@gnus.org To: Nikolaos Chatzikonstantinou Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 30 16:33:24 2022 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 1oeH4t-0001zz-Qk for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 30 Sep 2022 16:33:23 +0200 Original-Received: from localhost ([::1]:40740 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oeH4s-0004hK-Lp for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 30 Sep 2022 10:33:22 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44958) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oeH4a-0004fD-0e for bug-gnu-emacs@gnu.org; Fri, 30 Sep 2022 10:33:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43525) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oeH4Y-0008Kg-Jj for bug-gnu-emacs@gnu.org; Fri, 30 Sep 2022 10:33:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oeH4Y-00016f-3H for bug-gnu-emacs@gnu.org; Fri, 30 Sep 2022 10:33:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Robert Pluim Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 30 Sep 2022 14:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50507 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 50507-submit@debbugs.gnu.org id=B50507.16645483484210 (code B ref 50507); Fri, 30 Sep 2022 14:33:02 +0000 Original-Received: (at 50507) by debbugs.gnu.org; 30 Sep 2022 14:32:28 +0000 Original-Received: from localhost ([127.0.0.1]:42603 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oeH40-00015q-HS for submit@debbugs.gnu.org; Fri, 30 Sep 2022 10:32:28 -0400 Original-Received: from mail-wm1-f41.google.com ([209.85.128.41]:38435) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oeH3w-00015Y-4W for 50507@debbugs.gnu.org; Fri, 30 Sep 2022 10:32:27 -0400 Original-Received: by mail-wm1-f41.google.com with SMTP id c192-20020a1c35c9000000b003b51339d350so5147131wma.3 for <50507@debbugs.gnu.org>; Fri, 30 Sep 2022 07:32:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date; bh=YuOXHEZ7xM9pvWQvlX5Bt3d0GPecRabWcWXrPm+5kYI=; b=JCZE7Jh3FONon2vUhauKaEGb+8yC+jUST/cAjTXLFm6EdROzqjGw2L98NfqUwIEupb 9D/1jadgkh7bqgE5nuBtyX+nr0EVmWvtosu1+BXs17nfZy6tW3kAdpR+RnPT4Hnu1fff uCF5rA3rp2055BpFyFN6nNBJtSWPLeqqp3RgsVKweQhDzDqGpRUhlMOhpfQ076LyJQil 07PsvRW8UauT/hG/3iwkhf6LaHWWkoUpYGcySqkDZbibNNDO8d7/jcKIc5GPUB2YcAam hVwtRMQlkzEGHgUzd44NtPOt6owCPxJq2lHdxK0+xGpjhYTgGFyEdjJBg846nUrOoP8W U5lA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=YuOXHEZ7xM9pvWQvlX5Bt3d0GPecRabWcWXrPm+5kYI=; b=5k/EvenSJmc+9YU6GCBXTCPEcf0zWQnAuCwoPo4Ncq8fZXpFYVXKrSNecDN7XiOOYZ MNJ9jf2tO3JOeyJDbwG0bWqxxwke9Vthb8V23OFN9dPh4DIO1BXqOYAgzgUzlTOUlLYR 2cP+VGG+nTIwBOCLBYfygYdLMeVbxdyVmX6Yv092974CfjNZXT/5bN+UTREWky7HMYyK gRkDhhc/k/mejTJYT7bko4acTSdBO0/nQHrJnbHJSwOKqKn6tLAm8V7ko8NaL7T2o25h 6iTUmroHNy2LNFS0Q0n0b1nqx9s3Vn7vX+TtgUVXdL3kih7IIT89mTfv4LOxy5i8EgUr 5aIQ== X-Gm-Message-State: ACrzQf0pod/JdnaBcSioUZfLpQbm1Z/2wfVieXQuDMMnd3ahltdI4IWb pe9gkE3zBlAHYm8NLSDBVOI= X-Google-Smtp-Source: AMsMyM4eI+/O2fBt1HKj9KTXpzkuPGkA2bRAJmRc8VjhUsbBWOqTVEcxGu9TtzzR6ZTY0MU1Ly8FVA== X-Received: by 2002:a05:600c:3845:b0:3b4:b187:3d09 with SMTP id s5-20020a05600c384500b003b4b1873d09mr14402552wmr.96.1664548337991; Fri, 30 Sep 2022 07:32:17 -0700 (PDT) Original-Received: from rltb ([2a01:e0a:3f3:fb50:2c11:2d7e:10f:9126]) by smtp.gmail.com with ESMTPSA id bg29-20020a05600c3c9d00b003b47a99d928sm2588339wmb.18.2022.09.30.07.32.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Sep 2022 07:32:17 -0700 (PDT) In-Reply-To: (Nikolaos Chatzikonstantinou's message of "Fri, 30 Sep 2022 09:49:30 -0400") 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:244025 Archived-At: >>>>> On Fri, 30 Sep 2022 09:49:30 -0400, Nikolaos Chatzikonstantinou said: Nikolaos> +static unsigned int Nikolaos> +key_file2_aux (Lisp_Object flags) Nikolaos> +{ Nikolaos> + unsigned int rv =3D 0; Nikolaos> + Lisp_Object tail =3D flags; Nikolaos> + FOR_EACH_TAIL_SAFE (tail) Nikolaos> + { Nikolaos> + Lisp_Object flag =3D XCAR (tail); Nikolaos> + if (EQ (flag, Qgnutls_pkcs_plain)) Nikolaos> + rv |=3D GNUTLS_PKCS_PLAIN; Nikolaos> + else if(EQ (flag, Qgnutls_pkcs_pkcs12_3des)) Space after 'if' here and in the rest of the function Nikolaos> +# ifdef HAVE_GNUTLS_CERTIFICATE_SET_X509_KEY_FILE2 Nikolaos> + if (STRINGP (pass)) Nikolaos> + ret =3D gnutls_certificate_set_x509_key_file2 Nikolaos> + (x509_cred, SSDATA (certfile), SSDATA (keyfile), file_fo= rmat, Nikolaos> + SSDATA (pass), key_file2_aux (flags)); Nikolaos> + else if (NILP (pass) && plist_member (proplist, QCpas= s)) Nikolaos> + ret =3D gnutls_certificate_set_x509_key_file2 Nikolaos> + (x509_cred, SSDATA (certfile), SSDATA (keyfile), file_fo= rmat, Nikolaos> + NULL, key_file2_aux (flags)); Nikolaos> + else Nikolaos> + ret =3D gnutls_certificate_set_x509_key_file Nikolaos> + (x509_cred, SSDATA (certfile), SSDATA (keyfile), file_fo= rmat); Nikolaos> +# else Nikolaos> ret =3D gnutls_certificate_set_x509_key_file Nikolaos> (x509_cred, SSDATA (certfile), SSDATA (keyfile), file_form= at); Nikolaos> +# endif 2 minor points: - If you use an intermediate variable for the C version of pass, you can set it correctly based on `plist_member' etc, and only have one call to _file2 (as it is it=CA=BCs kind of difficult to quickly see the difference between the two calls) - I think you can then rework the #else/#endif here to avoid repetition of the call to the _file variant Robert --=20