Home
last modified time | relevance | path

Searched refs:primes (Results 1 – 25 of 122) sorted by relevance

12345

/netbsd-src/usr.sbin/sysinst/
H A Dfactor.c48 long primes[4800]; variable
65 primes[0] = 2; in build_primes()
66 primes[1] = 3; in build_primes()
68 for (pc = primes[num_primes-1]; pc < 46345 && pc*pc <= max; pc+=2) { in build_primes()
71 while (j < num_primes && primes[j] * primes[j] <= pc) { in build_primes()
72 if ((rem = pc % primes[j]) == 0) in build_primes()
77 primes[num_primes++] = pc; in build_primes()
97 while (i < num_primes && val % primes[i] != 0) i++; in factor()
101 val % primes[i] == 0) { in factor()
102 fact_list[(*num_fact)++] = primes[i]; in factor()
[all …]
/netbsd-src/crypto/external/bsd/openssl/dist/crypto/bn/
H A Dbn_prime.pl32 my @primes = ( 2 );
34 loop: while ($#primes < $num-1) {
38 for (my $i = 0; defined($primes[$i]) && $primes[$i] <= $s; $i++) {
39 next loop if ($p % $primes[$i]) == 0;
41 push(@primes, $p);
48 for (my $i = 0; $i <= $#primes; $i++) {
50 printf " %5d,", $primes[$i];
H A Dbn_prime.c297 BN_ULONG mod = BN_mod_word(w, primes[i]); in bn_is_prime_int()
301 return BN_is_word(w, primes[i]); in bn_is_prime_int()
484 BN_ULONG maxdelta = BN_MASK2 - primes[trial_divisions - 1]; in probable_prime()
494 BN_ULONG mod = BN_mod_word(rnd, (BN_ULONG)primes[i]); in probable_prime()
510 && square(primes[i]) > BN_get_word(rnd) + delta) in probable_prime()
512 if (safe ? (mods[i] + delta) % primes[i] <= 1 in probable_prime()
513 : (mods[i] + delta) % primes[i] == 0) { in probable_prime()
544 BN_ULONG maxdelta = BN_MASK2 - primes[trial_divisions - 1]; in probable_prime_dh()
579 BN_ULONG mod = BN_mod_word(rnd, (BN_ULONG)primes[i]); in probable_prime_dh()
589 && square(primes[i]) > BN_get_word(rnd) + delta) in probable_prime_dh()
[all …]
/netbsd-src/crypto/external/bsd/openssl.old/dist/crypto/bn/
H A Dbn_prime.pl31 my @primes = ( 2 );
33 loop: while ($#primes < $num-1) {
37 for (my $i = 0; defined($primes[$i]) && $primes[$i] <= $s; $i++) {
38 next loop if ($p % $primes[$i]) == 0;
40 push(@primes, $p);
47 for (my $i = 0; $i <= $#primes; $i++) {
49 printf " %5d,", $primes[$i];
H A Dbn_prime.c174 BN_ULONG mod = BN_mod_word(a, primes[i]); in BN_is_prime_fasttest_ex()
178 return BN_is_word(a, primes[i]); in BN_is_prime_fasttest_ex()
276 BN_ULONG maxdelta = BN_MASK2 - primes[NUMPRIMES - 1]; in probable_prime()
286 BN_ULONG mod = BN_mod_word(rnd, (BN_ULONG)primes[i]); in probable_prime()
302 && square(primes[i]) > BN_get_word(rnd) + delta) in probable_prime()
304 if (safe ? (mods[i] + delta) % primes[i] <= 1 in probable_prime()
305 : (mods[i] + delta) % primes[i] == 0) { in probable_prime()
327 BN_ULONG maxdelta = BN_MASK2 - primes[NUMPRIMES - 1]; in probable_prime_dh()
362 BN_ULONG mod = BN_mod_word(rnd, (BN_ULONG)primes[i]); in probable_prime_dh()
372 && square(primes[i]) > BN_get_word(rnd) + delta) in probable_prime_dh()
[all …]
/netbsd-src/crypto/external/bsd/openssl.old/dist/crypto/rsa/
H A Drsa_gen.c22 static int rsa_builtin_keygen(RSA *rsa, int bits, int primes, BIGNUM *e_value,
41 int RSA_generate_multi_prime_key(RSA *rsa, int bits, int primes, in RSA_generate_multi_prime_key() argument
46 return rsa->meth->rsa_multi_prime_keygen(rsa, bits, primes, in RSA_generate_multi_prime_key()
55 if (primes == 2) in RSA_generate_multi_prime_key()
61 return rsa_builtin_keygen(rsa, bits, primes, e_value, cb); in RSA_generate_multi_prime_key()
64 static int rsa_builtin_keygen(RSA *rsa, int bits, int primes, BIGNUM *e_value, in rsa_builtin_keygen() argument
82 if (primes < RSA_DEFAULT_PRIME_NUM || primes > rsa_multip_cap(bits)) { in rsa_builtin_keygen()
99 quo = bits / primes; in rsa_builtin_keygen()
100 rmd = bits % primes; in rsa_builtin_keygen()
102 for (i = 0; i < primes; i++) in rsa_builtin_keygen()
[all …]
/netbsd-src/external/lgpl3/gmp/dist/demos/
H A Dprimes.c55 struct primes struct
61 struct primes *primes; argument
194 primes = malloc (est_n_primes * sizeof primes[0]); in main()
201 n_primes, primes[n_primes - 1].prime); in main()
265 prime = primes[i].prime; in sieve_region()
267 if (primes[i].rem >= 0) in sieve_region()
269 start2 = primes[i].rem; in sieve_region()
294 primes[i].rem = ii - ssize; in sieve_region()
301 primes[i].rem = k; in sieve_region()
365 primes[n_primes].prime = j * 2 + 3; in make_primelist()
[all …]
/netbsd-src/crypto/external/bsd/openssl.old/dist/test/recipes/
H A D15-test_mp_rsa.t29 primes => '3',
34 primes => '4',
39 primes => '5',
53 my $primes = $param->{primes};
55 my $name = ($evp ? "evp" : "") . "${bits}p${primes}";
59 '-algorithm', 'RSA', '-pkeyopt', "rsa_keygen_primes:$primes",
63 '-primes', $primes, $bits])), "genrsa $name");
/netbsd-src/crypto/external/bsd/openssl/dist/crypto/rsa/
H A Drsa_gen.c31 static int rsa_keygen(OSSL_LIB_CTX *libctx, RSA *rsa, int bits, int primes,
50 int RSA_generate_multi_prime_key(RSA *rsa, int bits, int primes, in RSA_generate_multi_prime_key() argument
56 return rsa->meth->rsa_multi_prime_keygen(rsa, bits, primes, in RSA_generate_multi_prime_key()
65 if (primes == 2) in RSA_generate_multi_prime_key()
71 return rsa_keygen(rsa->libctx, rsa, bits, primes, e_value, cb, 0); in RSA_generate_multi_prime_key()
75 static int rsa_multiprime_keygen(RSA *rsa, int bits, int primes, in rsa_multiprime_keygen() argument
100 if (primes < RSA_DEFAULT_PRIME_NUM || primes > ossl_rsa_multip_cap(bits)) { in rsa_multiprime_keygen()
117 quo = bits / primes; in rsa_multiprime_keygen()
118 rmd = bits % primes; in rsa_multiprime_keygen()
120 for (i = 0; i < primes; i++) in rsa_multiprime_keygen()
[all …]
H A Drsa_lib.c479 int RSA_set0_multi_prime_params(RSA *r, BIGNUM *primes[], BIGNUM *exps[], in RSA_set0_multi_prime_params() argument
486 if (primes == NULL || exps == NULL || coeffs == NULL || pnum == 0) in RSA_set0_multi_prime_params()
500 if (primes[i] != NULL && exps[i] != NULL && coeffs[i] != NULL) { in RSA_set0_multi_prime_params()
504 pinfo->r = primes[i]; in RSA_set0_multi_prime_params()
575 int RSA_get0_multi_prime_factors(const RSA *r, const BIGNUM *primes[]) in RSA_get0_multi_prime_factors() argument
589 primes[i] = pinfo->r; in RSA_get0_multi_prime_factors()
743 int ossl_rsa_set0_all_params(RSA *r, const STACK_OF(BIGNUM) *primes, in DEFINE_STACK_OF()
752 if (primes == NULL || exps == NULL || coeffs == NULL) in DEFINE_STACK_OF()
755 pnum = sk_BIGNUM_num(primes); in DEFINE_STACK_OF()
759 if (!RSA_set0_factors(r, sk_BIGNUM_value(primes, 0), in DEFINE_STACK_OF()
[all …]
/netbsd-src/external/lgpl3/gmp/dist/tests/mpz/
H A Dt-perfpow.c109 mpz_t n, np, temp, primes[NRP]; in check_random() local
122 mpz_init (primes[i]); in check_random()
136 mpz_urandomb (primes[j], rands, primebits); in check_random()
137 mpz_nextprime (primes[j], primes[j]); in check_random()
141 if (mpz_cmp (primes[j], primes[k]) == 0) in check_random()
184 mpz_pow_ui (n, primes[0], exp[0]); in check_random()
187 mpz_pow_ui (temp, primes[j], exp[j]); in check_random()
198 gmp_printf("n = %Zu\nprimes[0] = %Zu\nexp[0] = %lu\n", n, primes[0], exp[0]); in check_random()
227 mpz_clear (primes[i]); in check_random()
/netbsd-src/crypto/external/bsd/openssl/dist/test/recipes/
H A D15-test_mp_rsa.t23 primes => '3',
28 primes => '4',
33 primes => '5',
56 my $primes = $param->{primes};
58 my $name = ($evp ? "evp" : "") . "${bits}p${primes}";
63 '-pkeyopt', "rsa_keygen_primes:$primes",
79 '-primes', $primes, $bits])), "genrsa $name");
/netbsd-src/crypto/external/bsd/openssl/dist/doc/internal/man3/
H A Dossl_rsa_get0_all_params.pod12 int ossl_rsa_get0_all_params(RSA *r, STACK_OF(BIGNUM_const) *primes,
15 int ossl_rsa_set0_all_params(RSA *r, const STACK_OF(BIGNUM) *primes,
21 ossl_rsa_set0_all_params() sets all primes, CRT exponents and CRT coefficients
22 in the B<RSA> object I<r> to the contents of the stacks of BIGNUMs I<primes>,
26 ossl_rsa_get0_all_params() gets all primes, CRT exponents and CRT coefficients
28 I<primes>, I<exps> and I<coeffs>. The B<RSA> object retains ownership of the
39 the I<primes> stack contains I<p>, I<q>, and then the rest of the primes
54 The number of primes must always be equal to the number of exponents, and
55 the number of coefficients must be one less than the number of primes.
/netbsd-src/crypto/external/bsd/openssl/dist/test/
H A Drsa_mp_test.c202 STACK_OF(BIGNUM) *primes = NULL, *exps = NULL, *coeffs = NULL; in key2048p3_v2()
206 if (!TEST_ptr(primes = sk_BIGNUM_new_null()) in key2048p3_v2()
212 || !TEST_int_ne(sk_BIGNUM_push(primes, num), 0) in key2048p3_v2()
214 || !TEST_int_ne(sk_BIGNUM_push(primes, num), 0) in key2048p3_v2()
216 || !TEST_int_ne(sk_BIGNUM_push(primes, num), 0)) in key2048p3_v2()
233 if (!TEST_true(ossl_rsa_set0_all_params(key, primes, exps, coeffs))) in key2048p3_v2()
237 sk_BIGNUM_free(primes); in key2048p3_v2()
242 sk_BIGNUM_pop_free(primes, BN_free); in key2048p3_v2()
245 primes = exps = coeffs = NULL; in key2048p3_v2()
/netbsd-src/external/gpl2/gettext/dist/gettext-tools/gnulib-lib/
H A Dgl_anyhash_list2.h26 static const size_t primes[] = variable
87 for (i = 0; i < sizeof (primes) / sizeof (primes[0]); i++) in next_prime()
88 if (primes[i] >= estimate) in next_prime()
89 return primes[i]; in next_prime()
/netbsd-src/games/quiz/datfiles/
H A Dseq-hard3 1,2,2,4,2,4,2,4,6,2:6{(diff of primes)}:diff{erences} [between|of] primes
15 3,7,31,127:8191{(Mersenne primes)}:Mersenne{ primes}
/netbsd-src/games/primes/
H A DMakefile4 PROG= primes
5 SRCS= pattern.c pr_tbl.c primes.c spsp.c
6 MAN= primes.6
/netbsd-src/crypto/external/bsd/openssl.old/dist/doc/man3/
H A DRSA_generate_key.pod13 int RSA_generate_multi_prime_key(RSA *rsa, int bits, int primes, BIGNUM *e, BN_GENCB *cb);
29 it in the B<RSA> structure provided in B<rsa>. The number of primes is given by
30 the B<primes> parameter. The random number generator must be seeded when
35 The modulus size will be of length B<bits>, the number of primes to form the
36 modulus will be B<primes>, and the public exponent will be B<e>. Key sizes
41 B<primes> depends on modulus bit length:
75 The process is then repeated for prime q and other primes (if any)
/netbsd-src/external/lgpl3/gmp/dist/mpz/
H A Dpprime_p.c114 unsigned int primes[15]; in mpz_probab_prime_p() local
129 if (r % primes[nprimes] == 0) in mpz_probab_prime_p()
131 ASSERT_ALWAYS (mpn_mod_1 (PTR(n), (mp_size_t) SIZ(n), (mp_limb_t) primes[nprimes]) == 0); in mpz_probab_prime_p()
141 primes[nprimes++] = q; in mpz_probab_prime_p()
/netbsd-src/crypto/external/bsd/openssl/dist/doc/man3/
H A DRSA_generate_key.pod20 int RSA_generate_multi_prime_key(RSA *rsa, int bits, int primes, BIGNUM *e, BN_GENCB *cb);
41 it in the B<RSA> structure provided in I<rsa>. The number of primes is given by
42 the I<primes> parameter.
46 The modulus size will be of length I<bits>, the number of primes to form the
47 modulus will be I<primes>, and the public exponent will be I<e>. Key sizes
52 I<primes> depends on modulus bit length:
86 The process is then repeated for prime q and other primes (if any)
/netbsd-src/crypto/external/cpl/trousers/dist/src/tspi/daa/daa_issuer/
H A Dprime_gen.c18 static unsigned long *primes; variable
94 primes = (unsigned long *)malloc(sizeof(unsigned long) * primes_length); in generate_small_primes()
95 if (primes == NULL) { in generate_small_primes()
103 primes[i++] = (unsigned long)current->obj; in generate_small_primes()
135 small_prime = primes[i++]; in test_small_prime_factors()
/netbsd-src/crypto/external/bsd/openssl.old/dist/apps/
H A Dgenrsa.c64 int ret = 1, num = DEFBITS, private = 0, primes = DEFPRIMES; in genrsa_main() local
111 if (!opt_int(opt_arg(), &primes)) in genrsa_main()
143 num, primes); in genrsa_main()
149 || !RSA_generate_multi_prime_key(rsa, num, primes, bn, cb)) in genrsa_main()
/netbsd-src/external/lgpl3/gmp/dist/tests/devel/
H A Dprimes.c131 mp_limb_t *sieve, *primes; in check_pprime() local
140 primes = __GMP_ALLOCATE_FUNC_LIMBS (size_p); in check_pprime()
141 gmp_primesieve (primes, start); in check_pprime()
149 block_resieve (sieve, BLOCK_SIZE, off, primes); in check_pprime()
178 __GMP_FREE_FUNC_LIMBS (primes, size_p); in check_pprime()
/netbsd-src/crypto/external/bsd/openssl/dist/doc/man7/
H A DEVP_PKEY-RSA.pod121 =item "primes" (B<OSSL_PKEY_PARAM_RSA_PRIMES>) <unsigned integer>
123 The value should be the number of primes for the generated B<RSA> key. The
124 default is 2. It isn't permitted to specify a larger number of primes than
125 10. Additionally, the number of primes is limited by the length of the key
181 The auxiliary probable primes.
203 OpenSSL default provider allows testing of the validity of multi-primes.
244 unsigned int primes = 3;
253 params[1] = OSSL_PARAM_construct_uint("primes", &primes);
/netbsd-src/external/lgpl3/gmp/dist/mini-gmp/tests/
H A Dt-pprime_p.c151 static const char * const primes[] = { in check_primes() local
169 for (i = 0; primes[i]; i++) in check_primes()
171 mpz_set_str_or_abort (n, primes[i], 0); in check_primes()

12345