@@ -106,6 +106,7 @@ nRF5xSecurityManager::~nRF5xSecurityManager()
106
106
107
107
ble_error_t nRF5xSecurityManager::initialize ()
108
108
{
109
+ #if defined(MBEDTLS_ECDH_C)
109
110
if (_crypto.generate_keys (
110
111
make_ArrayView (X),
111
112
make_ArrayView (Y),
@@ -115,6 +116,8 @@ ble_error_t nRF5xSecurityManager::initialize()
115
116
}
116
117
117
118
return BLE_ERROR_INTERNAL_STACK_FAILURE;
119
+ #endif
120
+ return BLE_ERROR_NONE;
118
121
}
119
122
120
123
ble_error_t nRF5xSecurityManager::terminate ()
@@ -210,6 +213,7 @@ nRF5xSecurityManager::get_resolving_list() {
210
213
211
214
const nRF5xSecurityManager::resolving_list_entry_t *
212
215
nRF5xSecurityManager::resolve_address (const address_t & resolvable_address) {
216
+ #if defined(MBEDTLS_ECDH_C)
213
217
typedef byte_array_t <CryptoToolbox::hash_size_> hash_t ;
214
218
215
219
for (size_t i = 0 ; i < resolving_list_entry_count; ++i) {
@@ -233,6 +237,7 @@ nRF5xSecurityManager::resolve_address(const address_t& resolvable_address) {
233
237
return &entry;
234
238
}
235
239
}
240
+ #endif
236
241
return NULL ;
237
242
}
238
243
@@ -715,6 +720,7 @@ ble_error_t nRF5xSecurityManager::send_keypress_notification(
715
720
716
721
ble_error_t nRF5xSecurityManager::generate_secure_connections_oob ()
717
722
{
723
+ #if defined(MBEDTLS_ECDH_C)
718
724
ble_gap_lesc_p256_pk_t own_secret;
719
725
ble_gap_lesc_oob_data_t oob_data;
720
726
@@ -734,6 +740,8 @@ ble_error_t nRF5xSecurityManager::generate_secure_connections_oob()
734
740
}
735
741
736
742
return convert_sd_error (err);
743
+ #endif
744
+ return BLE_ERROR_NOT_IMPLEMENTED;
737
745
}
738
746
739
747
nRF5xSecurityManager& nRF5xSecurityManager::get_security_manager ()
@@ -877,6 +885,7 @@ bool nRF5xSecurityManager::sm_handler(const ble_evt_t *evt)
877
885
}
878
886
879
887
case BLE_GAP_EVT_LESC_DHKEY_REQUEST: {
888
+ #if defined(MBEDTLS_ECDH_C)
880
889
const ble_gap_evt_lesc_dhkey_request_t & dhkey_request =
881
890
gap_evt.params .lesc_dhkey_request ;
882
891
@@ -895,7 +904,7 @@ bool nRF5xSecurityManager::sm_handler(const ble_evt_t *evt)
895
904
if (dhkey_request.oobd_req ) {
896
905
handler->on_secure_connections_oob_request (connection);
897
906
}
898
-
907
+ # endif
899
908
return true ;
900
909
}
901
910
@@ -1138,9 +1147,10 @@ ble_gap_sec_keyset_t nRF5xSecurityManager::make_keyset(
1138
1147
}
1139
1148
1140
1149
// copy public keys used
1150
+ #if defined(MBEDTLS_ECDH_C)
1141
1151
memcpy (pairing_cb.own_pk .pk , X.data (), X.size ());
1142
1152
memcpy (pairing_cb.own_pk .pk + X.size (), Y.data (), Y.size ());
1143
-
1153
+ # endif
1144
1154
return keyset;
1145
1155
}
1146
1156
0 commit comments