Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
btwise
openssl
提交
2a056de8
O
openssl
项目概览
btwise
/
openssl
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
openssl
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2a056de8
编写于
12月 24, 2015
作者:
D
Dr. Stephen Henson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add lh_doall_arg inlining
Reviewed-by:
N
Rich Salz
<
rsalz@openssl.org
>
上级
63c75cd6
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
44 addition
and
63 deletion
+44
-63
crypto/conf/conf_api.c
crypto/conf/conf_api.c
+7
-9
crypto/conf/conf_def.c
crypto/conf/conf_def.c
+3
-4
crypto/engine/eng_table.c
crypto/engine/eng_table.c
+6
-10
crypto/mem_dbg.c
crypto/mem_dbg.c
+3
-3
crypto/objects/o_names.c
crypto/objects/o_names.c
+6
-7
include/openssl/lhash.h
include/openssl/lhash.h
+16
-0
include/openssl/safestack.h
include/openssl/safestack.h
+0
-24
ssl/ssl_sess.c
ssl/ssl_sess.c
+3
-4
util/mkstack.pl
util/mkstack.pl
+0
-2
未找到文件。
crypto/conf/conf_api.c
浏览文件 @
2a056de8
...
...
@@ -70,11 +70,8 @@
#include <openssl/conf_api.h>
#include "e_os.h"
static
void
value_free_hash_doall_arg
(
CONF_VALUE
*
a
,
LHASH_OF
(
CONF_VALUE
)
*
conf
);
static
void
value_free_hash
(
const
CONF_VALUE
*
a
,
LHASH_OF
(
CONF_VALUE
)
*
conf
);
static
void
value_free_stack_doall
(
CONF_VALUE
*
a
);
static
IMPLEMENT_LHASH_DOALL_ARG_FN
(
value_free_hash
,
CONF_VALUE
,
LHASH_OF
(
CONF_VALUE
))
/* Up until OpenSSL 0.9.5a, this was get_section */
CONF_VALUE
*
_CONF_get_section
(
const
CONF
*
conf
,
const
char
*
section
)
...
...
@@ -193,6 +190,10 @@ int _CONF_new_data(CONF *conf)
return
1
;
}
typedef
LHASH_OF
(
CONF_VALUE
)
LH_CONF_VALUE
;
IMPLEMENT_LHASH_DOALL_ARG_CONST
(
CONF_VALUE
,
LH_CONF_VALUE
);
void
_CONF_free_data
(
CONF
*
conf
)
{
if
(
conf
==
NULL
||
conf
->
data
==
NULL
)
...
...
@@ -200,9 +201,7 @@ void _CONF_free_data(CONF *conf)
/* evil thing to make sure the 'OPENSSL_free()' works as expected */
lh_CONF_VALUE_set_down_load
(
conf
->
data
,
0
);
lh_CONF_VALUE_doall_arg
(
conf
->
data
,
LHASH_DOALL_ARG_FN
(
value_free_hash
),
LHASH_OF
(
CONF_VALUE
),
conf
->
data
);
lh_CONF_VALUE_doall_LH_CONF_VALUE
(
conf
->
data
,
value_free_hash
,
conf
->
data
);
/*
* We now have only 'section' entries in the hash table. Due to problems
...
...
@@ -213,8 +212,7 @@ void _CONF_free_data(CONF *conf)
lh_CONF_VALUE_free
(
conf
->
data
);
}
static
void
value_free_hash_doall_arg
(
CONF_VALUE
*
a
,
LHASH_OF
(
CONF_VALUE
)
*
conf
)
static
void
value_free_hash
(
const
CONF_VALUE
*
a
,
LHASH_OF
(
CONF_VALUE
)
*
conf
)
{
if
(
a
->
name
!=
NULL
)
(
void
)
lh_CONF_VALUE_delete
(
conf
,
a
);
...
...
crypto/conf/conf_def.c
浏览文件 @
2a056de8
...
...
@@ -652,7 +652,7 @@ static char *scan_dquote(CONF *conf, char *p)
return
(
p
);
}
static
void
dump_value_doall_arg
(
CONF_VALUE
*
a
,
BIO
*
out
)
static
void
dump_value_doall_arg
(
const
CONF_VALUE
*
a
,
BIO
*
out
)
{
if
(
a
->
name
)
BIO_printf
(
out
,
"[%s] %s=%s
\n
"
,
a
->
section
,
a
->
name
,
a
->
value
);
...
...
@@ -660,12 +660,11 @@ static void dump_value_doall_arg(CONF_VALUE *a, BIO *out)
BIO_printf
(
out
,
"[[%s]]
\n
"
,
a
->
section
);
}
static
IMPLEMENT_LHASH_DOALL_ARG_FN
(
dump_value
,
CONF_VALUE
,
BIO
)
IMPLEMENT_LHASH_DOALL_ARG_CONST
(
CONF_VALUE
,
BIO
);
static
int
def_dump
(
const
CONF
*
conf
,
BIO
*
out
)
{
lh_CONF_VALUE_doall_arg
(
conf
->
data
,
LHASH_DOALL_ARG_FN
(
dump_value
),
BIO
,
out
);
lh_CONF_VALUE_doall_BIO
(
conf
->
data
,
dump_value_doall_arg
,
out
);
return
1
;
}
...
...
crypto/engine/eng_table.c
浏览文件 @
2a056de8
...
...
@@ -183,7 +183,7 @@ int engine_table_register(ENGINE_TABLE **table, ENGINE_CLEANUP_CB *cleanup,
return
ret
;
}
static
void
int_unregister_cb
_doall_arg
(
ENGINE_PILE
*
pile
,
ENGINE
*
e
)
static
void
int_unregister_cb
(
ENGINE_PILE
*
pile
,
ENGINE
*
e
)
{
int
n
;
/* Iterate the 'c->sk' stack removing any occurrence of 'e' */
...
...
@@ -197,15 +197,13 @@ static void int_unregister_cb_doall_arg(ENGINE_PILE *pile, ENGINE *e)
}
}
static
IMPLEMENT_LHASH_DOALL_ARG_FN
(
int_unregister_cb
,
ENGINE_PILE
,
ENGINE
)
IMPLEMENT_LHASH_DOALL_ARG
(
ENGINE_PILE
,
ENGINE
);
void
engine_table_unregister
(
ENGINE_TABLE
**
table
,
ENGINE
*
e
)
{
CRYPTO_w_lock
(
CRYPTO_LOCK_ENGINE
);
if
(
int_table_check
(
table
,
0
))
lh_ENGINE_PILE_doall_arg
(
&
(
*
table
)
->
piles
,
LHASH_DOALL_ARG_FN
(
int_unregister_cb
),
ENGINE
,
e
);
lh_ENGINE_PILE_doall_ENGINE
(
&
(
*
table
)
->
piles
,
int_unregister_cb
,
e
);
CRYPTO_w_unlock
(
CRYPTO_LOCK_ENGINE
);
}
...
...
@@ -332,12 +330,12 @@ ENGINE *engine_table_select_tmp(ENGINE_TABLE **table, int nid, const char *f,
/* Table enumeration */
static
void
int_
cb_doall_arg
(
ENGINE_PILE
*
pile
,
ENGINE_PILE_DOALL
*
dall
)
static
void
int_
dall
(
const
ENGINE_PILE
*
pile
,
ENGINE_PILE_DOALL
*
dall
)
{
dall
->
cb
(
pile
->
nid
,
pile
->
sk
,
pile
->
funct
,
dall
->
arg
);
}
static
IMPLEMENT_LHASH_DOALL_ARG_FN
(
int_cb
,
ENGINE_PILE
,
ENGINE_PILE_DOALL
)
IMPLEMENT_LHASH_DOALL_ARG_CONST
(
ENGINE_PILE
,
ENGINE_PILE_DOALL
);
void
engine_table_doall
(
ENGINE_TABLE
*
table
,
engine_table_doall_cb
*
cb
,
void
*
arg
)
...
...
@@ -346,7 +344,5 @@ void engine_table_doall(ENGINE_TABLE *table, engine_table_doall_cb *cb,
dall
.
cb
=
cb
;
dall
.
arg
=
arg
;
if
(
table
)
lh_ENGINE_PILE_doall_arg
(
&
table
->
piles
,
LHASH_DOALL_ARG_FN
(
int_cb
),
ENGINE_PILE_DOALL
,
&
dall
);
lh_ENGINE_PILE_doall_ENGINE_PILE_DOALL
(
&
table
->
piles
,
int_dall
,
&
dall
);
}
crypto/mem_dbg.c
浏览文件 @
2a056de8
...
...
@@ -544,7 +544,7 @@ typedef struct mem_leak_st {
long
bytes
;
}
MEM_LEAK
;
static
void
print_leak
_doall_arg
(
const
MEM
*
m
,
MEM_LEAK
*
l
)
static
void
print_leak
(
const
MEM
*
m
,
MEM_LEAK
*
l
)
{
char
buf
[
1024
];
char
*
bufp
=
buf
;
...
...
@@ -629,7 +629,7 @@ static void print_leak_doall_arg(const MEM *m, MEM_LEAK *l)
#endif
}
static
IMPLEMENT_LHASH_DOALL_ARG_FN
(
print_leak
,
const
MEM
,
MEM_LEAK
)
IMPLEMENT_LHASH_DOALL_ARG_CONST
(
MEM
,
MEM_LEAK
);
int
CRYPTO_mem_leaks
(
BIO
*
b
)
{
...
...
@@ -645,7 +645,7 @@ int CRYPTO_mem_leaks(BIO *b)
ml
.
chunks
=
0
;
ml
.
seen
=
0
;
if
(
mh
!=
NULL
)
lh_MEM_doall_
arg
(
mh
,
LHASH_DOALL_ARG_FN
(
print_leak
),
MEM_LEAK
,
&
ml
);
lh_MEM_doall_
MEM_LEAK
(
mh
,
print_leak
,
&
ml
);
/* Don't count the BIO that was passed in as a "leak" */
if
(
ml
.
seen
&&
ml
.
chunks
>=
1
&&
ml
.
bytes
>=
(
int
)
sizeof
(
*
b
))
{
ml
.
chunks
--
;
...
...
crypto/objects/o_names.c
浏览文件 @
2a056de8
...
...
@@ -234,31 +234,30 @@ int OBJ_NAME_remove(const char *name, int type)
return
(
0
);
}
struct
doall
{
typedef
struct
{
int
type
;
void
(
*
fn
)
(
const
OBJ_NAME
*
,
void
*
arg
);
void
*
arg
;
};
}
OBJ_DOALL
;
static
void
do_all_fn
_doall_arg
(
const
OBJ_NAME
*
name
,
struct
doall
*
d
)
static
void
do_all_fn
(
const
OBJ_NAME
*
name
,
OBJ_DOALL
*
d
)
{
if
(
name
->
type
==
d
->
type
)
d
->
fn
(
name
,
d
->
arg
);
}
static
IMPLEMENT_LHASH_DOALL_ARG_FN
(
do_all_fn
,
const
OBJ_NAME
,
struct
doall
)
IMPLEMENT_LHASH_DOALL_ARG_CONST
(
OBJ_NAME
,
OBJ_DOALL
);
void
OBJ_NAME_do_all
(
int
type
,
void
(
*
fn
)
(
const
OBJ_NAME
*
,
void
*
arg
),
void
*
arg
)
{
struct
doall
d
;
OBJ_DOALL
d
;
d
.
type
=
type
;
d
.
fn
=
fn
;
d
.
arg
=
arg
;
lh_OBJ_NAME_doall_arg
(
names_lh
,
LHASH_DOALL_ARG_FN
(
do_all_fn
),
struct
doall
,
&
d
);
lh_OBJ_NAME_doall_OBJ_DOALL
(
names_lh
,
do_all_fn
,
&
d
);
}
struct
doall_sorted
{
...
...
include/openssl/lhash.h
浏览文件 @
2a056de8
...
...
@@ -244,6 +244,22 @@ void lh_node_usage_stats_bio(const _LHASH *lh, BIO *out);
} \
LHASH_OF(type)
#define IMPLEMENT_LHASH_DOALL_ARG_CONST(type, argtype) \
int_implement_lhash_doall(type, argtype, const type)
#define IMPLEMENT_LHASH_DOALL_ARG(type, argtype) \
int_implement_lhash_doall(type, argtype, type)
#define int_implement_lhash_doall(type, argtype, cbargtype) \
static inline void \
lh_##type##_doall_##argtype(LHASH_OF(type) *lh, \
void (*fn)(cbargtype *, argtype *), \
argtype *arg) \
{ \
lh_doall_arg((_LHASH *)lh, (LHASH_DOALL_ARG_FN_TYPE)fn, (void *)arg); \
} \
LHASH_OF(type)
# define CHECKED_LHASH_OF(type,lh) \
((_LHASH *)CHECKED_PTR_OF(LHASH_OF(type),lh))
...
...
include/openssl/safestack.h
浏览文件 @
2a056de8
...
...
@@ -231,41 +231,17 @@ DEFINE_SPECIAL_STACK_OF(OPENSSL_BLOCK, void)
*/
# define lh_ADDED_OBJ_doall_arg(lh,fn,arg_type,arg) \
LHM_lh_doall_arg(ADDED_OBJ,lh,fn,arg_type,arg)
# define lh_APP_INFO_doall_arg(lh,fn,arg_type,arg) \
LHM_lh_doall_arg(APP_INFO,lh,fn,arg_type,arg)
# define lh_CONF_VALUE_doall_arg(lh,fn,arg_type,arg) \
LHM_lh_doall_arg(CONF_VALUE,lh,fn,arg_type,arg)
# define lh_ENGINE_PILE_doall_arg(lh,fn,arg_type,arg) \
LHM_lh_doall_arg(ENGINE_PILE,lh,fn,arg_type,arg)
# define lh_ERR_STATE_doall_arg(lh,fn,arg_type,arg) \
LHM_lh_doall_arg(ERR_STATE,lh,fn,arg_type,arg)
# define lh_ERR_STRING_DATA_doall_arg(lh,fn,arg_type,arg) \
LHM_lh_doall_arg(ERR_STRING_DATA,lh,fn,arg_type,arg)
# define lh_FUNCTION_doall_arg(lh,fn,arg_type,arg) \
LHM_lh_doall_arg(FUNCTION,lh,fn,arg_type,arg)
# define lh_MEM_doall_arg(lh,fn,arg_type,arg) \
LHM_lh_doall_arg(MEM,lh,fn,arg_type,arg)
# define lh_OBJ_NAME_doall_arg(lh,fn,arg_type,arg) \
LHM_lh_doall_arg(OBJ_NAME,lh,fn,arg_type,arg)
# define lh_OPENSSL_CSTRING_doall_arg(lh,fn,arg_type,arg) \
LHM_lh_doall_arg(OPENSSL_CSTRING,lh,fn,arg_type,arg)
# define lh_OPENSSL_STRING_doall_arg(lh,fn,arg_type,arg) \
LHM_lh_doall_arg(OPENSSL_STRING,lh,fn,arg_type,arg)
# define lh_SSL_SESSION_doall_arg(lh,fn,arg_type,arg) \
LHM_lh_doall_arg(SSL_SESSION,lh,fn,arg_type,arg)
# ifdef __cplusplus
}
...
...
ssl/ssl_sess.c
浏览文件 @
2a056de8
...
...
@@ -1044,7 +1044,7 @@ typedef struct timeout_param_st {
LHASH_OF
(
SSL_SESSION
)
*
cache
;
}
TIMEOUT_PARAM
;
static
void
timeout_
doall_arg
(
SSL_SESSION
*
s
,
TIMEOUT_PARAM
*
p
)
static
void
timeout_
cb
(
SSL_SESSION
*
s
,
TIMEOUT_PARAM
*
p
)
{
if
((
p
->
time
==
0
)
||
(
p
->
time
>
(
s
->
time
+
s
->
timeout
)))
{
/* timeout */
/*
...
...
@@ -1060,7 +1060,7 @@ static void timeout_doall_arg(SSL_SESSION *s, TIMEOUT_PARAM *p)
}
}
static
IMPLEMENT_LHASH_DOALL_ARG_FN
(
timeout
,
SSL_SESSION
,
TIMEOUT_PARAM
)
IMPLEMENT_LHASH_DOALL_ARG
(
SSL_SESSION
,
TIMEOUT_PARAM
);
void
SSL_CTX_flush_sessions
(
SSL_CTX
*
s
,
long
t
)
{
...
...
@@ -1075,8 +1075,7 @@ void SSL_CTX_flush_sessions(SSL_CTX *s, long t)
CRYPTO_w_lock
(
CRYPTO_LOCK_SSL_CTX
);
i
=
CHECKED_LHASH_OF
(
SSL_SESSION
,
tp
.
cache
)
->
down_load
;
CHECKED_LHASH_OF
(
SSL_SESSION
,
tp
.
cache
)
->
down_load
=
0
;
lh_SSL_SESSION_doall_arg
(
tp
.
cache
,
LHASH_DOALL_ARG_FN
(
timeout
),
TIMEOUT_PARAM
,
&
tp
);
lh_SSL_SESSION_doall_TIMEOUT_PARAM
(
tp
.
cache
,
timeout_cb
,
&
tp
);
CHECKED_LHASH_OF
(
SSL_SESSION
,
tp
.
cache
)
->
down_load
=
i
;
CRYPTO_w_unlock
(
CRYPTO_LOCK_SSL_CTX
);
}
...
...
util/mkstack.pl
浏览文件 @
2a056de8
...
...
@@ -275,8 +275,6 @@ foreach $type_thing (sort @lhashlst) {
my
$lc_tt
=
lc
$type_thing
;
$new_stackfile
.=
<<EOF;
# define lh_${type_thing}_doall_arg(lh,fn,arg_type,arg) \\
LHM_lh_doall_arg(${type_thing},lh,fn,arg_type,arg)
EOF
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录