Skip to content

Commit 24d793c

Browse files
committed
Fix parameters provided to oob generator function
The function in the Nordic SDK for generating OOB data, sd_ble_gap_lesc_oob_data_get, requires local LE Secure Connection P256 Public Keys in {X,Y} format, but was being supplied with the local secret key. This caused the generated OOB data to fail to correspond to the Public Keys, which caused a mismatch during the OOB pairing phase of the OOB confirmation value by a remote peer when attempting to verify the OOB data against the Public Keys, ultimately causing the OOB pairing request to fail with a Confirm Value Failed (0x04) error.
1 parent 55507ea commit 24d793c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NORDIC_SOFTDEVICE/TARGET_NRF52/source/nRF5xPalSecurityManager.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
#include <stdint.h>
18+
#include "platform/mbed_assert.h"
1819
#include "nRF5xPalSecurityManager.h"
1920
#include "nRF5xn.h"
2021
#include "ble/Gap.h"
@@ -734,7 +735,9 @@ ble_error_t nRF5xSecurityManager::generate_secure_connections_oob()
734735
ble_gap_lesc_p256_pk_t own_secret;
735736
ble_gap_lesc_oob_data_t oob_data;
736737

737-
memcpy(own_secret.pk, secret.data(), secret.size());
738+
MBED_ASSERT(sizeof(own_secret.pk) >= X.size() + Y.size());
739+
memcpy(own_secret.pk, X.data(), X.size());
740+
memcpy(own_secret.pk + X.size(), Y.data(), Y.size());
738741

739742
uint32_t err = sd_ble_gap_lesc_oob_data_get(
740743
BLE_CONN_HANDLE_INVALID,

0 commit comments

Comments
 (0)