Stricter parameter check

pull/6642/head
Yossi Levy 2018-05-16 11:44:45 +03:00
parent 1cb43fa020
commit d88f4b3084
1 changed files with 2 additions and 4 deletions

View File

@ -243,10 +243,8 @@ int DeviceKey::generate_key_by_trng(uint32_t *output, size_t& size)
if (DEVICE_KEY_16BYTE > size) { if (DEVICE_KEY_16BYTE > size) {
return DEVICEKEY_BUFFER_TOO_SMALL; return DEVICEKEY_BUFFER_TOO_SMALL;
} else if (DEVICE_KEY_16BYTE <= size && DEVICE_KEY_32BYTE > size) { } else if (DEVICE_KEY_16BYTE != size && DEVICE_KEY_32BYTE != size) {
size = DEVICE_KEY_16BYTE; return DEVICEKEY_INVALID_PARAM;
} else {
size = DEVICE_KEY_32BYTE;
} }
trng_init(&trng_obj); trng_init(&trng_obj);