Implement Clone for RSAKeyPair.

This commit is contained in:
Brian Smith 2018-05-07 14:04:50 -10:00
parent a31c1e6efb
commit 2b06760de8
3 changed files with 5 additions and 0 deletions

View File

@ -195,6 +195,7 @@ pub const MODULUS_MAX_LIMBS: usize = 8192 / limb::LIMB_BITS;
/// for efficient Montgomery multiplication modulo *m*. The value must be odd
/// and larger than 2. The larger-than-1 requirement is imposed, at least, by
/// the modular inversion code.
#[derive(Clone)]
pub struct Modulus<M> {
limbs: BoxedLimbs, // Also `value >= 3`.
@ -645,6 +646,7 @@ pub fn elem_exp_vartime<M>(
// `M` represents the prime modulus for which the exponent is in the interval
// [1, `m` - 1).
#[cfg(feature = "rsa_signing")]
#[derive(Clone)]
pub struct PrivateExponent<M> {
limbs: BoxedLimbs,
m: PhantomData<M>,

View File

@ -27,6 +27,7 @@ use untrusted;
/// `RSASigningState`s that reference the `RSAKeyPair` and use
/// `RSASigningState::sign()` to generate signatures. See `ring::signature`'s
/// module-level documentation for an example.
#[derive(Clone)]
pub struct RSAKeyPair {
n: bigint::Modulus<N>,
e: bigint::PublicExponent,
@ -381,6 +382,7 @@ impl RSAKeyPair {
}
}
#[derive(Clone)]
struct PrivatePrime<M: Prime> {
modulus: bigint::Modulus<M>,
exponent: bigint::PrivateExponent<M>,

View File

@ -160,6 +160,7 @@ fn test_signature_rsa_pss_sign() {
#[cfg(feature = "rsa_signing")]
#[test]
fn test_rsa_key_pair_sync_and_send() {
test::compile_time_assert_clone::<signature::RSAKeyPair>();
test::compile_time_assert_send::<signature::RSAKeyPair>();
test::compile_time_assert_sync::<signature::RSAKeyPair>();
test::compile_time_assert_send::<signature::RSASigningState>();