summaryrefslogtreecommitdiff
path: root/lib/priority.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2018-03-29 14:21:59 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2018-10-12 10:30:37 +0200
commit4a11812d9c47213fe1d06bb7b8136901a6b26674 (patch)
treef242c8af22873ad9974f1a4eb46061c031bda86b /lib/priority.c
parent679f3f23fb6132051f855c836aefb6aac2e62881 (diff)
downloadgnutls-4a11812d9c47213fe1d06bb7b8136901a6b26674.tar.gz
pkcs11 uris: the URI scheme is case insensitivetmp-uris
Makes the comparisons of the URI scheme to use c_strcasecmp from gnulib. It also replaces various straw strcasecmp with the gnulib variant. This ensures that comparison will be reliable irrespective of the locale. Resolves #590 Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
Diffstat (limited to 'lib/priority.c')
-rw-r--r--lib/priority.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/lib/priority.c b/lib/priority.c
index afd4b1a680..fb9aba76c8 100644
--- a/lib/priority.c
+++ b/lib/priority.c
@@ -31,6 +31,7 @@
#include <gnutls/x509.h>
#include <c-ctype.h>
#include <hello_ext.h>
+#include <c-strcase.h>
#include "fips.h"
#include "errno.h"
#include "ext/srp.h"
@@ -1687,21 +1688,21 @@ gnutls_priority_init(gnutls_priority_t * priority_cache,
GNUTLS_KX_UNKNOWN) {
if (algo != GNUTLS_KX_INVALID)
fn(&(*priority_cache)->_kx, algo);
- } else if (strncasecmp
+ } else if (c_strncasecmp
(&broken_list[i][1], "VERS-", 5) == 0) {
- if (strncasecmp
+ if (c_strncasecmp
(&broken_list[i][1], "VERS-TLS-ALL",
12) == 0) {
bulk_given_fn(&(*priority_cache)->
protocol,
stream_protocol_priority);
- } else if (strncasecmp
+ } else if (c_strncasecmp
(&broken_list[i][1],
"VERS-DTLS-ALL", 13) == 0) {
bulk_given_fn(&(*priority_cache)->
protocol,
(bulk_given_fn==_add_priority)?dtls_protocol_priority:dgram_protocol_priority);
- } else if (strncasecmp
+ } else if (c_strncasecmp
(&broken_list[i][1],
"VERS-ALL", 8) == 0) {
bulk_fn(&(*priority_cache)->
@@ -1719,14 +1720,14 @@ gnutls_priority_init(gnutls_priority_t * priority_cache,
}
} /* now check if the element is something like -ALGO */
- else if (strncasecmp
+ else if (c_strncasecmp
(&broken_list[i][1], "COMP-", 5) == 0) {
/* ignore all compression methods */
continue;
} /* now check if the element is something like -ALGO */
- else if (strncasecmp
+ else if (c_strncasecmp
(&broken_list[i][1], "CURVE-", 6) == 0) {
- if (strncasecmp
+ if (c_strncasecmp
(&broken_list[i][1], "CURVE-ALL",
9) == 0) {
bulk_fn(&(*priority_cache)->
@@ -1742,9 +1743,9 @@ gnutls_priority_init(gnutls_priority_t * priority_cache,
else
goto error;
}
- } else if (strncasecmp
+ } else if (c_strncasecmp
(&broken_list[i][1], "GROUP-", 6) == 0) {
- if (strncasecmp
+ if (c_strncasecmp
(&broken_list[i][1], "GROUP-ALL",
9) == 0) {
bulk_fn(&(*priority_cache)->
@@ -1824,16 +1825,16 @@ gnutls_priority_init(gnutls_priority_t * priority_cache,
else
goto error;
}
- } else if (strncasecmp
+ } else if (c_strncasecmp
(&broken_list[i][1], "MAC-ALL", 7) == 0) {
bulk_fn(&(*priority_cache)->_mac,
mac_priority_normal);
- } else if (strncasecmp
+ } else if (c_strncasecmp
(&broken_list[i][1], "CIPHER-ALL",
10) == 0) {
bulk_fn(&(*priority_cache)->_cipher,
cipher_priority_normal);
- } else if (strncasecmp
+ } else if (c_strncasecmp
(&broken_list[i][1], "KX-ALL", 6) == 0) {
bulk_fn(&(*priority_cache)->_kx,
kx_priority_secure);