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

crypto: Check for l_cipher_decrypt error

This commit is contained in:
Andrew Zaborowski 2021-02-10 15:24:23 +01:00 committed by Denis Kenzior
parent a327e3f4d8
commit 0b5e7ab7bb

View File

@ -167,12 +167,18 @@ bool aes_unwrap(const uint8_t *kek, size_t kek_len, const uint8_t *in, size_t le
for (i = n; i >= 1; i--, t--) {
b[0] ^= L_CPU_TO_BE64(t);
b[1] = L_GET_UNALIGNED(r);
l_cipher_decrypt(cipher, b, b, 16);
if (!l_cipher_decrypt(cipher, b, b, 16)) {
b[0] = 0;
goto done;
}
L_PUT_UNALIGNED(b[1], r);
r -= 1;
}
}
done:
l_cipher_free(cipher);
explicit_bzero(&b[1], 8);