Skip to content

Commit

Permalink
primeorder: use PrimeField::NUM_BITS to bound scalar size when mult…
Browse files Browse the repository at this point in the history
…iplying (#1119)
  • Loading branch information
fjarri authored Feb 8, 2025
1 parent 7a91adb commit 6033a21
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions primeorder/src/projective.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use core::{
};
use elliptic_curve::{
array::ArraySize,
bigint::{ArrayEncoding, Bounded},
bigint::ArrayEncoding,
group::{
self,
cofactor::CofactorGroup,
Expand All @@ -26,7 +26,7 @@ use elliptic_curve::{
},
subtle::{Choice, ConditionallySelectable, ConstantTimeEq, CtOption},
zeroize::DefaultIsZeroes,
BatchNormalize, Error, FieldBytes, FieldBytesSize, PublicKey, Result, Scalar,
BatchNormalize, Error, FieldBytes, FieldBytesSize, PrimeField, PublicKey, Result, Scalar,
};

#[cfg(feature = "alloc")]
Expand Down Expand Up @@ -122,7 +122,7 @@ where
}

let mut q = Self::IDENTITY;
let mut pos = C::Uint::BITS as usize - 4;
let mut pos = (<Scalar<C> as PrimeField>::NUM_BITS.div_ceil(8) * 8) as usize - 4;

loop {
let slot = (k[pos >> 3] >> (pos & 7)) & 0xf;
Expand Down

0 comments on commit 6033a21

Please sign in to comment.