From 9e1bb6662a4762d474392c3d1dd78ef126814da7 Mon Sep 17 00:00:00 2001 From: Paul Jimenez Date: Tue, 18 Sep 2018 21:42:55 -0400 Subject: [PATCH] Automate python venv creation. Add convenient Makefile targets. --- .gitignore | 1 + Makefile | 36 +++++++++++++++++++++++++++++++++--- README.md | 34 ++++++++-------------------------- 3 files changed, 42 insertions(+), 29 deletions(-) diff --git a/.gitignore b/.gitignore index e47ce92..03744a0 100644 --- a/.gitignore +++ b/.gitignore @@ -74,3 +74,4 @@ tools/python-fido2/* *.key site/ _site/ +venv/ diff --git a/Makefile b/Makefile index 52815b8..201aa7b 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ CFLAGS += $(INCLUDES) name = main .PHONY: all -all: main +all: python-fido2 main tinycbor/Makefile crypto/tiny-AES-c/aes.h: @@ -63,7 +63,7 @@ efm32bootprog: crypto/tiny-AES-c/aes.o: - if ! grep "^#define AES256" crypto/tiny-AES-c/aes.h ; then \ + if ! grep -q "^#define AES256" crypto/tiny-AES-c/aes.h ; then \ echo "Fixing crypto/tiny-AES-c/aes.h" ;\ sed -i 's/^#define AES1\/\/#define AES1; s/^\/*#define AES256/#define AES256/' crypto/tiny-AES-c/aes.h ;\ fi @@ -81,11 +81,41 @@ testgcm: $(obj) $(LIBCBOR) uECC.o: ./crypto/micro-ecc/uECC.c $(CC) -c -o $@ $^ -O2 -fdata-sections -ffunction-sections -DuECC_PLATFORM=$(platform) -I./crypto/micro-ecc/ + +# python virtualenv + +venv: + @if ! which virtualenv >/dev/null ; then \ + echo "ERR: Sorry, no python virtualenv found. Please consider installing " ;\ + echo " it via something like:" ;\ + echo " sudo apt install python-virtualenv" ;\ + echo " or maybe:" ;\ + echo " pip install virtualenv" ;\ + fi + virtualenv venv + ./venv/bin/pip install wheel + +.PHONY: python-fido2 +python-fido2: venv + cd python-fido2/ && ../venv/bin/python setup.py install + +venv/bin/mkdocs: venv + ./venv/bin/pip install mkdocs mkdocs-material + +.PHONY: docsrv +docsrv: venv/bin/mkdocs + ./venv/bin/mkdocs serve + +.PHONY: fido2-test +fido2-test: + ./venv/bin/python tools/ctap_test.py + clean: rm -f *.o main.exe main $(obj) for f in crypto/tiny-AES-c/Makefile tinycbor/Makefile ; do \ if [ -f "$$f" ]; then \ - (cd `dirname $$f` ; git co -- .) ;\ + (cd `dirname $$f` ; git checkout -- .) ;\ fi ;\ done + rm -rf venv diff --git a/README.md b/README.md index 26cf1ab..4385773 100644 --- a/README.md +++ b/README.md @@ -39,39 +39,22 @@ bulk order and provide open source security tokens for everyone that is interest # Setting up -Clone and Compile CBOR library and FIDO 2 client library. +Clone solo and build it ```bash git clone https://github.com/SoloKeysSec/solo cd solo/ -git submodule update --init - -cd tinycbor && make -cd .. - -cd python-fido2/ -python setup.py install +make all ``` +This builds our FIDO 2.0 and the U2F authenticator, as well as making a virtualenv in venv/ +that has our python-fido2 fork installed. + Note that our python-fido2 fork will only connect to the software FIDO2 application, not a hardware authenticator. Install Yubico's fork to do that. -Open `crypto/tiny-AES-c/aes.h` in a text editor and make sure AES256 is selected as follows. - -``` -//#define AES128 1 -//#define AES192 1 -#define AES256 1 -``` - -Now compile FIDO 2.0 and U2F authenticator. - -```bash -make -``` - # Testing and development The application is set up to send and recv USB HID messages over UDP to ease @@ -90,13 +73,13 @@ Run FIDO 2 / U2F application. Run example client software. This runs through a registration and authentication. ``` -python python-fido2/examples/credential.py +./venv/bin/python python-fido2/examples/credential.py ``` Run the FIDO2 tests. ``` -python tools/ctap_test.py +make fido2-test ``` Follow specifications to really dig in. @@ -142,8 +125,7 @@ for each interface. Look at the issues to see what is currently being worked on. Feel free to add issues as well. -This is an upgrade to [U2F -Zero](https://github.com/conorpp/u2f-zero). +This is an upgrade to [U2F Zero](https://github.com/conorpp/u2f-zero). # License