Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
a5afc0a8
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,发现更多精彩内容 >>
提交
a5afc0a8
编写于
11月 23, 2012
作者:
D
Dr. Stephen Henson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Don't display messages about verify depth in s_server if -quiet it set.
Add support for separate verify and chain stores in s_client.
上级
20b431e3
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
65 addition
and
44 deletion
+65
-44
apps/s_apps.h
apps/s_apps.h
+3
-0
apps/s_cb.c
apps/s_cb.c
+29
-0
apps/s_client.c
apps/s_client.c
+29
-0
apps/s_server.c
apps/s_server.c
+4
-44
未找到文件。
apps/s_apps.h
浏览文件 @
a5afc0a8
...
@@ -201,4 +201,7 @@ int args_ssl(char ***pargs, int *pargc, SSL_CONF_CTX *cctx,
...
@@ -201,4 +201,7 @@ int args_ssl(char ***pargs, int *pargc, SSL_CONF_CTX *cctx,
int
*
badarg
,
BIO
*
err
,
STACK_OF
(
OPENSSL_STRING
)
**
pstr
);
int
*
badarg
,
BIO
*
err
,
STACK_OF
(
OPENSSL_STRING
)
**
pstr
);
int
args_ssl_call
(
SSL_CTX
*
ctx
,
BIO
*
err
,
SSL_CONF_CTX
*
cctx
,
int
args_ssl_call
(
SSL_CTX
*
ctx
,
BIO
*
err
,
SSL_CONF_CTX
*
cctx
,
STACK_OF
(
OPENSSL_STRING
)
*
str
,
int
no_ecdhe
);
STACK_OF
(
OPENSSL_STRING
)
*
str
,
int
no_ecdhe
);
int
ssl_load_stores
(
SSL_CTX
*
ctx
,
const
char
*
vfyCApath
,
const
char
*
vfyCAfile
,
const
char
*
chCApath
,
const
char
*
chCAfile
);
#endif
#endif
apps/s_cb.c
浏览文件 @
a5afc0a8
...
@@ -1671,3 +1671,32 @@ int args_ssl_call(SSL_CTX *ctx, BIO *err, SSL_CONF_CTX *cctx,
...
@@ -1671,3 +1671,32 @@ int args_ssl_call(SSL_CTX *ctx, BIO *err, SSL_CONF_CTX *cctx,
}
}
return
1
;
return
1
;
}
}
int
ssl_load_stores
(
SSL_CTX
*
ctx
,
const
char
*
vfyCApath
,
const
char
*
vfyCAfile
,
const
char
*
chCApath
,
const
char
*
chCAfile
)
{
X509_STORE
*
vfy
=
NULL
,
*
ch
=
NULL
;
int
rv
=
0
;
if
(
vfyCApath
||
vfyCAfile
)
{
vfy
=
X509_STORE_new
();
if
(
!
X509_STORE_load_locations
(
vfy
,
vfyCAfile
,
vfyCApath
))
goto
err
;
SSL_CTX_set1_verify_cert_store
(
ctx
,
vfy
);
}
if
(
chCApath
||
chCAfile
)
{
ch
=
X509_STORE_new
();
if
(
!
X509_STORE_load_locations
(
ch
,
chCAfile
,
chCApath
))
goto
err
;
SSL_CTX_set1_chain_cert_store
(
ctx
,
ch
);
}
rv
=
1
;
err:
if
(
vfy
)
X509_STORE_free
(
vfy
);
if
(
ch
)
X509_STORE_free
(
ch
);
return
rv
;
}
apps/s_client.c
浏览文件 @
a5afc0a8
...
@@ -581,6 +581,8 @@ int MAIN(int argc, char **argv)
...
@@ -581,6 +581,8 @@ int MAIN(int argc, char **argv)
X509
*
cert
=
NULL
;
X509
*
cert
=
NULL
;
EVP_PKEY
*
key
=
NULL
;
EVP_PKEY
*
key
=
NULL
;
char
*
CApath
=
NULL
,
*
CAfile
=
NULL
;
char
*
CApath
=
NULL
,
*
CAfile
=
NULL
;
char
*
chCApath
=
NULL
,
*
chCAfile
=
NULL
;
char
*
vfyCApath
=
NULL
,
*
vfyCAfile
=
NULL
;
int
reconnect
=
0
,
badop
=
0
,
verify
=
SSL_VERIFY_NONE
;
int
reconnect
=
0
,
badop
=
0
,
verify
=
SSL_VERIFY_NONE
;
int
crlf
=
0
;
int
crlf
=
0
;
int
write_tty
,
read_tty
,
write_ssl
,
read_ssl
,
tty_on
,
ssl_pending
;
int
write_tty
,
read_tty
,
write_ssl
,
read_ssl
,
tty_on
,
ssl_pending
;
...
@@ -901,6 +903,16 @@ int MAIN(int argc, char **argv)
...
@@ -901,6 +903,16 @@ int MAIN(int argc, char **argv)
if
(
--
argc
<
1
)
goto
bad
;
if
(
--
argc
<
1
)
goto
bad
;
CApath
=
*
(
++
argv
);
CApath
=
*
(
++
argv
);
}
}
else
if
(
strcmp
(
*
argv
,
"-chainCApath"
)
==
0
)
{
if
(
--
argc
<
1
)
goto
bad
;
chCApath
=
*
(
++
argv
);
}
else
if
(
strcmp
(
*
argv
,
"-verifyCApath"
)
==
0
)
{
if
(
--
argc
<
1
)
goto
bad
;
vfyCApath
=
*
(
++
argv
);
}
else
if
(
strcmp
(
*
argv
,
"-build_chain"
)
==
0
)
else
if
(
strcmp
(
*
argv
,
"-build_chain"
)
==
0
)
build_chain
=
1
;
build_chain
=
1
;
else
if
(
strcmp
(
*
argv
,
"-CAfile"
)
==
0
)
else
if
(
strcmp
(
*
argv
,
"-CAfile"
)
==
0
)
...
@@ -908,6 +920,16 @@ int MAIN(int argc, char **argv)
...
@@ -908,6 +920,16 @@ int MAIN(int argc, char **argv)
if
(
--
argc
<
1
)
goto
bad
;
if
(
--
argc
<
1
)
goto
bad
;
CAfile
=
*
(
++
argv
);
CAfile
=
*
(
++
argv
);
}
}
else
if
(
strcmp
(
*
argv
,
"-chainCAfile"
)
==
0
)
{
if
(
--
argc
<
1
)
goto
bad
;
chCAfile
=
*
(
++
argv
);
}
else
if
(
strcmp
(
*
argv
,
"-verifyCAfile"
)
==
0
)
{
if
(
--
argc
<
1
)
goto
bad
;
vfyCAfile
=
*
(
++
argv
);
}
#ifndef OPENSSL_NO_TLSEXT
#ifndef OPENSSL_NO_TLSEXT
# ifndef OPENSSL_NO_NEXTPROTONEG
# ifndef OPENSSL_NO_NEXTPROTONEG
else
if
(
strcmp
(
*
argv
,
"-nextprotoneg"
)
==
0
)
else
if
(
strcmp
(
*
argv
,
"-nextprotoneg"
)
==
0
)
...
@@ -1157,6 +1179,13 @@ bad:
...
@@ -1157,6 +1179,13 @@ bad:
goto
end
;
goto
end
;
}
}
if
(
!
ssl_load_stores
(
ctx
,
vfyCApath
,
vfyCAfile
,
chCApath
,
chCAfile
))
{
BIO_printf
(
bio_err
,
"Error loading store locations
\n
"
);
ERR_print_errors
(
bio_err
);
goto
end
;
}
#ifndef OPENSSL_NO_ENGINE
#ifndef OPENSSL_NO_ENGINE
if
(
ssl_client_engine
)
if
(
ssl_client_engine
)
{
{
...
...
apps/s_server.c
浏览文件 @
a5afc0a8
...
@@ -216,9 +216,6 @@ static int generate_session_id(const SSL *ssl, unsigned char *id,
...
@@ -216,9 +216,6 @@ static int generate_session_id(const SSL *ssl, unsigned char *id,
unsigned
int
*
id_len
);
unsigned
int
*
id_len
);
static
void
init_session_cache_ctx
(
SSL_CTX
*
sctx
);
static
void
init_session_cache_ctx
(
SSL_CTX
*
sctx
);
static
void
free_sessions
(
void
);
static
void
free_sessions
(
void
);
static
int
ssl_load_stores
(
SSL_CTX
*
sctx
,
const
char
*
vfyCApath
,
const
char
*
vfyCAfile
,
const
char
*
chCApath
,
const
char
*
chCAfile
);
#ifndef OPENSSL_NO_DH
#ifndef OPENSSL_NO_DH
static
DH
*
load_dh_param
(
const
char
*
dhfile
);
static
DH
*
load_dh_param
(
const
char
*
dhfile
);
static
DH
*
get_dh512
(
void
);
static
DH
*
get_dh512
(
void
);
...
@@ -1057,7 +1054,8 @@ int MAIN(int argc, char *argv[])
...
@@ -1057,7 +1054,8 @@ int MAIN(int argc, char *argv[])
s_server_verify
=
SSL_VERIFY_PEER
|
SSL_VERIFY_CLIENT_ONCE
;
s_server_verify
=
SSL_VERIFY_PEER
|
SSL_VERIFY_CLIENT_ONCE
;
if
(
--
argc
<
1
)
goto
bad
;
if
(
--
argc
<
1
)
goto
bad
;
verify_depth
=
atoi
(
*
(
++
argv
));
verify_depth
=
atoi
(
*
(
++
argv
));
BIO_printf
(
bio_err
,
"verify depth is %d
\n
"
,
verify_depth
);
if
(
!
s_quiet
)
BIO_printf
(
bio_err
,
"verify depth is %d
\n
"
,
verify_depth
);
}
}
else
if
(
strcmp
(
*
argv
,
"-Verify"
)
==
0
)
else
if
(
strcmp
(
*
argv
,
"-Verify"
)
==
0
)
{
{
...
@@ -1065,7 +1063,8 @@ int MAIN(int argc, char *argv[])
...
@@ -1065,7 +1063,8 @@ int MAIN(int argc, char *argv[])
SSL_VERIFY_CLIENT_ONCE
;
SSL_VERIFY_CLIENT_ONCE
;
if
(
--
argc
<
1
)
goto
bad
;
if
(
--
argc
<
1
)
goto
bad
;
verify_depth
=
atoi
(
*
(
++
argv
));
verify_depth
=
atoi
(
*
(
++
argv
));
BIO_printf
(
bio_err
,
"verify depth is %d, must return a certificate
\n
"
,
verify_depth
);
if
(
!
s_quiet
)
BIO_printf
(
bio_err
,
"verify depth is %d, must return a certificate
\n
"
,
verify_depth
);
}
}
else
if
(
strcmp
(
*
argv
,
"-context"
)
==
0
)
else
if
(
strcmp
(
*
argv
,
"-context"
)
==
0
)
{
{
...
@@ -3399,42 +3398,3 @@ static void free_sessions(void)
...
@@ -3399,42 +3398,3 @@ static void free_sessions(void)
}
}
first
=
NULL
;
first
=
NULL
;
}
}
static
int
ssl_load_stores
(
SSL_CTX
*
sctx
,
const
char
*
vfyCApath
,
const
char
*
vfyCAfile
,
const
char
*
chCApath
,
const
char
*
chCAfile
)
{
X509_STORE
*
vfy
=
NULL
,
*
ch
=
NULL
;
int
rv
=
0
;
if
(
vfyCApath
||
vfyCAfile
)
{
vfy
=
X509_STORE_new
();
if
(
!
X509_STORE_load_locations
(
vfy
,
vfyCAfile
,
vfyCApath
))
goto
err
;
SSL_CTX_set1_verify_cert_store
(
ctx
,
vfy
);
}
if
(
chCApath
||
chCAfile
)
{
ch
=
X509_STORE_new
();
if
(
!
X509_STORE_load_locations
(
ch
,
chCAfile
,
chCApath
))
goto
err
;
/*X509_STORE_set_verify_cb(ch, verify_callback);*/
SSL_CTX_set1_chain_cert_store
(
ctx
,
ch
);
}
rv
=
1
;
err:
if
(
vfy
)
X509_STORE_free
(
vfy
);
if
(
ch
)
X509_STORE_free
(
ch
);
return
rv
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录