mirror of
https://github.com/polhenarejos/pico-hsm.git
synced 2026-01-30 15:19:21 +00:00
When working with SM, wrap() manipulates res_APDU. Thus, we cannot change the pointer of res_APDU anymore. Everything must be memcpy-ed.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
parent
7232625bab
commit
db5f5fd435
1 changed files with 2 additions and 2 deletions
|
|
@ -388,7 +388,7 @@ static int cmd_read_binary()
|
|||
uint16_t maxle = data_len-offset;
|
||||
if (apdu.expected_res_size > maxle)
|
||||
apdu.expected_res_size = maxle;
|
||||
res_APDU = file_read(ef->data+2+offset);
|
||||
memcpy(res_APDU, file_read(ef->data+2+offset), data_len-offset);
|
||||
res_APDU_size = data_len-offset;
|
||||
}
|
||||
}
|
||||
|
|
@ -569,7 +569,7 @@ static int cmd_challenge() {
|
|||
uint8_t *rb = (uint8_t *)random_bytes_get(apdu.expected_res_size);
|
||||
if (!rb)
|
||||
return SW_WRONG_LENGTH();
|
||||
res_APDU = rb;
|
||||
memcpy(res_APDU, rb, apdu.expected_res_size);
|
||||
res_APDU_size = apdu.expected_res_size;
|
||||
return SW_OK();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue