af-alg: Reset hmac/xcbc state before doing set_key()
authorMartin Willi <martin@revosec.ch>
Fri, 27 Mar 2015 15:06:21 +0000 (16:06 +0100)
committerMartin Willi <martin@revosec.ch>
Fri, 27 Mar 2015 15:06:21 +0000 (16:06 +0100)
src/libstrongswan/plugins/af_alg/af_alg_prf.c
src/libstrongswan/plugins/af_alg/af_alg_signer.c

index 720738a..2b7d513 100644 (file)
@@ -139,6 +139,7 @@ METHOD(prf_t, set_key, bool,
 {
        char buf[this->block_size];
 
+       this->ops->reset(this->ops);
        if (this->xcbc)
        {
                /* The kernel currently does not support variable length XCBC keys,
index 6ee3806..9ad0110 100644 (file)
@@ -156,6 +156,7 @@ METHOD(signer_t, get_block_size, size_t,
 METHOD(signer_t, set_key, bool,
        private_af_alg_signer_t *this, chunk_t key)
 {
+       this->ops->reset(this->ops);
        return this->ops->set_key(this->ops, key);
 }