Automate python venv creation. Add convenient Makefile targets.

This commit is contained in:
Paul Jimenez 2018-09-18 21:42:55 -04:00
parent 60d5222873
commit 9e1bb6662a
3 changed files with 42 additions and 29 deletions

1
.gitignore vendored
View File

@ -74,3 +74,4 @@ tools/python-fido2/*
*.key *.key
site/ site/
_site/ _site/
venv/

View File

@ -26,7 +26,7 @@ CFLAGS += $(INCLUDES)
name = main name = main
.PHONY: all .PHONY: all
all: main all: python-fido2 main
tinycbor/Makefile crypto/tiny-AES-c/aes.h: tinycbor/Makefile crypto/tiny-AES-c/aes.h:
@ -63,7 +63,7 @@ efm32bootprog:
crypto/tiny-AES-c/aes.o: 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" ;\ 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 ;\ sed -i 's/^#define AES1\/\/#define AES1; s/^\/*#define AES256/#define AES256/' crypto/tiny-AES-c/aes.h ;\
fi fi
@ -81,11 +81,41 @@ testgcm: $(obj) $(LIBCBOR)
uECC.o: ./crypto/micro-ecc/uECC.c uECC.o: ./crypto/micro-ecc/uECC.c
$(CC) -c -o $@ $^ -O2 -fdata-sections -ffunction-sections -DuECC_PLATFORM=$(platform) -I./crypto/micro-ecc/ $(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: clean:
rm -f *.o main.exe main $(obj) rm -f *.o main.exe main $(obj)
for f in crypto/tiny-AES-c/Makefile tinycbor/Makefile ; do \ for f in crypto/tiny-AES-c/Makefile tinycbor/Makefile ; do \
if [ -f "$$f" ]; then \ if [ -f "$$f" ]; then \
(cd `dirname $$f` ; git co -- .) ;\ (cd `dirname $$f` ; git checkout -- .) ;\
fi ;\ fi ;\
done done
rm -rf venv

View File

@ -39,39 +39,22 @@ bulk order and provide open source security tokens for everyone that is interest
# Setting up # Setting up
Clone and Compile CBOR library and FIDO 2 client library. Clone solo and build it
```bash ```bash
git clone https://github.com/SoloKeysSec/solo git clone https://github.com/SoloKeysSec/solo
cd solo/ cd solo/
git submodule update --init make all
cd tinycbor && make
cd ..
cd python-fido2/
python setup.py install
``` ```
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, 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. 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 # Testing and development
The application is set up to send and recv USB HID messages over UDP to ease 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. 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. Run the FIDO2 tests.
``` ```
python tools/ctap_test.py make fido2-test
``` ```
Follow specifications to really dig in. 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. 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 This is an upgrade to [U2F Zero](https://github.com/conorpp/u2f-zero).
Zero](https://github.com/conorpp/u2f-zero).
# License # License