summaryrefslogtreecommitdiff
path: root/tests
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 /tests
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 'tests')
-rw-r--r--tests/Makefile.am10
-rw-r--r--tests/pkcs11/pkcs11-import-url-privkey.c10
2 files changed, 17 insertions, 3 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 71d00bcd32..536171995d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -324,6 +324,11 @@ pkcs11_obj_raw_SOURCES = pkcs11/pkcs11-obj-raw.c
pkcs11_obj_raw_DEPENDENCIES = libpkcs11mock1.la libutils.la
pkcs11_obj_raw_LDADD = $(LDADD) $(LIBDL)
+pkcs11_import_url_privkey_caps_SOURCES = pkcs11/pkcs11-import-url-privkey.c
+pkcs11_import_url_privkey_caps_DEPENDENCIES = libpkcs11mock1.la libutils.la
+pkcs11_import_url_privkey_caps_LDADD = $(LDADD) $(LIBDL)
+pkcs11_import_url_privkey_caps_CFLAGS = -DALL_CAPS_URI
+
pkcs11_privkey_fork_SOURCES = pkcs11/pkcs11-privkey-fork.c
pkcs11_privkey_fork_DEPENDENCIES = libpkcs11mock1.la libutils.la
pkcs11_privkey_fork_LDADD = $(LDADD) $(LIBDL)
@@ -361,6 +366,9 @@ ctests += pkcs11-cert-import-url-exts pkcs11-get-exts pkcs11-get-raw-issuer-exts
pkcs11/gnutls_x509_crt_list_import_url pkcs11/gnutls_pcert_list_import_x509_file \
pkcs11-token-raw pkcs11-obj-raw
+if P11KIT_0_23_11_API
+ctests += pkcs11-import-url-privkey-caps
+endif
endif
endif
@@ -443,7 +451,7 @@ if ENABLE_PKCS11
dist_check_SCRIPTS += p11-kit-trust.sh testpkcs11.sh certtool-pkcs11.sh
if HAVE_PKCS11_TRUST_STORE
-if P11KIT_0_23_10_API
+if P11KIT_0_23_11_API
dist_check_SCRIPTS += p11-kit-load.sh
indirect_tests += pkcs11/list-tokens
endif
diff --git a/tests/pkcs11/pkcs11-import-url-privkey.c b/tests/pkcs11/pkcs11-import-url-privkey.c
index cb44fb1e53..38d40b666d 100644
--- a/tests/pkcs11/pkcs11-import-url-privkey.c
+++ b/tests/pkcs11/pkcs11-import-url-privkey.c
@@ -39,6 +39,12 @@
/* Tests the private key import for sensitive keys in the common case and in
* some problematic cases. */
+#ifdef ALL_CAPS_URI
+#define PURI "PKCS11:"
+#else
+#define PURI "pkcs11:"
+#endif
+
#ifdef _WIN32
# define P11LIB "libpkcs11mock1.dll"
#else
@@ -76,7 +82,7 @@ void doit(void)
exit(1);
}
- ret = gnutls_pkcs11_obj_list_import_url4(&obj_list, &obj_list_size, "pkcs11:", GNUTLS_PKCS11_OBJ_FLAG_PRIVKEY);
+ ret = gnutls_pkcs11_obj_list_import_url4(&obj_list, &obj_list_size, PURI, GNUTLS_PKCS11_OBJ_FLAG_PRIVKEY);
if (ret < 0) {
fail("%d: %s\n", ret, gnutls_strerror(ret));
exit(1);
@@ -107,7 +113,7 @@ void doit(void)
*pflags = MOCK_FLAG_BROKEN_GET_ATTRIBUTES;
- ret = gnutls_pkcs11_obj_list_import_url4(&obj_list, &obj_list_size, "pkcs11:", GNUTLS_PKCS11_OBJ_FLAG_PRIVKEY);
+ ret = gnutls_pkcs11_obj_list_import_url4(&obj_list, &obj_list_size, PURI, GNUTLS_PKCS11_OBJ_FLAG_PRIVKEY);
if (ret < 0) {
fail("%d: %s\n", ret, gnutls_strerror(ret));
exit(1);