mirror of https://github.com/ARMmbed/mbed-os.git
Stricter parameter check
parent
1cb43fa020
commit
d88f4b3084
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue