summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2023-07-12 08:54:19 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2023-07-12 08:54:19 +0000
commitf2afb880d578195e2b0d0a4c9295d6e1e2daa962 (patch)
tree1cb40e0a31ecfb7305c5866fdf92da50f44b7402 /lib
parentb22c46d30214d87f5195a4e91da1387927decba3 (diff)
Revert accidental addition of cofactor ECDH support
This snuck in with ech_key.c r1.33 because I committed from a dirty tree.
Diffstat (limited to 'lib')
-rw-r--r--lib/libcrypto/ecdh/ecdh.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/lib/libcrypto/ecdh/ecdh.c b/lib/libcrypto/ecdh/ecdh.c
index 0781c30e095..ecb849c135a 100644
--- a/lib/libcrypto/ecdh/ecdh.c
+++ b/lib/libcrypto/ecdh/ecdh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ecdh.c,v 1.4 2023/07/07 13:54:45 beck Exp $ */
+/* $OpenBSD: ecdh.c,v 1.5 2023/07/12 08:54:18 tb Exp $ */
/* ====================================================================
* Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
*
@@ -151,7 +151,7 @@ ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, EC_KEY *ecdh
void *(*KDF)(const void *in, size_t inlen, void *out, size_t *outlen))
{
BN_CTX *ctx;
- BIGNUM *cofactor, *x;
+ BIGNUM *x;
const BIGNUM *priv_key;
const EC_GROUP *group;
EC_POINT *point = NULL;
@@ -172,8 +172,6 @@ ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, EC_KEY *ecdh
if ((x = BN_CTX_get(ctx)) == NULL)
goto err;
- if ((cofactor = BN_CTX_get(ctx)) == NULL)
- goto err;
if ((group = EC_KEY_get0_group(ecdh)) == NULL)
goto err;
@@ -191,18 +189,6 @@ ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, EC_KEY *ecdh
goto err;
}
- if ((EC_KEY_get_flags(ecdh) & EC_FLAG_COFACTOR_ECDH) != 0) {
- if (!EC_GROUP_get_cofactor(group, cofactor, NULL)) {
- ECerror(ERR_R_EC_LIB);
- goto err;
- }
- if (!BN_mul(cofactor, cofactor, priv_key, ctx)) {
- ECerror(ERR_R_BN_LIB);
- goto err;
- }
- priv_key = cofactor;
- }
-
if (!EC_POINT_mul(group, point, NULL, pub_key, priv_key, ctx)) {
ECerror(EC_R_POINT_ARITHMETIC_FAILURE);
goto err;