1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-18 20:38:10 +00:00

fix(crypto): unify function headers in sha2.c and sha2.h

This commit is contained in:
Ondřej Vejpustek 2021-09-01 12:37:31 +02:00
parent 10bc747dc6
commit 4827969cc8

View File

@ -577,7 +577,7 @@ void sha1_Update(SHA1_CTX* context, const sha2_byte *data, size_t len) {
usedspace = freespace = 0;
}
void sha1_Final(SHA1_CTX* context, sha2_byte digest[]) {
void sha1_Final(SHA1_CTX* context, sha2_byte digest[SHA1_DIGEST_LENGTH]) {
unsigned int usedspace = 0;
/* If no digest buffer is passed, we don't bother doing this: */
@ -631,7 +631,7 @@ void sha1_Final(SHA1_CTX* context, sha2_byte digest[]) {
usedspace = 0;
}
char *sha1_End(SHA1_CTX* context, char buffer[]) {
char *sha1_End(SHA1_CTX* context, char buffer[SHA1_DIGEST_STRING_LENGTH]) {
sha2_byte digest[SHA1_DIGEST_LENGTH] = {0}, *d = digest;
int i = 0;
@ -884,7 +884,7 @@ void sha256_Update(SHA256_CTX* context, const sha2_byte *data, size_t len) {
usedspace = freespace = 0;
}
void sha256_Final(SHA256_CTX* context, sha2_byte digest[]) {
void sha256_Final(SHA256_CTX* context, sha2_byte digest[SHA256_DIGEST_LENGTH]) {
unsigned int usedspace = 0;
/* If no digest buffer is passed, we don't bother doing this: */
@ -938,7 +938,7 @@ void sha256_Final(SHA256_CTX* context, sha2_byte digest[]) {
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] = {0}, *d = digest;
int i = 0;
@ -1228,7 +1228,7 @@ static void sha512_Last(SHA512_CTX* context) {
sha512_Transform(context->state, context->buffer, context->state);
}
void sha512_Final(SHA512_CTX* context, sha2_byte digest[]) {
void sha512_Final(SHA512_CTX* context, sha2_byte digest[SHA512_DIGEST_LENGTH]) {
/* If no digest buffer is passed, we don't bother doing this: */
if (digest != (sha2_byte*)0) {
sha512_Last(context);
@ -1247,7 +1247,7 @@ void sha512_Final(SHA512_CTX* context, sha2_byte digest[]) {
memzero(context, sizeof(SHA512_CTX));
}
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] = {0}, *d = digest;
int i = 0;