mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
commit before working on acceleration code
This commit is contained in:
parent
d50b620f33
commit
89b3875bfc
3 changed files with 31 additions and 1 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
|
@ -549,6 +549,7 @@ checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d"
|
|||
dependencies = [
|
||||
"curve25519-dalek",
|
||||
"ed25519",
|
||||
"rand 0.7.3",
|
||||
"sha2",
|
||||
"zeroize",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ features = ["u32_backend"]
|
|||
version = "1.0.1"
|
||||
#path = "../../../ed25519-dalek"
|
||||
default-features = false
|
||||
features = ["u32_backend"]
|
||||
features = ["u32_backend", "rand"]
|
||||
|
||||
[target.'cfg(not(any(windows,unix)))'.dependencies]
|
||||
utralib = {path = "../../utralib"}
|
||||
|
|
|
|||
|
|
@ -291,6 +291,35 @@ impl<'a> ShellCmdApi<'a> for Engine {
|
|||
write!(ret, "x25519 key exchange fail").unwrap();
|
||||
}
|
||||
}
|
||||
"ed2" => {
|
||||
use ed25519_dalek::{Keypair, Signature, Signer};
|
||||
let keypair: Keypair;
|
||||
let good_sig: Signature;
|
||||
let bad_sig: Signature;
|
||||
|
||||
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);
|
||||
|
||||
if keypair.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() {
|
||||
write!(ret, "Verification of a signature on a different message failed, as expected.\n").unwrap();
|
||||
} 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() {
|
||||
write!(ret, "Verification of a signature on a different message failed, as expected.\n").unwrap();
|
||||
} else {
|
||||
write!(ret, "Verification of a signature on a different message passed (this is unexpected)!\n").unwrap();
|
||||
}
|
||||
}
|
||||
"ed" => {
|
||||
use ed25519_dalek::*;
|
||||
use ed25519::signature::Signature as _;
|
||||
|
|
|
|||
Loading…
Reference in a new issue