desboth.pl 1.3 KB

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