[PATCH 7/9] shared/crypto: Fix byte order of message

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

 



Message should be swapped before we send it to the kernel for signing
---
 src/shared/crypto.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/shared/crypto.c b/src/shared/crypto.c
index ad89174..c400081 100644
--- a/src/shared/crypto.c
+++ b/src/shared/crypto.c
@@ -265,6 +265,7 @@ bool bt_crypto_sign_att(struct bt_crypto *crypto, const uint8_t key[16],
 	uint8_t tmp[16], out[16];
 	uint16_t msg_len = m_len + sizeof(uint32_t);
 	uint8_t msg[msg_len];
+	uint8_t msg_s[msg_len];
 
 	if (!crypto)
 		return false;
@@ -283,7 +284,10 @@ bool bt_crypto_sign_att(struct bt_crypto *crypto, const uint8_t key[16],
 	if (fd < 0)
 		return false;
 
-	len = send(fd, msg, msg_len, 0);
+	/* Swap msg before signing */
+	swap_buf(msg, msg_s, msg_len);
+
+	len = send(fd, msg_s, msg_len, 0);
 	if (len < 0) {
 		close(fd);
 		return false;
-- 
1.8.4

--
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