mirror of https://github.com/ARMmbed/mbed-os.git
BLE: Fix SM random number generation.
Ensure the more than 8 random bytes are fetched from the stack.pull/14125/head
parent
b28e11574a
commit
4cfcadd9e9
|
@ -1125,7 +1125,7 @@ ble_error_t SecurityManager::get_random_data(uint8_t *buffer, size_t size)
|
||||||
while (size) {
|
while (size) {
|
||||||
/* fill out the buffer by reading the random data in chunks
|
/* fill out the buffer by reading the random data in chunks
|
||||||
* and copying it until reaching the set size */
|
* and copying it until reaching the set size */
|
||||||
size_t copy_size = std::max(size, random_data.size());
|
size_t copy_size = std::min(size, random_data.size());
|
||||||
ble_error_t ret = _pal.get_random_data(random_data);
|
ble_error_t ret = _pal.get_random_data(random_data);
|
||||||
if (ret != BLE_ERROR_NONE) {
|
if (ret != BLE_ERROR_NONE) {
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in New Issue