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
2 changed files with 5 additions and 1 deletions

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;
}
}