3.2.3 Don't yield identity in Group::random

This commit is contained in:
Luke Parker 2023-02-23 04:14:07 -05:00
parent 40a6672547
commit 74647b1b52
No known key found for this signature in database

View file

@ -358,7 +358,11 @@ macro_rules! dalek_group {
bytes[31] |= u8::try_from(rng.next_u32() % 2).unwrap() << 7;
let opt = Self::from_bytes(&bytes);
if opt.is_some().into() {
return opt.unwrap();
let opt = opt.unwrap();
// Ban identity, per the trait specification
if !bool::from(opt.is_identity()) {
return opt;
}
}
}
}