mirror of
https://github.com/polhenarejos/pico-hsm.git
synced 2026-05-07 12:43:06 +00:00
Fix kmac and kenc computation.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
parent
7aca7b323a
commit
7aee18110e
1 changed files with 2 additions and 2 deletions
|
|
@ -97,7 +97,7 @@ int dkek_kenc(uint8_t *kenc) { //kenc 32 bytes
|
|||
return r;
|
||||
memcpy(buf, dkek+IV_SIZE, 32);
|
||||
release_dkek();
|
||||
memcpy(buf, "\x0\x0\x0\x1", 4);
|
||||
memcpy(buf+32, "\x0\x0\x0\x1", 4);
|
||||
hash256(buf, sizeof(buf), kenc);
|
||||
memset(buf, 0, sizeof(buf));
|
||||
return HSM_OK;
|
||||
|
|
@ -110,7 +110,7 @@ int dkek_kmac(uint8_t *kmac) { //kmac 32 bytes
|
|||
return r;
|
||||
memcpy(buf, dkek+IV_SIZE, 32);
|
||||
release_dkek();
|
||||
memcpy(buf, "\x0\x0\x0\x2", 4);
|
||||
memcpy(buf+32, "\x0\x0\x0\x2", 4);
|
||||
hash256(buf, sizeof(buf), kmac);
|
||||
memset(buf, 0, sizeof(buf));
|
||||
return HSM_OK;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue