mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-28 19:20:54 +00:00
mesh: dump network config only in main app
This commit is contained in:
parent
9f877d16e1
commit
2a825dbaba
@ -232,12 +232,6 @@ static void mesh_network_key_derive_network_id_calculated(void * arg) {
|
||||
}
|
||||
|
||||
static void mesh_network_key_derive_k2_calculated(void * arg){
|
||||
printf("NID: %02x\n", k2_result[0]);
|
||||
printf("EncryptionKey: ");
|
||||
printf_hexdump(&k2_result[1], 16);
|
||||
printf("PrivacyKey: ");
|
||||
printf_hexdump(&k2_result[17], 16);
|
||||
|
||||
// store
|
||||
mesh_network_key_derive_key->nid = k2_result[0];
|
||||
memcpy(mesh_network_key_derive_key->encryption_key, &k2_result[1], 16);
|
||||
@ -249,18 +243,12 @@ static void mesh_network_key_derive_k2_calculated(void * arg){
|
||||
}
|
||||
|
||||
static void mesh_network_key_derive_identity_key_calculated(void *arg) {
|
||||
printf("IdentityKey: ");
|
||||
printf_hexdump(mesh_network_key_derive_key->identity_key, 16);
|
||||
|
||||
// calc k2
|
||||
btstack_crypto_aes128_cmac_t * request = (btstack_crypto_aes128_cmac_t*) arg;
|
||||
mesh_k2(request, mesh_network_key_derive_key->net_key, k2_result, &mesh_network_key_derive_k2_calculated, request);
|
||||
}
|
||||
|
||||
static void mesh_network_key_derive_beacon_key_calculated(void *arg){
|
||||
printf("BeaconKey: ");
|
||||
printf_hexdump(mesh_network_key_derive_key->beacon_key, 16);
|
||||
|
||||
// calc identity key
|
||||
btstack_crypto_aes128_cmac_t * request = (btstack_crypto_aes128_cmac_t*) arg;
|
||||
mesh_k1(request, mesh_network_key_derive_key->net_key, 16, mesh_salt_nkik, id128_tag, sizeof(id128_tag),
|
||||
@ -272,9 +260,6 @@ void mesh_network_key_derive(btstack_crypto_aes128_cmac_t * request, mesh_networ
|
||||
mesh_network_key_derive_arg = callback_arg;
|
||||
mesh_network_key_derive_key = network_key;
|
||||
|
||||
printf("NetKey: ");
|
||||
printf_hexdump(network_key->net_key, 16);
|
||||
|
||||
// calc k1 using
|
||||
mesh_k1(request, mesh_network_key_derive_key->net_key, 16, mesh_salt_nhbk, id128_tag, sizeof(id128_tag),
|
||||
mesh_network_key_derive_key->beacon_key, &mesh_network_key_derive_beacon_key_calculated, request);
|
||||
|
@ -419,7 +419,7 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
||||
case HCI_EVENT_DISCONNECTION_COMPLETE:
|
||||
// enable PB_GATT
|
||||
if (provisioned == 0){
|
||||
setup_advertising_unprovisioned();
|
||||
setup_advertising_unprovisioned();
|
||||
}
|
||||
break;
|
||||
|
||||
@ -723,6 +723,7 @@ static void show_usage(void){
|
||||
printf("4 - Send Segmented Access Message - Virtual 9779\n");
|
||||
printf("6 - Clear Replay Protection List\n");
|
||||
printf("7 - Load PTS App key\n");
|
||||
printf("8 - Delete provisioning data\n");
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
@ -763,13 +764,8 @@ static void stdin_process(char cmd){
|
||||
load_pts_app_key();
|
||||
break;
|
||||
case '8':
|
||||
printf("Creating link to device uuid: ");
|
||||
printf_hexdump(pts_device_uuid, 16);
|
||||
pb_adv_create_link(pts_device_uuid);
|
||||
break;
|
||||
case '9':
|
||||
printf("Close link\n");
|
||||
pb_adv_close_link(1, 0);
|
||||
btstack_tlv_singleton_impl->delete_tag(btstack_tlv_singleton_context, 'PROV');
|
||||
printf("Provisioning data deleted\n");
|
||||
break;
|
||||
case 'p':
|
||||
printf("+ Public Key OOB Enabled\n");
|
||||
|
@ -681,20 +681,6 @@ static void provisioning_handle_random(uint8_t *packet, uint16_t size){
|
||||
|
||||
// PROV_DATA
|
||||
static void provisioning_handle_network_dervived(void * arg){
|
||||
|
||||
printf("BeaconKey: ");
|
||||
printf_hexdump(network_key.beacon_key, 16);
|
||||
printf("Network ID: ");
|
||||
printf_hexdump(network_key.network_id, 8);
|
||||
printf("IdentityKey: ");
|
||||
printf_hexdump(network_key.identity_key, 16);
|
||||
printf("NID: %02x\n", network_key.nid);
|
||||
printf("EncryptionKey: ");
|
||||
printf_hexdump(network_key.encryption_key, 16);
|
||||
printf("PrivacyKey: ");
|
||||
printf_hexdump(network_key.privacy_key, 16);
|
||||
|
||||
//
|
||||
provisioning_timer_stop();
|
||||
|
||||
// notify client
|
||||
@ -706,10 +692,6 @@ static void provisioning_handle_network_dervived(void * arg){
|
||||
}
|
||||
|
||||
static void provisioning_handle_data_device_key(void * arg){
|
||||
// dump
|
||||
printf("DeviceKey: ");
|
||||
printf_hexdump(device_key, 16);
|
||||
|
||||
// derive full network key
|
||||
mesh_network_key_derive(&prov_cmac_request, &network_key, &provisioning_handle_network_dervived, NULL);
|
||||
}
|
||||
@ -731,14 +713,6 @@ static void provisioning_handle_data_ccm(void * arg){
|
||||
iv_index = big_endian_read_32(provisioning_data, 19);
|
||||
unicast_address = big_endian_read_16(provisioning_data, 23);
|
||||
|
||||
// dump
|
||||
printf("NetKey: ");
|
||||
printf_hexdump(network_key.net_key, 16);
|
||||
printf("NetKeyIndex: %04x\n", network_key.netkey_index);
|
||||
printf("Flags: %02x\n", flags);
|
||||
printf("IVIndex: %04x\n", iv_index);
|
||||
printf("UnicastAddress: %02x\n", unicast_address);
|
||||
|
||||
// DeviceKey
|
||||
mesh_k1(&prov_cmac_request, dhkey, sizeof(dhkey), provisioning_salt, (const uint8_t*) "prdk", 4, device_key, &provisioning_handle_data_device_key, NULL);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user