mirror of https://github.com/ARMmbed/mbed-os.git
Cordio PAL security manager: Copy locally own CSRK
The stack does not copy csrk when DmSecSetLocalCsrk is invoked; it just retains a pointer to it. Therefore a copy is kept inside the pal.pull/6932/head
parent
e4813f4fe9
commit
2da6fa3947
|
@ -327,6 +327,7 @@ private:
|
||||||
bool _lesc_keys_generated;
|
bool _lesc_keys_generated;
|
||||||
uint8_t _public_key_x[SEC_ECC_KEY_LEN];
|
uint8_t _public_key_x[SEC_ECC_KEY_LEN];
|
||||||
irk_t _irk;
|
irk_t _irk;
|
||||||
|
csrk_t _csrk;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // cordio
|
} // cordio
|
||||||
|
|
|
@ -273,8 +273,11 @@ ble_error_t CordioSecurityManager::set_csrk(
|
||||||
const csrk_t& csrk,
|
const csrk_t& csrk,
|
||||||
sign_count_t sign_counter
|
sign_count_t sign_counter
|
||||||
) {
|
) {
|
||||||
|
_csrk = csrk;
|
||||||
|
DmSecSetLocalCsrk(_csrk.data());
|
||||||
|
// extra set the sign counter used by the client
|
||||||
CordioAttClient::get_client().set_sign_counter(sign_counter);
|
CordioAttClient::get_client().set_sign_counter(sign_counter);
|
||||||
DmSecSetLocalCsrk(const_cast<uint8_t*>(csrk.data()));
|
|
||||||
return BLE_ERROR_NONE;
|
return BLE_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue