diff options
author | Tim Rühsen <tim.ruehsen@gmx.de> | 2018-09-27 21:11:21 +0200 |
---|---|---|
committer | Tim Rühsen <tim.ruehsen@gmx.de> | 2018-09-27 21:15:58 +0200 |
commit | 65f0988f74fa4a6c2ff474f0b63ea928c1cde929 (patch) | |
tree | 41bd236c96ac482e2a60e455248678c61cb84e16 /lib/algorithms/mac.c | |
parent | c9c4523eaddbfd8e7fb7855e31de4f1d88ec1c06 (diff) | |
download | gnutls-tmp-lib-c-strcase.tar.gz |
Use ASCII version of strcasecmp() in library codetmp-lib-c-strcase
strcasecmp() has side effects in some locales.
What we really need is c_strcasecmp() from Gnulib for comparing
ASCII strings.
Fixes #570
Signed-off-by: Tim Rühsen <tim.ruehsen@gmx.de>
Diffstat (limited to 'lib/algorithms/mac.c')
-rw-r--r-- | lib/algorithms/mac.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/algorithms/mac.c b/lib/algorithms/mac.c index 8fc1da2254..6573b35686 100644 --- a/lib/algorithms/mac.c +++ b/lib/algorithms/mac.c @@ -25,6 +25,7 @@ #include <algorithms.h> #include "errors.h" #include <x509/common.h> +#include "c-strcase.h" #define MAC_OID_SHA1 "1.2.840.113549.2.7" #define MAC_OID_SHA224 "1.2.840.113549.2.8" @@ -229,7 +230,7 @@ gnutls_digest_algorithm_t gnutls_digest_get_id(const char *name) gnutls_digest_algorithm_t ret = GNUTLS_DIG_UNKNOWN; GNUTLS_HASH_LOOP( - if (p->oid != NULL && strcasecmp(p->name, name) == 0) { + if (p->oid != NULL && c_strcasecmp(p->name, name) == 0) { if (_gnutls_digest_exists((gnutls_digest_algorithm_t)p->id)) ret = (gnutls_digest_algorithm_t)p->id; break; @@ -254,7 +255,7 @@ gnutls_mac_algorithm_t gnutls_mac_get_id(const char *name) gnutls_mac_algorithm_t ret = GNUTLS_MAC_UNKNOWN; GNUTLS_HASH_LOOP( - if (strcasecmp(p->name, name) == 0) { + if (c_strcasecmp(p->name, name) == 0) { if (p->placeholder != 0 || _gnutls_mac_exists(p->id)) ret = p->id; break; @@ -351,7 +352,7 @@ const gnutls_digest_algorithm_t *gnutls_digest_list(void) GNUTLS_HASH_LOOP( if (p->oid != NULL && (p->placeholder != 0 || _gnutls_mac_exists(p->id))) { - + supported_digests[i++] = (gnutls_digest_algorithm_t)p->id; } ); |