This is an automated email from the ASF dual-hosted git repository. sjanc pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
commit ee5da3a658d43dd41a17b0cc9c89faea5b4e80db Author: Szymon Janc <[email protected]> AuthorDate: Wed Oct 7 18:06:35 2026 +0200 nimble/phy/cmac: Include upper packet counter bits in CCM nonce Only lower 32 bits of packet counter were put in CCM nonce. Packet counter is 39-bit so also set bits 32-38 in nonce together with direction bit. Without this, 64-bit packet counters in LL had no effect on CMAC. Assisted-by: Claude:claude-opus-5-5 --- nimble/drivers/dialog_cmac/src/ble_phy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nimble/drivers/dialog_cmac/src/ble_phy.c b/nimble/drivers/dialog_cmac/src/ble_phy.c index de7024b46..c59990fea 100644 --- a/nimble/drivers/dialog_cmac/src/ble_phy.c +++ b/nimble/drivers/dialog_cmac/src/ble_phy.c @@ -1643,7 +1643,7 @@ ble_phy_encrypt_counter_set(uint64_t counter, uint8_t dir_bit) enc = &g_ble_phy_encrypt_data; put_le32(&enc->b0[1], counter); - enc->b0[5] = dir_bit ? 0x80 : 0; + enc->b0[5] = ((counter >> 32) & 0x7f) | (dir_bit ? 0x80 : 0); put_le32(&enc->ai[1], counter); enc->ai[5] = enc->b0[5];
