-/* $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.
*
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;
-/* $OpenBSD: hmac.h,v 1.17 2023/04/25 15:48:48 tb Exp $ */
+/* $OpenBSD: hmac.h,v 1.18 2024/06/01 07:36:16 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len);
int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len);
unsigned char *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);
+ const unsigned char *d, size_t n, unsigned char *md, unsigned int *md_len)
+ __attribute__((__nonnull__ (6)));
int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx);
void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags);
-/* $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.
*
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);
-/* $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.
*
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
}
-/* $OpenBSD: md5.c,v 1.22 2024/03/28 08:00:08 jsing Exp $ */
+/* $OpenBSD: md5.c,v 1.23 2024/06/01 07:36:16 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
MD5(const unsigned char *d, size_t n, unsigned char *md)
{
MD5_CTX c;
- static unsigned char m[MD5_DIGEST_LENGTH];
- if (md == NULL)
- md = m;
if (!MD5_Init(&c))
return NULL;
MD5_Update(&c, d, n);
-/* $OpenBSD: md5.h,v 1.21 2023/07/08 06:50:38 jsing Exp $ */
+/* $OpenBSD: md5.h,v 1.22 2024/06/01 07:36:16 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
__attribute__ ((__bounded__(__buffer__, 2, 3)));
int MD5_Final(unsigned char *md, MD5_CTX *c);
unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md)
+ __attribute__ ((__nonnull__(3)))
__attribute__ ((__bounded__(__buffer__, 1, 2)));
void MD5_Transform(MD5_CTX *c, const unsigned char *b);
#ifdef __cplusplus
-/* $OpenBSD: ripemd.c,v 1.18 2024/03/28 23:54:15 joshua Exp $ */
+/* $OpenBSD: ripemd.c,v 1.19 2024/06/01 07:36:16 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
LCRYPTO_ALIAS(RIPEMD160_Final);
unsigned char *
-RIPEMD160(const unsigned char *d, size_t n,
- unsigned char *md)
+RIPEMD160(const unsigned char *d, size_t n, unsigned char *md)
{
RIPEMD160_CTX c;
- static unsigned char m[RIPEMD160_DIGEST_LENGTH];
- if (md == NULL)
- md = m;
if (!RIPEMD160_Init(&c))
return NULL;
RIPEMD160_Update(&c, d, n);
-/* $OpenBSD: ripemd.h,v 1.15 2023/07/08 06:52:56 jsing Exp $ */
+/* $OpenBSD: ripemd.h,v 1.16 2024/06/01 07:36:16 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
int RIPEMD160_Init(RIPEMD160_CTX *c);
int RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, size_t len);
+ __attribute__ ((__bounded__(__buffer__, 2, 3)));
int RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c);
unsigned char *RIPEMD160(const unsigned char *d, size_t n,
- unsigned char *md);
+ unsigned char *md)
+ __attribute__ ((__nonnull__(3)))
+ __attribute__ ((__bounded__(__buffer__, 1, 2)));
void RIPEMD160_Transform(RIPEMD160_CTX *c, const unsigned char *b);
#ifdef __cplusplus
}
-/* $OpenBSD: sha.h,v 1.22 2023/07/08 07:08:11 jsing Exp $ */
+/* $OpenBSD: sha.h,v 1.23 2024/06/01 07:36:16 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
__attribute__ ((__bounded__(__buffer__, 2, 3)));
int SHA1_Final(unsigned char *md, SHA_CTX *c);
unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md)
+ __attribute__ ((__nonnull__(3)))
__attribute__ ((__bounded__(__buffer__, 1, 2)));
void SHA1_Transform(SHA_CTX *c, const unsigned char *data);
#endif
__attribute__ ((__bounded__(__buffer__, 2, 3)));
int SHA224_Final(unsigned char *md, SHA256_CTX *c);
unsigned char *SHA224(const unsigned char *d, size_t n, unsigned char *md)
+ __attribute__ ((__nonnull__(3)))
__attribute__ ((__bounded__(__buffer__, 1, 2)));
int SHA256_Init(SHA256_CTX *c);
int SHA256_Update(SHA256_CTX *c, const void *data, size_t len)
__attribute__ ((__bounded__(__buffer__, 2, 3)));
int SHA256_Final(unsigned char *md, SHA256_CTX *c);
unsigned char *SHA256(const unsigned char *d, size_t n, unsigned char *md)
+ __attribute__ ((__nonnull__(3)))
__attribute__ ((__bounded__(__buffer__, 1, 2)));
void SHA256_Transform(SHA256_CTX *c, const unsigned char *data);
#endif
__attribute__ ((__bounded__(__buffer__, 2, 3)));
int SHA384_Final(unsigned char *md, SHA512_CTX *c);
unsigned char *SHA384(const unsigned char *d, size_t n, unsigned char *md)
+ __attribute__ ((__nonnull__(3)))
__attribute__ ((__bounded__(__buffer__, 1, 2)));
int SHA512_Init(SHA512_CTX *c);
int SHA512_Update(SHA512_CTX *c, const void *data, size_t len)
__attribute__ ((__bounded__(__buffer__, 2, 3)));
int SHA512_Final(unsigned char *md, SHA512_CTX *c);
unsigned char *SHA512(const unsigned char *d, size_t n, unsigned char *md)
+ __attribute__ ((__nonnull__(3)))
__attribute__ ((__bounded__(__buffer__, 1, 2)));
void SHA512_Transform(SHA512_CTX *c, const unsigned char *data);
#endif
-/* $OpenBSD: sha1.c,v 1.14 2024/03/28 07:06:12 jsing Exp $ */
+/* $OpenBSD: sha1.c,v 1.15 2024/06/01 07:36:16 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
SHA1(const unsigned char *d, size_t n, unsigned char *md)
{
SHA_CTX c;
- static unsigned char m[SHA_DIGEST_LENGTH];
-
- if (md == NULL)
- md = m;
if (!SHA1_Init(&c))
return NULL;
-/* $OpenBSD: sha256.c,v 1.31 2024/03/28 04:23:02 jsing Exp $ */
+/* $OpenBSD: sha256.c,v 1.32 2024/06/01 07:36:16 tb Exp $ */
/* ====================================================================
* Copyright (c) 1998-2011 The OpenSSL Project. All rights reserved.
*
SHA224(const unsigned char *d, size_t n, unsigned char *md)
{
SHA256_CTX c;
- static unsigned char m[SHA224_DIGEST_LENGTH];
-
- if (md == NULL)
- md = m;
SHA224_Init(&c);
SHA256_Update(&c, d, n);
SHA256(const unsigned char *d, size_t n, unsigned char *md)
{
SHA256_CTX c;
- static unsigned char m[SHA256_DIGEST_LENGTH];
-
- if (md == NULL)
- md = m;
SHA256_Init(&c);
SHA256_Update(&c, d, n);
-/* $OpenBSD: sha512.c,v 1.41 2023/07/08 12:24:10 beck Exp $ */
+/* $OpenBSD: sha512.c,v 1.42 2024/06/01 07:36:16 tb Exp $ */
/* ====================================================================
* Copyright (c) 1998-2011 The OpenSSL Project. All rights reserved.
*
SHA384(const unsigned char *d, size_t n, unsigned char *md)
{
SHA512_CTX c;
- static unsigned char m[SHA384_DIGEST_LENGTH];
-
- if (md == NULL)
- md = m;
SHA384_Init(&c);
SHA512_Update(&c, d, n);
SHA512(const unsigned char *d, size_t n, unsigned char *md)
{
SHA512_CTX c;
- static unsigned char m[SHA512_DIGEST_LENGTH];
-
- if (md == NULL)
- md = m;
SHA512_Init(&c);
SHA512_Update(&c, d, n);
-/* $OpenBSD: whirlpool.c,v 1.2 2024/03/30 03:45:47 joshua Exp $ */
+/* $OpenBSD: whirlpool.c,v 1.3 2024/06/01 07:36:17 tb Exp $ */
/**
* The Whirlpool hashing function.
*
WHIRLPOOL(const void *inp, size_t bytes, unsigned char *md)
{
WHIRLPOOL_CTX ctx;
- static unsigned char m[WHIRLPOOL_DIGEST_LENGTH];
- if (md == NULL)
- md = m;
WHIRLPOOL_Init(&ctx);
WHIRLPOOL_Update(&ctx, inp, bytes);
WHIRLPOOL_Final(md, &ctx);
-/* $OpenBSD: whrlpool.h,v 1.5 2014/07/10 22:45:58 jsing Exp $ */
+/* $OpenBSD: whrlpool.h,v 1.6 2024/06/01 07:36:17 tb Exp $ */
#include <stddef.h>
#ifndef OPENSSL_NO_WHIRLPOOL
int WHIRLPOOL_Init (WHIRLPOOL_CTX *c);
-int WHIRLPOOL_Update (WHIRLPOOL_CTX *c,const void *inp,size_t bytes);
+int WHIRLPOOL_Update (WHIRLPOOL_CTX *c,const void *inp,size_t bytes)
+ __attribute__ ((__bounded__(__buffer__, 2, 3)));
void WHIRLPOOL_BitUpdate(WHIRLPOOL_CTX *c,const void *inp,size_t bits);
int WHIRLPOOL_Final (unsigned char *md,WHIRLPOOL_CTX *c);
-unsigned char *WHIRLPOOL(const void *inp,size_t bytes,unsigned char *md);
+unsigned char *WHIRLPOOL(const void *inp,size_t bytes,unsigned char *md)
+ __attribute__ ((__nonnull__(3)))
+ __attribute__ ((__bounded__(__buffer__, 1, 2)));
#endif
#ifdef __cplusplus