ATT_Signed_Write_Command is not implemented in BlueZ 5.50

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

During Bluetooth Qualification tests with PTS I found out
that Attribute Signed Write Command is not implemented in 'bluetoothd'.
Hence the related tests like GATT/SR/GAW/BV-02-C would always fail. The
following patch included implementation of ATT_Signed_Write_Command and
a bug fix in 'att.c', where reversed logic in 'if' statement prevented
signature verification when cryptographic function exists.


--- a/src/shared/att.c	2018-06-01 10:37:36.000000000 +0200
+++ b/src/shared/att.c	2020-01-23 11:07:03.000000000 +0100
@@ -816,7 +816,7 @@
 	const struct queue_entry *entry;
 	bool found;
 
-	if ((opcode & ATT_OP_SIGNED_MASK) && !att->crypto) {
+	if ((opcode & ATT_OP_SIGNED_MASK) && att->crypto) {
 		if (!handle_signed(att, opcode, pdu, pdu_len))
 			return;
 		pdu_len -= BT_ATT_SIGNATURE_LEN;
--- a/src/shared/gatt-server.c	2018-06-01 10:37:36.000000000 +0200
+++ b/src/shared/gatt-server.c	2020-01-24 11:30:51.000000000 +0100
@@ -97,6 +97,7 @@
 	unsigned int find_by_type_value_id;
 	unsigned int write_id;
 	unsigned int write_cmd_id;
+	unsigned int signed_write_cmd_id;
 	unsigned int read_id;
 	unsigned int read_blob_id;
 	unsigned int read_multiple_id;
@@ -128,6 +129,7 @@
 	bt_att_unregister(server->att, server->find_by_type_value_id);
 	bt_att_unregister(server->att, server->write_id);
 	bt_att_unregister(server->att, server->write_cmd_id);
+	bt_att_unregister(server->att, server->signed_write_cmd_id);
 	bt_att_unregister(server->att, server->read_id);
 	bt_att_unregister(server->att, server->read_blob_id);
 	bt_att_unregister(server->att, server->read_multiple_id);
@@ -769,7 +771,7 @@
 	struct bt_gatt_server *server = op->server;
 	uint16_t handle;
 
-	if (!server || op->opcode == BT_ATT_OP_WRITE_CMD) {
+	if (!server || op->opcode == BT_ATT_OP_WRITE_CMD || op->opcode
== BT_ATT_OP_SIGNED_WRITE_CMD) {
 		async_write_op_destroy(op);
 		return;
 	}
@@ -837,7 +839,7 @@
 	ecode = BT_ATT_ERROR_UNLIKELY;
 
 error:
-	if (opcode == BT_ATT_OP_WRITE_CMD)
+	if (opcode == BT_ATT_OP_WRITE_CMD || opcode ==
BT_ATT_OP_SIGNED_WRITE_CMD)
 		return;
 
 	bt_att_send_error_rsp(server->att, opcode, handle, ecode);
@@ -1514,6 +1516,13 @@
 	if (!server->write_cmd_id)
 		return false;
 
+	/* Signed Write Command */
+	server->signed_write_cmd_id = bt_att_register(server->att,
BT_ATT_OP_SIGNED_WRITE_CMD,
+								write_c
b,
+								server,
NULL);
+	if (!server->signed_write_cmd_id)
+		return false;
+
 	/* Read Request */
 	server->read_id = bt_att_register(server->att,
BT_ATT_OP_READ_REQ,
 								read_cb
,


Best regards
Konstantin





[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux