Merge pull request #9278 from boomer41/master

DeviceKey: [Security Fix] Generated ROT-key is still used when TRNG fails
pull/9313/head
Martin Kojtal 2019-01-09 13:09:01 +00:00 committed by GitHub
commit 65729d6800
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -267,11 +267,12 @@ int DeviceKey::generate_key_by_random(uint32_t *output, size_t size)
ret = mbedtls_entropy_func(entropy, (unsigned char *)output, size);
if (ret != MBED_SUCCESS) {
ret = DEVICEKEY_GENERATE_RANDOM_ERROR;
} else {
ret = DEVICEKEY_SUCCESS;
}
mbedtls_entropy_free(entropy);
delete entropy;
ret = DEVICEKEY_SUCCESS;
#endif
return ret;