Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
744c49a8
T
Third Party Openssl
项目概览
OpenHarmony
/
Third Party Openssl
大约 1 年 前同步成功
通知
9
Star
18
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Openssl
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
744c49a8
编写于
2月 20, 2002
作者:
G
Geoff Thorpe
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
- Add support for cipher suites that require a temporary RSA key for
key-agreement. - Tolerate signal interruptions of select().
上级
9c5b91fd
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
32 addition
and
7 deletion
+32
-7
demos/tunala/cb.c
demos/tunala/cb.c
+10
-0
demos/tunala/tunala.c
demos/tunala/tunala.c
+21
-7
demos/tunala/tunala.h
demos/tunala/tunala.h
+1
-0
未找到文件。
demos/tunala/cb.c
浏览文件 @
744c49a8
...
@@ -129,5 +129,15 @@ void cb_ssl_verify_set_level(unsigned int level)
...
@@ -129,5 +129,15 @@ void cb_ssl_verify_set_level(unsigned int level)
cb_ssl_verify_level
=
level
;
cb_ssl_verify_level
=
level
;
}
}
RSA
*
cb_generate_tmp_rsa
(
SSL
*
s
,
int
is_export
,
int
keylength
)
{
/* TODO: Perhaps make it so our global key can be generated on-the-fly
* after certain intervals? */
static
RSA
*
rsa_tmp
=
NULL
;
if
(
!
rsa_tmp
)
rsa_tmp
=
RSA_generate_key
(
keylength
,
RSA_F4
,
NULL
,
NULL
);
return
rsa_tmp
;
}
#endif
/* !defined(NO_OPENSSL) */
#endif
/* !defined(NO_OPENSSL) */
demos/tunala/tunala.c
浏览文件 @
744c49a8
...
@@ -69,8 +69,8 @@ typedef struct _tunala_world_t {
...
@@ -69,8 +69,8 @@ typedef struct _tunala_world_t {
static
SSL_CTX
*
initialise_ssl_ctx
(
int
server_mode
,
const
char
*
engine_id
,
static
SSL_CTX
*
initialise_ssl_ctx
(
int
server_mode
,
const
char
*
engine_id
,
const
char
*
CAfile
,
const
char
*
cert
,
const
char
*
key
,
const
char
*
CAfile
,
const
char
*
cert
,
const
char
*
key
,
const
char
*
dcert
,
const
char
*
dkey
,
const
char
*
cipher_list
,
const
char
*
dcert
,
const
char
*
dkey
,
const
char
*
cipher_list
,
const
char
*
dh_file
,
const
char
*
dh_special
,
int
ctx_options
,
const
char
*
dh_file
,
const
char
*
dh_special
,
int
tmp_rsa
,
int
out_state
,
int
out_verify
,
int
verify_mode
,
int
ctx_options
,
int
out_state
,
int
out_verify
,
int
verify_mode
,
unsigned
int
verify_depth
);
unsigned
int
verify_depth
);
static
void
selector_init
(
tunala_selector_t
*
selector
);
static
void
selector_init
(
tunala_selector_t
*
selector
);
static
void
selector_add_listener
(
tunala_selector_t
*
selector
,
int
fd
);
static
void
selector_add_listener
(
tunala_selector_t
*
selector
,
int
fd
);
...
@@ -102,6 +102,7 @@ static int def_flipped = 0;
...
@@ -102,6 +102,7 @@ static int def_flipped = 0;
static
const
char
*
def_cipher_list
=
NULL
;
static
const
char
*
def_cipher_list
=
NULL
;
static
const
char
*
def_dh_file
=
NULL
;
static
const
char
*
def_dh_file
=
NULL
;
static
const
char
*
def_dh_special
=
NULL
;
static
const
char
*
def_dh_special
=
NULL
;
static
int
def_tmp_rsa
=
1
;
static
int
def_ctx_options
=
0
;
static
int
def_ctx_options
=
0
;
static
int
def_verify_mode
=
0
;
static
int
def_verify_mode
=
0
;
static
unsigned
int
def_verify_depth
=
10
;
static
unsigned
int
def_verify_depth
=
10
;
...
@@ -127,6 +128,7 @@ static const char *helpstring =
...
@@ -127,6 +128,7 @@ static const char *helpstring =
" -cipher <list> (specifies cipher list to use)
\n
"
" -cipher <list> (specifies cipher list to use)
\n
"
" -dh_file <path> (a PEM file containing DH parameters to use)
\n
"
" -dh_file <path> (a PEM file containing DH parameters to use)
\n
"
" -dh_special <NULL|generate|standard> (see below: def=NULL)
\n
"
" -dh_special <NULL|generate|standard> (see below: def=NULL)
\n
"
" -no_tmp_rsa (don't generate temporary RSA keys)
\n
"
" -no_ssl2 (disable SSLv2)
\n
"
" -no_ssl2 (disable SSLv2)
\n
"
" -no_ssl3 (disable SSLv3)
\n
"
" -no_ssl3 (disable SSLv3)
\n
"
" -no_tls1 (disable TLSv1)
\n
"
" -no_tls1 (disable TLSv1)
\n
"
...
@@ -306,6 +308,7 @@ int main(int argc, char *argv[])
...
@@ -306,6 +308,7 @@ int main(int argc, char *argv[])
const
char
*
cipher_list
=
def_cipher_list
;
const
char
*
cipher_list
=
def_cipher_list
;
const
char
*
dh_file
=
def_dh_file
;
const
char
*
dh_file
=
def_dh_file
;
const
char
*
dh_special
=
def_dh_special
;
const
char
*
dh_special
=
def_dh_special
;
int
tmp_rsa
=
def_tmp_rsa
;
int
ctx_options
=
def_ctx_options
;
int
ctx_options
=
def_ctx_options
;
int
verify_mode
=
def_verify_mode
;
int
verify_mode
=
def_verify_mode
;
unsigned
int
verify_depth
=
def_verify_depth
;
unsigned
int
verify_depth
=
def_verify_depth
;
...
@@ -427,6 +430,9 @@ next_arg:
...
@@ -427,6 +430,9 @@ next_arg:
if
(
!
parse_dh_special
(
*
argv
,
&
dh_special
))
if
(
!
parse_dh_special
(
*
argv
,
&
dh_special
))
return
1
;
return
1
;
goto
next_arg
;
goto
next_arg
;
}
else
if
(
strcmp
(
*
argv
,
"-no_tmp_rsa"
)
==
0
)
{
tmp_rsa
=
0
;
goto
next_arg
;
}
else
if
(
strcmp
(
*
argv
,
"-no_ssl2"
)
==
0
)
{
}
else
if
(
strcmp
(
*
argv
,
"-no_ssl2"
)
==
0
)
{
ctx_options
|=
SSL_OP_NO_SSLv2
;
ctx_options
|=
SSL_OP_NO_SSLv2
;
goto
next_arg
;
goto
next_arg
;
...
@@ -487,7 +493,7 @@ next_arg:
...
@@ -487,7 +493,7 @@ next_arg:
/* Create the SSL_CTX */
/* Create the SSL_CTX */
if
((
world
.
ssl_ctx
=
initialise_ssl_ctx
(
server_mode
,
engine_id
,
if
((
world
.
ssl_ctx
=
initialise_ssl_ctx
(
server_mode
,
engine_id
,
cacert
,
cert
,
key
,
dcert
,
dkey
,
cipher_list
,
dh_file
,
cacert
,
cert
,
key
,
dcert
,
dkey
,
cipher_list
,
dh_file
,
dh_special
,
ctx_options
,
out_state
,
out_verify
,
dh_special
,
tmp_rsa
,
ctx_options
,
out_state
,
out_verify
,
verify_mode
,
verify_depth
))
==
NULL
)
verify_mode
,
verify_depth
))
==
NULL
)
return
err_str1
(
"initialise_ssl_ctx(engine_id=%s) failed"
,
return
err_str1
(
"initialise_ssl_ctx(engine_id=%s) failed"
,
(
engine_id
==
NULL
)
?
"NULL"
:
engine_id
);
(
engine_id
==
NULL
)
?
"NULL"
:
engine_id
);
...
@@ -522,8 +528,13 @@ main_loop:
...
@@ -522,8 +528,13 @@ main_loop:
/* Now do the select */
/* Now do the select */
switch
(
selector_select
(
&
world
.
selector
))
{
switch
(
selector_select
(
&
world
.
selector
))
{
case
-
1
:
case
-
1
:
fprintf
(
stderr
,
"selector_select returned a badness error.
\n
"
);
if
(
errno
!=
EINTR
)
{
goto
shouldnt_happen
;
fprintf
(
stderr
,
"selector_select returned a "
"badness error.
\n
"
);
goto
shouldnt_happen
;
}
fprintf
(
stderr
,
"Warn, selector interrupted by a signal
\n
"
);
goto
main_loop
;
case
0
:
case
0
:
fprintf
(
stderr
,
"Warn, selector_select returned 0 - signal?""?
\n
"
);
fprintf
(
stderr
,
"Warn, selector_select returned 0 - signal?""?
\n
"
);
goto
main_loop
;
goto
main_loop
;
...
@@ -717,8 +728,8 @@ do_it:
...
@@ -717,8 +728,8 @@ do_it:
static
SSL_CTX
*
initialise_ssl_ctx
(
int
server_mode
,
const
char
*
engine_id
,
static
SSL_CTX
*
initialise_ssl_ctx
(
int
server_mode
,
const
char
*
engine_id
,
const
char
*
CAfile
,
const
char
*
cert
,
const
char
*
key
,
const
char
*
CAfile
,
const
char
*
cert
,
const
char
*
key
,
const
char
*
dcert
,
const
char
*
dkey
,
const
char
*
cipher_list
,
const
char
*
dcert
,
const
char
*
dkey
,
const
char
*
cipher_list
,
const
char
*
dh_file
,
const
char
*
dh_special
,
int
ctx_options
,
const
char
*
dh_file
,
const
char
*
dh_special
,
int
tmp_rsa
,
int
out_state
,
int
out_verify
,
int
verify_mode
,
int
ctx_options
,
int
out_state
,
int
out_verify
,
int
verify_mode
,
unsigned
int
verify_depth
)
unsigned
int
verify_depth
)
{
{
SSL_CTX
*
ctx
=
NULL
,
*
ret
=
NULL
;
SSL_CTX
*
ctx
=
NULL
,
*
ret
=
NULL
;
...
@@ -770,6 +781,9 @@ static SSL_CTX *initialise_ssl_ctx(int server_mode, const char *engine_id,
...
@@ -770,6 +781,9 @@ static SSL_CTX *initialise_ssl_ctx(int server_mode, const char *engine_id,
/* dcert and dkey */
/* dcert and dkey */
if
((
dcert
||
dkey
)
&&
!
ctx_set_cert
(
ctx
,
dcert
,
dkey
))
if
((
dcert
||
dkey
)
&&
!
ctx_set_cert
(
ctx
,
dcert
,
dkey
))
goto
err
;
goto
err
;
/* temporary RSA key generation */
if
(
tmp_rsa
)
SSL_CTX_set_tmp_rsa_callback
(
ctx
,
cb_generate_tmp_rsa
);
/* cipher_list */
/* cipher_list */
if
(
cipher_list
)
{
if
(
cipher_list
)
{
...
...
demos/tunala/tunala.h
浏览文件 @
744c49a8
...
@@ -149,6 +149,7 @@ int cb_ssl_verify(int ok, X509_STORE_CTX *ctx);
...
@@ -149,6 +149,7 @@ int cb_ssl_verify(int ok, X509_STORE_CTX *ctx);
void
cb_ssl_verify_set_output
(
FILE
*
fp
);
void
cb_ssl_verify_set_output
(
FILE
*
fp
);
void
cb_ssl_verify_set_depth
(
unsigned
int
verify_depth
);
void
cb_ssl_verify_set_depth
(
unsigned
int
verify_depth
);
void
cb_ssl_verify_set_level
(
unsigned
int
level
);
void
cb_ssl_verify_set_level
(
unsigned
int
level
);
RSA
*
cb_generate_tmp_rsa
(
SSL
*
s
,
int
is_export
,
int
keylength
);
#endif
/* !defined(NO_OPENSSL) */
#endif
/* !defined(NO_OPENSSL) */
#endif
/* !defined(OPENSSL_NO_BUFFER) */
#endif
/* !defined(OPENSSL_NO_BUFFER) */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录