Skip to content

Commit 79641e1

Browse files
authored
Fix modulus size check in check_public_with_max_size (#529)
It was checking the bits of precision, rather than the actual bit length of the key. Closes #528.
1 parent 087c3d3 commit 79641e1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/key.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ pub fn check_public(public_key: &impl PublicKeyParts) -> Result<()> {
622622
/// Check that the public key is well formed and has an exponent within acceptable bounds.
623623
#[inline]
624624
fn check_public_with_max_size(n: &BoxedUint, e: &BoxedUint, max_size: usize) -> Result<()> {
625-
if n.bits_precision() as usize > max_size {
625+
if n.bits_vartime() as usize > max_size {
626626
return Err(Error::ModulusTooLarge);
627627
}
628628

0 commit comments

Comments
 (0)