Skip to content

Commit

Permalink
Merge pull request #7218 from anhu/gcmccm
Browse files Browse the repository at this point in the history
Fixup places where it should be CCM instead of GCM.
  • Loading branch information
SparkiDev committed May 15, 2024
2 parents abd1e36 + 1e2fb8f commit ca47d49
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
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;
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

0 comments on commit ca47d49

Please sign in to comment.