Skip to content
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
12 changes: 12 additions & 0 deletions elliptic-curve/src/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@ pub trait BatchInvert: Field {
fn batch_invert_in_place(elements: &mut [Self], scratch_space: &mut [Self]) -> Self {
BatchInverter::invert_with_external_scratch(elements, scratch_space)
}

/// Variable-time batch inversion.
///
/// <div class="warning">
/// <b>Security Warning</b>
///
/// This should NOT be used on secret values!
/// </b>
fn batch_invert_in_place_vartime(elements: &mut [Self], scratch_space: &mut [Self]) -> Self {
// Call the constant-time implementation by default
Self::batch_invert_in_place(elements, scratch_space)
}
}

/// Perform a doubling (i.e. `self + self`).
Expand Down
15 changes: 14 additions & 1 deletion elliptic-curve/src/point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,20 @@ pub trait BatchNormalize<Points: ?Sized> {
/// Perform a batched conversion to affine representation on a sequence of projective points
/// at an amortized cost that should be practically as efficient as a single conversion.
/// Internally, implementors should rely upon `InvertBatch`.
fn batch_normalize(points: &Points) -> <Self as BatchNormalize<Points>>::Output;
fn batch_normalize(points: &Points) -> Self::Output;

/// Perform a batched conversion to affine representation on a sequence of projective points
/// in variable-time.
///
/// <div class="warning">
/// <b>Security Warning</b>
///
/// This should NOT be used on points which represent secrets!
/// </b>
fn batch_normalize_vartime(points: &Points) -> Self::Output {
// Call the constant-time implementation by default
Self::batch_normalize(points)
}
}

/// Decompress an elliptic curve point.
Expand Down