Skip to content
Open
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: 2 additions & 2 deletions ff_derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1189,7 +1189,7 @@ fn prime_field_impl(
impl ::ff::PrimeField for #name {
type Repr = #repr;

fn from_repr(r: #repr) -> ::ff::derive::subtle::CtOption<#name> {
fn from_repr(r: &#repr) -> ::ff::derive::subtle::CtOption<#name> {
#from_repr_impl

// Try to subtract the modulus
Expand All @@ -1207,7 +1207,7 @@ fn prime_field_impl(
::ff::derive::subtle::CtOption::new(r * &R2, is_some)
}

fn from_repr_vartime(r: #repr) -> Option<#name> {
fn from_repr_vartime(r: &#repr) -> Option<#name> {
#from_repr_impl

if r.is_valid() {
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ pub trait PrimeField: Field + From<u64> {
///
/// The byte representation is interpreted with the same endianness as elements
/// returned by [`PrimeField::to_repr`].
fn from_repr(repr: Self::Repr) -> CtOption<Self>;
fn from_repr(repr: &Self::Repr) -> CtOption<Self>;

/// Attempts to convert a byte representation of a field element into an element of
/// this prime field, failing if the input is not canonical (is not smaller than the
Expand All @@ -293,7 +293,7 @@ pub trait PrimeField: Field + From<u64> {
///
/// This method provides **no** constant-time guarantees. Implementors of the
/// `PrimeField` trait **may** optimise this method using non-constant-time logic.
fn from_repr_vartime(repr: Self::Repr) -> Option<Self> {
fn from_repr_vartime(repr: &Self::Repr) -> Option<Self> {
Self::from_repr(repr).into()
}

Expand Down