Bluetooth: Refactor signed write command
Include all headers to signature verification process. Change-Id: I14e152e8529bca380faeb8e9a1be00e4e8d84f9a Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
This commit is contained in:
parent
355ff64175
commit
0c6b6902fe
1 changed files with 5 additions and 1 deletions
|
@ -1169,10 +1169,11 @@ static uint8_t att_signed_write_cmd(struct bt_conn *conn, struct bt_buf *data)
|
|||
req = (void *)data->data;
|
||||
|
||||
handle = sys_le16_to_cpu(req->handle);
|
||||
bt_buf_pull(data, sizeof(*req));
|
||||
|
||||
BT_DBG("handle 0x%04x\n", handle);
|
||||
|
||||
/* Verifying data requires full buffer including attribute header */
|
||||
bt_buf_push(data, sizeof(struct bt_att_hdr));
|
||||
err = bt_smp_sign_verify(conn, data);
|
||||
if (err) {
|
||||
BT_ERR("Error verifying data\n");
|
||||
|
@ -1180,6 +1181,9 @@ static uint8_t att_signed_write_cmd(struct bt_conn *conn, struct bt_buf *data)
|
|||
return 0;
|
||||
}
|
||||
|
||||
bt_buf_pull(data, sizeof(struct bt_att_hdr));
|
||||
bt_buf_pull(data, sizeof(*req));
|
||||
|
||||
return att_write_rsp(conn, 0, 0, handle, 0, data->data,
|
||||
data->len - sizeof(struct bt_att_signature));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue