diff options
Diffstat (limited to 'src/libstrongswan/plugins')
-rw-r--r-- | src/libstrongswan/plugins/cmac/cmac.c | 3 | ||||
-rw-r--r-- | src/libstrongswan/plugins/hmac/hmac.c | 3 | ||||
-rw-r--r-- | src/libstrongswan/plugins/openssl/openssl_hmac.c | 18 | ||||
-rw-r--r-- | src/libstrongswan/plugins/xcbc/xcbc.c | 5 |
4 files changed, 15 insertions, 14 deletions
diff --git a/src/libstrongswan/plugins/cmac/cmac.c b/src/libstrongswan/plugins/cmac/cmac.c index 8d689f49f..b36d41387 100644 --- a/src/libstrongswan/plugins/cmac/cmac.c +++ b/src/libstrongswan/plugins/cmac/cmac.c @@ -165,7 +165,7 @@ static void final(private_mac_t *this, u_int8_t *out) this->remaining_bytes = 0; } -METHOD(mac_t, get_mac, void, +METHOD(mac_t, get_mac, bool, private_mac_t *this, chunk_t data, u_int8_t *out) { /* update T, do not process last block */ @@ -175,6 +175,7 @@ METHOD(mac_t, get_mac, void, { /* if not in append mode, process last block and output result */ final(this, out); } + return TRUE; } METHOD(mac_t, get_mac_size, size_t, diff --git a/src/libstrongswan/plugins/hmac/hmac.c b/src/libstrongswan/plugins/hmac/hmac.c index ecfb01913..85ad31776 100644 --- a/src/libstrongswan/plugins/hmac/hmac.c +++ b/src/libstrongswan/plugins/hmac/hmac.c @@ -56,7 +56,7 @@ struct private_mac_t { chunk_t ipaded_key; }; -METHOD(mac_t, get_mac, void, +METHOD(mac_t, get_mac, bool, private_mac_t *this, chunk_t data, u_int8_t *out) { /* H(K XOR opad, H(K XOR ipad, text)) @@ -90,6 +90,7 @@ METHOD(mac_t, get_mac, void, /* reinit for next call */ this->h->get_hash(this->h, this->ipaded_key, NULL); } + return TRUE; } METHOD(mac_t, get_mac_size, size_t, 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, diff --git a/src/libstrongswan/plugins/xcbc/xcbc.c b/src/libstrongswan/plugins/xcbc/xcbc.c index 59655cb1f..776f15109 100644 --- a/src/libstrongswan/plugins/xcbc/xcbc.c +++ b/src/libstrongswan/plugins/xcbc/xcbc.c @@ -179,7 +179,7 @@ static void final(private_mac_t *this, u_int8_t *out) this->zero = TRUE; } -METHOD(mac_t, get_mac, void, +METHOD(mac_t, get_mac, bool, private_mac_t *this, chunk_t data, u_int8_t *out) { /* update E, do not process last block */ @@ -189,6 +189,7 @@ METHOD(mac_t, get_mac, void, { /* if not in append mode, process last block and output result */ final(this, out); } + return TRUE; } METHOD(mac_t, get_mac_size, size_t, @@ -350,4 +351,4 @@ signer_t *xcbc_signer_create(integrity_algorithm_t algo) return mac_signer_create(xcbc, trunc); } return NULL; -}
\ No newline at end of file +} |