From dad3267aefbeab3a8910c1c59b2e5f7e9c12b048 Mon Sep 17 00:00:00 2001 From: tb <> Date: Sat, 19 Jan 2019 01:12:48 +0000 Subject: Partial port of EC_KEY_METHOD from OpenSSL 1.1. This commit adds missing API for ECDH/ECDSA_verify. from markus --- src/lib/libcrypto/ecdh/ech_key.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'src/lib/libcrypto/ecdh/ech_key.c') 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 @@ -/* $OpenBSD: ech_key.c,v 1.8 2018/09/02 17:20:31 tb Exp $ */ +/* $OpenBSD: ech_key.c,v 1.9 2019/01/19 01:12:48 tb Exp $ */ /* ==================================================================== * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. * @@ -78,6 +78,7 @@ #include #include "ech_locl.h" +#include "ec_lcl.h" static int ecdh_compute_key(void *out, size_t len, const EC_POINT *pub_key, EC_KEY *ecdh, @@ -215,13 +216,26 @@ ECDH_OpenSSL(void) return &openssl_ecdh_meth; } +/* replace w/ ecdh_compute_key() when ECDH_METHOD gets removed */ int -ECDH_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, +ossl_ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, EC_KEY *eckey, void *(*KDF)(const void *in, size_t inlen, void *out, size_t *outlen)) { - ECDH_DATA *ecdh = ecdh_check(eckey); - if (ecdh == NULL) + ECDH_DATA *ecdh; + + if ((ecdh = ecdh_check(eckey)) == NULL) return 0; return ecdh->meth->compute_key(out, outlen, pub_key, eckey, KDF); } + +int +ECDH_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, + EC_KEY *eckey, + void *(*KDF)(const void *in, size_t inlen, void *out, size_t *outlen)) +{ + if (eckey->meth->compute_key != NULL) + return eckey->meth->compute_key(out, outlen, pub_key, eckey, KDF); + ECerror(EC_R_NOT_IMPLEMENTED); + return 0; +} -- cgit v1.2.3-55-g6feb