wip: dumping deps to get curve25519 to 4.1.1

This commit is contained in:
David Kotval 2024-02-04 14:12:36 -06:00
parent 38855960fa
commit a70832b3ce
8 changed files with 1141 additions and 1045 deletions

2090
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -21,13 +21,13 @@ xous-semver = "0.1.2"
utralib = { version = "0.1.24", optional = true, default-features = false }
xous-ipc = "0.9.57"
num-derive = { version = "0.3.3", default-features = false }
num-derive = { version = "0.4.1", default-features = false }
num-traits = { version = "0.2.14", default-features = false }
rkyv = { version = "0.4.3", default-features = false, features = [
"const_generics",
] }
zeroize = "1.3.0"
rand_core = "0.5.1"
rand_core = "0.6.4"
aes-kw = { version = "0.2.1", features = ["alloc"] }
@ -63,7 +63,7 @@ keyboard = { path = "../keyboard" }
# private keys
#sha2 = {version = "0.9.5", default-features = false, features = []}
sha2 = { version = "0.10.8" }
digest = "0.9.0"
digest = "0.10.7"
aes = { path = "../aes" }
engine-25519 = { path = "../engine-25519" }
byteorder = "1.4.3" # used by keywrap
@ -71,15 +71,14 @@ byteorder = "1.4.3" # used by keywrap
hex = { version = "0.4.3", default-features = false, features = [] }
[dependencies.curve25519-dalek]
version = "3.1.0" # note this is patched to our fork in ./Cargo.toml
version = "4.1.1" # note this is patched to our fork in ./Cargo.toml
default-features = false
features = ["u32_backend", "betrusted"]
[dependencies.ed25519-dalek]
version = "1.0.1"
version = "2.1.0"
#path = "../../../ed25519-dalek"
default-features = false
features = ["u32_backend", "rand"]
features = ["rand_core"]
[features]
precursor = ["utralib/precursor", "sha2/precursor"]

View file

@ -1,7 +1,6 @@
mod rkyv_enum;
use core::mem::size_of;
use core::ops::{Deref, DerefMut};
pub use rkyv_enum::*;
pub(crate) const SERVER_NAME_KEYS: &str = "_Root key server and update manager_";

View file

@ -25,9 +25,9 @@ keyboard = { path = "../keyboard" }
susres = { package = "xous-api-susres", version = "0.9.53" }
codec = { path = "../codec" }
sha2 = { version = "0.10.8" }
digest = "0.9.0"
digest = "0.10.7"
aes = { path = "../aes" }
cipher = "0.3.0"
cipher = "0.4.4"
engine-25519 = { path = "../engine-25519" }
spinor = { path = "../spinor" }
root-keys = { path = "../root-keys" }
@ -44,7 +44,7 @@ locales = { path = "../../locales" }
trng = { path = "../trng" }
num-derive = { version = "0.3.3", default-features = false }
num-derive = { version = "0.4.1", default-features = false }
num-traits = { version = "0.2.14", default-features = false }
rkyv = { version = "0.4.3", default-features = false, features = [
"const_generics",
@ -97,20 +97,20 @@ random-pick = { version = "1.2.15", optional = true }
hex = { version = "0.4.3", default-features = false, features = [] }
#sha2 = {version = "0.9.5", default-features = false, features = []}
[dependencies.curve25519-dalek]
version = "3.1.0" # note this is patched to our fork in ./Cargo.toml
version = "4.1.1" # note this is patched to our fork in ./Cargo.toml
default-features = false
features = ["u32_backend", "betrusted"]
[dependencies.x25519-dalek]
version = "1.1.1"
version = "2.0.0"
# TODO: static_secrets is only needed by the engine tests. Ideally, we would put the static_secrets version in dev deps only
default-features = false
features = ["u32_backend"]
features = ["static_secrets"]
[dependencies.ed25519-dalek]
version = "1.0.1"
version = "2.1.0"
#path = "../../../ed25519-dalek"
default-features = false
features = ["u32_backend", "rand"]
features = ["rand_core"]
[features]
precursor = ["utralib/precursor", "sha2/precursor"]

View file

@ -465,24 +465,20 @@ impl<'a> ShellCmdApi<'a> for Engine {
}
}
"ed2" => {
use ed25519_dalek::{Keypair, Signature, Signer};
let keypair: Keypair;
let good_sig: Signature;
let bad_sig: Signature;
use ed25519_dalek::{Signature, Signer, SigningKey};
let good: &[u8] = "test message".as_bytes();
let bad: &[u8] = "wrong message".as_bytes();
keypair = Keypair::generate(&mut env.trng);
good_sig = keypair.sign(&good);
bad_sig = keypair.sign(&bad);
let signingkey = SigningKey::generate(&mut env.trng);
let good_sig = signingkey.sign(&good);
let bad_sig = signingkey.sign(&bad);
if keypair.verify(&good, &good_sig).is_ok() {
if signingkey.verify(&good, &good_sig).is_ok() {
write!(ret, "Verification of valid signtaure passed!\n").unwrap();
} else {
write!(ret, "Verification of valid signtaure failed!\n").unwrap();
}
if keypair.verify(&good, &bad_sig).is_err() {
if signingkey.verify(&good, &bad_sig).is_err() {
write!(
ret,
"Verification of a signature on a different message failed, as expected.\n"
@ -491,7 +487,7 @@ impl<'a> ShellCmdApi<'a> for Engine {
} else {
write!(ret, "Verification of a signature on a different message passed (this is unexpected)!\n").unwrap();
}
if keypair.verify(&bad, &good_sig).is_err() {
if signingkey.verify(&bad, &good_sig).is_err() {
write!(
ret,
"Verification of a signature on a different message failed, as expected.\n"
@ -507,20 +503,18 @@ impl<'a> ShellCmdApi<'a> for Engine {
use hex::FromHex;
let secret_key: &[u8] =
b"833fe62409237b9d62ec77587520911e9a759cec1d19755b7da901b96dca3d42";
let public_key: &[u8] =
let signing_key: &[u8] =
b"ec172b93ad5e563bf4932c70e1245034c35467ef2efd4d64ebf819683467e2bf";
let message: &[u8] = b"616263";
let signature: &[u8] = b"98a70222f0b8121aa9d30f813d683f809e462b469c7ff87639499bb94e6dae4131f85042463c2a355a2003d062adf5aaa10b8c61e636062aaad11c2a26083406";
let sec_bytes = <[u8; 32]>::from_hex(secret_key).unwrap();
let pub_bytes = <[u8; 32]>::from_hex(public_key).unwrap();
let msg_bytes = <[u8; 3]>::from_hex(message).unwrap();
let sig_bytes = <[u8; 64]>::from_hex(signature).unwrap();
let secret: SecretKey = SecretKey::from_bytes(&sec_bytes[..SECRET_KEY_LENGTH]).unwrap();
let public: PublicKey = PublicKey::from_bytes(&pub_bytes[..PUBLIC_KEY_LENGTH]).unwrap();
let keypair: Keypair = Keypair { secret, public };
let sig1: Signature = Signature::from_bytes(&sig_bytes[..]).unwrap();
let secret_key_bytes = <[u8; SECRET_KEY_LENGTH]>::from_hex(secret_key).unwrap();
let signing_key_bytes = <[u8; PUBLIC_KEY_LENGTH]>::from_hex(signing_key).unwrap();
let signature_bytes = <[u8; SIGNATURE_LENGTH]>::from_hex(signature).unwrap();
let signingkey: SigningKey = SigningKey::from_bytes(&signing_key_bytes);
let sig1: Signature = Signature::from_bytes(&signature_bytes);
//let mut prehash_for_signing = engine_sha512::Sha512::default(); // this defaults to Hw
// then Sw strategy let mut prehash_for_verifying =
@ -531,7 +525,7 @@ impl<'a> ShellCmdApi<'a> for Engine {
prehash_for_signing.update(&msg_bytes[..]);
prehash_for_verifying.update(&msg_bytes[..]);
let sig2: Signature = keypair.sign_prehashed(prehash_for_signing, None).unwrap();
let sig2: Signature = signingkey.sign_prehashed(prehash_for_signing, None).unwrap();
log::info!("original: {:02x?}", sig1);
log::info!("produced: {:02x?}", sig2);
@ -546,7 +540,7 @@ impl<'a> ShellCmdApi<'a> for Engine {
)
.unwrap();
}
if keypair.verify_prehashed(prehash_for_verifying, None, &sig2).is_err() {
if signingkey.verify_prehashed(prehash_for_verifying, None, &sig2).is_err() {
pass = false;
write!(ret, "Could not verify ed25519ph signature!").unwrap();
}

View file

@ -12,14 +12,14 @@ log-server = { package = "xous-api-log", version = "0.1.53" }
ticktimer-server = { package = "xous-api-ticktimer", version = "0.9.53" }
xous-names = { package = "xous-api-names", version = "0.9.55" }
log = "0.4.14"
num-derive = { version = "0.3.3", default-features = false }
num-derive = { version = "0.4.1", default-features = false }
num-traits = { version = "0.2.14", default-features = false }
susres = { package = "xous-api-susres", version = "0.9.53" }
rkyv = { version = "0.4.3", default-features = false, features = [
"const_generics",
] }
xous-ipc = "0.9.57"
rand_core = "0.5.1" # the 0.5.1 API is necessary for compatibility with curve25519-dalek crates
rand_core = "0.6.4" # the 0.6.4 API is necessary for compatibility with curve25519-dalek crates
utralib = { version = "0.1.24", optional = true, default-features = false }
[target.'cfg(any(windows,unix))'.dependencies]

View file

@ -28,13 +28,14 @@ cramium-hal = { path = "../../libs/cramium-hal", optional = true, default-featur
"std",
] }
[target.'cfg(target_arch = "arm")'.dependencies]
atsama5d27 = { git = "https://github.com/Foundation-Devices/atsama5d27.git", branch = "master", features = [
"lcd-console",
] }
xous = { version = "0.9.57", features = [
"v2p",
] } # v2p feature is used when lcd-console feature is turned on
# this depends on an old version of svd2utra. Removing for now. TODO: fix this
#[target.'cfg(target_arch = "arm")'.dependencies]
#atsama5d27 = { git = "https://github.com/Foundation-Devices/atsama5d27.git", branch = "master", features = [
# "lcd-console",
#] }
#xous = { version = "0.9.57", features = [
# "v2p",
#] } # v2p feature is used when lcd-console feature is turned on
[features]
cramium-soc = ["utralib/cramium-soc", "cramium-hal"]

View file

@ -25,11 +25,12 @@ num-traits = { version = "0.2.14", default-features = false }
xous-semver = "0.1.2"
utralib = { version = "0.1.24", optional = true, default-features = false }
[target.'cfg(target_arch = "arm")'.dependencies]
atsama5d27 = { git = "https://github.com/Foundation-Devices/atsama5d27.git", branch = "master" }
# TODO: fix this
#[target.'cfg(target_arch = "arm")'.dependencies]
#atsama5d27 = { git = "https://github.com/Foundation-Devices/atsama5d27.git", branch = "master" }
[features]
atsama5d27 = ["utralib/atsama5d27"]
#atsama5d27 = ["utralib/atsama5d27"]
# you may want to remove the watchdog feature if you're debugging a crash, as it will force the system to reboot automatically
precursor = ["utralib/precursor", "susres/precursor", "watchdog"]