1*0Sstevel@tonic-gate#!/usr/local/bin/perl 2*0Sstevel@tonic-gate 3*0Sstevel@tonic-gate$L="edi"; 4*0Sstevel@tonic-gate$R="esi"; 5*0Sstevel@tonic-gate 6*0Sstevel@tonic-gatesub DES_encrypt3 7*0Sstevel@tonic-gate { 8*0Sstevel@tonic-gate local($name,$enc)=@_; 9*0Sstevel@tonic-gate 10*0Sstevel@tonic-gate &function_begin_B($name,""); 11*0Sstevel@tonic-gate &push("ebx"); 12*0Sstevel@tonic-gate &mov("ebx",&wparam(0)); 13*0Sstevel@tonic-gate 14*0Sstevel@tonic-gate &push("ebp"); 15*0Sstevel@tonic-gate &push("esi"); 16*0Sstevel@tonic-gate 17*0Sstevel@tonic-gate &push("edi"); 18*0Sstevel@tonic-gate 19*0Sstevel@tonic-gate &comment(""); 20*0Sstevel@tonic-gate &comment("Load the data words"); 21*0Sstevel@tonic-gate &mov($L,&DWP(0,"ebx","",0)); 22*0Sstevel@tonic-gate &mov($R,&DWP(4,"ebx","",0)); 23*0Sstevel@tonic-gate &stack_push(3); 24*0Sstevel@tonic-gate 25*0Sstevel@tonic-gate &comment(""); 26*0Sstevel@tonic-gate &comment("IP"); 27*0Sstevel@tonic-gate &IP_new($L,$R,"edx",0); 28*0Sstevel@tonic-gate 29*0Sstevel@tonic-gate # put them back 30*0Sstevel@tonic-gate 31*0Sstevel@tonic-gate if ($enc) 32*0Sstevel@tonic-gate { 33*0Sstevel@tonic-gate &mov(&DWP(4,"ebx","",0),$R); 34*0Sstevel@tonic-gate &mov("eax",&wparam(1)); 35*0Sstevel@tonic-gate &mov(&DWP(0,"ebx","",0),"edx"); 36*0Sstevel@tonic-gate &mov("edi",&wparam(2)); 37*0Sstevel@tonic-gate &mov("esi",&wparam(3)); 38*0Sstevel@tonic-gate } 39*0Sstevel@tonic-gate else 40*0Sstevel@tonic-gate { 41*0Sstevel@tonic-gate &mov(&DWP(4,"ebx","",0),$R); 42*0Sstevel@tonic-gate &mov("esi",&wparam(1)); 43*0Sstevel@tonic-gate &mov(&DWP(0,"ebx","",0),"edx"); 44*0Sstevel@tonic-gate &mov("edi",&wparam(2)); 45*0Sstevel@tonic-gate &mov("eax",&wparam(3)); 46*0Sstevel@tonic-gate } 47*0Sstevel@tonic-gate &mov(&swtmp(2), (DWC(($enc)?"1":"0"))); 48*0Sstevel@tonic-gate &mov(&swtmp(1), "eax"); 49*0Sstevel@tonic-gate &mov(&swtmp(0), "ebx"); 50*0Sstevel@tonic-gate &call("DES_encrypt2"); 51*0Sstevel@tonic-gate &mov(&swtmp(2), (DWC(($enc)?"0":"1"))); 52*0Sstevel@tonic-gate &mov(&swtmp(1), "edi"); 53*0Sstevel@tonic-gate &mov(&swtmp(0), "ebx"); 54*0Sstevel@tonic-gate &call("DES_encrypt2"); 55*0Sstevel@tonic-gate &mov(&swtmp(2), (DWC(($enc)?"1":"0"))); 56*0Sstevel@tonic-gate &mov(&swtmp(1), "esi"); 57*0Sstevel@tonic-gate &mov(&swtmp(0), "ebx"); 58*0Sstevel@tonic-gate &call("DES_encrypt2"); 59*0Sstevel@tonic-gate 60*0Sstevel@tonic-gate &stack_pop(3); 61*0Sstevel@tonic-gate &mov($L,&DWP(0,"ebx","",0)); 62*0Sstevel@tonic-gate &mov($R,&DWP(4,"ebx","",0)); 63*0Sstevel@tonic-gate 64*0Sstevel@tonic-gate &comment(""); 65*0Sstevel@tonic-gate &comment("FP"); 66*0Sstevel@tonic-gate &FP_new($L,$R,"eax",0); 67*0Sstevel@tonic-gate 68*0Sstevel@tonic-gate &mov(&DWP(0,"ebx","",0),"eax"); 69*0Sstevel@tonic-gate &mov(&DWP(4,"ebx","",0),$R); 70*0Sstevel@tonic-gate 71*0Sstevel@tonic-gate &pop("edi"); 72*0Sstevel@tonic-gate &pop("esi"); 73*0Sstevel@tonic-gate &pop("ebp"); 74*0Sstevel@tonic-gate &pop("ebx"); 75*0Sstevel@tonic-gate &ret(); 76*0Sstevel@tonic-gate &function_end_B($name); 77*0Sstevel@tonic-gate } 78*0Sstevel@tonic-gate 79*0Sstevel@tonic-gate 80