xcbc: Reset XCBC state in set_key()

If some partial data has been appended, a truncated key gets invalid if it
is calculated from the pending state.
This commit is contained in:
Martin Willi
2015-03-27 15:53:52 +01:00
parent bfb029c82a
commit eedd92b53b
+4
View File
@@ -219,6 +219,10 @@ METHOD(mac_t, set_key, bool,
{
chunk_t iv, k1, lengthened;
memset(this->e, 0, this->b);
this->remaining_bytes = 0;
this->zero = TRUE;
/* we support variable keys from RFC4434 */
if (key.len == this->b)
{