From 8ec42d5ee5a4f2ad8f1041e98230cca595c03ba9 Mon Sep 17 00:00:00 2001 From: joshua <> Date: Tue, 26 Mar 2024 12:10:50 +0000 Subject: Simplify HMAC_CTX_new() There is no need to call HMAC_CTX_init() as the memory has already been initialised to zero. ok tb --- src/lib/libcrypto/hmac/hmac.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'src/lib') diff --git a/src/lib/libcrypto/hmac/hmac.c b/src/lib/libcrypto/hmac/hmac.c index 32d75154d4..d80b45de5b 100644 --- a/src/lib/libcrypto/hmac/hmac.c +++ b/src/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); -- cgit v1.2.3-55-g6feb