Bluetooth: GATT: Fix byte order for database hash
Core 5.1, Vol 3, Part F, 3.3.1 "Multi-octet fields within the GATT profile shall be sent least significant octet first (little-endian) with the exception of the Characteristic Value field. The Characteristic Value and any fields within it shall be little-endian unless otherwise defined in the specification which defines the characteristic." Fixes: GATT/SR/GAS/BV-02-C Fixes: #17857 Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This commit is contained in:
parent
09c1c9e800
commit
a56695db9a
1 changed files with 9 additions and 0 deletions
|
@ -420,6 +420,15 @@ static void db_hash_gen(bool store)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Core 5.1 does not state the endianess of the hash.
|
||||||
|
* However Vol 3, Part F, 3.3.1 says that multi-octet Characteristic
|
||||||
|
* Values shall be LE unless otherwise defined. PTS expects hash to be
|
||||||
|
* in little endianess as well. bt_smp_aes_cmac calculates the hash in
|
||||||
|
* big endianess so we have to swap.
|
||||||
|
*/
|
||||||
|
sys_mem_swap(db_hash, sizeof(db_hash));
|
||||||
|
|
||||||
BT_HEXDUMP_DBG(db_hash, sizeof(db_hash), "Hash: ");
|
BT_HEXDUMP_DBG(db_hash, sizeof(db_hash), "Hash: ");
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_SETTINGS) && store) {
|
if (IS_ENABLED(CONFIG_BT_SETTINGS) && store) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue