Skip to content

Commit

Permalink
Merge pull request openwsn-berkeley#171 from geonnave/more-renamings-…
Browse files Browse the repository at this point in the history
…for-0.4.0-alpha.1

Final renamings towards new `lakers` name
  • Loading branch information
geonnave authored Dec 12, 2023
2 parents 5e66807 + 4976fe3 commit e8c752b
Show file tree
Hide file tree
Showing 143 changed files with 116 additions and 114 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
strategy:
fail-fast: false
matrix:
crypto_backend: [edhoc-crypto/hacspec, edhoc-crypto/psa, edhoc-crypto/rustcrypto]
crypto_backend: [lakers-crypto/hacspec, lakers-crypto/psa, lakers-crypto/rustcrypto]
ead: [ead-none, ead-zeroconf]

steps:
Expand All @@ -39,7 +39,7 @@ jobs:
run: RUST_BACKTRACE=1 cargo test

- name: Run unit tests with feature matrix # note that we only add `--package lakers-ead-zeroconf` when testing with that config
run: RUST_BACKTRACE=1 cargo test -p lakers -p edhoc-crypto -p lakers-shared ${{ matrix.ead == 'ead-zeroconf' && '-p lakers-ead-zeroconf' || '' }} --no-default-features --features="${{ matrix.crypto_backend }}, ${{ matrix.ead }}" --no-fail-fast -- --test-threads 1
run: RUST_BACKTRACE=1 cargo test -p lakers -p lakers-crypto -p lakers-shared ${{ matrix.ead == 'ead-zeroconf' && '-p lakers-ead-zeroconf' || '' }} --no-default-features --features="${{ matrix.crypto_backend }}, ${{ matrix.ead }}" --no-fail-fast -- --test-threads 1


build-edhoc-package:
Expand All @@ -49,7 +49,7 @@ jobs:
strategy:
fail-fast: false
matrix:
crypto_backend: [edhoc-crypto/hacspec, edhoc-crypto/psa, edhoc-crypto/psa-baremetal, edhoc-crypto/cryptocell310, edhoc-crypto/rustcrypto]
crypto_backend: [lakers-crypto/hacspec, lakers-crypto/psa, lakers-crypto/psa-baremetal, lakers-crypto/cryptocell310, lakers-crypto/rustcrypto]
ead: [ead-none, ead-zeroconf]

steps:
Expand All @@ -62,7 +62,7 @@ jobs:
run: sudo apt-get -y update && sudo apt-get -y install gcc-arm-none-eabi

- name: Build
run: cargo build --package lakers --package edhoc-crypto --package lakers-ead-dispatch --no-default-features --features="${{ matrix.crypto_backend }}, ${{ matrix.ead }}" --release
run: cargo build --package lakers --package lakers-crypto --package lakers-ead-dispatch --no-default-features --features="${{ matrix.crypto_backend }}, ${{ matrix.ead }}" --release


generate-fstar:
Expand All @@ -79,7 +79,7 @@ jobs:
cd lakers
# generate the fstar files
cargo-hax -C -p lakers --no-default-features --features='edhoc-crypto/hacspec, ead-none' --release \; into -i '-lakers::generate_connection_identifier_cbor -lakers::generate_connection_identifier' fstar
cargo-hax -C -p lakers --no-default-features --features='lakers-crypto/hacspec, ead-none' --release \; into -i '-lakers::generate_connection_identifier_cbor -lakers::generate_connection_identifier' fstar
cargo-hax -C -p lakers-shared \; into fstar
# even if fstar generation was ok, fail if something is not implemented
Expand Down
36 changes: 18 additions & 18 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
members = [
"lib",
"ead",
"ead/edhoc-ead-none",
"ead/edhoc-ead-zeroconf",
"ead/lakers-ead-none",
"ead/lakers-ead-zeroconf",
"crypto",
"crypto/edhoc-crypto-cc2538",
"crypto/edhoc-crypto-hacspec",
"crypto/edhoc-crypto-psa",
"crypto/edhoc-crypto-rustcrypto",
"crypto/edhoc-crypto-cryptocell310-sys",
"crypto/lakers-crypto-cc2538",
"crypto/lakers-crypto-hacspec",
"crypto/lakers-crypto-psa",
"crypto/lakers-crypto-rustcrypto",
"crypto/lakers-crypto-cryptocell310-sys",
"examples/coap",
"examples/edhoc-rs-no_std",
"examples/edhoc-rs-cc2538",
Expand All @@ -22,7 +22,7 @@ default-members = [
"lib",
"ead",
"crypto",
"crypto/edhoc-crypto-hacspec",
"crypto/lakers-crypto-hacspec",
"examples/coap",
]

Expand All @@ -40,17 +40,17 @@ license = "BSD-3-Clause"

[workspace.dependencies]

edhoc-consts = { package = "lakers-shared", path = "consts/", version = "^0.4.0-alpha.1" }
edhoc-ead = { package = "lakers-ead-dispatch", path = "ead/", version = "^0.4.0-alpha.1", default-features = false }
edhoc-ead-none = { package = "lakers-ead-none", path = "ead/edhoc-ead-none/", version = "^0.4.0-alpha.1" }
edhoc-ead-zeroconf = { package = "lakers-ead-zeroconf", path = "ead/edhoc-ead-zeroconf/", version = "^0.4.0-alpha.1" }
edhoc-crypto = { path = "crypto/" }
lakers-shared = { package = "lakers-shared", path = "shared/", version = "^0.4.0-alpha.1" }
lakers-ead = { package = "lakers-ead-dispatch", path = "ead/", version = "^0.4.0-alpha.1", default-features = false }
lakers-ead-none = { package = "lakers-ead-none", path = "ead/lakers-ead-none/", version = "^0.4.0-alpha.1" }
lakers-ead-zeroconf = { package = "lakers-ead-zeroconf", path = "ead/lakers-ead-zeroconf/", version = "^0.4.0-alpha.1" }
lakers-crypto = { path = "crypto/" }

edhoc-crypto-cc2538 = { path = "crypto/edhoc-crypto-cc2538/" }
edhoc-crypto-cryptocell310 = { path = "crypto/edhoc-crypto-cryptocell310-sys/" }
edhoc-crypto-hacspec = { path = "crypto/edhoc-crypto-hacspec/" }
edhoc-crypto-psa = { path = "crypto/edhoc-crypto-psa/" }
edhoc-crypto-rustcrypto = { package = "lakers-crypto-rustcrypto", path = "crypto/edhoc-crypto-rustcrypto/", version = "^0.4.0-alpha.1" }
lakers-crypto-cc2538 = { path = "crypto/lakers-crypto-cc2538/" }
lakers-crypto-cryptocell310 = { path = "crypto/lakers-crypto-cryptocell310-sys/" }
lakers-crypto-hacspec = { path = "crypto/lakers-crypto-hacspec/" }
lakers-crypto-psa = { path = "crypto/lakers-crypto-psa/" }
lakers-crypto-rustcrypto = { package = "lakers-crypto-rustcrypto", path = "crypto/lakers-crypto-rustcrypto/", version = "^0.4.0-alpha.1" }

edhoc-rs = { package = "lakers", path = "lib/", version = "^0.4.0-alpha.1", default-features = false }

Expand Down
4 changes: 2 additions & 2 deletions build_for_c.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ echo "Changing crate-type to: $new_value"
sed -i -E "s/crate-type.*/$new_value/" lib/Cargo.toml

# generate the static library
cargo build --target thumbv7em-none-eabihf --package edhoc-rs --package edhoc-crypto --package edhoc-ead --features="$cargo_features" --release
cargo build --target thumbv7em-none-eabihf --package edhoc-rs --package lakers-crypto --package lakers-ead --features="$cargo_features" --release

# generate the headers
cbindgen --config consts/cbindgen.toml --crate edhoc-consts --output ./target/include/edhoc_consts.h -v
cbindgen --config consts/cbindgen.toml --crate lakers-shared --output ./target/include/lakers_shared.h -v
cbindgen --config lib/cbindgen.toml --crate edhoc-rs --output ./target/include/edhoc_rs.h -v

# zip to a single file
Expand Down
28 changes: 14 additions & 14 deletions crypto/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "edhoc-crypto"
name = "lakers-crypto"
version.workspace = true
edition = "2021"
authors = ["Mališa Vučinić <malisa.vucinic@inria.fr>"]
Expand All @@ -8,33 +8,33 @@ description = "EDHOC crypto library dispatch crate"
repository.workspace = true

[dependencies]
edhoc-consts = { package = "lakers-shared", path = "../consts", default-features = false }
lakers-shared = { package = "lakers-shared", path = "../shared", default-features = false }

# hacspec
edhoc-crypto-hacspec = { workspace = true, optional = true }
lakers-crypto-hacspec = { workspace = true, optional = true }

# cc2538 hardware accelerated
edhoc-crypto-cc2538 = { workspace = true, optional = true }
lakers-crypto-cc2538 = { workspace = true, optional = true }

# psa
edhoc-crypto-psa = { workspace = true, default-features = false, optional = true }
lakers-crypto-psa = { workspace = true, default-features = false, optional = true }

# cryptocell for nrf52840
edhoc-crypto-cryptocell310 = { workspace = true, optional = true }
lakers-crypto-cryptocell310 = { workspace = true, optional = true }

# software implementations from rustcrypto
edhoc-crypto-rustcrypto = { workspace = true, optional = true }
lakers-crypto-rustcrypto = { workspace = true, optional = true }
rand_core = { version = "0.6.4", optional = true, default-features = false }

[features]
default = [ ]
hacspec = [ "edhoc-crypto-hacspec" ]
cc2538 = [ "edhoc-crypto-cc2538" ]
psa = [ "edhoc-crypto-psa" ]
psa-baremetal = [ "psa", "edhoc-crypto-psa/baremetal" ]
cryptocell310 = [ "edhoc-crypto-cryptocell310" ]
hacspec = [ "lakers-crypto-hacspec" ]
cc2538 = [ "lakers-crypto-cc2538" ]
psa = [ "lakers-crypto-psa" ]
psa-baremetal = [ "psa", "lakers-crypto-psa/baremetal" ]
cryptocell310 = [ "lakers-crypto-cryptocell310" ]
# This requires std because we need to conjure randomness from thin air;
# embedded systems can still use rustcrypto but need to provide a crypto from
# edhoc-crypto-rustcrypto on their own, and combine it with an entropy choice
# lakers-crypto-rustcrypto on their own, and combine it with an entropy choice
# of their avail.
rustcrypto = [ "edhoc-crypto-rustcrypto", "rand_core/getrandom" ]
rustcrypto = [ "lakers-crypto-rustcrypto", "rand_core/getrandom" ]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "edhoc-crypto-cc2538"
name = "lakers-crypto-cc2538"
version.workspace = true
edition = "2021"
authors = ["Mališa Vučinić <malisa.vucinic@inria.fr>"]
Expand All @@ -8,7 +8,7 @@ description = "EDHOC crypto library cc2538 backend"
repository.workspace = true

[dependencies]
edhoc-consts.workspace = true
lakers-shared.workspace = true
hacspec-lib = { version = "0.1.0-beta.1", default-features = false, features = [ "alloc" ] }
cortex-m = { version = "0.7.4" }
cortex-m-rt = { version = "0.7.1" }
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![no_std]

use edhoc_consts::*;
use lakers_shared::*;

use cc2538_hal::crypto::aes_engine::ccm::AesCcmInfo;
use cc2538_hal::crypto::aes_engine::keys::{AesKey, AesKeySize, AesKeys};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "edhoc-crypto-cryptocell310"
name = "lakers-crypto-cryptocell310"
version.workspace = true
edition = "2021"
authors = ["Mališa Vučinić <malisa.vucinic@inria.fr>"]
Expand All @@ -9,7 +9,7 @@ links = "nrf_cc310_0.9.13"
repository.workspace = true

[dependencies]
edhoc-consts.workspace = true
lakers-shared.workspace = true

[build-dependencies]
bindgen = "0.69.1"
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));

use core::ffi::c_void;
use edhoc_consts::{Crypto as CryptoTrait, *};
use lakers_shared::{Crypto as CryptoTrait, *};

fn convert_array(input: &[u32]) -> [u8; SHA256_DIGEST_LEN] {
assert!(input.len() == SHA256_DIGEST_LEN / 4);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "edhoc-crypto-hacspec"
name = "lakers-crypto-hacspec"
version.workspace = true
edition = "2021"
authors = ["Mališa Vučinić <malisa.vucinic@inria.fr>"]
Expand All @@ -8,7 +8,7 @@ description = "EDHOC crypto library hacspec backend"
repository.workspace = true

[dependencies]
edhoc-consts.workspace = true
lakers-shared.workspace = true
hacspec-lib = { version = "0.1.0-beta.1", default-features = false }
hacspec-p256 = { version = "0.1.0" }
hacspec-hkdf = { version = "0.1.0" }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#![no_std]

use edhoc_consts::{Crypto as CryptoTrait, *};
use hacspec_aes::*;
use hacspec_aes_ccm::*;
use hacspec_hkdf::*;
use hacspec_lib::*;
use hacspec_p256::*;
use hacspec_sha256::*;
use lakers_shared::{Crypto as CryptoTrait, *};
use rand::Rng;

// Types and functions to aid in translation between the hacspec and non-hacspec world
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "edhoc-crypto-psa"
name = "lakers-crypto-psa"
version.workspace = true
edition = "2021"
authors = ["Kaspar Schleiser <kaspar@schleiser.de>"]
Expand All @@ -8,7 +8,7 @@ description = "EDHOC crypto library PSA backend"
repository.workspace = true

[dependencies]
edhoc-consts.workspace = true
lakers-shared.workspace = true
psa-crypto = { version = "0.9.2" }

[features]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![no_std]

use edhoc_consts::{Crypto as CryptoTrait, *};
use lakers_shared::{Crypto as CryptoTrait, *};
use psa_crypto::operations::hash::hash_compute;
use psa_crypto::operations::{aead, key_agreement, key_management, other::generate_random};
use psa_crypto::types::algorithm::Hash;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ description = "EDHOC crypto library backend based on the RustCrypto crates"
repository.workspace = true

[dependencies]
edhoc-consts.workspace = true
lakers-shared.workspace = true

aead = { version = "0.5.2", default-features = false }
aes = { version = "0.8.3", default-features = false }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![no_std]

use edhoc_consts::{
use lakers_shared::{
BufferCiphertext3, BufferPlaintext3, BytesCcmIvLen, BytesCcmKeyLen, BytesHashLen,
BytesMaxBuffer, BytesMaxInfoBuffer, BytesP256ElemLen, Crypto as CryptoTrait, EDHOCError,
AES_CCM_TAG_LEN, MAX_BUFFER_LEN,
Expand Down Expand Up @@ -30,7 +30,7 @@ impl<Rng: rand_core::RngCore + rand_core::CryptoRng> Crypto<Rng> {

impl<Rng: rand_core::RngCore + rand_core::CryptoRng> core::fmt::Debug for Crypto<Rng> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> Result<(), core::fmt::Error> {
f.debug_struct("edhoc_crypto_rustcrypto::Crypto")
f.debug_struct("lakers_crypto_rustcrypto::Crypto")
.field("rng", &core::any::type_name::<Rng>())
.finish()
}
Expand Down
20 changes: 10 additions & 10 deletions crypto/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,42 @@
#![no_std]

/// Convenience re-export
pub use edhoc_consts::Crypto as CryptoTrait;
pub use lakers_shared::Crypto as CryptoTrait;

#[cfg(feature = "hacspec")]
pub type Crypto = edhoc_crypto_hacspec::Crypto;
pub type Crypto = lakers_crypto_hacspec::Crypto;

#[cfg(feature = "hacspec")]
pub const fn default_crypto() -> Crypto {
edhoc_crypto_hacspec::Crypto
lakers_crypto_hacspec::Crypto
}

// FIXME: Does not work with crypto-as-trait yet
#[cfg(feature = "cc2538")]
pub use edhoc_crypto_cc2538::*;
pub use lakers_crypto_cc2538::*;

#[cfg(any(feature = "psa", feature = "psa-rust",))]
pub type Crypto = edhoc_crypto_psa::Crypto;
pub type Crypto = lakers_crypto_psa::Crypto;

#[cfg(any(feature = "psa", feature = "psa-rust",))]
pub const fn default_crypto() -> Crypto {
edhoc_crypto_psa::Crypto
lakers_crypto_psa::Crypto
}

#[cfg(feature = "rustcrypto")]
pub type Crypto = edhoc_crypto_rustcrypto::Crypto<rand_core::OsRng>;
pub type Crypto = lakers_crypto_rustcrypto::Crypto<rand_core::OsRng>;

#[cfg(feature = "rustcrypto")]
pub const fn default_crypto() -> Crypto {
edhoc_crypto_rustcrypto::Crypto::new(rand_core::OsRng)
lakers_crypto_rustcrypto::Crypto::new(rand_core::OsRng)
}

#[cfg(any(feature = "cryptocell310", feature = "cryptocell310-rust"))]
pub type Crypto = edhoc_crypto_cryptocell310::Crypto;
pub type Crypto = lakers_crypto_cryptocell310::Crypto;

#[cfg(any(feature = "cryptocell310", feature = "cryptocell310-rust"))]
pub const fn default_crypto() -> Crypto {
edhoc_crypto_cryptocell310::Crypto
lakers_crypto_cryptocell310::Crypto
}

/// See test_implements_crypto
Expand Down
10 changes: 5 additions & 5 deletions ead/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ description = "EDHOC EAD library dispatch crate"
repository.workspace = true

[dependencies]
edhoc-consts.workspace = true
lakers-shared.workspace = true

edhoc-ead-none = { workspace = true, optional = true }
edhoc-ead-zeroconf = { workspace = true, optional = true }
lakers-ead-none = { workspace = true, optional = true }
lakers-ead-zeroconf = { workspace = true, optional = true }

[features]
default = [ "ead-none" ]
ead-none = [ "edhoc-ead-none" ]
ead-zeroconf = [ "edhoc-ead-zeroconf" ]
ead-none = [ "lakers-ead-none" ]
ead-zeroconf = [ "lakers-ead-zeroconf" ]
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ description = "EDHOC EAD none (just a placeholder)"
repository.workspace = true

[dependencies]
edhoc-consts.workspace = true
lakers-shared.workspace = true
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![no_std]

use edhoc_consts::*;
use lakers_shared::*;

// TODO: the function signatures should not be necessarily the same as the zeroconf version
// find a way to be generic on this part.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ description = "EDHOC EAD zeroconf (draf-lake-authz)"
repository.workspace = true

[dependencies]
edhoc-consts.workspace = true
lakers-shared.workspace = true

[dev-dependencies]
edhoc-crypto.workspace = true
lakers-crypto.workspace = true
hexlit = "0.5.3"
Loading

0 comments on commit e8c752b

Please sign in to comment.