Skip to content

Commit 550a034

Browse files
committed
Fix SHA1 hash error handling
F-815
1 parent 19f0cd8 commit 550a034

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/internal.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9146,10 +9146,11 @@ static int GetSha1CheckValue(const byte* dataIn, int inLen, byte* dataOut,
91469146
}
91479147

91489148
ret = wc_Hash(WC_HASH_TYPE_SHA, dataIn, inLen, hash, WC_SHA_DIGEST_SIZE);
9149-
if (ret == 0) {
9150-
XMEMCPY(dataOut, hash, PKCS11_CHECK_VALUE_SIZE);
9151-
*outLen = PKCS11_CHECK_VALUE_SIZE;
9149+
if (ret != 0) {
9150+
return CKR_FUNCTION_FAILED;
91529151
}
9152+
XMEMCPY(dataOut, hash, PKCS11_CHECK_VALUE_SIZE);
9153+
*outLen = PKCS11_CHECK_VALUE_SIZE;
91539154

91549155
return CKR_OK;
91559156
}

0 commit comments

Comments
 (0)