From 99f85c8c05c4802b641e5bfa6ae6f153f11cb9c0 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Tue, 18 Mar 2014 12:59:35 +0200 Subject: [PATCH] shared/crypto: Fix bt_crypto_s1 byte order handling The assumption is that this function takes little endian data, i.e. the most significant 64-bits to be discarded are found at the end of r1 and r2 instead of the beginning. --- src/shared/crypto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shared/crypto.c b/src/shared/crypto.c index c54a17d4d..cc7536aba 100644 --- a/src/shared/crypto.c +++ b/src/shared/crypto.c @@ -463,8 +463,8 @@ bool bt_crypto_s1(struct bt_crypto *crypto, const uint8_t k[16], const uint8_t r1[16], const uint8_t r2[16], uint8_t res[16]) { - memcpy(res, r1 + 8, 8); - memcpy(res + 8, r2 + 8, 8); + memcpy(res, r2, 8); + memcpy(res + 8, r1, 8); return bt_crypto_e(crypto, k, res, res); } -- 2.47.3