mesh: add mesh_transport_key_calc_aid

This commit is contained in:
Matthias Ringwald 2019-04-24 16:22:02 +02:00
parent fa5e639f2c
commit 042ce6c5b9
3 changed files with 16 additions and 1 deletions

View File

@ -279,3 +279,8 @@ void mesh_network_key_derive(btstack_crypto_aes128_cmac_t * request, mesh_networ
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);
}
void mesh_transport_key_calc_aid(btstack_crypto_aes128_cmac_t * request, mesh_transport_key_t * app_key, void (* callback)(void * arg), void * callback_arg){
mesh_k4(request, app_key->key, &app_key->aid, callback, callback_arg);
}

View File

@ -93,6 +93,16 @@ void mesh_virtual_address(btstack_crypto_aes128_cmac_t * request, const uint8_t
*/
void mesh_network_key_derive(btstack_crypto_aes128_cmac_t * request, mesh_network_key_t * network_key, void (* callback)(void * arg), void * callback_arg);
/**
* Calc AID from AppKey
* @param request
* @param transport_key
* @param callback
* @param callback_arg
*/
void mesh_transport_key_calc_aid(btstack_crypto_aes128_cmac_t * request, mesh_transport_key_t * app_key, void (* callback)(void * arg), void * callback_arg);
#ifdef __cplusplus
} /* end of extern "C" */
#endif

View File

@ -1524,7 +1524,7 @@ static void config_appkey_add_handler(mesh_model_t *mesh_model, mesh_pdu_t * pdu
// calculate AID
access_pdu_in_process = pdu;
mesh_k4(&mesh_cmac_request, new_app_key, &new_aid, config_appkey_add_aid, NULL);
mesh_transport_key_calc_aid(&mesh_cmac_request, new_app_key, config_appkey_add_aid, NULL);
}
static void config_model_subscription_status(mesh_model_t * mesh_model, uint16_t netkey_index, uint16_t dest, uint8_t status, uint16_t element_address, uint16_t address, uint32_t model_identifier){