Skip to content

Commit

Permalink
arithmetic: Move bn_mul_mont declaration to montgomery.
Browse files Browse the repository at this point in the history
  • Loading branch information
briansmith committed Dec 2, 2023
1 parent af471c9 commit 40e147d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
12 changes: 0 additions & 12 deletions src/arithmetic/bigint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -758,18 +758,6 @@ fn limbs_mont_square(r: &mut [Limb], m: &[Limb], n0: &N0, _cpu_features: cpu::Fe
}
}

prefixed_extern! {
// `r` and/or 'a' and/or 'b' may alias.
fn bn_mul_mont(
r: *mut Limb,
a: *const Limb,
b: *const Limb,
n: *const Limb,
n0: &N0,
num_limbs: c::size_t,
);
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down
20 changes: 19 additions & 1 deletion src/arithmetic/montgomery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ use crate::{bssl, c, limb::Limb};
// TODO: Stop calling this from C and un-export it.
#[allow(deprecated)]
prefixed_export! {
unsafe fn bn_mul_mont(
pub(super) unsafe fn bn_mul_mont(
r: *mut Limb,
a: *const Limb,
b: *const Limb,
Expand Down Expand Up @@ -218,6 +218,24 @@ prefixed_extern! {
fn limbs_mul_add_limb(r: *mut Limb, a: *const Limb, b: Limb, num_limbs: c::size_t) -> Limb;
}

#[cfg(any(
target_arch = "aarch64",
target_arch = "arm",
target_arch = "x86_64",
target_arch = "x86"
))]
prefixed_extern! {
// `r` and/or 'a' and/or 'b' may alias.
pub(super) fn bn_mul_mont(
r: *mut Limb,
a: *const Limb,
b: *const Limb,
n: *const Limb,
n0: &N0,
num_limbs: c::size_t,
);
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down

0 comments on commit 40e147d

Please sign in to comment.