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 04b4619..12d00f6 100644 --- a/Makefile +++ b/Makefile @@ -15,20 +15,32 @@ EFM32_DEBUGGER= -s 440083537 --device EFM32JG1B200F128GM32 src = $(wildcard pc/*.c) $(wildcard fido2/*.c) $(wildcard crypto/sha256/*.c) crypto/tiny-AES-c/aes.c obj = $(src:.c=.o) uECC.o -LDFLAGS = -Wl,--gc-sections ./tinycbor/lib/libtinycbor.a +LIBCBOR = tinycbor/lib/libtinycbor.a +LDFLAGS = -Wl,--gc-sections $(LIBCBOR) CFLAGS = -O2 -fdata-sections -ffunction-sections INCLUDES = -I./tinycbor/src -I./crypto/sha256 -I./crypto/micro-ecc/ -Icrypto/tiny-AES-c/ -I./fido2/ -I./pc -I./fido2/extensions CFLAGS += $(INCLUDES) +# for crypto/tiny-AES-c +CFLAGS += -DAES256=1 name = main -all: main +.PHONY: all +all: python-fido2 main -cbor: + +tinycbor/Makefile crypto/tiny-AES-c/aes.c: + git submodule update --init + +.PHONY: cbor +cbor: $(LIBCBOR) + +$(LIBCBOR): tinycbor/Makefile cd tinycbor/ && $(MAKE) clean && $(MAKE) -j8 +.PHONY: test test: testgcm efm8prog: @@ -51,16 +63,54 @@ efm32bootprog: cd './targets/efm32boot/GNU ARM v7.2.1 - Debug' && $(MAKE) all commander flash './efm32boot/GNU ARM v7.2.1 - Debug/efm32boot.hex' $(EFM32_DEBUGGER) --masserase -$(name): $(obj) +$(name): $(obj) $(LIBCBOR) $(CC) $(LDFLAGS) -o $@ $(obj) $(LDFLAGS) -testgcm: $(obj) - $(CC) -c main.c $(CFLAGS) -DTEST -o main.o - $(CC) -c crypto/aes_gcm.c $(CFLAGS) -DTEST -o crypto/aes_gcm.o +crypto/aes-gcm/aes_gcm.o: + $(CC) -c crypto/aes-gcm/aes_gcm.c $(CFLAGS) -DTEST -o crypto/aes-gcm/aes_gcm.o + +testgcm: $(obj) $(LIBCBOR) crypto/aes-gcm/aes_gcm.o + $(CC) -c fido2/main.c $(CFLAGS) -DTEST -o fido2/main.o $(CC) $(LDFLAGS) -o $@ $^ $(LDFLAGS) 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) + rm -f *.o main.exe main testgcm $(obj) + for f in crypto/tiny-AES-c/Makefile tinycbor/Makefile ; do \ + if [ -f "$$f" ]; then \ + (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 diff --git a/docs/documenting.md b/docs/documenting.md index 9f6d0cc..012d8d1 100644 --- a/docs/documenting.md +++ b/docs/documenting.md @@ -2,8 +2,6 @@ Documentation of the `master` branch is deployed to Netlify automatically. To host or develop locally: -- install python3 and pip -- `pip install mkdocs mkdocs-material` -- `mkdocs serve` and visit [localhost:8000](http://localhost:8000). +- `make docsrv` and visit [localhost:8000](http://localhost:8000). The file `runtime.txt` is necessary to tell Netlify to use Python3.