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: Glenn Morris
Subject: Re: master 583995c: GnuTLS HMAC and symmetric cipher support
Date: Mon, 17 Jul 2017 17:37:51 -0400
User-agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)

Paul Eggert wrote:

>> gnutls_mac_get_name and gnutls_digest_get_name can
>> also apparently return NULL
>
> As I recall, they can't return NULL in the contexts where they're
> used, as a previous call already established the validities of their
> arguments.

It's not obvious to me that 2 and 3 below are any different to 1, save
for the fact that GNUTLS_CIPHER_NULL == 1 (and GNUTLS_CIPHER_UNKNOWN ==
0, which is maybe what happens to stop 2 and 3 crashing in the same way
1 does. Seems a bit like a happy accident?):


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));
  ...
}


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));
  ...
}


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));
  ...
}



reply via email to

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