From e240d43ad3e7455425ad784e1c864cbbd6db9755 Mon Sep 17 00:00:00 2001 From: Justin W Smith <103147162+justsmth@users.noreply.github.com> Date: Fri, 5 Jan 2024 10:26:41 -0500 Subject: [PATCH] check/assert hmac_update success (#1383) --- crypto/fipsmodule/evp/digestsign.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crypto/fipsmodule/evp/digestsign.c b/crypto/fipsmodule/evp/digestsign.c index 3efd64c8fb..ed84201808 100644 --- a/crypto/fipsmodule/evp/digestsign.c +++ b/crypto/fipsmodule/evp/digestsign.c @@ -61,6 +61,11 @@ #include "../digest/internal.h" #include "internal.h" +#if defined(NDEBUG) +#define CHECK(x) (void) (x) +#else +#define CHECK(x) assert(x) +#endif enum evp_sign_verify_t { evp_sign, @@ -79,7 +84,7 @@ static int uses_prehash(EVP_MD_CTX *ctx, enum evp_sign_verify_t op) { static void hmac_update(EVP_MD_CTX *ctx, const void *data, size_t count) { HMAC_PKEY_CTX *hctx = ctx->pctx->data; - HMAC_Update(&hctx->ctx, data, count); + CHECK(HMAC_Update(&hctx->ctx, data, count)); } static int HMAC_DigestFinal_ex(EVP_MD_CTX *ctx, uint8_t *out_sig,