Fix when initialize with 0 dkek shares. DKEK is automatically generated and saved.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
2
sc_hsm.c
2
sc_hsm.c
@@ -462,7 +462,7 @@ static int cmd_initialize() {
|
|||||||
memcpy(tmp_dkek, p, IV_SIZE);
|
memcpy(tmp_dkek, p, IV_SIZE);
|
||||||
if (dkeks == 0) {
|
if (dkeks == 0) {
|
||||||
p = random_bytes_get(32);
|
p = random_bytes_get(32);
|
||||||
memcpy(tmp_dkek, p, 32);
|
memcpy(tmp_dkek+IV_SIZE, p, 32);
|
||||||
encrypt(session_pin, tmp_dkek, tmp_dkek+IV_SIZE, 32);
|
encrypt(session_pin, tmp_dkek, tmp_dkek+IV_SIZE, 32);
|
||||||
file_t *tf = search_by_fid(EF_DKEK, NULL, SPECIFY_EF);
|
file_t *tf = search_by_fid(EF_DKEK, NULL, SPECIFY_EF);
|
||||||
flash_write_data_to_file(tf, tmp_dkek, sizeof(tmp_dkek));
|
flash_write_data_to_file(tf, tmp_dkek, sizeof(tmp_dkek));
|
||||||
|
|||||||
Reference in New Issue
Block a user