Bluetooth: Audio: Rename set_sirk to just sirk

The S in SIRK is for set, so set_sirk was effectively
"set set".

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
Emil Gydesen 2024-05-28 15:55:57 +02:00 committed by Henrik Brix Andersen
commit 6b6107ccd1
23 changed files with 189 additions and 216 deletions

View file

@ -27,9 +27,9 @@ register callbacks.
[rank <int>] [not-lockable] [sirk <data>] [rank <int>] [not-lockable] [sirk <data>]
lock :Lock the set lock :Lock the set
release :Release the set [force] release :Release the set [force]
set_sirk :Set the currently used SIRK <sirk> sirk :Set the currently used SIRK <sirk>
get_sirk :Get the currently used SIRK get_sirk :Get the currently used SIRK
set_sirk_rsp :Set the response used in SIRK requests <accept, accept_enc, sirk_rsp :Set the response used in SIRK requests <accept, accept_enc,
reject, oob> reject, oob>
Besides initializing the CAS and the CSIS, there are also commands to lock and release the CSIS Besides initializing the CAS and the CSIS, there are also commands to lock and release the CSIS
@ -45,8 +45,8 @@ clients.
.. code-block:: console .. code-block:: console
uart:~$ cap_acceptor set_sirk 00112233445566778899aabbccddeeff uart:~$ cap_acceptor sirk 00112233445566778899aabbccddeeff
Set SIRK updated SIRK updated
Getting the current SIRK Getting the current SIRK
------------------------ ------------------------
@ -56,7 +56,7 @@ This command can get the currently used SIRK.
.. code-block:: console .. code-block:: console
uart:~$ cap_acceptor get_sirk uart:~$ cap_acceptor get_sirk
Set SIRK SIRK
36 04 9a dc 66 3a a1 a1 |6...f:.. 36 04 9a dc 66 3a a1 a1 |6...f:..
1d 9a 2f 41 01 73 3e 01 |../A.s>. 1d 9a 2f 41 01 73 3e 01 |../A.s>.

View file

@ -80,7 +80,7 @@ Discovering sets on a device:
<dbg> bt_csip_set_coordinator.discover_func: Setup complete for 1 / 1 <dbg> bt_csip_set_coordinator.discover_func: Setup complete for 1 / 1
Found 1 sets on device Found 1 sets on device
uart:~$ csip_set_coordinator discover_sets uart:~$ csip_set_coordinator discover_sets
<dbg> bt_csip_set_coordinator.Set SIRK <dbg> bt_csip_set_coordinator.SIRK
36 04 9a dc 66 3a a1 a1 |6...f:.. 36 04 9a dc 66 3a a1 a1 |6...f:..
1d 9a 2f 41 01 73 3e 01 |../A.s>. 1d 9a 2f 41 01 73 3e 01 |../A.s>.
<dbg> bt_csip_set_coordinator.csip_set_coordinator_discover_sets_read_set_size_cb: 2 <dbg> bt_csip_set_coordinator.csip_set_coordinator_discover_sets_read_set_size_cb: 2
@ -109,7 +109,7 @@ Lock set members:
<dbg> bt_csip_set_coordinator.csip_set_coordinator_connected: Connected to 34:02:86:03:86:c0 (public) <dbg> bt_csip_set_coordinator.csip_set_coordinator_connected: Connected to 34:02:86:03:86:c0 (public)
<dbg> bt_csip_set_coordinator.discover_func: Setup complete for 1 / 1 <dbg> bt_csip_set_coordinator.discover_func: Setup complete for 1 / 1
<dbg> bt_csip_set_coordinator.csip_set_coordinator_lock_set_init_cb: <dbg> bt_csip_set_coordinator.csip_set_coordinator_lock_set_init_cb:
<dbg> bt_csip_set_coordinator.Set SIRK <dbg> bt_csip_set_coordinator.SIRK
36 04 9a dc 66 3a a1 a1 |6...f:.. 36 04 9a dc 66 3a a1 a1 |6...f:..
1d 9a 2f 41 01 73 3e 01 |../A.s>. 1d 9a 2f 41 01 73 3e 01 |../A.s>.
<dbg> bt_csip_set_coordinator.csip_set_coordinator_discover_sets_read_set_size_cb: 2 <dbg> bt_csip_set_coordinator.csip_set_coordinator_discover_sets_read_set_size_cb: 2
@ -149,9 +149,9 @@ Using the Set Member
[rank <int>] [not-lockable] [sirk <data>] [rank <int>] [not-lockable] [sirk <data>]
lock :Lock the set lock :Lock the set
release :Release the set [force] release :Release the set [force]
set_sirk :Set the currently used SIRK <sirk> sirk :Set the currently used SIRK <sirk>
get_sirk :Get the currently used SIRK get_sirk :Get the currently used SIRK
set_sirk_rsp :Set the response used in SIRK requests <accept, accept_enc, sirk_rsp :Set the response used in SIRK requests <accept, accept_enc,
reject, oob> reject, oob>
Example Usage Example Usage
@ -176,8 +176,8 @@ clients.
.. code-block:: console .. code-block:: console
uart:~$ csip_set_member set_sirk 00112233445566778899aabbccddeeff uart:~$ csip_set_member sirk 00112233445566778899aabbccddeeff
Set SIRK updated SIRK updated
Getting the current SIRK Getting the current SIRK
------------------------ ------------------------
@ -187,6 +187,6 @@ This command can get the currently used SIRK.
.. code-block:: console .. code-block:: console
uart:~$ csip_set_member get_sirk uart:~$ csip_set_member get_sirk
Set SIRK SIRK
36 04 9a dc 66 3a a1 a1 |6...f:.. 36 04 9a dc 66 3a a1 a1 |6...f:..
1d 9a 2f 41 01 73 3e 01 |../A.s>. 1d 9a 2f 41 01 73 3e 01 |../A.s>.

View file

@ -446,6 +446,9 @@ Bluetooth Audio
This needs to be added to all instances of CAP discovery callback functions defined. This needs to be added to all instances of CAP discovery callback functions defined.
(:github:`72797`) (:github:`72797`)
* All occurrences of ``set_sirk`` have been changed to just ``sirk`` as the ``s`` in ``sirk`` stands
for set. (:github:`73413`)
Bluetooth Classic Bluetooth Classic
================= =================

View file

@ -44,7 +44,7 @@ extern "C" {
#define BT_CSIP_READ_SIRK_REQ_RSP_OOB_ONLY 0x03 #define BT_CSIP_READ_SIRK_REQ_RSP_OOB_ONLY 0x03
/** Size of the Set Identification Resolving Key (SIRK) */ /** Size of the Set Identification Resolving Key (SIRK) */
#define BT_CSIP_SET_SIRK_SIZE 16 #define BT_CSIP_SIRK_SIZE 16
/** Size of the Resolvable Set Identifier (RSI) */ /** Size of the Resolvable Set Identifier (RSI) */
#define BT_CSIP_RSI_SIZE 6 #define BT_CSIP_RSI_SIZE 6
@ -123,7 +123,7 @@ struct bt_csip_set_member_register_param {
* This shall be unique between different sets, and shall be the same * This shall be unique between different sets, and shall be the same
* for each set member for each set. * for each set member for each set.
*/ */
uint8_t set_sirk[BT_CSIP_SET_SIRK_SIZE]; uint8_t sirk[BT_CSIP_SIRK_SIZE];
/** /**
* @brief Boolean to set whether the set is lockable by clients * @brief Boolean to set whether the set is lockable by clients
@ -204,8 +204,8 @@ int bt_csip_set_member_unregister(struct bt_csip_set_member_svc_inst *svc_inst);
* @param svc_inst Pointer to the registered Coordinated Set Identification Service. * @param svc_inst Pointer to the registered Coordinated Set Identification Service.
* @param sirk The new SIRK. * @param sirk The new SIRK.
*/ */
int bt_csip_set_member_set_sirk(struct bt_csip_set_member_svc_inst *svc_inst, int bt_csip_set_member_sirk(struct bt_csip_set_member_svc_inst *svc_inst,
const uint8_t sirk[BT_CSIP_SET_SIRK_SIZE]); const uint8_t sirk[BT_CSIP_SIRK_SIZE]);
/** /**
* @brief Get the SIRK of a service instance * @brief Get the SIRK of a service instance
@ -214,7 +214,7 @@ int bt_csip_set_member_set_sirk(struct bt_csip_set_member_svc_inst *svc_inst,
* @param[out] sirk Array to store the SIRK in. * @param[out] sirk Array to store the SIRK in.
*/ */
int bt_csip_set_member_get_sirk(struct bt_csip_set_member_svc_inst *svc_inst, int bt_csip_set_member_get_sirk(struct bt_csip_set_member_svc_inst *svc_inst,
uint8_t sirk[BT_CSIP_SET_SIRK_SIZE]); uint8_t sirk[BT_CSIP_SIRK_SIZE]);
/** /**
* @brief Generate the Resolvable Set Identifier (RSI) value. * @brief Generate the Resolvable Set Identifier (RSI) value.
@ -248,10 +248,10 @@ struct bt_csip_set_coordinator_set_info {
/** /**
* @brief The 16 octet set Set Identity Resolving Key (SIRK) * @brief The 16 octet set Set Identity Resolving Key (SIRK)
* *
* The Set SIRK may not be exposed by the server over Bluetooth, and * The SIRK may not be exposed by the server over Bluetooth, and
* may require an out-of-band solution. * may require an out-of-band solution.
*/ */
uint8_t set_sirk[BT_CSIP_SET_SIRK_SIZE]; uint8_t sirk[BT_CSIP_SIRK_SIZE];
/** /**
* @brief The size of the set * @brief The size of the set
@ -382,12 +382,12 @@ struct bt_csip_set_coordinator_cb {
/** /**
* @brief Check if advertising data indicates a set member * @brief Check if advertising data indicates a set member
* *
* @param set_sirk The SIRK of the set to check against * @param sirk The SIRK of the set to check against
* @param data The advertising data * @param data The advertising data
* *
* @return true if the advertising data indicates a set member, false otherwise * @return true if the advertising data indicates a set member, false otherwise
*/ */
bool bt_csip_set_coordinator_is_set_member(const uint8_t set_sirk[BT_CSIP_SET_SIRK_SIZE], bool bt_csip_set_coordinator_is_set_member(const uint8_t sirk[BT_CSIP_SIRK_SIZE],
struct bt_data *data); struct bt_data *data);
/** /**

View file

@ -4120,12 +4120,11 @@ struct bt_uuid_128 {
/** /**
* @brief Set Identity Resolving Key value * @brief Set Identity Resolving Key value
*/ */
#define BT_UUID_CSIS_SET_SIRK_VAL 0x2b84 #define BT_UUID_CSIS_SIRK_VAL 0x2b84
/** /**
* @brief Set Identity Resolving Key * @brief Set Identity Resolving Key
*/ */
#define BT_UUID_CSIS_SET_SIRK \ #define BT_UUID_CSIS_SIRK BT_UUID_DECLARE_16(BT_UUID_CSIS_SIRK_VAL)
BT_UUID_DECLARE_16(BT_UUID_CSIS_SET_SIRK_VAL)
/** /**
* @brief Set size value * @brief Set size value
*/ */

View file

@ -41,7 +41,7 @@ int csip_set_member_init(void)
.set_size = 2, .set_size = 2,
.rank = CONFIG_HAP_HA_SET_RANK, .rank = CONFIG_HAP_HA_SET_RANK,
.lockable = false, .lockable = false,
.set_sirk = CSIP_SIRK_DEBUG, .sirk = CSIP_SIRK_DEBUG,
.cb = &csip_cb, .cb = &csip_cb,
}; };

View file

@ -26,7 +26,7 @@ LOG_MODULE_REGISTER(bt_csip_crypto, CONFIG_BT_CSIP_SET_MEMBER_CRYPTO_LOG_LEVEL);
#define BT_CSIP_PADDED_RAND_SIZE (BT_CSIP_CRYPTO_PADDING_SIZE + BT_CSIP_CRYPTO_PRAND_SIZE) #define BT_CSIP_PADDED_RAND_SIZE (BT_CSIP_CRYPTO_PADDING_SIZE + BT_CSIP_CRYPTO_PRAND_SIZE)
#define BT_CSIP_R_MASK BIT_MASK(24) /* r is 24 bit / 3 octet */ #define BT_CSIP_R_MASK BIT_MASK(24) /* r is 24 bit / 3 octet */
int bt_csip_sih(const uint8_t sirk[BT_CSIP_SET_SIRK_SIZE], uint8_t r[BT_CSIP_CRYPTO_PRAND_SIZE], int bt_csip_sih(const uint8_t sirk[BT_CSIP_SIRK_SIZE], uint8_t r[BT_CSIP_CRYPTO_PRAND_SIZE],
uint8_t out[BT_CSIP_CRYPTO_HASH_SIZE]) uint8_t out[BT_CSIP_CRYPTO_HASH_SIZE])
{ {
uint8_t res[BT_CSIP_PADDED_RAND_SIZE]; /* need to store 128 bit */ uint8_t res[BT_CSIP_PADDED_RAND_SIZE]; /* need to store 128 bit */
@ -37,7 +37,7 @@ int bt_csip_sih(const uint8_t sirk[BT_CSIP_SET_SIRK_SIZE], uint8_t r[BT_CSIP_CRY
LOG_DBG("Invalid r %s", bt_hex(r, BT_CSIP_CRYPTO_PRAND_SIZE)); LOG_DBG("Invalid r %s", bt_hex(r, BT_CSIP_CRYPTO_PRAND_SIZE));
} }
LOG_DBG("SIRK %s", bt_hex(sirk, BT_CSIP_SET_SIRK_SIZE)); LOG_DBG("SIRK %s", bt_hex(sirk, BT_CSIP_SIRK_SIZE));
LOG_DBG("r %s", bt_hex(r, BT_CSIP_CRYPTO_PRAND_SIZE)); LOG_DBG("r %s", bt_hex(r, BT_CSIP_CRYPTO_PRAND_SIZE));
/* r' = padding || r */ /* r' = padding || r */
@ -148,9 +148,8 @@ static int s1(const uint8_t *m, size_t m_size,
return err; return err;
} }
int bt_csip_sef(const uint8_t k[BT_CSIP_CRYPTO_KEY_SIZE], int bt_csip_sef(const uint8_t k[BT_CSIP_CRYPTO_KEY_SIZE], const uint8_t sirk[BT_CSIP_SIRK_SIZE],
const uint8_t sirk[BT_CSIP_SET_SIRK_SIZE], uint8_t out_sirk[BT_CSIP_SIRK_SIZE])
uint8_t out_sirk[BT_CSIP_SET_SIRK_SIZE])
{ {
const uint8_t m[] = {'S', 'I', 'R', 'K', 'e', 'n', 'c'}; const uint8_t m[] = {'S', 'I', 'R', 'K', 'e', 'n', 'c'};
const uint8_t p[] = {'c', 's', 'i', 's'}; const uint8_t p[] = {'c', 's', 'i', 's'};
@ -163,7 +162,7 @@ int bt_csip_sef(const uint8_t k[BT_CSIP_CRYPTO_KEY_SIZE],
* sef(K, SIRK) = k1(K, s1("SIRKenc"), "csis") ^ SIRK * sef(K, SIRK) = k1(K, s1("SIRKenc"), "csis") ^ SIRK
*/ */
LOG_DBG("SIRK %s", bt_hex(sirk, BT_CSIP_SET_SIRK_SIZE)); LOG_DBG("SIRK %s", bt_hex(sirk, BT_CSIP_SIRK_SIZE));
if (IS_ENABLED(CONFIG_LITTLE_ENDIAN)) { if (IS_ENABLED(CONFIG_LITTLE_ENDIAN)) {
/* Swap because aes_cmac is big endian /* Swap because aes_cmac is big endian
@ -195,14 +194,13 @@ int bt_csip_sef(const uint8_t k[BT_CSIP_CRYPTO_KEY_SIZE],
} }
mem_xor_128(out_sirk, k1_out, sirk); mem_xor_128(out_sirk, k1_out, sirk);
LOG_DBG("out %s", bt_hex(out_sirk, BT_CSIP_SET_SIRK_SIZE)); LOG_DBG("out %s", bt_hex(out_sirk, BT_CSIP_SIRK_SIZE));
return 0; return 0;
} }
int bt_csip_sdf(const uint8_t k[BT_CSIP_CRYPTO_KEY_SIZE], int bt_csip_sdf(const uint8_t k[BT_CSIP_CRYPTO_KEY_SIZE], const uint8_t enc_sirk[BT_CSIP_SIRK_SIZE],
const uint8_t enc_sirk[BT_CSIP_SET_SIRK_SIZE], uint8_t out_sirk[BT_CSIP_SIRK_SIZE])
uint8_t out_sirk[BT_CSIP_SET_SIRK_SIZE])
{ {
/* SIRK encryption is currently symmetric, which means that we can /* SIRK encryption is currently symmetric, which means that we can
* simply apply the sef function to decrypt it. * simply apply the sef function to decrypt it.

View file

@ -27,8 +27,7 @@
* @param out 3 byte LS byte first output buffer * @param out 3 byte LS byte first output buffer
* @return int 0 on success, any other value indicates a failure. * @return int 0 on success, any other value indicates a failure.
*/ */
int bt_csip_sih(const uint8_t sirk[BT_CSIP_SET_SIRK_SIZE], int bt_csip_sih(const uint8_t sirk[BT_CSIP_SIRK_SIZE], uint8_t r[BT_CSIP_CRYPTO_PRAND_SIZE],
uint8_t r[BT_CSIP_CRYPTO_PRAND_SIZE],
uint8_t out[BT_CSIP_CRYPTO_HASH_SIZE]); uint8_t out[BT_CSIP_CRYPTO_HASH_SIZE]);
/** /**
@ -54,9 +53,8 @@ int bt_csip_sih(const uint8_t sirk[BT_CSIP_SET_SIRK_SIZE],
* @param out_sirk The encrypted SIRK. * @param out_sirk The encrypted SIRK.
* @return int 0 on success, any other value indicates a failure. * @return int 0 on success, any other value indicates a failure.
*/ */
int bt_csip_sef(const uint8_t k[BT_CSIP_CRYPTO_KEY_SIZE], int bt_csip_sef(const uint8_t k[BT_CSIP_CRYPTO_KEY_SIZE], const uint8_t sirk[BT_CSIP_SIRK_SIZE],
const uint8_t sirk[BT_CSIP_SET_SIRK_SIZE], uint8_t out_sirk[BT_CSIP_SIRK_SIZE]);
uint8_t out_sirk[BT_CSIP_SET_SIRK_SIZE]);
/** /**
* @brief SIRK decryption function sdf * @brief SIRK decryption function sdf
@ -81,6 +79,5 @@ int bt_csip_sef(const uint8_t k[BT_CSIP_CRYPTO_KEY_SIZE],
* @param out_sirk The decrypted SIRK. * @param out_sirk The decrypted SIRK.
* @return int 0 on success, any other value indicates a failure. * @return int 0 on success, any other value indicates a failure.
*/ */
int bt_csip_sdf(const uint8_t k[BT_CSIP_CRYPTO_KEY_SIZE], int bt_csip_sdf(const uint8_t k[BT_CSIP_CRYPTO_KEY_SIZE], const uint8_t enc_sirk[BT_CSIP_SIRK_SIZE],
const uint8_t enc_sirk[BT_CSIP_SET_SIRK_SIZE], uint8_t out_sirk[BT_CSIP_SIRK_SIZE]);
uint8_t out_sirk[BT_CSIP_SET_SIRK_SIZE]);

View file

@ -16,9 +16,9 @@
#define BT_CSIP_RELEASE_VALUE 0x01 #define BT_CSIP_RELEASE_VALUE 0x01
#define BT_CSIP_LOCK_VALUE 0x02 #define BT_CSIP_LOCK_VALUE 0x02
struct bt_csip_set_sirk { struct bt_csip_sirk {
uint8_t type; uint8_t type;
uint8_t value[BT_CSIP_SET_SIRK_SIZE]; uint8_t value[BT_CSIP_SIRK_SIZE];
} __packed; } __packed;
struct bt_csip_set_coordinator_svc_inst *bt_csip_set_coordinator_lookup_instance_by_index( struct bt_csip_set_coordinator_svc_inst *bt_csip_set_coordinator_lookup_instance_by_index(
@ -29,7 +29,7 @@ struct bt_csip_set_coordinator_svc_inst {
uint16_t start_handle; uint16_t start_handle;
uint16_t end_handle; uint16_t end_handle;
uint16_t set_sirk_handle; uint16_t sirk_handle;
uint16_t set_size_handle; uint16_t set_size_handle;
uint16_t set_lock_handle; uint16_t set_lock_handle;
uint16_t rank_handle; uint16_t rank_handle;

View file

@ -73,15 +73,15 @@ static struct bt_uuid_16 uuid = BT_UUID_INIT_16(0);
static sys_slist_t csip_set_coordinator_cbs = SYS_SLIST_STATIC_INIT(&csip_set_coordinator_cbs); static sys_slist_t csip_set_coordinator_cbs = SYS_SLIST_STATIC_INIT(&csip_set_coordinator_cbs);
static struct bt_csip_set_coordinator_inst client_insts[CONFIG_BT_MAX_CONN]; static struct bt_csip_set_coordinator_inst client_insts[CONFIG_BT_MAX_CONN];
static int read_set_sirk(struct bt_csip_set_coordinator_svc_inst *svc_inst); static int read_sirk(struct bt_csip_set_coordinator_svc_inst *svc_inst);
static int csip_set_coordinator_read_set_size(struct bt_conn *conn, static int csip_set_coordinator_read_set_size(struct bt_conn *conn,
uint8_t inst_idx, uint8_t inst_idx,
bt_gatt_read_func_t cb); bt_gatt_read_func_t cb);
static int csip_set_coordinator_read_set_lock(struct bt_csip_set_coordinator_svc_inst *svc_inst); static int csip_set_coordinator_read_set_lock(struct bt_csip_set_coordinator_svc_inst *svc_inst);
static uint8_t csip_set_coordinator_discover_insts_read_set_sirk_cb( static uint8_t csip_set_coordinator_discover_insts_read_sirk_cb(struct bt_conn *conn, uint8_t err,
struct bt_conn *conn, uint8_t err, struct bt_gatt_read_params *params, struct bt_gatt_read_params *params,
const void *data, uint16_t length); const void *data, uint16_t length);
static void discover_insts_resume(struct bt_conn *conn, uint16_t sirk_handle, static void discover_insts_resume(struct bt_conn *conn, uint16_t sirk_handle,
uint16_t size_handle, uint16_t rank_handle); uint16_t size_handle, uint16_t rank_handle);
@ -140,9 +140,7 @@ static struct bt_csip_set_coordinator_svc_inst *lookup_instance_by_set_info(
member_set_info = &member->insts[i].info; member_set_info = &member->insts[i].info;
if (member_set_info->set_size == set_info->set_size && if (member_set_info->set_size == set_info->set_size &&
memcmp(&member_set_info->set_sirk, memcmp(&member_set_info->sirk, &set_info->sirk, sizeof(set_info->sirk)) == 0) {
&set_info->set_sirk,
sizeof(set_info->set_sirk)) == 0) {
return bt_csip_set_coordinator_lookup_instance_by_index(inst->conn, i); return bt_csip_set_coordinator_lookup_instance_by_index(inst->conn, i);
} }
} }
@ -375,18 +373,17 @@ static uint8_t sirk_notify_func(struct bt_conn *conn,
if (svc_inst != NULL) { if (svc_inst != NULL) {
LOG_DBG("Instance %u", svc_inst->idx); LOG_DBG("Instance %u", svc_inst->idx);
if (length == sizeof(struct bt_csip_set_sirk)) { if (length == sizeof(struct bt_csip_sirk)) {
struct bt_csip_set_sirk *sirk = struct bt_csip_sirk *sirk = (struct bt_csip_sirk *)data;
(struct bt_csip_set_sirk *)data;
struct bt_csip_set_coordinator_inst *client; struct bt_csip_set_coordinator_inst *client;
struct bt_csip_set_coordinator_csis_inst *inst; struct bt_csip_set_coordinator_csis_inst *inst;
uint8_t *dst_sirk; uint8_t *dst_sirk;
client = &client_insts[bt_conn_index(conn)]; client = &client_insts[bt_conn_index(conn)];
inst = &client->set_member.insts[svc_inst->idx]; inst = &client->set_member.insts[svc_inst->idx];
dst_sirk = inst->info.set_sirk; dst_sirk = inst->info.sirk;
LOG_DBG("Set SIRK %sencrypted", LOG_DBG("SIRK %sencrypted",
sirk->type == BT_CSIP_SIRK_TYPE_PLAIN ? "not " : ""); sirk->type == BT_CSIP_SIRK_TYPE_PLAIN ? "not " : "");
/* Assuming not connected to other set devices */ /* Assuming not connected to other set devices */
@ -395,7 +392,7 @@ static uint8_t sirk_notify_func(struct bt_conn *conn,
int err; int err;
LOG_HEXDUMP_DBG(sirk->value, sizeof(*sirk), LOG_HEXDUMP_DBG(sirk->value, sizeof(*sirk),
"Encrypted Set SIRK"); "Encrypted SIRK");
err = sirk_decrypt(conn, sirk->value, err = sirk_decrypt(conn, sirk->value,
dst_sirk); dst_sirk);
if (err != 0) { if (err != 0) {
@ -411,8 +408,7 @@ static uint8_t sirk_notify_func(struct bt_conn *conn,
(void)memcpy(dst_sirk, sirk->value, sizeof(sirk->value)); (void)memcpy(dst_sirk, sirk->value, sizeof(sirk->value));
} }
LOG_HEXDUMP_DBG(dst_sirk, BT_CSIP_SET_SIRK_SIZE, LOG_HEXDUMP_DBG(dst_sirk, BT_CSIP_SIRK_SIZE, "SIRK");
"Set SIRK");
sirk_changed(inst); sirk_changed(inst);
} else { } else {
@ -548,7 +544,7 @@ static int csip_set_coordinator_write_set_lock(struct bt_csip_set_coordinator_sv
return bt_gatt_write(inst->conn, &client->write_params); return bt_gatt_write(inst->conn, &client->write_params);
} }
static int read_set_sirk(struct bt_csip_set_coordinator_svc_inst *svc_inst) static int read_sirk(struct bt_csip_set_coordinator_svc_inst *svc_inst)
{ {
struct bt_csip_set_coordinator_inst *client = &client_insts[bt_conn_index(svc_inst->conn)]; struct bt_csip_set_coordinator_inst *client = &client_insts[bt_conn_index(svc_inst->conn)];
@ -560,14 +556,14 @@ static int read_set_sirk(struct bt_csip_set_coordinator_svc_inst *svc_inst)
client->cur_inst = svc_inst; client->cur_inst = svc_inst;
} }
if (svc_inst->set_sirk_handle == 0) { if (svc_inst->sirk_handle == 0) {
LOG_DBG("Handle not set"); LOG_DBG("Handle not set");
return -EINVAL; return -EINVAL;
} }
client->read_params.func = csip_set_coordinator_discover_insts_read_set_sirk_cb; client->read_params.func = csip_set_coordinator_discover_insts_read_sirk_cb;
client->read_params.handle_count = 1; client->read_params.handle_count = 1;
client->read_params.single.handle = svc_inst->set_sirk_handle; client->read_params.single.handle = svc_inst->sirk_handle;
client->read_params.single.offset = 0U; client->read_params.single.offset = 0U;
return bt_gatt_read(svc_inst->conn, &client->read_params); return bt_gatt_read(svc_inst->conn, &client->read_params);
@ -649,7 +645,7 @@ static int csip_set_coordinator_discover_sets(struct bt_csip_set_coordinator_ins
int err; int err;
/* Start reading values and call CB when done */ /* Start reading values and call CB when done */
err = read_set_sirk((struct bt_csip_set_coordinator_svc_inst *)member->insts[0].svc_inst); err = read_sirk((struct bt_csip_set_coordinator_svc_inst *)member->insts[0].svc_inst);
if (err == 0) { if (err == 0) {
client->busy = true; client->busy = true;
} }
@ -707,9 +703,9 @@ static uint8_t discover_func(struct bt_conn *conn,
if (params->type == BT_GATT_DISCOVER_CHARACTERISTIC && if (params->type == BT_GATT_DISCOVER_CHARACTERISTIC &&
client->inst_count != 0) { client->inst_count != 0) {
chrc = (struct bt_gatt_chrc *)attr->user_data; chrc = (struct bt_gatt_chrc *)attr->user_data;
if (bt_uuid_cmp(chrc->uuid, BT_UUID_CSIS_SET_SIRK) == 0) { if (bt_uuid_cmp(chrc->uuid, BT_UUID_CSIS_SIRK) == 0) {
LOG_DBG("Set SIRK"); LOG_DBG("SIRK");
client->cur_inst->set_sirk_handle = chrc->value_handle; client->cur_inst->sirk_handle = chrc->value_handle;
sub_params = &client->cur_inst->sirk_sub_params; sub_params = &client->cur_inst->sirk_sub_params;
sub_params->disc_params = &client->cur_inst->sirk_sub_disc_params; sub_params->disc_params = &client->cur_inst->sirk_sub_disc_params;
notify_handler = sirk_notify_func; notify_handler = sirk_notify_func;
@ -819,8 +815,8 @@ static uint8_t primary_discover_func(struct bt_conn *conn,
return BT_GATT_ITER_CONTINUE; return BT_GATT_ITER_CONTINUE;
} }
bool bt_csip_set_coordinator_is_set_member(const uint8_t set_sirk[BT_CSIP_SET_SIRK_SIZE], bool bt_csip_set_coordinator_is_set_member(const uint8_t sirk[BT_CSIP_SIRK_SIZE],
struct bt_data *data) struct bt_data *data)
{ {
if (data->type == BT_DATA_CSIS_RSI && if (data->type == BT_DATA_CSIS_RSI &&
data->data_len == BT_CSIP_RSI_SIZE) { data->data_len == BT_CSIP_RSI_SIZE) {
@ -834,7 +830,7 @@ bool bt_csip_set_coordinator_is_set_member(const uint8_t set_sirk[BT_CSIP_SET_SI
LOG_DBG("hash: %s", bt_hex(hash, BT_CSIP_CRYPTO_HASH_SIZE)); LOG_DBG("hash: %s", bt_hex(hash, BT_CSIP_CRYPTO_HASH_SIZE));
LOG_DBG("prand %s", bt_hex(prand, BT_CSIP_CRYPTO_PRAND_SIZE)); LOG_DBG("prand %s", bt_hex(prand, BT_CSIP_CRYPTO_PRAND_SIZE));
err = bt_csip_sih(set_sirk, prand, calculated_hash); err = bt_csip_sih(sirk, prand, calculated_hash);
if (err != 0) { if (err != 0) {
return false; return false;
} }
@ -921,25 +917,23 @@ static uint8_t csip_set_coordinator_discover_insts_read_set_size_cb(
static int parse_sirk(struct bt_csip_set_coordinator_inst *client, static int parse_sirk(struct bt_csip_set_coordinator_inst *client,
const void *data, uint16_t length) const void *data, uint16_t length)
{ {
uint8_t *set_sirk; uint8_t *sirk;
set_sirk = client->set_member.insts[client->cur_inst->idx].info.set_sirk; sirk = client->set_member.insts[client->cur_inst->idx].info.sirk;
if (length == sizeof(struct bt_csip_set_sirk)) { if (length == sizeof(struct bt_csip_sirk)) {
struct bt_csip_set_sirk *sirk = struct bt_csip_sirk *recvd_sirk = (struct bt_csip_sirk *)data;
(struct bt_csip_set_sirk *)data;
LOG_DBG("Set SIRK %sencrypted", LOG_DBG("SIRK %sencrypted",
sirk->type == BT_CSIP_SIRK_TYPE_PLAIN ? "not " : ""); recvd_sirk->type == BT_CSIP_SIRK_TYPE_PLAIN ? "not " : "");
/* Assuming not connected to other set devices */ /* Assuming not connected to other set devices */
if (sirk->type == BT_CSIP_SIRK_TYPE_ENCRYPTED) { if (recvd_sirk->type == BT_CSIP_SIRK_TYPE_ENCRYPTED) {
if (IS_ENABLED(CONFIG_BT_CSIP_SET_COORDINATOR_ENC_SIRK_SUPPORT)) { if (IS_ENABLED(CONFIG_BT_CSIP_SET_COORDINATOR_ENC_SIRK_SUPPORT)) {
int err; int err;
LOG_HEXDUMP_DBG(sirk->value, sizeof(sirk->value), LOG_HEXDUMP_DBG(recvd_sirk->value, sizeof(recvd_sirk->value),
"Encrypted Set SIRK"); "Encrypted SIRK");
err = sirk_decrypt(client->conn, sirk->value, err = sirk_decrypt(client->conn, recvd_sirk->value, sirk);
set_sirk);
if (err != 0) { if (err != 0) {
LOG_ERR("Could not decrypt " LOG_ERR("Could not decrypt "
"SIRK %d", "SIRK %d",
@ -948,16 +942,15 @@ static int parse_sirk(struct bt_csip_set_coordinator_inst *client,
} }
} else { } else {
LOG_WRN("Encrypted SIRK not supported"); LOG_WRN("Encrypted SIRK not supported");
set_sirk = NULL; sirk = NULL;
return BT_ATT_ERR_INSUFFICIENT_ENCRYPTION; return BT_ATT_ERR_INSUFFICIENT_ENCRYPTION;
} }
} else { } else {
(void)memcpy(set_sirk, sirk->value, sizeof(sirk->value)); (void)memcpy(sirk, recvd_sirk->value, sizeof(recvd_sirk->value));
} }
if (set_sirk != NULL) { if (sirk != NULL) {
LOG_HEXDUMP_DBG(set_sirk, BT_CSIP_SET_SIRK_SIZE, LOG_HEXDUMP_DBG(sirk, BT_CSIP_SIRK_SIZE, "SIRK");
"Set SIRK");
} }
} else { } else {
LOG_DBG("Invalid length"); LOG_DBG("Invalid length");
@ -967,9 +960,9 @@ static int parse_sirk(struct bt_csip_set_coordinator_inst *client,
return 0; return 0;
} }
static uint8_t csip_set_coordinator_discover_insts_read_set_sirk_cb( static uint8_t csip_set_coordinator_discover_insts_read_sirk_cb(struct bt_conn *conn, uint8_t err,
struct bt_conn *conn, uint8_t err, struct bt_gatt_read_params *params, struct bt_gatt_read_params *params,
const void *data, uint16_t length) const void *data, uint16_t length)
{ {
struct bt_csip_set_coordinator_inst *client = &client_insts[bt_conn_index(conn)]; struct bt_csip_set_coordinator_inst *client = &client_insts[bt_conn_index(conn)];
int cb_err = err; int cb_err = err;
@ -1036,7 +1029,7 @@ static void discover_insts_resume(struct bt_conn *conn, uint16_t sirk_handle,
bt_csip_set_coordinator_lookup_instance_by_index(conn, next_idx); bt_csip_set_coordinator_lookup_instance_by_index(conn, next_idx);
/* Read next */ /* Read next */
cb_err = read_set_sirk(client->cur_inst); cb_err = read_sirk(client->cur_inst);
} else { } else {
discover_complete(client, 0); discover_complete(client, 0);
@ -1351,7 +1344,7 @@ static void csip_set_coordinator_reset(struct bt_csip_set_coordinator_inst *inst
svc_inst->set_lock = 0; svc_inst->set_lock = 0;
svc_inst->start_handle = 0; svc_inst->start_handle = 0;
svc_inst->end_handle = 0; svc_inst->end_handle = 0;
svc_inst->set_sirk_handle = 0; svc_inst->sirk_handle = 0;
svc_inst->set_size_handle = 0; svc_inst->set_size_handle = 0;
svc_inst->set_lock_handle = 0; svc_inst->set_lock_handle = 0;
svc_inst->rank_handle = 0; svc_inst->rank_handle = 0;

View file

@ -54,7 +54,7 @@ struct csip_client {
}; };
struct bt_csip_set_member_svc_inst { struct bt_csip_set_member_svc_inst {
struct bt_csip_set_sirk set_sirk; struct bt_csip_sirk sirk;
uint8_t set_size; uint8_t set_size;
uint8_t set_lock; uint8_t set_lock;
uint8_t rank; uint8_t rank;
@ -127,9 +127,8 @@ static void notify_clients(struct bt_csip_set_member_svc_inst *svc_inst,
} }
} }
static int sirk_encrypt(struct bt_conn *conn, static int sirk_encrypt(struct bt_conn *conn, const struct bt_csip_sirk *sirk,
const struct bt_csip_set_sirk *sirk, struct bt_csip_sirk *enc_sirk)
struct bt_csip_set_sirk *enc_sirk)
{ {
int err; int err;
uint8_t *k; uint8_t *k;
@ -214,7 +213,7 @@ int bt_csip_set_member_generate_rsi(const struct bt_csip_set_member_svc_inst *sv
} }
} }
res = bt_csip_sih(svc_inst->set_sirk.value, prand, hash); res = bt_csip_sih(svc_inst->sirk.value, prand, hash);
if (res != 0) { if (res != 0) {
LOG_WRN("Could not generate new RSI"); LOG_WRN("Could not generate new RSI");
return res; return res;
@ -226,12 +225,11 @@ int bt_csip_set_member_generate_rsi(const struct bt_csip_set_member_svc_inst *sv
return res; return res;
} }
static ssize_t read_set_sirk(struct bt_conn *conn, static ssize_t read_sirk(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf,
const struct bt_gatt_attr *attr, uint16_t len, uint16_t offset)
void *buf, uint16_t len, uint16_t offset)
{ {
struct bt_csip_set_sirk enc_sirk; struct bt_csip_sirk enc_sirk;
struct bt_csip_set_sirk *sirk; struct bt_csip_sirk *sirk;
struct bt_csip_set_member_svc_inst *svc_inst = BT_AUDIO_CHRC_USER_DATA(attr); struct bt_csip_set_member_svc_inst *svc_inst = BT_AUDIO_CHRC_USER_DATA(attr);
if (svc_inst->cb != NULL && svc_inst->cb->sirk_read_req != NULL) { if (svc_inst->cb != NULL && svc_inst->cb->sirk_read_req != NULL) {
@ -242,22 +240,20 @@ static ssize_t read_set_sirk(struct bt_conn *conn,
cb_rsp = svc_inst->cb->sirk_read_req(conn, &svc_insts[0]); cb_rsp = svc_inst->cb->sirk_read_req(conn, &svc_insts[0]);
if (cb_rsp == BT_CSIP_READ_SIRK_REQ_RSP_ACCEPT) { if (cb_rsp == BT_CSIP_READ_SIRK_REQ_RSP_ACCEPT) {
sirk = &svc_inst->set_sirk; sirk = &svc_inst->sirk;
} else if (IS_ENABLED(CONFIG_BT_CSIP_SET_MEMBER_ENC_SIRK_SUPPORT) && } else if (IS_ENABLED(CONFIG_BT_CSIP_SET_MEMBER_ENC_SIRK_SUPPORT) &&
cb_rsp == BT_CSIP_READ_SIRK_REQ_RSP_ACCEPT_ENC) { cb_rsp == BT_CSIP_READ_SIRK_REQ_RSP_ACCEPT_ENC) {
int err; int err;
err = sirk_encrypt(conn, &svc_inst->set_sirk, err = sirk_encrypt(conn, &svc_inst->sirk, &enc_sirk);
&enc_sirk);
if (err != 0) { if (err != 0) {
LOG_ERR("Could not encrypt SIRK: %d", LOG_ERR("Could not encrypt SIRK: %d",
err); err);
gatt_err = BT_GATT_ERR(BT_ATT_ERR_UNLIKELY); gatt_err = BT_GATT_ERR(BT_ATT_ERR_UNLIKELY);
} else { } else {
sirk = &enc_sirk; sirk = &enc_sirk;
LOG_HEXDUMP_DBG(enc_sirk.value, LOG_HEXDUMP_DBG(enc_sirk.value, sizeof(enc_sirk.value),
sizeof(enc_sirk.value), "Encrypted SIRK");
"Encrypted Set SIRK");
} }
} else if (cb_rsp == BT_CSIP_READ_SIRK_REQ_RSP_REJECT) { } else if (cb_rsp == BT_CSIP_READ_SIRK_REQ_RSP_REJECT) {
gatt_err = BT_GATT_ERR(BT_ATT_ERR_AUTHORIZATION); gatt_err = BT_GATT_ERR(BT_ATT_ERR_AUTHORIZATION);
@ -272,21 +268,17 @@ static ssize_t read_set_sirk(struct bt_conn *conn,
return gatt_err; return gatt_err;
} }
} else { } else {
sirk = &svc_inst->set_sirk; sirk = &svc_inst->sirk;
} }
LOG_DBG("SIRK %sencrypted", sirk->type == BT_CSIP_SIRK_TYPE_PLAIN ? "not " : "");
LOG_DBG("Set sirk %sencrypted", LOG_HEXDUMP_DBG(svc_inst->sirk.value, sizeof(svc_inst->sirk.value), "SIRK");
sirk->type == BT_CSIP_SIRK_TYPE_PLAIN ? "not " : "");
LOG_HEXDUMP_DBG(svc_inst->set_sirk.value,
sizeof(svc_inst->set_sirk.value), "Set SIRK");
return bt_gatt_attr_read(conn, attr, buf, len, offset, return bt_gatt_attr_read(conn, attr, buf, len, offset,
sirk, sizeof(*sirk)); sirk, sizeof(*sirk));
} }
#if defined(CONFIG_BT_CSIP_SET_MEMBER_NOTIFIABLE) #if defined(CONFIG_BT_CSIP_SET_MEMBER_NOTIFIABLE)
static void set_sirk_cfg_changed(const struct bt_gatt_attr *attr, static void sirk_cfg_changed(const struct bt_gatt_attr *attr, uint16_t value)
uint16_t value)
{ {
LOG_DBG("value 0x%04x", value); LOG_DBG("value 0x%04x", value);
} }
@ -616,13 +608,13 @@ static struct bt_conn_auth_info_cb auth_callbacks = {
#if defined(CONFIG_BT_CSIP_SET_MEMBER_NOTIFIABLE) #if defined(CONFIG_BT_CSIP_SET_MEMBER_NOTIFIABLE)
#define BT_CSIS_CHR_SIRK(_csip) \ #define BT_CSIS_CHR_SIRK(_csip) \
BT_AUDIO_CHRC(BT_UUID_CSIS_SET_SIRK, BT_GATT_CHRC_READ | BT_GATT_CHRC_NOTIFY, \ BT_AUDIO_CHRC(BT_UUID_CSIS_SIRK, BT_GATT_CHRC_READ | BT_GATT_CHRC_NOTIFY, \
BT_GATT_PERM_READ_ENCRYPT, read_set_sirk, NULL, &_csip), \ BT_GATT_PERM_READ_ENCRYPT, read_sirk, NULL, &_csip), \
BT_AUDIO_CCC(set_sirk_cfg_changed) BT_AUDIO_CCC(sirk_cfg_changed)
#else #else
#define BT_CSIS_CHR_SIRK(_csip) \ #define BT_CSIS_CHR_SIRK(_csip) \
BT_AUDIO_CHRC(BT_UUID_CSIS_SET_SIRK, BT_GATT_CHRC_READ, BT_GATT_PERM_READ_ENCRYPT, \ BT_AUDIO_CHRC(BT_UUID_CSIS_SIRK, BT_GATT_CHRC_READ, BT_GATT_PERM_READ_ENCRYPT, read_sirk, \
read_set_sirk, NULL, &_csip) NULL, &_csip)
#endif /* CONFIG_BT_CSIP_SET_MEMBER_NOTIFIABLE */ #endif /* CONFIG_BT_CSIP_SET_MEMBER_NOTIFIABLE */
#define BT_CSIP_SERVICE_DEFINITION(_csip) {\ #define BT_CSIP_SERVICE_DEFINITION(_csip) {\
@ -771,8 +763,8 @@ static void notify_cb(struct bt_conn *conn, void *data)
if (IS_ENABLED(CONFIG_BT_CSIP_SET_MEMBER_NOTIFIABLE) && if (IS_ENABLED(CONFIG_BT_CSIP_SET_MEMBER_NOTIFIABLE) &&
atomic_test_and_clear_bit(client->flags, FLAG_NOTIFY_SIRK)) { atomic_test_and_clear_bit(client->flags, FLAG_NOTIFY_SIRK)) {
notify(svc_inst, conn, BT_UUID_CSIS_SET_SIRK, &svc_inst->set_sirk, notify(svc_inst, conn, BT_UUID_CSIS_SIRK, &svc_inst->sirk,
sizeof(svc_inst->set_sirk)); sizeof(svc_inst->sirk));
} }
} }
} }
@ -869,7 +861,7 @@ int bt_csip_set_member_register(const struct bt_csip_set_member_register_param *
inst->rank = param->rank; inst->rank = param->rank;
inst->set_size = param->set_size; inst->set_size = param->set_size;
inst->set_lock = BT_CSIP_RELEASE_VALUE; inst->set_lock = BT_CSIP_RELEASE_VALUE;
inst->set_sirk.type = BT_CSIP_SIRK_TYPE_PLAIN; inst->sirk.type = BT_CSIP_SIRK_TYPE_PLAIN;
inst->cb = param->cb; inst->cb = param->cb;
if (IS_ENABLED(CONFIG_BT_CSIP_SET_MEMBER_TEST_SAMPLE_DATA)) { if (IS_ENABLED(CONFIG_BT_CSIP_SET_MEMBER_TEST_SAMPLE_DATA)) {
@ -878,12 +870,10 @@ int bt_csip_set_member_register(const struct bt_csip_set_member_register_param *
0x22, 0xfd, 0xa1, 0x21, 0x09, 0x7d, 0x7d, 0x45, 0x22, 0xfd, 0xa1, 0x21, 0x09, 0x7d, 0x7d, 0x45,
}; };
(void)memcpy(inst->set_sirk.value, test_sirk, (void)memcpy(inst->sirk.value, test_sirk, sizeof(test_sirk));
sizeof(test_sirk));
LOG_DBG("CSIP SIRK was overwritten by sample data SIRK"); LOG_DBG("CSIP SIRK was overwritten by sample data SIRK");
} else { } else {
(void)memcpy(inst->set_sirk.value, param->set_sirk, (void)memcpy(inst->sirk.value, param->sirk, sizeof(inst->sirk.value));
sizeof(inst->set_sirk.value));
} }
*svc_inst = inst; *svc_inst = inst;
@ -911,8 +901,8 @@ int bt_csip_set_member_unregister(struct bt_csip_set_member_svc_inst *svc_inst)
return 0; return 0;
} }
int bt_csip_set_member_set_sirk(struct bt_csip_set_member_svc_inst *svc_inst, int bt_csip_set_member_sirk(struct bt_csip_set_member_svc_inst *svc_inst,
const uint8_t sirk[BT_CSIP_SET_SIRK_SIZE]) const uint8_t sirk[BT_CSIP_SIRK_SIZE])
{ {
CHECKIF(svc_inst == NULL) { CHECKIF(svc_inst == NULL) {
LOG_DBG("NULL svc_inst"); LOG_DBG("NULL svc_inst");
@ -924,7 +914,7 @@ int bt_csip_set_member_set_sirk(struct bt_csip_set_member_svc_inst *svc_inst,
return -EINVAL; return -EINVAL;
} }
memcpy(svc_inst->set_sirk.value, sirk, BT_CSIP_SET_SIRK_SIZE); memcpy(svc_inst->sirk.value, sirk, BT_CSIP_SIRK_SIZE);
notify_clients(svc_inst, NULL, FLAG_NOTIFY_SIRK); notify_clients(svc_inst, NULL, FLAG_NOTIFY_SIRK);
@ -932,7 +922,7 @@ int bt_csip_set_member_set_sirk(struct bt_csip_set_member_svc_inst *svc_inst,
} }
int bt_csip_set_member_get_sirk(struct bt_csip_set_member_svc_inst *svc_inst, int bt_csip_set_member_get_sirk(struct bt_csip_set_member_svc_inst *svc_inst,
uint8_t sirk[BT_CSIP_SET_SIRK_SIZE]) uint8_t sirk[BT_CSIP_SIRK_SIZE])
{ {
CHECKIF(svc_inst == NULL) { CHECKIF(svc_inst == NULL) {
LOG_DBG("NULL svc_inst"); LOG_DBG("NULL svc_inst");
@ -944,7 +934,7 @@ int bt_csip_set_member_get_sirk(struct bt_csip_set_member_svc_inst *svc_inst,
return -EINVAL; return -EINVAL;
} }
memcpy(sirk, svc_inst->set_sirk.value, BT_CSIP_SET_SIRK_SIZE); memcpy(sirk, svc_inst->sirk.value, BT_CSIP_SIRK_SIZE);
return 0; return 0;
} }

View file

@ -81,9 +81,9 @@ static int cmd_cap_acceptor_init(const struct shell *sh, size_t argc,
.rank = 1, .rank = 1,
.lockable = true, .lockable = true,
/* Using the CSIS test sample SIRK */ /* Using the CSIS test sample SIRK */
.set_sirk = { 0xcd, 0xcc, 0x72, 0xdd, 0x86, 0x8c, 0xcd, 0xce, .sirk = { 0xcd, 0xcc, 0x72, 0xdd, 0x86, 0x8c, 0xcd, 0xce,
0x22, 0xfd, 0xa1, 0x21, 0x09, 0x7d, 0x7d, 0x45 }, 0x22, 0xfd, 0xa1, 0x21, 0x09, 0x7d, 0x7d, 0x45 },
.cb = &csip_set_member_cbs .cb = &csip_set_member_cbs,
}; };
int err = 0; int err = 0;
@ -150,8 +150,8 @@ static int cmd_cap_acceptor_init(const struct shell *sh, size_t argc,
return SHELL_CMD_HELP_PRINTED; return SHELL_CMD_HELP_PRINTED;
} }
len = hex2bin(argv[argn], strlen(argv[argn]), len = hex2bin(argv[argn], strlen(argv[argn]), param.sirk,
param.set_sirk, sizeof(param.set_sirk)); sizeof(param.sirk));
if (len == 0) { if (len == 0) {
shell_error(sh, "Could not parse SIRK"); shell_error(sh, "Could not parse SIRK");
@ -220,9 +220,9 @@ static int cmd_cap_acceptor_release(const struct shell *sh, size_t argc,
return 0; return 0;
} }
static int cmd_cap_acceptor_set_sirk(const struct shell *sh, size_t argc, char *argv[]) static int cmd_cap_acceptor_sirk(const struct shell *sh, size_t argc, char *argv[])
{ {
uint8_t sirk[BT_CSIP_SET_SIRK_SIZE]; uint8_t sirk[BT_CSIP_SIRK_SIZE];
size_t len; size_t len;
int err; int err;
@ -239,7 +239,7 @@ static int cmd_cap_acceptor_set_sirk(const struct shell *sh, size_t argc, char *
return -ENOEXEC; return -ENOEXEC;
} }
err = bt_csip_set_member_set_sirk(cap_csip_svc_inst, sirk); err = bt_csip_set_member_sirk(cap_csip_svc_inst, sirk);
if (err != 0) { if (err != 0) {
shell_error(sh, "Failed to set SIRK: %d", err); shell_error(sh, "Failed to set SIRK: %d", err);
return -ENOEXEC; return -ENOEXEC;
@ -252,7 +252,7 @@ static int cmd_cap_acceptor_set_sirk(const struct shell *sh, size_t argc, char *
static int cmd_cap_acceptor_get_sirk(const struct shell *sh, size_t argc, char *argv[]) static int cmd_cap_acceptor_get_sirk(const struct shell *sh, size_t argc, char *argv[])
{ {
uint8_t sirk[BT_CSIP_SET_SIRK_SIZE]; uint8_t sirk[BT_CSIP_SIRK_SIZE];
int err; int err;
if (cap_csip_svc_inst == NULL) { if (cap_csip_svc_inst == NULL) {
@ -267,14 +267,13 @@ static int cmd_cap_acceptor_get_sirk(const struct shell *sh, size_t argc, char *
return -ENOEXEC; return -ENOEXEC;
} }
shell_print(sh, "Set SIRK"); shell_print(sh, "SIRK");
shell_hexdump(sh, sirk, sizeof(sirk)); shell_hexdump(sh, sirk, sizeof(sirk));
return 0; return 0;
} }
static int cmd_cap_acceptor_set_sirk_rsp(const struct shell *sh, size_t argc, static int cmd_cap_acceptor_sirk_rsp(const struct shell *sh, size_t argc, char *argv[])
char *argv[])
{ {
if (strcmp(argv[1], "accept") == 0) { if (strcmp(argv[1], "accept") == 0) {
sirk_read_rsp = BT_CSIP_READ_SIRK_REQ_RSP_ACCEPT; sirk_read_rsp = BT_CSIP_READ_SIRK_REQ_RSP_ACCEPT;
@ -299,26 +298,23 @@ static int cmd_cap_acceptor(const struct shell *sh, size_t argc, char **argv)
return -ENOEXEC; return -ENOEXEC;
} }
SHELL_STATIC_SUBCMD_SET_CREATE(cap_acceptor_cmds, SHELL_STATIC_SUBCMD_SET_CREATE(
cap_acceptor_cmds,
SHELL_CMD_ARG(init, NULL, SHELL_CMD_ARG(init, NULL,
"Initialize the service and register callbacks " "Initialize the service and register callbacks "
"[size <int>] [rank <int>] [not-lockable] [sirk <data>]", "[size <int>] [rank <int>] [not-lockable] [sirk <data>]",
cmd_cap_acceptor_init, 1, 4), cmd_cap_acceptor_init, 1, 4),
SHELL_CMD_ARG(lock, NULL, SHELL_CMD_ARG(lock, NULL, "Lock the set", cmd_cap_acceptor_lock, 1, 0),
"Lock the set", SHELL_CMD_ARG(release, NULL, "Release the set [force]", cmd_cap_acceptor_release, 1, 1),
cmd_cap_acceptor_lock, 1, 0), SHELL_CMD_ARG(sirk, NULL, "Set the currently used SIRK <sirk>", cmd_cap_acceptor_sirk, 2,
SHELL_CMD_ARG(release, NULL, 0),
"Release the set [force]", SHELL_CMD_ARG(get_sirk, NULL, "Get the currently used SIRK", cmd_cap_acceptor_get_sirk, 1,
cmd_cap_acceptor_release, 1, 1), 0),
SHELL_CMD_ARG(set_sirk, NULL, "Set the currently used SIRK <sirk>", SHELL_CMD_ARG(sirk_rsp, NULL,
cmd_cap_acceptor_set_sirk, 2, 0),
SHELL_CMD_ARG(get_sirk, NULL, "Get the currently used SIRK", cmd_cap_acceptor_get_sirk,
1, 0),
SHELL_CMD_ARG(set_sirk_rsp, NULL,
"Set the response used in SIRK requests " "Set the response used in SIRK requests "
"<accept, accept_enc, reject, oob>", "<accept, accept_enc, reject, oob>",
cmd_cap_acceptor_set_sirk_rsp, 2, 0), cmd_cap_acceptor_sirk_rsp, 2, 0),
SHELL_SUBCMD_SET_END SHELL_SUBCMD_SET_END
); );
SHELL_CMD_ARG_REGISTER(cap_acceptor, &cap_acceptor_cmds, "Bluetooth CAP acceptor shell commands", SHELL_CMD_ARG_REGISTER(cap_acceptor, &cap_acceptor_cmds, "Bluetooth CAP acceptor shell commands",

View file

@ -181,7 +181,7 @@ static struct bt_le_scan_cb csip_set_coordinator_scan_callbacks = {
static bool csip_found(struct bt_data *data, void *user_data) static bool csip_found(struct bt_data *data, void *user_data)
{ {
if (bt_csip_set_coordinator_is_set_member(cur_inst->info.set_sirk, data)) { if (bt_csip_set_coordinator_is_set_member(cur_inst->info.sirk, data)) {
bt_addr_le_t *addr = user_data; bt_addr_le_t *addr = user_data;
char addr_str[BT_ADDR_LE_STR_LEN]; char addr_str[BT_ADDR_LE_STR_LEN];
@ -325,8 +325,7 @@ static int cmd_csip_set_coordinator_discover_members(const struct shell *sh,
const struct bt_csip_set_coordinator_csis_inst *inst = const struct bt_csip_set_coordinator_csis_inst *inst =
&set_members[i]->insts[j]; &set_members[i]->insts[j];
if (memcmp(inst->info.set_sirk, cur_inst->info.set_sirk, if (memcmp(inst->info.sirk, cur_inst->info.sirk, BT_CSIP_SIRK_SIZE) == 0) {
BT_CSIP_SET_SIRK_SIZE) == 0) {
bt_addr_le_copy(&addr_found[members_found++], bt_addr_le_copy(&addr_found[members_found++],
bt_conn_get_dst(conns[i])); bt_conn_get_dst(conns[i]));
break; break;

View file

@ -69,9 +69,9 @@ static int cmd_csip_set_member_register(const struct shell *sh, size_t argc, cha
.rank = 1, .rank = 1,
.lockable = true, .lockable = true,
/* Using the CSIS test sample SIRK */ /* Using the CSIS test sample SIRK */
.set_sirk = { 0xcd, 0xcc, 0x72, 0xdd, 0x86, 0x8c, 0xcd, 0xce, .sirk = { 0xcd, 0xcc, 0x72, 0xdd, 0x86, 0x8c, 0xcd, 0xce,
0x22, 0xfd, 0xa1, 0x21, 0x09, 0x7d, 0x7d, 0x45 }, 0x22, 0xfd, 0xa1, 0x21, 0x09, 0x7d, 0x7d, 0x45 },
.cb = &csip_set_member_cbs .cb = &csip_set_member_cbs,
}; };
for (size_t argn = 1; argn < argc; argn++) { for (size_t argn = 1; argn < argc; argn++) {
@ -136,8 +136,8 @@ static int cmd_csip_set_member_register(const struct shell *sh, size_t argc, cha
return SHELL_CMD_HELP_PRINTED; return SHELL_CMD_HELP_PRINTED;
} }
len = hex2bin(argv[argn], strlen(argv[argn]), len = hex2bin(argv[argn], strlen(argv[argn]), param.sirk,
param.set_sirk, sizeof(param.set_sirk)); sizeof(param.sirk));
if (len == 0) { if (len == 0) {
shell_error(sh, "Could not parse SIRK"); shell_error(sh, "Could not parse SIRK");
return -ENOEXEC; return -ENOEXEC;
@ -157,9 +157,9 @@ static int cmd_csip_set_member_register(const struct shell *sh, size_t argc, cha
return 0; return 0;
} }
static int cmd_csip_set_member_set_sirk(const struct shell *sh, size_t argc, char *argv[]) static int cmd_csip_set_member_sirk(const struct shell *sh, size_t argc, char *argv[])
{ {
uint8_t sirk[BT_CSIP_SET_SIRK_SIZE]; uint8_t sirk[BT_CSIP_SIRK_SIZE];
size_t len; size_t len;
int err; int err;
@ -176,7 +176,7 @@ static int cmd_csip_set_member_set_sirk(const struct shell *sh, size_t argc, cha
return -ENOEXEC; return -ENOEXEC;
} }
err = bt_csip_set_member_set_sirk(svc_inst, sirk); err = bt_csip_set_member_sirk(svc_inst, sirk);
if (err != 0) { if (err != 0) {
shell_error(sh, "Failed to set SIRK: %d", err); shell_error(sh, "Failed to set SIRK: %d", err);
return -ENOEXEC; return -ENOEXEC;
@ -189,7 +189,7 @@ static int cmd_csip_set_member_set_sirk(const struct shell *sh, size_t argc, cha
static int cmd_csip_set_member_get_sirk(const struct shell *sh, size_t argc, char *argv[]) static int cmd_csip_set_member_get_sirk(const struct shell *sh, size_t argc, char *argv[])
{ {
uint8_t sirk[BT_CSIP_SET_SIRK_SIZE]; uint8_t sirk[BT_CSIP_SIRK_SIZE];
int err; int err;
if (svc_inst == NULL) { if (svc_inst == NULL) {
@ -204,7 +204,7 @@ static int cmd_csip_set_member_get_sirk(const struct shell *sh, size_t argc, cha
return -ENOEXEC; return -ENOEXEC;
} }
shell_print(sh, "Set SIRK"); shell_print(sh, "SIRK");
shell_hexdump(sh, sirk, sizeof(sirk)); shell_hexdump(sh, sirk, sizeof(sirk));
return 0; return 0;
@ -252,8 +252,7 @@ static int cmd_csip_set_member_release(const struct shell *sh, size_t argc,
return 0; return 0;
} }
static int cmd_csip_set_member_set_sirk_rsp(const struct shell *sh, size_t argc, static int cmd_csip_set_member_sirk_rsp(const struct shell *sh, size_t argc, char *argv[])
char *argv[])
{ {
if (strcmp(argv[1], "accept") == 0) { if (strcmp(argv[1], "accept") == 0) {
sirk_read_rsp = BT_CSIP_READ_SIRK_REQ_RSP_ACCEPT; sirk_read_rsp = BT_CSIP_READ_SIRK_REQ_RSP_ACCEPT;
@ -286,14 +285,14 @@ SHELL_STATIC_SUBCMD_SET_CREATE(
cmd_csip_set_member_register, 1, 4), cmd_csip_set_member_register, 1, 4),
SHELL_CMD_ARG(lock, NULL, "Lock the set", cmd_csip_set_member_lock, 1, 0), SHELL_CMD_ARG(lock, NULL, "Lock the set", cmd_csip_set_member_lock, 1, 0),
SHELL_CMD_ARG(release, NULL, "Release the set [force]", cmd_csip_set_member_release, 1, 1), SHELL_CMD_ARG(release, NULL, "Release the set [force]", cmd_csip_set_member_release, 1, 1),
SHELL_CMD_ARG(set_sirk, NULL, "Set the currently used SIRK <sirk>", SHELL_CMD_ARG(sirk, NULL, "Set the currently used SIRK <sirk>", cmd_csip_set_member_sirk, 2,
cmd_csip_set_member_set_sirk, 2, 0), 0),
SHELL_CMD_ARG(get_sirk, NULL, "Get the currently used SIRK", cmd_csip_set_member_get_sirk, SHELL_CMD_ARG(get_sirk, NULL, "Get the currently used SIRK", cmd_csip_set_member_get_sirk,
1, 0), 1, 0),
SHELL_CMD_ARG(set_sirk_rsp, NULL, SHELL_CMD_ARG(sirk_rsp, NULL,
"Set the response used in SIRK requests " "Set the response used in SIRK requests "
"<accept, accept_enc, reject, oob>", "<accept, accept_enc, reject, oob>",
cmd_csip_set_member_set_sirk_rsp, 2, 0), cmd_csip_set_member_sirk_rsp, 2, 0),
SHELL_SUBCMD_SET_END SHELL_SUBCMD_SET_END
); );

View file

@ -49,7 +49,7 @@ struct btp_csip_discovered_ev {
#define BTP_CSIP_SIRK_EV 0x81 #define BTP_CSIP_SIRK_EV 0x81
struct btp_csip_sirk_ev { struct btp_csip_sirk_ev {
bt_addr_le_t address; bt_addr_le_t address;
uint8_t sirk[BT_CSIP_SET_SIRK_SIZE]; uint8_t sirk[BT_CSIP_SIRK_SIZE];
} __packed; } __packed;
#define BTP_CSIP_LOCK_EV 0x82 #define BTP_CSIP_LOCK_EV 0x82

View file

@ -30,6 +30,6 @@ struct btp_csis_get_member_rsi_rp {
} __packed; } __packed;
#define BTP_CSIS_ENC_SIRK_TYPE 0x04 #define BTP_CSIS_ENC_SIRK_TYPE 0x04
struct btp_csis_set_sirk_type_cmd { struct btp_csis_sirk_type_cmd {
uint8_t encrypted; uint8_t encrypted;
} __packed; } __packed;

View file

@ -86,11 +86,11 @@ uint8_t tester_init_cas(void)
#if defined(CONFIG_BT_CAP_ACCEPTOR) && defined(CONFIG_BT_CAP_ACCEPTOR_SET_MEMBER) #if defined(CONFIG_BT_CAP_ACCEPTOR) && defined(CONFIG_BT_CAP_ACCEPTOR_SET_MEMBER)
struct bt_csip_set_member_register_param register_params = { struct bt_csip_set_member_register_param register_params = {
.set_size = 2, .set_size = 2,
.set_sirk = { 0xB8, 0x03, 0xEA, 0xC6, 0xAF, 0xBB, 0x65, 0xA2, .sirk = { 0xB8, 0x03, 0xEA, 0xC6, 0xAF, 0xBB, 0x65, 0xA2,
0x5A, 0x41, 0xF1, 0x53, 0x05, 0x68, 0x8E, 0x83 }, 0x5A, 0x41, 0xF1, 0x53, 0x05, 0x68, 0x8E, 0x83 },
.lockable = true, .lockable = true,
.rank = 1, .rank = 1,
.cb = NULL .cb = NULL,
}; };
int err = bt_cap_acceptor_register(&register_params, &csis_svc_inst); int err = bt_cap_acceptor_register(&register_params, &csis_svc_inst);
#else #else

View file

@ -92,7 +92,7 @@ static void csip_discover_cb(struct bt_conn *conn,
{ {
LOG_DBG(""); LOG_DBG("");
uint8_t sirk[BT_CSIP_SET_SIRK_SIZE]; uint8_t sirk[BT_CSIP_SIRK_SIZE];
size_t sirk_size = ARRAY_SIZE(sirk); size_t sirk_size = ARRAY_SIZE(sirk);
uint8_t conn_index; uint8_t conn_index;
@ -112,7 +112,7 @@ static void csip_discover_cb(struct bt_conn *conn,
cur_csis_inst = &member->insts[0]; cur_csis_inst = &member->insts[0];
memcpy(sirk, cur_csis_inst->info.set_sirk, sizeof(cur_csis_inst->info.set_sirk)); memcpy(sirk, cur_csis_inst->info.sirk, sizeof(cur_csis_inst->info.sirk));
btp_send_csip_sirk_ev(conn, sirk, sirk_size); btp_send_csip_sirk_ev(conn, sirk, sirk_size);
@ -126,7 +126,7 @@ static void csip_discover_cb(struct bt_conn *conn,
btp_csip_set_members[conn_index] = member; btp_csip_set_members[conn_index] = member;
csip_inst = bt_csip_set_coordinator_lookup_instance_by_index(conn, conn_index); csip_inst = bt_csip_set_coordinator_lookup_instance_by_index(conn, conn_index);
btp_send_csip_discovered_ev(conn, csip_inst->set_sirk_handle, csip_inst->set_size_handle, btp_send_csip_discovered_ev(conn, csip_inst->sirk_handle, csip_inst->set_size_handle,
csip_inst->set_lock_handle, csip_inst->rank_handle, err); csip_inst->set_lock_handle, csip_inst->rank_handle, err);
} }

View file

@ -63,14 +63,13 @@ static uint8_t csis_get_member_rsi(const void *cmd, uint16_t cmd_len,
return BTP_STATUS_VAL(err); return BTP_STATUS_VAL(err);
} }
static uint8_t csis_set_sirk_type(const void *cmd, uint16_t cmd_len, void *rsp, static uint8_t csis_sirk_type(const void *cmd, uint16_t cmd_len, void *rsp, uint16_t *rsp_len)
uint16_t *rsp_len)
{ {
const struct btp_csis_set_sirk_type_cmd *cp = cmd; const struct btp_csis_sirk_type_cmd *cp = cmd;
enc_sirk = cp->encrypted != 0U; enc_sirk = cp->encrypted != 0U;
LOG_DBG("Set SIRK type: %s", enc_sirk ? "encrypted" : "plain text"); LOG_DBG("SIRK type: %s", enc_sirk ? "encrypted" : "plain text");
return BTP_STATUS_SUCCESS; return BTP_STATUS_SUCCESS;
} }
@ -80,22 +79,22 @@ static const struct btp_handler csis_handlers[] = {
.opcode = BTP_CSIS_READ_SUPPORTED_COMMANDS, .opcode = BTP_CSIS_READ_SUPPORTED_COMMANDS,
.index = BTP_INDEX_NONE, .index = BTP_INDEX_NONE,
.expect_len = 0, .expect_len = 0,
.func = csis_supported_commands .func = csis_supported_commands,
}, },
{ {
.opcode = BTP_CSIS_SET_MEMBER_LOCK, .opcode = BTP_CSIS_SET_MEMBER_LOCK,
.expect_len = sizeof(struct btp_csis_set_member_lock_cmd), .expect_len = sizeof(struct btp_csis_set_member_lock_cmd),
.func = csis_set_member_lock .func = csis_set_member_lock,
}, },
{ {
.opcode = BTP_CSIS_GET_MEMBER_RSI, .opcode = BTP_CSIS_GET_MEMBER_RSI,
.expect_len = sizeof(struct btp_csis_get_member_rsi_cmd), .expect_len = sizeof(struct btp_csis_get_member_rsi_cmd),
.func = csis_get_member_rsi .func = csis_get_member_rsi,
}, },
{ {
.opcode = BTP_CSIS_ENC_SIRK_TYPE, .opcode = BTP_CSIS_ENC_SIRK_TYPE,
.expect_len = sizeof(struct btp_csis_set_sirk_type_cmd), .expect_len = sizeof(struct btp_csis_sirk_type_cmd),
.func = csis_set_sirk_type, .func = csis_sirk_type,
}, },
}; };
@ -123,8 +122,8 @@ uint8_t tester_init_csis(void)
{ {
const struct bt_csip_set_member_register_param register_params = { const struct bt_csip_set_member_register_param register_params = {
.set_size = 1, .set_size = 1,
.set_sirk = { 0xB8, 0x03, 0xEA, 0xC6, 0xAF, 0xBB, 0x65, 0xA2, .sirk = { 0xB8, 0x03, 0xEA, 0xC6, 0xAF, 0xBB, 0x65, 0xA2,
0x5A, 0x41, 0xF1, 0x53, 0x05, 0x68, 0x8E, 0x83 }, 0x5A, 0x41, 0xF1, 0x53, 0x05, 0x68, 0x8E, 0x83 },
.lockable = true, .lockable = true,
.rank = 1, .rank = 1,
.cb = &csis_cb, .cb = &csis_cb,

View file

@ -562,8 +562,8 @@ static void init(void)
.rank = 1, .rank = 1,
.lockable = true, .lockable = true,
/* Using the CSIP_SET_MEMBER test sample SIRK */ /* Using the CSIP_SET_MEMBER test sample SIRK */
.set_sirk = { 0xcd, 0xcc, 0x72, 0xdd, 0x86, 0x8c, 0xcd, 0xce, .sirk = { 0xcd, 0xcc, 0x72, 0xdd, 0x86, 0x8c, 0xcd, 0xce,
0x22, 0xfd, 0xa1, 0x21, 0x09, 0x7d, 0x7d, 0x45 }, 0x22, 0xfd, 0xa1, 0x21, 0x09, 0x7d, 0x7d, 0x45 },
}; };
int err; int err;

View file

@ -169,7 +169,7 @@ static bool is_discovered(const bt_addr_le_t *addr)
static bool csip_found(struct bt_data *data, void *user_data) static bool csip_found(struct bt_data *data, void *user_data)
{ {
if (bt_csip_set_coordinator_is_set_member(primary_inst->info.set_sirk, data)) { if (bt_csip_set_coordinator_is_set_member(primary_inst->info.sirk, data)) {
const bt_addr_le_t *addr = user_data; const bt_addr_le_t *addr = user_data;
char addr_str[BT_ADDR_LE_STR_LEN]; char addr_str[BT_ADDR_LE_STR_LEN];

View file

@ -18,8 +18,8 @@ struct bt_csip_set_member_register_param param = {
.rank = 1, .rank = 1,
.lockable = true, .lockable = true,
/* Using the CSIS test sample SIRK */ /* Using the CSIS test sample SIRK */
.set_sirk = { 0xcd, 0xcc, 0x72, 0xdd, 0x86, 0x8c, 0xcd, 0xce, .sirk = { 0xcd, 0xcc, 0x72, 0xdd, 0x86, 0x8c, 0xcd, 0xce,
0x22, 0xfd, 0xa1, 0x21, 0x09, 0x7d, 0x7d, 0x45 }, 0x22, 0xfd, 0xa1, 0x21, 0x09, 0x7d, 0x7d, 0x45 },
}; };
static void csip_lock_changed_cb(struct bt_conn *conn, static void csip_lock_changed_cb(struct bt_conn *conn,
@ -76,15 +76,15 @@ static void bt_ready(int err)
} }
} }
static void test_set_sirk(void) static void test_sirk(void)
{ {
const uint8_t new_set_sirk[] = {0xff, 0xcc, 0x72, 0xdd, 0x86, 0x8c, 0xcd, 0xce, const uint8_t new_sirk[] = {0xff, 0xcc, 0x72, 0xdd, 0x86, 0x8c, 0xcd, 0xce,
0x22, 0xfd, 0xa1, 0x21, 0x09, 0x7d, 0x7d, 0x45}; 0x22, 0xfd, 0xa1, 0x21, 0x09, 0x7d, 0x7d, 0x45};
uint8_t tmp_sirk[BT_CSIP_SET_SIRK_SIZE]; uint8_t tmp_sirk[BT_CSIP_SIRK_SIZE];
int err; int err;
printk("Setting new SIRK\n"); printk("Setting new SIRK\n");
err = bt_csip_set_member_set_sirk(svc_inst, new_set_sirk); err = bt_csip_set_member_sirk(svc_inst, new_sirk);
if (err != 0) { if (err != 0) {
FAIL("Failed to set SIRK: %d\n", err); FAIL("Failed to set SIRK: %d\n", err);
return; return;
@ -97,7 +97,7 @@ static void test_set_sirk(void)
return; return;
} }
if (memcmp(new_set_sirk, tmp_sirk, BT_CSIP_SET_SIRK_SIZE) != 0) { if (memcmp(new_sirk, tmp_sirk, BT_CSIP_SIRK_SIZE) != 0) {
FAIL("The SIRK set and the SIRK set were different\n"); FAIL("The SIRK set and the SIRK set were different\n");
return; return;
} }
@ -193,7 +193,7 @@ static void test_new_sirk(void)
backchannel_sync_send_all(); backchannel_sync_send_all();
backchannel_sync_wait_all(); backchannel_sync_wait_all();
test_set_sirk(); test_sirk();
WAIT_FOR_UNSET_FLAG(flag_connected); WAIT_FOR_UNSET_FLAG(flag_connected);
@ -223,8 +223,8 @@ static void test_args(int argc, char *argv[])
argn++; argn++;
len = hex2bin(argv[argn], strlen(argv[argn]), len = hex2bin(argv[argn], strlen(argv[argn]), param.sirk,
param.set_sirk, sizeof(param.set_sirk)); sizeof(param.sirk));
if (len == 0) { if (len == 0) {
FAIL("Could not parse SIRK"); FAIL("Could not parse SIRK");
return; return;

View file

@ -362,8 +362,8 @@ static void test_main(void)
.rank = csis_rank, .rank = csis_rank,
.lockable = true, .lockable = true,
/* Using the CSIP_SET_MEMBER test sample SIRK */ /* Using the CSIP_SET_MEMBER test sample SIRK */
.set_sirk = {0xcd, 0xcc, 0x72, 0xdd, 0x86, 0x8c, 0xcd, 0xce, 0x22, 0xfd, .sirk = { 0xcd, 0xcc, 0x72, 0xdd, 0x86, 0x8c, 0xcd, 0xce,
0xa1, 0x21, 0x09, 0x7d, 0x7d, 0x45}, 0x22, 0xfd, 0xa1, 0x21, 0x09, 0x7d, 0x7d, 0x45 },
}; };
err = bt_cap_acceptor_register(&csip_set_member_param, &csip_set_member); err = bt_cap_acceptor_register(&csip_set_member_param, &csip_set_member);