Skip to content

Commit

Permalink
Merge pull request #109 from geonnave/update-readme
Browse files Browse the repository at this point in the history
Update readme
  • Loading branch information
geonnave authored Oct 4, 2023
2 parents 1acf406 + cea4a25 commit 5fe2756
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# edhoc-rs

[![Build and test](https://github.com/openwsn-berkeley/edhoc-rs/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/openwsn-berkeley/edhoc-rs/actions/workflows/build-and-test.yml)

A microcontroller-optimized implementation of EDHOC in Rust (`no_std`).

Supports:
Expand All @@ -18,7 +20,9 @@ cargo build
cargo test
```

## Example
`edhoc_rs` can be compiled with different configurations depending on the enabled features. To learn what are the available features and how to select them for several configurations of build and test, check the [Github Actions file](./.github/workflows/rust.yml).

## Example: EDHOC over CoAP on native host

In one terminal, run an example CoAP server:
```
Expand All @@ -34,34 +38,29 @@ In the output you should find the EDHOC handshake messages and the derived OSCOR

The source code for these examples is at `examples/coap/src/bin`.

## Example: flashing a device and selecting lib version / crypto backend
## Example: EDHOC on nRF52840 device with different crypto backends

To build an example application that works on the [nrf52840dk](https://www.nordicsemi.com/Products/Development-hardware/nrf52840-dk), do as follows:

```bash
# head to the example `no_std` example
cd ./examples/edhoc-rs-no_std

# build using the hacspec version of the lib, and software-based crypto
cargo build --target="thumbv7em-none-eabihf" --no-default-features --features="hacspec-psa, rtt" --release
# build using the psa crypto backend (software-based)
cargo build --target="thumbv7em-none-eabihf" --no-default-features --features="crypto-psa, rtt" --release

# build using the rust version of the lib, and hardware-accelerated crypto
# build using the cryptocell310 crypto backend (hardware-accelerated)
cargo build --target="thumbv7em-none-eabihf" --no-default-features --features="crypto-cryptocell310, rtt"
```

To build **and** flash to the board, replace the word `build` with `embed` in the commands above (you may need to `cargo install cargo-embed`).

For example: `cargo embed --target="thumbv7em-none-eabihf" --no-default-features --features="cryptocell310, rtt"`

To see more examples on how to build it using different crypto backends and workspace features, check the [Github Actions file](./.github/workflows/rust.yml).

## Directory structure
This library is structured as a Workspace, a feature from Cargo which makes it easy to manage more than one package / application in the same repository. Here are its the main folders:

- `lib`: The main library for the EDHOC implementation.
- `examples`: Example applications that demonstrate how to use the EDHOC library. There are several subdirectories, each containing a different example application (e.g., coap, edhoc-rs-cc2538, edhoc-rs-no_std).
- `consts`: Defines constants used throughout the project.
- `crypto`: Implement wrappers from cryptographic operations that work in different targets (native, nrf52840 with and without hardware-accelerated crypto, etc.).
- `hacspec`: Leverages the Hacspec cryptographic specification language to implement the EDHOC protocol (the RFC stuff).

To see how to select different features, check the [Github Actions file](./.github/workflows/rust.yml).
- `consts`: Defines constants and structs used throughout the project.
- `crypto`: Diferent cryptographic backends (e.g. psa, cryptocell310, hacspec).

0 comments on commit 5fe2756

Please sign in to comment.