Fix ne parameter when secure message protocol is used.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos 2025-04-07 01:27:57 +02:00
parent 4b59bd6481
commit 7c1ef56799
No known key found for this signature in database
GPG key ID: C0095B7870A4CCD3
2 changed files with 5 additions and 1 deletions

@ -1 +1 @@
Subproject commit 2c3fe5bebf6cf6a9a5fb9c685aa744529c8548cb
Subproject commit 580b0acffa8e685caee4508fb656b78247064248

View file

@ -761,6 +761,7 @@ static const cmd_t cmds[] = {
};
int sc_hsm_process_apdu() {
uint32_t ne = apdu.ne;
int r = sm_unwrap();
if (r != PICOKEY_OK) {
return SW_DATA_INVALID();
@ -769,6 +770,9 @@ int sc_hsm_process_apdu() {
if (cmd->ins == INS(apdu)) {
int res = cmd->cmd_handler();
sm_wrap();
if ((CLA(apdu) >> 2) & 0x3) {
apdu.ne = ne;
}
return res;
}
}