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,10 +33,13 @@ 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() {
register_app(u2f_select, u2f_aid);

View File

@@ -55,10 +55,13 @@ 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() {
#if defined(USB_ITF_CCID) || defined(ENABLE_EMULATION)

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;
@@ -105,6 +106,8 @@ int oath_select(app_t *a) {
apdu.ne = res_APDU_size;
return CCID_OK;
}
return CCID_ERR_FILE_NOT_FOUND;
}
void __attribute__((constructor)) oath_ctor() {
register_app(oath_select, oath_aid);

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)) ||
@@ -132,6 +133,8 @@ int otp_select(app_t *a) {
apdu.ne = res_APDU_size;
return CCID_OK;
}
return CCID_ERR_FILE_NOT_FOUND;
}
uint8_t modhex_tab[] =
{ 'c', 'b', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'n', 'r', 't', 'u', 'v' };