Skip to content

Commit d20c20b

Browse files
committed
API
1 parent 2121a6b commit d20c20b

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

src/ietf.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ impl<S: IetfSuite> Prover<S> for Secret<S> {
9191
fn prove(&self, input: Input<S>, output: Output<S>, ad: impl AsRef<[u8]>) -> Proof<S> {
9292
let k = S::nonce(&self.scalar, input);
9393

94-
let k_b = utils::mul_secret::<S>(k, S::generator()).into_affine();
95-
let k_h = utils::mul_secret::<S>(k, input.0).into_affine();
94+
let k_b = utils::mul_secret::<S>(S::generator(), k).into_affine();
95+
let k_h = utils::mul_secret::<S>(input.0, k).into_affine();
9696

9797
let c = S::challenge(
9898
&[&self.public.0, &input.0, &output.0, &k_b, &k_h],

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ impl<S: Suite> Secret<S> {
242242

243243
/// Get the VRF output point relative to input.
244244
pub fn output(&self, input: Input<S>) -> Output<S> {
245-
Output(utils::mul_secret::<S>(self.scalar, input.0).into_affine())
245+
Output(utils::mul_secret::<S>(input.0, self.scalar).into_affine())
246246
}
247247
}
248248

src/pedersen.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,17 @@ impl<S: PedersenSuite> Prover<S> for Secret<S> {
8989
let kb = S::nonce(&blinding, input);
9090

9191
// Yb = x*G + b*B
92-
let xg = utils::mul_secret::<S>(self.scalar, S::generator());
93-
let bb = utils::mul_secret::<S>(blinding, S::BLINDING_BASE);
92+
let xg = utils::mul_secret::<S>(S::generator(), self.scalar);
93+
let bb = utils::mul_secret::<S>(S::BLINDING_BASE, blinding);
9494
let pk_com = (xg + bb).into_affine();
9595

9696
// R = k*G + kb*B
97-
let kg = utils::mul_secret::<S>(k, S::generator());
98-
let kbb = utils::mul_secret::<S>(kb, S::BLINDING_BASE);
97+
let kg = utils::mul_secret::<S>(S::generator(), k);
98+
let kbb = utils::mul_secret::<S>(S::BLINDING_BASE, kb);
9999
let r = (kg + kbb).into_affine();
100100

101101
// Ok = k*I
102-
let ok = utils::mul_secret::<S>(k, input.0).into_affine();
102+
let ok = utils::mul_secret::<S>(input.0, k).into_affine();
103103

104104
// c = Hash(Yb, I, O, R, Ok, ad)
105105
let c = S::challenge(&[&pk_com, &input.0, &output.0, &r, &ok], ad.as_ref());

src/utils/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ type Projective<S> = <AffinePoint<S> as AffineRepr>::Group;
1919
/// retain the same sum. Incurs 2x penalty in scalar multiplications, but provides
2020
/// side channel defenses.
2121
#[cfg(feature = "secret-split")]
22-
pub(crate) fn mul_secret<S: Suite>(s: ScalarField<S>, p: AffinePoint<S>) -> Projective<S> {
22+
#[inline(always)]
23+
pub(crate) fn mul_secret<S: Suite>(p: AffinePoint<S>, s: ScalarField<S>) -> Projective<S> {
2324
use ark_std::UniformRand;
2425
let mut rng = ark_std::rand::rngs::OsRng;
2526
let x1 = ScalarField::<S>::rand(&mut rng);
@@ -30,6 +31,6 @@ pub(crate) fn mul_secret<S: Suite>(s: ScalarField<S>, p: AffinePoint<S>) -> Proj
3031
/// Point scalar multiplication with no secret splitting.
3132
#[cfg(not(feature = "secret-split"))]
3233
#[inline(always)]
33-
pub(crate) fn mul_secret<S: Suite>(s: ScalarField<S>, p: AffinePoint<S>) -> Projective<S> {
34+
pub(crate) fn mul_secret<S: Suite>(p: AffinePoint<S>, s: ScalarField<S>) -> Projective<S> {
3435
p * s
3536
}

0 commit comments

Comments
 (0)