From 13dc1f4fa21e958ba23889845bd3d97bdfbf2010 Mon Sep 17 00:00:00 2001 From: Steffen Jaeckel Date: Thu, 1 Sep 2022 12:28:17 +0200 Subject: [PATCH] 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 --- tests/misc_test.c | 1 + tests/no_null_termination_check_test.c | 12 ++++++++++++ tests/tomcrypt_test.h | 1 + 3 files changed, 14 insertions(+) create mode 100644 tests/no_null_termination_check_test.c diff --git a/tests/misc_test.c b/tests/misc_test.c index 0ba9c15a..cf5cd217 100644 --- a/tests/misc_test.c +++ b/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; } diff --git a/tests/no_null_termination_check_test.c b/tests/no_null_termination_check_test.c new file mode 100644 index 00000000..329366c7 --- /dev/null +++ b/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); +} diff --git a/tests/tomcrypt_test.h b/tests/tomcrypt_test.h index 543b2853..263c4e62 100644 --- a/tests/tomcrypt_test.h +++ b/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);