ssl_private.h 36.8 KB
Newer Older
powelld's avatar
powelld committed
/**  Logfile Support  */
void         ssl_log_ssl_error(const char *, int, int, server_rec *);

/* ssl_log_xerror, ssl_log_cxerror and ssl_log_rxerror are wrappers for the
 * respective ap_log_*error functions and take a certificate as an
 * additional argument (whose details are appended to the log message).
 * The other arguments are interpreted exactly as with their ap_log_*error
 * counterparts. */
void ssl_log_xerror(const char *file, int line, int level,
                    apr_status_t rv, apr_pool_t *p, server_rec *s,
                    X509 *cert, const char *format, ...)
    __attribute__((format(printf,8,9)));

void ssl_log_cxerror(const char *file, int line, int level,
                     apr_status_t rv, conn_rec *c, X509 *cert,
                     const char *format, ...)
    __attribute__((format(printf,7,8)));

void ssl_log_rxerror(const char *file, int line, int level,
                     apr_status_t rv, request_rec *r, X509 *cert,
                     const char *format, ...)
    __attribute__((format(printf,7,8)));

#define SSLLOG_MARK              __FILE__,__LINE__

/**  Variables  */

/* Register variables for the lifetime of the process pool 'p'. */
void         ssl_var_register(apr_pool_t *p);
char        *ssl_var_lookup(apr_pool_t *, server_rec *, conn_rec *, request_rec *, char *);
apr_array_header_t *ssl_ext_list(apr_pool_t *p, conn_rec *c, int peer, const char *extension);

void         ssl_var_log_config_register(apr_pool_t *p);

/* Extract SSL_*_DN_* variables into table 't' from SSL object 'ssl',
 * allocating from 'p': */
void modssl_var_extract_dns(apr_table_t *t, SSL *ssl, apr_pool_t *p);

/* Extract SSL_*_SAN_* variables (subjectAltName entries) into table 't'
 * from SSL object 'ssl', allocating from 'p'. */
void modssl_var_extract_san_entries(apr_table_t *t, SSL *ssl, apr_pool_t *p);

#ifndef OPENSSL_NO_OCSP
/* Perform OCSP validation of the current cert in the given context.
 * Returns non-zero on success or zero on failure.  On failure, the
 * context error code is set. */
int modssl_verify_ocsp(X509_STORE_CTX *ctx, SSLSrvConfigRec *sc,
                       server_rec *s, conn_rec *c, apr_pool_t *pool);

/* OCSP helper interface; dispatches the given OCSP request to the
 * responder at the given URI.  Returns the decoded OCSP response
 * object, or NULL on error (in which case, errors will have been
 * logged).  Pool 'p' is used for temporary allocations. */
OCSP_RESPONSE *modssl_dispatch_ocsp_request(const apr_uri_t *uri,
                                            apr_interval_time_t timeout,
                                            OCSP_REQUEST *request,
                                            conn_rec *c, apr_pool_t *p);

/* Initialize OCSP trusted certificate list */
void ssl_init_ocsp_certificates(server_rec *s, modssl_ctx_t *mctx);

#endif

/* Retrieve DH parameters for given key length.  Return value should
 * be treated as unmutable, since it is stored in process-global
 * memory. */
DH *modssl_get_dh_params(unsigned keylen);

#endif /* SSL_PRIVATE_H */
/** @} */