Skip to content

Commit 9d5fe18

Browse files
nyhwkozaczuk
authored andcommitted
bsd/sha2.c: fix mismatched signatures
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 <[email protected]> Message-Id: <[email protected]>
1 parent 4f67366 commit 9d5fe18

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

bsd/sys/crypto/sha2/sha2.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ void SHA256_Update(SHA256_CTX* context, const sha2_byte *data, size_t len) {
553553
usedspace = freespace = 0;
554554
}
555555

556-
void SHA256_Final(sha2_byte digest[], SHA256_CTX* context) {
556+
void SHA256_Final(sha2_byte digest[SHA256_DIGEST_LENGTH], SHA256_CTX* context) {
557557
sha2_word32 *d = (sha2_word32*)digest;
558558
unsigned int usedspace;
559559

@@ -616,7 +616,7 @@ void SHA256_Final(sha2_byte digest[], SHA256_CTX* context) {
616616
usedspace = 0;
617617
}
618618

619-
char *SHA256_End(SHA256_CTX* context, char buffer[]) {
619+
char *SHA256_End(SHA256_CTX* context, char buffer[SHA256_DIGEST_STRING_LENGTH]) {
620620
sha2_byte digest[SHA256_DIGEST_LENGTH], *d = digest;
621621
int i;
622622

@@ -916,7 +916,7 @@ static void SHA512_Last(SHA512_CTX* context) {
916916
SHA512_Transform(context, (sha2_word64*)context->buffer);
917917
}
918918

919-
void SHA512_Final(sha2_byte digest[], SHA512_CTX* context) {
919+
void SHA512_Final(sha2_byte digest[SHA512_DIGEST_LENGTH], SHA512_CTX* context) {
920920
sha2_word64 *d = (sha2_word64*)digest;
921921

922922
/* Sanity check: */
@@ -945,7 +945,7 @@ void SHA512_Final(sha2_byte digest[], SHA512_CTX* context) {
945945
bzero(context, sizeof(*context));
946946
}
947947

948-
char *SHA512_End(SHA512_CTX* context, char buffer[]) {
948+
char *SHA512_End(SHA512_CTX* context, char buffer[SHA512_DIGEST_STRING_LENGTH]) {
949949
sha2_byte digest[SHA512_DIGEST_LENGTH], *d = digest;
950950
int i;
951951

@@ -991,7 +991,7 @@ void SHA384_Update(SHA384_CTX* context, const sha2_byte* data, size_t len) {
991991
SHA512_Update((SHA512_CTX*)context, data, len);
992992
}
993993

994-
void SHA384_Final(sha2_byte digest[], SHA384_CTX* context) {
994+
void SHA384_Final(sha2_byte digest[SHA384_DIGEST_LENGTH], SHA384_CTX* context) {
995995
sha2_word64 *d = (sha2_word64*)digest;
996996

997997
/* Sanity check: */
@@ -1020,7 +1020,7 @@ void SHA384_Final(sha2_byte digest[], SHA384_CTX* context) {
10201020
bzero(context, sizeof(*context));
10211021
}
10221022

1023-
char *SHA384_End(SHA384_CTX* context, char buffer[]) {
1023+
char *SHA384_End(SHA384_CTX* context, char buffer[SHA384_DIGEST_STRING_LENGTH]) {
10241024
sha2_byte digest[SHA384_DIGEST_LENGTH], *d = digest;
10251025
int i;
10261026

0 commit comments

Comments
 (0)