1998-12-21 10:52:47 +00:00
|
|
|
#!/usr/local/bin/perl
|
1998-12-21 10:56:39 +00:00
|
|
|
|
|
|
|
$L="edi";
|
|
|
|
$R="esi";
|
|
|
|
|
2001-10-24 21:21:12 +00:00
|
|
|
sub DES_encrypt3
|
1998-12-21 10:56:39 +00:00
|
|
|
{
|
|
|
|
local($name,$enc)=@_;
|
|
|
|
|
|
|
|
&function_begin_B($name,"");
|
|
|
|
&push("ebx");
|
|
|
|
&mov("ebx",&wparam(0));
|
|
|
|
|
|
|
|
&push("ebp");
|
|
|
|
&push("esi");
|
|
|
|
|
|
|
|
&push("edi");
|
|
|
|
|
|
|
|
&comment("");
|
|
|
|
&comment("Load the data words");
|
|
|
|
&mov($L,&DWP(0,"ebx","",0));
|
|
|
|
&mov($R,&DWP(4,"ebx","",0));
|
|
|
|
&stack_push(3);
|
|
|
|
|
|
|
|
&comment("");
|
|
|
|
&comment("IP");
|
|
|
|
&IP_new($L,$R,"edx",0);
|
|
|
|
|
|
|
|
# put them back
|
|
|
|
|
|
|
|
if ($enc)
|
|
|
|
{
|
|
|
|
&mov(&DWP(4,"ebx","",0),$R);
|
|
|
|
&mov("eax",&wparam(1));
|
|
|
|
&mov(&DWP(0,"ebx","",0),"edx");
|
|
|
|
&mov("edi",&wparam(2));
|
|
|
|
&mov("esi",&wparam(3));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
&mov(&DWP(4,"ebx","",0),$R);
|
|
|
|
&mov("esi",&wparam(1));
|
|
|
|
&mov(&DWP(0,"ebx","",0),"edx");
|
|
|
|
&mov("edi",&wparam(2));
|
|
|
|
&mov("eax",&wparam(3));
|
|
|
|
}
|
1999-07-12 18:12:43 +00:00
|
|
|
&mov(&swtmp(2), (DWC(($enc)?"1":"0")));
|
1998-12-21 10:56:39 +00:00
|
|
|
&mov(&swtmp(1), "eax");
|
|
|
|
&mov(&swtmp(0), "ebx");
|
2001-10-24 21:21:12 +00:00
|
|
|
&call("DES_encrypt2");
|
1999-07-12 18:12:43 +00:00
|
|
|
&mov(&swtmp(2), (DWC(($enc)?"0":"1")));
|
1998-12-21 10:56:39 +00:00
|
|
|
&mov(&swtmp(1), "edi");
|
|
|
|
&mov(&swtmp(0), "ebx");
|
2001-10-24 21:21:12 +00:00
|
|
|
&call("DES_encrypt2");
|
1999-07-12 18:12:43 +00:00
|
|
|
&mov(&swtmp(2), (DWC(($enc)?"1":"0")));
|
1998-12-21 10:56:39 +00:00
|
|
|
&mov(&swtmp(1), "esi");
|
|
|
|
&mov(&swtmp(0), "ebx");
|
2001-10-24 21:21:12 +00:00
|
|
|
&call("DES_encrypt2");
|
1998-12-21 10:56:39 +00:00
|
|
|
|
|
|
|
&stack_pop(3);
|
|
|
|
&mov($L,&DWP(0,"ebx","",0));
|
|
|
|
&mov($R,&DWP(4,"ebx","",0));
|
|
|
|
|
|
|
|
&comment("");
|
|
|
|
&comment("FP");
|
|
|
|
&FP_new($L,$R,"eax",0);
|
|
|
|
|
|
|
|
&mov(&DWP(0,"ebx","",0),"eax");
|
|
|
|
&mov(&DWP(4,"ebx","",0),$R);
|
|
|
|
|
|
|
|
&pop("edi");
|
|
|
|
&pop("esi");
|
|
|
|
&pop("ebp");
|
|
|
|
&pop("ebx");
|
|
|
|
&ret();
|
|
|
|
&function_end_B($name);
|
|
|
|
}
|
|
|
|
|
|
|
|
|