Function: gnutls-ciphers

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

Signature

(gnutls-ciphers)

Documentation

Return alist of GnuTLS symmetric cipher descriptions as plists.

The alist key is the cipher name.

Probably introduced at or before Emacs version 26.1.

Source Code

// Defined in /usr/src/emacs/src/gnutls.c
{
  Lisp_Object ciphers = Qnil;

  const gnutls_cipher_algorithm_t *gciphers = gnutls_cipher_list ();
  for (ptrdiff_t pos = 0; gciphers[pos] != 0; pos++)
    {
      gnutls_cipher_algorithm_t gca = gciphers[pos];
      if (gca == GNUTLS_CIPHER_NULL)
	continue;
      char const *cipher_name = gnutls_cipher_get_name (gca);
      if (!cipher_name)
	continue;

      /* A symbol representing the GnuTLS cipher.  */
      Lisp_Object cipher_symbol = intern (cipher_name);

      ptrdiff_t cipher_tag_size = gnutls_cipher_get_tag_size (gca);

      Lisp_Object cp
	 = list (cipher_symbol,
		 QCcipher_id, make_fixnum (gca),
		 QCtype, Qgnutls_type_cipher,
		 QCcipher_aead_capable, cipher_tag_size == 0 ? Qnil : Qt,
		 QCcipher_tagsize, make_fixnum (cipher_tag_size),

		 QCcipher_blocksize,
		 make_fixnum (gnutls_cipher_get_block_size (gca)),

		 QCcipher_keysize,
		 make_fixnum (gnutls_cipher_get_key_size (gca)),

		 QCcipher_ivsize,
		 make_fixnum (gnutls_cipher_get_iv_size (gca)));

      ciphers = Fcons (cp, ciphers);
    }

  return ciphers;
}