mod_ssl: follow up to r1876934: wrap DH_bits()
DH_get0_p() seems to be undefined for some openssl versions, so it can't
be used to implement DH_bits() generically.
Add new a modssl_DH_bits() wrapper to call DH_bits() for openssl < 3,
and BN_num_bits(DH_get0_p(dh)) otherwise.
@@ -1322,6 +1322,15 @@ static int ssl_no_passwd_prompt_cb(char *buf, int size, int rwflag,
return 0;
}
+static APR_INLINE int modssl_DH_bits(DH *dh)
+{
+#if OPENSSL_VERSION_NUMBER < 0x30000000L
+ return DH_bits(dh);
+#else
+ return BN_num_bits(DH_get0_p(dh));
+#endif
+}
+
static apr_status_t ssl_init_server_certs(server_rec *s,
apr_pool_t *p,
apr_pool_t *ptemp,
@@ -1521,7 +1530,7 @@ static apr_status_t ssl_init_server_certs(server_rec *s,
SSL_CTX_set_tmp_dh(mctx->ssl_ctx, dh);
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(02540)
"Custom DH parameters (%d bits) for %s loaded from %s",
- BN_num_bits(DH_get0_p(dh)), vhost_id, certfile);
+ modssl_DH_bits(dh), vhost_id, certfile);
DH_free(dh);
}
