Function: gnutls-macs

gnutls-macs is a function defined in gnutls.c.

Signature

(gnutls-macs)

Documentation

Return alist of GnuTLS mac-algorithm method descriptions as plists.

Use the value of the alist (extract it with alist-get for instance) with gnutls-hash-mac. The alist key is the mac-algorithm method name.

Probably introduced at or before Emacs version 26.1.

Source Code

// Defined in /usr/src/emacs/src/gnutls.c
{
  Lisp_Object mac_algorithms = Qnil;
  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];

      /* A symbol representing the GnuTLS MAC algorithm.  */
      Lisp_Object gma_symbol = intern (gnutls_mac_get_name (gma));

      size_t nonce_size = 0;
# ifdef HAVE_GNUTLS_MAC_GET_NONCE_SIZE
      nonce_size = gnutls_mac_get_nonce_size (gma);
# endif
      Lisp_Object mp =  list (gma_symbol,
			      QCmac_algorithm_id, make_fixnum (gma),
			      QCtype, Qgnutls_type_mac_algorithm,

                              QCmac_algorithm_length,
                              make_fixnum (gnutls_hmac_get_len (gma)),

                              QCmac_algorithm_keysize,
                              make_fixnum (gnutls_mac_get_key_size (gma)),

                              QCmac_algorithm_noncesize,
			      make_fixnum (nonce_size));
      mac_algorithms = Fcons (mp, mac_algorithms);
    }

  return mac_algorithms;
}