}
static DH *ssl_tmp_dh_callback(SSL *ssl ATTR_UNUSED,
- int is_export, int keylength)
+ int is_export ATTR_UNUSED, int keylength ATTR_UNUSED)
{
- struct ssl_iostream *ssl_io;
-
- ssl_io = SSL_get_ex_data(ssl, dovecot_ssl_extdata_index);
- /* Well, I'm not exactly sure why the logic in here is this.
- It's the same as in Postfix, so it can't be too wrong. */
- if (is_export != 0 && keylength == 512 && ssl_io->ctx->dh_512 != NULL)
- return ssl_io->ctx->dh_512;
- else
- return ssl_io->ctx->dh_default;
+ i_error("Diffie-Hellman key exchange requested, "
+ "but no DH parameters provided. Set ssh_dh=</path/to/dh.pem");
+ return NULL;
}
static int
{
DH *dh;
int ret = 0;
-
+ if (*set->dh == '\0') {
+ return 0;
+ }
if (openssl_iostream_load_dh(set, &dh, error_r) < 0)
return -1;
if (SSL_CTX_set_tmp_dh(ctx->ssl_ctx, dh) == 0) {
static int
ssl_proxy_ctx_set_crypto_params(SSL_CTX *ssl_ctx,
- const struct ssl_iostream_settings *set ATTR_UNUSED,
+ const struct ssl_iostream_settings *set,
const char **error_r ATTR_UNUSED)
{
#if defined(HAVE_ECDH) && !defined(SSL_CTX_set_ecdh_auto)
#endif
if (SSL_CTX_need_tmp_RSA(ssl_ctx) != 0)
SSL_CTX_set_tmp_rsa_callback(ssl_ctx, ssl_gen_rsa_key);
- SSL_CTX_set_tmp_dh_callback(ssl_ctx, ssl_tmp_dh_callback);
+ if (set->dh == NULL || *set->dh == '\0')
+ SSL_CTX_set_tmp_dh_callback(ssl_ctx, ssl_tmp_dh_callback);
#ifdef HAVE_ECDH
/* In the non-recommended situation where ECDH cipher suites are being
used instead of ECDHE, do not reuse the same ECDH key pair for