xcbc: Reset XCBC state in set_key()
authorMartin Willi <martin@revosec.ch>
Fri, 27 Mar 2015 14:51:52 +0000 (15:51 +0100)
committerMartin Willi <martin@revosec.ch>
Fri, 27 Mar 2015 14:53:52 +0000 (15:53 +0100)
If some partial data has been appended, a truncated key gets invalid if it
is calculated from the pending state.

src/libstrongswan/plugins/xcbc/xcbc.c

index 802c8a3..d852a29 100644 (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)
        {