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_B($name,"");
  11         &push("ebx");
  12         &mov("ebx",&wparam(0));
  13 
  14         &push("ebp");
  15         &push("esi");
  16 
  17         &push("edi");
  18 
  19         &comment("");
  20         &comment("Load the data words");
  21         &mov($L,&DWP(0,"ebx","",0));
  22         &mov($R,&DWP(4,"ebx","",0));
  23         &stack_push(3);
  24 
  25         &comment("");
  26         &comment("IP");
  27         &IP_new($L,$R,"edx",0);
  28 
  29         # put them back
  30 
  31         if ($enc)
  32                 {
  33                 &mov(&DWP(4,"ebx","",0),$R);
  34                  &mov("eax",&wparam(1));
  35                 &mov(&DWP(0,"ebx","",0),"edx");
  36                  &mov("edi",&wparam(2));
  37                  &mov("esi",&wparam(3));
  38                 }
  39         else
  40                 {
  41                 &mov(&DWP(4,"ebx","",0),$R);
  42                  &mov("esi",&wparam(1));
  43                 &mov(&DWP(0,"ebx","",0),"edx");
  44                  &mov("edi",&wparam(2));
  45                  &mov("eax",&wparam(3));
  46                 }
  47         &mov(&swtmp(2), (DWC(($enc)?"1":"0")));
  48         &mov(&swtmp(1), "eax");
  49         &mov(&swtmp(0), "ebx");
  50         &call("DES_encrypt2");
  51         &mov(&swtmp(2), (DWC(($enc)?"0":"1")));
  52         &mov(&swtmp(1), "edi");
  53         &mov(&swtmp(0), "ebx");
  54         &call("DES_encrypt2");
  55         &mov(&swtmp(2), (DWC(($enc)?"1":"0")));
  56         &mov(&swtmp(1), "esi");
  57         &mov(&swtmp(0), "ebx");
  58         &call("DES_encrypt2");
  59 
  60         &stack_pop(3);
  61         &mov($L,&DWP(0,"ebx","",0));
  62         &mov($R,&DWP(4,"ebx","",0));
  63 
  64         &comment("");
  65         &comment("FP");
  66         &FP_new($L,$R,"eax",0);
  67 
  68         &mov(&DWP(0,"ebx","",0),"eax");
  69         &mov(&DWP(4,"ebx","",0),$R);
  70 
  71         &pop("edi");
  72         &pop("esi");
  73         &pop("ebp");
  74         &pop("ebx");
  75         &ret();
  76         &function_end_B($name);
  77         }