Ver Fonte

add test-case that uses `LTC_NO_NULL_TERMINATION_CHECK`

It's a compile-only test, but we run it anyways so we can finally get
`crypt_fsa()` included in the coverage report. It's not really useful but
also doesn't hurt.

Signed-off-by: Steffen Jaeckel <[email protected]>
Steffen Jaeckel há 3 anos atrás
pai
commit
13dc1f4fa2
3 ficheiros alterados com 14 adições e 0 exclusões
  1. 1 0
      tests/misc_test.c
  2. 12 0
      tests/no_null_termination_check_test.c
  3. 1 0
      tests/tomcrypt_test.h

+ 1 - 0
tests/misc_test.c

@@ -34,5 +34,6 @@ int misc_test(void)
 #ifdef LTC_SSH
    ssh_test();
 #endif
+   no_null_termination_check_test();
    return 0;
 }

+ 12 - 0
tests/no_null_termination_check_test.c

@@ -0,0 +1,12 @@
+/* LibTomCrypt, modular cryptographic library -- Tom St Denis */
+/* SPDX-License-Identifier: Unlicense */
+
+#define LTC_NO_NULL_TERMINATION_CHECK
+#include "tomcrypt.h"
+
+#define NNTCT_NULL ((void *)0)
+
+int no_null_termination_check_test(void)
+{
+   return crypt_fsa(NNTCT_NULL, NNTCT_NULL, NNTCT_NULL, NNTCT_NULL, NNTCT_NULL, NNTCT_NULL, 0);
+}

+ 1 - 0
tests/tomcrypt_test.h

@@ -42,6 +42,7 @@ int x25519_test(void);
 int ed25519_test(void);
 int ssh_test(void);
 int bcrypt_test(void);
+int no_null_termination_check_test(void);
 
 #ifdef LTC_PKCS_1
 struct ltc_prng_descriptor* no_prng_desc_get(void);