Skip to content

Commit 1afebbe

Browse files
committed
* modules/ssl/ssl_private.h (SSLModConfigRec): Make szCryptoDevice
conditional on ENGINE API support. * modules/ssl/ssl_engine_config.c (ssl_cmd_SSLCryptoDevice): Log a warning if the directive is used in a non-ENGINE OpenSSL build; only touch szCryptoDevice for with-ENGINE builds. * modules/ssl/ssl_engine_init.c (ssl_init_server_certs): Only use szCryptoDevice for with-ENGINE builds. Submitted by: Joe Orton <jorton redhat.com> Github: closes #559 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1928874 13f79535-47bb-0310-9956-ffa450edef68
1 parent def23ce commit 1afebbe

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

modules/ssl/ssl_engine_config.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -693,14 +693,17 @@ const char *ssl_cmd_SSLCryptoDevice(cmd_parms *cmd,
693693
}
694694

695695
if (strcEQ(arg, "builtin")) {
696+
#if !MODSSL_HAVE_ENGINE_API
697+
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server, APLOGNO(10542)
698+
"'SSLCryptoDevice builtin' is deprecated and has no effect");
699+
#else
696700
mc->szCryptoDevice = NULL;
697701
}
698-
#if MODSSL_HAVE_ENGINE_API
699702
else if ((e = ENGINE_by_id(arg))) {
700703
mc->szCryptoDevice = arg;
701704
ENGINE_free(e);
702-
}
703705
#endif
706+
}
704707
else {
705708
err = "SSLCryptoDevice: Invalid argument; must be one of: "
706709
"'builtin' (none)";

modules/ssl/ssl_engine_init.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,6 +1546,12 @@ static int ssl_no_passwd_prompt_cb(char *buf, int size, int rwflag,
15461546
&& ERR_GET_REASON(ec) != X509_R_UNKNOWN_KEY_TYPE))
15471547
#endif
15481548

1549+
#if MODSSL_HAVE_ENGINE_API
1550+
#define LOG_SOURCE(mc_) ((mc_)->szCryptoDevice ? (mc_)->szCryptoDevice : "provider")
1551+
#else
1552+
#define LOG_SOURCE(mc_) "provider"
1553+
#endif
1554+
15491555
static apr_status_t ssl_init_server_certs(server_rec *s,
15501556
apr_pool_t *p,
15511557
apr_pool_t *ptemp,
@@ -1623,9 +1629,7 @@ static apr_status_t ssl_init_server_certs(server_rec *s,
16231629
if (SSL_CTX_use_certificate(mctx->ssl_ctx, cert) < 1) {
16241630
ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, APLOGNO(10137)
16251631
"Failed to configure certificate %s from %s, check %s",
1626-
key_id, mc->szCryptoDevice ?
1627-
mc->szCryptoDevice : "provider",
1628-
certfile);
1632+
key_id, LOG_SOURCE(mc), certfile);
16291633
ssl_log_ssl_error(SSLLOG_MARK, APLOG_EMERG, s);
16301634
return APR_EGENERAL;
16311635
}
@@ -1637,8 +1641,7 @@ static apr_status_t ssl_init_server_certs(server_rec *s,
16371641
if (SSL_CTX_use_PrivateKey(mctx->ssl_ctx, pkey) < 1) {
16381642
ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, APLOGNO(10130)
16391643
"Failed to configure private key %s from %s",
1640-
keyfile, mc->szCryptoDevice ?
1641-
mc->szCryptoDevice : "provider");
1644+
keyfile, LOG_SOURCE(mc));
16421645
ssl_log_ssl_error(SSLLOG_MARK, APLOG_EMERG, s);
16431646
return APR_EGENERAL;
16441647
}

modules/ssl/ssl_private.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,9 @@ typedef struct {
704704
apr_array_header_t *aRandSeed;
705705
#endif
706706

707+
#if MODSSL_HAVE_ENGINE_API
707708
const char *szCryptoDevice; /* ENGINE device (if available) */
709+
#endif
708710

709711
#ifdef HAVE_OCSP_STAPLING
710712
const ap_socache_provider_t *stapling_cache;

0 commit comments

Comments
 (0)