Added fmd flag to wrap FCP to include later the FMD.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos 2022-05-24 23:30:01 +02:00
parent bd178c86e4
commit 56453b60d6
No known key found for this signature in database
GPG key ID: C0095B7870A4CCD3
2 changed files with 8 additions and 5 deletions

View file

@ -35,12 +35,14 @@ extern uint8_t *flash_read(uintptr_t addr);
extern void low_flash_available();
//puts FCI in the RAPDU
void process_fci(const file_t *pe) {
void process_fci(const file_t *pe, int fmd) {
uint8_t *p = res_APDU;
uint8_t buf[64];
res_APDU_size = 0;
res_APDU[res_APDU_size++] = 0x6f;
res_APDU[res_APDU_size++] = 0x00; //computed later
if (fmd) {
res_APDU[res_APDU_size++] = 0x6f;
res_APDU[res_APDU_size++] = 0x00; //computed later
}
res_APDU[res_APDU_size++] = 0x62;
res_APDU[res_APDU_size++] = 0x00; //computed later
@ -95,7 +97,8 @@ void process_fci(const file_t *pe) {
res_APDU_size += meta_size;
}
res_APDU[1] = res_APDU_size-2;
res_APDU[3] = res_APDU_size-4;
if (fmd)
res_APDU[3] = res_APDU_size-4;
}
#define MAX_DYNAMIC_FILES 128

View file

@ -92,7 +92,7 @@ extern file_t *search_by_fid(const uint16_t fid, const file_t *parent, const uin
extern file_t *search_by_name(uint8_t *name, uint16_t namelen);
extern file_t *search_by_path(const uint8_t *pe_path, uint8_t pathlen, const file_t *parent);
extern bool authenticate_action(const file_t *ef, uint8_t op);
extern void process_fci(const file_t *pe);
extern void process_fci(const file_t *pe, int fmd);
extern void scan_flash();
extern void initialize_flash(bool);