Match new openssl HMAC_CTX_new better and zero out all the fields.

This commit is contained in:
maya 2018-02-05 21:12:14 +00:00
parent bb64310352
commit 2272657d65
2 changed files with 2 additions and 2 deletions

View File

@ -105,7 +105,7 @@ void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags);
#if OPENSSL_VERSION_NUMBER >= 0x10100000L #if OPENSSL_VERSION_NUMBER >= 0x10100000L
static inline HMAC_CTX *HMAC_CTX_new(void) static inline HMAC_CTX *HMAC_CTX_new(void)
{ {
HMAC_CTX *ctx = malloc(sizeof(*ctx)); HMAC_CTX *ctx = calloc(1, sizeof(*ctx));
if (ctx == NULL) if (ctx == NULL)
return NULL; return NULL;
HMAC_CTX_init(ctx); HMAC_CTX_init(ctx);

View File

@ -105,7 +105,7 @@ void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags);
#ifdef OPENSSL_VERSION_NUMBER >= 0x10100000L #ifdef OPENSSL_VERSION_NUMBER >= 0x10100000L
static inline HMAC_CTX *HMAC_CTX_new(void) static inline HMAC_CTX *HMAC_CTX_new(void)
{ {
HMAC_CTX *ctx = malloc(sizeof(*ctx)); HMAC_CTX *ctx = calloc(1, sizeof(*ctx));
if (ctx == NULL) if (ctx == NULL)
return NULL; return NULL;
HMAC_CTX_init(ctx); HMAC_CTX_init(ctx);