summaryrefslogtreecommitdiff
path: root/lib/libcrypto/md4
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2024-06-01 07:36:18 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2024-06-01 07:36:18 +0000
commit2faf0c828da9fd6c83a54efcea7d85f34f43ed40 (patch)
treec3287e420381d5f95d9d515a73df2b6bc64ae92f /lib/libcrypto/md4
parent9e546e3a2d4cf104f44a71584446aa9e2a54e49e (diff)
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 'lib/libcrypto/md4')
-rw-r--r--lib/libcrypto/md4/md4.c5
-rw-r--r--lib/libcrypto/md4/md4.h5
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/libcrypto/md4/md4.c b/lib/libcrypto/md4/md4.c
index 42c5b214280..9cf1ff95328 100644
--- a/lib/libcrypto/md4/md4.c
+++ b/lib/libcrypto/md4/md4.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: md4.c,v 1.17 2024/03/28 08:00:07 jsing Exp $ */
+/* $OpenBSD: md4.c,v 1.18 2024/06/01 07:36:16 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -336,10 +336,7 @@ unsigned char *
MD4(const unsigned char *d, size_t n, unsigned char *md)
{
MD4_CTX c;
- static unsigned char m[MD4_DIGEST_LENGTH];
- if (md == NULL)
- md = m;
if (!MD4_Init(&c))
return NULL;
MD4_Update(&c, d, n);
diff --git a/lib/libcrypto/md4/md4.h b/lib/libcrypto/md4/md4.h
index cb4f3cb6e9b..bf4313b345e 100644
--- a/lib/libcrypto/md4/md4.h
+++ b/lib/libcrypto/md4/md4.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: md4.h,v 1.17 2023/07/08 06:47:26 jsing Exp $ */
+/* $OpenBSD: md4.h,v 1.18 2024/06/01 07:36:16 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -92,8 +92,11 @@ typedef struct MD4state_st {
int MD4_Init(MD4_CTX *c);
int MD4_Update(MD4_CTX *c, const void *data, size_t len);
+ __attribute__ ((__bounded__(__buffer__, 2, 3)));
int MD4_Final(unsigned char *md, MD4_CTX *c);
unsigned char *MD4(const unsigned char *d, size_t n, unsigned char *md);
+ __attribute__ ((__nonnull__(3)))
+ __attribute__ ((__bounded__(__buffer__, 1, 2)));
void MD4_Transform(MD4_CTX *c, const unsigned char *b);
#ifdef __cplusplus
}