From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Nikolaos Chatzikonstantinou Newsgroups: gmane.emacs.bugs Subject: bug#50507: New function in Emacs GnuTLS implementation Date: Thu, 29 Sep 2022 09:44:09 -0400 Message-ID: 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> 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="23621"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 50507@debbugs.gnu.org, Lars Ingebrigtsen , Eli Zaretskii To: Robert Pluim Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Sep 29 17:58:39 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 1odvvq-00061G-H6 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 29 Sep 2022 17:58:38 +0200 Original-Received: from localhost ([::1]:54642 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odvvp-0001XD-K9 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 29 Sep 2022 11:58:37 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37278) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odtqY-0003IT-LW for bug-gnu-emacs@gnu.org; Thu, 29 Sep 2022 09:45:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:37613) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1odtqY-0005p4-4A for bug-gnu-emacs@gnu.org; Thu, 29 Sep 2022 09:45:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1odtqX-0005HC-Sm for bug-gnu-emacs@gnu.org; Thu, 29 Sep 2022 09:45:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Nikolaos Chatzikonstantinou Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 29 Sep 2022 13:45:01 +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.166445906820220 (code B ref 50507); Thu, 29 Sep 2022 13:45:01 +0000 Original-Received: (at 50507) by debbugs.gnu.org; 29 Sep 2022 13:44:28 +0000 Original-Received: from localhost ([127.0.0.1]:36691 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1odtq0-0005G4-Dt for submit@debbugs.gnu.org; Thu, 29 Sep 2022 09:44:28 -0400 Original-Received: from mail-yw1-f179.google.com ([209.85.128.179]:45812) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1odtpy-0005Fq-7R for 50507@debbugs.gnu.org; Thu, 29 Sep 2022 09:44:27 -0400 Original-Received: by mail-yw1-f179.google.com with SMTP id 00721157ae682-3539c6f39d7so14656967b3.12 for <50507@debbugs.gnu.org>; Thu, 29 Sep 2022 06:44:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date; bh=USRXRTnSbfOxayigLekpF/21dVyRKh2lXazStoQghb0=; b=MZMpKF7By2dGW6dsyC6oo2fmqjQ5wIjsszTwfbXYu97iW+Is39ITb2Qwn5qf+PGN7h VviRyHnZoAnS3hIhghbZytNqFxg/YV42w4TG6CrZsDTMYVNCyrND8fZlBLE8n8U/kZhE qCPdBOJeR5zKcZhfcf35QeTWUJv97L7VBTfRJTbQQlgmBskZV8icXk+ZpxwDCSiGetpO 6gywRaZSLz9FylV4neZCleybrzwonDLE+CCzks091uqf1XCtEK1FTtReGvHFOjJtTgeu kq3S6BaQFYdBLJaOhAsE9VJdroF2tdpmpzh5qFqIvOXAiHKpqB0NT4+/ZG60O3L2jY21 uj6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date; bh=USRXRTnSbfOxayigLekpF/21dVyRKh2lXazStoQghb0=; b=LFoM/UgHA7zoi+gKVCJekGJJ6uepmSr5EynQ60WacNhRwhscH3Lm0wafu5bdi5OOKR SxCBzefQb7N5XZnah3cvVNUHLizozGxnMqbRmkQiWHs54Qekx1uaO/fcJCT20Gf5Pw/5 LgO9pVHxiPg7cNcE/EMPexsHPvSs1Osq+0PL4AhPuK2tvs/26u/h54FwZlyYw0aXVhTW WbVRDtWcI0nT0q0Dsh0KCqHd7g1ChCD7DypRV5/yK3kSfDWTcNtPKfdF1AkmbWTs8rpq S5B/Pqb9Awt+UCcKh1zM/C3+OMO9WUvaJxx1H5+t3BV3ZbdWAXFPjrkh7FpMe9zZ0soa os/Q== X-Gm-Message-State: ACrzQf1qvqv52NSP0hqhLrh3HILvHyQm+0f9iuEqc7+SIKfNjKF6fbId VE/qmG8NVpOqKQYwMgtDfeXnrCMtxrE5t1UnjwY= X-Google-Smtp-Source: AMsMyM5yaqGYulnrA9eKK0xVJSl97t6BwnNDbZxIO1D0DLCnyYhoaRZXw9CssE4h2Qt7g5K2YN4UWMEy7o811q3a5ek= X-Received: by 2002:a81:54c5:0:b0:353:889c:5ea1 with SMTP id i188-20020a8154c5000000b00353889c5ea1mr3240061ywb.331.1664459060610; Thu, 29 Sep 2022 06:44:20 -0700 (PDT) In-Reply-To: <87a66id03q.fsf@gmail.com> 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:243919 Archived-At: On Thu, Sep 29, 2022 at 5:02 AM Robert Pluim wrote: > > >>>>> On Wed, 28 Sep 2022 23:09:46 -0400, Nikolaos Chatzikonstantinou said: > > Nikolaos> From b11707c423773f6234746991222acd80ab3f708c Mon Sep 17 00= :00:00 2001 > Nikolaos> From: Nikolaos Chatzikonstantinou > Nikolaos> Date: Mon, 26 Sep 2022 11:08:18 -0400 > Nikolaos> Subject: [PATCH] add :pass and :flags to gnutls-boot for :k= eylist > > Nikolaos> + corresponds to a GnuTLS C flag, the ORed result is to b= e passed to > Nikolaos> + the function gnutls_certificate_set_x509_key_file2() as= its last > Nikolaos> + argument. > Nikolaos> +*/ > Nikolaos> +static unsigned int > Nikolaos> +key_file2_aux (Lisp_Object flags) > Nikolaos> +{ > Nikolaos> + unsigned int rv =3D 0; > Nikolaos> + Lisp_Object tail; > Nikolaos> + for (tail =3D flags; CONSP (tail); tail =3D XCDR (tail)) > > We have some convenience macros in lisp.h for traversing lists, one of > which is FOR_EACH_TAIL. The reason to prefer it is that it will detect > circular lists, which is good practice since this list will come from > the user level, so it could be anything :-) Good point. I opted for FOR_EACH_TAIL_SAFE, which seems even better for this case. As documented in ChangeLog.3, it's the right one when the operation is idempotent, which an OR of flags is. (repeated flags do not alter the result.) > Nikolaos> +The :pass and :flags keys are ignored with old versions of= GnuTLS, and > Nikolaos> +:flags is ignored if :pass is not specified. > Nikolaos> + > > Maybe mention that not specifying :flags or passing :flags nil means > passing '0' to the GnuTLS function? Yes, and on that note, I discovered two things. One, the value 0 is special; it has meaning but it is not an enumeration constant. I documented this appropriately. Two, the password may be NULL instead of a string. How can I differentiate between `:pass nil` and not specifying `:pass`? I would like to do this because in the former case I'm calling ...key_file2() and in the latter I'm calling the original ...key_file(). > Nikolaos> + DEFSYM (Qgnutls_pkcs_plain, "GNUTLS_PKCS_PLAIN"); > Nikolaos> + DEFSYM (Qgnutls_pkcs_pbes2_gost_cpd, "GNUTLS_PKCS_PBES2_= GOST_CPD"); > > All this is kind of awkward, but apart from doing DEFVAR_LISP I=CA=BCm no= t > aware of how to define a lisp level symbol with a value (it would > allow you to simplify `key_file2_aux', since you could just extract > the values directly from the symbols). I am now comparing against intern("GNUTLS_PKCS_PLAIN") and so on. I will hold off the submission of the final patch until I figure out the :pass issue that I mentioned above. Regards, Nikolaos Chatzikonstantinou