Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
016bc5ce
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看板
提交
016bc5ce
编写于
9月 11, 2006
作者:
D
Dr. Stephen Henson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixes for new CRL/cert callbacks. Update CRL processing code to use new
callbacks.
上级
ed65f7dc
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
66 addition
and
66 deletion
+66
-66
crypto/x509/x509_lu.c
crypto/x509/x509_lu.c
+45
-12
crypto/x509/x509_vfy.c
crypto/x509/x509_vfy.c
+19
-52
crypto/x509/x509_vfy.h
crypto/x509/x509_vfy.h
+2
-2
未找到文件。
crypto/x509/x509_lu.c
浏览文件 @
016bc5ce
...
...
@@ -452,9 +452,9 @@ static int x509_object_idx_cnt(STACK_OF(X509_OBJECT) *h, int type,
for
(
tidx
=
idx
+
1
;
tidx
<
sk_X509_OBJECT_num
(
h
);
tidx
++
)
{
tobj
=
sk_X509_OBJECT_value
(
h
,
tidx
);
if
(
!
x509_object_cmp
(
&
tobj
,
&
pstmp
))
if
(
x509_object_cmp
(
&
tobj
,
&
pstmp
))
break
;
*
pnmatch
++
;
(
*
pnmatch
)
++
;
}
}
return
idx
;
...
...
@@ -476,7 +476,7 @@ X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h, int type,
return
sk_X509_OBJECT_value
(
h
,
idx
);
}
STACK_OF
(
X509
)
*
X509_STORE_get
_certs
(
X509_STORE
*
st
,
X509_NAME
*
nm
)
STACK_OF
(
X509
)
*
X509_STORE_get
1_certs
(
X509_STORE_CTX
*
ctx
,
X509_NAME
*
nm
)
{
int
i
,
idx
,
cnt
;
STACK_OF
(
X509
)
*
sk
;
...
...
@@ -484,16 +484,32 @@ STACK_OF(X509)* X509_STORE_get_certs(X509_STORE *st, X509_NAME *nm)
X509_OBJECT
*
obj
;
sk
=
sk_X509_new_null
();
CRYPTO_r_lock
(
CRYPTO_LOCK_X509_STORE
);
idx
=
x509_object_idx_cnt
(
st
->
objs
,
X509_LU_X509
,
nm
,
&
cnt
);
idx
=
x509_object_idx_cnt
(
ctx
->
ctx
->
objs
,
X509_LU_X509
,
nm
,
&
cnt
);
if
(
idx
<
0
)
{
/* Nothing found in cache: do lookup to possibly add new
* objects to cache
*/
X509_OBJECT
xobj
;
CRYPTO_r_unlock
(
CRYPTO_LOCK_X509_STORE
);
sk_X509_free
(
sk
);
return
NULL
;
if
(
!
X509_STORE_get_by_subject
(
ctx
,
X509_LU_X509
,
nm
,
&
xobj
))
{
sk_X509_free
(
sk
);
return
NULL
;
}
X509_OBJECT_free_contents
(
&
xobj
);
CRYPTO_r_lock
(
CRYPTO_LOCK_X509_STORE
);
idx
=
x509_object_idx_cnt
(
ctx
->
ctx
->
objs
,
X509_LU_X509
,
nm
,
&
cnt
);
if
(
idx
<
0
)
{
CRYPTO_r_unlock
(
CRYPTO_LOCK_X509_STORE
);
sk_X509_free
(
sk
);
return
NULL
;
}
}
for
(
i
=
0
;
i
<
cnt
;
i
++
,
idx
++
)
{
obj
=
sk_X509_OBJECT_value
(
st
->
objs
,
i
);
obj
=
sk_X509_OBJECT_value
(
ctx
->
ctx
->
objs
,
idx
);
x
=
obj
->
data
.
x509
;
CRYPTO_add
(
&
x
->
references
,
1
,
CRYPTO_LOCK_X509
);
if
(
!
sk_X509_push
(
sk
,
x
))
...
...
@@ -509,7 +525,7 @@ STACK_OF(X509)* X509_STORE_get_certs(X509_STORE *st, X509_NAME *nm)
}
STACK_OF
(
X509_CRL
)
*
X509_STORE_get
_crls
(
X509_STORE
*
st
,
X509_NAME
*
nm
)
STACK_OF
(
X509_CRL
)
*
X509_STORE_get
1_crls
(
X509_STORE_CTX
*
ctx
,
X509_NAME
*
nm
)
{
int
i
,
idx
,
cnt
;
STACK_OF
(
X509_CRL
)
*
sk
;
...
...
@@ -517,16 +533,33 @@ STACK_OF(X509_CRL)* X509_STORE_get_crls(X509_STORE *st, X509_NAME *nm)
X509_OBJECT
*
obj
;
sk
=
sk_X509_CRL_new_null
();
CRYPTO_r_lock
(
CRYPTO_LOCK_X509_STORE
);
idx
=
x509_object_idx_cnt
(
st
->
objs
,
X509_LU_CRL
,
nm
,
&
cnt
);
/* Check cache first */
idx
=
x509_object_idx_cnt
(
ctx
->
ctx
->
objs
,
X509_LU_CRL
,
nm
,
&
cnt
);
if
(
idx
<
0
)
{
/* Nothing found in cache: do lookup to possibly add new
* objects to cache
*/
X509_OBJECT
xobj
;
CRYPTO_r_unlock
(
CRYPTO_LOCK_X509_STORE
);
sk_X509_CRL_free
(
sk
);
return
NULL
;
if
(
!
X509_STORE_get_by_subject
(
ctx
,
X509_LU_CRL
,
nm
,
&
xobj
))
{
sk_X509_CRL_free
(
sk
);
return
NULL
;
}
X509_OBJECT_free_contents
(
&
xobj
);
CRYPTO_r_lock
(
CRYPTO_LOCK_X509_STORE
);
idx
=
x509_object_idx_cnt
(
ctx
->
ctx
->
objs
,
X509_LU_CRL
,
nm
,
&
cnt
);
if
(
idx
<
0
)
{
CRYPTO_r_unlock
(
CRYPTO_LOCK_X509_STORE
);
sk_X509_CRL_free
(
sk
);
return
NULL
;
}
}
for
(
i
=
0
;
i
<
cnt
;
i
++
,
idx
++
)
{
obj
=
sk_X509_OBJECT_value
(
st
->
objs
,
i
);
obj
=
sk_X509_OBJECT_value
(
ctx
->
ctx
->
objs
,
idx
);
x
=
obj
->
data
.
crl
;
CRYPTO_add
(
&
x
->
references
,
1
,
CRYPTO_LOCK_X509_CRL
);
if
(
!
sk_X509_CRL_push
(
sk
,
x
))
...
...
crypto/x509/x509_vfy.c
浏览文件 @
016bc5ce
...
...
@@ -79,8 +79,6 @@ static int check_revocation(X509_STORE_CTX *ctx);
static
int
check_cert
(
X509_STORE_CTX
*
ctx
);
static
int
check_policy
(
X509_STORE_CTX
*
ctx
);
static
int
internal_verify
(
X509_STORE_CTX
*
ctx
);
static
STACK_OF
(
X509
)
*
lookup_certs
(
X509_STORE_CTX
*
ctx
,
X509_NAME
*
nm
);
static
STACK_OF
(
X509_CRL
)
*
lookup_crls
(
X509_STORE_CTX
*
ctx
,
X509_NAME
*
nm
);
const
char
*
X509_version
=
"X.509"
OPENSSL_VERSION_PTEXT
;
...
...
@@ -666,7 +664,7 @@ static int get_crl_sk(X509_STORE_CTX *ctx, X509_CRL **pcrl,
for
(
i
=
0
;
i
<
sk_X509_CRL_num
(
crls
);
i
++
)
{
crl
=
sk_X509_CRL_value
(
crls
,
i
);
if
(
X509_NAME_cmp
(
nm
,
X509_CRL_get_issuer
(
crl
)))
if
(
nm
&&
X509_NAME_cmp
(
nm
,
X509_CRL_get_issuer
(
crl
)))
continue
;
if
(
check_crl_time
(
ctx
,
crl
,
0
))
{
...
...
@@ -692,7 +690,7 @@ static int get_crl(X509_STORE_CTX *ctx, X509_CRL **pcrl, X509 *x)
{
int
ok
;
X509_CRL
*
crl
=
NULL
;
X509_OBJECT
xobj
;
STACK_OF
(
X509_CRL
)
*
skcrl
;
X509_NAME
*
nm
;
nm
=
X509_get_issuer_name
(
x
);
ok
=
get_crl_sk
(
ctx
,
&
crl
,
nm
,
ctx
->
crls
);
...
...
@@ -702,11 +700,13 @@ static int get_crl(X509_STORE_CTX *ctx, X509_CRL **pcrl, X509 *x)
return
1
;
}
ok
=
X509_STORE_get_by_subject
(
ctx
,
X509_LU_CRL
,
nm
,
&
xobj
);
/* Lookup CRLs from store */
if
(
!
ok
)
skcrl
=
ctx
->
lookup_crls
(
ctx
,
nm
);
/* If no CRLs found and a near match from get_crl_sk use that */
if
(
!
skcrl
)
{
/* If we got a near match from get_crl_sk use that */
if
(
crl
)
{
*
pcrl
=
crl
;
...
...
@@ -715,41 +715,18 @@ static int get_crl(X509_STORE_CTX *ctx, X509_CRL **pcrl, X509 *x)
return
0
;
}
/* If CRL times not valid look through store */
if
(
!
check_crl_time
(
ctx
,
xobj
.
data
.
crl
,
0
))
get_crl_sk
(
ctx
,
&
crl
,
NULL
,
skcrl
);
sk_X509_CRL_pop_free
(
skcrl
,
X509_CRL_free
);
/* If we got any kind of CRL use it and return success */
if
(
crl
)
{
int
idx
,
i
;
X509_OBJECT
*
pobj
;
X509_OBJECT_free_contents
(
&
xobj
);
idx
=
X509_OBJECT_idx_by_subject
(
ctx
->
ctx
->
objs
,
X509_LU_CRL
,
nm
);
if
(
idx
==
-
1
)
return
0
;
*
pcrl
=
NULL
;
for
(
i
=
idx
;
i
<
sk_X509_OBJECT_num
(
ctx
->
ctx
->
objs
);
i
++
)
{
pobj
=
sk_X509_OBJECT_value
(
ctx
->
ctx
->
objs
,
i
);
/* Check to see if it is a CRL and issuer matches */
if
(
pobj
->
type
!=
X509_LU_CRL
)
break
;
if
(
X509_NAME_cmp
(
nm
,
X509_CRL_get_issuer
(
pobj
->
data
.
crl
)))
break
;
/* Set *pcrl because the CRL will either be valid or
* a "best fit" CRL.
*/
*
pcrl
=
pobj
->
data
.
crl
;
if
(
check_crl_time
(
ctx
,
*
pcrl
,
0
))
break
;
}
if
(
*
pcrl
)
CRYPTO_add
(
&
(
*
pcrl
)
->
references
,
1
,
CRYPTO_LOCK_X509
);
*
pcrl
=
crl
;
return
1
;
}
else
*
pcrl
=
xobj
.
data
.
crl
;
if
(
crl
)
X509_CRL_free
(
crl
);
return
1
;
return
0
;
}
/* Check CRL validity */
...
...
@@ -876,16 +853,6 @@ static int cert_crl(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x)
return
1
;
}
static
STACK_OF
(
X509
)
*
lookup_certs
(
X509_STORE_CTX
*
ctx
,
X509_NAME
*
nm
)
{
return
X509_STORE_get_certs
(
ctx
->
ctx
,
nm
);
}
static
STACK_OF
(
X509_CRL
)
*
lookup_crls
(
X509_STORE_CTX
*
ctx
,
X509_NAME
*
nm
)
{
return
X509_STORE_get_crls
(
ctx
->
ctx
,
nm
);
}
static
int
check_policy
(
X509_STORE_CTX
*
ctx
)
{
int
ret
;
...
...
@@ -1476,12 +1443,12 @@ int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509,
if
(
store
&&
store
->
lookup_certs
)
ctx
->
lookup_certs
=
store
->
lookup_certs
;
else
ctx
->
lookup_certs
=
lookup
_certs
;
ctx
->
lookup_certs
=
X509_STORE_get1
_certs
;
if
(
store
&&
store
->
lookup_crls
)
ctx
->
lookup_crls
=
store
->
lookup_crls
;
else
ctx
->
lookup_crls
=
lookup
_crls
;
ctx
->
lookup_crls
=
X509_STORE_get1
_crls
;
ctx
->
check_policy
=
check_policy
;
...
...
crypto/x509/x509_vfy.h
浏览文件 @
016bc5ce
...
...
@@ -387,8 +387,8 @@ void X509_OBJECT_free_contents(X509_OBJECT *a);
X509_STORE
*
X509_STORE_new
(
void
);
void
X509_STORE_free
(
X509_STORE
*
v
);
STACK_OF
(
X509
)
*
X509_STORE_get
_certs
(
X509_STORE
*
st
,
X509_NAME
*
nm
);
STACK_OF
(
X509_CRL
)
*
X509_STORE_get
_crls
(
X509_STORE
*
st
,
X509_NAME
*
nm
);
STACK_OF
(
X509
)
*
X509_STORE_get
1_certs
(
X509_STORE_CTX
*
st
,
X509_NAME
*
nm
);
STACK_OF
(
X509_CRL
)
*
X509_STORE_get
1_crls
(
X509_STORE_CTX
*
st
,
X509_NAME
*
nm
);
int
X509_STORE_set_flags
(
X509_STORE
*
ctx
,
unsigned
long
flags
);
int
X509_STORE_set_purpose
(
X509_STORE
*
ctx
,
int
purpose
);
int
X509_STORE_set_trust
(
X509_STORE
*
ctx
,
int
trust
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录