Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
9c940446
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看板
提交
9c940446
编写于
7月 10, 2016
作者:
A
Andy Polyakov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
crypto/x86[_64]cpuid.pl: add OPENSSL_ia32_rd[rand|seed]_bytes.
Reviewed-by:
N
Richard Levitte
<
levitte@openssl.org
>
上级
b1837abd
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
98 addition
and
32 deletion
+98
-32
crypto/perlasm/x86_64-xlate.pl
crypto/perlasm/x86_64-xlate.pl
+2
-2
crypto/x86_64cpuid.pl
crypto/x86_64cpuid.pl
+52
-21
crypto/x86cpuid.pl
crypto/x86cpuid.pl
+44
-9
未找到文件。
crypto/perlasm/x86_64-xlate.pl
浏览文件 @
9c940446
...
...
@@ -805,7 +805,7 @@ my $rdrand = sub {
my
@opcode
=
();
my
$dst
=
$
1
;
if
(
$dst
!~
/[0-9]+/
)
{
$dst
=
$regrm
{"
%e
$dst
"};
}
rex
(
\
@opcode
,
0
,
$
1
,
8
);
rex
(
\
@opcode
,
0
,
$
dst
,
8
);
push
@opcode
,
0x0f
,
0xc7
,
0xf0
|
(
$dst
&
7
);
@opcode
;
}
else
{
...
...
@@ -818,7 +818,7 @@ my $rdseed = sub {
my
@opcode
=
();
my
$dst
=
$
1
;
if
(
$dst
!~
/[0-9]+/
)
{
$dst
=
$regrm
{"
%e
$dst
"};
}
rex
(
\
@opcode
,
0
,
$
1
,
8
);
rex
(
\
@opcode
,
0
,
$
dst
,
8
);
push
@opcode
,
0x0f
,
0xc7
,
0xf8
|
(
$dst
&
7
);
@opcode
;
}
else
{
...
...
crypto/x86_64cpuid.pl
浏览文件 @
9c940446
...
...
@@ -393,36 +393,67 @@ OPENSSL_instrument_bus2:
___
}
sub
gen_random
{
my
$rdop
=
shift
;
print
<<___;
.globl OPENSSL_ia32_
rdrand
.type OPENSSL_ia32_
rdrand
,\@abi-omnipotent
.globl OPENSSL_ia32_
${rdop}
.type OPENSSL_ia32_
${rdop}
,\@abi-omnipotent
.align 16
OPENSSL_ia32_
rdrand
:
OPENSSL_ia32_
${rdop}
:
mov \$8,%ecx
.Loop_
rdrand
:
rdrand
%rax
jc .Lbreak_
rdrand
loop .Loop_
rdrand
.Lbreak_
rdrand
:
.Loop_
${rdop}
:
${rdop}
%rax
jc .Lbreak_
${rdop}
loop .Loop_
${rdop}
.Lbreak_
${rdop}
:
cmp \$0,%rax
cmove %rcx,%rax
ret
.size OPENSSL_ia32_
rdrand,.-OPENSSL_ia32_rdrand
.size OPENSSL_ia32_
${rdop},.-OPENSSL_ia32_${rdop}
.globl OPENSSL_ia32_
rdseed
.type OPENSSL_ia32_
rdseed
,\@abi-omnipotent
.globl OPENSSL_ia32_
${rdop}_bytes
.type OPENSSL_ia32_
${rdop}_bytes
,\@abi-omnipotent
.align 16
OPENSSL_ia32_rdseed:
mov \$8,%ecx
.Loop_rdseed:
rdseed %rax
jc .Lbreak_rdseed
loop .Loop_rdseed
.Lbreak_rdseed:
cmp \$0,%rax
cmove %rcx,%rax
OPENSSL_ia32_${rdop}_bytes:
xor %rax, %rax # return value
cmp \$0,$arg2
je .Ldone_${rdop}_bytes
mov \$8,%r11
.Loop_${rdop}_bytes:
${rdop} %r10
jc .Lbreak_${rdop}_bytes
dec %r11
jnz .Loop_${rdop}_bytes
jmp .Ldone_${rdop}_bytes
.align 16
.Lbreak_${rdop}_bytes:
cmp \$8,$arg2
jb .Ltail_${rdop}_bytes
mov %r10,($arg1)
lea 8($arg1),$arg1
add \$8,%rax
sub \$8,$arg2
jz .Ldone_${rdop}_bytes
mov \$8,%r11
jmp .Loop_${rdop}_bytes
.align 16
.Ltail_${rdop}_bytes:
mov %r10b,($arg1)
lea 1($arg1),$arg1
inc %rax
shr \$8,%r8
dec $arg2
jnz .Ltail_${rdop}_bytes
.Ldone_${rdop}_bytes:
ret
.size OPENSSL_ia32_
rdseed,.-OPENSSL_ia32_rdseed
.size OPENSSL_ia32_
${rdop}_bytes,.-OPENSSL_ia32_${rdop}_bytes
___
}
gen_random
("
rdrand
");
gen_random
("
rdseed
");
close
STDOUT
;
# flush
crypto/x86cpuid.pl
浏览文件 @
9c940446
...
...
@@ -492,29 +492,64 @@ my $max = "ebp";
&function_end
("
OPENSSL_instrument_bus2
");
}
&function_begin_B
("
OPENSSL_ia32_rdrand
");
sub
gen_random
{
my
$rdop
=
shift
;
&function_begin_B
("
OPENSSL_ia32_
${rdop}
");
&mov
("
ecx
",
8
);
&set_label
("
loop
");
&
rdrand
("
eax
");
&
$
{
rdop
}
("
eax
");
&jc
(
&label
("
break
"));
&loop
(
&label
("
loop
"));
&set_label
("
break
");
&cmp
("
eax
",
0
);
&cmove
("
eax
","
ecx
");
&ret
();
&function_end_B
("
OPENSSL_ia32_rdrand
");
&function_end_B
("
OPENSSL_ia32_
${rdop}
");
&function_begin_B
("
OPENSSL_ia32_
${rdop}
_bytes
");
&push
("
edi
");
&push
("
ebx
");
&xor
("
eax
","
eax
");
# return value
&mov
("
edi
",
&wparam
(
0
));
&mov
("
ebx
",
&wparam
(
1
));
&cmp
("
ebx
",
0
);
&je
(
&label
("
done
"));
&function_begin_B
("
OPENSSL_ia32_rdseed
");
&mov
("
ecx
",
8
);
&set_label
("
loop
");
&
rdseed
("
ea
x
");
&
$
{
rdop
}("
ed
x
");
&jc
(
&label
("
break
"));
&loop
(
&label
("
loop
"));
&set_label
("
break
");
&cmp
("
eax
",
0
);
&cmove
("
eax
","
ecx
");
&jmp
(
&label
("
done
"));
&set_label
("
break
",
16
);
&cmp
("
ebx
",
4
);
&jb
(
&label
("
tail
"));
&mov
(
&DWP
(
0
,"
edi
"),"
edx
");
&lea
("
edi
",
&DWP
(
4
,"
edi
"));
&add
("
eax
",
4
);
&sub
("
ebx
",
4
);
&jz
(
&label
("
done
"));
&mov
("
ecx
",
8
);
&jmp
(
&label
("
loop
"));
&set_label
("
tail
",
16
);
&mov
(
&BP
(
0
,"
edi
"),"
dl
");
&lea
("
edi
",
&DWP
(
1
,"
edi
"));
&inc
("
eax
");
&shr
("
edx
",
8
);
&dec
("
ebx
");
&jnz
(
&label
("
tail
"));
&set_label
("
done
");
&pop
("
ebx
");
&pop
("
edi
");
&ret
();
&function_end_B
("
OPENSSL_ia32_rdseed
");
&function_end_B
("
OPENSSL_ia32_
${rdop}
_bytes
");
}
&gen_random
("
rdrand
");
&gen_random
("
rdseed
");
&initseg
("
OPENSSL_cpuid_setup
");
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录