Home | History | Annotate | Download | only in bn

Lines Matching refs:ctx

97 int test_lshift(BIO *bp,BN_CTX *ctx,BIGNUM *a_);
99 int test_rshift(BIO *bp,BN_CTX *ctx);
100 int test_div(BIO *bp,BN_CTX *ctx);
102 int test_div_recp(BIO *bp,BN_CTX *ctx);
104 int test_sqr(BIO *bp,BN_CTX *ctx);
105 int test_mont(BIO *bp,BN_CTX *ctx);
106 int test_mod(BIO *bp,BN_CTX *ctx);
107 int test_mod_mul(BIO *bp,BN_CTX *ctx);
108 int test_mod_exp(BIO *bp,BN_CTX *ctx);
109 int test_mod_exp_mont_consttime(BIO *bp,BN_CTX *ctx);
110 int test_exp(BIO *bp,BN_CTX *ctx);
113 int test_gf2m_mod_mul(BIO *bp,BN_CTX *ctx);
114 int test_gf2m_mod_sqr(BIO *bp,BN_CTX *ctx);
115 int test_gf2m_mod_inv(BIO *bp,BN_CTX *ctx);
116 int test_gf2m_mod_div(BIO *bp,BN_CTX *ctx);
117 int test_gf2m_mod_exp(BIO *bp,BN_CTX *ctx);
118 int test_gf2m_mod_sqrt(BIO *bp,BN_CTX *ctx);
119 int test_gf2m_mod_solve_quad(BIO *bp,BN_CTX *ctx);
120 int test_kron(BIO *bp,BN_CTX *ctx);
121 int test_sqrt(BIO *bp,BN_CTX *ctx);
140 BN_CTX *ctx;
164 ctx=BN_CTX_new();
165 if (ctx == NULL) EXIT(1);
198 if (!test_lshift(out,ctx,BN_bin2bn(lst,sizeof(lst)-1,NULL)))
203 if (!test_lshift(out,ctx,NULL)) goto err;
211 if (!test_rshift(out,ctx)) goto err;
215 if (!test_sqr(out,ctx)) goto err;
223 if (!test_div(out,ctx)) goto err;
231 if (!test_div_recp(out,ctx)) goto err;
235 if (!test_mod(out,ctx)) goto err;
239 if (!test_mod_mul(out,ctx)) goto err;
243 if (!test_mont(out,ctx)) goto err;
247 if (!test_mod_exp(out,ctx)) goto err;
251 if (!test_mod_exp_mont_consttime(out,ctx)) goto err;
255 if (!test_exp(out,ctx)) goto err;
259 if (!test_kron(out,ctx)) goto err;
263 if (!test_sqrt(out,ctx)) goto err;
275 if (!test_gf2m_mod_mul(out,ctx)) goto err;
279 if (!test_gf2m_mod_sqr(out,ctx)) goto err;
283 if (!test_gf2m_mod_inv(out,ctx)) goto err;
287 if (!test_gf2m_mod_div(out,ctx)) goto err;
291 if (!test_gf2m_mod_exp(out,ctx)) goto err;
295 if (!test_gf2m_mod_sqrt(out,ctx)) goto err;
299 if (!test_gf2m_mod_solve_quad(out,ctx)) goto err;
302 BN_CTX_free(ctx);
412 int test_div(BIO *bp, BN_CTX *ctx)
436 BN_div(&d,&c,&a,&b,ctx);
459 BN_mul(&e,&d,&b,ctx);
548 int test_div_recp(BIO *bp, BN_CTX *ctx)
574 BN_RECP_CTX_set(&recp,&b,ctx);
575 BN_div_recp(&d,&c,&a,&recp,ctx);
598 BN_mul(&e,&d,&b,ctx);
625 BN_CTX *ctx;
627 ctx = BN_CTX_new();
628 if (ctx == NULL) EXIT(1);
647 BN_mul(&c,&a,&b,ctx);
660 BN_div(&d,&e,&c,&a,ctx);
673 BN_CTX_free(ctx);
677 int test_sqr(BIO *bp, BN_CTX *ctx)
691 BN_sqr(&c,&a,ctx);
704 BN_div(&d,&e,&c,&a,ctx);
719 int test_mont(BIO *bp, BN_CTX *ctx)
745 ctx);
747 BN_nnmod(&a,&a,&n,ctx);
748 BN_nnmod(&b,&b,&n,ctx);
750 BN_to_montgomery(&A,&a,mont,ctx);
751 BN_to_montgomery(&B,&b,mont,ctx);
753 BN_mod_mul_montgomery(&c,&A,&B,mont,ctx);/**/
754 BN_from_montgomery(&A,&c,mont,ctx);/**/
775 BN_mod_mul(&d,&a,&b,&n,ctx);
794 int test_mod(BIO *bp, BN_CTX *ctx)
811 BN_mod(c,a,b,ctx);/**/
824 BN_div(d,e,a,b,ctx);
840 int test_mod_mul(BIO *bp, BN_CTX *ctx)
859 if (!BN_mod_mul(e,a,b,c,ctx))
892 BN_mul(d,a,b,ctx);
894 BN_div(a,b,d,c,ctx);
911 int test_mod_exp(BIO *bp, BN_CTX *ctx)
928 if (!BN_mod_exp(d,a,b,c,ctx))
945 BN_exp(e,a,b,ctx);
947 BN_div(a,b,e,c,ctx);
962 int test_mod_exp_mont_consttime(BIO *bp, BN_CTX *ctx)
979 if (!BN_mod_exp_mont_consttime(d,a,b,c,ctx,NULL))
996 BN_exp(e,a,b,ctx);
998 BN_div(a,b,e,c,ctx);
1013 int test_exp(BIO *bp, BN_CTX *ctx)
1030 if (BN_exp(d,a,b,ctx) <= 0)
1047 BN_mul(e,e,a,ctx);
1173 int test_gf2m_mod_mul(BIO *bp,BN_CTX *ctx)
1200 BN_GF2m_mod_mul(e, a, c, b[j], ctx);
1218 BN_GF2m_mod_mul(g, f, c, b[j], ctx);
1219 BN_GF2m_mod_mul(h, d, c, b[j], ctx);
1244 int test_gf2m_mod_sqr(BIO *bp,BN_CTX *ctx)
1265 BN_GF2m_mod_sqr(c, a, b[j], ctx);
1267 BN_GF2m_mod_mul(d, a, d, b[j], ctx);
1303 int test_gf2m_mod_inv(BIO *bp,BN_CTX *ctx)
1324 BN_GF2m_mod_inv(c, a, b[j], ctx);
1325 BN_GF2m_mod_mul(d, a, c, b[j], ctx);
1358 int test_gf2m_mod_div(BIO *bp,BN_CTX *ctx)
1382 BN_GF2m_mod_div(d, a, c, b[j], ctx);
1383 BN_GF2m_mod_mul(e, d, c, b[j], ctx);
1384 BN_GF2m_mod_div(f, a, e, b[j], ctx);
1421 int test_gf2m_mod_exp(BIO *bp,BN_CTX *ctx)
1446 BN_GF2m_mod_exp(e, a, c, b[j], ctx);
1447 BN_GF2m_mod_exp(f, a, d, b[j], ctx);
1448 BN_GF2m_mod_mul(e, e, f, b[j], ctx);
1450 BN_GF2m_mod_exp(f, a, f, b[j], ctx);
1492 int test_gf2m_mod_sqrt(BIO *bp,BN_CTX *ctx)
1516 BN_GF2m_mod_sqrt(d, a, b[j], ctx);
1517 BN_GF2m_mod_sqr(e, d, b[j], ctx);
1551 int test_gf2m_mod_solve_quad(BIO *bp,BN_CTX *ctx)
1573 t = BN_GF2m_mod_solve_quad(c, a, b[j], ctx);
1577 BN_GF2m_mod_sqr(d, c, b[j], ctx);
1651 int test_kron(BIO *bp, BN_CTX *ctx)
1667 /* We test BN_kronecker(a, b, ctx) just for b odd (Jacobi symbol).
1668 * In this case we know that if b is prime, then BN_kronecker(a, b, ctx)
1693 if (!BN_mod_exp_recp(r, a, t, b, ctx)) goto err;
1711 kronecker = BN_kronecker(a, b, ctx);
1742 int test_sqrt(BIO *bp, BN_CTX *ctx)
1779 if (!BN_nnmod(r, r, p, ctx)) goto err;
1780 if (!BN_mod_sqr(r, r, p, ctx)) goto err;
1782 if (!BN_nnmod(a, a, p, ctx)) goto err;
1783 if (!BN_mod_sqr(a, a, p, ctx)) goto err;
1784 if (!BN_mul(a, a, r, ctx)) goto err;
1788 if (!BN_mod_sqrt(r, a, p, ctx)) goto err;
1789 if (!BN_mod_sqr(r, r, p, ctx)) goto err;
1791 if (!BN_nnmod(a, a, p, ctx)) goto err;
1820 int test_lshift(BIO *bp,BN_CTX *ctx,BIGNUM *a_)
1854 BN_mul(d,a,c,ctx);
1919 int test_rshift(BIO *bp,BN_CTX *ctx)
1949 BN_div(d,e,a,c,ctx);