Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
e1cc0671
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看板
提交
e1cc0671
编写于
4月 30, 2005
作者:
D
Dr. Stephen Henson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use more efficient way to locate end of an ASN1 structure.
上级
c1a8a5de
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
61 addition
and
4 deletion
+61
-4
crypto/asn1/asn1.h
crypto/asn1/asn1.h
+1
-0
crypto/asn1/asn1_err.c
crypto/asn1/asn1_err.c
+1
-0
crypto/asn1/tasn_dec.c
crypto/asn1/tasn_dec.c
+59
-4
未找到文件。
crypto/asn1/asn1.h
浏览文件 @
e1cc0671
...
...
@@ -1035,6 +1035,7 @@ void ERR_load_ASN1_strings(void);
#define ASN1_F_ASN1_DUP 111
#define ASN1_F_ASN1_ENUMERATED_SET 112
#define ASN1_F_ASN1_ENUMERATED_TO_BN 113
#define ASN1_F_ASN1_FIND_END 190
#define ASN1_F_ASN1_GENERALIZEDTIME_SET 185
#define ASN1_F_ASN1_GENERATE_V3 178
#define ASN1_F_ASN1_GET_OBJECT 114
...
...
crypto/asn1/asn1_err.c
浏览文件 @
e1cc0671
...
...
@@ -88,6 +88,7 @@ static ERR_STRING_DATA ASN1_str_functs[]=
{
ERR_FUNC
(
ASN1_F_ASN1_DUP
),
"ASN1_dup"
},
{
ERR_FUNC
(
ASN1_F_ASN1_ENUMERATED_SET
),
"ASN1_ENUMERATED_set"
},
{
ERR_FUNC
(
ASN1_F_ASN1_ENUMERATED_TO_BN
),
"ASN1_ENUMERATED_to_BN"
},
{
ERR_FUNC
(
ASN1_F_ASN1_FIND_END
),
"ASN1_FIND_END"
},
{
ERR_FUNC
(
ASN1_F_ASN1_GENERALIZEDTIME_SET
),
"ASN1_GENERALIZEDTIME_set"
},
{
ERR_FUNC
(
ASN1_F_ASN1_GENERATE_V3
),
"ASN1_generate_v3"
},
{
ERR_FUNC
(
ASN1_F_ASN1_GET_OBJECT
),
"ASN1_get_object"
},
...
...
crypto/asn1/tasn_dec.c
浏览文件 @
e1cc0671
...
...
@@ -66,6 +66,7 @@
#include <openssl/err.h>
static
int
asn1_check_eoc
(
const
unsigned
char
**
in
,
long
len
);
static
int
asn1_find_end
(
const
unsigned
char
**
in
,
long
len
,
char
inf
);
static
int
asn1_collect
(
BUF_MEM
*
buf
,
const
unsigned
char
**
in
,
long
len
,
char
inf
,
int
tag
,
int
aclass
);
...
...
@@ -848,7 +849,7 @@ static int asn1_d2i_ex_primitive(ASN1_VALUE **pval,
/* If indefinite length constructed find the real end */
if
(
inf
)
{
if
(
!
asn1_
collect
(
NULL
,
&
p
,
plen
,
inf
,
-
1
,
-
1
))
if
(
!
asn1_
find_end
(
&
p
,
plen
,
inf
))
goto
err
;
len
=
p
-
cont
;
}
...
...
@@ -1053,12 +1054,66 @@ int asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len,
return
ret
;
}
/* This function finds the end of an ASN1 structure when passed its maximum
* length, whether it is indefinite length and a pointer to the content.
* This is more efficient than calling asn1_collect because it does not
* recurse on each indefinite length header.
*/
static
int
asn1_find_end
(
const
unsigned
char
**
in
,
long
len
,
char
inf
)
{
int
expected_eoc
;
long
plen
;
const
unsigned
char
*
p
=
*
in
,
*
q
;
/* If not indefinite length constructed just add length */
if
(
inf
==
0
)
{
*
in
+=
len
;
return
1
;
}
expected_eoc
=
1
;
/* Indefinite length constructed form. Find the end when enough EOCs
* are found. If more indefinite length constructed headers
* are encountered increment the expected eoc count otherwise just
* skip to the end of the data.
*/
while
(
len
>
0
)
{
if
(
asn1_check_eoc
(
&
p
,
len
))
{
expected_eoc
--
;
if
(
expected_eoc
==
0
)
break
;
len
-=
2
;
continue
;
}
q
=
p
;
/* Just read in a header: only care about the length */
if
(
!
asn1_check_tlen
(
&
plen
,
NULL
,
NULL
,
&
inf
,
NULL
,
&
p
,
len
,
-
1
,
0
,
0
,
NULL
))
{
ASN1err
(
ASN1_F_ASN1_FIND_END
,
ERR_R_NESTED_ASN1_ERROR
);
return
0
;
}
if
(
inf
)
expected_eoc
++
;
else
p
+=
plen
;
len
-=
p
-
q
;
}
if
(
expected_eoc
)
{
ASN1err
(
ASN1_F_ASN1_FIND_END
,
ASN1_R_MISSING_EOC
);
return
0
;
}
*
in
=
p
;
return
1
;
}
/* This function collects the asn1 data from a constructred string
* type into a buffer. The values of 'in' and 'len' should refer
* to the contents of the constructed type and 'inf' should be set
* if it is indefinite length. If 'buf' is NULL then we just want
* to find the end of the current structure: useful for indefinite
* length constructed stuff.
* if it is indefinite length.
*/
static
int
asn1_collect
(
BUF_MEM
*
buf
,
const
unsigned
char
**
in
,
long
len
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录