Skip to content

Commit

Permalink
refactor: Use crypto trait for EAD
Browse files Browse the repository at this point in the history
  • Loading branch information
chrysn committed Nov 15, 2023
1 parent f30d2d8 commit 31ff6a0
Show file tree
Hide file tree
Showing 5 changed files with 134 additions and 46 deletions.
1 change: 1 addition & 0 deletions ead/edhoc-ead-none/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ description = "EDHOC EAD none (just a placeholder)"

[dependencies]
edhoc-consts = { path = "../../consts" }
edhoc-crypto-trait = { path = "../../crypto/edhoc-crypto-trait" }
14 changes: 12 additions & 2 deletions ead/edhoc-ead-none/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
#![no_std]

use edhoc_consts::*;
use edhoc_crypto_trait::Crypto;

// TODO: the function signatures should not be necessarily the same as the zeroconf version
// find a way to be generic on this part.

// initiator side
pub fn i_prepare_ead_1(_x: &BytesP256ElemLen, _ss: u8) -> Option<EADItem> {
pub fn i_prepare_ead_1(
_crypto: &mut impl Crypto,
_x: &BytesP256ElemLen,
_ss: u8,
) -> Option<EADItem> {
None
}

pub fn i_process_ead_2(
_crypto: &mut impl Crypto,
_ead_2: EADItem,
_cred_v_u8: &[u8],
_h_message_1: &BytesHashLen,
Expand All @@ -23,7 +29,11 @@ pub fn i_prepare_ead_3() -> Option<EADItem> {
}

// responder side
pub fn r_process_ead_1(_ead_1: &EADItem, _message_1: &BufferMessage1) -> Result<(), ()> {
pub fn r_process_ead_1(
_crypto: &mut impl Crypto,
_ead_1: &EADItem,
_message_1: &BufferMessage1,
) -> Result<(), ()> {
Ok(())
}

Expand Down
5 changes: 4 additions & 1 deletion ead/edhoc-ead-zeroconf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ description = "EDHOC EAD zeroconf (draf-lake-authz)"

[dependencies]
edhoc-consts = { path = "../../consts" }
edhoc-crypto = { path = "../../crypto", default-features = false }
edhoc-crypto-trait = { path = "../../crypto/edhoc-crypto-trait" }
hacspec-lib = { version = "0.1.0-beta.1", default-features = false, optional = true }
hexlit = "0.5.3"

[dev-dependencies]
edhoc-crypto = { path = "../../crypto", default-features = false }

[features]
crypto-psa = [ "edhoc-crypto/psa" ]
crypto-hacspec = ["hacspec-lib/std", "edhoc-crypto/hacspec" ]
Loading

0 comments on commit 31ff6a0

Please sign in to comment.