Skip to content

Commit 37eddb6

Browse files
authored
Merge pull request #151 from particle-iot/fix/ota-flash-hal-udp
[nrf52840] hal: fixes ota_flash_hal for HAL_PLATFORM_CLOUD_UDP
2 parents 8522e54 + 97ee86f commit 37eddb6

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

hal/src/nRF52840/ota_flash_hal.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,21 @@ int32_t key_gen_random(void* p)
7474
return (int32_t)HAL_RNG_GetRandomNumber();
7575
}
7676

77+
int key_gen_random_block(void* handle, uint8_t* data, size_t len)
78+
{
79+
while (len>=4)
80+
{
81+
*((uint32_t*)data) = HAL_RNG_GetRandomNumber();
82+
data += 4;
83+
len -= 4;
84+
}
85+
while (len-->0)
86+
{
87+
*data++ = HAL_RNG_GetRandomNumber();
88+
}
89+
return 0;
90+
}
91+
7792
int fetch_device_private_key_ex(uint8_t *key_buf, uint16_t length)
7893
{
7994
return dct_read_app_data_copy(HAL_Feature_Get(FEATURE_CLOUD_UDP) ? DCT_ALT_DEVICE_PRIVATE_KEY_OFFSET : DCT_DEVICE_PRIVATE_KEY_OFFSET,

0 commit comments

Comments
 (0)