From 8386ae56d2acf696e77e73bcd367ea4b6a53b1a3 Mon Sep 17 00:00:00 2001 From: Nicolas Stalder Date: Wed, 13 Feb 2019 03:25:08 +0100 Subject: [PATCH 1/6] Cleanup makefile, minor typos --- .gitignore | 1 + 99-solo.rules | 4 +- Makefile | 53 +++++++------------------- fido2/log.h | 2 +- targets/stm32l432/lib/usbd/usbd_desc.c | 9 +++-- 5 files changed, 23 insertions(+), 46 deletions(-) diff --git a/.gitignore b/.gitignore index 66184fa..f6da0e3 100644 --- a/.gitignore +++ b/.gitignore @@ -74,6 +74,7 @@ tools/python-fido2/* *.key site/ _site/ +venv/ env2/ env3/ .project diff --git a/99-solo.rules b/99-solo.rules index 0c6450a..c0b6015 100644 --- a/99-solo.rules +++ b/99-solo.rules @@ -8,8 +8,8 @@ ATTRS{idVendor}=="0483", ATTRS{idProduct}=="a2ca", ENV{ID_MM_DEVICE_IGNORE}="1" LABEL="mm_usb_device_blacklist_end" # Solo -ATTRS{idVendor}=="0483", ATTRS{idProduct}=="a2ca", ATTRS{product}=="Solo", TAG+="uaccess", GROUP="plugdev", SYMLINK+="solokey" -ATTRS{idVendor}=="0483", ATTRS{idProduct}=="a2ca", ATTRS{product}=="Solo HACKER (Unlocked)", TAG+="uaccess", GROUP="plugdev", SYMLINK+="solohacker" +SUBSYSTEM=="hidraw" ATTRS{idVendor}=="0483", ATTRS{idProduct}=="a2ca", ATTRS{product}=="Solo [1-9]*", TAG+="uaccess", GROUP="plugdev", SYMLINK+="solokey" +SUBSYSTEM=="hidraw" ATTRS{idVendor}=="0483", ATTRS{idProduct}=="a2ca", ATTRS{product}=="Solo Hacker [1-9]*", TAG+="uaccess", GROUP="plugdev", SYMLINK+="solohacker" SUBSYSTEM=="tty", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="a2ca", TAG+="uaccess", GROUP="plugdev", SYMLINK+="solokey-serial" diff --git a/Makefile b/Makefile index e9caa44..b57354c 100644 --- a/Makefile +++ b/Makefile @@ -9,9 +9,6 @@ ecc_platform=2 -EFM32_DEBUGGER= -s 440083537 --device EFM32JG1B200F128GM32 -#EFM32_DEBUGGER= -s 440121060 #dev board - src = $(wildcard pc/*.c) $(wildcard fido2/*.c) $(wildcard crypto/sha256/*.c) crypto/tiny-AES-c/aes.c obj = $(src:.c=.o) crypto/micro-ecc/uECC.o @@ -33,7 +30,7 @@ CFLAGS += -DAES256=1 -DAPP_CONFIG=\"app.h\" name = main -.PHONY: all $(LIBCBOR) env2 env3 black wink2 wink3 fido2-test clean full-clean travis +.PHONY: all $(LIBCBOR) black blackcheck cppcheck wink fido2-test clean full-clean travis test clean all: main tinycbor/Makefile crypto/tiny-AES-c/aes.c: @@ -45,7 +42,7 @@ cbor: $(LIBCBOR) $(LIBCBOR): cd tinycbor/ && $(MAKE) clean && $(MAKE) -j8 -test: env3 +test: venv $(MAKE) clean $(MAKE) -C . main $(MAKE) clean @@ -53,48 +50,26 @@ test: env3 $(MAKE) clean $(MAKE) cppcheck -.PHONY: efm8prog -efm8prog: - cd './targets/efm8\Keil 8051 v9.53 - Debug' && $(MAKE) all - flashefm8.exe -part EFM8UB10F8G -sn 440105518 -erase - flashefm8.exe -part EFM8UB10F8G -sn 440105518 -upload './targets/efm8/Keil 8051 v9.53 - Debug/efm8.hex' - -.PHONY: efm32com efm32prog efm32read efm32bootprog -efm32com: - cd './targets/efm32/GNU ARM v7.2.1 - Debug' && $(MAKE) all -efm32prog: efm32com - commander flash './targets/efm32/GNU ARM v7.2.1 - Debug/EFM32.hex' $(EFM32_DEBUGGER) -p "0x1E7FC:0x00000000:4" -efm32read: efm32com - commander swo read $(EFM32_DEBUGGER) -efm32bootprog: efm32com - commander flash './efm32boot/GNU ARM v7.2.1 - Debug/efm32boot.hex' $(EFM32_DEBUGGER) --masserase - $(name): $(obj) $(LIBCBOR) $(CC) $(LDFLAGS) -o $@ $(obj) $(LDFLAGS) crypto/micro-ecc/uECC.o: ./crypto/micro-ecc/uECC.c $(CC) -c -o $@ $^ -O2 -fdata-sections -ffunction-sections -DuECC_PLATFORM=$(ecc_platform) -I./crypto/micro-ecc/ -env2: - virtualenv --python=python2.7 env2 - env3/bin/pip --version - env2/bin/pip install -r tools/requirements.txt +venv: + python3 -m venv venv + venv/bin/pip -q install --upgrade -r tools/requirements.txt + venv/bin/pip -q install --upgrade black -env3: - python3 -m venv env3 - env3/bin/pip -q install --upgrade -r tools/requirements.txt - env3/bin/pip -q install --upgrade black - -.PHONY: black blackcheck wink2 wink3 fido2-test cppcheck test clean # selectively reformat our own code -black: env3 - env3/bin/black --skip-string-normalization --check tools/ +black: venv + venv/bin/black --skip-string-normalization --check tools/ -wink2 wink3: wink% : env% - $ 0 diff --git a/targets/stm32l432/lib/usbd/usbd_desc.c b/targets/stm32l432/lib/usbd/usbd_desc.c index 88b920d..3505328 100644 --- a/targets/stm32l432/lib/usbd/usbd_desc.c +++ b/targets/stm32l432/lib/usbd/usbd_desc.c @@ -88,10 +88,11 @@ const uint8_t USBD_DeviceDesc[USB_LEN_DEV_DESC]= { USB_MAX_EP0_SIZE, /* bMaxPacketSize */ LOBYTE(USBD_VID), /* idVendor */ HIBYTE(USBD_VID), /* idVendor */ - LOBYTE(USBD_PID), /* idVendor */ - HIBYTE(USBD_PID), /* idVendor */ - 0x00, /* bcdDevice rel. 2.00 */ - 0x02, + LOBYTE(USBD_PID), /* idProduct */ + HIBYTE(USBD_PID), /* idProduct */ + // should put SOLO_VERSION_MAJ/MIN here too, but binary coded decimal + 0x00, /* bcdDevice version */ + 0x01, USBD_IDX_MFC_STR, /* Index of manufacturer string */ USBD_IDX_PRODUCT_STR, /* Index of product string */ USBD_IDX_SERIAL_STR, /* Index of serial number string */ From 34fb8c9c248e4479efc7f3bc5eedd2e9aeed2800 Mon Sep 17 00:00:00 2001 From: Nicolas Stalder Date: Wed, 13 Feb 2019 03:54:06 +0100 Subject: [PATCH 2/6] udev fix --- 99-solo.rules | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/99-solo.rules b/99-solo.rules index c0b6015..65d5fdc 100644 --- a/99-solo.rules +++ b/99-solo.rules @@ -7,11 +7,19 @@ ATTRS{idVendor}=="0483", ATTRS{idProduct}=="a2ca", ENV{ID_MM_DEVICE_IGNORE}="1" LABEL="mm_usb_device_blacklist_end" -# Solo -SUBSYSTEM=="hidraw" ATTRS{idVendor}=="0483", ATTRS{idProduct}=="a2ca", ATTRS{product}=="Solo [1-9]*", TAG+="uaccess", GROUP="plugdev", SYMLINK+="solokey" -SUBSYSTEM=="hidraw" ATTRS{idVendor}=="0483", ATTRS{idProduct}=="a2ca", ATTRS{product}=="Solo Hacker [1-9]*", TAG+="uaccess", GROUP="plugdev", SYMLINK+="solohacker" -SUBSYSTEM=="tty", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="a2ca", TAG+="uaccess", GROUP="plugdev", SYMLINK+="solokey-serial" +# Solo + +## access +ATTRS{idVendor}=="0483", ATTRS{idProduct}=="a2ca", TAG+="uaccess", GROUP="plugdev" + +## Solo Secure symlink +SUBSYSTEM=="hidraw", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="a2ca", ATTRS{product}=="Solo [1-9]*", SYMLINK+="solokey" +## Solo Hacker symlink +SUBSYSTEM=="hidraw", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="a2ca", ATTRS{product}=="Solo Hacker [1-9]*", SYMLINK+="solohacker" +## Solo Serial symlink +SUBSYSTEM=="tty", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="a2ca", SYMLINK+="soloserial" + # U2F Zero -KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="8acf", TAG+="uaccess", GROUP="plugdev", SYMLINK+="u2fzero" +SUBSYSTEM=="hidraw", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="8acf", TAG+="uaccess", GROUP="plugdev", SYMLINK+="u2fzero" From 41f1d5efed0eb9e0b0859b9188da087dbbd1ee7a Mon Sep 17 00:00:00 2001 From: Nicolas Stalder Date: Wed, 13 Feb 2019 04:03:55 +0100 Subject: [PATCH 3/6] udev fix --- 99-solo.rules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/99-solo.rules b/99-solo.rules index 65d5fdc..9a78a00 100644 --- a/99-solo.rules +++ b/99-solo.rules @@ -17,8 +17,8 @@ ATTRS{idVendor}=="0483", ATTRS{idProduct}=="a2ca", TAG+="uaccess", GROUP="plugde SUBSYSTEM=="hidraw", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="a2ca", ATTRS{product}=="Solo [1-9]*", SYMLINK+="solokey" ## Solo Hacker symlink SUBSYSTEM=="hidraw", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="a2ca", ATTRS{product}=="Solo Hacker [1-9]*", SYMLINK+="solohacker" -## Solo Serial symlink -SUBSYSTEM=="tty", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="a2ca", SYMLINK+="soloserial" +## Solo Serial access + symlink +SUBSYSTEM=="tty", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="a2ca", TAG+="uaccess", GROUP="plugdev", SYMLINK+="soloserial" # U2F Zero From 1ea4a2776ba86ba646d9394a007e666f5b44ca6a Mon Sep 17 00:00:00 2001 From: Nicolas Stalder Date: Wed, 13 Feb 2019 04:12:31 +0100 Subject: [PATCH 4/6] remove .clabot --- .clabot | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 .clabot diff --git a/.clabot b/.clabot deleted file mode 100644 index 76e90a2..0000000 --- a/.clabot +++ /dev/null @@ -1,4 +0,0 @@ -{ - "contributors": "https://raw.githubusercontent.com/solokeys/contributors/master/contributors.json", - "message": "We require contributors to sign our Copyright License Agreement, and we don't have {{usersWithoutCLA}} on file. In order for us to review and merge your code, please visit https://solokeys.com/legal/contributors, or contact @nickray, @conorpp or @0x0ece for further information or help." -} From b212c71da6c7f96c9cef3686b7b468aef46d7906 Mon Sep 17 00:00:00 2001 From: Nicolas Stalder Date: Wed, 13 Feb 2019 04:13:15 +0100 Subject: [PATCH 5/6] fix .envrc --- .envrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.envrc b/.envrc index 2ec7e88..619fe07 100644 --- a/.envrc +++ b/.envrc @@ -1 +1 @@ -source env3/bin/activate +source venv/bin/activate From 5fddde240fb4441de5cfbee312b9209c643a50c5 Mon Sep 17 00:00:00 2001 From: Nicolas Stalder Date: Wed, 13 Feb 2019 04:14:55 +0100 Subject: [PATCH 6/6] fix env3 reference to venv in README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1dc8284..6685c14 100644 --- a/README.md +++ b/README.md @@ -46,8 +46,8 @@ make cbor make all-hacker cd ../.. -make env3 -source env3/bin/activate +make venv +source venv/bin/activate python tools/solotool.py program targets/stm32l432/solo.hex ```