mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-22 22:59:41 +01:00
core: Fix output buffer length handling of prf_sha1() function
This commit is contained in:
parent
8b3ec52c09
commit
f25b1442ff
13
src/sha1.c
13
src/sha1.c
@ -174,10 +174,17 @@ bool prf_sha1(const void *key, size_t key_len,
|
||||
input_len = prefix_len + 1 + data_len + 1;
|
||||
|
||||
for (i = 0; i < (size + 19) / 20; i++) {
|
||||
__hmac_sha1(checksum, key, key_len, input, input_len,
|
||||
output + offset, SHA1_MAC_LEN);
|
||||
size_t len;
|
||||
|
||||
offset += 20;
|
||||
if (size - offset > SHA1_MAC_LEN)
|
||||
len = SHA1_MAC_LEN;
|
||||
else
|
||||
len = size - offset;
|
||||
|
||||
__hmac_sha1(checksum, key, key_len, input, input_len,
|
||||
output + offset, len);
|
||||
|
||||
offset += len;
|
||||
input[input_len - 1]++;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user