@Override
    protected int computeKey(byte[] buffer, OpenSSLKey theirPublicKey, OpenSSLKey ourPrivateKey) throws InvalidKeyException {
        return NativeCrypto.ECDH_compute_key(
                buffer,
                0,
                theirPublicKey.getNativeRef(),
                ourPrivateKey.getNativeRef());
    }
Elliptic Curve Diffie-Hellman key agreement backed by the OpenSSL engine.
common/src/main/java/org/conscrypt/OpenSSLECDHKeyAgreement.java