Fix security bug in DeviceKey

pull/9278/head
Stephan Brunner 2019-01-07 18:04:33 +01:00
parent 90fd6cdf27
commit 9d8835741b
No known key found for this signature in database
GPG Key ID: D3CD7237AFB7EF6B
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;