diff options
author | Iulia Tanasescu <iulia.tanasescu@nxp.com> | 2023-04-19 16:43:54 +0300 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2023-04-19 13:46:00 -0700 |
commit | b56479f4f5a350391af06cae331bd1d78651da58 (patch) | |
tree | 2473acd4f63367bf86ac7b4dcc0a0ad9e1722ea9 /emulator | |
parent | ce1eb5dd0a03db1f6c123f14e4f837d115fd08d7 (diff) | |
download | bluez-b56479f4f5a350391af06cae331bd1d78651da58.tar.gz |
tools/iso-tester: Add Broadcast tests for encrypted BIG
This adds the following tests for encrypted broadcast:
ISO Broadcaster Encrypted - Success
ISO Broadcaster Receiver Encrypted - Success
Diffstat (limited to 'emulator')
-rw-r--r-- | emulator/btdev.c | 8 | ||||
-rw-r--r-- | emulator/bthost.c | 5 | ||||
-rw-r--r-- | emulator/bthost.h | 4 |
3 files changed, 15 insertions, 2 deletions
diff --git a/emulator/btdev.c b/emulator/btdev.c index a04f34d4b..7980a5280 100644 --- a/emulator/btdev.c +++ b/emulator/btdev.c @@ -5,6 +5,7 @@ * * Copyright (C) 2011-2012 Intel Corporation * Copyright (C) 2004-2010 Marcel Holtmann <marcel@holtmann.org> + * Copyright 2023 NXP * * */ @@ -6162,6 +6163,13 @@ static int cmd_big_create_sync_complete(struct btdev *dev, const void *data, dev->big_handle = cmd->handle; bis = conn->data; + if (bis->encryption != cmd->encryption) { + pdu.ev.status = BT_HCI_ERR_ENC_MODE_NOT_ACCEPTABLE; + le_meta_event(dev, BT_HCI_EVT_LE_BIG_SYNC_ESTABILISHED, &pdu, + sizeof(pdu.ev)); + return 0; + } + pdu.ev.handle = cmd->handle; memcpy(pdu.ev.latency, bis->sdu_interval, sizeof(pdu.ev.interval)); pdu.ev.nse = 0x01; diff --git a/emulator/bthost.c b/emulator/bthost.c index 8cdfa0c06..3179bb3d2 100644 --- a/emulator/bthost.c +++ b/emulator/bthost.c @@ -3137,7 +3137,8 @@ void bthost_set_pa_enable(struct bthost *bthost, uint8_t enable) send_command(bthost, BT_HCI_CMD_LE_SET_PA_ENABLE, &cp, sizeof(cp)); } -void bthost_create_big(struct bthost *bthost, uint8_t num_bis) +void bthost_create_big(struct bthost *bthost, uint8_t num_bis, + uint8_t enc, const uint8_t *bcode) { struct bt_hci_cmd_le_create_big cp; @@ -3150,6 +3151,8 @@ void bthost_create_big(struct bthost *bthost, uint8_t num_bis) cp.bis.latency = cpu_to_le16(10); cp.bis.rtn = 0x02; cp.bis.phy = 0x02; + cp.bis.encryption = enc; + memcpy(cp.bis.bcode, bcode, sizeof(cp.bis.bcode)); send_command(bthost, BT_HCI_CMD_LE_CREATE_BIG, &cp, sizeof(cp)); } diff --git a/emulator/bthost.h b/emulator/bthost.h index 92182687f..cdc12dc1c 100644 --- a/emulator/bthost.h +++ b/emulator/bthost.h @@ -5,6 +5,7 @@ * * Copyright (C) 2011-2012 Intel Corporation * Copyright (C) 2004-2010 Marcel Holtmann <marcel@holtmann.org> + * Copyright 2023 NXP * * */ @@ -102,7 +103,8 @@ void bthost_set_ext_adv_params(struct bthost *bthost); void bthost_set_ext_adv_enable(struct bthost *bthost, uint8_t enable); void bthost_set_pa_params(struct bthost *bthost); void bthost_set_pa_enable(struct bthost *bthost, uint8_t enable); -void bthost_create_big(struct bthost *bthost, uint8_t num_bis); +void bthost_create_big(struct bthost *bthost, uint8_t num_bis, uint8_t enc, + const uint8_t *bcode); bool bthost_search_ext_adv_addr(struct bthost *bthost, const uint8_t *addr); void bthost_set_cig_params(struct bthost *bthost, uint8_t cig_id, |