diff options
author | Ard Biesheuvel <ardb@kernel.org> | 2021-01-05 19:10:53 +0300 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2021-01-06 10:41:48 +0300 |
commit | ef0bb5adc1a3cdbf20c77b8ba841d2eca7c7dc5a (patch) | |
tree | c342db7e4ee8d397cc23ddece5c48d0bfd811539 /net/bluetooth/smp.c | |
parent | b649813eadbc062d8682f7a20aa025275707dd1f (diff) | |
download | linux-ef0bb5adc1a3cdbf20c77b8ba841d2eca7c7dc5a.tar.xz |
Bluetooth: avoid u128_xor() on potentially misaligned inputs
u128_xor() takes pointers to quantities that are assumed to be at least
64-bit aligned, which is not guaranteed to be the case in the smp_c1()
routine. So switch to crypto_xor() instead.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/smp.c')
-rw-r--r-- | net/bluetooth/smp.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c index c659c464f7ca..b0c1ee110eff 100644 --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c @@ -25,7 +25,6 @@ #include <linux/crypto.h> #include <crypto/aes.h> #include <crypto/algapi.h> -#include <crypto/b128ops.h> #include <crypto/hash.h> #include <crypto/kpp.h> @@ -425,7 +424,7 @@ static int smp_c1(const u8 k[16], SMP_DBG("p1 %16phN", p1); /* res = r XOR p1 */ - u128_xor((u128 *) res, (u128 *) r, (u128 *) p1); + crypto_xor_cpy(res, r, p1, sizeof(p1)); /* res = e(k, res) */ err = smp_e(k, res); @@ -442,7 +441,7 @@ static int smp_c1(const u8 k[16], SMP_DBG("p2 %16phN", p2); /* res = res XOR p2 */ - u128_xor((u128 *) res, (u128 *) res, (u128 *) p2); + crypto_xor(res, p2, sizeof(p2)); /* res = e(k, res) */ err = smp_e(k, res); |