Skip to content

Commit bb3678d

Browse files
authored
Merge pull request #39 from All-Your-Locks-Are-Belong-To-Us/doc
2 parents 1916feb + 092f7ad commit bb3678d

File tree

4 files changed

+35
-7
lines changed

4 files changed

+35
-7
lines changed

examples/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# examples
2+
3+
This directory contains examples demonstrating the use of libmicrofido2 on different microcontrollers.
4+
5+
- `nfc.c` shows the setup of a FIDO device.
6+
- `invalid_device.c` shows how errors are returned by libmicrofido2.
7+
- `measurements/` contains files to run measurements. More info in the README.
8+
- `esp32/` contains specific files for the ESP32 hardware platform. More info in the README.
9+
- `nrf52/` contains specific files for the NRF52480 hardware platform. More info in the README.
10+
- `stateless_rp` contains an example of a stateless, offline relying party. This can be used in hardware or with the provided nfc simulator (which can be executed from `nfc_simulator.c`).

examples/invalid_device.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@
77
*/
88

99
#include "fido.h"
10+
#include "assert.h"
1011

1112
int main(void) {
1213
fido_dev_t device;
1314
fido_dev_init(&device);
1415

1516
// This should fail because the io and transport functions are not set for the device.
16-
fido_dev_open(&device);
17+
int r = fido_dev_open(&device);
18+
assert(r != FIDO_OK);
1719

1820
// Always close your devices.
1921
fido_dev_close(&device);

examples/nrf52/README.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,20 @@ This container image can be built using the following command:
1111
sudo DOCKER_BUILDKIT=1 docker build -t nrf52-sdk .
1212
```
1313

14-
## Building, Flashing and Debugging
14+
## Building
1515

16-
After connecting the Devkit to the computer, it should be shown with `lsusb` as `SEGGER J-LINK`.
17-
It should also be found as ACM device in `/dev/ttyACM?` (*remember the number*).
18-
Building can be done with (run from this directory!): `sudo docker run --rm -v $PWD/../../:/libmicrofido2 nrf52-sdk west -v build -b nrf52840dk_nrf52840 -d /libmicrofido2/examples/nrf52/build /libmicrofido2/examples/nrf52`.
19-
Flashing can then be done with `sudo docker run --rm -v $PWD/../../:/libmicrofido2 --privileged --device=/dev/ttyACM? nrf52-sdk west flash -d /libmicrofido2/examples/nrf52/build`.
20-
An interactive GDB session can be started with `sudo docker run --rm -it -v $PWD/../../:/libmicrofido2 --privileged --device=/dev/ttyACM? nrf52-sdk west debug -d /libmicrofido2/examples/nrf52/build`.
16+
1. Navigate to this directory.
17+
1. Run `sudo docker run --rm -v $PWD/../../:/libmicrofido2 nrf52-sdk west -v build -b nrf52840dk_nrf52840 -d /libmicrofido2/examples/nrf52/build /libmicrofido2/examples/nrf52`.
18+
19+
## Flashing
20+
21+
1. Connect the Devkit to the computer.
22+
1. It should be shown with `lsusb` as `SEGGER J-LINK`. It should also be found as ACM device in `/dev/ttyACM?` (*remember the number*).
23+
1. Run `sudo docker run --rm -v $PWD/../../:/libmicrofido2 --privileged --device=/dev/ttyACM? nrf52-sdk west flash -d /libmicrofido2/examples/nrf52/build`.
24+
25+
## Debugging
26+
27+
An interactive GDB session can be started with `sudo docker run --rm -it -v $PWD/../../:/libmicrofido2 --privileged --device=/dev/ttyACM? nrf52-sdk west debug -d /libmicrofido2/examples/nrf52/build`.
2128
You can additionally connect to the serial console output / log via `sudo docker run --rm -it --privileged --device=/dev/ttyACM0 nrf52-sdk minicom -D /dev/ttyACM0 -b 115200`.
2229

2330
## Hardware Cryptography

external/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# external
2+
3+
This directory contains external libraries.
4+
5+
- [Monocypher](https://github.com/All-Your-Locks-Are-Belong-To-Us/Monocypher), used for Ed25519 signature verification
6+
- [AES GCM](https://github.com/All-Your-Locks-Are-Belong-To-Us/aes_gcm) for AES in Galois Counter Mode
7+
- [cb0r](https://github.com/All-Your-Locks-Are-Belong-To-Us/cb0r) for writing and reading CBOR encoded data
8+
- sha256
9+
- [tinf](https://github.com/All-Your-Locks-Are-Belong-To-Us/tinf) for INFLATE decompression

0 commit comments

Comments
 (0)