From b10f872845d82b4d390ec4db9e3f9d4dc3428973 Mon Sep 17 00:00:00 2001 From: Geovane Fedrecheski Date: Fri, 2 Feb 2024 14:25:16 +0100 Subject: [PATCH] chore: less warnings, more docs --- examples/lakers-c-riot/Makefile | 4 ++-- examples/lakers-c-riot/README.md | 6 +++++- lakers-c/build.sh | 6 +++--- lakers-c/src/initiator.rs | 2 -- lakers-c/src/lib.rs | 2 +- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/examples/lakers-c-riot/Makefile b/examples/lakers-c-riot/Makefile index 0de0b146..a16ca8b5 100644 --- a/examples/lakers-c-riot/Makefile +++ b/examples/lakers-c-riot/Makefile @@ -8,8 +8,8 @@ BOARD ?= nrf52840dk INCLUDES += -I$(CURDIR)/../../target/include ARCHIVES += $(CURDIR)/../../target/thumbv7em-none-eabihf/release/liblakers_c.a -ifeq ($(EDHOC_CRYPTO), CRYPTO_PSA) - CFLAGS += -D$(EDHOC_CRYPTO) +ifeq ($(EDHOC_CRYPTO), psa) + CFLAGS += -DCRYPTO_PSA else CFLAGS += -DCRYPTO_CRYPTOCELL310 endif diff --git a/examples/lakers-c-riot/README.md b/examples/lakers-c-riot/README.md index 2931cef5..a71b2ff8 100644 --- a/examples/lakers-c-riot/README.md +++ b/examples/lakers-c-riot/README.md @@ -7,7 +7,11 @@ Compile and run: make flash term ``` +Add `EDHOC_CRYPTO=psa` if you want the `crypto-psa-baremetal` configuration. + # Requirements -- See the README in the `lakers-c` crate. +- `lakers-c` library and headers: + - either download them from the [releases page on GitHub](https://github.com/openwsn-berkeley/lakers/releases) + - or build yourself following the README in the `lakers-c` crate - [RIOT](https://github.com/RIOT-OS/RIOT)'s source code must be available in a local folder, which can be set via the `RIOTBASE` variable. diff --git a/lakers-c/build.sh b/lakers-c/build.sh index aee9a173..273749a0 100755 --- a/lakers-c/build.sh +++ b/lakers-c/build.sh @@ -28,9 +28,9 @@ cargo build --target="$rust_target" --no-default-features --features="$feature_ # cargo build --target=thumbv7em-none-eabihf --no-default-features --features="crypto-cryptocell310, ead-authz" --release # generate the headers -cbindgen --config ../shared/cbindgen.toml --crate lakers-shared --output ../target/include/lakers_shared.h -v -cbindgen --config ../ead/lakers-ead-authz/cbindgen.toml --crate lakers-ead-authz --output ../target/include/lakers_ead_authz.h -v -cbindgen --config ./cbindgen.toml --crate lakers-c --output ../target/include/lakers.h -v +cbindgen --config ../shared/cbindgen.toml --crate lakers-shared --output ../target/include/lakers_shared.h +cbindgen --config ../ead/lakers-ead-authz/cbindgen.toml --crate lakers-ead-authz --output ../target/include/lakers_ead_authz.h +cbindgen --config ./cbindgen.toml --crate lakers-c --output ../target/include/lakers.h # # zip to a single file cd ../target diff --git a/lakers-c/src/initiator.rs b/lakers-c/src/initiator.rs index 8aa7d27a..64f96401 100644 --- a/lakers-c/src/initiator.rs +++ b/lakers-c/src/initiator.rs @@ -1,5 +1,3 @@ -use core::slice; - use lakers::*; use lakers_crypto::{default_crypto, CryptoTrait}; diff --git a/lakers-c/src/lib.rs b/lakers-c/src/lib.rs index def1f95e..cff583aa 100644 --- a/lakers-c/src/lib.rs +++ b/lakers-c/src/lib.rs @@ -39,7 +39,7 @@ impl EADItemC { } } - pub unsafe fn copy_into_c(mut ead: EADItem, ead_c: *mut EADItemC) { + pub unsafe fn copy_into_c(ead: EADItem, ead_c: *mut EADItemC) { (*ead_c).label = ead.label; (*ead_c).is_critical = ead.is_critical; if let Some(value) = ead.value {