Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
f76d8c47
T
Third Party Openssl
项目概览
OpenHarmony
/
Third Party Openssl
1 年多 前同步成功
通知
10
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看板
提交
f76d8c47
编写于
25年前
作者:
D
Dr. Stephen Henson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Modify verify code to handle self signed certificates.
上级
b1fe6ca1
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
52 addition
and
22 deletion
+52
-22
CHANGES
CHANGES
+14
-1
apps/verify.c
apps/verify.c
+11
-14
crypto/x509/x509_vfy.c
crypto/x509/x509_vfy.c
+27
-7
未找到文件。
CHANGES
浏览文件 @
f76d8c47
...
...
@@ -4,6 +4,19 @@
Changes between 0.9.4 and 0.9.5 [xx XXX 1999]
*) First update to verify code. Change the verify utility
so it warns if it is passed a self signed certificate:
for consistency with the normal behaviour. X509_verify
has been modified to it will now verify a self signed
certificate if *exactly* the same certificate appears
in the store: it was previously impossible to trust a
single self signed certificate. This means that:
openssl verify ss.pem
now gives a warning about a self signed certificate but
openssl verify -CAfile ss.pem ss.pem
is OK.
[Steve Henson]
*) For servers, store verify_result in SSL_SESSION data structure
(and add it to external session representation).
This is needed when client certificate verifications fails,
...
...
@@ -18,7 +31,7 @@
*) Fix a bug in the new PKCS#7 code: it didn't consider the
case in PKCS7_dataInit() where the signed PKCS7 structure
didn't contain any existing data because it was being created.
[Po-Cheng Chen
"
<pocheng@nst.com.tw>, slightly modified by Steve Henson]
[Po-Cheng Chen <pocheng@nst.com.tw>, slightly modified by Steve Henson]
*) Add a salt to the key derivation routines in enc.c. This
forms the first 8 bytes of the encrypted file. Also add a
...
...
This diff is collapsed.
Click to expand it.
apps/verify.c
浏览文件 @
f76d8c47
...
...
@@ -206,21 +206,18 @@ static int MS_CALLBACK cb(int ok, X509_STORE_CTX *ctx)
if
(
!
ok
)
{
/* since we are just checking the certificates, it is
* ok if they are self signed. */
if
(
ctx
->
error
==
X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT
)
ok
=
1
;
else
{
X509_NAME_oneline
(
X509_NAME_oneline
(
X509_get_subject_name
(
ctx
->
current_cert
),
buf
,
256
);
printf
(
"%s
\n
"
,
buf
);
printf
(
"error %d at %d depth lookup:%s
\n
"
,
ctx
->
error
,
ctx
->
error_depth
,
X509_verify_cert_error_string
(
ctx
->
error
));
if
(
ctx
->
error
==
X509_V_ERR_CERT_HAS_EXPIRED
)
ok
=
1
;
}
printf
(
"%s
\n
"
,
buf
);
printf
(
"error %d at %d depth lookup:%s
\n
"
,
ctx
->
error
,
ctx
->
error_depth
,
X509_verify_cert_error_string
(
ctx
->
error
));
if
(
ctx
->
error
==
X509_V_ERR_CERT_HAS_EXPIRED
)
ok
=
1
;
/* since we are just checking the certificates, it is
* ok if they are self signed. But we should still warn
* the user.
*/
if
(
ctx
->
error
==
X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT
)
ok
=
1
;
}
if
(
!
v_verbose
)
ERR_clear_error
();
...
...
This diff is collapsed.
Click to expand it.
crypto/x509/x509_vfy.c
浏览文件 @
f76d8c47
...
...
@@ -125,7 +125,7 @@ int X509_verify_cert(X509_STORE_CTX *ctx)
ctx
->
last_untrusted
=
1
;
}
/* We use a temporary so we can chop and hack at it */
/* We use a temporary
STACK
so we can chop and hack at it */
if
(
ctx
->
untrusted
!=
NULL
&&
(
sktmp
=
sk_X509_dup
(
ctx
->
untrusted
))
==
NULL
)
{
...
...
@@ -182,17 +182,37 @@ int X509_verify_cert(X509_STORE_CTX *ctx)
i
=
sk_X509_num
(
ctx
->
chain
);
x
=
sk_X509_value
(
ctx
->
chain
,
i
-
1
);
if
(
X509_NAME_cmp
(
X509_get_subject_name
(
x
),
X509_get_issuer_name
(
x
))
xn
=
X509_get_subject_name
(
x
);
if
(
X509_NAME_cmp
(
xn
,
X509_get_issuer_name
(
x
))
==
0
)
{
/* we have a self signed certificate */
if
(
sk_X509_num
(
ctx
->
chain
)
==
1
)
{
ctx
->
error
=
X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT
;
ctx
->
current_cert
=
x
;
ctx
->
error_depth
=
i
-
1
;
ok
=
cb
(
0
,
ctx
);
if
(
!
ok
)
goto
end
;
/* We have a single self signed certificate: see if
* we can find it in the store. We must have an exact
* match to avoid possible impersonation.
*/
ok
=
X509_STORE_get_by_subject
(
ctx
,
X509_LU_X509
,
xn
,
&
obj
);
if
((
ok
!=
X509_LU_X509
)
||
X509_cmp
(
x
,
obj
.
data
.
x509
))
{
ctx
->
error
=
X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT
;
ctx
->
current_cert
=
x
;
ctx
->
error_depth
=
i
-
1
;
if
(
ok
==
X509_LU_X509
)
X509_OBJECT_free_contents
(
&
obj
);
ok
=
cb
(
0
,
ctx
);
if
(
!
ok
)
goto
end
;
}
else
{
/* We have a match: replace certificate with store version
* so we get any trust settings.
*/
X509_free
(
x
);
x
=
obj
.
data
.
x509
;
sk_X509_set
(
ctx
->
chain
,
i
-
1
,
x
);
ctx
->
last_untrusted
=
0
;
}
}
else
{
...
...
This diff is collapsed.
Click to expand it.
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录
新手
引导
客服
返回
顶部