Fix when secure message cannot be correctly processed.

It is discarded.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos
2022-10-30 21:11:06 +01:00
parent b2ac893efc
commit eec4612a6f

View File

@@ -647,7 +647,9 @@ static const cmd_t cmds[] = {
}; };
int sc_hsm_process_apdu() { int sc_hsm_process_apdu() {
sm_unwrap(); int r = sm_unwrap();
if (r != CCID_OK)
return SW_DATA_INVALID();
for (const cmd_t *cmd = cmds; cmd->ins != 0x00; cmd++) { for (const cmd_t *cmd = cmds; cmd->ins != 0x00; cmd++) {
if (cmd->ins == INS(apdu)) { if (cmd->ins == INS(apdu)) {
int r = cmd->cmd_handler(); int r = cmd->cmd_handler();