Adding identity element checks and ensuring non-zero scalar selection

This commit is contained in:
Kevin Lewi
2021-06-15 18:39:33 -07:00
committed by Kevin Lewi
parent 210e0e99df
commit 98f1821897
8 changed files with 148 additions and 24 deletions
+2 -1
View File
@@ -30,7 +30,8 @@ pub(crate) fn blind<R: RngCore + CryptoRng, G: GroupWithMapToCurve, H: Hash>(
input: &[u8],
blinding_factor_rng: &mut R,
) -> Result<(Token<G>, G), InternalPakeError> {
let blind = G::random_scalar(blinding_factor_rng);
// Choose a random scalar that must be non-zero
let blind = G::random_nonzero_scalar(blinding_factor_rng);
let dst = [STR_VOPRF, &G::get_context_string(MODE_BASE)].concat();
let mapped_point = G::map_to_curve::<H>(input, &dst)?;
let blind_token = mapped_point * &blind;