From 3413bd8fa985116db860c944b4697ce7c4a2b910 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 28 Feb 2025 16:12:21 +0000 Subject: [PATCH] Update: Call NULL_CIPHER_TYPE tests from api.c Co-Authored-By: lealem@wolfssl.com --- tests/api.c | 34 ++++++++++++++++++++++++++++++++++ tests/api/test_evp.c | 30 ++++-------------------------- tests/api/test_evp.h | 10 ++++++++-- 3 files changed, 46 insertions(+), 28 deletions(-) diff --git a/tests/api.c b/tests/api.c index e90082864..d84b22957 100644 --- a/tests/api.c +++ b/tests/api.c @@ -295,6 +295,7 @@ #include #include #include +#include #include #include #include @@ -64078,6 +64079,35 @@ static int test_wolfSSL_EVP_BytesToKey(void) return EXPECT_RESULT(); } + +static int test_evp_null_cipher(void) +{ + EXPECT_DECLS; +#ifdef OPENSSL_EXTRA + int ret = 0; + + ret = TestNullCipherUpdate(); + if (ret != 0) { + EXPECT_FAIL("TestNullCipherUpdate failed"); + } + + ret = TestNullCipherUpdateEmptyData(); + if (ret != 0) { + EXPECT_FAIL("TestNullCipherUpdateEmptyData failed"); + } + + ret = TestNullCipherUpdateLargeData(); + if (ret != 0) { + EXPECT_FAIL("TestNullCipherUpdateLargeData failed"); + } + + ret = TestNullCipherUpdateMultiple(); + if (ret != 0) { + EXPECT_FAIL("TestNullCipherUpdateMultiple failed"); + } +#endif /* OPENSSL_EXTRA */ + return EXPECT_RESULT(); +} static int test_evp_cipher_aes_gcm(void) { EXPECT_DECLS; @@ -89613,6 +89643,10 @@ TEST_CASE testCases[] = { TEST_DECL(test_wolfSSL_EVP_rc2_cbc), TEST_DECL(test_wolfSSL_EVP_mdc2), + +#ifdef OPENSSL_EXTRA + TEST_DECL(test_evp_null_cipher), +#endif TEST_DECL(test_evp_cipher_aes_gcm), #endif TEST_DECL(test_wolfssl_EVP_aria_gcm), diff --git a/tests/api/test_evp.c b/tests/api/test_evp.c index b41293a8c..dd69b3b8d 100644 --- a/tests/api/test_evp.c +++ b/tests/api/test_evp.c @@ -34,16 +34,7 @@ #ifdef OPENSSL_EXTRA /* Test for NULL_CIPHER_TYPE in wolfSSL_EVP_CipherUpdate() */ -static int TestNullCipherUpdate(void); -/* Test for NULL_CIPHER_TYPE with empty data */ -static int TestNullCipherUpdateEmptyData(void); -/* Test for NULL_CIPHER_TYPE with large data */ -static int TestNullCipherUpdateLargeData(void); -/* Test for NULL_CIPHER_TYPE with multiple updates */ -static int TestNullCipherUpdateMultiple(void); - -/* Test for NULL_CIPHER_TYPE in wolfSSL_EVP_CipherUpdate() */ -static int TestNullCipherUpdate(void) +int TestNullCipherUpdate(void) { EXPECT_DECLS; WOLFSSL_EVP_CIPHER_CTX* ctx; @@ -78,7 +69,7 @@ static int TestNullCipherUpdate(void) } /* Test for NULL_CIPHER_TYPE with empty data */ -static int TestNullCipherUpdateEmptyData(void) +int TestNullCipherUpdateEmptyData(void) { EXPECT_DECLS; WOLFSSL_EVP_CIPHER_CTX* ctx; @@ -107,7 +98,7 @@ static int TestNullCipherUpdateEmptyData(void) } /* Test for NULL_CIPHER_TYPE with large data */ -static int TestNullCipherUpdateLargeData(void) +int TestNullCipherUpdateLargeData(void) { EXPECT_DECLS; WOLFSSL_EVP_CIPHER_CTX* ctx; @@ -146,7 +137,7 @@ static int TestNullCipherUpdateLargeData(void) } /* Test for NULL_CIPHER_TYPE with multiple updates */ -static int TestNullCipherUpdateMultiple(void) +int TestNullCipherUpdateMultiple(void) { EXPECT_DECLS; WOLFSSL_EVP_CIPHER_CTX* ctx; @@ -191,17 +182,4 @@ static int TestNullCipherUpdateMultiple(void) return EXPECT_RESULT(); } -/* Function to register all EVP tests */ -int TestEvpAll(void) -{ - int ret = 0; - - ret |= TestNullCipherUpdate(); - ret |= TestNullCipherUpdateEmptyData(); - ret |= TestNullCipherUpdateLargeData(); - ret |= TestNullCipherUpdateMultiple(); - - return ret; -} - #endif /* OPENSSL_EXTRA */ diff --git a/tests/api/test_evp.h b/tests/api/test_evp.h index dce6b3330..a10feb6fd 100644 --- a/tests/api/test_evp.h +++ b/tests/api/test_evp.h @@ -23,8 +23,14 @@ #define WOLFSSL_TEST_EVP_H #ifdef OPENSSL_EXTRA -/* Function to register all EVP tests */ -int TestEvpAll(void); +/* Test for NULL_CIPHER_TYPE in wolfSSL_EVP_CipherUpdate() */ +int TestNullCipherUpdate(void); +/* Test for NULL_CIPHER_TYPE with empty data */ +int TestNullCipherUpdateEmptyData(void); +/* Test for NULL_CIPHER_TYPE with large data */ +int TestNullCipherUpdateLargeData(void); +/* Test for NULL_CIPHER_TYPE with multiple updates */ +int TestNullCipherUpdateMultiple(void); #endif /* OPENSSL_EXTRA */ #endif /* WOLFSSL_TEST_EVP_H */