diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2021-12-26 15:34:27 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2021-12-26 15:34:27 +0000 |
commit | 6778c7dd31b1741b5dd28580c19206e8e8446ed8 (patch) | |
tree | d8f0f74abf5f6c576e2020d1a1c6209ae1762eab /usr.bin | |
parent | 37dfc9174201cfa5fdeb0c07d0b8fa6ccb25de29 (diff) |
Check error returns for HMAC_* to appease coverity.
CID 345114
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/openssl/speed.c | 17 |
1 files 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); |