Added dynamic option to enable/disable press to confirm.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos 2022-04-06 15:14:23 +02:00
parent 7060d2d2ca
commit c16a7a3c5c
No known key found for this signature in database
GPG key ID: C0095B7870A4CCD3
2 changed files with 16 additions and 12 deletions

View file

@ -104,12 +104,15 @@ uint16_t get_device_options() {
extern uint32_t board_button_read(void);
static void wait_button() {
uint32_t val = EV_PRESS_BUTTON;
queue_try_add(ccid_comm, &val);
do {
queue_remove_blocking(card_comm, &val);
uint16_t opts = get_device_options();
if (opts & HSM_OPT_BOOTSEL_BUTTON) {
uint32_t val = EV_PRESS_BUTTON;
queue_try_add(ccid_comm, &val);
do {
queue_remove_blocking(card_comm, &val);
}
while (val != EV_BUTTON_PRESSED);
}
while (val != EV_BUTTON_PRESSED);
}
static int cmd_select() {

View file

@ -88,13 +88,14 @@ extern const uint8_t sc_hsm_aid[];
#define ALGO_AES_CMAC 0x18
#define ALGO_AES_DERIVE 0x99
#define HSM_OPT_RRC 0x1
#define HSM_OPT_TRANSPORT_PIN 0x2
#define HSM_OPT_SESSION_PIN 0x4
#define HSM_OPT_SESSION_PIN_EXPL 0xC
#define HSM_OPT_REPLACE_PKA 0x8
#define HSM_OPT_COMBINED_AUTH 0x10
#define HSM_OPT_RRC_RESET_ONLY 0x20
#define HSM_OPT_RRC 0x0001
#define HSM_OPT_TRANSPORT_PIN 0x0002
#define HSM_OPT_SESSION_PIN 0x0004
#define HSM_OPT_SESSION_PIN_EXPL 0x000C
#define HSM_OPT_REPLACE_PKA 0x0008
#define HSM_OPT_COMBINED_AUTH 0x0010
#define HSM_OPT_RRC_RESET_ONLY 0x0020
#define HSM_OPT_BOOTSEL_BUTTON 0x0100
#define P15_KEYTYPE_RSA 0x30
#define P15_KEYTYPE_ECC 0xA0