Add heimdal-0.6.3
[dragonfly.git] / crypto / heimdal-0.6.3 / lib / des / asm / desboth.pl
1 #!/usr/local/bin/perl
2
3 $L="edi";
4 $R="esi";
5
6 sub des_encrypt3
7         {
8         local($name,$enc)=@_;
9
10         &function_begin($name,4);
11
12         &comment("");
13         &comment("Load the data words");
14         &mov("ebx",&wparam(0));
15         &mov($L,&DWP(0,"ebx","",0));
16         &mov($R,&DWP(4,"ebx","",0));
17
18         &comment("");
19         &comment("IP");
20         &IP_new($L,$R,"edx",0);
21
22         # put them back
23         
24         if ($enc)
25                 {
26                 &mov(&DWP(4,"ebx","",0),$R);
27                  &mov("eax",&wparam(1));
28                 &mov(&DWP(0,"ebx","",0),"edx");
29                  &mov("edi",&wparam(2));
30                  &mov("esi",&wparam(3));
31                 }
32         else
33                 {
34                 &mov(&DWP(4,"ebx","",0),$R);
35                  &mov("esi",&wparam(1));
36                 &mov(&DWP(0,"ebx","",0),"edx");
37                  &mov("edi",&wparam(2));
38                  &mov("eax",&wparam(3));
39                 }
40         &push(($enc)?"1":"0");
41         &push("eax");
42         &push("ebx");
43         &call("des_encrypt2");
44         &push(($enc)?"0":"1");
45         &push("edi");
46         &push("ebx");
47         &call("des_encrypt2");
48         &push(($enc)?"1":"0");
49         &push("esi");
50         &push("ebx");
51         &call("des_encrypt2");
52
53         &mov($L,&DWP(0,"ebx","",0));
54         &add("esp",36);
55         &mov($R,&DWP(4,"ebx","",0));
56
57         &comment("");
58         &comment("FP");
59         &FP_new($L,$R,"eax",0);
60
61         &mov(&DWP(0,"ebx","",0),"eax");
62         &mov(&DWP(4,"ebx","",0),$R);
63
64         &function_end($name);
65         }
66
67