OLD | NEW |
1 #!/usr/local/bin/perl | 1 #!/usr/local/bin/perl |
2 # | 2 # |
3 # The inner loop instruction sequence and the IP/FP modifications are from | 3 # The inner loop instruction sequence and the IP/FP modifications are from |
4 # Svend Olaf Mikkelsen <svolaf@inet.uni-c.dk> | 4 # Svend Olaf Mikkelsen <svolaf@inet.uni-c.dk> |
5 # I've added the stuff needed for crypt() but I've not worried about making | 5 # I've added the stuff needed for crypt() but I've not worried about making |
6 # things perfect. | 6 # things perfect. |
7 # | 7 # |
8 | 8 |
9 push(@INC,"perlasm","../../perlasm"); | 9 $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; |
| 10 push(@INC,"${dir}","${dir}../../perlasm"); |
10 require "x86asm.pl"; | 11 require "x86asm.pl"; |
11 | 12 |
12 &asm_init($ARGV[0],"crypt586.pl"); | 13 &asm_init($ARGV[0],"crypt586.pl"); |
13 | 14 |
14 $L="edi"; | 15 $L="edi"; |
15 $R="esi"; | 16 $R="esi"; |
16 | 17 |
17 &external_label("DES_SPtrans"); | 18 &external_label("DES_SPtrans"); |
18 &fcrypt_body("fcrypt_body"); | 19 &fcrypt_body("fcrypt_body"); |
19 &asm_finish(); | 20 &asm_finish(); |
20 | 21 |
21 sub fcrypt_body | 22 sub fcrypt_body |
22 { | 23 { |
23 local($name,$do_ip)=@_; | 24 local($name,$do_ip)=@_; |
24 | 25 |
25 » &function_begin($name,"EXTRN _DES_SPtrans:DWORD"); | 26 » &function_begin($name); |
26 | 27 |
27 &comment(""); | 28 &comment(""); |
28 &comment("Load the 2 words"); | 29 &comment("Load the 2 words"); |
29 $trans="ebp"; | 30 $trans="ebp"; |
30 | 31 |
31 &xor( $L, $L); | 32 &xor( $L, $L); |
32 &xor( $R, $R); | 33 &xor( $R, $R); |
33 | 34 |
34 # PIC-ification:-) | 35 # PIC-ification:-) |
35 &picmeup("edx","DES_SPtrans"); | 36 &picmeup("edx","DES_SPtrans"); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 } | 200 } |
200 | 201 |
201 &R_PERM_OP($l,$r,$tt, 0,"0xaaaaaaaa",$r); | 202 &R_PERM_OP($l,$r,$tt, 0,"0xaaaaaaaa",$r); |
202 &R_PERM_OP($tt,$r,$l,23,"0x03fc03fc",$r); | 203 &R_PERM_OP($tt,$r,$l,23,"0x03fc03fc",$r); |
203 &R_PERM_OP($l,$r,$tt,10,"0x33333333",$l); | 204 &R_PERM_OP($l,$r,$tt,10,"0x33333333",$l); |
204 &R_PERM_OP($r,$tt,$l,18,"0xfff0000f",$l); | 205 &R_PERM_OP($r,$tt,$l,18,"0xfff0000f",$l); |
205 &R_PERM_OP($l,$tt,$r,12,"0xf0f0f0f0",$r); | 206 &R_PERM_OP($l,$tt,$r,12,"0xf0f0f0f0",$r); |
206 &rotr($tt , 4); | 207 &rotr($tt , 4); |
207 } | 208 } |
208 | 209 |
OLD | NEW |