F-14002: map 3DES to its own bulk-cipher enum and add ChaCha/Camellia mirrors

pull/421/head
Chris Conlon 2026-09-18 13:39:54 -06:00
parent cb6c38abc3
commit 0cd33889e8
3 changed files with 23 additions and 1 deletions

View File

@ -298,6 +298,10 @@ public class WolfSSL {
public static int wolfssl_aes_gcm;
/** Bulk cipher algorithm enum: AES-CCM */
public static int wolfssl_aes_ccm;
/** Bulk cipher algorithm enum: ChaCha */
public static int wolfssl_chacha;
/** Bulk cipher algorithm enum: Camellia */
public static int wolfssl_camellia;
/* wolfSSL error codes, pulled in from wolfssl/error.h wolfSSL_ErrorCodes */
/** Generate Cookie Error */
@ -747,10 +751,12 @@ public class WolfSSL {
wolfssl_rc4 = getBulkCipherAlgorithmEnumRC4();
wolfssl_rc2 = getBulkCipherAlgorithmEnumRC2();
wolfssl_des = getBulkCipherAlgorithmEnumDES();
wolfssl_triple_des = getBulkCipherAlgorithmEnumDES();
wolfssl_triple_des = getBulkCipherAlgorithmEnum3DES();
wolfssl_des40 = getBulkCipherAlgorithmEnumDES40();
wolfssl_aes_gcm = getBulkCipherAlgorithmEnumAESGCM();
wolfssl_aes_ccm = getBulkCipherAlgorithmEnumAESCCM();
wolfssl_chacha = getBulkCipherAlgorithmEnumCHACHA();
wolfssl_camellia = getBulkCipherAlgorithmEnumCAMELLIA();
/* initialize cipher enum values */
MD5 = getHmacEnumMD5();

View File

@ -4522,6 +4522,7 @@ public class WolfSSLSession {
* WolfSSL.wolfssl_aes<br>
* WolfSSL.wolfssl_aes_gcm<br>
* WolfSSL.wolfssl_aes_ccm<br>
* WolfSSL.wolfssl_chacha<br>
* WolfSSL.wolfssl_camellia<br>
* <b><code>BAD_FUNC_ARG</code></b> for an error state.<br>
* @throws IllegalStateException WolfSSLContext has been freed

View File

@ -67,6 +67,21 @@ public class WolfSSLTest {
}
}
@Test
public void test_WolfSSL_bulkCipherEnumsDistinct()
throws WolfSSLException {
new WolfSSL();
/* 3DES must not mirror the DES enum value */
assertNotEquals(WolfSSL.wolfssl_des, WolfSSL.wolfssl_triple_des);
/* ChaCha and Camellia mirrors are populated and distinct from DES */
assertNotEquals(WolfSSL.wolfssl_des, WolfSSL.wolfssl_chacha);
assertNotEquals(WolfSSL.wolfssl_des, WolfSSL.wolfssl_camellia);
assertNotEquals(WolfSSL.wolfssl_chacha, WolfSSL.wolfssl_camellia);
}
@Test
public void test_WolfSSL_protocol() {
String[] p = WolfSSL.getProtocols();