Skip to content

Commit a58e4f7

Browse files
Yossi Levyadbridge
authored andcommitted
Adding MBEDTLS_ENTROPY_NV_SEED macro check in device key to allow key derivation when there is no TRNG but there is DRBG
1 parent ecb3c8c commit a58e4f7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

features/device_key/source/DeviceKey.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ int DeviceKey::generate_key_by_random(uint32_t *output, size_t size)
260260
return DEVICEKEY_INVALID_PARAM;
261261
}
262262

263-
#if DEVICE_TRNG
263+
#if defined(DEVICE_TRNG) || defined(MBEDTLS_ENTROPY_NV_SEED)
264264
uint32_t test_buff[DEVICE_KEY_32BYTE / sizeof(int)];
265265
mbedtls_entropy_context *entropy = new mbedtls_entropy_context;
266266
mbedtls_entropy_init(entropy);
@@ -276,6 +276,7 @@ int DeviceKey::generate_key_by_random(uint32_t *output, size_t size)
276276

277277
mbedtls_entropy_free(entropy);
278278
delete entropy;
279+
279280
#endif
280281

281282
return ret;

0 commit comments

Comments
 (0)