summaryrefslogtreecommitdiff
path: root/drivers/builtin_openssl2/crypto/ecdh/ech_ossl.c
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2016-04-18 19:21:46 +0200
committerRémi Verschelde <remi@verschelde.fr>2016-04-18 19:21:46 +0200
commit206895afae413df9a3961ce6793ce295babb5920 (patch)
tree0b16a8466e9f0f054176ecfb2fa24a6b942fcec6 /drivers/builtin_openssl2/crypto/ecdh/ech_ossl.c
parent336cbfa7b63721757874f0fc5c33ec5dd31c5076 (diff)
parente97922f22038e9049ed4c2db5b3736dfaa0edde3 (diff)
Merge pull request #4329 from mrezai/openssl-1.0.2g
Update OpenSSL to version 1.0.2g
Diffstat (limited to 'drivers/builtin_openssl2/crypto/ecdh/ech_ossl.c')
-rw-r--r--drivers/builtin_openssl2/crypto/ecdh/ech_ossl.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/builtin_openssl2/crypto/ecdh/ech_ossl.c b/drivers/builtin_openssl2/crypto/ecdh/ech_ossl.c
index d448b19a52..df115cc262 100644
--- a/drivers/builtin_openssl2/crypto/ecdh/ech_ossl.c
+++ b/drivers/builtin_openssl2/crypto/ecdh/ech_ossl.c
@@ -138,6 +138,16 @@ static int ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key,
}
group = EC_KEY_get0_group(ecdh);
+
+ if (EC_KEY_get_flags(ecdh) & EC_FLAG_COFACTOR_ECDH) {
+ if (!EC_GROUP_get_cofactor(group, x, ctx) ||
+ !BN_mul(x, x, priv_key, ctx)) {
+ ECDHerr(ECDH_F_ECDH_COMPUTE_KEY, ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+ priv_key = x;
+ }
+
if ((tmp = EC_POINT_new(group)) == NULL) {
ECDHerr(ECDH_F_ECDH_COMPUTE_KEY, ERR_R_MALLOC_FAILURE);
goto err;