Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixup places where it should be CCM instead of GCM. #7218

Merged
merged 1 commit into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions src/keys.c
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ int GetCipherSpec(word16 side, byte cipherSuite0, byte cipherSuite,
specs->static_ecdh = 0;
specs->key_size = AES_128_KEY_SIZE;
specs->block_size = AES_BLOCK_SIZE;
specs->iv_size = AESGCM_IMP_IV_SZ;
specs->iv_size = AESCCM_IMP_IV_SZ;
specs->aead_mac_size = AES_CCM_16_AUTH_SZ;

break;
Expand All @@ -690,7 +690,7 @@ int GetCipherSpec(word16 side, byte cipherSuite0, byte cipherSuite,
specs->static_ecdh = 0;
specs->key_size = AES_128_KEY_SIZE;
specs->block_size = AES_BLOCK_SIZE;
specs->iv_size = AESGCM_IMP_IV_SZ;
specs->iv_size = AESCCM_IMP_IV_SZ;
specs->aead_mac_size = AES_CCM_8_AUTH_SZ;

break;
Expand All @@ -708,7 +708,7 @@ int GetCipherSpec(word16 side, byte cipherSuite0, byte cipherSuite,
specs->static_ecdh = 0;
specs->key_size = AES_256_KEY_SIZE;
specs->block_size = AES_BLOCK_SIZE;
specs->iv_size = AESGCM_IMP_IV_SZ;
specs->iv_size = AESCCM_IMP_IV_SZ;
specs->aead_mac_size = AES_CCM_8_AUTH_SZ;

break;
Expand Down Expand Up @@ -1069,7 +1069,7 @@ int GetCipherSpec(word16 side, byte cipherSuite0, byte cipherSuite,
specs->static_ecdh = 0;
specs->key_size = AES_128_KEY_SIZE;
specs->block_size = AES_BLOCK_SIZE;
specs->iv_size = AESGCM_IMP_IV_SZ;
specs->iv_size = AESCCM_IMP_IV_SZ;
specs->aead_mac_size = AES_CCM_8_AUTH_SZ;

break;
Expand All @@ -1087,7 +1087,7 @@ int GetCipherSpec(word16 side, byte cipherSuite0, byte cipherSuite,
specs->static_ecdh = 0;
specs->key_size = AES_256_KEY_SIZE;
specs->block_size = AES_BLOCK_SIZE;
specs->iv_size = AESGCM_IMP_IV_SZ;
specs->iv_size = AESCCM_IMP_IV_SZ;
specs->aead_mac_size = AES_CCM_8_AUTH_SZ;

break;
Expand All @@ -1105,7 +1105,7 @@ int GetCipherSpec(word16 side, byte cipherSuite0, byte cipherSuite,
specs->static_ecdh = 0;
specs->key_size = AES_128_KEY_SIZE;
specs->block_size = AES_BLOCK_SIZE;
specs->iv_size = AESGCM_IMP_IV_SZ;
specs->iv_size = AESCCM_IMP_IV_SZ;
specs->aead_mac_size = AES_CCM_8_AUTH_SZ;

if (opts != NULL)
Expand All @@ -1125,7 +1125,7 @@ int GetCipherSpec(word16 side, byte cipherSuite0, byte cipherSuite,
specs->static_ecdh = 0;
specs->key_size = AES_256_KEY_SIZE;
specs->block_size = AES_BLOCK_SIZE;
specs->iv_size = AESGCM_IMP_IV_SZ;
specs->iv_size = AESCCM_IMP_IV_SZ;
specs->aead_mac_size = AES_CCM_8_AUTH_SZ;

if (opts != NULL)
Expand All @@ -1145,7 +1145,7 @@ int GetCipherSpec(word16 side, byte cipherSuite0, byte cipherSuite,
specs->static_ecdh = 0;
specs->key_size = AES_128_KEY_SIZE;
specs->block_size = AES_BLOCK_SIZE;
specs->iv_size = AESGCM_IMP_IV_SZ;
specs->iv_size = AESCCM_IMP_IV_SZ;
specs->aead_mac_size = AES_CCM_16_AUTH_SZ;

if (opts != NULL)
Expand All @@ -1165,7 +1165,7 @@ int GetCipherSpec(word16 side, byte cipherSuite0, byte cipherSuite,
specs->static_ecdh = 0;
specs->key_size = AES_256_KEY_SIZE;
specs->block_size = AES_BLOCK_SIZE;
specs->iv_size = AESGCM_IMP_IV_SZ;
specs->iv_size = AESCCM_IMP_IV_SZ;
specs->aead_mac_size = AES_CCM_16_AUTH_SZ;

if (opts != NULL)
Expand All @@ -1185,7 +1185,7 @@ int GetCipherSpec(word16 side, byte cipherSuite0, byte cipherSuite,
specs->static_ecdh = 0;
specs->key_size = AES_128_KEY_SIZE;
specs->block_size = AES_BLOCK_SIZE;
specs->iv_size = AESGCM_IMP_IV_SZ;
specs->iv_size = AESCCM_IMP_IV_SZ;
specs->aead_mac_size = AES_CCM_16_AUTH_SZ;

if (opts != NULL)
Expand All @@ -1205,7 +1205,7 @@ int GetCipherSpec(word16 side, byte cipherSuite0, byte cipherSuite,
specs->static_ecdh = 0;
specs->key_size = AES_256_KEY_SIZE;
specs->block_size = AES_BLOCK_SIZE;
specs->iv_size = AESGCM_IMP_IV_SZ;
specs->iv_size = AESCCM_IMP_IV_SZ;
specs->aead_mac_size = AES_CCM_16_AUTH_SZ;

if (opts != NULL)
Expand Down Expand Up @@ -1330,7 +1330,7 @@ int GetCipherSpec(word16 side, byte cipherSuite0, byte cipherSuite,
specs->static_ecdh = 0;
specs->key_size = AES_128_KEY_SIZE;
specs->block_size = AES_BLOCK_SIZE;
specs->iv_size = AESGCM_NONCE_SZ;
specs->iv_size = AESCCM_NONCE_SZ;
specs->aead_mac_size = AES_CCM_16_AUTH_SZ;

break;
Expand All @@ -1348,7 +1348,7 @@ int GetCipherSpec(word16 side, byte cipherSuite0, byte cipherSuite,
specs->static_ecdh = 0;
specs->key_size = AES_128_KEY_SIZE;
specs->block_size = AES_BLOCK_SIZE;
specs->iv_size = AESGCM_NONCE_SZ;
specs->iv_size = AESCCM_NONCE_SZ;
specs->aead_mac_size = AES_CCM_8_AUTH_SZ;

break;
Expand Down Expand Up @@ -1440,7 +1440,7 @@ int GetCipherSpec(word16 side, byte cipherSuite0, byte cipherSuite,
specs->static_ecdh = 0;
specs->key_size = SM4_KEY_SIZE;
specs->block_size = SM4_BLOCK_SIZE;
specs->iv_size = GCM_IMP_IV_SZ;
SparkiDev marked this conversation as resolved.
Show resolved Hide resolved
specs->iv_size = CCM_IMP_IV_SZ;
specs->aead_mac_size = SM4_CCM_AUTH_SZ;

break;
Expand Down
6 changes: 4 additions & 2 deletions wolfssl/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -1731,10 +1731,12 @@ enum Misc {
AEAD_LEN_OFFSET = 11, /* Auth Data: Length */
AEAD_AUTH_DATA_SZ = 13, /* Size of the data to authenticate */
AEAD_NONCE_SZ = 12,
AESGCM_IMP_IV_SZ = 4, /* Size of GCM/CCM AEAD implicit IV */
AESGCM_IMP_IV_SZ = 4, /* Size of GCM AEAD implicit IV */
AESCCM_IMP_IV_SZ = 4, /* Size of CCM AEAD implicit IV */
AESGCM_EXP_IV_SZ = 8, /* Size of GCM/CCM AEAD explicit IV */
AESGCM_NONCE_SZ = AESGCM_EXP_IV_SZ + AESGCM_IMP_IV_SZ,
GCM_IMP_IV_SZ = 4, /* Size of GCM/CCM AEAD implicit IV */
GCM_IMP_IV_SZ = 4, /* Size of GCM AEAD implicit IV */
CCM_IMP_IV_SZ = 4, /* Size of CCM AEAD implicit IV */
GCM_EXP_IV_SZ = 8, /* Size of GCM/CCM AEAD explicit IV */
GCM_NONCE_SZ = GCM_EXP_IV_SZ + GCM_IMP_IV_SZ,

Expand Down