summaryrefslogtreecommitdiffstats
path: root/cpukit/include/sha256.h
diff options
context:
space:
mode:
authorAlan Somers <asomers@FreeBSD.org>2016-10-18 23:20:49 +0000
committerSebastian Huber <sebastian.huber@embedded-brains.de>2022-09-08 16:14:56 +0200
commit48f7979f5d858900b729db3f7dcc3fa84d496f53 (patch)
tree298cd5857e762cf33b2343ad40baedf57b49b835 /cpukit/include/sha256.h
parentRetune SHA2 code for improved performance on CPUs (diff)
downloadrtems-48f7979f5d858900b729db3f7dcc3fa84d496f53.tar.bz2
Fix C++ includability of crypto headers with static array sizes
C99 allows array function parameters to use the static keyword for their sizes. This tells the compiler that the parameter will have at least the specified size, and calling code will fail to compile if that guarantee is not met. However, this syntax is not legal in C++. This commit reverts r300824, which worked around the problem for sys/sys/md5.h only, and introduces a new macro: min_size(). min_size(x) can be used in headers as a static array size, but will still compile in C++ mode. Reviewed by: cem, ed MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D8277
Diffstat (limited to 'cpukit/include/sha256.h')
-rw-r--r--cpukit/include/sha256.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/cpukit/include/sha256.h b/cpukit/include/sha256.h
index 4fe35935c0..f612713f3d 100644
--- a/cpukit/include/sha256.h
+++ b/cpukit/include/sha256.h
@@ -47,7 +47,8 @@ __BEGIN_DECLS
void SHA256_Init(SHA256_CTX *);
void SHA256_Update(SHA256_CTX *, const void *, size_t);
-void SHA256_Final(unsigned char [static SHA256_DIGEST_LENGTH], SHA256_CTX *);
+void SHA256_Final(unsigned char [__min_size(SHA256_DIGEST_LENGTH)],
+ SHA256_CTX *);
#ifndef _KERNEL
char *SHA256_End(SHA256_CTX *, char *);
char *SHA256_Data(const void *, unsigned int, char *);