jonasschnelli / mcu

MCU code for the Digital Bitbox hardware wallet

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status License

MCU code for the Digital Bitbox hardware wallet.

All communication to the hardware wallet enters and exits a single gateway char *commander(const char *command) that receives an encrypted command and returns an encrypted reply. The communication protocol is desribed in the API.

See the tests_cmdline.c code for a simple example and the tests_api.c code to test the API. The tests can be compiled and run locally without the need for a device. The tests_api.c code will also test a live device if one is plugged into a USB slot. This requires installation of the hidapi library for USB communication, a micro SD card in the device, and a number of touch button presses (to permit erase and sign commands).

ECDSA signatures are performed using a simplified version of the micro ECC library. The micro ECC library is designed for microcontrollers, resistant to known side channel attacks, and does not use dynamic memory allocation. In the simplified version, non-secp256k1 ECDSA curves were removed and RFC6979 (deterministic k) and convenience functions were added.

Standardized functions:

Cryptographic: secp256k1, AES-256-CBC, SHA2, HMAC, PBKDF2, RIPEMD160
Encoding: Base-64, Base-58-check, JSON
Bitcoin: BIP32, BIP39, BIP44

Build Instructions

Dependencies:

OSX:

brew install hidapi

Basic build steps:

mkdir build
cd build
cmake ..
make

Contributing

Please do NOT use an editor that automatically reformats.

Use the coding style set by astyle (http://astyle.sourceforge.net/) with the following parameteres:

astyle --style=stroustrup --indent-switches --indent-labels --pad-oper --pad-header --align-pointer=name --add-brackets --convert-tabs --max-code-length=90 --break-after-logical --suffix=none *.c *.h --recursive

astyle Git hook

For convenience, enable a Git hook to trigger the astyle styling whenever a git commit operation is performed. This is done by typing in the repository directory:

cd .git/hooks
ln -s ../../contrib/git/pre-commit

About

MCU code for the Digital Bitbox hardware wallet

License:Other


Languages

Language:C 88.0%Language:C++ 11.6%Language:Shell 0.2%Language:CMake 0.1%