Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
26c255fc
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看板
提交
26c255fc
编写于
1月 27, 2016
作者:
D
Dr. Stephen Henson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add ASN1_buf_print to print a buffer in ASN1_bn_print format.
Reviewed-by:
N
Viktor Dukhovni
<
viktor@openssl.org
>
上级
d698550f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
38 addition
and
17 deletion
+38
-17
crypto/asn1/t_pkey.c
crypto/asn1/t_pkey.c
+37
-17
include/openssl/asn1.h
include/openssl/asn1.h
+1
-0
未找到文件。
crypto/asn1/t_pkey.c
浏览文件 @
26c255fc
...
...
@@ -61,16 +61,45 @@
#include <openssl/buffer.h>
#include "internal/bn_int.h"
/* Number of octets per line */
#define ASN1_BUF_PRINT_WIDTH 15
/* Maximum indent */
#define ASN1_PRINT_MAX_INDENT 128
int
ASN1_buf_print
(
BIO
*
bp
,
unsigned
char
*
buf
,
size_t
buflen
,
int
indent
)
{
size_t
i
;
for
(
i
=
0
;
i
<
buflen
;
i
++
)
{
if
((
i
%
ASN1_BUF_PRINT_WIDTH
)
==
0
)
{
if
(
i
>
0
&&
BIO_puts
(
bp
,
"
\n
"
)
<=
0
)
return
0
;
if
(
!
BIO_indent
(
bp
,
indent
,
ASN1_PRINT_MAX_INDENT
))
return
0
;
}
/*
* Use colon separators for each octet for compatibility as
* this fuction is used to print out key components.
*/
if
(
BIO_printf
(
bp
,
"%02x%s"
,
buf
[
i
],
(
i
==
buflen
-
1
)
?
""
:
":"
)
<=
0
)
return
0
;
}
if
(
BIO_write
(
bp
,
"
\n
"
,
1
)
<=
0
)
return
0
;
return
1
;
}
int
ASN1_bn_print
(
BIO
*
bp
,
const
char
*
number
,
const
BIGNUM
*
num
,
unsigned
char
*
buf
,
int
off
)
unsigned
char
*
buf
,
int
indent
)
{
int
n
,
i
;
int
n
;
const
char
*
neg
;
if
(
num
==
NULL
)
return
(
1
)
;
return
1
;
neg
=
(
BN_is_negative
(
num
))
?
"-"
:
""
;
if
(
!
BIO_indent
(
bp
,
off
,
128
))
if
(
!
BIO_indent
(
bp
,
indent
,
ASN1_PRINT_MAX_INDENT
))
return
0
;
if
(
BN_is_zero
(
num
))
{
if
(
BIO_printf
(
bp
,
"%s 0
\n
"
,
number
)
<=
0
)
...
...
@@ -85,7 +114,7 @@ int ASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num,
return
(
0
);
}
else
{
buf
[
0
]
=
0
;
if
(
BIO_printf
(
bp
,
"%s%s"
,
number
,
if
(
BIO_printf
(
bp
,
"%s%s
\n
"
,
number
,
(
neg
[
0
]
==
'-'
)
?
" (Negative)"
:
""
)
<=
0
)
return
(
0
);
n
=
BN_bn2bin
(
num
,
&
buf
[
1
]);
...
...
@@ -95,17 +124,8 @@ int ASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num,
else
buf
++
;
for
(
i
=
0
;
i
<
n
;
i
++
)
{
if
((
i
%
15
)
==
0
)
{
if
(
BIO_puts
(
bp
,
"
\n
"
)
<=
0
||
!
BIO_indent
(
bp
,
off
+
4
,
128
))
return
0
;
}
if
(
BIO_printf
(
bp
,
"%02x%s"
,
buf
[
i
],
((
i
+
1
)
==
n
)
?
""
:
":"
)
<=
0
)
return
(
0
);
}
if
(
BIO_write
(
bp
,
"
\n
"
,
1
)
<=
0
)
return
(
0
);
if
(
ASN1_buf_print
(
bp
,
buf
,
n
,
indent
+
4
)
==
0
)
return
0
;
}
return
(
1
)
;
return
1
;
}
include/openssl/asn1.h
浏览文件 @
26c255fc
...
...
@@ -785,6 +785,7 @@ int ASN1_GENERALIZEDTIME_print(BIO *fp, const ASN1_GENERALIZEDTIME *a);
int
ASN1_TIME_print
(
BIO
*
fp
,
const
ASN1_TIME
*
a
);
int
ASN1_STRING_print
(
BIO
*
bp
,
const
ASN1_STRING
*
v
);
int
ASN1_STRING_print_ex
(
BIO
*
out
,
ASN1_STRING
*
str
,
unsigned
long
flags
);
int
ASN1_buf_print
(
BIO
*
bp
,
unsigned
char
*
buf
,
size_t
buflen
,
int
off
);
int
ASN1_bn_print
(
BIO
*
bp
,
const
char
*
number
,
const
BIGNUM
*
num
,
unsigned
char
*
buf
,
int
off
);
int
ASN1_parse
(
BIO
*
bp
,
const
unsigned
char
*
pp
,
long
len
,
int
indent
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录