Lines Matching refs:primes
83 Primes []*big.Int // prime factors of N, has >= 2 elements.
145 // CRTValues is used for the 3rd and subsequent primes. Due to a
146 // historical accident, the CRT for the first two primes is handled
156 R *big.Int // product of primes prior to this (inc p and q).
166 // Check that ?primes == n.
168 for _, prime := range priv.Primes {
169 // Any primes ? 1 will cause divide-by-zero panics later.
187 for _, prime := range priv.Primes {
210 // Table 1 in [2] suggests maximum numbers of primes for a given size.
224 // pi approximates the number of primes less than primeLimit
226 // Generated primes start with 11 (in binary) so we can only
233 return nil, errors.New("crypto/rsa: too few primes of given length to generate an RSA key")
237 primes := make([]*big.Int, nprimes)
258 primes[i], err = rand.Prime(random, todo/(nprimes-i))
262 todo -= primes[i].BitLen()
265 // Make sure that primes is pairwise unequal.
266 for i, prime := range primes {
268 if prime.Cmp(primes[j]) == 0 {
277 for _, prime := range primes {
298 priv.Primes = primes
433 // prime (being the product of two primes) rather than truly
454 priv.Precomputed.Dp = new(big.Int).Sub(priv.Primes[0], bigOne)
457 priv.Precomputed.Dq = new(big.Int).Sub(priv.Primes[1], bigOne)
460 priv.Precomputed.Qinv = new(big.Int).ModInverse(priv.Primes[1], priv.Primes[0])
462 r := new(big.Int).Mul(priv.Primes[0], priv.Primes[1])
463 priv.Precomputed.CRTValues = make([]CRTValue, len(priv.Primes)-2)
464 for i := 2; i < len(priv.Primes); i++ {
465 prime := priv.Primes[i]
525 m = new(big.Int).Exp(c, priv.Precomputed.Dp, priv.Primes[0])
526 m2 := new(big.Int).Exp(c, priv.Precomputed.Dq, priv.Primes[1])
529 m.Add(m, priv.Primes[0])
532 m.Mod(m, priv.Primes[0])
533 m.Mul(m, priv.Primes[1])
537 prime := priv.Primes[2+i]