summaryrefslogtreecommitdiffstats
path: root/crypto/ec/ec_kmeth.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2015-10-22 18:48:59 +0100
committerDr. Stephen Henson <steve@openssl.org>2015-12-09 22:09:17 +0000
commita22a7e70899a28fff4719d458e12f8bfcd457f62 (patch)
treefb8f4510103452589f6ba97873d5585bc77056a0 /crypto/ec/ec_kmeth.c
parent647b2238755efb4a3dc6a6a6141c0ba1b2e54beb (diff)
Add compute key support to EC_KEY_METHOD
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/ec/ec_kmeth.c')
-rw-r--r--crypto/ec/ec_kmeth.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/crypto/ec/ec_kmeth.c b/crypto/ec/ec_kmeth.c
index ba6db6e1df..6be99c2265 100644
--- a/crypto/ec/ec_kmeth.c
+++ b/crypto/ec/ec_kmeth.c
@@ -61,7 +61,8 @@
static const EC_KEY_METHOD openssl_ec_key_method = {
"OpenSSL EC_KEY method",
0,
- ossl_ec_key_gen
+ ossl_ec_key_gen,
+ ossl_ecdh_compute_key
};
const EC_KEY_METHOD *default_ec_key_meth = &openssl_ec_key_method;
@@ -119,3 +120,14 @@ EC_KEY *EC_KEY_new_method(ENGINE *engine)
ret->references = 1;
return (ret);
}
+
+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)
+ return eckey->meth->compute_key(out, outlen, pub_key, eckey, KDF);
+ ECerr(EC_F_ECDH_COMPUTE_KEY, EC_R_OPERATION_NOT_SUPPORTED);
+ return 0;
+}