public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ v1 2/2] mesh: Fix build errors when compiling on fc42
Date: Thu, 17 Apr 2025 16:21:13 -0400	[thread overview]
Message-ID: <20250417202113.80496-2-luiz.dentz@gmail.com> (raw)
In-Reply-To: <20250417202113.80496-1-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

./mesh/crypto.c: In function ‘mesh_crypto_device_key’:
./mesh/crypto.c:436:33: error: initializer-string for array of ‘unsigned char’ truncates NUL terminator but destination lacks ‘nonstring’ attribute (5 chars into 4 available) [-Werror=unterminated-string-initialization]
  436 |         const uint8_t prdk[4] = "prdk";
      |                                 ^~~~~~
---
 mesh/crypto.c            | 8 ++++----
 tools/mesh-gatt/crypto.c | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/mesh/crypto.c b/mesh/crypto.c
index b7607bb83794..ab44baee3427 100644
--- a/mesh/crypto.c
+++ b/mesh/crypto.c
@@ -371,7 +371,7 @@ bool mesh_crypto_session_key(const uint8_t secret[32],
 					const uint8_t salt[16],
 					uint8_t session_key[16])
 {
-	const uint8_t prsk[4] = "prsk";
+	const uint8_t prsk[4] = { 'p', 'r', 's', 'k' };
 
 	if (!aes_cmac_one(salt, secret, 32, session_key))
 		return false;
@@ -383,7 +383,7 @@ bool mesh_crypto_nonce(const uint8_t secret[32],
 					const uint8_t salt[16],
 					uint8_t nonce[13])
 {
-	const uint8_t prsn[4] = "prsn";
+	const uint8_t prsn[4] = { 'p', 'r', 's', 'n' };
 	uint8_t tmp[16];
 	bool result;
 
@@ -421,7 +421,7 @@ bool mesh_crypto_prov_conf_key(const uint8_t secret[32],
 					const uint8_t salt[16],
 					uint8_t conf_key[16])
 {
-	const uint8_t prck[4] = "prck";
+	const uint8_t prck[4] = { 'p', 'r', 'c', 'k' };
 
 	if (!aes_cmac_one(salt, secret, 32, conf_key))
 		return false;
@@ -433,7 +433,7 @@ bool mesh_crypto_device_key(const uint8_t secret[32],
 						const uint8_t salt[16],
 						uint8_t device_key[16])
 {
-	const uint8_t prdk[4] = "prdk";
+	const uint8_t prdk[4] = { 'p', 'r', 'd', 'k' };
 
 	if (!aes_cmac_one(salt, secret, 32, device_key))
 		return false;
diff --git a/tools/mesh-gatt/crypto.c b/tools/mesh-gatt/crypto.c
index c65974bb02d0..0dc796f004df 100644
--- a/tools/mesh-gatt/crypto.c
+++ b/tools/mesh-gatt/crypto.c
@@ -902,7 +902,7 @@ bool mesh_crypto_session_key(const uint8_t secret[32],
 					const uint8_t salt[16],
 					uint8_t session_key[16])
 {
-	const uint8_t prsk[4] = "prsk";
+	const uint8_t prsk[4] = { 'p', 'r', 's', 'k' };
 
 	if (!aes_cmac_one(salt, secret, 32, session_key))
 		return false;
@@ -914,7 +914,7 @@ bool mesh_crypto_nonce(const uint8_t secret[32],
 					const uint8_t salt[16],
 					uint8_t nonce[13])
 {
-	const uint8_t prsn[4] = "prsn";
+	const uint8_t prsn[4] = { 'p', 'r', 's', 'n' };
 	uint8_t tmp[16];
 	bool result;
 
@@ -955,7 +955,7 @@ bool mesh_crypto_prov_conf_key(const uint8_t secret[32],
 					const uint8_t salt[16],
 					uint8_t conf_key[16])
 {
-	const uint8_t prck[4] = "prck";
+	const uint8_t prck[4] = { 'p', 'r', 'c', 'k' };
 
 	if (!aes_cmac_one(salt, secret, 32, conf_key))
 		return false;
@@ -967,7 +967,7 @@ bool mesh_crypto_device_key(const uint8_t secret[32],
 						const uint8_t salt[16],
 						uint8_t device_key[16])
 {
-	const uint8_t prdk[4] = "prdk";
+	const uint8_t prdk[4] = { 'p', 'r', 'd', 'k' };
 
 	if (!aes_cmac_one(salt, secret, 32, device_key))
 		return false;
-- 
2.49.0


  reply	other threads:[~2025-04-17 20:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-17 20:21 [PATCH BlueZ v1 1/2] shared/shell: Fix build errors in fc42 Luiz Augusto von Dentz
2025-04-17 20:21 ` Luiz Augusto von Dentz [this message]
2025-04-17 21:58 ` [BlueZ,v1,1/2] " bluez.test.bot
2025-04-18 14:10 ` [PATCH BlueZ v1 1/2] " patchwork-bot+bluetooth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250417202113.80496-2-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox