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

U2F implementation #56

Draft
wants to merge 28 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
1e6ca27
Vendor in the highly customised tinyusb, rather than patching esp-iot…
MatthewWilkes May 28, 2022
f50f336
Reduce patching of micropython to support USB
MatthewWilkes May 28, 2022
98d660d
Merge remote-tracking branch 'emf/main' into feature/u2f-mode
MatthewWilkes May 28, 2022
e4b1cd2
Progress on internal U2F protocol
MatthewWilkes May 29, 2022
ae3e5f7
Update U2F implementation to be ready for crypto drop-in
MatthewWilkes May 29, 2022
02ff0f7
Add cryptoauthlib and partial SoftI2C HAL
marksteward Jun 12, 2022
260af72
Add get serial number for ecc108
MatthewWilkes Jul 30, 2022
ed6dc1d
Update ECC108A interface
MatthewWilkes Jul 30, 2022
6995c47
Attempts to configure keys
MatthewWilkes Aug 21, 2022
6cec889
Include calib updatextra
MatthewWilkes Aug 21, 2022
7b0596a
Provision ATECC108A and offer some initial helper functions
MatthewWilkes Aug 29, 2022
42c115c
Merge branch 'ecc108a-wip' into feature/u2f-mode
MatthewWilkes Oct 30, 2022
51ee313
U2F Implementation includes crypto functions
MatthewWilkes Nov 27, 2022
91e249c
Use DER format for signature return
MatthewWilkes Nov 27, 2022
e26308f
Send pubkey in uncompressed format
MatthewWilkes Nov 27, 2022
2a66ea5
Fix alignment of continuation packets and simplify signature scheme.
MatthewWilkes Nov 28, 2022
64564fd
Helper functions for debugging. Return data as bytes rather than a nu…
MatthewWilkes Feb 10, 2024
237bf9b
Improve verify helper to fix mp API problem. Now returns ATCA error.@
MatthewWilkes Apr 3, 2024
eaba9ee
Update github build script with user components
MatthewWilkes Apr 3, 2024
99487ac
Fix signature size, allowing authentication to work (!)
MatthewWilkes Apr 4, 2024
44df071
Basic GUI for authenticator support
MatthewWilkes Apr 15, 2024
3a347cc
Allow user driven switching of U2F and HID modes
MatthewWilkes Apr 15, 2024
fb4a4f2
Set the target env variable at workflow module scope
MatthewWilkes Apr 15, 2024
020440b
Force idf target in the tinyusb component
MatthewWilkes Apr 15, 2024
818d729
Another attempt to sort target for github builds
MatthewWilkes Apr 15, 2024
b440c3c
Use IDF 4.4.1 in github
MatthewWilkes Apr 15, 2024
7e94e9d
Move cryptographic operation calls into MicroPython to improve reliab…
MatthewWilkes Apr 21, 2024
be695b2
Improvements to u2f
MatthewWilkes Jul 7, 2024
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: 6 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
push:
tags:
- "v*"
env:
TARGET: esp32s3
IDF_TARGET: esp32s3
jobs:
Build-Firmware:
runs-on: ubuntu-latest
Expand All @@ -21,7 +24,7 @@ jobs:
uses: actions/checkout@v2
with:
repository: espressif/esp-idf
ref: release/v4.4
ref: v4.4.1
path: esp-idf
submodules: true
- name: Install SDK
Expand All @@ -48,8 +51,8 @@ jobs:
source esp-idf/export.sh
ln -sfn $GITHUB_WORKSPACE/tildamk6 micropython/ports/esp32/boards/tildamk6
cd micropython/ports/esp32
make submodules BOARD=tildamk6 USER_C_MODULES=$GITHUB_WORKSPACE/drivers/micropython.cmake IOT_SOLUTION_PATH=$GITHUB_WORKSPACE/esp-iot-solution TARGET=esp32s3
make BOARD=tildamk6 USER_C_MODULES=$GITHUB_WORKSPACE/drivers/micropython.cmake $@ IOT_SOLUTION_PATH=$GITHUB_WORKSPACE/esp-iot-solution TARGET=esp32s3
make submodules BOARD=tildamk6 USER_C_MODULES=$GITHUB_WORKSPACE/drivers/micropython.cmake USER_COMPONENTS=$GITHUB_WORKSPACE/components/tinyusb IOT_SOLUTION_PATH=$GITHUB_WORKSPACE/esp-iot-solution TARGET=esp32s3
make BOARD=tildamk6 USER_C_MODULES=$GITHUB_WORKSPACE/drivers/micropython.cmake USER_COMPONENTS=$GITHUB_WORKSPACE/components/tinyusb $@ IOT_SOLUTION_PATH=$GITHUB_WORKSPACE/esp-iot-solution TARGET=esp32s3
cd ../../..
echo "{\"build\":\"$(git describe --tags --always)\", \"name\":\"$(git describe --tags --always)\"}" > micropython/ports/esp32/build-tildamk6/tidal.txt
- name: Archive firmware
Expand Down
107 changes: 107 additions & 0 deletions components/tinyusb/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
set(IDF_TARGET esp32s3)
idf_build_get_property(target IDF_TARGET)

set(srcs)
set(includes_public)
set(includes_private)
set(compile_options)


if(CONFIG_TINYUSB)
set(tusb_mcu "OPT_MCU_ESP32S3")
set(tusb_family "esp32sx")

list(APPEND compile_options
"-DCFG_TUSB_MCU=${tusb_mcu}"
"-DCFG_TUSB_DEBUG=${CONFIG_TINYUSB_DEBUG_LEVEL}"
)

idf_component_get_property(freertos_component_dir freertos COMPONENT_DIR)

list(APPEND includes_private
"${IDF_PATH}/components/tinyusb/tinyusb/hw/bsp/"
"${IDF_PATH}/components/tinyusb/tinyusb/src/"
"${IDF_PATH}/components/tinyusb/tinyusb/src/device"
"${IDF_PATH}/components/tinyusb/tinyusb/src/class/bth"
#"additions/include_private"
)

list(APPEND includes_public
"${IDF_PATH}/components/tinyusb/tinyusb/src/"
"additions/include"
"additions/include_private"
"additions/tusb/src/lib/networking"
"additions/tusb/src/class/dfu"
# The FreeRTOS API include convention in tinyusb is different from esp-idf
"${freertos_component_dir}/include/freertos"
)

list(APPEND srcs
"${IDF_PATH}/components/tinyusb/tinyusb/src/portable/espressif/${tusb_family}/dcd_${tusb_family}.c"
"${IDF_PATH}/components/tinyusb/tinyusb/src/class/cdc/cdc_device.c"
"${IDF_PATH}/components/tinyusb/tinyusb/src/class/hid/hid_device.c"
"${IDF_PATH}/components/tinyusb/tinyusb/src/class/midi/midi_device.c"
"${IDF_PATH}/components/tinyusb/tinyusb/src/class/msc/msc_device.c"
"${IDF_PATH}/components/tinyusb/tinyusb/src/class/vendor/vendor_device.c"
"${IDF_PATH}/components/tinyusb/tinyusb/src/common/tusb_fifo.c"
"${IDF_PATH}/components/tinyusb/tinyusb/src/device/usbd_control.c"
"${IDF_PATH}/components/tinyusb/tinyusb/src/tusb.c"
"additions/src/usbd.c"
"additions/src/descriptors_control.c"
"additions/src/tinyusb.c"
"additions/src/tusb_tasks.c"
"additions/src/usb_descriptors.c"
)

# when no builtin class driver is enabled, an uint8_t data compared with `BUILTIN_DRIVER_COUNT` will always be false
set_source_files_properties("tinyusb/src/device/usbd.c" PROPERTIES COMPILE_FLAGS "-Wno-type-limits")

if(CONFIG_TINYUSB_CDC_ENABLED)
list(APPEND srcs
"additions/src/cdc.c"
"additions/src/tusb_cdc_acm.c"
"additions/src/tusb_console.c"
"additions/src/vfs_tinyusb.c"
)
endif() # CONFIG_TINYUSB_CDC_ENABLED

if(CONFIG_TINYUSB_HID_ENABLED)
list(APPEND srcs
"additions/src/tusb_hid.c")
endif()

if(CONFIG_TINYUSB_MSC_ENABLED)
list(APPEND srcs
"additions/src/tusb_msc.c")
endif()

if(CONFIG_TINYUSB_NET_ENABLED)
list(APPEND srcs
"additions/src/tusb_net.c"
"additions/tusb/src/class/net/net_device.c"
"additions/tusb/src/lib/networking/rndis_reports.c")
endif()

if(CONFIG_TINYUSB_BTH_ENABLED)
list(APPEND srcs
"additions/src/tusb_bth.c"
"${IDF_PATH}/components/tinyusb/tinyusb/src/class/bth/bth_device.c")
endif()

if(CONFIG_TINYUSB_DFU_ENABLED)
list(APPEND srcs
"additions/src/tusb_dfu.c"
"additions/tusb/src/class/dfu/dfu_device.c")
endif()

endif() # CONFIG_TINYUSB

idf_component_register(SRCS ${srcs}
INCLUDE_DIRS ${includes_public}
PRIV_INCLUDE_DIRS ${includes_private}
PRIV_REQUIRES "vfs" "fatfs" "bt" "app_update"
)

if(CONFIG_TINYUSB)
target_compile_options(${COMPONENT_LIB} PRIVATE ${compile_options})
endif()
Loading
Loading