From 38283f588da0b43bd32b882d82ce7f62ea9abe4a Mon Sep 17 00:00:00 2001 From: Pol Henarejos Date: Thu, 27 Apr 2023 11:43:20 +0200 Subject: [PATCH] Fix particular case where an EF has masked types. Signed-off-by: Pol Henarejos --- src/fs/file.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/fs/file.c b/src/fs/file.c index 7845b71..205e62b 100644 --- a/src/fs/file.c +++ b/src/fs/file.c @@ -74,15 +74,18 @@ void process_fci(const file_t *pe, int fmd) { res_APDU[res_APDU_size++] = 0x82; res_APDU[res_APDU_size++] = 1; res_APDU[res_APDU_size] = 0; - if (pe->type == FILE_TYPE_INTERNAL_EF) { + if (pe->type & FILE_TYPE_INTERNAL_EF) { res_APDU[res_APDU_size++] |= 0x08; } - else if (pe->type == FILE_TYPE_WORKING_EF) { + else if (pe->type & FILE_TYPE_WORKING_EF) { res_APDU[res_APDU_size++] |= pe->ef_structure & 0x7; } - else if (pe->type == FILE_TYPE_DF) { + else if (pe->type & FILE_TYPE_DF) { res_APDU[res_APDU_size++] |= 0x38; } + else { + res_APDU_size++; + } res_APDU[res_APDU_size++] = 0x83; res_APDU[res_APDU_size++] = 2;