mirror of
https://github.com/apache/httpd.git
synced 2025-08-08 15:02:10 +03:00
Remove the hardcoded algorithm-type dependency for the SSLCertificateFile
and SSLCertificateKeyFile directives, and deprecate SSLCertificateChainFile Splitting the patch into smaller pieces turned out to be infeasible, unfortunately, due to the heavily intertwined code in ssl_engine_config.c, ssl_engine_init.c and ssl_engine_pphrase.c, which all depends on the modssl_pk_server_t data structure. For better comprehensibility, a detailed listing of the changes follows: ssl_private.h - drop the X509 certs and EVP_PKEY keys arrays from modssl_pk_server_t - use apr_array_header_t for cert_files and key_files - drop tPublicCert from SSLModConfigRec - drop the ssl_algo_t struct and the SSL_ALGO_* and SSL_AIDX_* constants ssl_engine_config.c - change to apr_array_header_t for SSLCertificate[Key]File - drop ssl_cmd_check_aidx_max, i.e. allow an arbitrary number of certs and keys (in theory; currently OpenSSL does not support more than one cert/key per algorithm type) - add deprecation warning for SSLCertificateChainFile ssl_engine_init.c - configure server certs/keys in ssl_init_server_certs (no longer via ssl_pphrase_Handle in ssl_init_Module) - in ssl_init_server_certs, read in certificates and keys with standard OpenSSL API functions (SSL_CTX_use_*_file), and only fall back to ssl_load_encrypted_pkey when encountering an encrypted private key - drop ssl_server_import_cert, ssl_server_import_key, ssl_init_server_check, and ssl_init_ctx_cleanup_server - move the "problematic re-initialization" check to ssl_init_server_ctx ssl_engine_pphrase.c - use servername:port:index as the key identifier, instead of the previously used servername:port:algorithm - ssl_pphrase_Handle overhaul: remove all cert/public-key handling, make it only load a single (encrypted) private key, and rename to ssl_load_encrypted_pkey - in the passphrase prompt message, show the private key file name instead of the vhost id and the algorithm name - do no longer supply the algorithm name as an argument to "exec"-type passphrase prompting programs ssl_util.c - drop ssl_util_algotypeof, ssl_util_algotypestr, ssl_asn1_keystr, and ssl_asn1_table_keyfmt ssl_util_ssl.{c,h} - drop SSL_read_X509 - constify the filename arg for SSL_read_PrivateKey git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1553824 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -135,61 +135,8 @@ BOOL ssl_util_path_check(ssl_pathcheck_t pcm, const char *path, apr_pool_t *p)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
ssl_algo_t ssl_util_algotypeof(X509 *pCert, EVP_PKEY *pKey)
|
||||
{
|
||||
ssl_algo_t t;
|
||||
EVP_PKEY *pFreeKey = NULL;
|
||||
|
||||
t = SSL_ALGO_UNKNOWN;
|
||||
if (pCert != NULL)
|
||||
pFreeKey = pKey = X509_get_pubkey(pCert);
|
||||
if (pKey != NULL) {
|
||||
switch (EVP_PKEY_type(pKey->type)) {
|
||||
case EVP_PKEY_RSA:
|
||||
t = SSL_ALGO_RSA;
|
||||
break;
|
||||
case EVP_PKEY_DSA:
|
||||
t = SSL_ALGO_DSA;
|
||||
break;
|
||||
#ifdef HAVE_ECC
|
||||
case EVP_PKEY_EC:
|
||||
t = SSL_ALGO_ECC;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (pFreeKey != NULL)
|
||||
EVP_PKEY_free(pFreeKey);
|
||||
return t;
|
||||
}
|
||||
|
||||
char *ssl_util_algotypestr(ssl_algo_t t)
|
||||
{
|
||||
char *cp;
|
||||
|
||||
cp = "UNKNOWN";
|
||||
switch (t) {
|
||||
case SSL_ALGO_RSA:
|
||||
cp = "RSA";
|
||||
break;
|
||||
case SSL_ALGO_DSA:
|
||||
cp = "DSA";
|
||||
break;
|
||||
#ifdef HAVE_ECC
|
||||
case SSL_ALGO_ECC:
|
||||
cp = "ECC";
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return cp;
|
||||
}
|
||||
|
||||
/*
|
||||
* certain key and cert data needs to survive restarts,
|
||||
* certain key data needs to survive restarts,
|
||||
* which are stored in the user data table of s->process->pool.
|
||||
* to prevent "leaking" of this data, we use malloc/free
|
||||
* rather than apr_palloc and these wrappers to help make sure
|
||||
@@ -253,30 +200,6 @@ void ssl_asn1_table_unset(apr_hash_t *table,
|
||||
apr_hash_set(table, key, klen, NULL);
|
||||
}
|
||||
|
||||
#ifdef HAVE_ECC
|
||||
static const char *ssl_asn1_key_types[] = {"RSA", "DSA", "ECC"};
|
||||
#else
|
||||
static const char *ssl_asn1_key_types[] = {"RSA", "DSA"};
|
||||
#endif
|
||||
|
||||
const char *ssl_asn1_keystr(int keytype)
|
||||
{
|
||||
if (keytype >= SSL_AIDX_MAX) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return ssl_asn1_key_types[keytype];
|
||||
}
|
||||
|
||||
const char *ssl_asn1_table_keyfmt(apr_pool_t *p,
|
||||
const char *id,
|
||||
int keytype)
|
||||
{
|
||||
const char *keystr = ssl_asn1_keystr(keytype);
|
||||
|
||||
return apr_pstrcat(p, id, ":", keystr, NULL);
|
||||
}
|
||||
|
||||
#if APR_HAS_THREADS
|
||||
/*
|
||||
* To ensure thread-safetyness in OpenSSL - work in progress
|
||||
|
Reference in New Issue
Block a user