]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
crypto-selftests: tolerate errors of gnutls_{hash,hmac}_copy
authorDaiki Ueno <ueno@gnu.org>
Wed, 14 Apr 2021 15:27:43 +0000 (17:27 +0200)
committerDaiki Ueno <ueno@gnu.org>
Fri, 23 Apr 2021 07:36:55 +0000 (09:36 +0200)
Some hardware accelerated implementations, such as afalg, cannot
support the copy operation.  This patch turns it a soft-error, as the
code below is already checking if the copy is non-NULL, before
performing any operation on it.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
lib/crypto-selftests.c

index d076ad13246670f02958ceedae06716a238ad293..36b7d067b2e8e4b03fbdece1265c041f6c3418f7 100644 (file)
@@ -2298,8 +2298,10 @@ static int test_digest(gnutls_digest_algorithm_t dig,
                        return gnutls_assert_val(GNUTLS_E_SELF_TEST_ERROR);
 
                copy = gnutls_hash_copy(hd);
-               if (!copy)
-                       return gnutls_assert_val(GNUTLS_E_SELF_TEST_ERROR);
+               if (!copy) {
+                       _gnutls_debug_log("copy is not supported for: %s\n",
+                                         gnutls_digest_get_name(dig));
+               }
 
                ret = gnutls_hash(hd,
                                  &vectors[i].plaintext[1],
@@ -2602,8 +2604,10 @@ static int test_mac(gnutls_mac_algorithm_t mac,
                        return gnutls_assert_val(GNUTLS_E_SELF_TEST_ERROR);
 
                copy = gnutls_hmac_copy(hd);
-               if (!copy)
-                       return gnutls_assert_val(GNUTLS_E_SELF_TEST_ERROR);
+               if (!copy) {
+                       _gnutls_debug_log("copy is not supported for: %s\n",
+                                         gnutls_mac_get_name(mac));
+               }
 
                ret = gnutls_hmac(hd,
                                  &vectors[i].plaintext[1],