Skip to content

Commit

Permalink
Update: Call NULL_CIPHER_TYPE tests from api.c
Browse files Browse the repository at this point in the history
  • Loading branch information
devin-ai-integration[bot] and lealem47 committed Feb 28, 2025
1 parent 3623365 commit 3413bd8
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 28 deletions.
34 changes: 34 additions & 0 deletions tests/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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),
Expand Down
30 changes: 4 additions & 26 deletions tests/api/test_evp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 */
10 changes: 8 additions & 2 deletions tests/api/test_evp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

0 comments on commit 3413bd8

Please sign in to comment.