type Element --> struct FieldElement

This commit is contained in:
2019-05-16 17:27:29 -07:00
parent 4c03ab6648
commit 44618c2e2f
4 changed files with 1109 additions and 1105 deletions

View File

@@ -136,7 +136,7 @@ impl ED25519Public {
let mut a = Point::new();
x25519_ge_frombytes_vartime(&mut a, &self.public);
invert_vartime(&mut a);
a.invert();
let h_digest = eddsa_digest(signature_r, &self.public, msg);
let h = digest_scalar(&h_digest);
let mut r = Point2::new();
@@ -164,14 +164,6 @@ fn digest_scalar(digest: &[u8]) -> Vec<u8> {
copy[..32].to_vec()
}
fn invert_vartime(v: &mut Point)
{
for i in 0..NUM_ELEMENT_LIMBS {
v.x[i] = -v.x[i];
v.t[i] = -v.t[i];
}
}
#[cfg(test)]
fn run_signing_testcase(case: HashMap<String,(bool,Vec<u8>)>)
{
@@ -207,4 +199,4 @@ fn rfc8072() {
fn signing() {
let fname = "testdata/ed25519/sign.test";
run_test(fname.to_string(), 4, run_signing_testcase);
}
}