74 #ifndef OPENSSL_NO_EC2M
77 #include <openssl/fips.h>
84 return fips_ec_gf2m_simple_method();
180 if (!
BN_copy(&dest->
a, &src->
a))
return 0;
181 if (!
BN_copy(&dest->
b, &src->
b))
return 0;
188 if (
bn_wexpand(&dest->
a, (
int)(dest->
poly[0] + BN_BITS2 - 1) / BN_BITS2) == NULL)
return 0;
189 if (
bn_wexpand(&dest->
b, (
int)(dest->
poly[0] + BN_BITS2 - 1) / BN_BITS2) == NULL)
return 0;
190 for (i = dest->
a.
top; i < dest->
a.dmax; i++) dest->
a.
d[i] = 0;
191 for (i = dest->
b.
top; i < dest->
b.dmax; i++) dest->
b.
d[i] = 0;
205 if ((i != 5) && (i != 3))
213 if(
bn_wexpand(&group->
a, (
int)(group->
poly[0] + BN_BITS2 - 1) / BN_BITS2) == NULL)
goto err;
214 for (i = group->
a.
top; i < group->a.
dmax; i++) group->
a.
d[i] = 0;
218 if(
bn_wexpand(&group->
b, (
int)(group->
poly[0] + BN_BITS2 - 1) / BN_BITS2) == NULL)
goto err;
219 for (i = group->
b.
top; i < group->b.
dmax; i++) group->
b.
d[i] = 0;
241 if (!
BN_copy(a, &group->
a))
goto err;
246 if (!
BN_copy(b, &group->
b))
goto err;
283 if (b == NULL)
goto err;
335 if (!
BN_copy(&dest->
X, &src->
X))
return 0;
336 if (!
BN_copy(&dest->
Y, &src->
Y))
return 0;
337 if (!
BN_copy(&dest->
Z, &src->
Z))
return 0;
362 if (x == NULL || y == NULL)
368 if (!
BN_copy(&point->
X, x))
goto err;
370 if (!
BN_copy(&point->
Y, y))
goto err;
403 if (!
BN_copy(x, &point->
X))
goto err;
408 if (!
BN_copy(y, &point->
Y))
goto err;
423 BIGNUM *x0, *y0, *x1, *y1, *x2, *y2, *s, *
t;
454 if (t == NULL)
goto err;
494 if (!group->
meth->
field_div(group, s, y1, x1, ctx))
goto err;
503 if (!group->
meth->
field_mul(group, y2, y2, s, ctx))
goto err;
556 int (*field_sqr)(
const EC_GROUP *, BIGNUM *,
const BIGNUM *,
BN_CTX *);
577 if (lh == NULL)
goto err;
585 if (!field_mul(group, lh, lh, &point->
X, ctx))
goto err;
587 if (!field_mul(group, lh, lh, &point->
X, ctx))
goto err;
589 if (!field_sqr(group, y2, &point->
Y, ctx))
goto err;
607 BIGNUM *aX, *aY, *bX, *bY;
636 if (bY == NULL)
goto err;
640 ret = ((
BN_cmp(aX, bX) == 0) &&
BN_cmp(aY, bY) == 0) ? 0 : 1;
669 if (y == NULL)
goto err;
672 if (!
BN_copy(&point->
X, x))
goto err;
673 if (!
BN_copy(&point->
Y, y))
goto err;
674 if (!
BN_one(&point->
Z))
goto err;
690 for (i = 0; i <
num; i++)