Skip to content

Commit aafcd4f

Browse files
gudipudiramanakumarkartben
authored andcommitted
bluetooth: audio: Update bad code in BASS to be v1.0.1 compliant
Bad Broadcast Code in BASS/Scan Delegator if BIG_Encryption field value = 0x03 (Bad_Code), Bad_Code shall be set to the value 0xFFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF according to BASS v1.0.1 Signed-off-by: Gudipudi Ramana Kumar <gudipudiramanakumar@gmail.com>
1 parent 7e6410d commit aafcd4f

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

subsys/bluetooth/audio/bap_scan_delegator.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,8 +1372,7 @@ int bt_bap_scan_delegator_set_bis_sync_state(
13721372
internal_state->index, src_id);
13731373

13741374
if (internal_state->state.encrypt_state == BT_BAP_BIG_ENC_STATE_BAD_CODE) {
1375-
(void)memcpy(internal_state->state.bad_code,
1376-
internal_state->broadcast_code,
1375+
(void)memset(internal_state->state.bad_code, 0xFF,
13771376
sizeof(internal_state->state.bad_code));
13781377
}
13791378

@@ -1570,8 +1569,7 @@ int bt_bap_scan_delegator_mod_src(const struct bt_bap_scan_delegator_mod_src_par
15701569
state->encrypt_state = param->encrypt_state;
15711570

15721571
if (state->encrypt_state == BT_BAP_BIG_ENC_STATE_BAD_CODE) {
1573-
(void)memcpy(state->bad_code, internal_state->broadcast_code,
1574-
sizeof(internal_state->state.bad_code));
1572+
(void)memset(state->bad_code, 0xFF, sizeof(internal_state->state.bad_code));
15751573
}
15761574

15771575
state_changed = true;

tests/bsim/bluetooth/audio/src/bap_broadcast_assistant_test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ static void bap_broadcast_assistant_recv_state_cb(
142142
SET_FLAG(flag_broadcast_code_requested);
143143
} else if (state->encrypt_state == BT_BAP_BIG_ENC_STATE_BAD_CODE) {
144144
SET_FLAG(flag_incorrect_broadcast_code);
145-
if (memcmp(state->bad_code, INCORRECT_BROADCAST_CODE, BT_ISO_BROADCAST_CODE_SIZE) !=
145+
if (memcmp(state->bad_code, BAD_BROADCAST_CODE, BT_ISO_BROADCAST_CODE_SIZE) !=
146146
0) {
147147
FAIL("Bad code is not what we sent\n");
148148
return;

tests/bsim/bluetooth/audio/src/bap_common.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@
4848
#define INCORRECT_BROADCAST_CODE \
4949
((uint8_t[]){0xDE, 0xAD, 0xBE, 0xEF, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, \
5050
0xdd, 0xee, 0xff})
51+
#define BAD_BROADCAST_CODE \
52+
((uint8_t[]){0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \
53+
0xFF, 0xFF, 0xFF})
5154

5255
#define BAP_RETRY_WAIT K_MSEC(100)
5356

0 commit comments

Comments
 (0)