Gcc 11 gives a warning (which we make into an error) when the signature
of a function declared in the header file uses a type[N] parameter but
then the function is defined with just type[]. It needs to repeat type[N].

We fix several mistakes of this sort in one file, sha2.c.

Signed-off-by: Nadav Har'El <n...@scylladb.com>
---
 bsd/sys/crypto/sha2/sha2.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/bsd/sys/crypto/sha2/sha2.c b/bsd/sys/crypto/sha2/sha2.c
index b4bee5b2..46468e5b 100644
--- a/bsd/sys/crypto/sha2/sha2.c
+++ b/bsd/sys/crypto/sha2/sha2.c
@@ -553,7 +553,7 @@ void SHA256_Update(SHA256_CTX* context, const sha2_byte 
*data, size_t len) {
        usedspace = freespace = 0;
 }
 
-void SHA256_Final(sha2_byte digest[], SHA256_CTX* context) {
+void SHA256_Final(sha2_byte digest[SHA256_DIGEST_LENGTH], SHA256_CTX* context) 
{
        sha2_word32     *d = (sha2_word32*)digest;
        unsigned int    usedspace;
 
@@ -616,7 +616,7 @@ void SHA256_Final(sha2_byte digest[], SHA256_CTX* context) {
        usedspace = 0;
 }
 
-char *SHA256_End(SHA256_CTX* context, char buffer[]) {
+char *SHA256_End(SHA256_CTX* context, char 
buffer[SHA256_DIGEST_STRING_LENGTH]) {
        sha2_byte       digest[SHA256_DIGEST_LENGTH], *d = digest;
        int             i;
 
@@ -916,7 +916,7 @@ static void SHA512_Last(SHA512_CTX* context) {
        SHA512_Transform(context, (sha2_word64*)context->buffer);
 }
 
-void SHA512_Final(sha2_byte digest[], SHA512_CTX* context) {
+void SHA512_Final(sha2_byte digest[SHA512_DIGEST_LENGTH], SHA512_CTX* context) 
{
        sha2_word64     *d = (sha2_word64*)digest;
 
        /* Sanity check: */
@@ -945,7 +945,7 @@ void SHA512_Final(sha2_byte digest[], SHA512_CTX* context) {
        bzero(context, sizeof(*context));
 }
 
-char *SHA512_End(SHA512_CTX* context, char buffer[]) {
+char *SHA512_End(SHA512_CTX* context, char 
buffer[SHA512_DIGEST_STRING_LENGTH]) {
        sha2_byte       digest[SHA512_DIGEST_LENGTH], *d = digest;
        int             i;
 
@@ -991,7 +991,7 @@ void SHA384_Update(SHA384_CTX* context, const sha2_byte* 
data, size_t len) {
        SHA512_Update((SHA512_CTX*)context, data, len);
 }
 
-void SHA384_Final(sha2_byte digest[], SHA384_CTX* context) {
+void SHA384_Final(sha2_byte digest[SHA384_DIGEST_LENGTH], SHA384_CTX* context) 
{
        sha2_word64     *d = (sha2_word64*)digest;
 
        /* Sanity check: */
@@ -1020,7 +1020,7 @@ void SHA384_Final(sha2_byte digest[], SHA384_CTX* 
context) {
        bzero(context, sizeof(*context));
 }
 
-char *SHA384_End(SHA384_CTX* context, char buffer[]) {
+char *SHA384_End(SHA384_CTX* context, char 
buffer[SHA384_DIGEST_STRING_LENGTH]) {
        sha2_byte       digest[SHA384_DIGEST_LENGTH], *d = digest;
        int             i;
 
-- 
2.31.1

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/20210614062057.1998552-4-nyh%40scylladb.com.

Reply via email to