Conversation
The new signature is setup_ecc_key(SSL_CTX, const char *). The additional argument can have one of the following values: - "auto": Follow the old behaviour to enable the default list of ECC curves if possible, which may be not-so-secure (see h2o#713). - A list of curve names or NIDs, seperated by a colon (e.g.: "P-256:brainpoolP512r"). A fairly recent version of Open/LibreSSL is required. With OpenSSL 1.1.0 group names like "ffdhe4096" may work for TLS 1.3, too. - A short name of a curve (e.g. "brainpoolP512r"). This will work with any OpenSSL version supporting ECDH. If the linked Open/LibreSSL does not support ECDHE, the silently does nothing. This may change in the future. If anything fails, the function returns but h2o won't crash. The behaviour is more or less identic to nginx'. In the current state the curve settings are compile time only.
The config key is a subkey of the ssl tree. Its value is passed to setup_ecc_key(SSL_CTX, const char *). Minor changes: - A proper error, referencing the line in the config file, is shown if something fails. - h2o now crashes when there is an error with the ECDH setup.
Documentation now has information about the new config option in the SSL section.
|
This is something that we definitely need. Thank you very much for working on the PR.
Yes. Please call the function whenever
IMO the principle should be that unless there is a bug, we should preserve the current behavior as-is, at the same time providing the users to change the curve being used. Considering that, how about an approach like below:
Note that you need to call |
Shouldn't it be possible to set a single curve if On the other hand it might create some confusion why a complete list cannot be passed. |
My understanding is that both Assuming that is correct, I'd anticipate that our users willing to prohibit 160-bit curves (which are enabled by (And FWIW, I am fine with disabling 160-bit curve by default, possibly by having our own list of default curves). I do not think that we would want to support OpenSSL 1.0.1 and earlier, considering the fact that they do not support ALPN (which is a prerequisite for HTTP/2). Note that Chromium has dropped support for NPN (the predecessor of ALPN) in 2016 (see https://blog.chromium.org/2016/02/transitioning-from-spdy-to-http2.html). |
|
The problem with a self created default list is, that compared to a cipher list, curves cannot be excluded. So it will be difficult to keep it up to date so auto seems to be the right choice here (curve detection is possible with
The current code in this PR supports OpenSSL 1.0.1 and earlier. |
OpenSSL 1.0.1 is outdated. As suggested by @kazuho setting a custom curve (besides "auto") is not supported with OpenSSL <= 1.0.1 anymore. Theis requirement is documented.
|
@kazuho As you suggested, custom curves cannot be set with OpenSSL <= 1.0.1 anymore. About tests: Is there some trivial way to test curves from |
|
Idea for tests: Try connections with different parameters against different server configurations.
|
This PR is a fix for #713 (How can I use a "stronger" ECDH curve?).
Current state:
Changes:
ecdh-curvesallows to set curves for the ECDH key exchange.auto: CallsSSL_CTX_set_ecdh_autoif required and possible. It falls back toprime256v1.brainpoolP512r1:brainpoolP384r1:brainpoolP256r1:prime256v1) which are passed toSSL_CTX_set1_curves_listif possible. This requires a fairly recent OpenSSL/LibreSSL version. In recent OpenSSL versions TLS 1.3 group names may work, too.prime256v1) which is passed toSSL_CTX_set1_curves_listor the combinationOBJ_sn2nid->EC_KEY_new_by_curve_name->SSL_CTX_set_tmp_ecdh. While it sets only a single curve, it will work with any OpenSSL supporting ECDH.Update: Not anymore. Usage of OpenSSL 1.0.1 is discouraged. OpenSSL 1.0.1 is not supported by the OpenSSL-team anymore.
SSL_OP_SINGLE_ECDH_USEwill be set if possible.To-Do:
(how?)Questions (@kazuho):
SSL_CTX_set_options(ssl_ctx, SSL_OP_SINGLE_ECDH_USE)be set? A similar one is set for normal Diffie-Hellman.Solved: Will be set.
autobe set? On LibreSSLautois a good default. Good curves might not get detected by a simple detection script which may leave the default a better one. On the handautocan be bad: Currently on (older) OpenSSL it allows old 160-bit curves by default.Solved: No (current behavior).
SSL_CTX_set_ecdh_autois not available andautofalls back toprime256v1?Solved: No (current behavior).