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
Cruz Monrreal 2018-06-04 10:44:54 -05:00 committed by GitHub
commit 20a4412082
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 33 additions and 13 deletions

View File

@ -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);

View File

@ -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

View File

@ -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();

View File

@ -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(

View File

@ -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;
};

View File

@ -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

View File

@ -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