Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
fc2e05c2
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,发现更多精彩内容 >>
提交
fc2e05c2
编写于
11月 30, 2000
作者:
B
Bodo Möller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix BN_rshift, which caused lots of trouble.
上级
b2993bde
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
11 addition
and
19 deletion
+11
-19
CHANGES
CHANGES
+3
-0
crypto/bn/bn_mul.c
crypto/bn/bn_mul.c
+1
-1
crypto/bn/bn_shift.c
crypto/bn/bn_shift.c
+5
-0
crypto/bn/bntest.c
crypto/bn/bntest.c
+2
-18
未找到文件。
CHANGES
浏览文件 @
fc2e05c2
...
@@ -3,6 +3,9 @@
...
@@ -3,6 +3,9 @@
Changes between 0.9.6 and 0.9.7 [xx XXX 2000]
Changes between 0.9.6 and 0.9.7 [xx XXX 2000]
*) BN_rshift bugfix for n == 0.
[Bodo Moeller]
*) Reformat the FAQ so the different questions and answers can be divided
*) Reformat the FAQ so the different questions and answers can be divided
i sections depending on the subject.
i sections depending on the subject.
[Richard Levitte]
[Richard Levitte]
...
...
crypto/bn/bn_mul.c
浏览文件 @
fc2e05c2
...
@@ -928,7 +928,7 @@ void bn_mul_high(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, BN_ULONG *l, int n2,
...
@@ -928,7 +928,7 @@ void bn_mul_high(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, BN_ULONG *l, int n2,
}
}
#endif
/* BN_RECURSION */
#endif
/* BN_RECURSION */
int
BN_mul
(
BIGNUM
*
r
,
const
BIGNUM
*
a
,
const
BIGNUM
*
b
,
BN_CTX
*
ctx
)
int
BN_mul
(
BIGNUM
*
r
,
/* almost const */
const
BIGNUM
*
a
,
/* almost const */
const
BIGNUM
*
b
,
BN_CTX
*
ctx
)
{
{
int
top
,
al
,
bl
;
int
top
,
al
,
bl
;
BIGNUM
*
rr
;
BIGNUM
*
rr
;
...
...
crypto/bn/bn_shift.c
浏览文件 @
fc2e05c2
...
@@ -172,6 +172,11 @@ int BN_rshift(BIGNUM *r, const BIGNUM *a, int n)
...
@@ -172,6 +172,11 @@ int BN_rshift(BIGNUM *r, const BIGNUM *a, int n)
r
->
neg
=
a
->
neg
;
r
->
neg
=
a
->
neg
;
if
(
bn_wexpand
(
r
,
a
->
top
-
nw
+
1
)
==
NULL
)
return
(
0
);
if
(
bn_wexpand
(
r
,
a
->
top
-
nw
+
1
)
==
NULL
)
return
(
0
);
}
}
else
{
if
(
n
==
0
)
return
1
;
/* or the copying loop will go berserk */
}
f
=
&
(
a
->
d
[
nw
]);
f
=
&
(
a
->
d
[
nw
]);
t
=
r
->
d
;
t
=
r
->
d
;
...
...
crypto/bn/bntest.c
浏览文件 @
fc2e05c2
...
@@ -165,7 +165,6 @@ int main(int argc, char *argv[])
...
@@ -165,7 +165,6 @@ int main(int argc, char *argv[])
if
(
!
results
)
if
(
!
results
)
BIO_puts
(
out
,
"obase=16
\n
ibase=16
\n
"
);
BIO_puts
(
out
,
"obase=16
\n
ibase=16
\n
"
);
#if 0
message
(
out
,
"BN_add"
);
message
(
out
,
"BN_add"
);
if
(
!
test_add
(
out
))
goto
err
;
if
(
!
test_add
(
out
))
goto
err
;
BIO_flush
(
out
);
BIO_flush
(
out
);
...
@@ -230,7 +229,6 @@ int main(int argc, char *argv[])
...
@@ -230,7 +229,6 @@ int main(int argc, char *argv[])
message
(
out
,
"BN_exp"
);
message
(
out
,
"BN_exp"
);
if
(
!
test_exp
(
out
,
ctx
))
goto
err
;
if
(
!
test_exp
(
out
,
ctx
))
goto
err
;
BIO_flush
(
out
);
BIO_flush
(
out
);
#endif
message
(
out
,
"BN_kronecker"
);
message
(
out
,
"BN_kronecker"
);
if
(
!
test_kron
(
out
,
ctx
))
goto
err
;
if
(
!
test_kron
(
out
,
ctx
))
goto
err
;
...
@@ -946,34 +944,20 @@ int test_kron(BIO *bp, BN_CTX *ctx)
...
@@ -946,34 +944,20 @@ int test_kron(BIO *bp, BN_CTX *ctx)
* don't want to test whether b is prime but whether BN_kronecker
* don't want to test whether b is prime but whether BN_kronecker
* works.) */
* works.) */
#if 0
if
(
!
BN_generate_prime
(
b
,
512
,
0
,
NULL
,
NULL
,
genprime_cb
,
NULL
))
goto
err
;
if
(
!
BN_generate_prime
(
b
,
512
,
0
,
NULL
,
NULL
,
genprime_cb
,
NULL
))
goto
err
;
#else
if
(
!
BN_set_word
(
b
,
65537
))
goto
err
;
#endif
putc
(
'\n'
,
stderr
);
putc
(
'\n'
,
stderr
);
for
(
i
=
0
;
i
<
num0
;
i
++
)
for
(
i
=
0
;
i
<
num0
;
i
++
)
{
{
#if 0
if
(
!
BN_rand
(
a
,
512
,
0
,
0
))
goto
err
;
if
(
!
BN_rand
(
a
,
512
,
0
,
0
))
goto
err
;
a
->
neg
=
rand_neg
();
a
->
neg
=
rand_neg
();
#else
if
(
!
BN_bin2bn
(
"
\x01\xff\xff\xff\xff
"
,
5
,
a
))
goto
err
;
#endif
/* t := (b-1)/2 (note that b is odd) */
/* t := (b-1)/2 (note that b is odd) */
if
(
!
BN_copy
(
t
,
b
))
goto
err
;
if
(
!
BN_copy
(
t
,
b
))
goto
err
;
if
(
!
BN_sub_word
(
t
,
1
))
goto
err
;
if
(
!
BN_sub_word
(
t
,
1
))
goto
err
;
if
(
!
BN_rshift1
(
t
,
t
))
goto
err
;
if
(
!
BN_rshift1
(
t
,
t
))
goto
err
;
/* r := a^t mod b */
/* r := a^t mod b */
#if 0
if
(
!
BN_mod_exp
(
r
,
a
,
t
,
b
,
ctx
))
goto
err
;
if
(
!
BN_mod_exp
(
r
,
a
,
t
,
b
,
ctx
))
goto
err
;
#elif
0
if
(
!
BN_mod_exp_recp
(
r
,
a
,
t
,
b
,
ctx
))
goto
err
;
#else
if
(
!
BN_mod_exp_simple
(
r
,
a
,
t
,
b
,
ctx
))
goto
err
;
#endif
if
(
BN_is_word
(
r
,
1
))
if
(
BN_is_word
(
r
,
1
))
legendre
=
1
;
legendre
=
1
;
...
@@ -997,7 +981,7 @@ int test_kron(BIO *bp, BN_CTX *ctx)
...
@@ -997,7 +981,7 @@ int test_kron(BIO *bp, BN_CTX *ctx)
{
{
fprintf
(
stderr
,
"legendre != kronecker; a = "
);
fprintf
(
stderr
,
"legendre != kronecker; a = "
);
BN_print_fp
(
stderr
,
a
);
BN_print_fp
(
stderr
,
a
);
fprintf
(
stderr
,
",
a
= "
);
fprintf
(
stderr
,
",
b
= "
);
BN_print_fp
(
stderr
,
b
);
BN_print_fp
(
stderr
,
b
);
fprintf
(
stderr
,
"
\n
"
);
fprintf
(
stderr
,
"
\n
"
);
goto
err
;
goto
err
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录