From 9138f49e6aa29c678f87544fd44adf7f3734d156 Mon Sep 17 00:00:00 2001 From: Martin Willi Date: Tue, 10 Jul 2012 09:03:38 +0200 Subject: Make sure HMAC_Init is called before HMAC_Update, fixes crash --- src/libstrongswan/plugins/openssl/openssl_hmac.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/libstrongswan/plugins/openssl/openssl_hmac.c') diff --git a/src/libstrongswan/plugins/openssl/openssl_hmac.c b/src/libstrongswan/plugins/openssl/openssl_hmac.c index feeecf539..b027e0fc3 100644 --- a/src/libstrongswan/plugins/openssl/openssl_hmac.c +++ b/src/libstrongswan/plugins/openssl/openssl_hmac.c @@ -159,6 +159,11 @@ static mac_t *hmac_create(hash_algorithm_t algo) } HMAC_CTX_init(&this->hmac); + if (!HMAC_Init_ex(&this->hmac, NULL, 0, this->hasher, NULL)) + { + destroy(this); + return NULL; + } return &this->public; } -- cgit v1.2.3