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
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(); extern void low_flash_available();
//puts FCI in the RAPDU //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 *p = res_APDU;
uint8_t buf[64]; uint8_t buf[64];
res_APDU_size = 0; res_APDU_size = 0;
if (fmd) {
res_APDU[res_APDU_size++] = 0x6f; res_APDU[res_APDU_size++] = 0x6f;
res_APDU[res_APDU_size++] = 0x00; //computed later res_APDU[res_APDU_size++] = 0x00; //computed later
}
res_APDU[res_APDU_size++] = 0x62; res_APDU[res_APDU_size++] = 0x62;
res_APDU[res_APDU_size++] = 0x00; //computed later res_APDU[res_APDU_size++] = 0x00; //computed later
@@ -95,6 +97,7 @@ void process_fci(const file_t *pe) {
res_APDU_size += meta_size; res_APDU_size += meta_size;
} }
res_APDU[1] = res_APDU_size-2; res_APDU[1] = res_APDU_size-2;
if (fmd)
res_APDU[3] = res_APDU_size-4; res_APDU[3] = res_APDU_size-4;
} }

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_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 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 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 scan_flash();
extern void initialize_flash(bool); extern void initialize_flash(bool);