-/* $OpenBSD: ec_key.c,v 1.25 2021/04/20 17:16:37 tb Exp $ */
+/* $OpenBSD: ec_key.c,v 1.26 2021/04/20 17:23:37 tb Exp $ */
/*
* Written by Nils Larsch for the OpenSSL project.
*/
BN_CTX *ctx = NULL;
BIGNUM *tx, *ty;
EC_POINT *point = NULL;
- int ok = 0, tmp_nid, is_char_two = 0;
+ int ok = 0;
if (!key || !key->group || !x || !y) {
ECerror(ERR_R_PASSED_NULL_PARAMETER);
if (!point)
goto err;
- tmp_nid = EC_METHOD_get_field_type(EC_GROUP_method_of(key->group));
-
- if (tmp_nid == NID_X9_62_characteristic_two_field)
- is_char_two = 1;
-
if ((tx = BN_CTX_get(ctx)) == NULL)
goto err;
if ((ty = BN_CTX_get(ctx)) == NULL)
goto err;
-#ifndef OPENSSL_NO_EC2M
- if (is_char_two) {
- if (!EC_POINT_set_affine_coordinates(key->group, point,
- x, y, ctx))
- goto err;
- if (!EC_POINT_get_affine_coordinates(key->group, point,
- tx, ty, ctx))
- goto err;
- } else
-#endif
- {
- if (!EC_POINT_set_affine_coordinates(key->group, point,
- x, y, ctx))
- goto err;
- if (!EC_POINT_get_affine_coordinates(key->group, point,
- tx, ty, ctx))
- goto err;
- }
+ if (!EC_POINT_set_affine_coordinates(key->group, point, x, y, ctx))
+ goto err;
+ if (!EC_POINT_get_affine_coordinates(key->group, point, tx, ty, ctx))
+ goto err;
/*
* Check if retrieved coordinates match originals: if not values are
* out of range.
-/* $OpenBSD: ech_key.c,v 1.10 2021/04/20 17:16:38 tb Exp $ */
+/* $OpenBSD: ech_key.c,v 1.11 2021/04/20 17:23:37 tb Exp $ */
/* ====================================================================
* Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
*
goto err;
}
- if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) ==
- NID_X9_62_prime_field) {
- if (!EC_POINT_get_affine_coordinates(group, tmp, x, y, ctx)) {
- ECDHerror(ECDH_R_POINT_ARITHMETIC_FAILURE);
- goto err;
- }
- }
-#ifndef OPENSSL_NO_EC2M
- else {
- if (!EC_POINT_get_affine_coordinates(group, tmp, x, y, ctx)) {
- ECDHerror(ECDH_R_POINT_ARITHMETIC_FAILURE);
- goto err;
- }
+ if (!EC_POINT_get_affine_coordinates(group, tmp, x, y, ctx)) {
+ ECDHerror(ECDH_R_POINT_ARITHMETIC_FAILURE);
+ goto err;
}
-#endif
buflen = ECDH_size(ecdh);
len = BN_num_bytes(x);
-/* $OpenBSD: ecs_ossl.c,v 1.21 2021/04/20 17:16:38 tb Exp $ */
+/* $OpenBSD: ecs_ossl.c,v 1.22 2021/04/20 17:23:37 tb Exp $ */
/*
* Written by Nils Larsch for the OpenSSL project
*/
ECDSAerror(ERR_R_EC_LIB);
goto err;
}
- if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) ==
- NID_X9_62_prime_field) {
- if (!EC_POINT_get_affine_coordinates(group, point,
- X, NULL, ctx)) {
- ECDSAerror(ERR_R_EC_LIB);
- goto err;
- }
- }
-#ifndef OPENSSL_NO_EC2M
- else { /* NID_X9_62_characteristic_two_field */
- if (!EC_POINT_get_affine_coordinates(group, point,
- X, NULL, ctx)) {
- ECDSAerror(ERR_R_EC_LIB);
- goto err;
- }
+ if (!EC_POINT_get_affine_coordinates(group, point, X, NULL,
+ ctx)) {
+ ECDSAerror(ERR_R_EC_LIB);
+ goto err;
}
-#endif
if (!BN_nnmod(r, X, order, ctx)) {
ECDSAerror(ERR_R_BN_LIB);
goto err;
ECDSAerror(ERR_R_EC_LIB);
goto err;
}
- if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) ==
- NID_X9_62_prime_field) {
- if (!EC_POINT_get_affine_coordinates(group, point, X, NULL,
- ctx)) {
- ECDSAerror(ERR_R_EC_LIB);
- goto err;
- }
- }
-#ifndef OPENSSL_NO_EC2M
- else { /* NID_X9_62_characteristic_two_field */
- if (!EC_POINT_get_affine_coordinates(group, point, X, NULL,
- ctx)) {
- ECDSAerror(ERR_R_EC_LIB);
- goto err;
- }
+ if (!EC_POINT_get_affine_coordinates(group, point, X, NULL, ctx)) {
+ ECDSAerror(ERR_R_EC_LIB);
+ goto err;
}
-#endif
if (!BN_nnmod(u1, X, order, ctx)) {
ECDSAerror(ERR_R_BN_LIB);
goto err;