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/whrlpool | |
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 'src/lib/libcrypto/whrlpool')
-rw-r--r-- | src/lib/libcrypto/whrlpool/whirlpool.c | 5 | ||||
-rw-r--r-- | src/lib/libcrypto/whrlpool/whrlpool.h | 9 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/libcrypto/whrlpool/whirlpool.c b/src/lib/libcrypto/whrlpool/whirlpool.c index e1e0f7a899..80e147c3b5 100644 --- a/src/lib/libcrypto/whrlpool/whirlpool.c +++ b/src/lib/libcrypto/whrlpool/whirlpool.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: whirlpool.c,v 1.2 2024/03/30 03:45:47 joshua Exp $ */ | 1 | /* $OpenBSD: whirlpool.c,v 1.3 2024/06/01 07:36:17 tb Exp $ */ |
2 | /** | 2 | /** |
3 | * The Whirlpool hashing function. | 3 | * The Whirlpool hashing function. |
4 | * | 4 | * |
@@ -846,10 +846,7 @@ unsigned char * | |||
846 | WHIRLPOOL(const void *inp, size_t bytes, unsigned char *md) | 846 | WHIRLPOOL(const void *inp, size_t bytes, unsigned char *md) |
847 | { | 847 | { |
848 | WHIRLPOOL_CTX ctx; | 848 | WHIRLPOOL_CTX ctx; |
849 | static unsigned char m[WHIRLPOOL_DIGEST_LENGTH]; | ||
850 | 849 | ||
851 | if (md == NULL) | ||
852 | md = m; | ||
853 | WHIRLPOOL_Init(&ctx); | 850 | WHIRLPOOL_Init(&ctx); |
854 | WHIRLPOOL_Update(&ctx, inp, bytes); | 851 | WHIRLPOOL_Update(&ctx, inp, bytes); |
855 | WHIRLPOOL_Final(md, &ctx); | 852 | WHIRLPOOL_Final(md, &ctx); |
diff --git a/src/lib/libcrypto/whrlpool/whrlpool.h b/src/lib/libcrypto/whrlpool/whrlpool.h index 875d34f7d3..1b4fac1993 100644 --- a/src/lib/libcrypto/whrlpool/whrlpool.h +++ b/src/lib/libcrypto/whrlpool/whrlpool.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: whrlpool.h,v 1.5 2014/07/10 22:45:58 jsing Exp $ */ | 1 | /* $OpenBSD: whrlpool.h,v 1.6 2024/06/01 07:36:17 tb Exp $ */ |
2 | 2 | ||
3 | #include <stddef.h> | 3 | #include <stddef.h> |
4 | 4 | ||
@@ -28,10 +28,13 @@ typedef struct { | |||
28 | 28 | ||
29 | #ifndef OPENSSL_NO_WHIRLPOOL | 29 | #ifndef OPENSSL_NO_WHIRLPOOL |
30 | int WHIRLPOOL_Init (WHIRLPOOL_CTX *c); | 30 | int WHIRLPOOL_Init (WHIRLPOOL_CTX *c); |
31 | int WHIRLPOOL_Update (WHIRLPOOL_CTX *c,const void *inp,size_t bytes); | 31 | int WHIRLPOOL_Update (WHIRLPOOL_CTX *c,const void *inp,size_t bytes) |
32 | __attribute__ ((__bounded__(__buffer__, 2, 3))); | ||
32 | void WHIRLPOOL_BitUpdate(WHIRLPOOL_CTX *c,const void *inp,size_t bits); | 33 | void WHIRLPOOL_BitUpdate(WHIRLPOOL_CTX *c,const void *inp,size_t bits); |
33 | int WHIRLPOOL_Final (unsigned char *md,WHIRLPOOL_CTX *c); | 34 | int WHIRLPOOL_Final (unsigned char *md,WHIRLPOOL_CTX *c); |
34 | unsigned char *WHIRLPOOL(const void *inp,size_t bytes,unsigned char *md); | 35 | unsigned char *WHIRLPOOL(const void *inp,size_t bytes,unsigned char *md) |
36 | __attribute__ ((__nonnull__(3))) | ||
37 | __attribute__ ((__bounded__(__buffer__, 1, 2))); | ||
35 | #endif | 38 | #endif |
36 | 39 | ||
37 | #ifdef __cplusplus | 40 | #ifdef __cplusplus |