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
1 change: 1 addition & 0 deletions src/algorithms/reduction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ pub(crate) fn to_monty(x: &BoxedUint, p: &BoxedMontyParams) -> BoxedMontyForm {
#[cfg(test)]
mod tests {
use super::*;
use alloc::vec::Vec;
use crypto_bigint::Odd;

#[test]
Expand Down
3 changes: 2 additions & 1 deletion src/algorithms/rsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ pub(crate) fn compute_private_exponent_carmicheal(
#[cfg(test)]
mod tests {
use super::*;
use core::mem;

#[test]
fn recover_primes_works() {
Expand Down Expand Up @@ -482,7 +483,7 @@ mod tests {
let (mut p1, mut q1) = recover_primes(&NonZero::new(n).unwrap(), &e, &d).unwrap();

if p1 < q1 {
std::mem::swap(&mut p1, &mut q1);
mem::swap(&mut p1, &mut q1);
}
assert_eq!(p, p1);
assert_eq!(q, q1);
Expand Down
18 changes: 7 additions & 11 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![cfg_attr(not(test), no_std)]
#![no_std]
#![cfg_attr(docsrs, feature(doc_cfg))]
#![cfg_attr(feature = "getrandom", doc = include_str!("../README.md"))] // example needs `getrandom`
#![doc(html_logo_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo_small.png")]
Expand Down Expand Up @@ -174,10 +174,9 @@
//!
//! ### Example
//!
//! ```
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! # #[cfg(all(feature = "encoding", feature = "std"))]
//! # {
#![cfg_attr(feature = "encoding", doc = "```")]
#![cfg_attr(not(feature = "encoding"), doc = "```ignore")]
//! # fn main() -> Result<(), rsa::Error> {
//! use rsa::{PublicKey, pkcs1::DecodeRsaPublicKey};
//!
//! let pem = "-----BEGIN RSA PUBLIC KEY-----
Expand All @@ -190,7 +189,6 @@
//! -----END RSA PUBLIC KEY-----";
//!
//! let public_key = PublicKey::from_pkcs1_pem(pem)?;
//! # }
//! # Ok(())
//! # }
//! ```
Expand Down Expand Up @@ -218,10 +216,9 @@
//!
//! ### Example
//!
//! ```
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! # #[cfg(all(feature = "encoding", feature = "std"))]
//! # {
#![cfg_attr(feature = "encoding", doc = "```")]
#![cfg_attr(not(feature = "encoding"), doc = "```ignore")]
//! # fn main() -> Result<(), rsa::pkcs8::Error> {
//! use rsa::{PublicKey, pkcs8::DecodePublicKey};
//!
//! let pem = "-----BEGIN PUBLIC KEY-----
Expand All @@ -235,7 +232,6 @@
//! -----END PUBLIC KEY-----";
//!
//! let public_key = PublicKey::from_public_key_pem(pem)?;
//! # }
//! # Ok(())
//! # }
//! ```
Expand Down
1 change: 1 addition & 0 deletions src/oaep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ mod tests {
use crate::traits::{Decryptor, RandomizedDecryptor, RandomizedEncryptor};
use crate::{PrivateKey, PublicKey};

use alloc::boxed::Box;
use crypto_bigint::BoxedUint;
use digest::{Digest, FixedOutputReset};
use rand::rngs::ChaCha8Rng;
Expand Down
3 changes: 1 addition & 2 deletions src/pss.rs
Original file line number Diff line number Diff line change
Expand Up @@ -699,8 +699,7 @@ tAboUGBxTDq3ZroNism3DaMIbKPyYrAqhKov1h5V
fn test_sign_and_verify_2049bit_key() {
let plaintext = "Hello\n";
let mut rng = ChaCha8Rng::from_seed([42; 32]);
for i in 0..10 {
println!("round {i}");
for _ in 0..10 {
let priv_key = PrivateKey::new(&mut rng, 2049).unwrap();

let digest = Sha1::digest(plaintext.as_bytes()).to_vec();
Expand Down
Loading