summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/ecdh/ech_key.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/ecdh/ech_key.c')
-rw-r--r--src/lib/libcrypto/ecdh/ech_key.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/lib/libcrypto/ecdh/ech_key.c b/src/lib/libcrypto/ecdh/ech_key.c
index 6911f1e341..378912cacb 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.8 2018/09/02 17:20:31 tb Exp $ */ 1/* $OpenBSD: ech_key.c,v 1.9 2019/01/19 01:12:48 tb Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. 3 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
4 * 4 *
@@ -78,6 +78,7 @@
78#include <openssl/sha.h> 78#include <openssl/sha.h>
79 79
80#include "ech_locl.h" 80#include "ech_locl.h"
81#include "ec_lcl.h"
81 82
82static int ecdh_compute_key(void *out, size_t len, const EC_POINT *pub_key, 83static int ecdh_compute_key(void *out, size_t len, const EC_POINT *pub_key,
83 EC_KEY *ecdh, 84 EC_KEY *ecdh,
@@ -215,13 +216,26 @@ ECDH_OpenSSL(void)
215 return &openssl_ecdh_meth; 216 return &openssl_ecdh_meth;
216} 217}
217 218
219/* replace w/ ecdh_compute_key() when ECDH_METHOD gets removed */
218int 220int
219ECDH_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, 221ossl_ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key,
220 EC_KEY *eckey, 222 EC_KEY *eckey,
221 void *(*KDF)(const void *in, size_t inlen, void *out, size_t *outlen)) 223 void *(*KDF)(const void *in, size_t inlen, void *out, size_t *outlen))
222{ 224{
223 ECDH_DATA *ecdh = ecdh_check(eckey); 225 ECDH_DATA *ecdh;
224 if (ecdh == NULL) 226
227 if ((ecdh = ecdh_check(eckey)) == NULL)
225 return 0; 228 return 0;
226 return ecdh->meth->compute_key(out, outlen, pub_key, eckey, KDF); 229 return ecdh->meth->compute_key(out, outlen, pub_key, eckey, KDF);
227} 230}
231
232int
233ECDH_compute_key(void *out, size_t outlen, const EC_POINT *pub_key,
234 EC_KEY *eckey,
235 void *(*KDF)(const void *in, size_t inlen, void *out, size_t *outlen))
236{
237 if (eckey->meth->compute_key != NULL)
238 return eckey->meth->compute_key(out, outlen, pub_key, eckey, KDF);
239 ECerror(EC_R_NOT_IMPLEMENTED);
240 return 0;
241}