[PATCH] tests/basic: Add ifdefs for SM4 and CAMELLIA tests

Clemens Lang cllang at redhat.com
Tue Aug 2 13:26:37 CEST 2022


 * tests/basic.c (check_gcm_siv_cipher): Do not run test vectors that
   are known to fail when compiled without support for SM4 or CAMELLIA.

--

Fixes test execution when configured --enable-ciphers excluding sm4 or
camellia.

Signed-off-by: Clemens Lang <cllang at redhat.com>
---
 tests/basic.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tests/basic.c b/tests/basic.c
index 0d03636b..26980e15 100644
--- a/tests/basic.c
+++ b/tests/basic.c
@@ -6160,6 +6160,7 @@ check_gcm_siv_cipher (void)
 	"\xee\x12\x55\x82\x25\x25\x30\xb9\xa6\xf8\x3c\x81\x36\xcd\xef",
 	"\xce\xc3\x13\x6c\x40\x2a\xcc\x51\xa1\xce\xb3\xed\xe8\xa6\x5b\x04",
       },
+#if USE_SM4
       {
 	GCRY_CIPHER_SM4, FLAG_NOFIPS,
 	"\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
@@ -6298,6 +6299,8 @@ check_gcm_siv_cipher (void)
 	"\x64\x15\x17\x55\x60\x71\xb4\xaf\xcd\xc8\x90\x25\xc8\xc8\x62",
 	"\xe2\x32\xda\x3a\x5a\x0e\x45\x1b\x8e\xf8\xbb\xe6\x60\x71\x81\xeb",
       },
+#endif /* USE_SM4 */
+#if USE_CAMELLIA
       {
 	GCRY_CIPHER_CAMELLIA128, FLAG_NOFIPS,
 	"\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
@@ -6564,6 +6567,7 @@ check_gcm_siv_cipher (void)
 	"\xfb\x92\x1d\xd1\x31\x8d\x9d\xa1\xc3\x46\x69\xfa\x71\x2c\x42",
 	"\xc6\x54\xf9\xf0\x22\x2c\xc3\xee\xdd\x13\x02\xb8\xe7\x5a\x2e\x7e"
       }
+#endif /* USE_CAMELLIA */
     };
   gcry_cipher_hd_t hde, hdd;
   unsigned char out[MAX_DATA_LEN * 2];
-- 
2.37.1




More information about the Gcrypt-devel mailing list