Start some cleanup

- add an editorconfig
- fix requirements.txt and the UTF-8 issue (lost in pull/47)
- two clean environments
- make black usable
- two test targets (wink2/wink3)
pull/48/head
Nicolas Stalder 2019-01-03 14:24:34 +01:00
rodzic fa810ff54d
commit b2c78ca7c0
5 zmienionych plików z 44 dodań i 19 usunięć

19
.editorconfig 100644
Wyświetl plik

@ -0,0 +1,19 @@
https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties
# editorconfig.org
root = true
[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 4
tab_width = 4
trim_trailing_whitespace = true
insert_final_newline = true
[Makefile]
indent_style = tab
[*.{yml,yaml}]
indent_size = 2

3
.gitignore vendored
Wyświetl plik

@ -74,7 +74,8 @@ tools/python-fido2/*
*.key *.key
site/ site/
_site/ _site/
venv/ env2/
env3/
.project .project
.tags* .tags*
targets/*/docs/ targets/*/docs/

Wyświetl plik

@ -7,7 +7,7 @@
#define uECC_arm64 6 #define uECC_arm64 6
#define uECC_avr 7 #define uECC_avr 7
platform=2 ecc_platform=2
EFM32_DEBUGGER= -s 440083537 --device EFM32JG1B200F128GM32 EFM32_DEBUGGER= -s 440083537 --device EFM32JG1B200F128GM32
#EFM32_DEBUGGER= -s 440121060 #dev board #EFM32_DEBUGGER= -s 440121060 #dev board
@ -29,7 +29,7 @@ INCLUDES = -I./tinycbor/src -I./crypto/sha256 -I./crypto/micro-ecc/ -Icrypto/tin
CFLAGS += $(INCLUDES) CFLAGS += $(INCLUDES)
# for crypto/tiny-AES-c # for crypto/tiny-AES-c
CFLAGS += -DAES256=1 -DAPP_CONFIG=\"app.h\" CFLAGS += -DAES256=1 -DAPP_CONFIG=\"app.h\"
name = main name = main
@ -68,29 +68,33 @@ $(name): $(obj) $(LIBCBOR)
$(CC) $(LDFLAGS) -o $@ $(obj) $(LDFLAGS) $(CC) $(LDFLAGS) -o $@ $(obj) $(LDFLAGS)
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=$(ecc_platform) -I./crypto/micro-ecc/
env2:
virtualenv env2
env2/bin/pip install -r tools/requirements.txt
# python virtualenv env3:
python3 -m venv env3
env3/bin/pip install -r tools/requirements.txt
env3/bin/pip install black
venv: # selectively reformat our own code
@if ! which virtualenv >/dev/null ; then \ black: env3
echo "ERR: Sorry, no python virtualenv found. Please consider installing " ;\ env3/bin/black -S tools/
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
wink2: env2
env2/bin/python tools/solotool.py solo --wink
.PHONY: fido2-test wink3: env3
fido2-test: env3/bin/python tools/solotool.py solo --wink
./venv/bin/python tools/ctap_test.py
fido2-test: env3
env3/bin/python tools/ctap_test.py
clean: clean:
rm -f *.o main.exe main $(obj) rm -f *.o main.exe main $(obj)
rm -rf env2 env3
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 checkout -- .) ;\ (cd `dirname $$f` ; git checkout -- .) ;\

Wyświetl plik

@ -1,5 +1,5 @@
ecdsa ecdsa
intelhex intelhex
pyserial pyserial
python-fido2 fido2
pyusb pyusb

Wyświetl plik

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
# #
# Copyright (C) 2018 SoloKeys, Inc. <https://solokeys.com/> # Copyright (C) 2018 SoloKeys, Inc. <https://solokeys.com/>
# #