From cc86847b25b69967ae39b0e3dd4e0255e92176f3 Mon Sep 17 00:00:00 2001 From: tb Date: Thu, 13 May 2021 14:28:03 +0000 Subject: [PATCH] Use field independent versions of {get,set}_coordinates() ok tobhe --- sbin/isakmpd/dh.c | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/sbin/isakmpd/dh.c b/sbin/isakmpd/dh.c index 3b2af8eb964..f7b07c865d1 100644 --- a/sbin/isakmpd/dh.c +++ b/sbin/isakmpd/dh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dh.c,v 1.21 2017/11/08 13:33:49 patrick Exp $ */ +/* $OpenBSD: dh.c,v 1.22 2021/05/13 14:28:03 tb Exp $ */ /* * Copyright (c) 2010-2014 Reyk Floeter @@ -535,16 +535,8 @@ ec_point2raw(struct group *group, const EC_POINT *point, 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_t *buf, size_t len) 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: -- 2.20.1