aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/plugins/xcbc/xcbc.c
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2012-07-06 16:57:17 +0200
committerMartin Willi <martin@revosec.ch>2012-07-16 14:53:38 +0200
commitce73fc19dbc36d089e595e452356deccd8afcd6f (patch)
treeba7f244b7e566bd86d3e87e6992d831203322445 /src/libstrongswan/plugins/xcbc/xcbc.c
parent3b96189a2afa4949e1d9cdf7c9fa8244d8d817f0 (diff)
downloadstrongswan-ce73fc19dbc36d089e595e452356deccd8afcd6f.tar.bz2
strongswan-ce73fc19dbc36d089e595e452356deccd8afcd6f.tar.xz
Add a return value to crypter_t.set_key()
Diffstat (limited to 'src/libstrongswan/plugins/xcbc/xcbc.c')
-rw-r--r--src/libstrongswan/plugins/xcbc/xcbc.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/libstrongswan/plugins/xcbc/xcbc.c b/src/libstrongswan/plugins/xcbc/xcbc.c
index 745efcaa4..1bb7e640a 100644
--- a/src/libstrongswan/plugins/xcbc/xcbc.c
+++ b/src/libstrongswan/plugins/xcbc/xcbc.c
@@ -257,17 +257,16 @@ METHOD(mac_t, set_key, bool,
memset(this->k2, 0x02, this->b);
memset(this->k3, 0x03, this->b);
- this->k1->set_key(this->k1, lengthened);
- if (!this->k1->encrypt(this->k1, chunk_create(this->k2, this->b), iv, NULL) ||
+ if (!this->k1->set_key(this->k1, lengthened) ||
+ !this->k1->encrypt(this->k1, chunk_create(this->k2, this->b), iv, NULL) ||
!this->k1->encrypt(this->k1, chunk_create(this->k3, this->b), iv, NULL) ||
- !this->k1->encrypt(this->k1, k1, iv, NULL))
+ !this->k1->encrypt(this->k1, k1, iv, NULL) ||
+ !this->k1->set_key(this->k1, k1))
{
+ memwipe(k1.ptr, k1.len);
return FALSE;
}
- this->k1->set_key(this->k1, k1);
-
memwipe(k1.ptr, k1.len);
-
return TRUE;
}