diff options
author | tb <> | 2024-06-01 07:36:17 +0000 |
---|---|---|
committer | tb <> | 2024-06-01 07:36:17 +0000 |
commit | f3bc6c83f92ef9b23bfc523ef1b24bfa27e1f6e4 (patch) | |
tree | d92a9fa364845580193b9ab3f5f391408342fa26 /src/lib/libcrypto/hmac/hmac.c | |
parent | aee2754cfbb89d3dff4c3a521fb027d0c6967bc9 (diff) | |
download | openbsd-f3bc6c83f92ef9b23bfc523ef1b24bfa27e1f6e4.tar.gz openbsd-f3bc6c83f92ef9b23bfc523ef1b24bfa27e1f6e4.tar.bz2 openbsd-f3bc6c83f92ef9b23bfc523ef1b24bfa27e1f6e4.zip |
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
Diffstat (limited to '')
-rw-r--r-- | src/lib/libcrypto/hmac/hmac.c | 5 |
1 files changed, 1 insertions, 4 deletions
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 @@ | |||
1 | /* $OpenBSD: hmac.c,v 1.34 2024/03/30 10:10:58 tb Exp $ */ | 1 | /* $OpenBSD: hmac.c,v 1.35 2024/06/01 07:36:16 tb Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -263,11 +263,8 @@ HMAC(const EVP_MD *evp_md, const void *key, int key_len, const unsigned char *d, | |||
263 | size_t n, unsigned char *md, unsigned int *md_len) | 263 | size_t n, unsigned char *md, unsigned int *md_len) |
264 | { | 264 | { |
265 | HMAC_CTX c; | 265 | HMAC_CTX c; |
266 | static unsigned char m[EVP_MAX_MD_SIZE]; | ||
267 | const unsigned char dummy_key[1] = { 0 }; | 266 | const unsigned char dummy_key[1] = { 0 }; |
268 | 267 | ||
269 | if (md == NULL) | ||
270 | md = m; | ||
271 | if (key == NULL) { | 268 | if (key == NULL) { |
272 | key = dummy_key; | 269 | key = dummy_key; |
273 | key_len = 0; | 270 | key_len = 0; |