diff options
| author | zhengchao <[email protected]> | 2019-05-16 20:33:42 +0800 |
|---|---|---|
| committer | zhengchao <[email protected]> | 2019-05-24 18:52:32 +0800 |
| commit | 630a3dba604815ed830e7229cf8e1b0bbac2f1b6 (patch) | |
| tree | 8190fe9df374d021ba6d95bd3e6ed2208f6213b9 /platform/src/ssl_sess_cache.cpp | |
| parent | ace7dd43794b90b428d9b8cd488927515690c67f (diff) | |
可以检测certificate pinning和mutual authentication。
Diffstat (limited to 'platform/src/ssl_sess_cache.cpp')
| -rw-r--r-- | platform/src/ssl_sess_cache.cpp | 45 |
1 files changed, 17 insertions, 28 deletions
diff --git a/platform/src/ssl_sess_cache.cpp b/platform/src/ssl_sess_cache.cpp index cc41a3c..991bc90 100644 --- a/platform/src/ssl_sess_cache.cpp +++ b/platform/src/ssl_sess_cache.cpp @@ -281,41 +281,30 @@ void down_session_del(struct sess_cache * cache, const SSL_SESSION * sess) } return; } - -int __wrapper_MESA_htable_set_opt(MESA_htable_handle table, enum MESA_htable_opt opt_type, unsigned value) -{ - int ret = MESA_htable_set_opt(table, opt_type, &value, (int)(sizeof(value))); - assert(ret == 0); - return ret; -} - -int __wrapper_MESA_htable_set_opt(MESA_htable_handle table, enum MESA_htable_opt opt_type, void * val, size_t len) -{ - int ret = MESA_htable_set_opt(table, opt_type, val, (int)len); - assert(ret == 0); - return ret; -} - struct sess_cache * ssl_sess_cache_create(unsigned int slot_size, unsigned int expire_seconds, enum tfe_conn_dir served) { struct sess_cache * cache = ALLOC(struct sess_cache, 1); unsigned max_num = slot_size * 4; UNUSED int ret = 0; - + int opt_val=0; + MESA_htable_handle htable = MESA_htable_born(); - ret = __wrapper_MESA_htable_set_opt(htable, MHO_SCREEN_PRINT_CTRL, 0); - ret = __wrapper_MESA_htable_set_opt(htable, MHO_THREAD_SAFE, 1); - - ret = __wrapper_MESA_htable_set_opt(htable, MHO_MUTEX_NUM, 16); - ret = __wrapper_MESA_htable_set_opt(htable, MHO_HASH_SLOT_SIZE, slot_size); - ret = __wrapper_MESA_htable_set_opt(htable, MHO_HASH_MAX_ELEMENT_NUM, max_num); - ret = __wrapper_MESA_htable_set_opt(htable, MHO_EXPIRE_TIME, expire_seconds); - - ret = __wrapper_MESA_htable_set_opt(htable, MHO_ELIMIMINATE_TYPE, - HASH_ELIMINATE_ALGO_FIFO); - ret = __wrapper_MESA_htable_set_opt(htable, MHO_CBFUN_DATA_FREE, + opt_val=0; + ret = MESA_htable_set_opt(htable, MHO_SCREEN_PRINT_CTRL, &opt_val, sizeof(opt_val)); + opt_val=1; + ret = MESA_htable_set_opt(htable, MHO_THREAD_SAFE, &opt_val, sizeof(opt_val)); + opt_val=16; + ret = MESA_htable_set_opt(htable, MHO_MUTEX_NUM, &opt_val, sizeof(opt_val)); + ret = MESA_htable_set_opt(htable, MHO_HASH_SLOT_SIZE, &slot_size, sizeof(slot_size)); + ret = MESA_htable_set_opt(htable, MHO_HASH_MAX_ELEMENT_NUM, &max_num, sizeof(max_num)); + ret = MESA_htable_set_opt(htable, MHO_EXPIRE_TIME, &expire_seconds, sizeof(expire_seconds)); + + opt_val=HASH_ELIMINATE_ALGO_FIFO; + ret = MESA_htable_set_opt(htable, MHO_ELIMIMINATE_TYPE, + &opt_val, sizeof(int)); + ret = MESA_htable_set_opt(htable, MHO_CBFUN_DATA_FREE, (void *)ssl_sess_free_serialized, sizeof(&ssl_sess_free_serialized)); - ret = __wrapper_MESA_htable_set_opt(htable, MHO_CBFUN_DATA_EXPIRE_NOTIFY, + ret = MESA_htable_set_opt(htable, MHO_CBFUN_DATA_EXPIRE_NOTIFY, (void *)ssl_sess_verify_cb, sizeof(&ssl_sess_verify_cb)); ret = MESA_htable_mature(htable); |
