summaryrefslogtreecommitdiff
path: root/src/gnutls.c
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2018-07-20 10:00:32 -0700
committerGlenn Morris <rgm@gnu.org>2018-07-20 10:00:32 -0700
commit6ee00324619673b402dadb3c28e791b79527868f (patch)
tree57070a6bb9dcf0620107f113f67551fe622c7385 /src/gnutls.c
parent144bcc0132e61cc932348312720d592764022844 (diff)
parent3e722980df9d4a705394c843a2a5e051e9c682b6 (diff)
downloademacs-6ee00324619673b402dadb3c28e791b79527868f.tar.gz
Merge from origin/emacs-26
3e72298 Improve documentation of 'pcase-defmacro rx' ba9b9bb Fix TTY colors breakage by 'clear-face-cache' f56ad42 * admin/MAINTAINERS: Add files maintained by me (Michael Albi... 7a258fa Adapt shadowfile.el for Tramp (Bug#4526, Bug#4846) cb50077 Fix auth-source-delete (Bug#26184) a4767a6 Avoid assertion violations in gnutls.c 90110f8 Don't use a literal "C-u" in ispell.el help message text f4e7f6d Improve documentation of 'seqp' ed13639 Clarify usage and dependencies between several Flyspell features Conflicts: etc/NEWS test/lisp/auth-source-tests.el
Diffstat (limited to 'src/gnutls.c')
-rw-r--r--src/gnutls.c38
1 files changed, 32 insertions, 6 deletions
diff --git a/src/gnutls.c b/src/gnutls.c
index d7a4ee474f7..4e98f16f484 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -2071,7 +2071,14 @@ gnutls_symmetric (bool encrypting, Lisp_Object cipher,
cipher = intern (SSDATA (cipher));
if (SYMBOLP (cipher))
- info = XCDR (Fassq (cipher, Fgnutls_ciphers ()));
+ {
+ info = Fassq (cipher, Fgnutls_ciphers ());
+ if (!CONSP (info))
+ xsignal2 (Qerror,
+ build_string ("GnuTLS cipher is invalid or not found"),
+ cipher);
+ info = XCDR (info);
+ }
else if (TYPE_RANGED_INTEGERP (gnutls_cipher_algorithm_t, cipher))
gca = XINT (cipher);
else
@@ -2086,7 +2093,8 @@ gnutls_symmetric (bool encrypting, Lisp_Object cipher,
ptrdiff_t key_size = gnutls_cipher_get_key_size (gca);
if (key_size == 0)
- error ("GnuTLS cipher is invalid or not found");
+ xsignal2 (Qerror,
+ build_string ("GnuTLS cipher is invalid or not found"), cipher);
ptrdiff_t kstart_byte, kend_byte;
const char *kdata = extract_data_from_object (key, &kstart_byte, &kend_byte);
@@ -2342,7 +2350,14 @@ itself. */)
hash_method = intern (SSDATA (hash_method));
if (SYMBOLP (hash_method))
- info = XCDR (Fassq (hash_method, Fgnutls_macs ()));
+ {
+ info = Fassq (hash_method, Fgnutls_macs ());
+ if (!CONSP (info))
+ xsignal2 (Qerror,
+ build_string ("GnuTLS MAC-method is invalid or not found"),
+ hash_method);
+ info = XCDR (info);
+ }
else if (TYPE_RANGED_INTEGERP (gnutls_mac_algorithm_t, hash_method))
gma = XINT (hash_method);
else
@@ -2357,7 +2372,9 @@ itself. */)
ptrdiff_t digest_length = gnutls_hmac_get_len (gma);
if (digest_length == 0)
- error ("GnuTLS MAC-method is invalid or not found");
+ xsignal2 (Qerror,
+ build_string ("GnuTLS MAC-method is invalid or not found"),
+ hash_method);
ptrdiff_t kstart_byte, kend_byte;
const char *kdata = extract_data_from_object (key, &kstart_byte, &kend_byte);
@@ -2423,7 +2440,14 @@ the number itself. */)
digest_method = intern (SSDATA (digest_method));
if (SYMBOLP (digest_method))
- info = XCDR (Fassq (digest_method, Fgnutls_digests ()));
+ {
+ info = Fassq (digest_method, Fgnutls_digests ());
+ if (!CONSP (info))
+ xsignal2 (Qerror,
+ build_string ("GnuTLS digest-method is invalid or not found"),
+ digest_method);
+ info = XCDR (info);
+ }
else if (TYPE_RANGED_INTEGERP (gnutls_digest_algorithm_t, digest_method))
gda = XINT (digest_method);
else
@@ -2438,7 +2462,9 @@ the number itself. */)
ptrdiff_t digest_length = gnutls_hash_get_len (gda);
if (digest_length == 0)
- error ("GnuTLS digest-method is invalid or not found");
+ xsignal2 (Qerror,
+ build_string ("GnuTLS digest-method is invalid or not found"),
+ digest_method);
gnutls_hash_hd_t hash;
int ret = gnutls_hash_init (&hash, gda);