aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/plugins/openssl/openssl_hmac.c
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2012-07-06 14:34:11 +0200
committerMartin Willi <martin@revosec.ch>2012-07-16 14:53:37 +0200
commit27e1eabbb5c4beaedab832d6a7aceb49a86a3061 (patch)
tree25777ac4cb2ed40d08b71448eee497dec728052d /src/libstrongswan/plugins/openssl/openssl_hmac.c
parent76a98ee2a1578a7f1f95b63846cefffad9b1df63 (diff)
downloadstrongswan-27e1eabbb5c4beaedab832d6a7aceb49a86a3061.tar.bz2
strongswan-27e1eabbb5c4beaedab832d6a7aceb49a86a3061.tar.xz
Add a return value to mac_t.get_bytes()
Diffstat (limited to 'src/libstrongswan/plugins/openssl/openssl_hmac.c')
-rw-r--r--src/libstrongswan/plugins/openssl/openssl_hmac.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/libstrongswan/plugins/openssl/openssl_hmac.c b/src/libstrongswan/plugins/openssl/openssl_hmac.c
index caf0d3aa2..21b1cd88b 100644
--- a/src/libstrongswan/plugins/openssl/openssl_hmac.c
+++ b/src/libstrongswan/plugins/openssl/openssl_hmac.c
@@ -75,24 +75,22 @@ struct private_mac_t {
/**
* Resets HMAC context
*/
-static void reset(private_mac_t *this)
+static bool reset(private_mac_t *this)
{
- HMAC_Init_ex(&this->hmac, this->key.ptr, this->key.len, this->hasher, NULL);
+ return HMAC_Init_ex(&this->hmac, this->key.ptr, this->key.len,
+ this->hasher, NULL);
}
-METHOD(mac_t, get_mac, void,
+METHOD(mac_t, get_mac, bool,
private_mac_t *this, chunk_t data, u_int8_t *out)
{
if (out == NULL)
{
- HMAC_Update(&this->hmac, data.ptr, data.len);
- }
- else
- {
- HMAC_Update(&this->hmac, data.ptr, data.len);
- HMAC_Final(&this->hmac, out, NULL);
- reset(this);
+ return HMAC_Update(&this->hmac, data.ptr, data.len);
}
+ return HMAC_Update(&this->hmac, data.ptr, data.len) &&
+ HMAC_Final(&this->hmac, out, NULL) &&
+ reset(this);
}
METHOD(mac_t, get_mac_size, size_t,