aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2015-03-27 15:51:52 +0100
committerMartin Willi <martin@revosec.ch>2015-03-27 15:53:52 +0100
commiteedd92b53bd78595bea130508fa64296e6a19f17 (patch)
tree6d9a992a8af89bc65746dc62c2707795b443e170 /src
parentbfb029c82afc09f7a368e8d3c03d4f1901aef6bc (diff)
downloadstrongswan-eedd92b53bd78595bea130508fa64296e6a19f17.tar.bz2
strongswan-eedd92b53bd78595bea130508fa64296e6a19f17.tar.xz
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.
Diffstat (limited to 'src')
-rw-r--r--src/libstrongswan/plugins/xcbc/xcbc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libstrongswan/plugins/xcbc/xcbc.c b/src/libstrongswan/plugins/xcbc/xcbc.c
index 802c8a39f..d852a2932 100644
--- a/src/libstrongswan/plugins/xcbc/xcbc.c
+++ b/src/libstrongswan/plugins/xcbc/xcbc.c
@@ -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)
{