iv-gen: Fail getting shorter IV values than the used counter size

While no algorithm actually uses such short IVs, we add a check here to ensure
we won't return just the lower bits of the counter.
This commit is contained in:
Martin Willi
2015-06-01 09:42:10 +02:00
committed by Andreas Steffen
parent d0ed107910
commit ef31254d34
+4
View File
@@ -53,6 +53,10 @@ METHOD(iv_gen_t, get_iv, bool,
{
return FALSE;
}
if (size < sizeof(u_int64_t))
{
return FALSE;
}
if (this->prev != SEQ_IV_INIT_STATE && seq <= this->prev)
{
return FALSE;