From b56479f4f5a350391af06cae331bd1d78651da58 Mon Sep 17 00:00:00 2001 From: Iulia Tanasescu Date: Wed, 19 Apr 2023 16:43:54 +0300 Subject: 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 --- emulator/btdev.c | 8 ++++++++ emulator/bthost.c | 5 ++++- emulator/bthost.h | 4 +++- 3 files changed, 15 insertions(+), 2 deletions(-) (limited to 'emulator') 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 + * 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 + * 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, -- cgit v1.2.1