Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
240f5169
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看板
提交
240f5169
编写于
12月 06, 2000
作者:
U
Ulf Möller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Intel assembler version for bn_sub_part_words(). I haven't got
reliable timings yet, please try it out!
上级
ef8f14a8
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
215 addition
and
2 deletion
+215
-2
crypto/bn/asm/bn-586.pl
crypto/bn/asm/bn-586.pl
+213
-2
crypto/bn/bn_mul.c
crypto/bn/bn_mul.c
+2
-0
未找到文件。
crypto/bn/asm/bn-586.pl
浏览文件 @
240f5169
...
...
@@ -11,6 +11,7 @@ require "x86asm.pl";
&bn_div_words
("
bn_div_words
");
&bn_add_words
("
bn_add_words
");
&bn_sub_words
("
bn_sub_words
");
&bn_sub_part_words
("
bn_sub_part_words
");
&asm_finish
();
...
...
@@ -300,7 +301,7 @@ sub bn_add_words
&add
(
$tmp1
,
$tmp2
);
&adc
(
$c
,
0
);
&dec
(
$num
)
if
(
$i
!=
6
);
&mov
(
&DWP
(
$i
*
4
,
$r
,"",
0
),
$tmp1
);
# *
a
&mov
(
&DWP
(
$i
*
4
,
$r
,"",
0
),
$tmp1
);
# *
r
&jz
(
&label
("
aw_end
"))
if
(
$i
!=
6
);
}
&set_label
("
aw_end
",
0
);
...
...
@@ -372,7 +373,7 @@ sub bn_sub_words
&sub
(
$tmp1
,
$tmp2
);
&adc
(
$c
,
0
);
&dec
(
$num
)
if
(
$i
!=
6
);
&mov
(
&DWP
(
$i
*
4
,
$r
,"",
0
),
$tmp1
);
# *
a
&mov
(
&DWP
(
$i
*
4
,
$r
,"",
0
),
$tmp1
);
# *
r
&jz
(
&label
("
aw_end
"))
if
(
$i
!=
6
);
}
&set_label
("
aw_end
",
0
);
...
...
@@ -382,3 +383,213 @@ sub bn_sub_words
&function_end
(
$name
);
}
sub
bn_sub_part_words
{
local
(
$name
)
=
@_
;
&function_begin
(
$name
,"");
&comment
("");
$a
=
"
esi
";
$b
=
"
edi
";
$c
=
"
eax
";
$r
=
"
ebx
";
$tmp1
=
"
ecx
";
$tmp2
=
"
edx
";
$num
=
"
ebp
";
&mov
(
$r
,
&wparam
(
0
));
# get r
&mov
(
$a
,
&wparam
(
1
));
# get a
&mov
(
$b
,
&wparam
(
2
));
# get b
&mov
(
$num
,
&wparam
(
3
));
# get num
&xor
(
$c
,
$c
);
# clear carry
&and
(
$num
,
0xfffffff8
);
# num / 8
&jz
(
&label
("
aw_finish
"));
&set_label
("
aw_loop
",
0
);
for
(
$i
=
0
;
$i
<
8
;
$i
++
)
{
&comment
("
Round
$i
");
&mov
(
$tmp1
,
&DWP
(
$i
*
4
,
$a
,"",
0
));
# *a
&mov
(
$tmp2
,
&DWP
(
$i
*
4
,
$b
,"",
0
));
# *b
&sub
(
$tmp1
,
$c
);
&mov
(
$c
,
0
);
&adc
(
$c
,
$c
);
&sub
(
$tmp1
,
$tmp2
);
&adc
(
$c
,
0
);
&mov
(
&DWP
(
$i
*
4
,
$r
,"",
0
),
$tmp1
);
# *r
}
&comment
("");
&add
(
$a
,
32
);
&add
(
$b
,
32
);
&add
(
$r
,
32
);
&sub
(
$num
,
8
);
&jnz
(
&label
("
aw_loop
"));
&set_label
("
aw_finish
",
0
);
&mov
(
$num
,
&wparam
(
3
));
# get num
&and
(
$num
,
7
);
&jz
(
&label
("
aw_end
"));
for
(
$i
=
0
;
$i
<
7
;
$i
++
)
{
&comment
("
Tail Round
$i
");
&mov
(
$tmp1
,
&DWP
(
0
,
$a
,"",
0
));
# *a
&mov
(
$tmp2
,
&DWP
(
0
,
$b
,"",
0
));
# *b
&sub
(
$tmp1
,
$c
);
&mov
(
$c
,
0
);
&adc
(
$c
,
$c
);
&sub
(
$tmp1
,
$tmp2
);
&adc
(
$c
,
0
);
&mov
(
&DWP
(
0
,
$r
,"",
0
),
$tmp1
);
# *r
&add
(
$a
,
4
);
&add
(
$b
,
4
);
&add
(
$r
,
4
);
&dec
(
$num
)
if
(
$i
!=
6
);
&jz
(
&label
("
aw_end
"))
if
(
$i
!=
6
);
}
&set_label
("
aw_end
",
0
);
&cmp
(
&wparam
(
4
),
0
);
&je
(
&label
("
pw_end
"));
&mov
(
$num
,
&wparam
(
3
));
# get num
&mov
(
$num
,
&wparam
(
4
));
# get dl
&cmp
(
$num
,
0
);
&je
(
&label
("
pw_end
"));
# unnoetig
&jge
(
&label
("
pw_pos
"));
&comment
("
pw_neg
");
&mov
(
$tmp2
,
0
);
&sub
(
$tmp2
,
$num
);
&mov
(
$num
,
$tmp2
);
&and
(
$num
,
0xfffffff8
);
# num / 8
&jz
(
&label
("
pw_neg_finish
"));
&set_label
("
pw_neg_loop
",
0
);
for
(
$i
=
0
;
$i
<
8
;
$i
++
)
{
&comment
("
dl<0 Round
$i
");
&mov
(
$tmp1
,
0
);
&mov
(
$tmp2
,
&DWP
(
$i
*
4
,
$b
,"",
0
));
# *b
&sub
(
$tmp1
,
$c
);
&mov
(
$c
,
0
);
&adc
(
$c
,
$c
);
&sub
(
$tmp1
,
$tmp2
);
&adc
(
$c
,
0
);
&mov
(
&DWP
(
$i
*
4
,
$r
,"",
0
),
$tmp1
);
# *r
}
&comment
("");
&add
(
$b
,
32
);
&add
(
$r
,
32
);
&sub
(
$num
,
8
);
&jnz
(
&label
("
pw_neg_loop
"));
&set_label
("
pw_neg_finish
",
0
);
&mov
(
$tmp2
,
&wparam
(
4
));
# get dl
&mov
(
$num
,
0
);
&sub
(
$num
,
$tmp2
);
&and
(
$num
,
7
);
&jz
(
&label
("
pw_end
"));
for
(
$i
=
0
;
$i
<
7
;
$i
++
)
{
&comment
("
dl<0 Tail Round
$i
");
&mov
(
$tmp1
,
0
);
&mov
(
$tmp2
,
&DWP
(
$i
*
4
,
$b
,"",
0
));
# *b
&sub
(
$tmp1
,
$c
);
&mov
(
$c
,
0
);
&adc
(
$c
,
$c
);
&sub
(
$tmp1
,
$tmp2
);
&adc
(
$c
,
0
);
&dec
(
$num
)
if
(
$i
!=
6
);
&mov
(
&DWP
(
$i
*
4
,
$r
,"",
0
),
$tmp1
);
# *r
&jz
(
&label
("
pw_end
"))
if
(
$i
!=
6
);
}
&jmp
(
&label
("
pw_end
"));
&set_label
("
pw_pos
",
0
);
&and
(
$num
,
0xfffffff8
);
# num / 8
&jz
(
&label
("
pw_pos_finish
"));
&set_label
("
pw_pos_loop
",
0
);
for
(
$i
=
0
;
$i
<
8
;
$i
++
)
{
&comment
("
dl>0 Round
$i
");
&mov
(
$tmp1
,
&DWP
(
$i
*
4
,
$a
,"",
0
));
# *a
&sub
(
$tmp1
,
$c
);
&mov
(
&DWP
(
$i
*
4
,
$r
,"",
0
),
$tmp1
);
# *r
&jnc
(
&label
("
pw_nc
"
.
$i
));
}
&comment
("");
&add
(
$a
,
32
);
&add
(
$r
,
32
);
&sub
(
$num
,
8
);
&jnz
(
&label
("
pw_pos_loop
"));
&set_label
("
pw_pos_finish
",
0
);
&mov
(
$num
,
&wparam
(
4
));
# get dl
&and
(
$num
,
7
);
&jz
(
&label
("
pw_end
"));
for
(
$i
=
0
;
$i
<
7
;
$i
++
)
{
&comment
("
dl>0 Tail Round
$i
");
&mov
(
$tmp1
,
&DWP
(
$i
*
4
,
$a
,"",
0
));
# *a
&sub
(
$tmp1
,
$c
);
&mov
(
&DWP
(
$i
*
4
,
$r
,"",
0
),
$tmp1
);
# *r
&jnc
(
&label
("
pw_tail_nc
"
.
$i
));
&dec
(
$num
)
if
(
$i
!=
6
);
&jz
(
&label
("
pw_end
"))
if
(
$i
!=
6
);
}
&mov
(
$c
,
1
);
&jmp
(
&label
("
pw_end
"));
&set_label
("
pw_nc_loop
",
0
);
for
(
$i
=
0
;
$i
<
8
;
$i
++
)
{
&mov
(
$tmp1
,
&DWP
(
$i
*
4
,
$a
,"",
0
));
# *a
&mov
(
&DWP
(
$i
*
4
,
$r
,"",
0
),
$tmp1
);
# *r
&set_label
("
pw_nc
"
.
$i
,
0
);
}
&comment
("");
&add
(
$a
,
32
);
&add
(
$r
,
32
);
&sub
(
$num
,
8
);
&jnz
(
&label
("
pw_nc_loop
"));
&mov
(
$num
,
&wparam
(
4
));
# get dl
&and
(
$num
,
7
);
&jz
(
&label
("
pw_nc_end
"));
for
(
$i
=
0
;
$i
<
7
;
$i
++
)
{
&mov
(
$tmp1
,
&DWP
(
$i
*
4
,
$a
,"",
0
));
# *a
&mov
(
&DWP
(
$i
*
4
,
$r
,"",
0
),
$tmp1
);
# *r
&set_label
("
pw_tail_nc
"
.
$i
,
0
);
&dec
(
$num
)
if
(
$i
!=
6
);
&jz
(
&label
("
pw_nc_end
"))
if
(
$i
!=
6
);
}
&set_label
("
pw_nc_end
",
0
);
&mov
(
$c
,
0
);
&set_label
("
pw_end
",
0
);
# &mov("eax",$c); # $c is "eax"
&function_end
(
$name
);
}
crypto/bn/bn_mul.c
浏览文件 @
240f5169
...
...
@@ -66,6 +66,7 @@
#include "cryptlib.h"
#include "bn_lcl.h"
#if defined(NO_ASM) || !defined(i386)
/* Here follows specialised variants of bn_add_words() and
bn_sub_words(). They have the property performing operations on
arrays of different sizes. The sizes of those arrays is expressed through
...
...
@@ -201,6 +202,7 @@ BN_ULONG bn_sub_part_words(BN_ULONG *r,
}
return
c
;
}
#endif
BN_ULONG
bn_add_part_words
(
BN_ULONG
*
r
,
const
BN_ULONG
*
a
,
const
BN_ULONG
*
b
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录