aead: Support custom AEAD salt sizes
The salt, or often called implicit nonce, varies between AEAD algorithms and their use in protocols. For IKE and ESP, GCM uses 4 bytes, while CCM uses 3 bytes. With TLS, however, AEAD mode uses 4 bytes for both GCM and CCM. Our GCM backends currently support 4 bytes and CCM 3 bytes only. This is fine until we go for CCM mode support in TLS, which requires 4 byte nonces.
This commit is contained in:
1 parent
e12eec1008
commit
e5d73b0dfa
17 files changed
+131
-43
No files matched your search
@@ -216,7 +216,8 @@ static bool create_aead(private_esp_context_t *this, int alg,
|
||||
case ENCR_AES_GCM_ICV12:
|
||||
case ENCR_AES_GCM_ICV16:
|
||||
/* the key includes a 4 byte salt */
|
||||
this->aead = lib->crypto->create_aead(lib->crypto, alg, key.len-4);
|
||||
this->aead = lib->crypto->create_aead(lib->crypto, alg,
|
||||
key.len - 4, 4);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user