btstack_crypto: let btstack_crypto_ecc_p256_generate_key generate new key if called again

This commit is contained in:
Matthias Ringwald 2018-10-25 14:57:13 +02:00
parent ebdf3c684b
commit e0449ce9c9

View File

@ -942,6 +942,11 @@ void btstack_crypto_aes128_cmac_zero(btstack_crypto_aes128_cmac_t * request, uin
#ifdef ENABLE_ECC_P256
void btstack_crypto_ecc_p256_generate_key(btstack_crypto_ecc_p256_t * request, uint8_t * public_key, void (* callback)(void * arg), void * callback_arg){
// reset key generation
if (btstack_crypto_ecc_p256_key_generation_state == ECC_P256_KEY_GENERATION_DONE){
btstack_crypto_ecc_p256_random_len = 0;
btstack_crypto_ecc_p256_key_generation_state = ECC_P256_KEY_GENERATION_IDLE;
}
request->btstack_crypto.context_callback.callback = callback;
request->btstack_crypto.context_callback.context = callback_arg;
request->btstack_crypto.operation = BTSTACK_CRYPTO_ECC_P256_GENERATE_KEY;