blob: ef7054e27506c97dc840487b8e8d0a9f54f904a7 [file] [log] [blame]
yuezonghe824eb0c2024-06-27 02:32:26 -07001#! /usr/bin/env perl
2# Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
3#
4# Licensed under the OpenSSL license (the "License"). You may not use
5# this file except in compliance with the License. You can obtain a copy
6# in the file LICENSE in the source distribution or at
7# https://www.openssl.org/source/license.html
8
9
10$L="edi";
11$R="esi";
12
13sub DES_encrypt3
14 {
15 local($name,$enc)=@_;
16
17 &function_begin_B($name,"");
18 &push("ebx");
19 &mov("ebx",&wparam(0));
20
21 &push("ebp");
22 &push("esi");
23
24 &push("edi");
25
26 &comment("");
27 &comment("Load the data words");
28 &mov($L,&DWP(0,"ebx","",0));
29 &mov($R,&DWP(4,"ebx","",0));
30 &stack_push(3);
31
32 &comment("");
33 &comment("IP");
34 &IP_new($L,$R,"edx",0);
35
36 # put them back
37
38 if ($enc)
39 {
40 &mov(&DWP(4,"ebx","",0),$R);
41 &mov("eax",&wparam(1));
42 &mov(&DWP(0,"ebx","",0),"edx");
43 &mov("edi",&wparam(2));
44 &mov("esi",&wparam(3));
45 }
46 else
47 {
48 &mov(&DWP(4,"ebx","",0),$R);
49 &mov("esi",&wparam(1));
50 &mov(&DWP(0,"ebx","",0),"edx");
51 &mov("edi",&wparam(2));
52 &mov("eax",&wparam(3));
53 }
54 &mov(&swtmp(2), (DWC(($enc)?"1":"0")));
55 &mov(&swtmp(1), "eax");
56 &mov(&swtmp(0), "ebx");
57 &call("DES_encrypt2");
58 &mov(&swtmp(2), (DWC(($enc)?"0":"1")));
59 &mov(&swtmp(1), "edi");
60 &mov(&swtmp(0), "ebx");
61 &call("DES_encrypt2");
62 &mov(&swtmp(2), (DWC(($enc)?"1":"0")));
63 &mov(&swtmp(1), "esi");
64 &mov(&swtmp(0), "ebx");
65 &call("DES_encrypt2");
66
67 &stack_pop(3);
68 &mov($L,&DWP(0,"ebx","",0));
69 &mov($R,&DWP(4,"ebx","",0));
70
71 &comment("");
72 &comment("FP");
73 &FP_new($L,$R,"eax",0);
74
75 &mov(&DWP(0,"ebx","",0),"eax");
76 &mov(&DWP(4,"ebx","",0),$R);
77
78 &pop("edi");
79 &pop("esi");
80 &pop("ebp");
81 &pop("ebx");
82 &ret();
83 &function_end_B($name);
84 }
85
86