Subject: Re: bug#50507: New function in Emacs GnuTLS implementation

From: Robert Pluim <[email-masked]>
Date: Thu, 29 Sep 2022 16:08:35 +0200

>>>>> On Thu, 29 Sep 2022 09:44:09 -0400, Nikolaos Chatzikonstantinou <[email-masked]> said:
    >> 
    >> 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 :-)

    Nikolaos> Good point. I opted for FOR_EACH_TAIL_SAFE, which seems even better
    Nikolaos> for this case. As documented in ChangeLog.3, it's the right one when
    Nikolaos> the operation is idempotent, which an OR of flags is. (repeated flags
    Nikolaos> do not alter the result.)

OK

    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?

    Nikolaos> Yes, and on that note, I discovered two things. One, the value 0 is
    Nikolaos> special; it has meaning but it is not an enumeration constant. I
    Nikolaos> documented this appropriately. Two, the password may be NULL instead
    Nikolaos> of a string.

OK. I guess youʼre mapping ':pass nil' to that?

    Nikolaos> How can I differentiate between `:pass nil` and not specifying
    Nikolaos> `:pass`? I would like to do this because in the former case I'm
    Nikolaos> calling ...key_file2() and in the latter I'm calling the original
    Nikolaos> ...key_file().

Youʼd do `plist-member' to check if thereʼs a `:pass' in the plist at
all, and then `plist-get' to extract the value.

    Nikolaos> +  DEFSYM (Qgnutls_pkcs_plain, "GNUTLS_PKCS_PLAIN");
    Nikolaos> <removed a few more such lines>
    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ʼm not
    >> 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).

    Nikolaos> I am now comparing against intern("GNUTLS_PKCS_PLAIN") and so on.

I guess thatʼs another option, but itʼs not the preferred
solution. Anyway, letʼs not let the perfect be the enemy of the good.

Thanks

Robert
--