diff --git a/src/openpgp/openpgp.c b/src/openpgp/openpgp.c index c801c83..aa599fc 100644 --- a/src/openpgp/openpgp.c +++ b/src/openpgp/openpgp.c @@ -764,6 +764,9 @@ static int cmd_get_data() { if (!authenticate_action(ef, ACL_OP_READ_SEARCH)) { return SW_SECURITY_STATUS_NOT_SATISFIED(); } + if (currentEF && (currentEF->fid & 0x1FF0) == (fid & 0x1FF0)) { //previously selected + ef = currentEF; + } if (ef->data) { uint16_t fids[] = {1,fid}; uint16_t data_len = parse_do(fids, 1); @@ -906,6 +909,9 @@ static int cmd_put_data() { fid = EF_PW_PRIV; apdu.cmd_apdu_data_len = 4; //we silently ommit the reset parameters } + if (currentEF && (currentEF->fid & 0x1FF0) == (fid & 0x1FF0)) { //previously selected + ef = currentEF; + } if (apdu.cmd_apdu_data_len > 0 && (ef->type & FILE_DATA_FLASH)) { int r = flash_write_data_to_file(ef, apdu.cmd_apdu_data, apdu.cmd_apdu_data_len); if (r != CCID_OK)