From d9413d20fb9ce4a1ab76cd9ad1261ce01660c864 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Kopy=C5=9Bci=C5=84ski?= Date: Fri, 8 Oct 2021 12:38:07 +0200 Subject: [PATCH] host/mesh: Fix setting remote public key in provisioner This aligns provisioner and provisionee APIs in terms of endianess of public key provided by an application. This is port of f5ba999257e977688e7eae6a36a554ceed51d95f --- nimble/host/mesh/include/mesh/main.h | 2 +- nimble/host/mesh/src/provisioner.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/nimble/host/mesh/include/mesh/main.h b/nimble/host/mesh/include/mesh/main.h index 213950b17..dff5eb1db 100644 --- a/nimble/host/mesh/include/mesh/main.h +++ b/nimble/host/mesh/include/mesh/main.h @@ -287,7 +287,7 @@ int bt_mesh_input_number(uint32_t num); /** @brief Provide Device public key. * - * @param public_key Device public key. + * @param public_key Device public key in big-endian. * * @return Zero on success or (negative) error code otherwise. */ diff --git a/nimble/host/mesh/src/provisioner.c b/nimble/host/mesh/src/provisioner.c index 9e8df8937..7a8c40d8f 100644 --- a/nimble/host/mesh/src/provisioner.c +++ b/nimble/host/mesh/src/provisioner.c @@ -724,8 +724,7 @@ int bt_mesh_prov_remote_pub_key_set(const uint8_t public_key[64]) } /* Swap X and Y halves independently to big-endian */ - memcpy(&bt_mesh_prov_link.conf_inputs[81], public_key, 32); - memcpy(&bt_mesh_prov_link.conf_inputs[81 + 32], &public_key[32], 32); + memcpy(&bt_mesh_prov_link.conf_inputs[81], public_key, 64); return 0; }