[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#50507: New function in Emacs GnuTLS implementation
From: |
Nikolaos Chatzikonstantinou |
Subject: |
bug#50507: New function in Emacs GnuTLS implementation |
Date: |
Fri, 30 Sep 2022 12:22:16 -0400 |
On Fri, Sep 30, 2022 at 10:32 AM Robert Pluim <rpluim@gmail.com> wrote:
>
> >>>>> On Fri, 30 Sep 2022 09:49:30 -0400, Nikolaos Chatzikonstantinou
> >>>>> <nchatz314@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
Description: Text Data
- bug#50507: New function in Emacs GnuTLS implementation, (continued)
- bug#50507: New function in Emacs GnuTLS implementation, Eli Zaretskii, 2022/09/29
- bug#50507: New function in Emacs GnuTLS implementation, Robert Pluim, 2022/09/29
- bug#50507: New function in Emacs GnuTLS implementation, Nikolaos Chatzikonstantinou, 2022/09/29
- bug#50507: New function in Emacs GnuTLS implementation, Robert Pluim, 2022/09/29
- bug#50507: New function in Emacs GnuTLS implementation, Nikolaos Chatzikonstantinou, 2022/09/30
- bug#50507: New function in Emacs GnuTLS implementation, Eli Zaretskii, 2022/09/30
- bug#50507: New function in Emacs GnuTLS implementation, Nikolaos Chatzikonstantinou, 2022/09/30
- bug#50507: New function in Emacs GnuTLS implementation, Eli Zaretskii, 2022/09/30
- bug#50507: New function in Emacs GnuTLS implementation, Nikolaos Chatzikonstantinou, 2022/09/30
- bug#50507: New function in Emacs GnuTLS implementation, Robert Pluim, 2022/09/30
- bug#50507: New function in Emacs GnuTLS implementation,
Nikolaos Chatzikonstantinou <=