diff options
author | Martin Willi <martin@revosec.ch> | 2012-07-06 14:40:04 +0200 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2012-07-16 14:53:37 +0200 |
commit | 6ac8d861d9a6353bae7f3be0a032da282ee13309 (patch) | |
tree | 28e1e56191151f5f636013699eaddf333713c9f1 /src/libstrongswan/plugins/xcbc/xcbc.c | |
parent | 27e1eabbb5c4beaedab832d6a7aceb49a86a3061 (diff) | |
download | strongswan-6ac8d861d9a6353bae7f3be0a032da282ee13309.tar.bz2 strongswan-6ac8d861d9a6353bae7f3be0a032da282ee13309.tar.xz |
Add a return value to mac_t.set_key()
Diffstat (limited to 'src/libstrongswan/plugins/xcbc/xcbc.c')
-rw-r--r-- | src/libstrongswan/plugins/xcbc/xcbc.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/libstrongswan/plugins/xcbc/xcbc.c b/src/libstrongswan/plugins/xcbc/xcbc.c index 776f15109..26979ace1 100644 --- a/src/libstrongswan/plugins/xcbc/xcbc.c +++ b/src/libstrongswan/plugins/xcbc/xcbc.c @@ -198,7 +198,7 @@ METHOD(mac_t, get_mac_size, size_t, return this->b; } -METHOD(mac_t, set_key, void, +METHOD(mac_t, set_key, bool, private_mac_t *this, chunk_t key) { chunk_t iv, k1, lengthened; @@ -218,8 +218,11 @@ METHOD(mac_t, set_key, void, { /* shorten key using xcbc */ lengthened = chunk_alloca(this->b); memset(lengthened.ptr, 0, lengthened.len); - set_key(this, lengthened); - get_mac(this, key, lengthened.ptr); + if (!set_key(this, lengthened) || + !get_mac(this, key, lengthened.ptr)) + { + return FALSE; + } } k1 = chunk_alloca(this->b); @@ -243,6 +246,8 @@ METHOD(mac_t, set_key, void, this->k1->set_key(this->k1, k1); memwipe(k1.ptr, k1.len); + + return TRUE; } METHOD(mac_t, destroy, void, |