00001 /* 00002 * $Id$ 00003 * 00004 * Copyright (C) 2010 iptelorg GmbH 00005 * 00006 * Permission to use, copy, modify, and distribute this software for any 00007 * purpose with or without fee is hereby granted, provided that the above 00008 * copyright notice and this permission notice appear in all copies. 00009 * 00010 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 00011 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 00012 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 00013 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 00014 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 00015 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 00016 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 00017 */ 00018 00026 /* 00027 * History: 00028 * -------- 00029 * 2010-05-27 initial version (andrei) 00030 */ 00031 00032 #ifndef __tls_cfg_h 00033 #define __tls_cfg_h 00034 00035 #include "../../str.h" 00036 #include "../../cfg/cfg.h" 00037 00038 00039 /* maximum accepted lifetime (maximum possible is ~ MAXINT/2) 00040 * (it should be kept in sync w/ MAX_TCP_CON_LIFETIME from tcp_main.c: 00041 * MAX_TLS_CON_LIFETIME <= MAX_TCP_CON_LIFETIME )*/ 00042 #define MAX_TLS_CON_LIFETIME (1U<<(sizeof(ticks_t)*8-1)) 00043 00044 00045 00046 struct cfg_group_tls { 00047 int force_run; 00048 str method; 00049 int verify_cert; 00050 int verify_depth; 00051 int require_cert; 00052 str private_key; 00053 str ca_list; 00054 str crl; 00055 str certificate; 00056 str cipher_list; 00057 int session_cache; 00058 str session_id; 00059 str config_file; 00060 int log; 00061 int debug; 00062 int con_lifetime; 00063 int disable_compression; 00064 /* release internal openssl read or write buffer when they are no longer 00065 * used (complete read or write that does not have to buffer anything). 00066 * Should be used together with tls_free_list_max_len. Might have some 00067 * performance impact (and extra *malloc pressure), but has also the 00068 * potential of saving a lot of memory (at least 32k/idle connection in the 00069 * default config, or ~ 16k+tls_max_send_fragment)) */ 00070 int ssl_release_buffers; 00071 /* maximum length of free/unused memory buffers/chunks per connection. 00072 * Setting it to 0 would cause any unused buffers to be immediately freed 00073 * and hence a lower memory footprint (at the cost of a possible 00074 * performance decrease and more *malloc pressure). 00075 * Too large value would result in extra memory consumption. 00076 * The default is 32 in openssl. 00077 * For lowest memory usage set it to 0 and tls_mode_release_buffers to 1 00078 */ 00079 int ssl_freelist_max; 00080 /* maximum number of bytes (clear text) sent into one record. 00081 * The default and maximum value are ~16k. Lower values would lead to a 00082 * lower memory footprint. 00083 * Values lower then the typical app. write size might decrease 00084 * performance (extra write() syscalls), so it should be kept ~2k for ser. 00085 */ 00086 int ssl_max_send_fragment; 00087 /* enable read ahead. Should increase performance (1 less syscall when 00088 * enabled, else openssl makes 1 read() for each record header and another 00089 * for the content), but might interact with SSL_pending() (not used right 00090 * now) 00091 */ 00092 int ssl_read_ahead; 00093 int low_mem_threshold1; 00094 int low_mem_threshold2; 00095 int ct_wq_max; /* maximum overall tls write clear text queued bytes */ 00096 int con_ct_wq_max; /* maximum clear text write queued bytes per con */ 00097 int ct_wq_blk_size; /* minimum block size for the clear text write queue */ 00098 int send_close_notify; /* if set try to be nice and send a shutdown alert 00099 before closing the tcp connection */ 00100 }; 00101 00102 00103 extern struct cfg_group_tls default_tls_cfg; 00104 extern void* tls_cfg; 00105 extern cfg_def_t tls_cfg_def[]; 00106 00107 00108 extern int fix_tls_cfg(struct cfg_group_tls* cfg); 00109 00110 #endif /*__tls_cfg_h*/ 00111 00112 /* vi: set ts=4 sw=4 tw=79:ai:cindent: */
1.7.1