mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #7089 from paul-szczepanek-arm/fix-master
BLE fixes (SM whitelist creation, Nordic scatter file fix, missing TLS initialisation)pull/6969/merge
commit
20a4412082
|
@ -584,7 +584,7 @@ public:
|
|||
WhitelistDbCb_t cb,
|
||||
::Gap::Whitelist_t *whitelist
|
||||
) {
|
||||
for (size_t i = 0; i < get_entry_count() && i < whitelist->capacity; i++) {
|
||||
for (size_t i = 0; i < get_entry_count() && whitelist->size < whitelist->capacity; i++) {
|
||||
entry_handle_t db_handle = get_entry_handle_by_index(i);
|
||||
SecurityDistributionFlags_t* flags = get_distribution_flags(db_handle);
|
||||
|
||||
|
@ -592,20 +592,24 @@ public:
|
|||
continue;
|
||||
}
|
||||
|
||||
if (flags->peer_address_is_public) {
|
||||
whitelist->addresses[i].type = BLEProtocol::AddressType::PUBLIC;
|
||||
} else {
|
||||
whitelist->addresses[i].type = BLEProtocol::AddressType::RANDOM_STATIC;
|
||||
SecurityEntryIdentity_t* identity = read_in_entry_peer_identity(db_handle);
|
||||
if (!identity) {
|
||||
continue;
|
||||
}
|
||||
|
||||
SecurityEntryIdentity_t* identity = read_in_entry_peer_identity(db_handle);
|
||||
if (identity) {
|
||||
memcpy(
|
||||
whitelist->addresses[i].address,
|
||||
identity->identity_address.data(),
|
||||
sizeof(BLEProtocol::AddressBytes_t)
|
||||
);
|
||||
memcpy(
|
||||
whitelist->addresses[whitelist->size].address,
|
||||
identity->identity_address.data(),
|
||||
sizeof(BLEProtocol::AddressBytes_t)
|
||||
);
|
||||
|
||||
if (flags->peer_address_is_public) {
|
||||
whitelist->addresses[whitelist->size].type = BLEProtocol::AddressType::PUBLIC;
|
||||
} else {
|
||||
whitelist->addresses[whitelist->size].type = BLEProtocol::AddressType::RANDOM_STATIC;
|
||||
}
|
||||
|
||||
whitelist->size++;
|
||||
}
|
||||
|
||||
cb(whitelist);
|
||||
|
|
|
@ -142,6 +142,9 @@ ble_error_t GenericSecurityManager::purgeAllBondingState(void) {
|
|||
ble_error_t GenericSecurityManager::generateWhitelistFromBondTable(Gap::Whitelist_t *whitelist) const {
|
||||
if (!_db) return BLE_ERROR_INITIALIZATION_INCOMPLETE;
|
||||
if (eventHandler) {
|
||||
if (!whitelist) {
|
||||
return BLE_ERROR_INVALID_PARAM;
|
||||
}
|
||||
_db->generate_whitelist_from_bond_table(
|
||||
mbed::callback(eventHandler, &::SecurityManager::EventHandler::whitelistFromBondTable),
|
||||
whitelist
|
||||
|
|
|
@ -1266,7 +1266,7 @@ void nRF5xGap::on_connection(Gap::Handle_t handle, const ble_gap_evt_connected_t
|
|||
const resolving_list_entry_t* entry = get_sm().resolve_address(
|
||||
evt.peer_addr.addr
|
||||
);
|
||||
MBED_ASSERT(entry == NULL);
|
||||
MBED_ASSERT(entry != NULL);
|
||||
|
||||
peer_addr_type = convert_identity_address(entry->peer_identity_address_type);
|
||||
peer_address = entry->peer_identity_address.data();
|
||||
|
|
|
@ -47,6 +47,7 @@ namespace vendor {
|
|||
namespace nordic {
|
||||
|
||||
CryptoToolbox::CryptoToolbox() : _initialized(false) {
|
||||
mbedtls_platform_setup(&_platform_context);
|
||||
mbedtls_entropy_init(&_entropy_context);
|
||||
mbedtls_ecp_group_init(&_group);
|
||||
int err = mbedtls_ecp_group_load(
|
||||
|
@ -59,6 +60,7 @@ CryptoToolbox::CryptoToolbox() : _initialized(false) {
|
|||
CryptoToolbox::~CryptoToolbox() {
|
||||
mbedtls_ecp_group_free(&_group);
|
||||
mbedtls_entropy_free(&_entropy_context);
|
||||
mbedtls_platform_teardown(&_platform_context);
|
||||
}
|
||||
|
||||
bool CryptoToolbox::generate_keys(
|
||||
|
|
|
@ -132,6 +132,7 @@ private:
|
|||
void swap_endian(uint8_t* buf, size_t len);
|
||||
|
||||
bool _initialized;
|
||||
mbedtls_platform_context _platform_context;
|
||||
mbedtls_entropy_context _entropy_context;
|
||||
mbedtls_ecp_group _group;
|
||||
};
|
||||
|
|
|
@ -27,6 +27,11 @@ LR_IROM1 MBED_APP_START MBED_APP_SIZE {
|
|||
ER_IROM1 MBED_APP_START MBED_APP_SIZE {
|
||||
*.o (RESET, +First)
|
||||
*(InRoot$$Sections)
|
||||
__start_sdh_soc_observers *(sdh_soc_observers) __stop_sdh_soc_observers
|
||||
__start_sdh_stack_observers *(sdh_stack_observers) __stop_sdh_stack_observers
|
||||
__start_sdh_req_observers *(sdh_req_observers) __stop_sdh_req_observers
|
||||
__start_sdh_state_observers *(sdh_state_observers) __stop_sdh_state_observers
|
||||
__start_sdh_ble_observers *(sdh_ble_observers) __stop_sdh_ble_observers
|
||||
.ANY (+RO)
|
||||
}
|
||||
RW_IRAM0 MBED_RAM0_START UNINIT MBED_RAM0_SIZE { ;no init section
|
||||
|
|
|
@ -27,6 +27,11 @@ LR_IROM1 MBED_APP_START MBED_APP_SIZE {
|
|||
ER_IROM1 MBED_APP_START MBED_APP_SIZE {
|
||||
*.o (RESET, +First)
|
||||
*(InRoot$$Sections)
|
||||
__start_sdh_soc_observers *(sdh_soc_observers) __stop_sdh_soc_observers
|
||||
__start_sdh_stack_observers *(sdh_stack_observers) __stop_sdh_stack_observers
|
||||
__start_sdh_req_observers *(sdh_req_observers) __stop_sdh_req_observers
|
||||
__start_sdh_state_observers *(sdh_state_observers) __stop_sdh_state_observers
|
||||
__start_sdh_ble_observers *(sdh_ble_observers) __stop_sdh_ble_observers
|
||||
.ANY (+RO)
|
||||
}
|
||||
RW_IRAM0 MBED_RAM0_START UNINIT MBED_RAM0_SIZE { ;no init section
|
||||
|
|
Loading…
Reference in New Issue