GNU bug report logs - #50507
New function in Emacs GnuTLS implementation

Previous Next

Package: emacs;

Reported by: Nikolaos Chatzikonstantinou <nchatz314 <at> gmail.com>

Date: Fri, 10 Sep 2021 12:02:02 UTC

Severity: wishlist

Tags: fixed, moreinfo

Fixed in version 30.1

Done: Robert Pluim <rpluim <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Nikolaos Chatzikonstantinou <nchatz314 <at> gmail.com>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: 50507 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>, larsi <at> gnus.org
Subject: bug#50507: New function in Emacs GnuTLS implementation
Date: Fri, 30 Sep 2022 12:22:16 -0400
[Message part 1 (text/plain, inline)]
On Fri, Sep 30, 2022 at 10:32 AM Robert Pluim <rpluim <at> gmail.com> wrote:
>
> >>>>> On Fri, 30 Sep 2022 09:49:30 -0400, Nikolaos Chatzikonstantinou <nchatz314 <at> gmail.com> said:
>     Nikolaos> +static unsigned int
>     Nikolaos> +key_file2_aux (Lisp_Object flags)
>     Nikolaos> +{
>     Nikolaos> +  unsigned int rv = 0;
>     Nikolaos> +  Lisp_Object tail = flags;
>     Nikolaos> +  FOR_EACH_TAIL_SAFE (tail)
>     Nikolaos> +    {
>     Nikolaos> +      Lisp_Object flag = XCAR (tail);
>     Nikolaos> +      if (EQ (flag, Qgnutls_pkcs_plain))
>     Nikolaos> + rv |= 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 = gnutls_certificate_set_x509_key_file2
>     Nikolaos> +           (x509_cred, SSDATA (certfile), SSDATA (keyfile), file_format,
>     Nikolaos> +            SSDATA (pass), key_file2_aux (flags));
>     Nikolaos> +       else if (NILP (pass) && plist_member (proplist, QCpass))
>     Nikolaos> +         ret = gnutls_certificate_set_x509_key_file2
>     Nikolaos> +           (x509_cred, SSDATA (certfile), SSDATA (keyfile), file_format,
>     Nikolaos> +            NULL, key_file2_aux (flags));
>     Nikolaos> +       else
>     Nikolaos> +         ret = gnutls_certificate_set_x509_key_file
>     Nikolaos> +           (x509_cred, SSDATA (certfile), SSDATA (keyfile), file_format);
>     Nikolaos> +# else
>     Nikolaos>         ret = gnutls_certificate_set_x509_key_file
>     Nikolaos>           (x509_cred, SSDATA (certfile), SSDATA (keyfile), file_format);
>     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ʼs 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

Thanks, I worked those out too, save for the last point you made. Do
you mean this sort of thing:

  #if COND
  if (something)
    foo();
  else
    bar();
  #else
  bar();
  #endif

To be rewritten as

  #if COND
  if (something)
    foo();
  else
  #endif
  bar();

Because in this case, I don't trust that kind of code to survive the
test of time. Someone may come along and break it by modifying the
bar() line, and it might be a sneaky bug. It's not easy to tell.
[0001-add-pass-and-flags-to-gnutls-boot-for-keylist.patch (text/x-patch, attachment)]

This bug report was last modified 2 years and 143 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.