Update: Call NULL_CIPHER_TYPE tests from api.c

Co-Authored-By: lealem@wolfssl.com <lealem@wolfssl.com>
This commit is contained in:
Devin AI
2025-02-28 16:12:21 +00:00
parent 36233656ef
commit 3413bd8fa9
3 changed files with 46 additions and 28 deletions

View File

@@ -295,6 +295,7 @@
#include <tests/api/test_sha256.h>
#include <tests/api/test_sha512.h>
#include <tests/api/test_sha3.h>
#include <tests/api/test_evp.h>
#include <tests/api/test_blake2.h>
#include <tests/api/test_sm3.h>
#include <tests/api/test_ripemd.h>
@@ -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),

View File

@@ -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 */

View File

@@ -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 */