emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master 583995c: GnuTLS HMAC and symmetric cipher support


From: Paul Eggert
Subject: Re: master 583995c: GnuTLS HMAC and symmetric cipher support
Date: Mon, 17 Jul 2017 14:58:44 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

Glenn Morris wrote:

Seems a bit like a happy accident?):

It's not an accident, as every valid cipher etc. has a name.

1. Fgnutls_ciphers. Can intern NULL and crash.
const gnutls_cipher_algorithm_t *gciphers = gnutls_cipher_list ();
for (ptrdiff_t pos = 0; gciphers[pos] != GNUTLS_CIPHER_NULL; pos++)
{
   gnutls_cipher_algorithm_t gca = gciphers[pos];
   Lisp_Object cipher_symbol = intern (gnutls_cipher_get_name (gca));
   ...
}

It's OK, as every cipher other than GNUTLS_CIPHER_NULL has a non-NULL name.

2. Fgnutls_macs.
const gnutls_mac_algorithm_t *macs = gnutls_mac_list ();
for (ptrdiff_t pos = 0; macs[pos] != 0; pos++)
{
   const gnutls_mac_algorithm_t gma = macs[pos];
   Lisp_Object gma_symbol = intern (gnutls_mac_get_name (gma));
   ...
}

Also OK, as every mac algorithm has a non-NULL name.

3. Fgnutls_digests.
const gnutls_digest_algorithm_t *digests = gnutls_digest_list ();
for (ptrdiff_t pos = 0; digests[pos] != 0; pos++)
{
   const gnutls_digest_algorithm_t gda = digests[pos];
   Lisp_Object gda_symbol = intern (gnutls_digest_get_name (gda));
   ...
}

Likewise.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]