diff options
Diffstat (limited to 'src/lib/libcrypto/ecdh/ech_key.c')
| -rw-r--r-- | src/lib/libcrypto/ecdh/ech_key.c | 22 |
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 | ||
| 82 | static int ecdh_compute_key(void *out, size_t len, const EC_POINT *pub_key, | 83 | static 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 */ | ||
| 218 | int | 220 | int |
| 219 | ECDH_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, | 221 | ossl_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 | |||
| 232 | int | ||
| 233 | ECDH_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 | } | ||
