From f3bc6c83f92ef9b23bfc523ef1b24bfa27e1f6e4 Mon Sep 17 00:00:00 2001 From: tb <> Date: Sat, 1 Jun 2024 07:36:17 +0000 Subject: Remove support for static buffers in HMAC/digests HMAC() and the one-step digests used to support passing a NULL buffer and would return the digest in a static buffer. This design is firmly from the nineties, not thread safe and it saves callers a single line. The few ports that used to rely this were fixed with patches sent to non-hostile (and non-dead) upstreams. It's early enough in the release cycle that remaining uses hidden from the compiler should be caught, at least the ones that matter. There won't be that many since BoringSSL removed this feature in 2017. https://boringssl-review.googlesource.com/14528 Add non-null attributes to the headers and add a few missing bounded attributes. ok beck jsing --- src/lib/libcrypto/hmac/hmac.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/lib/libcrypto/hmac/hmac.c') diff --git a/src/lib/libcrypto/hmac/hmac.c b/src/lib/libcrypto/hmac/hmac.c index 7c882ba15b..1315b1a0d2 100644 --- a/src/lib/libcrypto/hmac/hmac.c +++ b/src/lib/libcrypto/hmac/hmac.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hmac.c,v 1.34 2024/03/30 10:10:58 tb Exp $ */ +/* $OpenBSD: hmac.c,v 1.35 2024/06/01 07:36:16 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -263,11 +263,8 @@ HMAC(const EVP_MD *evp_md, const void *key, int key_len, const unsigned char *d, size_t n, unsigned char *md, unsigned int *md_len) { HMAC_CTX c; - static unsigned char m[EVP_MAX_MD_SIZE]; const unsigned char dummy_key[1] = { 0 }; - if (md == NULL) - md = m; if (key == NULL) { key = dummy_key; key_len = 0; -- cgit v1.2.3-55-g6feb