diff --git a/configure.ac b/configure.ac index 19c74590d..730407d08 100644 --- a/configure.ac +++ b/configure.ac @@ -3318,7 +3318,6 @@ AC_ARG_ENABLE([examples], ) AS_IF([test "x$ENABLED_FILESYSTEM" = "xno"], [ENABLED_EXAMPLES="no"]) -AS_IF([test "x$ENABLED_INLINE" = "xno"], [ENABLED_EXAMPLES="no"]) AS_IF([test "x$ENABLED_CRYPTONLY" = "xyes"], [ENABLED_EXAMPLES="no"]) AM_CONDITIONAL([BUILD_EXAMPLE_SERVERS], [test "x$ENABLED_EXAMPLES" = "xyes" && test "x$ENABLED_LEANTLS" = "xno"]) AM_CONDITIONAL([BUILD_EXAMPLE_CLIENTS], [test "x$ENABLED_EXAMPLES" = "xyes"]) diff --git a/tests/api.c b/tests/api.c index 0c3eaec7e..0f1dfd263 100644 --- a/tests/api.c +++ b/tests/api.c @@ -218,7 +218,6 @@ #include #endif - #ifndef NO_RSA #include #include @@ -20136,6 +20135,41 @@ static void test_wolfSSL_i2c_ASN1_INTEGER() printf(resultFmt, passed); #endif /* OPENSSL_EXTRA */ } + +#ifndef NO_INLINE +#define WOLFSSL_MISC_INCLUDED +#include +#else +#include +#endif + +static int test_ForceZero(void) +{ + unsigned char data[32]; + unsigned int i, j, len; + + /* Test ForceZero */ + for (i = 0; i < sizeof(data); i++) { + for (len = 1; len < sizeof(data) - i; len++) { + for (j = 0; j < sizeof(data); j++) + data[j] = j + 1; + + ForceZero(data + i, len); + + for (j = 0; j < sizeof(data); j++) { + if (j < i || j >= i + len) { + if (data[j] == 0x00) + return -10200; + } + else if (data[j] != 0x00) + return -10201; + } + } + } + + return 0; +} + /*----------------------------------------------------------------------------* | Main *----------------------------------------------------------------------------*/ @@ -20477,6 +20511,8 @@ void ApiTest(void) test_wc_PKCS7_EncodeDecodeEnvelopedData(); test_wc_PKCS7_EncodeEncryptedData(); + AssertIntEQ(test_ForceZero(), 0); + printf(" End API Tests\n"); } diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index b63b72506..52981a203 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -123,13 +123,6 @@ #include #endif -#ifndef NO_INLINE -#define WOLFSSL_MISC_INCLUDED -#include -#else -#include -#endif - /* only for stack size check */ #ifdef HAVE_STACK_SIZE #include @@ -345,7 +338,6 @@ int memcb_test(void); #ifdef WOLFSSL_IMX6_CAAM_BLOB int blob_test(void); #endif -int misc_test(void); #ifdef WOLF_CRYPTO_DEV int cryptodev_test(void); @@ -964,11 +956,6 @@ initDefaultName(); printf( "blob test passed!\n"); #endif - if ( (ret = misc_test()) != 0) - return err_sys("misc test failed!\n", ret); - else - printf( "misc test passed!\n"); - #ifdef WOLF_CRYPTO_DEV if ( (ret = cryptodev_test()) != 0) return err_sys("crypto dev test failed!\n", ret); @@ -19662,33 +19649,6 @@ int blob_test(void) } #endif /* WOLFSSL_IMX6_CAAM_BLOB */ -int misc_test(void) -{ - unsigned char data[32]; - unsigned int i, j, len; - - /* Test ForceZero */ - for (i = 0; i < sizeof(data); i++) { - for (len = 1; len < sizeof(data) - i; len++) { - for (j = 0; j < sizeof(data); j++) - data[j] = j + 1; - - ForceZero(data + i, len); - - for (j = 0; j < sizeof(data); j++) { - if (j < i || j >= i + len) { - if (data[j] == 0x00) - return -10200; - } - else if (data[j] != 0x00) - return -10201; - } - } - } - - return 0; -} - #ifdef WOLF_CRYPTO_DEV /* Example custom context for crypto callback */