From 415eed495c5ca200913d34324d8d3dccb2c470f1 Mon Sep 17 00:00:00 2001 From: tb Date: Sun, 26 Dec 2021 15:34:26 +0000 Subject: [PATCH] Check error returns for HMAC_* to appease coverity. CID 345114 --- usr.bin/openssl/speed.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/usr.bin/openssl/speed.c b/usr.bin/openssl/speed.c index 2426e2351bc..b5c8c742ccb 100644 --- a/usr.bin/openssl/speed.c +++ b/usr.bin/openssl/speed.c @@ -1,4 +1,4 @@ -/* $OpenBSD: speed.c,v 1.26 2021/12/26 15:31:24 tb Exp $ */ +/* $OpenBSD: speed.c,v 1.27 2021/12/26 15:34:26 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -1045,9 +1045,18 @@ speed_main(int argc, char **argv) print_message(names[D_HMAC], c[D_HMAC][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_HMAC][j]); count++) { - HMAC_Init_ex(hctx, NULL, 0, NULL, NULL); - HMAC_Update(hctx, buf, lengths[j]); - HMAC_Final(hctx, &(hmac[0]), NULL); + if (!HMAC_Init_ex(hctx, NULL, 0, NULL, NULL)) { + HMAC_CTX_free(hctx); + goto end; + } + if (!HMAC_Update(hctx, buf, lengths[j])) { + HMAC_CTX_free(hctx); + goto end; + } + if (!HMAC_Final(hctx, &(hmac[0]), NULL)) { + HMAC_CTX_free(hctx); + goto end; + } } d = Time_F(STOP); print_result(D_HMAC, j, count, d); -- 2.20.1