Lines Matching refs:primes
83 Primes []*big.Int // prime factors of N, has >= 2 elements.
143 // CRTValues is used for the 3rd and subsequent primes. Due to a
144 // historical accident, the CRT for the first two primes is handled
154 R *big.Int // product of primes prior to this (inc p and q).
164 // Check that ?primes == n.
166 for _, prime := range priv.Primes {
167 // Any primes ? 1 will cause divide-by-zero panics later.
185 for _, prime := range priv.Primes {
208 // Table 1 in [2] suggests maximum numbers of primes for a given size.
222 // pi approximates the number of primes less than primeLimit
224 // Generated primes start with 11 (in binary) so we can only
231 return nil, errors.New("crypto/rsa: too few primes of given length to generate an RSA key")
235 primes := make([]*big.Int, nprimes)
256 primes[i], err = rand.Prime(random, todo/(nprimes-i))
260 todo -= primes[i].BitLen()
263 // Make sure that primes is pairwise unequal.
264 for i, prime := range primes {
266 if prime.Cmp(primes[j]) == 0 {
275 for _, prime := range primes {
296 priv.Primes = primes
432 // prime (being the product of two primes) rather than truly
453 priv.Precomputed.Dp = new(big.Int).Sub(priv.Primes[0], bigOne)
456 priv.Precomputed.Dq = new(big.Int).Sub(priv.Primes[1], bigOne)
459 priv.Precomputed.Qinv = new(big.Int).ModInverse(priv.Primes[1], priv.Primes[0])
461 r := new(big.Int).Mul(priv.Primes[0], priv.Primes[1])
462 priv.Precomputed.CRTValues = make([]CRTValue, len(priv.Primes)-2)
463 for i := 2; i < len(priv.Primes); i++ {
464 prime := priv.Primes[i]
524 m = new(big.Int).Exp(c, priv.Precomputed.Dp, priv.Primes[0])
525 m2 := new(big.Int).Exp(c, priv.Precomputed.Dq, priv.Primes[1])
528 m.Add(m, priv.Primes[0])
531 m.Mod(m, priv.Primes[0])
532 m.Mul(m, priv.Primes[1])
536 prime := priv.Primes[2+i]