Apache HTTPD
Classes | Functions | Variables
tls_proto.c File Reference
module tls_module
#include <assert.h>
#include <apr_lib.h>
#include <apr_strings.h>
#include <httpd.h>
#include <http_connection.h>
#include <http_core.h>
#include <http_log.h>
#include <rustls.h>
#include "tls_proto.h"
#include "tls_conf.h"
#include "tls_util.h"

Go to the source code of this file.

Classes

struct  rustls_cipher_t
 

Functions

tls_proto_conf_ttls_proto_init (apr_pool_t *pool, server_rec *s)
 
const chartls_proto_get_cipher_names (tls_proto_conf_t *conf, const apr_array_header_t *ciphers, apr_pool_t *pool)
 
apr_status_t tls_proto_pre_config (apr_pool_t *pool, apr_pool_t *ptemp)
 
apr_status_t tls_proto_post_config (apr_pool_t *pool, apr_pool_t *ptemp, server_rec *s)
 
static apr_status_t get_uint16_from (const char *name, const char *prefix, apr_uint16_t *pint)
 
apr_uint16_t tls_proto_get_version_by_name (tls_proto_conf_t *conf, const char *name)
 
const chartls_proto_get_version_name (tls_proto_conf_t *conf, apr_uint16_t id, apr_pool_t *pool)
 
apr_array_header_ttls_proto_create_versions_plus (tls_proto_conf_t *conf, apr_uint16_t min_version, apr_pool_t *pool)
 
int tls_proto_is_cipher_supported (tls_proto_conf_t *conf, apr_uint16_t cipher)
 
apr_status_t tls_proto_get_cipher_by_name (tls_proto_conf_t *conf, const char *name, apr_uint16_t *pcipher)
 
const chartls_proto_get_cipher_name (tls_proto_conf_t *conf, apr_uint16_t id, apr_pool_t *pool)
 
apr_array_header_ttls_proto_get_rustls_suites (tls_proto_conf_t *conf, const apr_array_header_t *ids, apr_pool_t *pool)
 

Variables

static int *const aplog_module_index = &( tls_module.module_index)
 
static tls_cipher_t KNOWN_CIPHERS []
 

Function Documentation

◆ get_uint16_from()

static apr_status_t get_uint16_from ( const char name,
const char prefix,
apr_uint16_t pint 
)
static

Definition at line 499 of file tls_proto.c.

◆ tls_proto_create_versions_plus()

apr_array_header_t * tls_proto_create_versions_plus ( tls_proto_conf_t conf,
apr_uint16_t  min_version,
apr_pool_t pool 
)

Create an array of the given TLS protocol version identifier min_version and all supported new ones. The array carries apr_uint16_t values.

Definition at line 544 of file tls_proto.c.

◆ tls_proto_get_cipher_by_name()

apr_status_t tls_proto_get_cipher_by_name ( tls_proto_conf_t conf,
const char name,
apr_uint16_t pcipher 
)

Get a TLS cipher spec by name/alias.

Definition at line 565 of file tls_proto.c.

◆ tls_proto_get_cipher_name()

const char * tls_proto_get_cipher_name ( tls_proto_conf_t conf,
apr_uint16_t  cipher,
apr_pool_t pool 
)

Get the name of a TLS cipher for the IANA assigned 16bit value. This will return the name in the protocol configuration, if the cipher is known, and create the string TLS_CIPHER_0x%04x for the 16bit cipher value.

Definition at line 576 of file tls_proto.c.

◆ tls_proto_get_cipher_names()

const char * tls_proto_get_cipher_names ( tls_proto_conf_t conf,
const apr_array_header_t ciphers,
apr_pool_t pool 
)

Get the concatenated names with ':' as separator of all TLS cipher identifiers as given in ciphers.

Parameters
confthe TLS protocol configuration
ciphersthe 16bit values of the TLS ciphers
poolto use for allocation the string.

Definition at line 464 of file tls_proto.c.

◆ tls_proto_get_rustls_suites()

apr_array_header_t * tls_proto_get_rustls_suites ( tls_proto_conf_t conf,
const apr_array_header_t ids,
apr_pool_t pool 
)

Convert an array of TLS cipher 16bit identifiers into the rustls_supported_ciphersuite instances that can be passed to crustls in session configurations. Any cipher identifier not supported by rustls we be silently omitted.

Definition at line 586 of file tls_proto.c.

◆ tls_proto_get_version_by_name()

apr_uint16_t tls_proto_get_version_by_name ( tls_proto_conf_t conf,
const char name 
)

Get the TLS protocol identifier (as used on the wire) for the TLS protocol of the given name. Returns 0 if protocol is unknown.

Definition at line 514 of file tls_proto.c.

◆ tls_proto_get_version_name()

const char * tls_proto_get_version_name ( tls_proto_conf_t conf,
apr_uint16_t  id,
apr_pool_t pool 
)

Get the name of the protocol version identified by its identifier. This will return the name from the protocol configuration or, if unknown, create the string TLSv0x%04x from the 16bit identifier.

Definition at line 530 of file tls_proto.c.

◆ tls_proto_init()

tls_proto_conf_t * tls_proto_init ( apr_pool_t p,
server_rec s 
)

Create and populate the protocol configuration.

Definition at line 420 of file tls_proto.c.

◆ tls_proto_is_cipher_supported()

int tls_proto_is_cipher_supported ( tls_proto_conf_t conf,
apr_uint16_t  cipher 
)

Return != 0 iff the cipher is supported by the rustls library.

Definition at line 560 of file tls_proto.c.

◆ tls_proto_post_config()

apr_status_t tls_proto_post_config ( apr_pool_t p,
apr_pool_t ptemp,
server_rec s 
)

Called during post-config phase to conclude the initialization of the tls protocol configuration.

Definition at line 485 of file tls_proto.c.

◆ tls_proto_pre_config()

apr_status_t tls_proto_pre_config ( apr_pool_t pool,
apr_pool_t ptemp 
)

Called during pre-config phase to start initialization of the tls protocol configuration.

Definition at line 478 of file tls_proto.c.

Variable Documentation

◆ aplog_module_index

int* const aplog_module_index = &( tls_module.module_index)
static

Definition at line 32 of file tls_proto.c.

◆ KNOWN_CIPHERS

tls_cipher_t KNOWN_CIPHERS[]
static