From: Martin Willi Date: Tue, 10 Jul 2012 07:03:38 +0000 (+0200) Subject: Make sure HMAC_Init is called before HMAC_Update, fixes crash X-Git-Tag: 5.0.1~308 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9138f49e;p=thirdparty%2Fstrongswan.git Make sure HMAC_Init is called before HMAC_Update, fixes crash --- diff --git a/src/libstrongswan/plugins/openssl/openssl_hmac.c b/src/libstrongswan/plugins/openssl/openssl_hmac.c index feeecf539d..b027e0fc3b 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; }