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

add nfc enable switch #80

Merged
merged 1 commit into from
Apr 11, 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
9 changes: 9 additions & 0 deletions applets/admin/admin.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ __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) {
UNUSED(capdu);
UNUSED(rapdu);
return 0;
}

uint8_t cfg_is_led_normally_on(void) { return current_config.led_normally_on; }

uint8_t cfg_is_ndef_enable(void) { return current_config.ndef_en; }
Expand Down Expand Up @@ -261,6 +267,9 @@ 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: 2 additions & 0 deletions include/admin.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#define ADMIN_INS_READ_CTAP_SM2_CONFIG 0x11
#define ADMIN_INS_WRITE_CTAP_SM2_CONFIG 0x12
#define ADMIN_INS_RESET_PASS 0x13
#define ADMIN_INS_NFC_ENABLE 0x14
#define ADMIN_INS_VERIFY 0x20
#define ADMIN_INS_CHANGE_PIN 0x21
#define ADMIN_INS_WRITE_SN 0x30
Expand Down Expand Up @@ -46,6 +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);

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