A local copy of OpenSSL from GitHub
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
1.7 KiB

  1. #! /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. $L="edi";
  9. $R="esi";
  10. sub DES_encrypt3
  11. {
  12. local($name,$enc)=@_;
  13. &function_begin_B($name,"");
  14. &push("ebx");
  15. &mov("ebx",&wparam(0));
  16. &push("ebp");
  17. &push("esi");
  18. &push("edi");
  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. &comment("");
  25. &comment("IP");
  26. &IP_new($L,$R,"edx",0);
  27. # put them back
  28. if ($enc)
  29. {
  30. &mov(&DWP(4,"ebx","",0),$R);
  31. &mov("eax",&wparam(1));
  32. &mov(&DWP(0,"ebx","",0),"edx");
  33. &mov("edi",&wparam(2));
  34. &mov("esi",&wparam(3));
  35. }
  36. else
  37. {
  38. &mov(&DWP(4,"ebx","",0),$R);
  39. &mov("esi",&wparam(1));
  40. &mov(&DWP(0,"ebx","",0),"edx");
  41. &mov("edi",&wparam(2));
  42. &mov("eax",&wparam(3));
  43. }
  44. &mov(&swtmp(2), (DWC(($enc)?"1":"0")));
  45. &mov(&swtmp(1), "eax");
  46. &mov(&swtmp(0), "ebx");
  47. &call("DES_encrypt2");
  48. &mov(&swtmp(2), (DWC(($enc)?"0":"1")));
  49. &mov(&swtmp(1), "edi");
  50. &mov(&swtmp(0), "ebx");
  51. &call("DES_encrypt2");
  52. &mov(&swtmp(2), (DWC(($enc)?"1":"0")));
  53. &mov(&swtmp(1), "esi");
  54. &mov(&swtmp(0), "ebx");
  55. &call("DES_encrypt2");
  56. &stack_pop(3);
  57. &mov($L,&DWP(0,"ebx","",0));
  58. &mov($R,&DWP(4,"ebx","",0));
  59. &comment("");
  60. &comment("FP");
  61. &FP_new($L,$R,"eax",0);
  62. &mov(&DWP(0,"ebx","",0),"eax");
  63. &mov(&DWP(4,"ebx","",0),$R);
  64. &pop("edi");
  65. &pop("esi");
  66. &pop("ebp");
  67. &pop("ebx");
  68. &ret();
  69. &function_end_B($name);
  70. }