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

Go to the source code of this file.

Functions

tls_data_t tls_data_from_str (const char *s)
 
tls_data_t tls_data_assign_copy (apr_pool_t *p, const tls_data_t *d)
 
tls_data_ttls_data_copy (apr_pool_t *p, const tls_data_t *d)
 
const chartls_data_to_str (apr_pool_t *p, const tls_data_t *d)
 
apr_status_t tls_util_rustls_error (apr_pool_t *p, rustls_result rr, const char **perr_descr)
 
int tls_util_is_file (apr_pool_t *p, const char *fpath)
 
apr_status_t tls_util_file_load (apr_pool_t *p, const char *fpath, apr_size_t min_len, apr_size_t max_len, tls_data_t *data)
 
int tls_util_array_uint16_contains (const apr_array_header_t *a, apr_uint16_t n)
 
const apr_array_header_ttls_util_array_uint16_remove (apr_pool_t *pool, const apr_array_header_t *from, const apr_array_header_t *others)
 
apr_status_t tls_util_brigade_transfer (apr_bucket_brigade *dest, apr_bucket_brigade *src, apr_off_t length, apr_off_t *pnout)
 
apr_status_t tls_util_brigade_copy (apr_bucket_brigade *dest, apr_bucket_brigade *src, apr_off_t length, apr_off_t *pnout)
 
apr_status_t tls_util_brigade_split_line (apr_bucket_brigade *dest, apr_bucket_brigade *src, apr_read_type_e block, apr_off_t length, apr_off_t *pnout)
 
int tls_util_name_matches_server (const char *name, server_rec *s)
 
apr_size_t tls_util_bucket_print (char *buffer, apr_size_t bmax, apr_bucket *b, const char *sep)
 
apr_size_t tls_util_bb_print (char *buffer, apr_size_t bmax, const char *tag, const char *sep, apr_bucket_brigade *bb)
 

Variables

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

Function Documentation

◆ tls_data_assign_copy()

tls_data_t tls_data_assign_copy ( apr_pool_t p,
const tls_data_t d 
)

Return a copy of a tls_data_t bytes allocated from pool.

Definition at line 43 of file tls_util.c.

◆ tls_data_copy()

tls_data_t * tls_data_copy ( apr_pool_t p,
const tls_data_t d 
)

Create a copy of a tls_data_t using the given pool.

Definition at line 51 of file tls_util.c.

◆ tls_data_from_str()

tls_data_t tls_data_from_str ( const char s)

Return a tls_data_t for a string.

Definition at line 35 of file tls_util.c.

◆ tls_data_to_str()

const char * tls_data_to_str ( apr_pool_t p,
const tls_data_t d 
)

Convert the data bytes in d into a NUL-terminated string. There is no check if the data bytes already contain NUL.

Definition at line 59 of file tls_util.c.

◆ tls_util_array_uint16_contains()

int tls_util_array_uint16_contains ( const apr_array_header_t a,
apr_uint16_t  n 
)

Return != 0 iff the array of apr_uint16_t contains value n.

Definition at line 141 of file tls_util.c.

◆ tls_util_array_uint16_remove()

const apr_array_header_t * tls_util_array_uint16_remove ( apr_pool_t pool,
const apr_array_header_t from,
const apr_array_header_t others 
)

Remove all apr_uint16_t in others from array from. Returns the new array or, if no overlap was found, the from array unchanged.

Definition at line 150 of file tls_util.c.

◆ tls_util_bb_print()

apr_size_t tls_util_bb_print ( char buffer,
apr_size_t  bmax,
const char tag,
const char sep,
apr_bucket_brigade bb 
)

Prints the brigade bucket types and lengths into the given buffer up to bmax.

Returns
number of characters printed

Definition at line 338 of file tls_util.c.

◆ tls_util_brigade_copy()

apr_status_t tls_util_brigade_copy ( apr_bucket_brigade dest,
apr_bucket_brigade src,
apr_off_t  length,
apr_off_t pnout 
)

Copy up to <length> bytes from <src> to <dest>, including all encountered meta data buckets. <src> remains semantically unchaanged, meaning there might have been buckets split or changed while reading their content. Return the actual byte count copied in <pnout>.

Definition at line 219 of file tls_util.c.

◆ tls_util_brigade_split_line()

apr_status_t tls_util_brigade_split_line ( apr_bucket_brigade dest,
apr_bucket_brigade src,
apr_read_type_e  block,
apr_off_t  length,
apr_off_t pnout 
)

Get a line of max length bytes from src into dest. Return the number of bytes transferred in pnout.

Definition at line 265 of file tls_util.c.

◆ tls_util_brigade_transfer()

apr_status_t tls_util_brigade_transfer ( apr_bucket_brigade dest,
apr_bucket_brigade src,
apr_off_t  length,
apr_off_t pnout 
)

Transfer up to <length> bytes from <src> to <dest>, including all encountered meta data buckets. The transferred buckets/data are removed from <src>. Return the actual byte count transferred in <pnout>.

Definition at line 175 of file tls_util.c.

◆ tls_util_bucket_print()

apr_size_t tls_util_bucket_print ( char buffer,
apr_size_t  bmax,
apr_bucket b,
const char sep 
)

Print a bucket's meta data (type and length) to the buffer.

Returns
number of characters printed

Definition at line 316 of file tls_util.c.

◆ tls_util_file_load()

apr_status_t tls_util_file_load ( apr_pool_t p,
const char fpath,
apr_size_t  min_len,
apr_size_t  max_len,
tls_data_t data 
)

< Type

< Size of the file

< Open the file for reading

Definition at line 89 of file tls_util.c.

◆ tls_util_is_file()

int tls_util_is_file ( apr_pool_t p,
const char fpath 
)

Return != 0 if fpath is a 'real' file.

< Type

< Size of the file

Definition at line 79 of file tls_util.c.

◆ tls_util_name_matches_server()

int tls_util_name_matches_server ( const char name,
server_rec s 
)

Return != 0 iff the given <name> matches the configured 'ServerName' or one of the 'ServerAlias' name of , including wildcard patterns as understood by ap_strcasecmp_match().

Definition at line 292 of file tls_util.c.

◆ tls_util_rustls_error()

apr_status_t tls_util_rustls_error ( apr_pool_t p,
rustls_result  rr,
const char **  perr_descr 
)

Inspect a 'rustls_result', retrieve the error description for it and return the apr_status_t to use as our error status.

Definition at line 66 of file tls_util.c.

Variable Documentation

◆ aplog_module_index

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

Definition at line 32 of file tls_util.c.