Fix length of output Vec for `SharedSecret::batch_to_affine`

It was too long, and `group::Curve::batch_normalize` panics if its
inputs are not the same length (which would be the case if a batch
included an output with an invalid `ephemeral_key`).
This commit is contained in:
Jack Grigg 2021-08-12 13:40:56 +01:00
parent 8e13986101
commit c79acc0e08
1 changed files with 1 additions and 1 deletions

View File

@ -573,7 +573,7 @@ impl SharedSecret {
.iter()
.filter_map(|s| s.as_ref().map(|s| *(s.0)))
.collect();
let mut secrets_affine = vec![pallas::Affine::identity(); shared_secrets.len()];
let mut secrets_affine = vec![pallas::Affine::identity(); secrets.len()];
group::Curve::batch_normalize(&secrets, &mut secrets_affine);
secrets_affine
}