]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
gnutls_hash/hmac_copy: check its usability in all cases
authorNikos Mavrogiannopoulos <nmav@redhat.com>
Wed, 26 Jun 2019 09:27:27 +0000 (11:27 +0200)
committerDmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Wed, 26 Jun 2019 11:17:47 +0000 (14:17 +0300)
During the test suite run we require that all supported
MAC and hash algorithms implement the copy function.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
lib/crypto-selftests.c
tests/Makefile.am
tests/cert-tests/Makefile.am
tests/slow/Makefile.am
tests/slow/override-ciphers
tests/suite/Makefile.am
tests/windows/Makefile.am

index 51105938459926b9519a6f8cb081bdad9f81bf40..eddf93568003418bf7ecb9d9759907a829b9f171 100644 (file)
@@ -1375,10 +1375,8 @@ static int test_digest(gnutls_digest_algorithm_t dig,
                copy = gnutls_hash_copy(hd);
                /* Returning NULL is not an error here for the time being, but
                 * it might become one later */
-#if 0
-               if (!copy)
+               if (!copy && secure_getenv("GNUTLS_TEST_SUITE_RUN"))
                        return gnutls_assert_val(GNUTLS_E_SELF_TEST_ERROR);
-#endif
 
                ret = gnutls_hash(hd,
                                  &vectors[i].plaintext[1],
@@ -1591,10 +1589,8 @@ static int test_mac(gnutls_mac_algorithm_t mac,
                copy = gnutls_hmac_copy(hd);
                /* Returning NULL is not an error here for the time being, but
                 * it might become one later */
-#if 0
-               if (!copy)
+               if (!copy && secure_getenv("GNUTLS_TEST_SUITE_RUN"))
                        return gnutls_assert_val(GNUTLS_E_SELF_TEST_ERROR);
-#endif
 
                ret = gnutls_hmac(hd,
                                  &vectors[i].plaintext[1],
index 62b2db75e5ec857b790e08d029bb9b208067c397..98623a20c85c6f4e8a19e6054fec64f012862777 100644 (file)
@@ -571,6 +571,7 @@ TESTS_ENVIRONMENT +=                                                \
        PSK_FILE=$(srcdir)/psk.passwd                           \
        OPENSSL_ia32cap=0x00000000                              \
        EXEEXT=$(EXEEXT)                                        \
+       GNUTLS_TEST_SUITE_RUN=1                                 \
        builddir="$(builddir)"                                  \
        top_builddir="$(top_builddir)"                          \
        libdir="$(libdir)"                                      \
index 06bdf42950aa2cec69a4fa553d2d1b1af166839e..c34b69c40afb250ff9cda205de4795a1cfe03d3e 100644 (file)
@@ -146,6 +146,7 @@ TESTS_ENVIRONMENT = EXEEXT=$(EXEEXT) \
        top_builddir="$(top_builddir)"          \
        ac_cv_sizeof_time_t="$(ac_cv_sizeof_time_t)" \
        ASAN_OPTIONS="detect_leaks=0:exitcode=6" \
+       GNUTLS_TEST_SUITE_RUN=1                 \
        srcdir="$(srcdir)"
 
 if ENABLE_FIPS140
index 7e8e4650ca1ab41dd0100f578921eee703c5dd9b..b4c43c6aa325d12fdd461c3a2799ffdf5b6433cb 100644 (file)
@@ -65,6 +65,7 @@ EXTRA_DIST = README gnutls-asan.supp
 TESTS_ENVIRONMENT = EXEEXT=$(EXEEXT) \
        LC_ALL="C"                                              \
        LSAN_OPTIONS=suppressions=gnutls-asan.supp              \
+       GNUTLS_TEST_SUITE_RUN=1                                 \
        OPENSSL_ia32cap=0x00000000                              \
        top_builddir="$(top_builddir)"                          \
        srcdir="$(srcdir)"
index 2a87b7655f8fa716b4c332b86c47766824220770..3c00e5be3e74ef0d3faa1023047ee40650639b3b 100755 (executable)
@@ -26,6 +26,11 @@ if ! test -z "${VALGRIND}"; then
 fi
 PROG=./cipher-override${EXEEXT}
 
+# we are explicitly unsetting this variable, because we want
+# the "production" checks to be triggered, not the ones in the
+# test suite.
+
+unset GNUTLS_TEST_SUITE_RUN
 GNUTLS_NO_EXPLICIT_INIT=1 ${VALGRIND} ${PROG}
 ret=$?
 if test $ret != 0; then
index bd3a56cc35825a3fde691f760d7eca8381ad8c18..b4da01a375656be600a82b3c7b177cc752b3ac2e 100644 (file)
@@ -102,6 +102,7 @@ TESTS_ENVIRONMENT = EXEEXT=$(EXEEXT) \
        top_builddir="$(top_builddir)"  \
        srcdir="$(srcdir)"              \
        ASAN_OPTIONS="detect_leaks=0"   \
+       GNUTLS_TEST_SUITE_RUN=1         \
        OPENSSL_ia32cap=0x00000000
 
 if ENABLE_NON_SUITEB_CURVES
index 86de084bb74764d6620c202cbde86b4730d6e904..5a810437727763e81346533575ba893605a39bdd 100644 (file)
@@ -69,6 +69,7 @@ TESTS = $(ctests) $(dist_check_SCRIPTS)
 TESTS_ENVIRONMENT =                                            \
        WINEDLLOVERRIDES="crypt32=n,ncrypt=n"                   \
        LC_ALL="C"                                              \
+       GNUTLS_TEST_SUITE_RUN=1                 \
        EXEEXT=$(EXEEXT)                                        \
        top_builddir="$(top_builddir)"                          \
        srcdir="$(srcdir)"