Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: remove MulAssign impl for Scalar #626

Merged
merged 3 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions frost-core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ Entries are listed in reverse chronological order.
* Removed `batch::Item::into()` which created a batch Item from a triple of
VerifyingKey, Signature and message. Use the new `batch::Item::new()` instead
(which can return an error).
* Removed the `MulAssign<Identifier<C>> for Scalar<C>` implementation since it
will result in a coherence error in future Rust versions (see #625). In the
unlikely case you're using this, you can replace e.g. `scalar *= identifier`
with `scalar = identifier * scalar`.

## 1.0.1

Expand Down
9 changes: 0 additions & 9 deletions frost-core/src/identifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,6 @@ where
}
}

impl<C> std::ops::MulAssign<Identifier<C>> for Scalar<C>
where
C: Ciphersuite,
{
fn mul_assign(&mut self, identifier: Identifier<C>) {
*self = *self * identifier.0
}
}

impl<C> std::ops::Sub for Identifier<C>
where
C: Ciphersuite,
Expand Down
2 changes: 1 addition & 1 deletion frost-core/src/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ fn evaluate_polynomial<C: Ciphersuite>(
let ell_scalar = identifier;
for coeff in coefficients.iter().skip(1).rev() {
value = value + *coeff;
value *= ell_scalar;
value = ell_scalar * value;
}
value = value
+ *coefficients
Expand Down
8 changes: 4 additions & 4 deletions frost-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,12 +306,12 @@ fn compute_lagrange_coefficient<C: Ciphersuite>(
}

if let Some(x) = x {
num *= x - *x_j;
den *= x_i - *x_j;
num = (x - *x_j) * num;
den = (x_i - *x_j) * den;
} else {
// Both signs inverted just to avoid requiring Neg (-*xj)
num *= *x_j;
den *= *x_j - x_i;
num = *x_j * num;
den = (*x_j - x_i) * den;
}
}
if !x_i_found {
Expand Down
Loading