File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -89710,6 +89710,7 @@ TEST_CASE testCases[] = {
8971089710 TEST_DECL(test_wolfSSL_EVP_EncodeInit),
8971189711 TEST_DECL(test_wolfSSL_EVP_EncodeUpdate),
8971289712 TEST_DECL(test_wolfSSL_EVP_CipherUpdate_Null),
89713+ TEST_DECL(test_wolfSSL_EVP_CIPHER_type_string),
8971389714 TEST_DECL(test_wolfSSL_EVP_EncodeFinal),
8971489715 TEST_DECL(test_wolfSSL_EVP_DecodeInit),
8971589716 TEST_DECL(test_wolfSSL_EVP_DecodeUpdate),
Original file line number Diff line number Diff line change @@ -68,3 +68,38 @@ int test_wolfSSL_EVP_CipherUpdate_Null(void)
6868 return EXPECT_RESULT ();
6969}
7070
71+ /* Test for wolfSSL_EVP_CIPHER_type_string() */
72+ int test_wolfSSL_EVP_CIPHER_type_string (void )
73+ {
74+ EXPECT_DECLS ;
75+ #ifdef OPENSSL_EXTRA
76+ const char * cipherStr ;
77+
78+ /* Test with valid cipher types */
79+ #ifndef NO_AES
80+ #ifdef WOLFSSL_AES_128
81+ cipherStr = wolfSSL_EVP_CIPHER_type_string (WC_AES_128_CBC_TYPE );
82+ ExpectNotNull (cipherStr );
83+ ExpectStrEQ (cipherStr , "AES-128-CBC" );
84+ #endif
85+ #endif
86+
87+ #ifndef NO_DES3
88+ cipherStr = wolfSSL_EVP_CIPHER_type_string (WC_DES_CBC_TYPE );
89+ ExpectNotNull (cipherStr );
90+ ExpectStrEQ (cipherStr , "DES-CBC" );
91+ #endif
92+
93+ /* Test with NULL cipher type */
94+ cipherStr = wolfSSL_EVP_CIPHER_type_string (WC_NULL_CIPHER_TYPE );
95+ ExpectNotNull (cipherStr );
96+ ExpectStrEQ (cipherStr , "NULL" );
97+
98+ /* Test with invalid cipher type */
99+ cipherStr = wolfSSL_EVP_CIPHER_type_string (0xFFFF );
100+ ExpectNull (cipherStr );
101+ #endif /* OPENSSL_EXTRA */
102+
103+ return EXPECT_RESULT ();
104+ }
105+
Original file line number Diff line number Diff line change 2323#define WOLFSSL_TEST_EVP_H
2424
2525int test_wolfSSL_EVP_CipherUpdate_Null (void );
26+ int test_wolfSSL_EVP_CIPHER_type_string (void );
2627
2728#endif /* WOLFSSL_TEST_EVP_H */
Original file line number Diff line number Diff line change @@ -2056,15 +2056,15 @@ static unsigned int cipherType(const WOLFSSL_EVP_CIPHER *cipher)
20562056
20572057/* Getter function for cipher type string
20582058 *
2059- * type cipherType enum value to get string for
2059+ * cipherType cipherType enum value to get string for
20602060 *
20612061 * Returns string representation of the cipher type or NULL if not found
20622062 */
2063- const char * wolfSSL_EVP_CIPHER_type_string (unsigned int type )
2063+ const char * wolfSSL_EVP_CIPHER_type_string (unsigned int cipherType )
20642064{
20652065 WOLFSSL_ENTER ("wolfSSL_EVP_CIPHER_type_string" );
20662066
2067- switch (type ) {
2067+ switch (cipherType ) {
20682068#ifndef NO_DES3
20692069 case WC_DES_CBC_TYPE : return EVP_DES_CBC ;
20702070 case WC_DES_EDE3_CBC_TYPE : return EVP_DES_EDE3_CBC ;
You can’t perform that action at this time.
0 commit comments