Blame modules/ssl/mod_ssl_openssl.h

Packit 90a5c9
/* Licensed to the Apache Software Foundation (ASF) under one or more
Packit 90a5c9
 * contributor license agreements.  See the NOTICE file distributed with
Packit 90a5c9
 * this work for additional information regarding copyright ownership.
Packit 90a5c9
 * The ASF licenses this file to You under the Apache License, Version 2.0
Packit 90a5c9
 * (the "License"); you may not use this file except in compliance with
Packit 90a5c9
 * the License.  You may obtain a copy of the License at
Packit 90a5c9
 *
Packit 90a5c9
 *     http://www.apache.org/licenses/LICENSE-2.0
Packit 90a5c9
 *
Packit 90a5c9
 * Unless required by applicable law or agreed to in writing, software
Packit 90a5c9
 * distributed under the License is distributed on an "AS IS" BASIS,
Packit 90a5c9
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Packit 90a5c9
 * See the License for the specific language governing permissions and
Packit 90a5c9
 * limitations under the License.
Packit 90a5c9
 */
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * @file mod_ssl_openssl.h
Packit 90a5c9
 * @brief Interface to OpenSSL-specific APIs provided by mod_ssl
Packit 90a5c9
 *
Packit 90a5c9
 * @defgroup MOD_SSL mod_ssl_openssl
Packit 90a5c9
 * @ingroup  APACHE_MODS
Packit 90a5c9
 * @{
Packit 90a5c9
 */
Packit 90a5c9
Packit 90a5c9
#ifndef __MOD_SSL_OPENSSL_H__
Packit 90a5c9
#define __MOD_SSL_OPENSSL_H__
Packit 90a5c9
Packit 90a5c9
#include "mod_ssl.h"
Packit 90a5c9
Packit 90a5c9
/* OpenSSL headers */
Packit 90a5c9
Packit 90a5c9
#ifndef SSL_PRIVATE_H
Packit 90a5c9
#include <openssl/opensslv.h>
Packit 90a5c9
#if (OPENSSL_VERSION_NUMBER >= 0x10001000)
Packit 90a5c9
/* must be defined before including ssl.h */
Packit 90a5c9
#define OPENSSL_NO_SSL_INTERN
Packit 90a5c9
#endif
Packit 90a5c9
#include <openssl/ssl.h>
Packit 90a5c9
#endif
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * init_server hook -- allow SSL_CTX-specific initialization to be performed by
Packit 90a5c9
 * a module for each SSL-enabled server (one at a time)
Packit 90a5c9
 * @param s SSL-enabled [virtual] server
Packit 90a5c9
 * @param p pconf pool
Packit 90a5c9
 * @param is_proxy 1 if this server supports backend connections
Packit 90a5c9
 * over SSL/TLS, 0 if it supports client connections over SSL/TLS
Packit 90a5c9
 * @param ctx OpenSSL SSL Context for the server
Packit 90a5c9
 */
Packit 90a5c9
APR_DECLARE_EXTERNAL_HOOK(ssl, SSL, int, init_server,
Packit 90a5c9
                          (server_rec *s, apr_pool_t *p, int is_proxy, SSL_CTX *ctx))
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * pre_handshake hook
Packit 90a5c9
 * @param c conn_rec for new connection from client or to backend server
Packit 90a5c9
 * @param ssl OpenSSL SSL Connection for the client or backend server
Packit 90a5c9
 * @param is_proxy 1 if this handshake is for a backend connection, 0 otherwise
Packit 90a5c9
 */
Packit 90a5c9
APR_DECLARE_EXTERNAL_HOOK(ssl, SSL, int, pre_handshake,
Packit 90a5c9
                          (conn_rec *c, SSL *ssl, int is_proxy))
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * proxy_post_handshake hook -- allow module to abort after successful
Packit 90a5c9
 * handshake with backend server and subsequent peer checks
Packit 90a5c9
 * @param c conn_rec for connection to backend server
Packit 90a5c9
 * @param ssl OpenSSL SSL Connection for the client or backend server
Packit 90a5c9
 */
Packit 90a5c9
APR_DECLARE_EXTERNAL_HOOK(ssl, SSL, int, proxy_post_handshake,
Packit 90a5c9
                          (conn_rec *c, SSL *ssl))
Packit 90a5c9
Packit 20f7c8
/** On TLS connections that do not relate to a configured virtual host,
Packit 20f7c8
 * allow other modules to provide a X509 certificate and EVP_PKEY to
Packit 20f7c8
 * be used on the connection. This first hook which does not
Packit 20f7c8
 * return DECLINED will determine the outcome. */
Packit 20f7c8
APR_DECLARE_EXTERNAL_HOOK(ssl, SSL, int, answer_challenge,
Packit 20f7c8
                          (conn_rec *c, const char *server_name, 
Packit 20f7c8
                          X509 **pcert, EVP_PKEY **pkey))
Packit 20f7c8
Packit 20f7c8
/** During post_config phase, ask around if someone wants to provide
Packit 20f7c8
 * OCSP stapling status information for the given cert (with the also
Packit 20f7c8
 * provided issuer certificate). The first hook which does not
Packit 20f7c8
 * return DECLINED promises to take responsibility (and respond
Packit 20f7c8
 * in later calls via hook ssl_get_stapling_status).
Packit 20f7c8
 * If no hook takes over, mod_ssl's own stapling implementation will
Packit 20f7c8
 * be applied (if configured).
Packit 20f7c8
 */
Packit 20f7c8
APR_DECLARE_EXTERNAL_HOOK(ssl, SSL, int, init_stapling_status,
Packit 20f7c8
                          (server_rec *s, apr_pool_t *p, 
Packit 20f7c8
                          X509 *cert, X509 *issuer))
Packit 20f7c8
Packit 20f7c8
/** Anyone answering positive to ssl_init_stapling_status for a 
Packit 20f7c8
 * certificate, needs to register here and supply the actual OCSP stapling
Packit 20f7c8
 * status data (OCSP_RESP) for a new connection.
Packit 20f7c8
 * A hook supplying the response data must return APR_SUCCESS.
Packit 20f7c8
 * The data is returned in DER encoded bytes via pder and pderlen. The
Packit 20f7c8
 * returned pointer may be NULL, which indicates that data is (currently)
Packit 20f7c8
 * unavailable.
Packit 20f7c8
 * If DER data is returned, it MUST come from a response with
Packit 20f7c8
 * status OCSP_RESPONSE_STATUS_SUCCESSFUL and V_OCSP_CERTSTATUS_GOOD
Packit 20f7c8
 * or V_OCSP_CERTSTATUS_REVOKED, not V_OCSP_CERTSTATUS_UNKNOWN. This means
Packit 20f7c8
 * errors in OCSP retrieval are to be handled/logged by the hook and
Packit 20f7c8
 * are not done by mod_ssl.
Packit 20f7c8
 * Any DER bytes returned MUST be allocated via malloc() and ownership
Packit 20f7c8
 * passes to mod_ssl. Meaning, the hook must return a malloced copy of
Packit 20f7c8
 * the data it has. mod_ssl (or OpenSSL) will free it. 
Packit 20f7c8
 */
Packit 20f7c8
APR_DECLARE_EXTERNAL_HOOK(ssl, SSL, int, get_stapling_status,
Packit 20f7c8
                          (unsigned char **pder, int *pderlen, 
Packit 20f7c8
                          conn_rec *c, server_rec *s, X509 *cert))
Packit 20f7c8
                          
Packit 90a5c9
#endif /* __MOD_SSL_OPENSSL_H__ */
Packit 90a5c9
/** @} */