From 8575833431a17dd752ca007fec8bbbd0273f8da0 Mon Sep 17 00:00:00 2001 From: Pol Henarejos Date: Wed, 20 Apr 2022 19:55:04 +0200 Subject: [PATCH] PUT DATA only accepts DO that live in flash. Signed-off-by: Pol Henarejos --- src/openpgp/openpgp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/openpgp/openpgp.c b/src/openpgp/openpgp.c index 5da4bc4..2c3df06 100644 --- a/src/openpgp/openpgp.c +++ b/src/openpgp/openpgp.c @@ -232,7 +232,6 @@ int parse_do(uint16_t *fids, int mode) { int len = 0; file_t *ef; for (int i = 0; i < fids[0]; i++) { - printf("FID %x\r\n",fids[i+1]); if ((ef = search_by_fid(fids[i+1], NULL, SPECIFY_EF))) { uint16_t data_len; if ((ef->type & FILE_DATA_FUNC) == FILE_DATA_FUNC) { @@ -624,7 +623,7 @@ static int cmd_put_data() { if (!authenticate_action(ef, ACL_OP_UPDATE_ERASE)) { return SW_SECURITY_STATUS_NOT_SATISFIED(); } - if (apdu.cmd_apdu_data_len > 0) { + 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) return SW_MEMORY_FAILURE();