Skip to content

Commit

Permalink
Align data in case it's not.
Browse files Browse the repository at this point in the history
Signed-off-by: Pol Henarejos <[email protected]>
  • Loading branch information
polhenarejos committed Oct 27, 2024
1 parent ccec83d commit 2856ec6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/hsm/cmd_extras.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 2856ec6

Please sign in to comment.