Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
f1fbd4c7
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看板
提交
f1fbd4c7
编写于
11月 06, 2005
作者:
A
Andy Polyakov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Address MASM-specific problems introduced with
http://cvs.openssl.org/chngview?cn=14547
.
上级
eed22ac4
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
13 addition
and
238 deletion
+13
-238
crypto/des/asm/crypt586.pl
crypto/des/asm/crypt586.pl
+1
-1
crypto/des/asm/des-586.pl
crypto/des/asm/des-586.pl
+1
-2
crypto/des/asm/des686.pl
crypto/des/asm/des686.pl
+0
-230
crypto/perlasm/x86ms.pl
crypto/perlasm/x86ms.pl
+11
-5
未找到文件。
crypto/des/asm/crypt586.pl
浏览文件 @
f1fbd4c7
...
...
@@ -22,7 +22,7 @@ sub fcrypt_body
{
local
(
$name
,
$do_ip
)
=
@_
;
&function_begin
(
$name
,"
EXTRN _DES_SPtrans:DWORD
"
);
&function_begin
(
$name
);
&comment
("");
&comment
("
Load the 2 words
");
...
...
crypto/des/asm/des-586.pl
浏览文件 @
f1fbd4c7
...
...
@@ -23,7 +23,6 @@ $small_footprint=1 if (grep(/\-DOPENSSL_SMALL_FOOTPRINT/,@ARGV));
# one can discuss setting this variable to 1 unconditionally, as
# the folded loop is only 3% slower than unrolled, but >7 times smaller
&external_label
("
DES_SPtrans
");
&DES_encrypt_internal
();
&DES_decrypt_internal
();
&DES_encrypt
("
DES_encrypt1
",
1
);
...
...
@@ -114,7 +113,7 @@ sub DES_encrypt
{
local
(
$name
,
$do_ip
)
=
@_
;
&function_begin_B
(
$name
,"
EXTRN _DES_SPtrans:DWORD
"
);
&function_begin_B
(
$name
);
&push
("
esi
");
&push
("
edi
");
...
...
crypto/des/asm/des686.pl
已删除
100644 → 0
浏览文件 @
eed22ac4
#!/usr/local/bin/perl
$prog
=
"
des686.pl
";
# base code is in microsft
# op dest, source
# format.
#
# WILL NOT WORK ANYMORE WITH desboth.pl
require
"
desboth.pl
";
if
(
(
$ARGV
[
0
]
eq
"
elf
"))
{
require
"
x86unix.pl
";
}
elsif
(
(
$ARGV
[
0
]
eq
"
a.out
"))
{
$aout
=
1
;
require
"
x86unix.pl
";
}
elsif
(
(
$ARGV
[
0
]
eq
"
sol
"))
{
$sol
=
1
;
require
"
x86unix.pl
";
}
elsif
(
(
$ARGV
[
0
]
eq
"
cpp
"))
{
$cpp
=
1
;
require
"
x86unix.pl
";
}
elsif
(
(
$ARGV
[
0
]
eq
"
win32
"))
{
require
"
x86ms.pl
";
}
else
{
print
STDERR
<<"EOF";
Pick one target type from
elf - linux, FreeBSD etc
a.out - old linux
sol - x86 solaris
cpp - format so x86unix.cpp can be used
win32 - Windows 95/Windows NT
EOF
exit
(
1
);
}
&comment
("
Don't even think of reading this code
");
&comment
("
It was automatically generated by
$prog
");
&comment
("
Which is a perl program used to generate the x86 assember for
");
&comment
("
any of elf, a.out, Win32, or Solaris
");
&comment
("
It can be found in SSLeay 0.6.5+ or in libdes 3.26+
");
&comment
("
eric <eay
\@
cryptsoft.com>
");
&comment
("");
&file
("
dx86xxxx
");
$L
=
"
edi
";
$R
=
"
esi
";
&DES_encrypt
("
DES_encrypt1
",
1
);
&DES_encrypt
("
DES_encrypt2
",
0
);
&DES_encrypt3
("
DES_encrypt3
",
1
);
&DES_encrypt3
("
DES_decrypt3
",
0
);
&file_end
();
sub
DES_encrypt
{
local
(
$name
,
$do_ip
)
=
@_
;
&function_begin
(
$name
,"
EXTRN _DES_SPtrans:DWORD
");
&comment
("");
&comment
("
Load the 2 words
");
&mov
("
eax
",
&wparam
(
0
));
&mov
(
$L
,
&DWP
(
0
,"
eax
","",
0
));
&mov
(
$R
,
&DWP
(
4
,"
eax
","",
0
));
$ksp
=
&wparam
(
1
);
if
(
$do_ip
)
{
&comment
("");
&comment
("
IP
");
&IP_new
(
$L
,
$R
,"
eax
");
}
&comment
("");
&comment
("
fixup rotate
");
&rotl
(
$R
,
3
);
&rotl
(
$L
,
3
);
&exch
(
$L
,
$R
);
&comment
("");
&comment
("
load counter, key_schedule and enc flag
");
&mov
("
eax
",
&wparam
(
2
));
# get encrypt flag
&mov
("
ebp
",
&wparam
(
1
));
# get ks
&cmp
("
eax
","
0
");
&je
(
&label
("
start_decrypt
"));
# encrypting part
for
(
$i
=
0
;
$i
<
16
;
$i
+=
2
)
{
&comment
("");
&comment
("
Round
$i
");
&D_ENCRYPT
(
$L
,
$R
,
$i
*
2
,"
ebp
","
DES_SPtrans
","
ecx
","
edx
","
eax
","
ebx
");
&comment
("");
&comment
("
Round
"
.
sprintf
("
%d
",
$i
+
1
));
&D_ENCRYPT
(
$R
,
$L
,(
$i
+
1
)
*
2
,"
ebp
","
DES_SPtrans
","
ecx
","
edx
","
eax
","
ebx
");
}
&jmp
(
&label
("
end
"));
&set_label
("
start_decrypt
");
for
(
$i
=
15
;
$i
>
0
;
$i
-=
2
)
{
&comment
("");
&comment
("
Round
$i
");
&D_ENCRYPT
(
$L
,
$R
,
$i
*
2
,"
ebp
","
DES_SPtrans
","
ecx
","
edx
","
eax
","
ebx
");
&comment
("");
&comment
("
Round
"
.
sprintf
("
%d
",
$i
-
1
));
&D_ENCRYPT
(
$R
,
$L
,(
$i
-
1
)
*
2
,"
ebp
","
DES_SPtrans
","
ecx
","
edx
","
eax
","
ebx
");
}
&set_label
("
end
");
&comment
("");
&comment
("
Fixup
");
&rotr
(
$L
,
3
);
# r
&rotr
(
$R
,
3
);
# l
if
(
$do_ip
)
{
&comment
("");
&comment
("
FP
");
&FP_new
(
$R
,
$L
,"
eax
");
}
&mov
("
eax
",
&wparam
(
0
));
&mov
(
&DWP
(
0
,"
eax
","",
0
),
$L
);
&mov
(
&DWP
(
4
,"
eax
","",
0
),
$R
);
&function_end
(
$name
);
}
# The logic is to load R into 2 registers and operate on both at the same time.
# We also load the 2 R's into 2 more registers so we can do the 'move word down a byte'
# while also masking the other copy and doing a lookup. We then also accumulate the
# L value in 2 registers then combine them at the end.
sub
D_ENCRYPT
{
local
(
$L
,
$R
,
$S
,
$ks
,
$desSP
,
$u
,
$t
,
$tmp1
,
$tmp2
,
$tmp3
)
=
@_
;
&mov
(
$u
,
&DWP
(
&n2a
(
$S
*
4
),
$ks
,"",
0
));
&mov
(
$t
,
&DWP
(
&n2a
((
$S
+
1
)
*
4
),
$ks
,"",
0
));
&xor
(
$u
,
$R
);
&xor
(
$t
,
$R
);
&rotr
(
$t
,
4
);
# the numbers at the end of the line are origional instruction order
&mov
(
$tmp2
,
$u
);
# 1 2
&mov
(
$tmp1
,
$t
);
# 1 1
&and
(
$tmp2
,
"
0xfc
"
);
# 1 4
&and
(
$tmp1
,
"
0xfc
"
);
# 1 3
&shr
(
$t
,
8
);
# 1 5
&xor
(
$L
,
&DWP
("
0x100+
$desSP
",
$tmp1
,"",
0
));
# 1 7
&shr
(
$u
,
8
);
# 1 6
&mov
(
$tmp1
,
&DWP
("
$desSP
",
$tmp2
,"",
0
));
# 1 8
&mov
(
$tmp2
,
$u
);
# 2 2
&xor
(
$L
,
$tmp1
);
# 1 9
&and
(
$tmp2
,
"
0xfc
"
);
# 2 4
&mov
(
$tmp1
,
$t
);
# 2 1
&and
(
$tmp1
,
"
0xfc
"
);
# 2 3
&shr
(
$t
,
8
);
# 2 5
&xor
(
$L
,
&DWP
("
0x300+
$desSP
",
$tmp1
,"",
0
));
# 2 7
&shr
(
$u
,
8
);
# 2 6
&mov
(
$tmp1
,
&DWP
("
0x200+
$desSP
",
$tmp2
,"",
0
));
# 2 8
&mov
(
$tmp2
,
$u
);
# 3 2
&xor
(
$L
,
$tmp1
);
# 2 9
&and
(
$tmp2
,
"
0xfc
"
);
# 3 4
&mov
(
$tmp1
,
$t
);
# 3 1
&shr
(
$u
,
8
);
# 3 6
&and
(
$tmp1
,
"
0xfc
"
);
# 3 3
&shr
(
$t
,
8
);
# 3 5
&xor
(
$L
,
&DWP
("
0x500+
$desSP
",
$tmp1
,"",
0
));
# 3 7
&mov
(
$tmp1
,
&DWP
("
0x400+
$desSP
",
$tmp2
,"",
0
));
# 3 8
&and
(
$t
,
"
0xfc
"
);
# 4 1
&xor
(
$L
,
$tmp1
);
# 3 9
&and
(
$u
,
"
0xfc
"
);
# 4 2
&xor
(
$L
,
&DWP
("
0x700+
$desSP
",
$t
,"",
0
));
# 4 3
&xor
(
$L
,
&DWP
("
0x600+
$desSP
",
$u
,"",
0
));
# 4 4
}
sub
PERM_OP
{
local
(
$a
,
$b
,
$tt
,
$shift
,
$mask
)
=
@_
;
&mov
(
$tt
,
$a
);
&shr
(
$tt
,
$shift
);
&xor
(
$tt
,
$b
);
&and
(
$tt
,
$mask
);
&xor
(
$b
,
$tt
);
&shl
(
$tt
,
$shift
);
&xor
(
$a
,
$tt
);
}
sub
IP_new
{
local
(
$l
,
$r
,
$tt
)
=
@_
;
&PERM_OP
(
$r
,
$l
,
$tt
,
4
,"
0x0f0f0f0f
");
&PERM_OP
(
$l
,
$r
,
$tt
,
16
,"
0x0000ffff
");
&PERM_OP
(
$r
,
$l
,
$tt
,
2
,"
0x33333333
");
&PERM_OP
(
$l
,
$r
,
$tt
,
8
,"
0x00ff00ff
");
&PERM_OP
(
$r
,
$l
,
$tt
,
1
,"
0x55555555
");
}
sub
FP_new
{
local
(
$l
,
$r
,
$tt
)
=
@_
;
&PERM_OP
(
$l
,
$r
,
$tt
,
1
,"
0x55555555
");
&PERM_OP
(
$r
,
$l
,
$tt
,
8
,"
0x00ff00ff
");
&PERM_OP
(
$l
,
$r
,
$tt
,
2
,"
0x33333333
");
&PERM_OP
(
$r
,
$l
,
$tt
,
16
,"
0x0000ffff
");
&PERM_OP
(
$l
,
$r
,
$tt
,
4
,"
0x0f0f0f0f
");
}
sub
n2a
{
sprintf
("
%d
",
$_
[
0
]);
}
crypto/perlasm/x86ms.pl
浏览文件 @
f1fbd4c7
...
...
@@ -28,6 +28,13 @@ sub main'asm_init_output { @out=(); }
sub
main
'asm_get_output {
return
(
@out
);
}
sub
main
'get_labels {
return
(
@labels
);
}
sub
main
'external_label {
push
(
@labels
,
@
_
);
}
sub
main
'
external_label
{
push
(
@labels
,
@
_
);
foreach
(
@
_
)
{
push
(
@out
,
"
EXTRN
\t
_
$_
:DWORD
\n
");
}
}
sub
main
'
LB
{
...
...
@@ -246,7 +253,9 @@ sub main'file
local
(
$tmp
)
=
<<"EOF";
TITLE $file.asm
.386
.model FLAT
.model FLAT
_TEXT\$ SEGMENT PAGE 'CODE'
EOF
push
(
@out
,
$tmp
);
}
...
...
@@ -258,7 +267,6 @@ sub main'function_begin
push
(
@labels
,
$func
);
local
(
$tmp
)
=
<<"EOF";
_TEXT\$ SEGMENT PAGE 'CODE'
PUBLIC _$func
$extra
_$func PROC NEAR
...
...
@@ -276,7 +284,6 @@ sub main'function_begin_B
local
(
$func
,
$extra
)
=
@_
;
local
(
$tmp
)
=
<<"EOF";
_TEXT\$ SEGMENT PAGE 'CODE'
PUBLIC _$func
$extra
_$func PROC NEAR
...
...
@@ -296,7 +303,6 @@ sub main'function_end
pop ebp
ret
_$func ENDP
_TEXT\$ ENDS
EOF
push
(
@out
,
$tmp
);
$stack
=
0
;
...
...
@@ -309,7 +315,6 @@ sub main'function_end_B
local
(
$tmp
)
=
<<"EOF";
_$func ENDP
_TEXT\$ ENDS
EOF
push
(
@out
,
$tmp
);
$stack
=
0
;
...
...
@@ -339,6 +344,7 @@ sub main'file_end
elsif
(
grep
{
/mm[0-7]\s*,/i
}
@out
)
{
grep
{
s/\.[3-7]86/\.686\n\t\.MMX/
}
@out
;
}
push
(
@out
,"
_TEXT
\$
ENDS
\n
");
push
(
@out
,"
END
\n
");
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录