Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
btwise
openssl
提交
49445f21
O
openssl
项目概览
btwise
/
openssl
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
openssl
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
49445f21
编写于
5月 12, 2016
作者:
R
Rich Salz
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use OPENSSL_hexchar2int
Reviewed-by:
N
Richard Levitte
<
levitte@openssl.org
>
上级
589902b2
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
26 addition
and
59 deletion
+26
-59
apps/s_client.c
apps/s_client.c
+4
-7
crypto/asn1/f_int.c
crypto/asn1/f_int.c
+2
-8
crypto/asn1/f_string.c
crypto/asn1/f_string.c
+2
-8
crypto/bn/bn_print.c
crypto/bn/bn_print.c
+2
-7
crypto/pem/pem_lib.c
crypto/pem/pem_lib.c
+2
-7
crypto/poly1305/poly1305.c
crypto/poly1305/poly1305.c
+4
-7
crypto/x509v3/v3_utl.c
crypto/x509v3/v3_utl.c
+5
-7
test/danetest.c
test/danetest.c
+5
-8
未找到文件。
apps/s_client.c
浏览文件 @
49445f21
...
...
@@ -518,19 +518,16 @@ static ossl_ssize_t hexdecode(const char **inptr, void *result)
return
-
1
;
for
(
byte
=
0
;
*
in
;
++
in
)
{
char
c
;
int
x
;
if
(
isspace
(
_UC
(
*
in
)))
continue
;
c
=
tolower
(
_UC
(
*
in
));
if
(
'0'
<=
c
&&
c
<=
'9'
)
{
byte
|=
c
-
'0'
;
}
else
if
(
'a'
<=
c
&&
c
<=
'f'
)
{
byte
|=
c
-
'a'
+
10
;
}
else
{
x
=
OPENSSL_hexchar2int
(
*
in
);
if
(
x
<
0
)
{
OPENSSL_free
(
ret
);
return
0
;
}
byte
|=
(
char
)
x
;
if
((
nibble
^=
1
)
==
0
)
{
*
cp
++
=
byte
;
byte
=
0
;
...
...
crypto/asn1/f_int.c
浏览文件 @
49445f21
...
...
@@ -175,14 +175,8 @@ int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size)
}
for
(
j
=
0
;
j
<
i
;
j
++
,
k
+=
2
)
{
for
(
n
=
0
;
n
<
2
;
n
++
)
{
m
=
bufp
[
k
+
n
];
if
((
m
>=
'0'
)
&&
(
m
<=
'9'
))
m
-=
'0'
;
else
if
((
m
>=
'a'
)
&&
(
m
<=
'f'
))
m
=
m
-
'a'
+
10
;
else
if
((
m
>=
'A'
)
&&
(
m
<=
'F'
))
m
=
m
-
'A'
+
10
;
else
{
m
=
OPENSSL_hexchar2int
(
bufp
[
k
+
n
]);
if
(
m
<
0
)
{
ASN1err
(
ASN1_F_A2I_ASN1_INTEGER
,
ASN1_R_NON_HEX_CHARACTERS
);
goto
err
;
...
...
crypto/asn1/f_string.c
浏览文件 @
49445f21
...
...
@@ -167,14 +167,8 @@ int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size)
}
for
(
j
=
0
;
j
<
i
;
j
++
,
k
+=
2
)
{
for
(
n
=
0
;
n
<
2
;
n
++
)
{
m
=
bufp
[
k
+
n
];
if
((
m
>=
'0'
)
&&
(
m
<=
'9'
))
m
-=
'0'
;
else
if
((
m
>=
'a'
)
&&
(
m
<=
'f'
))
m
=
m
-
'a'
+
10
;
else
if
((
m
>=
'A'
)
&&
(
m
<=
'F'
))
m
=
m
-
'A'
+
10
;
else
{
m
=
OPENSSL_hexchar2int
(
bufp
[
k
+
n
]);
if
(
m
<
0
)
{
ASN1err
(
ASN1_F_A2I_ASN1_STRING
,
ASN1_R_NON_HEX_CHARACTERS
);
return
0
;
...
...
crypto/bn/bn_print.c
浏览文件 @
49445f21
...
...
@@ -215,13 +215,8 @@ int BN_hex2bn(BIGNUM **bn, const char *a)
l
=
0
;
for
(;;)
{
c
=
a
[
j
-
m
];
if
((
c
>=
'0'
)
&&
(
c
<=
'9'
))
k
=
c
-
'0'
;
else
if
((
c
>=
'a'
)
&&
(
c
<=
'f'
))
k
=
c
-
'a'
+
10
;
else
if
((
c
>=
'A'
)
&&
(
c
<=
'F'
))
k
=
c
-
'A'
+
10
;
else
k
=
OPENSSL_hexchar2int
(
c
);
if
(
k
<
0
)
k
=
0
;
/* paranoia */
l
=
(
l
<<
4
)
|
k
;
...
...
crypto/pem/pem_lib.c
浏览文件 @
49445f21
...
...
@@ -558,13 +558,8 @@ static int load_iv(char **fromp, unsigned char *to, int num)
to
[
i
]
=
0
;
num
*=
2
;
for
(
i
=
0
;
i
<
num
;
i
++
)
{
if
((
*
from
>=
'0'
)
&&
(
*
from
<=
'9'
))
v
=
*
from
-
'0'
;
else
if
((
*
from
>=
'A'
)
&&
(
*
from
<=
'F'
))
v
=
*
from
-
'A'
+
10
;
else
if
((
*
from
>=
'a'
)
&&
(
*
from
<=
'f'
))
v
=
*
from
-
'a'
+
10
;
else
{
v
=
OPENSSL_hexchar2int
(
*
from
);
if
(
v
<
0
)
{
PEMerr
(
PEM_F_LOAD_IV
,
PEM_R_BAD_IV_CHARS
);
return
(
0
);
}
...
...
crypto/poly1305/poly1305.c
浏览文件 @
49445f21
...
...
@@ -871,14 +871,11 @@ static const struct poly1305_test poly1305_tests[] = {
static
unsigned
char
hex_digit
(
char
h
)
{
if
(
h
>=
'0'
&&
h
<=
'9'
)
return
h
-
'0'
;
else
if
(
h
>=
'a'
&&
h
<=
'f'
)
return
h
-
'a'
+
10
;
else
if
(
h
>=
'A'
&&
h
<=
'F'
)
return
h
-
'A'
+
10
;
else
int
i
=
OPENSSL_hexchar2int
(
h
);
if
(
i
<
0
)
abort
();
return
i
;
}
static
void
hex_decode
(
unsigned
char
*
out
,
const
char
*
hex
)
...
...
crypto/x509v3/v3_utl.c
浏览文件 @
49445f21
...
...
@@ -1177,19 +1177,17 @@ static int ipv6_hex(unsigned char *out, const char *in, int inlen)
{
unsigned
char
c
;
unsigned
int
num
=
0
;
int
x
;
if
(
inlen
>
4
)
return
0
;
while
(
inlen
--
)
{
c
=
*
in
++
;
num
<<=
4
;
if
((
c
>=
'0'
)
&&
(
c
<=
'9'
))
num
|=
c
-
'0'
;
else
if
((
c
>=
'A'
)
&&
(
c
<=
'F'
))
num
|=
c
-
'A'
+
10
;
else
if
((
c
>=
'a'
)
&&
(
c
<=
'f'
))
num
|=
c
-
'a'
+
10
;
else
x
=
OPENSSL_hexchar2int
(
c
);
if
(
x
<
0
)
return
0
;
num
|=
(
char
)
x
;
}
out
[
0
]
=
num
>>
8
;
out
[
1
]
=
num
&
0xff
;
...
...
test/danetest.c
浏览文件 @
49445f21
...
...
@@ -198,7 +198,7 @@ static STACK_OF(X509) *load_chain(BIO *fp, int nelem)
fprintf
(
stderr
,
"error reading: malformed %s
\n
"
,
errtype
);
goto
err
;
}
if
(
count
==
nelem
)
{
ERR_clear_error
();
return
chain
;
...
...
@@ -252,19 +252,16 @@ static ossl_ssize_t hexdecode(const char *in, void *result)
return
-
1
;
for
(
byte
=
0
;
*
in
;
++
in
)
{
char
c
;
int
x
;
if
(
isspace
(
_UC
(
*
in
)))
continue
;
c
=
tolower
(
_UC
(
*
in
));
if
(
'0'
<=
c
&&
c
<=
'9'
)
{
byte
|=
c
-
'0'
;
}
else
if
(
'a'
<=
c
&&
c
<=
'f'
)
{
byte
|=
c
-
'a'
+
10
;
}
else
{
x
=
OPENSSL_hexchar2int
(
*
in
);
if
(
x
<
0
)
{
OPENSSL_free
(
ret
);
return
0
;
}
byte
|=
(
char
)
x
;
if
((
nibble
^=
1
)
==
0
)
{
*
cp
++
=
byte
;
byte
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录