X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=crypto%2Fecdh%2Fech_ossl.c;h=2656797449e7075cd910bd69deaf4c6c8012b3f5;hb=a3a2e3a43d13d8486c5e100e1bef7fec8e61b27b;hp=94a8f4b696a5fcb97c3cd08ab4c471d8dc696210;hpb=67ef4f63f1fcedc7202a721007e9aac29133a668;p=oweals%2Fopenssl.git diff --git a/crypto/ecdh/ech_ossl.c b/crypto/ecdh/ech_ossl.c index 94a8f4b696..2656797449 100644 --- a/crypto/ecdh/ech_ossl.c +++ b/crypto/ecdh/ech_ossl.c @@ -146,6 +146,18 @@ 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);