Skip to content

Commit 65729d6

Browse files
authored
Merge pull request #9278 from boomer41/master
DeviceKey: [Security Fix] Generated ROT-key is still used when TRNG fails
2 parents c27dabe + 9d88357 commit 65729d6

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
@@ -267,11 +267,12 @@ int DeviceKey::generate_key_by_random(uint32_t *output, size_t size)
267267
ret = mbedtls_entropy_func(entropy, (unsigned char *)output, size);
268268
if (ret != MBED_SUCCESS) {
269269
ret = DEVICEKEY_GENERATE_RANDOM_ERROR;
270+
} else {
271+
ret = DEVICEKEY_SUCCESS;
270272
}
271273

272274
mbedtls_entropy_free(entropy);
273275
delete entropy;
274-
ret = DEVICEKEY_SUCCESS;
275276
#endif
276277

277278
return ret;

0 commit comments

Comments
 (0)