Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
985a9af8
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
985a9af8
编写于
1月 20, 2015
作者:
A
Andy Polyakov
提交者:
Matt Caswell
1月 22, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
bn/bntest.c: make it indent-friendly.
Reviewed-by:
N
Tim Hudson
<
tjh@openssl.org
>
上级
e95bbc3c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
27 addition
and
25 deletion
+27
-25
crypto/bn/bntest.c
crypto/bn/bntest.c
+27
-25
未找到文件。
crypto/bn/bntest.c
浏览文件 @
985a9af8
...
@@ -315,11 +315,11 @@ int main(int argc, char *argv[])
...
@@ -315,11 +315,11 @@ int main(int argc, char *argv[])
BN_CTX_free
(
ctx
);
BN_CTX_free
(
ctx
);
BIO_free
(
out
);
BIO_free
(
out
);
/**/
EXIT
(
0
);
EXIT
(
0
);
err:
err:
BIO_puts
(
out
,
"1
\n
"
);
/* make sure the Perl script fed by bc notices
BIO_puts
(
out
,
"1
\n
"
);
/* make sure the Perl script fed by bc notices
* the failure, see test_bn in test/Makefile.ssl*/
* the failure, see test_bn in test/Makefile.ssl
*/
(
void
)
BIO_flush
(
out
);
(
void
)
BIO_flush
(
out
);
ERR_load_crypto_strings
();
ERR_load_crypto_strings
();
ERR_print_errors_fp
(
stderr
);
ERR_print_errors_fp
(
stderr
);
...
@@ -729,7 +729,8 @@ int test_sqr(BIO *bp, BN_CTX *ctx)
...
@@ -729,7 +729,8 @@ int test_sqr(BIO *bp, BN_CTX *ctx)
/* Regression test for a BN_sqr overflow bug. */
/* Regression test for a BN_sqr overflow bug. */
BN_hex2bn
(
&
a
,
BN_hex2bn
(
&
a
,
"80000000000000008000000000000001FFFFFFFFFFFFFFFE0000000000000000"
);
"80000000000000008000000000000001"
"FFFFFFFFFFFFFFFE0000000000000000"
);
BN_sqr
(
c
,
a
,
ctx
);
BN_sqr
(
c
,
a
,
ctx
);
if
(
bp
!=
NULL
)
if
(
bp
!=
NULL
)
{
{
...
@@ -753,7 +754,8 @@ int test_sqr(BIO *bp, BN_CTX *ctx)
...
@@ -753,7 +754,8 @@ int test_sqr(BIO *bp, BN_CTX *ctx)
/* Regression test for a BN_sqr overflow bug. */
/* Regression test for a BN_sqr overflow bug. */
BN_hex2bn
(
&
a
,
BN_hex2bn
(
&
a
,
"80000000000000000000000080000001FFFFFFFE000000000000000000000000"
);
"80000000000000000000000080000001"
"FFFFFFFE000000000000000000000000"
);
BN_sqr
(
c
,
a
,
ctx
);
BN_sqr
(
c
,
a
,
ctx
);
if
(
bp
!=
NULL
)
if
(
bp
!=
NULL
)
{
{
...
@@ -802,8 +804,8 @@ int test_mont(BIO *bp, BN_CTX *ctx)
...
@@ -802,8 +804,8 @@ int test_mont(BIO *bp, BN_CTX *ctx)
if
(
mont
==
NULL
)
if
(
mont
==
NULL
)
return
0
;
return
0
;
BN_bntest_rand
(
a
,
100
,
0
,
0
);
/**/
BN_bntest_rand
(
a
,
100
,
0
,
0
);
BN_bntest_rand
(
b
,
100
,
0
,
0
);
/**/
BN_bntest_rand
(
b
,
100
,
0
,
0
);
for
(
i
=
0
;
i
<
num2
;
i
++
)
for
(
i
=
0
;
i
<
num2
;
i
++
)
{
{
int
bits
=
(
200
*
(
i
+
1
))
/
num2
;
int
bits
=
(
200
*
(
i
+
1
))
/
num2
;
...
@@ -819,8 +821,8 @@ int test_mont(BIO *bp, BN_CTX *ctx)
...
@@ -819,8 +821,8 @@ int test_mont(BIO *bp, BN_CTX *ctx)
BN_to_montgomery
(
A
,
a
,
mont
,
ctx
);
BN_to_montgomery
(
A
,
a
,
mont
,
ctx
);
BN_to_montgomery
(
B
,
b
,
mont
,
ctx
);
BN_to_montgomery
(
B
,
b
,
mont
,
ctx
);
BN_mod_mul_montgomery
(
c
,
A
,
B
,
mont
,
ctx
);
/**/
BN_mod_mul_montgomery
(
c
,
A
,
B
,
mont
,
ctx
);
BN_from_montgomery
(
A
,
c
,
mont
,
ctx
);
/**/
BN_from_montgomery
(
A
,
c
,
mont
,
ctx
);
if
(
bp
!=
NULL
)
if
(
bp
!=
NULL
)
{
{
if
(
!
results
)
if
(
!
results
)
...
@@ -829,7 +831,7 @@ int test_mont(BIO *bp, BN_CTX *ctx)
...
@@ -829,7 +831,7 @@ int test_mont(BIO *bp, BN_CTX *ctx)
fprintf
(
stderr
,
"%d * %d %% %d
\n
"
,
fprintf
(
stderr
,
"%d * %d %% %d
\n
"
,
BN_num_bits
(
a
),
BN_num_bits
(
a
),
BN_num_bits
(
b
),
BN_num_bits
(
b
),
BN_num_bits
(
&
mont
->
N
);
BN_num_bits
(
&
mont
->
N
)
)
;
#endif
#endif
BN_print
(
bp
,
a
);
BN_print
(
bp
,
a
);
BIO_puts
(
bp
,
" * "
);
BIO_puts
(
bp
,
" * "
);
...
@@ -871,13 +873,13 @@ int test_mod(BIO *bp, BN_CTX *ctx)
...
@@ -871,13 +873,13 @@ int test_mod(BIO *bp, BN_CTX *ctx)
d
=
BN_new
();
d
=
BN_new
();
e
=
BN_new
();
e
=
BN_new
();
BN_bntest_rand
(
a
,
1024
,
0
,
0
);
/**/
BN_bntest_rand
(
a
,
1024
,
0
,
0
);
for
(
i
=
0
;
i
<
num0
;
i
++
)
for
(
i
=
0
;
i
<
num0
;
i
++
)
{
{
BN_bntest_rand
(
b
,
450
+
i
*
10
,
0
,
0
);
/**/
BN_bntest_rand
(
b
,
450
+
i
*
10
,
0
,
0
);
a
->
neg
=
rand_neg
();
a
->
neg
=
rand_neg
();
b
->
neg
=
rand_neg
();
b
->
neg
=
rand_neg
();
BN_mod
(
c
,
a
,
b
,
ctx
);
/**/
BN_mod
(
c
,
a
,
b
,
ctx
);
if
(
bp
!=
NULL
)
if
(
bp
!=
NULL
)
{
{
if
(
!
results
)
if
(
!
results
)
...
@@ -918,11 +920,11 @@ int test_mod_mul(BIO *bp, BN_CTX *ctx)
...
@@ -918,11 +920,11 @@ int test_mod_mul(BIO *bp, BN_CTX *ctx)
e
=
BN_new
();
e
=
BN_new
();
for
(
j
=
0
;
j
<
3
;
j
++
)
{
for
(
j
=
0
;
j
<
3
;
j
++
)
{
BN_bntest_rand
(
c
,
1024
,
0
,
0
);
/**/
BN_bntest_rand
(
c
,
1024
,
0
,
0
);
for
(
i
=
0
;
i
<
num0
;
i
++
)
for
(
i
=
0
;
i
<
num0
;
i
++
)
{
{
BN_bntest_rand
(
a
,
475
+
i
*
10
,
0
,
0
);
/**/
BN_bntest_rand
(
a
,
475
+
i
*
10
,
0
,
0
);
BN_bntest_rand
(
b
,
425
+
i
*
11
,
0
,
0
);
/**/
BN_bntest_rand
(
b
,
425
+
i
*
11
,
0
,
0
);
a
->
neg
=
rand_neg
();
a
->
neg
=
rand_neg
();
b
->
neg
=
rand_neg
();
b
->
neg
=
rand_neg
();
if
(
!
BN_mod_mul
(
e
,
a
,
b
,
c
,
ctx
))
if
(
!
BN_mod_mul
(
e
,
a
,
b
,
c
,
ctx
))
...
@@ -991,8 +993,8 @@ int test_mod_exp(BIO *bp, BN_CTX *ctx)
...
@@ -991,8 +993,8 @@ int test_mod_exp(BIO *bp, BN_CTX *ctx)
BN_bntest_rand
(
c
,
30
,
0
,
1
);
/* must be odd for montgomery */
BN_bntest_rand
(
c
,
30
,
0
,
1
);
/* must be odd for montgomery */
for
(
i
=
0
;
i
<
num2
;
i
++
)
for
(
i
=
0
;
i
<
num2
;
i
++
)
{
{
BN_bntest_rand
(
a
,
20
+
i
*
5
,
0
,
0
);
/**/
BN_bntest_rand
(
a
,
20
+
i
*
5
,
0
,
0
);
BN_bntest_rand
(
b
,
2
+
i
,
0
,
0
);
/**/
BN_bntest_rand
(
b
,
2
+
i
,
0
,
0
);
if
(
!
BN_mod_exp
(
d
,
a
,
b
,
c
,
ctx
))
if
(
!
BN_mod_exp
(
d
,
a
,
b
,
c
,
ctx
))
return
(
0
);
return
(
0
);
...
@@ -1042,8 +1044,8 @@ int test_mod_exp_mont_consttime(BIO *bp, BN_CTX *ctx)
...
@@ -1042,8 +1044,8 @@ int test_mod_exp_mont_consttime(BIO *bp, BN_CTX *ctx)
BN_bntest_rand
(
c
,
30
,
0
,
1
);
/* must be odd for montgomery */
BN_bntest_rand
(
c
,
30
,
0
,
1
);
/* must be odd for montgomery */
for
(
i
=
0
;
i
<
num2
;
i
++
)
for
(
i
=
0
;
i
<
num2
;
i
++
)
{
{
BN_bntest_rand
(
a
,
20
+
i
*
5
,
0
,
0
);
/**/
BN_bntest_rand
(
a
,
20
+
i
*
5
,
0
,
0
);
BN_bntest_rand
(
b
,
2
+
i
,
0
,
0
);
/**/
BN_bntest_rand
(
b
,
2
+
i
,
0
,
0
);
if
(
!
BN_mod_exp_mont_consttime
(
d
,
a
,
b
,
c
,
ctx
,
NULL
))
if
(
!
BN_mod_exp_mont_consttime
(
d
,
a
,
b
,
c
,
ctx
,
NULL
))
return
(
00
);
return
(
00
);
...
@@ -1167,8 +1169,8 @@ int test_exp(BIO *bp, BN_CTX *ctx)
...
@@ -1167,8 +1169,8 @@ int test_exp(BIO *bp, BN_CTX *ctx)
for
(
i
=
0
;
i
<
num2
;
i
++
)
for
(
i
=
0
;
i
<
num2
;
i
++
)
{
{
BN_bntest_rand
(
a
,
20
+
i
*
5
,
0
,
0
);
/**/
BN_bntest_rand
(
a
,
20
+
i
*
5
,
0
,
0
);
BN_bntest_rand
(
b
,
2
+
i
,
0
,
0
);
/**/
BN_bntest_rand
(
b
,
2
+
i
,
0
,
0
);
if
(
BN_exp
(
d
,
a
,
b
,
ctx
)
<=
0
)
if
(
BN_exp
(
d
,
a
,
b
,
ctx
)
<=
0
)
return
(
0
);
return
(
0
);
...
@@ -2028,7 +2030,7 @@ int test_lshift(BIO *bp,BN_CTX *ctx,BIGNUM *a_)
...
@@ -2028,7 +2030,7 @@ int test_lshift(BIO *bp,BN_CTX *ctx,BIGNUM *a_)
else
else
{
{
a
=
BN_new
();
a
=
BN_new
();
BN_bntest_rand
(
a
,
200
,
0
,
0
);
/**/
BN_bntest_rand
(
a
,
200
,
0
,
0
);
a
->
neg
=
rand_neg
();
a
->
neg
=
rand_neg
();
}
}
for
(
i
=
0
;
i
<
num0
;
i
++
)
for
(
i
=
0
;
i
<
num0
;
i
++
)
...
@@ -2080,7 +2082,7 @@ int test_lshift1(BIO *bp)
...
@@ -2080,7 +2082,7 @@ int test_lshift1(BIO *bp)
b
=
BN_new
();
b
=
BN_new
();
c
=
BN_new
();
c
=
BN_new
();
BN_bntest_rand
(
a
,
200
,
0
,
0
);
/**/
BN_bntest_rand
(
a
,
200
,
0
,
0
);
a
->
neg
=
rand_neg
();
a
->
neg
=
rand_neg
();
for
(
i
=
0
;
i
<
num0
;
i
++
)
for
(
i
=
0
;
i
<
num0
;
i
++
)
{
{
...
@@ -2124,7 +2126,7 @@ int test_rshift(BIO *bp,BN_CTX *ctx)
...
@@ -2124,7 +2126,7 @@ int test_rshift(BIO *bp,BN_CTX *ctx)
e
=
BN_new
();
e
=
BN_new
();
BN_one
(
c
);
BN_one
(
c
);
BN_bntest_rand
(
a
,
200
,
0
,
0
);
/**/
BN_bntest_rand
(
a
,
200
,
0
,
0
);
a
->
neg
=
rand_neg
();
a
->
neg
=
rand_neg
();
for
(
i
=
0
;
i
<
num0
;
i
++
)
for
(
i
=
0
;
i
<
num0
;
i
++
)
{
{
...
@@ -2167,7 +2169,7 @@ int test_rshift1(BIO *bp)
...
@@ -2167,7 +2169,7 @@ int test_rshift1(BIO *bp)
b
=
BN_new
();
b
=
BN_new
();
c
=
BN_new
();
c
=
BN_new
();
BN_bntest_rand
(
a
,
200
,
0
,
0
);
/**/
BN_bntest_rand
(
a
,
200
,
0
,
0
);
a
->
neg
=
rand_neg
();
a
->
neg
=
rand_neg
();
for
(
i
=
0
;
i
<
num0
;
i
++
)
for
(
i
=
0
;
i
<
num0
;
i
++
)
{
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录