From d00231f885256cbd471ce47c2cf1a2b6fbeb06cd Mon Sep 17 00:00:00 2001 From: lloyd Date: Thu, 28 Mar 2013 14:00:27 +0000 Subject: Add nonce length checks to EAX and GCM --- src/aead/eax/eax.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/aead/eax/eax.cpp') diff --git a/src/aead/eax/eax.cpp b/src/aead/eax/eax.cpp index fa0496f42..725a473f4 100644 --- a/src/aead/eax/eax.cpp +++ b/src/aead/eax/eax.cpp @@ -94,6 +94,9 @@ void EAX_Mode::set_associated_data(const byte ad[], size_t length) secure_vector EAX_Mode::start(const byte nonce[], size_t nonce_len) { + if(!valid_nonce_length(nonce_len)) + throw Invalid_IV_Length(name(), nonce_len); + m_nonce_mac = eax_prf(0, block_size(), *m_cmac, nonce, nonce_len); m_ctr->set_iv(&m_nonce_mac[0], m_nonce_mac.size()); -- cgit v1.2.3