Skip to content

Commit

Permalink
add nfc enable switch
Browse files Browse the repository at this point in the history
  • Loading branch information
dangfan committed Feb 7, 2024
1 parent 2ccd945 commit 2be83da
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
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

0 comments on commit 2be83da

Please sign in to comment.