Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow fetching nfc enable status without an admin pin #103

Merged
merged 3 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions applets/admin/admin.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ __attribute__((weak)) int admin_vendor_hw_sn(const CAPDU *capdu, RAPDU *rapdu) {
return 0;
}

__attribute__((weak)) int admin_vendor_nfc_enable(const CAPDU *capdu, RAPDU *rapdu) {
__attribute__((weak)) int admin_vendor_nfc_enable(const CAPDU *capdu, RAPDU *rapdu, bool pin_validated) {
UNUSED(capdu);
UNUSED(rapdu);
UNUSED(pin_validated);
return 0;
}

Expand Down Expand Up @@ -223,6 +224,10 @@ int admin_process_apdu(const CAPDU *capdu, RAPDU *rapdu) {
ret = admin_vendor_hw_sn(capdu, rapdu);
goto done;

case ADMIN_INS_NFC_ENABLE:
ret = admin_vendor_nfc_enable(capdu, rapdu, pin.is_validated);
goto done;

case ADMIN_INS_FACTORY_RESET:
ret = admin_factory_reset(capdu, rapdu);
goto done;
Expand Down Expand Up @@ -267,9 +272,6 @@ int admin_process_apdu(const CAPDU *capdu, RAPDU *rapdu) {
case ADMIN_INS_RESET_CTAP:
ret = ctap_install(1);
break;
case ADMIN_INS_NFC_ENABLE:
ret = admin_vendor_nfc_enable(capdu, rapdu);
break;
case ADMIN_INS_READ_CTAP_SM2_CONFIG:
ret = ctap_read_sm2_config(capdu, rapdu);
break;
Expand Down
2 changes: 1 addition & 1 deletion include/admin.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ int admin_vendor_specific(const CAPDU *capdu, RAPDU *rapdu);
int admin_vendor_version(const CAPDU *capdu, RAPDU *rapdu);
int admin_vendor_hw_variant(const CAPDU *capdu, RAPDU *rapdu);
int admin_vendor_hw_sn(const CAPDU *capdu, RAPDU *rapdu);
int admin_vendor_nfc_enable(const CAPDU *capdu, RAPDU *rapdu);
int admin_vendor_nfc_enable(const CAPDU *capdu, RAPDU *rapdu, bool pin_validated);

uint8_t cfg_is_led_normally_on(void);
uint8_t cfg_is_ndef_enable(void);
Expand Down
Loading