Fix AES key generation for other 128 and 192 bits.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
2
sc_hsm.c
2
sc_hsm.c
@@ -1189,7 +1189,7 @@ static int cmd_key_gen() {
|
|||||||
if (!isUserAuthenticated)
|
if (!isUserAuthenticated)
|
||||||
return SW_SECURITY_STATUS_NOT_SATISFIED();
|
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)
|
//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);
|
file_t *fpk = file_new((KEY_PREFIX << 8) | key_id);
|
||||||
int r = flash_write_data_to_file(fpk, aes_key, key_size);
|
int r = flash_write_data_to_file(fpk, aes_key, key_size);
|
||||||
if (r != HSM_OK)
|
if (r != HSM_OK)
|
||||||
|
|||||||
Reference in New Issue
Block a user