aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/plugins/ccm/ccm_aead.c
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2014-01-31 15:53:38 +0100
committerMartin Willi <martin@revosec.ch>2014-03-31 15:56:12 +0200
commite5d73b0dfa6bc57b2ed8745df4409308eeaf272e (patch)
tree245ca1455caf0fa3c8e22e8916ad7d4474f82c34 /src/libstrongswan/plugins/ccm/ccm_aead.c
parente12eec10089a4a18a15ccb511aa1200ad59e8044 (diff)
downloadstrongswan-e5d73b0dfa6bc57b2ed8745df4409308eeaf272e.tar.bz2
strongswan-e5d73b0dfa6bc57b2ed8745df4409308eeaf272e.tar.xz
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.
Diffstat (limited to 'src/libstrongswan/plugins/ccm/ccm_aead.c')
-rw-r--r--src/libstrongswan/plugins/ccm/ccm_aead.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libstrongswan/plugins/ccm/ccm_aead.c b/src/libstrongswan/plugins/ccm/ccm_aead.c
index 65eccb2db..6d4b2e13c 100644
--- a/src/libstrongswan/plugins/ccm/ccm_aead.c
+++ b/src/libstrongswan/plugins/ccm/ccm_aead.c
@@ -343,7 +343,8 @@ METHOD(aead_t, destroy, void,
/**
* See header
*/
-ccm_aead_t *ccm_aead_create(encryption_algorithm_t algo, size_t key_size)
+ccm_aead_t *ccm_aead_create(encryption_algorithm_t algo,
+ size_t key_size, size_t salt_size)
{
private_ccm_aead_t *this;
size_t icv_size;
@@ -360,6 +361,11 @@ ccm_aead_t *ccm_aead_create(encryption_algorithm_t algo, size_t key_size)
default:
return NULL;
}
+ if (salt_size && salt_size != SALT_SIZE)
+ {
+ /* currently not supported */
+ return NULL;
+ }
switch (algo)
{
case ENCR_AES_CCM_ICV8: