summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/ecdh/ech_key.c
diff options
context:
space:
mode:
authortb <>2021-04-20 17:23:37 +0000
committertb <>2021-04-20 17:23:37 +0000
commitb567b8b60d2a8021e06cc33d2fee8b1cf180eac5 (patch)
tree2d01b94789dd9feb10bf48a12e3b8d831acb2076 /src/lib/libcrypto/ecdh/ech_key.c
parent0b9d2ddee375142a5100f30f23c6869070bcaedd (diff)
downloadopenbsd-b567b8b60d2a8021e06cc33d2fee8b1cf180eac5.tar.gz
openbsd-b567b8b60d2a8021e06cc33d2fee8b1cf180eac5.tar.bz2
openbsd-b567b8b60d2a8021e06cc33d2fee8b1cf180eac5.zip
Simplify code after adding EC_POINT_{s,g}et_affine_coordinates()
ok jsing
Diffstat (limited to 'src/lib/libcrypto/ecdh/ech_key.c')
-rw-r--r--src/lib/libcrypto/ecdh/ech_key.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/src/lib/libcrypto/ecdh/ech_key.c b/src/lib/libcrypto/ecdh/ech_key.c
index c82002ea46..e59ce8bc3c 100644
--- a/src/lib/libcrypto/ecdh/ech_key.c
+++ b/src/lib/libcrypto/ecdh/ech_key.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ech_key.c,v 1.10 2021/04/20 17:16:38 tb Exp $ */ 1/* $OpenBSD: ech_key.c,v 1.11 2021/04/20 17:23:37 tb Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. 3 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
4 * 4 *
@@ -140,21 +140,10 @@ ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key,
140 goto err; 140 goto err;
141 } 141 }
142 142
143 if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) == 143 if (!EC_POINT_get_affine_coordinates(group, tmp, x, y, ctx)) {
144 NID_X9_62_prime_field) { 144 ECDHerror(ECDH_R_POINT_ARITHMETIC_FAILURE);
145 if (!EC_POINT_get_affine_coordinates(group, tmp, x, y, ctx)) { 145 goto err;
146 ECDHerror(ECDH_R_POINT_ARITHMETIC_FAILURE);
147 goto err;
148 }
149 }
150#ifndef OPENSSL_NO_EC2M
151 else {
152 if (!EC_POINT_get_affine_coordinates(group, tmp, x, y, ctx)) {
153 ECDHerror(ECDH_R_POINT_ARITHMETIC_FAILURE);
154 goto err;
155 }
156 } 146 }
157#endif
158 147
159 buflen = ECDH_size(ecdh); 148 buflen = ECDH_size(ecdh);
160 len = BN_num_bytes(x); 149 len = BN_num_bytes(x);