Skip to content

Commit 0b2a9d3

Browse files
committed
fix SHA-512/224,256 KCAPI digest sizes
1 parent 7facd3e commit 0b2a9d3

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

wolfcrypt/src/port/kcapi/kcapi_hash.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -488,15 +488,15 @@ int wc_Sha512_224Final(wc_Sha512* sha, byte* hash)
488488
if (sha == NULL) {
489489
return BAD_FUNC_ARG;
490490
}
491-
return KcapiHashFinal(&sha->kcapi, hash, WC_SHA512_DIGEST_SIZE,
491+
return KcapiHashFinal(&sha->kcapi, hash, WC_SHA512_224_DIGEST_SIZE,
492492
WC_NAME_SHA512_224);
493493
}
494494
int wc_Sha512_224GetHash(wc_Sha512* sha, byte* hash)
495495
{
496496
if (sha == NULL) {
497497
return BAD_FUNC_ARG;
498498
}
499-
return KcapiHashGet(&sha->kcapi, hash, WC_SHA512_DIGEST_SIZE);
499+
return KcapiHashGet(&sha->kcapi, hash, WC_SHA512_224_DIGEST_SIZE);
500500
}
501501

502502

@@ -527,15 +527,15 @@ int wc_Sha512_256Final(wc_Sha512* sha, byte* hash)
527527
if (sha == NULL) {
528528
return BAD_FUNC_ARG;
529529
}
530-
return KcapiHashFinal(&sha->kcapi, hash, WC_SHA512_DIGEST_SIZE,
530+
return KcapiHashFinal(&sha->kcapi, hash, WC_SHA512_256_DIGEST_SIZE,
531531
WC_NAME_SHA512_256);
532532
}
533533
int wc_Sha512_256GetHash(wc_Sha512* sha, byte* hash)
534534
{
535535
if (sha == NULL) {
536536
return BAD_FUNC_ARG;
537537
}
538-
return KcapiHashGet(&sha->kcapi, hash, WC_SHA512_DIGEST_SIZE);
538+
return KcapiHashGet(&sha->kcapi, hash, WC_SHA512_256_DIGEST_SIZE);
539539
}
540540

541541

0 commit comments

Comments
 (0)