Skip to content

ecdh_curve from lws_context_creation_info is copied but never applied to client SSL_CTX #3655

Description

@sush126

lws_context_creation_info.ecdh_curve is documented for configuring TLS elliptic curve groups. In lws_create_vhost() the value is correctly copied into vh->tls.ecdh_curve:

if (info->ecdh_curve)
    lws_strncpy(vh->tls.ecdh_curve, info->ecdh_curve,
                sizeof(vh->tls.ecdh_curve));

However, lws_tls_client_create_vhost_context() in openssl-client.c never calls SSL_CTX_set1_groups_list() (or the older SSL_CTX_set1_curves_list()) on the client SSL_CTX using this value. As a result, the ecdh_curve setting has no effect on TLS clients — the client always advertises OpenSSL's default supported_groups in the ClientHello, ignoring the user's configuration entirely.
By contrast, the server-side code in openssl-server.c does partially handle ecdh_curve (via SSL_CTX_set_tmp_ecdh() / OBJ_sn2nid()), but only for a single curve name, not a colon-separated list.

Additional Issue: vh->tls.ecdh_curve buffer too small for group lists

vh->tls.ecdh_curve is declared as char ecdh_curve[16] in lib/tls/private-network.h. A colon-separated list such as "X25519:P-256:P-384:P-521" (24 bytes + NUL) is silently truncated by lws_strncpy() to "X25519:P-256:P-" — an invalid value. The buffer should be enlarged to accommodate realistic group lists.

On OpenSSL 3.4+, the default supported_groups includes post-quantum groups (X25519MLKEM768) and FFDH groups (ffdhe2048, ffdhe3072) which many deployments need to suppress for interoperability or compliance. The ecdh_curve field is the intended API for this, but it is silently a no-op for clients.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions