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.
pull/9507/head
Nic Costa 2019-01-08 12:26:30 -06:00 committed by adbridge
parent c5edbe05b0
commit 09bd512da8
1 changed files with 4 additions and 1 deletions

View File

@ -15,6 +15,7 @@
*/ */
#include <stdint.h> #include <stdint.h>
#include "platform/mbed_assert.h"
#include "nRF5xPalSecurityManager.h" #include "nRF5xPalSecurityManager.h"
#include "nRF5xn.h" #include "nRF5xn.h"
#include "ble/Gap.h" #include "ble/Gap.h"
@ -734,7 +735,9 @@ ble_error_t nRF5xSecurityManager::generate_secure_connections_oob()
ble_gap_lesc_p256_pk_t own_secret; ble_gap_lesc_p256_pk_t own_secret;
ble_gap_lesc_oob_data_t oob_data; ble_gap_lesc_oob_data_t oob_data;
memcpy(own_secret.pk, secret.data(), secret.size()); MBED_ASSERT(sizeof(own_secret.pk) >= X.size() + Y.size());
memcpy(own_secret.pk, X.data(), X.size());
memcpy(own_secret.pk + X.size(), Y.data(), Y.size());
uint32_t err = sd_ble_gap_lesc_oob_data_get( uint32_t err = sd_ble_gap_lesc_oob_data_get(
BLE_CONN_HANDLE_INVALID, BLE_CONN_HANDLE_INVALID,