mirror of
https://github.com/polhenarejos/pico-hsm.git
synced 2024-09-20 11:20:08 +00:00
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:
parent
010c8018ea
commit
f022c3235d
2
sc_hsm.c
2
sc_hsm.c
@ -462,7 +462,7 @@ static int cmd_initialize() {
|
||||
memcpy(tmp_dkek, p, IV_SIZE);
|
||||
if (dkeks == 0) {
|
||||
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);
|
||||
file_t *tf = search_by_fid(EF_DKEK, NULL, SPECIFY_EF);
|
||||
flash_write_data_to_file(tf, tmp_dkek, sizeof(tmp_dkek));
|
||||
|
Loading…
Reference in New Issue
Block a user