@Override
    protected int getOutputSize(OpenSSLKey openSslKey) {
        int fieldSizeBits = NativeCrypto.EC_GROUP_get_degree(new NativeRef.EC_GROUP(
                NativeCrypto.EC_KEY_get1_group(openSslKey.getNativeRef())));
        return (fieldSizeBits + 7) / 8;
    }
Elliptic Curve Diffie-Hellman key agreement backed by the OpenSSL engine.
common/src/main/java/org/conscrypt/OpenSSLECDHKeyAgreement.java