Lines Matching refs:bigint
16 bigint::{self, Prime},
33 qInv: bigint::Elem<P, R>,
34 qq: bigint::Modulus<QQ>,
35 q_mod_n: bigint::Elem<N, R>,
198 let (p, p_bits) = bigint::Nonnegative::from_be_bytes_with_bit_length(p) in from_der_reader()
200 let (q, q_bits) = bigint::Nonnegative::from_be_bytes_with_bit_length(q) in from_der_reader()
295 let q_mod_n = bigint::elem_mul( in from_der_reader()
303 let pq_mod_n = bigint::elem_mul(&q_mod_n, p_mod_n, &public_key.n); in from_der_reader()
315 let (d, d_bits) = bigint::Nonnegative::from_be_bytes_with_bit_length(d) in from_der_reader()
342 bigint::Elem::from_be_bytes_padded(qInv, &p.modulus) in from_der_reader()
347 let q_mod_p = bigint::elem_mul(p.modulus.oneRR().as_ref(), q_mod_p.clone(), &p.modulus); in from_der_reader()
348 bigint::elem_inverse_consttime(q_mod_p, &p.modulus) in from_der_reader()
357 let qInv = bigint::elem_mul(p.modulus.oneRR().as_ref(), qInv, &p.modulus); in from_der_reader()
358 bigint::verify_inverses_consttime(&qInv, q_mod_p, &p.modulus) in from_der_reader()
361 let qq = bigint::elem_mul(&q_mod_n, q_mod_n_decoded, &public_key.n).into_modulus::<QQ>()?; in from_der_reader()
435 modulus: bigint::Modulus<M>,
436 exponent: bigint::PrivateExponent<M>,
442 fn new(p: bigint::Nonnegative, dP: untrusted::Input) -> Result<Self, KeyRejected> { in new()
443 let (p, p_bits) = bigint::Modulus::from_nonnegative_with_bit_length(p)?; in new()
449 let dP = bigint::PrivateExponent::from_be_bytes_padded(dP, &p) in new()
469 c: &bigint::Elem<MM>, in elem_exp_consttime()
471 ) -> Result<bigint::Elem<M>, error::Unspecified> in elem_exp_consttime()
473 M: bigint::NotMuchSmallerModulus<MM>, in elem_exp_consttime()
476 let c_mod_m = bigint::elem_reduced(c, &p.modulus); in elem_exp_consttime()
479 let c_mod_m = bigint::elem_mul(p.modulus.oneRR().as_ref(), c_mod_m, &p.modulus); in elem_exp_consttime()
480 let c_mod_m = bigint::elem_mul(p.modulus.oneRR().as_ref(), c_mod_m, &p.modulus); in elem_exp_consttime()
481 bigint::elem_exp_consttime(c_mod_m, &p.exponent, &p.modulus) in elem_exp_consttime()
490 unsafe impl bigint::SmallerModulus<N> for P {}
491 unsafe impl bigint::NotMuchSmallerModulus<N> for P {}
495 unsafe impl bigint::SmallerModulus<N> for QQ {}
496 unsafe impl bigint::NotMuchSmallerModulus<N> for QQ {}
503 unsafe impl bigint::SlightlySmallerModulus<N> for QQ {}
508 unsafe impl bigint::SmallerModulus<N> for Q {}
509 unsafe impl bigint::SmallerModulus<P> for Q {}
512 unsafe impl bigint::SlightlySmallerModulus<P> for Q {}
514 unsafe impl bigint::SmallerModulus<QQ> for Q {}
515 unsafe impl bigint::NotMuchSmallerModulus<QQ> for Q {}
555 let base = bigint::Elem::from_be_bytes_padded(untrusted::Input::from(signature), n)?; in sign()
562 let c_mod_qq = bigint::elem_reduced_once(&c, &self.qq); in sign()
569 let m_2 = bigint::elem_widen(m_2, p); in sign()
570 let m_1_minus_m_2 = bigint::elem_sub(m_1, &m_2, p); in sign()
571 let h = bigint::elem_mul(&self.qInv, m_1_minus_m_2, p); in sign()
577 let h = bigint::elem_widen(h, n); in sign()
578 let q_times_h = bigint::elem_mul(&self.q_mod_n, h, n); in sign()
579 let m_2 = bigint::elem_widen(m_2, n); in sign()
580 let m = bigint::elem_add(m_2, q_times_h, n); in sign()
593 let verify = bigint::elem_exp_vartime(m.clone(), self.public.e, n); in sign()
595 bigint::elem_verify_equal_consttime(&verify, &c)?; in sign()