|
@@ -27,7 +27,7 @@ use pasta_curves::{
|
|
|
arithmetic::CurveExt,
|
|
arithmetic::CurveExt,
|
|
|
group::{
|
|
group::{
|
|
|
ff::{Field, FromUniformBytes},
|
|
ff::{Field, FromUniformBytes},
|
|
|
- GroupEncoding,
|
|
|
|
|
|
|
+ Group, GroupEncoding,
|
|
|
},
|
|
},
|
|
|
pallas,
|
|
pallas,
|
|
|
};
|
|
};
|
|
@@ -51,6 +51,7 @@ impl VrfProof {
|
|
|
/// a seed input `alpha_string`, and an RNG instance.
|
|
/// a seed input `alpha_string`, and an RNG instance.
|
|
|
pub fn prove(x: SecretKey, alpha_string: &[u8], rng: &mut (impl CryptoRng + RngCore)) -> Self {
|
|
pub fn prove(x: SecretKey, alpha_string: &[u8], rng: &mut (impl CryptoRng + RngCore)) -> Self {
|
|
|
let Y = PublicKey::from_secret(x);
|
|
let Y = PublicKey::from_secret(x);
|
|
|
|
|
+ assert!(!bool::from(Y.inner().is_identity()));
|
|
|
|
|
|
|
|
let mut message = vec![];
|
|
let mut message = vec![];
|
|
|
message.extend_from_slice(&Y.to_bytes());
|
|
message.extend_from_slice(&Y.to_bytes());
|
|
@@ -80,6 +81,10 @@ impl VrfProof {
|
|
|
|
|
|
|
|
/// Verify a `VrfProof` given a `Publickey` and a seed input `alpha_string`.
|
|
/// Verify a `VrfProof` given a `Publickey` and a seed input `alpha_string`.
|
|
|
pub fn verify(&self, Y: PublicKey, alpha_string: &[u8]) -> bool {
|
|
pub fn verify(&self, Y: PublicKey, alpha_string: &[u8]) -> bool {
|
|
|
|
|
+ if bool::from(Y.inner().is_identity()) {
|
|
|
|
|
+ return false
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
let mut message = vec![];
|
|
let mut message = vec![];
|
|
|
message.extend_from_slice(&Y.to_bytes());
|
|
message.extend_from_slice(&Y.to_bytes());
|
|
|
message.extend_from_slice(alpha_string);
|
|
message.extend_from_slice(alpha_string);
|