Fix AES key generation for other 128 and 192 bits.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos 2022-03-06 01:29:39 +01:00
parent 5e377cccaf
commit 7306a9765e
No known key found for this signature in database
GPG Key ID: C0095B7870A4CCD3

View File

@ -1189,7 +1189,7 @@ static int cmd_key_gen() {
if (!isUserAuthenticated)
return SW_SECURITY_STATUS_NOT_SATISFIED();
//at this moment, we do not use the template, as only CBC is supported by the driver (encrypt, decrypt and CMAC)
const uint8_t *aes_key = random_bytes_get(32);
const uint8_t *aes_key = random_bytes_get(key_size);
file_t *fpk = file_new((KEY_PREFIX << 8) | key_id);
int r = flash_write_data_to_file(fpk, aes_key, key_size);
if (r != HSM_OK)