Selecting an app by AID requires the AID as argument.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
parent
24522b9db8
commit
4682e5821f
3 changed files with 12 additions and 4 deletions
|
|
@ -30,7 +30,7 @@ int process_apdu() {
|
|||
{
|
||||
if (INS(apdu) == 0xA4 && P1(apdu) == 0x04 && (P2(apdu) == 0x00 || P2(apdu) == 0x4)) { //select by AID
|
||||
for (int a = 0; a < num_apps; a++) {
|
||||
if ((current_app = apps[a].select_aid(&apps[a]))) {
|
||||
if ((current_app = apps[a].select_aid(&apps[a], apdu.data, apdu.nc))) {
|
||||
return set_res_sw(0x90,0x00);
|
||||
}
|
||||
}
|
||||
|
|
@ -169,6 +169,7 @@ void apdu_thread() {
|
|||
//printf("EXIT !!!!!!\r\n");
|
||||
if (current_app && current_app->unload) {
|
||||
current_app->unload();
|
||||
current_app = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
11
src/apdu.h
11
src/apdu.h
|
|
@ -25,11 +25,18 @@
|
|||
typedef struct app {
|
||||
const uint8_t *aid;
|
||||
int (*process_apdu)();
|
||||
struct app* (*select_aid)();
|
||||
struct app* (*select_aid)(struct app *, const uint8_t *, uint8_t);
|
||||
int (*unload)();
|
||||
} app_t;
|
||||
|
||||
extern int register_app(app_t * (*)());
|
||||
extern int register_app(app_t * (*)(app_t *, const uint8_t *, uint8_t));
|
||||
|
||||
typedef struct cmd
|
||||
{
|
||||
uint8_t ins;
|
||||
int (*cmd_handler)();
|
||||
} cmd_t;
|
||||
|
||||
|
||||
#if defined(DEBUG_APDU) && DEBUG_APDU == 1
|
||||
#define DEBUG_PAYLOAD(_p,_s) { \
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ uint8_t num_apps = 0;
|
|||
|
||||
app_t *current_app = NULL;
|
||||
|
||||
int register_app(app_t * (*select_aid)()) {
|
||||
int register_app(app_t * (*select_aid)(app_t *, const uint8_t *, uint8_t)) {
|
||||
if (num_apps < sizeof(apps)/sizeof(app_t)) {
|
||||
apps[num_apps].select_aid = select_aid;
|
||||
num_apps++;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue