2 ** _ __ ___ ___ __| | ___ ___| | mod_ssl
3 ** | '_ ` _ \ / _ \ / _` | / __/ __| | Apache Interface to OpenSSL
4 ** | | | | | | (_) | (_| | \__ \__ \ | www.modssl.org
5 ** |_| |_| |_|\___/ \__,_|___|___/___/_| ftp.modssl.org
11 /* ====================================================================
12 * The Apache Software License, Version 1.1
14 * Copyright (c) 2000-2001 The Apache Software Foundation. All rights
17 * Redistribution and use in source and binary forms, with or without
18 * modification, are permitted provided that the following conditions
21 * 1. Redistributions of source code must retain the above copyright
22 * notice, this list of conditions and the following disclaimer.
24 * 2. Redistributions in binary form must reproduce the above copyright
25 * notice, this list of conditions and the following disclaimer in
26 * the documentation and/or other materials provided with the
29 * 3. The end-user documentation included with the redistribution,
30 * if any, must include the following acknowledgment:
31 * "This product includes software developed by the
32 * Apache Software Foundation (http://www.apache.org/)."
33 * Alternately, this acknowledgment may appear in the software itself,
34 * if and wherever such third-party acknowledgments normally appear.
36 * 4. The names "Apache" and "Apache Software Foundation" must
37 * not be used to endorse or promote products derived from this
38 * software without prior written permission. For written
39 * permission, please contact apache@apache.org.
41 * 5. Products derived from this software may not be called "Apache",
42 * nor may "Apache" appear in their name, without prior written
43 * permission of the Apache Software Foundation.
45 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
46 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
47 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
48 * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
49 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
50 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
51 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
52 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
53 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
54 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
55 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
57 * ====================================================================
59 /* ``The Apache Group: a collection
60 of talented individuals who are
61 trying to perfect the art of
62 never finishing something.''
67 #define MOD_SSL_VERSION "3.0a0"
70 * Optionally enable the experimental stuff, but allow the user to
71 * override the decision which experimental parts are included by using
72 * CFLAGS="-DSSL_EXPERIMENTAL_xxxx_IGNORE".
74 #ifdef SSL_EXPERIMENTAL
75 #ifndef SSL_EXPERIMENTAL_PERDIRCA_IGNORE
76 #define SSL_EXPERIMENTAL_PERDIRCA
78 #ifndef SSL_EXPERIMENTAL_PROXY_IGNORE
79 #define SSL_EXPERIMENTAL_PROXY
82 #ifndef SSL_EXPERIMENTAL_ENGINE_IGNORE
83 #define SSL_EXPERIMENTAL_ENGINE
86 #endif /* SSL_EXPERIMENTAL */
89 * Power up our brain...
97 #include <sys/types.h>
100 #if APR_HAVE_SYS_TIME_H
101 #include <sys/time.h>
103 /* XXX: these better go away */
106 /* OpenSSL headers */
107 #include <openssl/ssl.h>
108 #include <openssl/err.h>
109 #include <openssl/x509.h>
110 #include <openssl/x509v3.h>
111 #include <openssl/pem.h>
112 #include <openssl/crypto.h>
113 #include <openssl/evp.h>
114 #include <openssl/rand.h>
115 #ifdef SSL_EXPERIMENTAL_ENGINE
116 #include <openssl/engine.h>
122 #include "http_config.h"
123 #include "http_core.h"
124 #include "http_log.h"
125 #include "http_main.h"
126 #include "http_connection.h"
127 #include "http_request.h"
128 #include "http_protocol.h"
129 #include "util_script.h"
130 #include "util_filter.h"
132 #include "apr_strings.h"
133 #include "apr_tables.h"
135 #include "apr_fnmatch.h"
136 #include "apr_strings.h"
140 /* mod_ssl headers */
141 #include "ssl_expr.h"
142 #include "ssl_util_ssl.h"
143 #include "ssl_util_table.h"
146 * Provide reasonable default for some defines
152 #define TRUE (!FALSE)
155 #define PFALSE ((void *)FALSE)
158 #define PTRUE ((void *)TRUE)
168 #define RAND_MAX INT_MAX
172 * Provide reasonable defines for some types
175 #define BOOL unsigned int
178 #define UCHAR unsigned char
182 * Provide useful shorthands
184 #define strEQ(s1,s2) (strcmp(s1,s2) == 0)
185 #define strNE(s1,s2) (strcmp(s1,s2) != 0)
186 #define strEQn(s1,s2,n) (strncmp(s1,s2,n) == 0)
187 #define strNEn(s1,s2,n) (strncmp(s1,s2,n) != 0)
189 #define strcEQ(s1,s2) (strcasecmp(s1,s2) == 0)
190 #define strcNE(s1,s2) (strcasecmp(s1,s2) != 0)
191 #define strcEQn(s1,s2,n) (strncasecmp(s1,s2,n) == 0)
192 #define strcNEn(s1,s2,n) (strncasecmp(s1,s2,n) != 0)
194 #define strIsEmpty(s) (s == NULL || s[0] == NUL)
196 #define cfgMerge(el,unset) new->el = add->el == unset ? base->el : add->el
197 #define cfgMergeArray(el) new->el = apr_array_append(p, add->el, base->el)
198 #define cfgMergeTable(el) new->el = apr_table_overlay(p, add->el, base->el)
199 #define cfgMergeCtx(el) new->el = apr_table_overlay(p, add->el, base->el)
200 #define cfgMergeString(el) cfgMerge(el, NULL)
201 #define cfgMergeBool(el) cfgMerge(el, UNSET)
202 #define cfgMergeInt(el) cfgMerge(el, UNSET)
204 #define myModConfig(srv) (SSLModConfigRec *)ssl_util_getmodconfig(srv, "ssl_module")
205 #define mySrvConfig(srv) (SSLSrvConfigRec *)ap_get_module_config(srv->module_config, &ssl_module)
206 #define myDirConfig(req) (SSLDirConfigRec *)ap_get_module_config(req->per_dir_config, &ssl_module)
208 #define myCtxVarSet(mc,num,val) mc->rCtx.pV##num = val
209 #define myCtxVarGet(mc,num,type) (type)(mc->rCtx.pV##num)
211 #define AP_CTX_NUM2PTR(n) (void *)(((unsigned long)(n))+1)
212 #define AP_CTX_PTR2NUM(p) (unsigned long)(((char *)(p))-1)
214 #define AP_CTX_MAX_ENTRIES 1024
219 #define SSL_LOG_NONE (1<<0)
220 #define SSL_LOG_ERROR (1<<1)
221 #define SSL_LOG_WARN (1<<2)
222 #define SSL_LOG_INFO (1<<3)
223 #define SSL_LOG_TRACE (1<<4)
224 #define SSL_LOG_DEBUG (1<<5)
225 #define SSL_LOG_MASK (SSL_LOG_ERROR|SSL_LOG_WARN|SSL_LOG_INFO|SSL_LOG_TRACE|SSL_LOG_DEBUG)
227 #define SSL_ADD_NONE (1<<8)
228 #define SSL_ADD_ERRNO (1<<9)
229 #define SSL_ADD_SSLERR (1<<10)
230 #define SSL_NO_TIMESTAMP (1<<11)
231 #define SSL_NO_LEVELID (1<<12)
232 #define SSL_NO_NEWLINE (1<<13)
235 * Defaults for the configuration
237 #ifndef SSL_SESSION_CACHE_TIMEOUT
238 #define SSL_SESSION_CACHE_TIMEOUT 300
242 * Support for MM library
244 #define SSL_MM_FILE_MODE ( APR_UREAD | APR_UWRITE | APR_GREAD | APR_WREAD )
247 * Support for DBM library
249 #define SSL_DBM_FILE_MODE ( APR_UREAD | APR_UWRITE | APR_GREAD | APR_WREAD )
251 #if !defined(SSL_DBM_FILE_SUFFIX_DIR) && !defined(SSL_DBM_FILE_SUFFIX_PAG)
252 #if defined(DBM_SUFFIX)
253 #define SSL_DBM_FILE_SUFFIX_DIR DBM_SUFFIX
254 #define SSL_DBM_FILE_SUFFIX_PAG DBM_SUFFIX
255 #elif defined(__FreeBSD__) || (defined(DB_LOCK) && defined(DB_SHMEM))
256 #define SSL_DBM_FILE_SUFFIX_DIR ".db"
257 #define SSL_DBM_FILE_SUFFIX_PAG ".db"
259 #define SSL_DBM_FILE_SUFFIX_DIR ".dir"
260 #define SSL_DBM_FILE_SUFFIX_PAG ".pag"
265 * Check for OpenSSL version
267 #if SSL_LIBRARY_VERSION < 0x00903100
268 #error "mod_ssl requires OpenSSL 0.9.3 or higher"
272 * The own data structures
276 apr_pool_t *pSubPool;
277 apr_array_header_t *aData;
282 apr_pool_t *pSubPool;
283 apr_array_header_t *aKey;
284 apr_array_header_t *aData;
288 * Define the certificate algorithm types
291 typedef int ssl_algo_t;
293 #define SSL_ALGO_UNKNOWN (0)
294 #define SSL_ALGO_RSA (1<<0)
295 #define SSL_ALGO_DSA (1<<1)
296 #define SSL_ALGO_ALL (SSL_ALGO_RSA|SSL_ALGO_DSA)
298 #define SSL_AIDX_RSA (0)
299 #define SSL_AIDX_DSA (1)
300 #define SSL_AIDX_MAX (2)
304 * Define IDs for the temporary RSA keys and DH params
307 #define SSL_TKP_GEN (0)
308 #define SSL_TKP_ALLOC (1)
309 #define SSL_TKP_FREE (2)
311 #define SSL_TKPIDX_RSA512 (0)
312 #define SSL_TKPIDX_RSA1024 (1)
313 #define SSL_TKPIDX_DH512 (2)
314 #define SSL_TKPIDX_DH1024 (3)
315 #define SSL_TKPIDX_MAX (4)
318 * Define the SSL options
320 #define SSL_OPT_NONE (0)
321 #define SSL_OPT_RELSET (1<<0)
322 #define SSL_OPT_STDENVVARS (1<<1)
323 #define SSL_OPT_COMPATENVVARS (1<<2)
324 #define SSL_OPT_EXPORTCERTDATA (1<<3)
325 #define SSL_OPT_FAKEBASICAUTH (1<<4)
326 #define SSL_OPT_STRICTREQUIRE (1<<5)
327 #define SSL_OPT_OPTRENEGOTIATE (1<<6)
328 #define SSL_OPT_ALL (SSL_OPT_STDENVVARS|SSL_OPT_COMPATENVVAR|SSL_OPT_EXPORTCERTDATA|SSL_OPT_FAKEBASICAUTH|SSL_OPT_STRICTREQUIRE|SSL_OPT_OPTRENEGOTIATE)
329 typedef int ssl_opt_t;
332 * Define the SSL Protocol options
334 #define SSL_PROTOCOL_NONE (0)
335 #define SSL_PROTOCOL_SSLV2 (1<<0)
336 #define SSL_PROTOCOL_SSLV3 (1<<1)
337 #define SSL_PROTOCOL_TLSV1 (1<<2)
338 #define SSL_PROTOCOL_ALL (SSL_PROTOCOL_SSLV2|SSL_PROTOCOL_SSLV3|SSL_PROTOCOL_TLSV1)
339 typedef int ssl_proto_t;
342 * Define the SSL verify levels
345 SSL_CVERIFY_UNSET = UNSET,
346 SSL_CVERIFY_NONE = 0,
347 SSL_CVERIFY_OPTIONAL = 1,
348 SSL_CVERIFY_REQUIRE = 2,
349 SSL_CVERIFY_OPTIONAL_NO_CA = 3
353 * Define the SSL pass phrase dialog types
356 SSL_PPTYPE_UNSET = UNSET,
357 SSL_PPTYPE_BUILTIN = 0,
358 SSL_PPTYPE_FILTER = 1
362 * Define the Path Checking modes
364 #define SSL_PCM_EXISTS 1
365 #define SSL_PCM_ISREG 2
366 #define SSL_PCM_ISDIR 4
367 #define SSL_PCM_ISNONZERO 8
368 typedef unsigned int ssl_pathcheck_t;
371 * Define the SSL session cache modes and structures
374 SSL_SCMODE_UNSET = UNSET,
377 SSL_SCMODE_SHMHT = 2,
382 * Define the SSL mutex modes
385 SSL_MUTEXMODE_UNSET = UNSET,
386 SSL_MUTEXMODE_NONE = 0,
387 SSL_MUTEXMODE_USED = 1
391 * Define the SSL requirement structure
399 * Define the SSL random number generator seeding source
402 SSL_RSCTX_STARTUP = 1,
403 SSL_RSCTX_CONNECT = 2
406 SSL_RSSRC_BUILTIN = 1,
409 #if SSL_LIBRARY_VERSION >= 0x00905100
421 * Define the structure of an ASN.1 anything
425 unsigned char *cpData;
429 * Define the mod_ssl per-module configuration structure
430 * (i.e. the global configuration for each httpd process)
437 ap_filter_t *pInputFilter;
438 ap_filter_t *pOutputFilter;
439 apr_bucket_brigade *pbbInput; /* encrypted input */
440 apr_bucket_brigade *pbbPendingInput; /* decrypted input */
447 int nSessionCacheMode;
448 char *szSessionCacheDataFile;
449 int nSessionCacheDataSize;
451 AP_MM *pSessionCacheDataMM;
453 apr_table_t *tSessionCacheDataTable;
454 ssl_mutexmode_t nMutexMode;
457 apr_array_header_t *aRandSeed;
458 ssl_ds_table *tTmpKeys;
459 void *pTmpKeys[SSL_TKPIDX_MAX];
460 ssl_ds_table *tPublicCert;
461 ssl_ds_table *tPrivateKey;
462 #ifdef SSL_EXPERIMENTAL_ENGINE
463 char *szCryptoDevice;
466 void *pV1, *pV2, *pV3, *pV4, *pV5, *pV6, *pV7, *pV8, *pV9, *pV10;
471 * Define the mod_ssl per-server configuration structure
472 * (i.e. the configuration for the main server
473 * and all <VirtualHost> contexts)
477 apr_table_t *ap_server_ctx;
478 char *szPublicCertFile[SSL_AIDX_MAX];
479 char *szPrivateKeyFile[SSL_AIDX_MAX];
480 char *szCertificateChain;
481 char *szCACertificatePath;
482 char *szCACertificateFile;
485 apr_file_t *fileLogFile;
488 ssl_verify_t nVerifyClient;
489 X509 *pPublicCert[SSL_AIDX_MAX];
490 EVP_PKEY *pPrivateKey[SSL_AIDX_MAX];
492 int nSessionCacheTimeout;
493 int nPassPhraseDialogType;
494 char *szPassPhraseDialogPath;
495 ssl_proto_t nProtocol;
496 char *szCARevocationPath;
497 char *szCARevocationFile;
498 X509_STORE *pRevocationStore;
499 #ifdef SSL_EXPERIMENTAL_PROXY
500 /* Configuration details for proxy operation */
501 ssl_proto_t nProxyProtocol;
503 int nProxyVerifyDepth;
504 char *szProxyCACertificatePath;
505 char *szProxyCACertificateFile;
506 char *szProxyClientCertificateFile;
507 char *szProxyClientCertificatePath;
508 char *szProxyCipherSuite;
509 SSL_CTX *pSSLProxyCtx;
510 STACK_OF(X509_INFO) *skProxyClientCerts;
515 * Define the mod_ssl per-directory configuration structure
516 * (i.e. the local configuration for all <Directory>
517 * and .htaccess contexts)
521 apr_array_header_t *aRequirement;
523 ssl_opt_t nOptionsAdd;
524 ssl_opt_t nOptionsDel;
526 ssl_verify_t nVerifyClient;
528 #ifdef SSL_EXPERIMENTAL_PERDIRCA
529 char *szCACertificatePath;
530 char *szCACertificateFile;
535 * function prototypes
538 /* API glue structures */
539 extern module AP_MODULE_DECLARE_DATA ssl_module;
541 /* configuration handling */
542 void ssl_config_global_create(server_rec *);
543 void ssl_config_global_fix(SSLModConfigRec *);
544 BOOL ssl_config_global_isfixed(SSLModConfigRec *);
545 void *ssl_config_server_create(apr_pool_t *, server_rec *);
546 void *ssl_config_server_merge(apr_pool_t *, void *, void *);
547 void *ssl_config_perdir_create(apr_pool_t *, char *);
548 void *ssl_config_perdir_merge(apr_pool_t *, void *, void *);
549 const char *ssl_cmd_SSLMutex(cmd_parms *, void *, const char *);
550 const char *ssl_cmd_SSLPassPhraseDialog(cmd_parms *, void *, const char *);
551 const char *ssl_cmd_SSLCryptoDevice(cmd_parms *, void *, const char *);
552 const char *ssl_cmd_SSLRandomSeed(cmd_parms *, void *, const char *, const char *, const char *);
553 const char *ssl_cmd_SSLEngine(cmd_parms *, void *, int);
554 const char *ssl_cmd_SSLCipherSuite(cmd_parms *, void *, const char *);
555 const char *ssl_cmd_SSLCertificateFile(cmd_parms *, void *, const char *);
556 const char *ssl_cmd_SSLCertificateKeyFile(cmd_parms *, void *, const char *);
557 const char *ssl_cmd_SSLCertificateChainFile(cmd_parms *, void *, const char *);
558 const char *ssl_cmd_SSLCACertificatePath(cmd_parms *, void *, const char *);
559 const char *ssl_cmd_SSLCACertificateFile(cmd_parms *, void *, const char *);
560 const char *ssl_cmd_SSLCARevocationPath(cmd_parms *, void *, const char *);
561 const char *ssl_cmd_SSLCARevocationFile(cmd_parms *, void *, const char *);
562 const char *ssl_cmd_SSLVerifyClient(cmd_parms *, void *, const char *);
563 const char *ssl_cmd_SSLVerifyDepth(cmd_parms *, void *, const char *);
564 const char *ssl_cmd_SSLSessionCache(cmd_parms *, void *, const char *);
565 const char *ssl_cmd_SSLSessionCacheTimeout(cmd_parms *, void *, const char *);
566 const char *ssl_cmd_SSLLog(cmd_parms *, void *, const char *);
567 const char *ssl_cmd_SSLLogLevel(cmd_parms *, void *, const char *);
568 const char *ssl_cmd_SSLProtocol(cmd_parms *, void *, const char *);
569 const char *ssl_cmd_SSLOptions(cmd_parms *, void *, const char *);
570 const char *ssl_cmd_SSLRequireSSL(cmd_parms *, void *);
571 const char *ssl_cmd_SSLRequire(cmd_parms *, void *, const char *);
572 #ifdef SSL_EXPERIMENTAL_PROXY
573 const char *ssl_cmd_SSLProxyProtocol(cmd_parms *, char *, const char *);
574 const char *ssl_cmd_SSLProxyCipherSuite(cmd_parms *, char *, char *);
575 const char *ssl_cmd_SSLProxyVerify(cmd_parms *, char *, int);
576 const char *ssl_cmd_SSLProxyVerifyDepth(cmd_parms *, char *, char *);
577 const char *ssl_cmd_SSLProxyCACertificatePath(cmd_parms *, char *, char *);
578 const char *ssl_cmd_SSLProxyCACertificateFile(cmd_parms *, char *, char *);
579 const char *ssl_cmd_SSLProxyMachineCertificatePath(cmd_parms *, char *, char *);
580 const char *ssl_cmd_SSLProxyMachineCertificateFile(cmd_parms *, char *, char *);
583 /* module initialization */
584 void ssl_init_Module(apr_pool_t *, apr_pool_t *, apr_pool_t *, server_rec *);
585 void ssl_init_SSLLibrary(void);
586 void ssl_init_Engine(server_rec *, apr_pool_t *);
587 void ssl_init_TmpKeysHandle(int, server_rec *, apr_pool_t *);
588 void ssl_init_ConfigureServer(server_rec *, apr_pool_t *, SSLSrvConfigRec *);
589 void ssl_init_CheckServers(server_rec *, apr_pool_t *);
591 *ssl_init_FindCAList(server_rec *, apr_pool_t *, char *, char *);
592 void ssl_init_Child(apr_pool_t *, server_rec *);
593 apr_status_t ssl_init_ChildKill(void *data);
594 apr_status_t ssl_init_ModuleKill(void *data);
596 /* Apache API hooks */
597 void ssl_hook_NewConnection(conn_rec *);
598 void ssl_hook_TimeoutConnection(int);
599 int ssl_hook_process_connection(SSLFilterRec *pRec);
600 apr_status_t ssl_hook_CloseConnection(SSLFilterRec *);
601 int ssl_hook_Translate(request_rec *);
602 int ssl_hook_Auth(request_rec *);
603 int ssl_hook_UserCheck(request_rec *);
604 int ssl_hook_Access(request_rec *);
605 int ssl_hook_Fixup(request_rec *);
606 int ssl_hook_ReadReq(request_rec *);
607 int ssl_hook_Handler(request_rec *);
609 /* OpenSSL callbacks */
610 RSA *ssl_callback_TmpRSA(SSL *, int, int);
611 DH *ssl_callback_TmpDH(SSL *, int, int);
612 int ssl_callback_SSLVerify(int, X509_STORE_CTX *);
613 int ssl_callback_SSLVerify_CRL(int, X509_STORE_CTX *, server_rec *);
614 int ssl_callback_NewSessionCacheEntry(SSL *, SSL_SESSION *);
615 SSL_SESSION *ssl_callback_GetSessionCacheEntry(SSL *, unsigned char *, int, int *);
616 void ssl_callback_DelSessionCacheEntry(SSL_CTX *, SSL_SESSION *);
617 void ssl_callback_LogTracingState(SSL *, int, int);
619 /* Session Cache Support */
620 void ssl_scache_init(server_rec *, apr_pool_t *);
621 void ssl_scache_kill(server_rec *);
622 BOOL ssl_scache_store(server_rec *, UCHAR *, int, time_t, SSL_SESSION *);
623 SSL_SESSION *ssl_scache_retrieve(server_rec *, UCHAR *, int);
624 void ssl_scache_remove(server_rec *, UCHAR *, int);
625 void ssl_scache_expire(server_rec *);
626 void ssl_scache_status(server_rec *, apr_pool_t *, void (*)(char *, void *), void *);
627 char *ssl_scache_id2sz(UCHAR *, int);
628 void ssl_scache_dbm_init(server_rec *, apr_pool_t *);
629 void ssl_scache_dbm_kill(server_rec *);
630 BOOL ssl_scache_dbm_store(server_rec *, UCHAR *, int, time_t, SSL_SESSION *);
631 SSL_SESSION *ssl_scache_dbm_retrieve(server_rec *, UCHAR *, int);
632 void ssl_scache_dbm_remove(server_rec *, UCHAR *, int);
633 void ssl_scache_dbm_expire(server_rec *);
634 void ssl_scache_dbm_status(server_rec *, apr_pool_t *, void (*)(char *, void *), void *);
636 void ssl_scache_shmht_init(server_rec *, pool *);
637 void ssl_scache_shmht_kill(server_rec *);
638 BOOL ssl_scache_shmht_store(server_rec *, UCHAR *, int, time_t, SSL_SESSION *);
639 SSL_SESSION *ssl_scache_shmht_retrieve(server_rec *, UCHAR *, int);
640 void ssl_scache_shmht_remove(server_rec *, UCHAR *, int);
641 void ssl_scache_shmht_expire(server_rec *);
642 void ssl_scache_shmht_status(server_rec *, pool *, void (*)(char *, void *), void *);
643 void ssl_scache_shmcb_init(server_rec *, pool *);
644 void ssl_scache_shmcb_kill(server_rec *);
645 BOOL ssl_scache_shmcb_store(server_rec *, UCHAR *, int, time_t, SSL_SESSION *);
646 SSL_SESSION *ssl_scache_shmcb_retrieve(server_rec *, UCHAR *, int);
647 void ssl_scache_shmcb_remove(server_rec *, UCHAR *, int);
648 void ssl_scache_shmcb_expire(server_rec *);
649 void ssl_scache_shmcb_status(server_rec *, pool *, void (*)(char *, void *), void *);
652 /* Pass Phrase Support */
653 void ssl_pphrase_Handle(server_rec *, apr_pool_t *);
654 int ssl_pphrase_Handle_CB(char *, int, int, void *);
656 /* Diffie-Hellman Parameter Support */
657 DH *ssl_dh_GetTmpParam(int);
658 DH *ssl_dh_GetParamFromFile(char *);
660 /* Data Structures */
661 ssl_ds_array *ssl_ds_array_make(apr_pool_t *, int);
662 BOOL ssl_ds_array_isempty(ssl_ds_array *);
663 void *ssl_ds_array_push(ssl_ds_array *);
664 void *ssl_ds_array_get(ssl_ds_array *, int);
665 void ssl_ds_array_wipeout(ssl_ds_array *);
666 void ssl_ds_array_kill(ssl_ds_array *);
667 ssl_ds_table *ssl_ds_table_make(apr_pool_t *, int);
668 BOOL ssl_ds_table_isempty(ssl_ds_table *);
669 void *ssl_ds_table_push(ssl_ds_table *, char *);
670 void *ssl_ds_table_get(ssl_ds_table *, char *);
671 void ssl_ds_table_wipeout(ssl_ds_table *);
672 void ssl_ds_table_kill(ssl_ds_table *);
675 int ssl_mutex_init(server_rec *, apr_pool_t *);
676 int ssl_mutex_reinit(server_rec *, apr_pool_t *);
677 int ssl_mutex_on(server_rec *);
678 int ssl_mutex_off(server_rec *);
679 int ssl_mutex_kill(server_rec *);
681 /* Logfile Support */
682 void ssl_log_open(server_rec *, server_rec *, apr_pool_t *);
683 BOOL ssl_log_applies(server_rec *, int);
684 void ssl_log(server_rec *, int, const char *, ...);
689 void ssl_var_register(void);
690 void ssl_var_unregister(void);
692 char *ssl_var_lookup(apr_pool_t *, server_rec *, conn_rec *, request_rec *, char *);
695 void ssl_io_register(void);
696 void ssl_io_unregister(void);
697 void ssl_io_filter_init(conn_rec *, SSL *);
698 void ssl_io_filter_register(apr_pool_t *);
699 long ssl_io_data_cb(BIO *, int, const char *, int, long, long);
702 int ssl_rand_seed(server_rec *, apr_pool_t *, ssl_rsctx_t, char *);
706 void ssl_ext_register(void);
707 void ssl_ext_unregister(void);
710 /* Utility Functions */
711 char *ssl_util_vhostid(apr_pool_t *, server_rec *);
712 void ssl_util_strupper(char *);
713 void ssl_util_uuencode(char *, const char *, BOOL);
714 void ssl_util_uuencode_binary(unsigned char *, const unsigned char *, int, BOOL);
715 apr_file_t *ssl_util_ppopen(server_rec *, apr_pool_t *, char *);
716 void ssl_util_ppclose(server_rec *, apr_pool_t *, apr_file_t *);
717 char *ssl_util_readfilter(server_rec *, apr_pool_t *, char *);
718 BOOL ssl_util_path_check(ssl_pathcheck_t, char *, apr_pool_t *);
719 ssl_algo_t ssl_util_algotypeof(X509 *, EVP_PKEY *);
720 char *ssl_util_algotypestr(ssl_algo_t);
721 char *ssl_util_ptxtsub(apr_pool_t *, const char *, const char *, char *);
722 void ssl_util_thread_setup(void);
723 apr_status_t ssl_util_setmodconfig(server_rec *, const char *, SSLModConfigRec *);
724 SSLModConfigRec *ssl_util_getmodconfig(server_rec *, const char *);
725 SSLModConfigRec *ssl_util_getmodconfig_ssl(SSL *, const char *);
727 #endif /* __MOD_SSL_H__ */