Update sim to run ecdsa sig + kw enc
This adds the functionality to build/run testing on images that were
signed using ECDSA and encrypted with KW, using tinycrypt.
Also when it this mode, ecdsa+kw, adds the Mbed-TLS submodule to the
build because the simulator needs to use the Mbed-TLS keywrapping
infrastructure to generate the keys sent to the image.
Signed-off-by: Fabio Utzig <utzig@apache.org>
diff --git a/sim/src/lib.rs b/sim/src/lib.rs
index 629b916..0fc9363 100644
--- a/sim/src/lib.rs
+++ b/sim/src/lib.rs
@@ -1196,6 +1196,13 @@
}
#[cfg(feature = "sig-ecdsa")]
+#[cfg(feature = "enc-kw")]
+fn make_tlv() -> TlvGen {
+ TlvGen::new_ecdsa_kw()
+}
+
+#[cfg(feature = "sig-ecdsa")]
+#[cfg(not(feature = "enc-kw"))]
fn make_tlv() -> TlvGen {
TlvGen::new_ecdsa()
}
@@ -1213,6 +1220,7 @@
}
#[cfg(not(feature = "sig-rsa"))]
+#[cfg(not(feature = "sig-ecdsa"))]
#[cfg(feature = "enc-kw")]
fn make_tlv() -> TlvGen {
TlvGen::new_enc_kw()
diff --git a/sim/src/tlv.rs b/sim/src/tlv.rs
index afc34aa..9aea50d 100644
--- a/sim/src/tlv.rs
+++ b/sim/src/tlv.rs
@@ -117,6 +117,16 @@
}
}
+ #[allow(dead_code)]
+ pub fn new_ecdsa_kw() -> TlvGen {
+ TlvGen {
+ flags: TlvFlags::ENCRYPTED as u32,
+ kinds: vec![TlvKinds::SHA256, TlvKinds::ECDSA256, TlvKinds::ENCKW128],
+ size: 4 + 32 + 4 + 32 + 4 + 72 + 4 + 24,
+ payload: vec![],
+ }
+ }
+
/// Retrieve the header flags for this configuration. This can be called at any time.
pub fn get_flags(&self) -> u32 {
self.flags