Remove redundant signature check
E::Fs guarantees its representation is in the field, implicitly enforcing that S < order(G).
This commit is contained in:
@@ -148,16 +148,18 @@ impl<E: JubjubEngine> PublicKey<E> {
|
|||||||
// c = H*(Rbar || M)
|
// c = H*(Rbar || M)
|
||||||
let c = h_star::<E>(&sig.rbar[..], msg);
|
let c = h_star::<E>(&sig.rbar[..], msg);
|
||||||
|
|
||||||
|
// Signature checks:
|
||||||
|
// R != invalid
|
||||||
let r = match Point::read(&sig.rbar[..], params) {
|
let r = match Point::read(&sig.rbar[..], params) {
|
||||||
Ok(r) => r,
|
Ok(r) => r,
|
||||||
Err(_) => return false,
|
Err(_) => return false,
|
||||||
};
|
};
|
||||||
|
// S < order(G)
|
||||||
|
// (E::Fs guarantees its representation is in the field)
|
||||||
let s = match read_scalar::<E, &[u8]>(&sig.sbar[..]) {
|
let s = match read_scalar::<E, &[u8]>(&sig.sbar[..]) {
|
||||||
Ok(s) => s,
|
Ok(s) => s,
|
||||||
Err(_) => return false,
|
Err(_) => return false,
|
||||||
};
|
};
|
||||||
// S < order(G)
|
|
||||||
s.into_repr() < E::Fs::char() &&
|
|
||||||
// S . P_G = R + c . vk
|
// S . P_G = R + c . vk
|
||||||
self.0.mul(c, params).add(&r, params) == params.generator(p_g).mul(s, params).into()
|
self.0.mul(c, params).add(&r, params) == params.generator(p_g).mul(s, params).into()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user