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
2 changes: 1 addition & 1 deletion p224/src/arithmetic/field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const MODULUS: Uint =
#[derive(Clone, Copy, Debug)]
pub struct FieldElement(pub(super) Uint);

primeorder::impl_field_element!(
primeorder::impl_mont_field_element!(
NistP224,
FieldElement,
FieldBytes,
Expand Down
2 changes: 1 addition & 1 deletion p224/src/arithmetic/scalar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ use core::ops::{Add, Mul, Sub};
#[derive(Clone, Copy, Debug, PartialOrd, Ord)]
pub struct Scalar(Uint);

primeorder::impl_field_element!(
primeorder::impl_mont_field_element!(
NistP224,
Scalar,
FieldBytes,
Expand Down
2 changes: 1 addition & 1 deletion p256/src/arithmetic/field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const R_2: U256 =
#[derive(Clone, Copy, Debug)]
pub struct FieldElement(pub(crate) U256);

primeorder::impl_field_element!(
primeorder::impl_mont_field_element!(
NistP256,
FieldElement,
FieldBytes,
Expand Down
2 changes: 1 addition & 1 deletion p384/src/arithmetic/field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub(crate) const MODULUS: U384 = U384::from_be_hex(FieldElement::MODULUS);
#[derive(Clone, Copy, Debug)]
pub struct FieldElement(pub(super) U384);

primeorder::impl_field_element!(
primeorder::impl_mont_field_element!(
NistP384,
FieldElement,
FieldBytes,
Expand Down
2 changes: 1 addition & 1 deletion p384/src/arithmetic/scalar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ use core::ops::{Add, Mul, Sub};
#[derive(Clone, Copy, Debug, PartialOrd, Ord)]
pub struct Scalar(U384);

primeorder::impl_field_element!(
primeorder::impl_mont_field_element!(
NistP384,
Scalar,
FieldBytes,
Expand Down
2 changes: 0 additions & 2 deletions p521/src/arithmetic/field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
clippy::identity_op,
rustdoc::bare_urls
)]
// TODO(tarcieri): use all variables
#![allow(unused_variables)]

// TODO(tarcieri): 32-bit backend?
#[path = "field/p521_64.rs"]
Expand Down
17 changes: 10 additions & 7 deletions primeorder/src/field.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/// Provides both inherent and trait impls for a field element type which are
/// backed by a core set of arithmetic functions specified as macro arguments.
/// Implements a field element type whose internal representation is in
/// Montgomery form, providing a combination of trait impls and inherent impls
/// which are `const fn` where possible.
///
/// Accepts a set of `const fn` arithmetic operation functions as arguments.
///
/// # Inherent impls
/// - `const ZERO: Self`
Expand Down Expand Up @@ -42,7 +45,7 @@
/// - `MulAssign`
/// - `Neg`
#[macro_export]
macro_rules! impl_field_element {
macro_rules! impl_mont_field_element {
(
$curve:tt,
$fe:tt,
Expand Down Expand Up @@ -364,9 +367,9 @@ macro_rules! impl_field_element {
}
}

$crate::impl_field_op!($fe, $uint, Add, add, $add);
$crate::impl_field_op!($fe, $uint, Sub, sub, $sub);
$crate::impl_field_op!($fe, $uint, Mul, mul, $mul);
$crate::impl_field_op!($fe, Add, add, $add);
$crate::impl_field_op!($fe, Sub, sub, $sub);
$crate::impl_field_op!($fe, Mul, mul, $mul);

impl AddAssign<$fe> for $fe {
#[inline]
Expand Down Expand Up @@ -449,7 +452,7 @@ macro_rules! impl_field_element {
/// which thunk to the given function.
#[macro_export]
macro_rules! impl_field_op {
($fe:tt, $uint:ty, $op:tt, $op_fn:ident, $func:ident) => {
($fe:tt, $op:tt, $op_fn:ident, $func:ident) => {
impl ::core::ops::$op for $fe {
type Output = $fe;

Expand Down