From 0e3bfb48fa50e77850a4245a6c14a2be8f375732 Mon Sep 17 00:00:00 2001 From: jiangwei Date: Fri, 19 Jan 2024 09:09:50 +0800 Subject: [PATCH] enable clientPin support --- main/Kconfig.projbuild | 4 ++-- main/ctap.c | 10 +++++----- main/device.c | 4 +++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/main/Kconfig.projbuild b/main/Kconfig.projbuild index fc7f092..b7e7ba3 100644 --- a/main/Kconfig.projbuild +++ b/main/Kconfig.projbuild @@ -13,8 +13,8 @@ menu "ESP32 U2F GPIO Configuration" Some GPIOs are used for other purposes (flash connections, etc.) and cannot be used to blink. config BUTTON_ENABLE - bool "enable button support" - default y + bool "enable Button support" + default n help Use button to confirm enter,Default use automatically enter diff --git a/main/ctap.c b/main/ctap.c index b46d858..c3a1ea4 100644 --- a/main/ctap.c +++ b/main/ctap.c @@ -1271,7 +1271,7 @@ static uint8_t ctap_get_info(CborEncoder *encoder) { ret = cbor_encode_int(&map, GI_RESP_OPTIONS); CHECK_CBOR_RET(ret); CborEncoder option_map; - ret = cbor_encoder_create_map(&map, &option_map, 5); + ret = cbor_encoder_create_map(&map, &option_map, 6); CHECK_CBOR_RET(ret); { ret = cbor_encode_text_stringz(&option_map, "rk"); @@ -1282,10 +1282,10 @@ static uint8_t ctap_get_info(CborEncoder *encoder) { CHECK_CBOR_RET(ret); ret = cbor_encode_boolean(&option_map, true); CHECK_CBOR_RET(ret); - //ret = cbor_encode_text_stringz(&option_map, "clientPin"); - //CHECK_CBOR_RET(ret); - //ret = cbor_encode_boolean(&option_map, has_pin()); - //CHECK_CBOR_RET(ret); + ret = cbor_encode_text_stringz(&option_map, "clientPin"); + CHECK_CBOR_RET(ret); + ret = cbor_encode_boolean(&option_map, has_pin()); + CHECK_CBOR_RET(ret); ret = cbor_encode_text_stringz(&option_map, "largeBlobs"); CHECK_CBOR_RET(ret); ret = cbor_encode_boolean(&option_map, true); diff --git a/main/device.c b/main/device.c index 3dd145c..ba4e53f 100644 --- a/main/device.c +++ b/main/device.c @@ -269,12 +269,14 @@ void device_init(void) { ESP_LOGI(TAG, "cert file initialization"); - ctap_install(true); + ctap_install(1); ctap_install_cert(u2f_cert_start, u2f_cert_end - u2f_cert_start); ctap_install_private_key(u2f_cert_key_start, u2f_cert_key_end - u2f_cert_key_start); } + ctap_install(0); + ESP_LOGI(TAG, "u2f device init done"); }