Lines Matching defs:ctx
23 BN_CTX *ctx);
26 BN_CTX *ctx);
27 static int bn_is_prime_int(const BIGNUM *w, int checks, BN_CTX *ctx,
125 BN_CTX *ctx)
153 BN_CTX_start(ctx);
154 t = BN_CTX_get(ctx);
160 if (!probable_prime(ret, bits, safe, mods, ctx))
163 if (!probable_prime_dh(ret, bits, safe, mods, add, rem, ctx))
172 i = bn_is_prime_int(ret, checks, ctx, 0, cb);
186 j = bn_is_prime_int(ret, 1, ctx, 0, cb);
192 j = bn_is_prime_int(t, 1, ctx, 0, cb);
207 BN_CTX_end(ctx);
216 BN_CTX *ctx = BN_CTX_new();
219 if (ctx == NULL)
222 retval = BN_generate_prime_ex2(ret, bits, safe, add, rem, cb, ctx);
224 BN_CTX_free(ctx);
236 int BN_is_prime_fasttest_ex(const BIGNUM *w, int checks, BN_CTX *ctx,
239 return ossl_bn_check_prime(w, checks, ctx, do_trial_division, cb);
244 int ossl_bn_check_prime(const BIGNUM *w, int checks, BN_CTX *ctx,
252 return bn_is_prime_int(w, checks, ctx, do_trial_division, cb);
255 int BN_check_prime(const BIGNUM *p, BN_CTX *ctx, BN_GENCB *cb)
257 return ossl_bn_check_prime(p, 0, ctx, 1, cb);
266 static int bn_is_prime_int(const BIGNUM *w, int checks, BN_CTX *ctx,
274 if (ctx == NULL)
307 if (ctx == NULL && (ctxlocal = ctx = BN_CTX_new()) == NULL)
311 if (!ossl_bn_miller_rabin_is_prime(w, checks, ctx, cb, 0, &status)) {
338 int ossl_bn_miller_rabin_is_prime(const BIGNUM *w, int iterations, BN_CTX *ctx,
349 BN_CTX_start(ctx);
350 g = BN_CTX_get(ctx);
351 w1 = BN_CTX_get(ctx);
352 w3 = BN_CTX_get(ctx);
353 x = BN_CTX_get(ctx);
354 m = BN_CTX_get(ctx);
355 z = BN_CTX_get(ctx);
356 b = BN_CTX_get(ctx);
381 if (mont == NULL || !BN_MONT_CTX_set(mont, w, ctx))
390 if (!BN_priv_rand_range_ex(b, w3, 0, ctx)
396 if (!BN_gcd(g, b, w, ctx))
406 if (!BN_mod_exp_mont(z, b, m, w, ctx, mont))
414 if (!BN_copy(x, z) || !BN_mod_mul(z, x, x, w, ctx))
425 if (!BN_copy(x, z) || !BN_mod_mul(z, x, x, w, ctx))
436 if (!BN_sub_word(x, 1) || !BN_gcd(g, x, w, ctx))
464 BN_CTX_end(ctx);
479 BN_CTX *ctx)
488 ctx))
538 BN_CTX *ctx)
546 BN_CTX_start(ctx);
547 if ((t1 = BN_CTX_get(ctx)) == NULL)
554 if (!BN_rand_ex(rnd, bits, BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ODD, 0, ctx))
559 if (!BN_mod(t1, rnd, add, ctx))
605 BN_CTX_end(ctx);