mirror of
https://github.com/polhenarejos/pico-hsm.git
synced 2026-01-17 01:18:06 +00:00
Align data in case it's not.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
parent
ccec83dfb1
commit
2856ec6917
1 changed files with 4 additions and 0 deletions
|
|
@ -273,6 +273,10 @@ int cmd_extras() {
|
|||
if (apdu.nc % 2) {
|
||||
return SW_WRONG_DATA();
|
||||
}
|
||||
if ((uintptr_t)apdu.data & 1) { // Not aligned
|
||||
memmove(apdu.data - 1, apdu.data, apdu.nc);
|
||||
apdu.data--;
|
||||
}
|
||||
int ret = otp_write_data(row, apdu.data, apdu.nc);
|
||||
if (ret != 0) {
|
||||
return SW_EXEC_ERROR();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue