summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/ecdh/ech_key.c
diff options
context:
space:
mode:
authortb <>2023-06-25 18:41:36 +0000
committertb <>2023-06-25 18:41:36 +0000
commit5119a6bbd2e88876fc335ff3b50913e87b9d734f (patch)
treea3d9fe6e2dfed0e078a378a56856c728dd1a10af /src/lib/libcrypto/ecdh/ech_key.c
parent4f21d97099309dee2fff64e714d96a6e3ff929ba (diff)
downloadopenbsd-5119a6bbd2e88876fc335ff3b50913e87b9d734f.tar.gz
openbsd-5119a6bbd2e88876fc335ff3b50913e87b9d734f.tar.bz2
openbsd-5119a6bbd2e88876fc335ff3b50913e87b9d734f.zip
Remove method wrappers that use {ecdh,ecdsa}_check()
Now that it is no longer possible to set a custom {ECDH,ECDSA}_METHOD, EC_KEY_METHOD can just call the relevant method directly without the need for this extra contortion. ok jsing
Diffstat (limited to 'src/lib/libcrypto/ecdh/ech_key.c')
-rw-r--r--src/lib/libcrypto/ecdh/ech_key.c25
1 files changed, 4 insertions, 21 deletions
diff --git a/src/lib/libcrypto/ecdh/ech_key.c b/src/lib/libcrypto/ecdh/ech_key.c
index a5c6371f91..108a5ff8f6 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.14 2022/11/26 16:08:52 tb Exp $ */ 1/* $OpenBSD: ech_key.c,v 1.15 2023/06/25 18:41:36 tb Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. 3 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
4 * 4 *
@@ -81,10 +81,6 @@
81#include "ech_local.h" 81#include "ech_local.h"
82#include "ec_local.h" 82#include "ec_local.h"
83 83
84static int ecdh_compute_key(void *out, size_t len, const EC_POINT *pub_key,
85 EC_KEY *ecdh,
86 void *(*KDF)(const void *in, size_t inlen, void *out, size_t *outlen));
87
88/* 84/*
89 * This implementation is based on the following primitives in the IEEE 1363 85 * This implementation is based on the following primitives in the IEEE 1363
90 * standard: 86 * standard:
@@ -92,8 +88,8 @@ static int ecdh_compute_key(void *out, size_t len, const EC_POINT *pub_key,
92 * - ECSVDP-DH 88 * - ECSVDP-DH
93 * Finally an optional KDF is applied. 89 * Finally an optional KDF is applied.
94 */ 90 */
95static int 91int
96ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, 92ossl_ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key,
97 EC_KEY *ecdh, 93 EC_KEY *ecdh,
98 void *(*KDF)(const void *in, size_t inlen, void *out, size_t *outlen)) 94 void *(*KDF)(const void *in, size_t inlen, void *out, size_t *outlen))
99{ 95{
@@ -195,7 +191,7 @@ err:
195 191
196static ECDH_METHOD openssl_ecdh_meth = { 192static ECDH_METHOD openssl_ecdh_meth = {
197 .name = "OpenSSL ECDH method", 193 .name = "OpenSSL ECDH method",
198 .compute_key = ecdh_compute_key 194 .compute_key = ossl_ecdh_compute_key,
199}; 195};
200 196
201const ECDH_METHOD * 197const ECDH_METHOD *
@@ -204,19 +200,6 @@ ECDH_OpenSSL(void)
204 return &openssl_ecdh_meth; 200 return &openssl_ecdh_meth;
205} 201}
206 202
207/* replace w/ ecdh_compute_key() when ECDH_METHOD gets removed */
208int
209ossl_ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key,
210 EC_KEY *eckey,
211 void *(*KDF)(const void *in, size_t inlen, void *out, size_t *outlen))
212{
213 ECDH_DATA *ecdh;
214
215 if ((ecdh = ecdh_check(eckey)) == NULL)
216 return 0;
217 return ecdh->meth->compute_key(out, outlen, pub_key, eckey, KDF);
218}
219
220int 203int
221ECDH_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, 204ECDH_compute_key(void *out, size_t outlen, const EC_POINT *pub_key,
222 EC_KEY *eckey, 205 EC_KEY *eckey,