3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-23 22:42:37 +01:00

sha1: Return right away if checksum creation fails

This patch covers pbkdf2_sha1 and prf_sha1
This commit is contained in:
Denis Kenzior 2015-03-20 14:55:42 -05:00
parent 86e7883c74
commit 204964fd8d

View File

@ -131,6 +131,8 @@ bool pbkdf2_sha1(const void *password, size_t password_len,
unsigned int i; unsigned int i;
checksum = l_checksum_new(L_CHECKSUM_SHA1); checksum = l_checksum_new(L_CHECKSUM_SHA1);
if (!checksum)
return false;
for (i = 1; size > 0; i++) { for (i = 1; size > 0; i++) {
size_t len; size_t len;
@ -160,6 +162,8 @@ bool prf_sha1(const void *key, size_t key_len,
unsigned int i, offset = 0; unsigned int i, offset = 0;
checksum = l_checksum_new(L_CHECKSUM_SHA1); checksum = l_checksum_new(L_CHECKSUM_SHA1);
if (!checksum)
return false;
memcpy(input, prefix, prefix_len); memcpy(input, prefix, prefix_len);
input[prefix_len] = 0; input[prefix_len] = 0;