Skip to contentSkip to conversation

bluetooth: fix set_ecdh_privkey() prototype

PATCH In review Arnd Bergmann 2 participants 2 messages Mar 22, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bluetooth: fix set_ecdh_privkey() prototype

From: Arnd Bergmann <[email protected]>

gcc-11 points out that the declaration does not match the definition:

net/bluetooth/ecdh_helper.c:122:55: error: argument 2 of type ‘const u8[32]’ {aka ‘const unsigned char[32]’} with mismatched bound [-Werror=array-parameter=]
122 | int set_ecdh_privkey(struct crypto_kpp *tfm, const u8 private_key[32])

      |                                              ~~~~~~~~~^~~~~~~~~~~~~~~
In file included from net/bluetooth/ecdh_helper.c:23:
net/bluetooth/ecdh_helper.h:28:56: note: previously declared as ‘const u8 *’ {aka ‘const unsigned char *’}
   28 | int set_ecdh_privkey(struct crypto_kpp *tfm, const u8 *private_key);
      |                                              ~~~~~~~~~~^~~~~~~~~~~

Change the declaration to contain the size of the array, rather than just a pointer.

---
 net/bluetooth/ecdh_helper.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/ecdh_helper.h +1 -1
index a6f8d03d4aaf..830723971cf8 100644
@@ -25,6 +25,6 @@
 
 int compute_ecdh_secret(struct crypto_kpp *tfm, const u8 pair_public_key[64],
 			u8 secret[32]);
-int set_ecdh_privkey(struct crypto_kpp *tfm, const u8 *private_key);
+int set_ecdh_privkey(struct crypto_kpp *tfm, const u8 private_key[32]);
 int generate_ecdh_public_key(struct crypto_kpp *tfm, u8 public_key[64]);
 int generate_ecdh_keys(struct crypto_kpp *tfm, u8 public_key[64]);
Signature · 1 line
2.29.2
maintainer
#1 lore raw

Hi Arnd,

Quoted 10 lines

gcc-11 points out that the declaration does not match the definition:

net/bluetooth/ecdh_helper.c:122:55: error: argument 2 of type ‘const u8[32]’ {aka ‘const unsigned char[32]’} with mismatched bound [-Werror=array-parameter=]
122 | int set_ecdh_privkey(struct crypto_kpp *tfm, const u8 private_key[32])

     |                                              ~~~~~~~~~^~~~~~~~~~~~~~~
In file included from net/bluetooth/ecdh_helper.c:23:
net/bluetooth/ecdh_helper.h:28:56: note: previously declared as ‘const u8 *’ {aka ‘const unsigned char *’}
  28 | int set_ecdh_privkey(struct crypto_kpp *tfm, const u8 *private_key);
     |                                              ~~~~~~~~~~^~~~~~~~~~~
Quoted 7 lines

Change the declaration to contain the size of the array, rather than just a pointer.

---
net/bluetooth/ecdh_helper.h | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel