From ef54309ef87902d5b677412920f4eb1f0c423011 Mon Sep 17 00:00:00 2001 From: joshua Date: Tue, 26 Mar 2024 12:10:50 +0000 Subject: [PATCH] Simplify HMAC_CTX_new() There is no need to call HMAC_CTX_init() as the memory has already been initialised to zero. ok tb --- lib/libcrypto/hmac/hmac.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/lib/libcrypto/hmac/hmac.c b/lib/libcrypto/hmac/hmac.c index 32d75154d40..d80b45de5b7 100644 --- a/lib/libcrypto/hmac/hmac.c +++ b/lib/libcrypto/hmac/hmac.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hmac.c,v 1.32 2024/02/18 15:45:42 tb Exp $ */ +/* $OpenBSD: hmac.c,v 1.33 2024/03/26 12:10:50 joshua Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -180,14 +180,7 @@ LCRYPTO_ALIAS(HMAC_Final); HMAC_CTX * HMAC_CTX_new(void) { - HMAC_CTX *ctx; - - if ((ctx = calloc(1, sizeof(*ctx))) == NULL) - return NULL; - - HMAC_CTX_init(ctx); - - return ctx; + return calloc(1, sizeof(HMAC_CTX)); } LCRYPTO_ALIAS(HMAC_CTX_new); -- 2.20.1