[PATCH v2] shared/att: Fix signed write without transparent signing

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

 



If local key wasn't set by bt_att_set_local_key() assume that signing
is done by bt_att_send() caller ie. gattrib code.
---
 src/shared/att.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/shared/att.c b/src/shared/att.c
index 9787377..90701b0 100644
--- a/src/shared/att.c
+++ b/src/shared/att.c
@@ -282,10 +282,10 @@ static bool encode_pdu(struct bt_att *att, struct att_send_op *op,
 					const void *pdu, uint16_t length)
 {
 	uint16_t pdu_len = 1;
-	struct sign_info *sign;
+	struct sign_info *sign = att->local_sign;
 	uint32_t sign_cnt;
 
-	if (op->opcode & ATT_OP_SIGNED_MASK)
+	if (sign && (op->opcode & ATT_OP_SIGNED_MASK))
 		pdu_len += BT_ATT_SIGNATURE_LEN;
 
 	if (length && pdu)
@@ -303,13 +303,9 @@ static bool encode_pdu(struct bt_att *att, struct att_send_op *op,
 	if (pdu_len > 1)
 		memcpy(op->pdu + 1, pdu, length);
 
-	if (!(op->opcode & ATT_OP_SIGNED_MASK))
+	if (!sign || !(op->opcode & ATT_OP_SIGNED_MASK))
 		return true;
 
-	sign = att->local_sign;
-	if (!sign)
-		goto fail;
-
 	if (!sign->counter(&sign_cnt, sign->user_data))
 		goto fail;
 
-- 
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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