Fix AID selection.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos
2023-10-28 20:57:53 +02:00
parent 28e979939a
commit 599fd706ce
4 changed files with 61 additions and 49 deletions

View File

@@ -33,9 +33,12 @@ int u2f_unload();
int u2f_process_apdu();
int u2f_select(app_t *a) {
if (cap_supported(CAP_U2F)) {
a->process_apdu = u2f_process_apdu;
a->unload = u2f_unload;
return CCID_OK;
}
return CCID_ERR_FILE_NOT_FOUND;
}
void __attribute__((constructor)) u2f_ctor() {

View File

@@ -55,9 +55,12 @@ const uint8_t atr_fido[] = {
};
int fido_select(app_t *a) {
if (cap_supported(CAP_FIDO2)) {
a->process_apdu = fido_process_apdu;
a->unload = fido_unload;
return CCID_OK;
}
return CCID_ERR_FILE_NOT_FOUND;
}
void __attribute__((constructor)) fido_ctor() {

View File

@@ -69,6 +69,7 @@ const uint8_t oath_aid[] = {
};
int oath_select(app_t *a) {
if (cap_supported(CAP_OATH)) {
a->process_apdu = oath_process_apdu;
a->unload = oath_unload;
res_APDU_size = 0;
@@ -104,6 +105,8 @@ int oath_select(app_t *a) {
res_APDU[res_APDU_size++] = ALG_HMAC_SHA1;
apdu.ne = res_APDU_size;
return CCID_OK;
}
return CCID_ERR_FILE_NOT_FOUND;
}
void __attribute__((constructor)) oath_ctor() {

View File

@@ -117,6 +117,7 @@ const uint8_t otp_aid[] = {
};
int otp_select(app_t *a) {
if (cap_supported(CAP_OTP)) {
a->process_apdu = otp_process_apdu;
a->unload = otp_unload;
if (file_has_data(search_dynamic_file(EF_OTP_SLOT1)) ||
@@ -131,6 +132,8 @@ int otp_select(app_t *a) {
res_APDU_size = 6;
apdu.ne = res_APDU_size;
return CCID_OK;
}
return CCID_ERR_FILE_NOT_FOUND;
}
uint8_t modhex_tab[] =