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:
Andrei Emeltchenko 2015-08-13 11:49:38 +03:00 committed by Anas Nashif
commit 0c6b6902fe

View file

@ -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));
}