提交 1acc24a8 编写于 作者: D Dr. Stephen Henson

Make no-ec2m work again.

上级 f52e552a
...@@ -88,8 +88,15 @@ int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group, EC_POINT *poi ...@@ -88,8 +88,15 @@ int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group, EC_POINT *poi
return ec_GFp_simple_set_compressed_coordinates( return ec_GFp_simple_set_compressed_coordinates(
group, point, x, y_bit, ctx); group, point, x, y_bit, ctx);
else else
#ifdef OPENSSL_NO_EC2M
{
ECerr(EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GFP, EC_R_GF2M_NOT_SUPPORTED);
return 0;
}
#else
return ec_GF2m_simple_set_compressed_coordinates( return ec_GF2m_simple_set_compressed_coordinates(
group, point, x, y_bit, ctx); group, point, x, y_bit, ctx);
#endif
} }
return group->meth->point_set_compressed_coordinates(group, point, x, y_bit, ctx); return group->meth->point_set_compressed_coordinates(group, point, x, y_bit, ctx);
} }
...@@ -142,8 +149,15 @@ size_t EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *point, point_co ...@@ -142,8 +149,15 @@ size_t EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *point, point_co
return ec_GFp_simple_point2oct(group, point, return ec_GFp_simple_point2oct(group, point,
form, buf, len, ctx); form, buf, len, ctx);
else else
#ifdef OPENSSL_NO_EC2M
{
ECerr(EC_F_EC_POINT_POINT2OCT, EC_R_GF2M_NOT_SUPPORTED);
return 0;
}
#else
return ec_GF2m_simple_point2oct(group, point, return ec_GF2m_simple_point2oct(group, point,
form, buf, len, ctx); form, buf, len, ctx);
#endif
} }
return group->meth->point2oct(group, point, form, buf, len, ctx); return group->meth->point2oct(group, point, form, buf, len, ctx);
...@@ -170,8 +184,15 @@ int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *point, ...@@ -170,8 +184,15 @@ int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *point,
return ec_GFp_simple_oct2point(group, point, return ec_GFp_simple_oct2point(group, point,
buf, len, ctx); buf, len, ctx);
else else
#ifdef OPENSSL_NO_EC2M
{
ECerr(EC_F_EC_POINT_OCT2POINT, EC_R_GF2M_NOT_SUPPORTED);
return 0;
}
#else
return ec_GF2m_simple_oct2point(group, point, return ec_GF2m_simple_oct2point(group, point,
buf, len, ctx); buf, len, ctx);
#endif
} }
return group->meth->oct2point(group, point, buf, len, ctx); return group->meth->oct2point(group, point, buf, len, ctx);
} }
......
...@@ -171,10 +171,17 @@ static EC_POINT *make_peer(EC_GROUP *group, BIGNUM *x, BIGNUM *y) ...@@ -171,10 +171,17 @@ static EC_POINT *make_peer(EC_GROUP *group, BIGNUM *x, BIGNUM *y)
return NULL; return NULL;
c = BN_CTX_new(); c = BN_CTX_new();
if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) if (EC_METHOD_get_field_type(EC_GROUP_method_of(group))
== NID_X9_62_characteristic_two_field) == NID_X9_62_prime_field)
rv = EC_POINT_set_affine_coordinates_GF2m(group, peer, x, y, c);
else
rv = EC_POINT_set_affine_coordinates_GFp(group, peer, x, y, c); rv = EC_POINT_set_affine_coordinates_GFp(group, peer, x, y, c);
else
#ifdef OPENSSL_NO_EC2M
{
fprintf(stderr, "ERROR: GF2m not supported\n");
exit(1);
}
#else
rv = EC_POINT_set_affine_coordinates_GF2m(group, peer, x, y, c);
#endif
BN_CTX_free(c); BN_CTX_free(c);
if (rv) if (rv)
...@@ -204,7 +211,14 @@ static int ec_print_pubkey(FILE *out, EC_KEY *key) ...@@ -204,7 +211,14 @@ static int ec_print_pubkey(FILE *out, EC_KEY *key)
if (EC_METHOD_get_field_type(meth) == NID_X9_62_prime_field) if (EC_METHOD_get_field_type(meth) == NID_X9_62_prime_field)
rv = EC_POINT_get_affine_coordinates_GFp(grp, pt, tx, ty, ctx); rv = EC_POINT_get_affine_coordinates_GFp(grp, pt, tx, ty, ctx);
else else
#ifdef OPENSSL_NO_EC2M
{
fprintf(stderr, "ERROR: GF2m not supported\n");
exit(1);
}
#else
rv = EC_POINT_get_affine_coordinates_GF2m(grp, pt, tx, ty, ctx); rv = EC_POINT_get_affine_coordinates_GF2m(grp, pt, tx, ty, ctx);
#endif
do_bn_print_name(out, "QeIUTx", tx); do_bn_print_name(out, "QeIUTx", tx);
do_bn_print_name(out, "QeIUTy", ty); do_bn_print_name(out, "QeIUTy", ty);
......
...@@ -169,7 +169,14 @@ static int ec_get_pubkey(EC_KEY *key, BIGNUM *x, BIGNUM *y) ...@@ -169,7 +169,14 @@ static int ec_get_pubkey(EC_KEY *key, BIGNUM *x, BIGNUM *y)
if (EC_METHOD_get_field_type(meth) == NID_X9_62_prime_field) if (EC_METHOD_get_field_type(meth) == NID_X9_62_prime_field)
rv = EC_POINT_get_affine_coordinates_GFp(grp, pt, x, y, ctx); rv = EC_POINT_get_affine_coordinates_GFp(grp, pt, x, y, ctx);
else else
#ifdef OPENSSL_NO_EC2M
{
fprintf(stderr, "ERROR: GF2m not supported\n");
exit(1);
}
#else
rv = EC_POINT_get_affine_coordinates_GF2m(grp, pt, x, y, ctx); rv = EC_POINT_get_affine_coordinates_GF2m(grp, pt, x, y, ctx);
#endif
BN_CTX_free(ctx); BN_CTX_free(ctx);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册