Lines Matching refs:ctx
103 const BIGNUM *b, BN_CTX *ctx)
142 BIGNUM *a, BIGNUM *b, BN_CTX *ctx)
181 BN_CTX *ctx)
188 if (ctx == NULL) {
189 ctx = new_ctx = BN_CTX_new();
190 if (ctx == NULL) {
196 BN_CTX_start(ctx);
197 b = BN_CTX_get(ctx);
214 BN_CTX_end(ctx);
292 BN_CTX *ctx)
323 BN_CTX *ctx)
357 const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx)
378 if (ctx == NULL) {
379 ctx = new_ctx = BN_CTX_new();
380 if (ctx == NULL)
385 BN_CTX_start(ctx);
386 x0 = BN_CTX_get(ctx);
387 y0 = BN_CTX_get(ctx);
388 x1 = BN_CTX_get(ctx);
389 y1 = BN_CTX_get(ctx);
390 x2 = BN_CTX_get(ctx);
391 y2 = BN_CTX_get(ctx);
392 s = BN_CTX_get(ctx);
393 t = BN_CTX_get(ctx);
403 if (!EC_POINT_get_affine_coordinates(group, a, x0, y0, ctx))
412 if (!EC_POINT_get_affine_coordinates(group, b, x1, y1, ctx))
421 if (!group->meth->field_div(group, s, s, t, ctx))
423 if (!group->meth->field_sqr(group, x2, s, ctx))
438 if (!group->meth->field_div(group, s, y1, x1, ctx))
443 if (!group->meth->field_sqr(group, x2, s, ctx))
453 if (!group->meth->field_mul(group, y2, y2, s, ctx))
460 if (!EC_POINT_set_affine_coordinates(group, r, x2, y2, ctx))
466 BN_CTX_end(ctx);
478 const EC_POINT *a, BN_CTX *ctx)
480 return ossl_ec_GF2m_simple_add(group, r, a, a, ctx);
484 BN_CTX *ctx)
491 || !group->meth->make_affine(group, point, ctx))
509 BN_CTX *ctx)
531 if (ctx == NULL) {
532 ctx = new_ctx = BN_CTX_new();
533 if (ctx == NULL)
538 BN_CTX_start(ctx);
539 y2 = BN_CTX_get(ctx);
540 lh = BN_CTX_get(ctx);
552 if (!field_mul(group, lh, lh, point->X, ctx))
556 if (!field_mul(group, lh, lh, point->X, ctx))
560 if (!field_sqr(group, y2, point->Y, ctx))
567 BN_CTX_end(ctx);
582 const EC_POINT *b, BN_CTX *ctx)
602 if (ctx == NULL) {
603 ctx = new_ctx = BN_CTX_new();
604 if (ctx == NULL)
609 BN_CTX_start(ctx);
610 aX = BN_CTX_get(ctx);
611 aY = BN_CTX_get(ctx);
612 bX = BN_CTX_get(ctx);
613 bY = BN_CTX_get(ctx);
617 if (!EC_POINT_get_affine_coordinates(group, a, aX, aY, ctx))
619 if (!EC_POINT_get_affine_coordinates(group, b, bX, bY, ctx))
624 BN_CTX_end(ctx);
633 BN_CTX *ctx)
645 if (ctx == NULL) {
646 ctx = new_ctx = BN_CTX_new();
647 if (ctx == NULL)
652 BN_CTX_start(ctx);
653 x = BN_CTX_get(ctx);
654 y = BN_CTX_get(ctx);
658 if (!EC_POINT_get_affine_coordinates(group, point, x, y, ctx))
671 BN_CTX_end(ctx);
682 EC_POINT *points[], BN_CTX *ctx)
687 if (!group->meth->make_affine(group, points[i], ctx))
696 const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
698 return BN_GF2m_mod_mul_arr(r, a, b, group->poly, ctx);
703 const BIGNUM *a, BN_CTX *ctx)
705 return BN_GF2m_mod_sqr_arr(r, a, group->poly, ctx);
710 const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
712 return BN_GF2m_mod_div(r, a, b, group->field, ctx);
724 EC_POINT *p, BN_CTX *ctx)
733 BN_RAND_TOP_ANY, BN_RAND_BOTTOM_ANY, 0, ctx)) {
741 && !group->meth->field_encode(group, s->Z, s->Z, ctx))
742 || !group->meth->field_mul(group, s->X, p->X, s->Z, ctx))
748 BN_RAND_TOP_ANY, BN_RAND_BOTTOM_ANY, 0, ctx)) {
755 && !group->meth->field_encode(group, r->Y, r->Y, ctx))
756 || !group->meth->field_sqr(group, r->Z, p->X, ctx)
757 || !group->meth->field_sqr(group, r->X, r->Z, ctx)
759 || !group->meth->field_mul(group, r->Z, r->Z, r->Y, ctx)
760 || !group->meth->field_mul(group, r->X, r->X, r->Y, ctx))
777 EC_POINT *p, BN_CTX *ctx)
779 if (!group->meth->field_mul(group, r->Y, r->Z, s->X, ctx)
780 || !group->meth->field_mul(group, s->X, r->X, s->Z, ctx)
781 || !group->meth->field_sqr(group, s->Y, r->Z, ctx)
782 || !group->meth->field_sqr(group, r->Z, r->X, ctx)
784 || !group->meth->field_sqr(group, s->Z, s->Z, ctx)
785 || !group->meth->field_mul(group, s->X, r->Y, s->X, ctx)
786 || !group->meth->field_mul(group, r->Y, s->Z, p->X, ctx)
788 || !group->meth->field_sqr(group, r->Y, r->Z, ctx)
789 || !group->meth->field_mul(group, r->Z, r->Z, s->Y, ctx)
790 || !group->meth->field_sqr(group, s->Y, s->Y, ctx)
791 || !group->meth->field_mul(group, s->Y, s->Y, group->b, ctx)
807 EC_POINT *p, BN_CTX *ctx)
817 || !EC_POINT_invert(group, r, ctx)) {
824 BN_CTX_start(ctx);
825 t0 = BN_CTX_get(ctx);
826 t1 = BN_CTX_get(ctx);
827 t2 = BN_CTX_get(ctx);
833 if (!group->meth->field_mul(group, t0, r->Z, s->Z, ctx)
834 || !group->meth->field_mul(group, t1, p->X, r->Z, ctx)
836 || !group->meth->field_mul(group, t2, p->X, s->Z, ctx)
837 || !group->meth->field_mul(group, r->Z, r->X, t2, ctx)
839 || !group->meth->field_mul(group, t1, t1, t2, ctx)
840 || !group->meth->field_sqr(group, t2, p->X, ctx)
842 || !group->meth->field_mul(group, t2, t2, t0, ctx)
844 || !group->meth->field_mul(group, t2, p->X, t0, ctx)
845 || !group->meth->field_inv(group, t2, t2, ctx)
846 || !group->meth->field_mul(group, t1, t1, t2, ctx)
847 || !group->meth->field_mul(group, r->X, r->Z, t2, ctx)
849 || !group->meth->field_mul(group, t2, t2, t1, ctx)
863 BN_CTX_end(ctx);
872 BN_CTX *ctx)
892 return ossl_ec_wNAF_mul(group, r, scalar, num, points, scalars, ctx);
896 return ossl_ec_scalar_mul_ladder(group, r, scalar, NULL, ctx);
900 return ossl_ec_scalar_mul_ladder(group, r, scalars[0], points[0], ctx);
912 if (!ossl_ec_scalar_mul_ladder(group, t, scalar, NULL, ctx)
913 || !ossl_ec_scalar_mul_ladder(group, r, scalars[0], points[0], ctx)
914 || !EC_POINT_add(group, r, t, r, ctx))
930 const BIGNUM *a, BN_CTX *ctx)
934 if (!(ret = BN_GF2m_mod_inv(r, a, group->field, ctx)))