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
-1
@@ -313,7 +313,7 @@ static bool do_test_gcm(test_vector_t *test)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
aead = lib->crypto->create_aead(lib->crypto, alg, test->key.len);
|
||||
aead = lib->crypto->create_aead(lib->crypto, alg, test->key.len, 4);
|
||||
if (!aead)
|
||||
{
|
||||
DBG1(DBG_APP, "algorithm %N or key length (%d bits) not supported",
|
||||
|
||||
@@ -61,7 +61,7 @@ int main(int argc, char *argv[])
|
||||
if (encryption_algorithm_is_aead(token->algorithm))
|
||||
{
|
||||
aead = lib->crypto->create_aead(lib->crypto,
|
||||
token->algorithm, token->keysize / 8);
|
||||
token->algorithm, token->keysize / 8, 0);
|
||||
if (!aead)
|
||||
{
|
||||
fprintf(stderr, "aead '%s' not supported!\n", argv[1]);
|
||||
|
||||
Reference in New Issue
Block a user