hmac: call ERR_clear_error() if HMAC() fails

This commit is contained in:
Alfred E. Heggestad 2014-06-17 21:31:37 +00:00
parent 8e63e77f1f
commit fc01e8de88

View file

@ -8,6 +8,7 @@
#ifdef USE_OPENSSL
#include <openssl/sha.h>
#include <openssl/hmac.h>
#include <openssl/err.h>
#else
#include <re_sha.h>
#endif
@ -38,8 +39,10 @@ void hmac_sha1(const uint8_t *k, /* secret key */
size_t t)
{
#ifdef USE_OPENSSL
(void)HMAC(EVP_sha1(), k, (int)lk, d, ld, out, NULL);
(void)t;
if (!HMAC(EVP_sha1(), k, (int)lk, d, ld, out, NULL))
ERR_clear_error();
#else
SHA_CTX ictx, octx;
uint8_t isha[SHA_DIGEST_LENGTH], osha[SHA_DIGEST_LENGTH];