Tests for ed25519 verify.

This commit is contained in:
Gav
2018-01-18 12:31:34 +01:00
parent 3b850c7ed1
commit 07c14104f7
6 changed files with 54 additions and 9 deletions
+4 -7
View File
@@ -91,13 +91,10 @@ pub fn keccak256(data: &[u8]) -> [u8; 32] {
}
/// Verify a ed25519 signature.
pub fn ed25519_verify(sig: &[u8; 64], msg: &[u8], pubkey: &[u8; 32]) -> bool {
unsafe {
match ext_ed25519_verify(&msg[0], msg.len() as u32, &sig[0], &pubkey[0]) {
0 => false,
_ => true,
}
}
pub fn ed25519_verify(sig: &[u8], msg: &[u8], pubkey: &[u8]) -> bool {
sig.len() != 64 || pubkey.len() != 32 || unsafe {
ext_ed25519_verify(&msg[0], msg.len() as u32, &sig[0], &pubkey[0])
} == 0
}
pub trait Printable {