Align data in case it's not.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
@@ -273,6 +273,10 @@ int cmd_extras() {
|
|||||||
if (apdu.nc % 2) {
|
if (apdu.nc % 2) {
|
||||||
return SW_WRONG_DATA();
|
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);
|
int ret = otp_write_data(row, apdu.data, apdu.nc);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
return SW_EXEC_ERROR();
|
return SW_EXEC_ERROR();
|
||||||
|
|||||||
Reference in New Issue
Block a user