There never was a real need for a distinction between the GFp and GF2m
variants of EC_POINT_{get,set}_affine_coordinates_{GFp,GF2m}() in
libcrypto. The EC_GROUP method has the correct function pointer set. Now
that we have EC_POINT_{get,set}_affine_coordinates(), let's use them and
avoid the complexity of using the GFp and GF2m variants.

Index: dh.c
===================================================================
RCS file: /cvs/src/sbin/isakmpd/dh.c,v
retrieving revision 1.21
diff -u -p -r1.21 dh.c
--- dh.c        8 Nov 2017 13:33:49 -0000       1.21
+++ dh.c        13 May 2021 05:25:32 -0000
@@ -535,16 +535,8 @@ ec_point2raw(struct group *group, const 
        if ((ecgroup = EC_KEY_get0_group(group->ec)) == NULL)
                goto done;
 
-       if (EC_METHOD_get_field_type(EC_GROUP_method_of(ecgroup)) ==
-           NID_X9_62_prime_field) {
-               if (!EC_POINT_get_affine_coordinates_GFp(ecgroup,
-                   point, x, y, bnctx))
-                       goto done;
-       } else {
-               if (!EC_POINT_get_affine_coordinates_GF2m(ecgroup,
-                   point, x, y, bnctx))
-                       goto done;
-       }
+       if (!EC_POINT_get_affine_coordinates(ecgroup, point, x, y, bnctx))
+               goto done;
 
        xoff = xlen - BN_num_bytes(x);
        bzero(buf, xoff);
@@ -603,16 +595,8 @@ ec_raw2point(struct group *group, u_int8
        if ((point = EC_POINT_new(ecgroup)) == NULL)
                goto done;
 
-       if (EC_METHOD_get_field_type(EC_GROUP_method_of(ecgroup)) ==
-           NID_X9_62_prime_field) {
-               if (!EC_POINT_set_affine_coordinates_GFp(ecgroup,
-                   point, x, y, bnctx))
-                       goto done;
-       } else {
-               if (!EC_POINT_set_affine_coordinates_GF2m(ecgroup,
-                   point, x, y, bnctx))
-                       goto done;
-       }
+       if (!EC_POINT_set_affine_coordinates(ecgroup, point, x, y, bnctx))
+               goto done;
 
        ret = 0;
  done:

Reply via email to