summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/rc5
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/rc5')
-rw-r--r--src/lib/libcrypto/rc5/Makefile.ssl107
-rw-r--r--src/lib/libcrypto/rc5/Makefile.uni72
-rw-r--r--src/lib/libcrypto/rc5/asm/r5-win32.asm574
-rw-r--r--src/lib/libcrypto/rc5/asm/r586unix.cpp628
-rw-r--r--src/lib/libcrypto/rc5/asm/rc5-586.pl109
5 files changed, 1490 insertions, 0 deletions
diff --git a/src/lib/libcrypto/rc5/Makefile.ssl b/src/lib/libcrypto/rc5/Makefile.ssl
new file mode 100644
index 0000000000..5e98ee2348
--- /dev/null
+++ b/src/lib/libcrypto/rc5/Makefile.ssl
@@ -0,0 +1,107 @@
1#
2# SSLeay/crypto/rc5/Makefile
3#
4
5DIR= rc5
6TOP= ../..
7CC= cc
8CPP= $(CC) -E
9INCLUDES=
10CFLAG=-g
11INSTALLTOP=/usr/local/ssl
12MAKE= make -f Makefile.ssl
13MAKEDEPEND= makedepend -f Makefile.ssl
14MAKEFILE= Makefile.ssl
15AR= ar r
16
17RC5_ENC= rc5_enc.o
18# or use
19#DES_ENC= r586-elf.o
20
21CFLAGS= $(INCLUDES) $(CFLAG)
22
23GENERAL=Makefile
24TEST=rc5test.c
25APPS=
26
27LIB=$(TOP)/libcrypto.a
28LIBSRC=rc5_skey.c rc5_ecb.c rc5_enc.c rc5cfb64.c rc5ofb64.c
29LIBOBJ=rc5_skey.o rc5_ecb.o $(RC5_ENC) rc5cfb64.o rc5ofb64.o
30
31SRC= $(LIBSRC)
32
33EXHEADER= rc5.h
34HEADER= rc5_locl.h $(EXHEADER)
35
36ALL= $(GENERAL) $(SRC) $(HEADER)
37
38top:
39 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
40
41all: lib
42
43lib: $(LIBOBJ)
44 $(AR) $(LIB) $(LIBOBJ)
45 sh $(TOP)/util/ranlib.sh $(LIB)
46 @touch lib
47
48# elf
49asm/r586-elf.o: asm/r586unix.cpp
50 $(CPP) -DELF asm/r586unix.cpp | as -o asm/r586-elf.o
51
52# solaris
53asm/r586-sol.o: asm/r586unix.cpp
54 $(CC) -E -DSOL asm/r586unix.cpp | sed 's/^#.*//' > asm/r586-sol.s
55 as -o asm/r586-sol.o asm/r586-sol.s
56 rm -f asm/r586-sol.s
57
58# a.out
59asm/r586-out.o: asm/r586unix.cpp
60 $(CPP) -DOUT asm/r586unix.cpp | as -o asm/r586-out.o
61
62# bsdi
63asm/r586bsdi.o: asm/r586unix.cpp
64 $(CPP) -DBSDI asm/r586unix.cpp | as -o asm/r586bsdi.o
65
66asm/r586unix.cpp:
67 (cd asm; perl rc5-586.pl cpp >r586unix.cpp)
68
69files:
70 perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
71
72links:
73 /bin/rm -f Makefile
74 $(TOP)/util/point.sh Makefile.ssl Makefile ;
75 $(TOP)/util/point.sh ../../doc/rc5.doc rc5.doc ;
76 $(TOP)/util/mklink.sh ../../include $(EXHEADER)
77 $(TOP)/util/mklink.sh ../../test $(TEST)
78 $(TOP)/util/mklink.sh ../../apps $(APPS)
79
80install:
81 @for i in $(EXHEADER) ; \
82 do \
83 (cp $$i $(INSTALLTOP)/include/$$i; \
84 chmod 644 $(INSTALLTOP)/include/$$i ); \
85 done;
86
87tags:
88 ctags $(SRC)
89
90tests:
91
92lint:
93 lint -DLINT $(INCLUDES) $(SRC)>fluff
94
95depend:
96 $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC)
97
98dclean:
99 perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
100 mv -f Makefile.new $(MAKEFILE)
101
102clean:
103 /bin/rm -f *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
104
105errors:
106
107# DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/src/lib/libcrypto/rc5/Makefile.uni b/src/lib/libcrypto/rc5/Makefile.uni
new file mode 100644
index 0000000000..e50b3f2d19
--- /dev/null
+++ b/src/lib/libcrypto/rc5/Makefile.uni
@@ -0,0 +1,72 @@
1# Targets
2# make - twidle the options yourself :-)
3# make cc - standard cc options
4# make gcc - standard gcc options
5
6DIR= rc2
7TOP= .
8CC= gcc
9CFLAG= -O3 -fomit-frame-pointer
10
11CPP= $(CC) -E
12INCLUDES=
13INSTALLTOP=/usr/local/lib
14MAKE= make
15MAKEDEPEND= makedepend
16MAKEFILE= Makefile.uni
17AR= ar r
18
19IDEA_ENC=rc2_cbc.o
20
21CFLAGS= $(INCLUDES) $(CFLAG)
22
23GENERAL=Makefile
24TEST=rc2test
25APPS=rc2speed
26
27LIB=librc2.a
28LIBSRC=rc2_skey.c rc2_ecb.c rc2_cbc.c rc2cfb64.c rc2ofb64.c
29LIBOBJ=rc2_skey.o rc2_ecb.o $(IDEA_ENC) rc2cfb64.o rc2ofb64.o
30
31SRC= $(LIBSRC)
32
33EXHEADER= rc2.h
34HEADER= rc2_locl.h $(EXHEADER)
35
36ALL= $(GENERAL) $(SRC) $(HEADER)
37
38all: $(LIB) $(TEST) $(APPS)
39
40$(LIB): $(LIBOBJ)
41 $(AR) $(LIB) $(LIBOBJ)
42 sh $(TOP)/ranlib.sh $(LIB)
43
44test: $(TEST)
45 ./$(TEST)
46
47$(TEST): $(TEST).c $(LIB)
48 $(CC) -o $(TEST) $(CFLAGS) $(TEST).c $(LIB)
49
50$(APPS): $(APPS).c $(LIB)
51 $(CC) -o $(APPS) $(CFLAGS) $(APPS).c $(LIB)
52
53lint:
54 lint -DLINT $(INCLUDES) $(SRC)>fluff
55
56depend:
57 $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC)
58
59dclean:
60 perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
61 mv -f Makefile.new $(MAKEFILE)
62
63clean:
64 /bin/rm -f $(LIB) $(TEST) $(APPS) *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
65
66cc:
67 $(MAKE) CC="cc" CFLAG="-O" all
68
69gcc:
70 $(MAKE) CC="gcc" CFLAGS="-O3 -fomit-frame-pointer" all
71
72# DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/src/lib/libcrypto/rc5/asm/r5-win32.asm b/src/lib/libcrypto/rc5/asm/r5-win32.asm
new file mode 100644
index 0000000000..f43d3711f0
--- /dev/null
+++ b/src/lib/libcrypto/rc5/asm/r5-win32.asm
@@ -0,0 +1,574 @@
1 ; Don't even think of reading this code
2 ; It was automatically generated by rc5-586.pl
3 ; Which is a perl program used to generate the x86 assember for
4 ; any of elf, a.out, BSDI,Win32, or Solaris
5 ; eric <eay@cryptsoft.com>
6 ;
7 TITLE rc5-586.asm
8 .386
9.model FLAT
10_TEXT SEGMENT
11PUBLIC _RC5_32_encrypt
12
13_RC5_32_encrypt PROC NEAR
14 ;
15 push ebp
16 push esi
17 push edi
18 mov edx, DWORD PTR 16[esp]
19 mov ebp, DWORD PTR 20[esp]
20 ; Load the 2 words
21 mov edi, DWORD PTR [edx]
22 mov esi, DWORD PTR 4[edx]
23 push ebx
24 mov ebx, DWORD PTR [ebp]
25 add edi, DWORD PTR 4[ebp]
26 add esi, DWORD PTR 8[ebp]
27 xor edi, esi
28 mov eax, DWORD PTR 12[ebp]
29 mov ecx, esi
30 rol edi, cl
31 add edi, eax
32 xor esi, edi
33 mov eax, DWORD PTR 16[ebp]
34 mov ecx, edi
35 rol esi, cl
36 add esi, eax
37 xor edi, esi
38 mov eax, DWORD PTR 20[ebp]
39 mov ecx, esi
40 rol edi, cl
41 add edi, eax
42 xor esi, edi
43 mov eax, DWORD PTR 24[ebp]
44 mov ecx, edi
45 rol esi, cl
46 add esi, eax
47 xor edi, esi
48 mov eax, DWORD PTR 28[ebp]
49 mov ecx, esi
50 rol edi, cl
51 add edi, eax
52 xor esi, edi
53 mov eax, DWORD PTR 32[ebp]
54 mov ecx, edi
55 rol esi, cl
56 add esi, eax
57 xor edi, esi
58 mov eax, DWORD PTR 36[ebp]
59 mov ecx, esi
60 rol edi, cl
61 add edi, eax
62 xor esi, edi
63 mov eax, DWORD PTR 40[ebp]
64 mov ecx, edi
65 rol esi, cl
66 add esi, eax
67 xor edi, esi
68 mov eax, DWORD PTR 44[ebp]
69 mov ecx, esi
70 rol edi, cl
71 add edi, eax
72 xor esi, edi
73 mov eax, DWORD PTR 48[ebp]
74 mov ecx, edi
75 rol esi, cl
76 add esi, eax
77 xor edi, esi
78 mov eax, DWORD PTR 52[ebp]
79 mov ecx, esi
80 rol edi, cl
81 add edi, eax
82 xor esi, edi
83 mov eax, DWORD PTR 56[ebp]
84 mov ecx, edi
85 rol esi, cl
86 add esi, eax
87 xor edi, esi
88 mov eax, DWORD PTR 60[ebp]
89 mov ecx, esi
90 rol edi, cl
91 add edi, eax
92 xor esi, edi
93 mov eax, DWORD PTR 64[ebp]
94 mov ecx, edi
95 rol esi, cl
96 add esi, eax
97 xor edi, esi
98 mov eax, DWORD PTR 68[ebp]
99 mov ecx, esi
100 rol edi, cl
101 add edi, eax
102 xor esi, edi
103 mov eax, DWORD PTR 72[ebp]
104 mov ecx, edi
105 rol esi, cl
106 add esi, eax
107 cmp ebx, 8
108 je $L000rc5_exit
109 xor edi, esi
110 mov eax, DWORD PTR 76[ebp]
111 mov ecx, esi
112 rol edi, cl
113 add edi, eax
114 xor esi, edi
115 mov eax, DWORD PTR 80[ebp]
116 mov ecx, edi
117 rol esi, cl
118 add esi, eax
119 xor edi, esi
120 mov eax, DWORD PTR 84[ebp]
121 mov ecx, esi
122 rol edi, cl
123 add edi, eax
124 xor esi, edi
125 mov eax, DWORD PTR 88[ebp]
126 mov ecx, edi
127 rol esi, cl
128 add esi, eax
129 xor edi, esi
130 mov eax, DWORD PTR 92[ebp]
131 mov ecx, esi
132 rol edi, cl
133 add edi, eax
134 xor esi, edi
135 mov eax, DWORD PTR 96[ebp]
136 mov ecx, edi
137 rol esi, cl
138 add esi, eax
139 xor edi, esi
140 mov eax, DWORD PTR 100[ebp]
141 mov ecx, esi
142 rol edi, cl
143 add edi, eax
144 xor esi, edi
145 mov eax, DWORD PTR 104[ebp]
146 mov ecx, edi
147 rol esi, cl
148 add esi, eax
149 cmp ebx, 12
150 je $L000rc5_exit
151 xor edi, esi
152 mov eax, DWORD PTR 108[ebp]
153 mov ecx, esi
154 rol edi, cl
155 add edi, eax
156 xor esi, edi
157 mov eax, DWORD PTR 112[ebp]
158 mov ecx, edi
159 rol esi, cl
160 add esi, eax
161 xor edi, esi
162 mov eax, DWORD PTR 116[ebp]
163 mov ecx, esi
164 rol edi, cl
165 add edi, eax
166 xor esi, edi
167 mov eax, DWORD PTR 120[ebp]
168 mov ecx, edi
169 rol esi, cl
170 add esi, eax
171 xor edi, esi
172 mov eax, DWORD PTR 124[ebp]
173 mov ecx, esi
174 rol edi, cl
175 add edi, eax
176 xor esi, edi
177 mov eax, DWORD PTR 128[ebp]
178 mov ecx, edi
179 rol esi, cl
180 add esi, eax
181 xor edi, esi
182 mov eax, DWORD PTR 132[ebp]
183 mov ecx, esi
184 rol edi, cl
185 add edi, eax
186 xor esi, edi
187 mov eax, DWORD PTR 136[ebp]
188 mov ecx, edi
189 rol esi, cl
190 add esi, eax
191$L000rc5_exit:
192 mov DWORD PTR [edx],edi
193 mov DWORD PTR 4[edx],esi
194 pop ebx
195 pop edi
196 pop esi
197 pop ebp
198 ret
199_RC5_32_encrypt ENDP
200_TEXT ENDS
201_TEXT SEGMENT
202PUBLIC _RC5_32_decrypt
203
204_RC5_32_decrypt PROC NEAR
205 ;
206 push ebp
207 push esi
208 push edi
209 mov edx, DWORD PTR 16[esp]
210 mov ebp, DWORD PTR 20[esp]
211 ; Load the 2 words
212 mov edi, DWORD PTR [edx]
213 mov esi, DWORD PTR 4[edx]
214 push ebx
215 mov ebx, DWORD PTR [ebp]
216 cmp ebx, 12
217 je $L001rc5_dec_12
218 cmp ebx, 8
219 je $L002rc5_dec_8
220 mov eax, DWORD PTR 136[ebp]
221 sub esi, eax
222 mov ecx, edi
223 ror esi, cl
224 xor esi, edi
225 mov eax, DWORD PTR 132[ebp]
226 sub edi, eax
227 mov ecx, esi
228 ror edi, cl
229 xor edi, esi
230 mov eax, DWORD PTR 128[ebp]
231 sub esi, eax
232 mov ecx, edi
233 ror esi, cl
234 xor esi, edi
235 mov eax, DWORD PTR 124[ebp]
236 sub edi, eax
237 mov ecx, esi
238 ror edi, cl
239 xor edi, esi
240 mov eax, DWORD PTR 120[ebp]
241 sub esi, eax
242 mov ecx, edi
243 ror esi, cl
244 xor esi, edi
245 mov eax, DWORD PTR 116[ebp]
246 sub edi, eax
247 mov ecx, esi
248 ror edi, cl
249 xor edi, esi
250 mov eax, DWORD PTR 112[ebp]
251 sub esi, eax
252 mov ecx, edi
253 ror esi, cl
254 xor esi, edi
255 mov eax, DWORD PTR 108[ebp]
256 sub edi, eax
257 mov ecx, esi
258 ror edi, cl
259 xor edi, esi
260$L001rc5_dec_12:
261 mov eax, DWORD PTR 104[ebp]
262 sub esi, eax
263 mov ecx, edi
264 ror esi, cl
265 xor esi, edi
266 mov eax, DWORD PTR 100[ebp]
267 sub edi, eax
268 mov ecx, esi
269 ror edi, cl
270 xor edi, esi
271 mov eax, DWORD PTR 96[ebp]
272 sub esi, eax
273 mov ecx, edi
274 ror esi, cl
275 xor esi, edi
276 mov eax, DWORD PTR 92[ebp]
277 sub edi, eax
278 mov ecx, esi
279 ror edi, cl
280 xor edi, esi
281 mov eax, DWORD PTR 88[ebp]
282 sub esi, eax
283 mov ecx, edi
284 ror esi, cl
285 xor esi, edi
286 mov eax, DWORD PTR 84[ebp]
287 sub edi, eax
288 mov ecx, esi
289 ror edi, cl
290 xor edi, esi
291 mov eax, DWORD PTR 80[ebp]
292 sub esi, eax
293 mov ecx, edi
294 ror esi, cl
295 xor esi, edi
296 mov eax, DWORD PTR 76[ebp]
297 sub edi, eax
298 mov ecx, esi
299 ror edi, cl
300 xor edi, esi
301$L002rc5_dec_8:
302 mov eax, DWORD PTR 72[ebp]
303 sub esi, eax
304 mov ecx, edi
305 ror esi, cl
306 xor esi, edi
307 mov eax, DWORD PTR 68[ebp]
308 sub edi, eax
309 mov ecx, esi
310 ror edi, cl
311 xor edi, esi
312 mov eax, DWORD PTR 64[ebp]
313 sub esi, eax
314 mov ecx, edi
315 ror esi, cl
316 xor esi, edi
317 mov eax, DWORD PTR 60[ebp]
318 sub edi, eax
319 mov ecx, esi
320 ror edi, cl
321 xor edi, esi
322 mov eax, DWORD PTR 56[ebp]
323 sub esi, eax
324 mov ecx, edi
325 ror esi, cl
326 xor esi, edi
327 mov eax, DWORD PTR 52[ebp]
328 sub edi, eax
329 mov ecx, esi
330 ror edi, cl
331 xor edi, esi
332 mov eax, DWORD PTR 48[ebp]
333 sub esi, eax
334 mov ecx, edi
335 ror esi, cl
336 xor esi, edi
337 mov eax, DWORD PTR 44[ebp]
338 sub edi, eax
339 mov ecx, esi
340 ror edi, cl
341 xor edi, esi
342 mov eax, DWORD PTR 40[ebp]
343 sub esi, eax
344 mov ecx, edi
345 ror esi, cl
346 xor esi, edi
347 mov eax, DWORD PTR 36[ebp]
348 sub edi, eax
349 mov ecx, esi
350 ror edi, cl
351 xor edi, esi
352 mov eax, DWORD PTR 32[ebp]
353 sub esi, eax
354 mov ecx, edi
355 ror esi, cl
356 xor esi, edi
357 mov eax, DWORD PTR 28[ebp]
358 sub edi, eax
359 mov ecx, esi
360 ror edi, cl
361 xor edi, esi
362 mov eax, DWORD PTR 24[ebp]
363 sub esi, eax
364 mov ecx, edi
365 ror esi, cl
366 xor esi, edi
367 mov eax, DWORD PTR 20[ebp]
368 sub edi, eax
369 mov ecx, esi
370 ror edi, cl
371 xor edi, esi
372 mov eax, DWORD PTR 16[ebp]
373 sub esi, eax
374 mov ecx, edi
375 ror esi, cl
376 xor esi, edi
377 mov eax, DWORD PTR 12[ebp]
378 sub edi, eax
379 mov ecx, esi
380 ror edi, cl
381 xor edi, esi
382 sub esi, DWORD PTR 8[ebp]
383 sub edi, DWORD PTR 4[ebp]
384L003rc5_exit:
385 mov DWORD PTR [edx],edi
386 mov DWORD PTR 4[edx],esi
387 pop ebx
388 pop edi
389 pop esi
390 pop ebp
391 ret
392_RC5_32_decrypt ENDP
393_TEXT ENDS
394_TEXT SEGMENT
395PUBLIC _RC5_32_cbc_encrypt
396
397_RC5_32_cbc_encrypt PROC NEAR
398 ;
399 push ebp
400 push ebx
401 push esi
402 push edi
403 mov ebp, DWORD PTR 28[esp]
404 ; getting iv ptr from parameter 4
405 mov ebx, DWORD PTR 36[esp]
406 mov esi, DWORD PTR [ebx]
407 mov edi, DWORD PTR 4[ebx]
408 push edi
409 push esi
410 push edi
411 push esi
412 mov ebx, esp
413 mov esi, DWORD PTR 36[esp]
414 mov edi, DWORD PTR 40[esp]
415 ; getting encrypt flag from parameter 5
416 mov ecx, DWORD PTR 56[esp]
417 ; get and push parameter 3
418 mov eax, DWORD PTR 48[esp]
419 push eax
420 push ebx
421 cmp ecx, 0
422 jz $L004decrypt
423 and ebp, 4294967288
424 mov eax, DWORD PTR 8[esp]
425 mov ebx, DWORD PTR 12[esp]
426 jz $L005encrypt_finish
427L006encrypt_loop:
428 mov ecx, DWORD PTR [esi]
429 mov edx, DWORD PTR 4[esi]
430 xor eax, ecx
431 xor ebx, edx
432 mov DWORD PTR 8[esp],eax
433 mov DWORD PTR 12[esp],ebx
434 call _RC5_32_encrypt
435 mov eax, DWORD PTR 8[esp]
436 mov ebx, DWORD PTR 12[esp]
437 mov DWORD PTR [edi],eax
438 mov DWORD PTR 4[edi],ebx
439 add esi, 8
440 add edi, 8
441 sub ebp, 8
442 jnz L006encrypt_loop
443$L005encrypt_finish:
444 mov ebp, DWORD PTR 52[esp]
445 and ebp, 7
446 jz $L007finish
447 xor ecx, ecx
448 xor edx, edx
449 mov ebp, DWORD PTR $L008cbc_enc_jmp_table[ebp*4]
450 jmp ebp
451L009ej7:
452 mov dh, BYTE PTR 6[esi]
453 shl edx, 8
454L010ej6:
455 mov dh, BYTE PTR 5[esi]
456L011ej5:
457 mov dl, BYTE PTR 4[esi]
458L012ej4:
459 mov ecx, DWORD PTR [esi]
460 jmp $L013ejend
461L014ej3:
462 mov ch, BYTE PTR 2[esi]
463 shl ecx, 8
464L015ej2:
465 mov ch, BYTE PTR 1[esi]
466L016ej1:
467 mov cl, BYTE PTR [esi]
468$L013ejend:
469 xor eax, ecx
470 xor ebx, edx
471 mov DWORD PTR 8[esp],eax
472 mov DWORD PTR 12[esp],ebx
473 call _RC5_32_encrypt
474 mov eax, DWORD PTR 8[esp]
475 mov ebx, DWORD PTR 12[esp]
476 mov DWORD PTR [edi],eax
477 mov DWORD PTR 4[edi],ebx
478 jmp $L007finish
479$L004decrypt:
480 and ebp, 4294967288
481 mov eax, DWORD PTR 16[esp]
482 mov ebx, DWORD PTR 20[esp]
483 jz $L017decrypt_finish
484L018decrypt_loop:
485 mov eax, DWORD PTR [esi]
486 mov ebx, DWORD PTR 4[esi]
487 mov DWORD PTR 8[esp],eax
488 mov DWORD PTR 12[esp],ebx
489 call _RC5_32_decrypt
490 mov eax, DWORD PTR 8[esp]
491 mov ebx, DWORD PTR 12[esp]
492 mov ecx, DWORD PTR 16[esp]
493 mov edx, DWORD PTR 20[esp]
494 xor ecx, eax
495 xor edx, ebx
496 mov eax, DWORD PTR [esi]
497 mov ebx, DWORD PTR 4[esi]
498 mov DWORD PTR [edi],ecx
499 mov DWORD PTR 4[edi],edx
500 mov DWORD PTR 16[esp],eax
501 mov DWORD PTR 20[esp],ebx
502 add esi, 8
503 add edi, 8
504 sub ebp, 8
505 jnz L018decrypt_loop
506$L017decrypt_finish:
507 mov ebp, DWORD PTR 52[esp]
508 and ebp, 7
509 jz $L007finish
510 mov eax, DWORD PTR [esi]
511 mov ebx, DWORD PTR 4[esi]
512 mov DWORD PTR 8[esp],eax
513 mov DWORD PTR 12[esp],ebx
514 call _RC5_32_decrypt
515 mov eax, DWORD PTR 8[esp]
516 mov ebx, DWORD PTR 12[esp]
517 mov ecx, DWORD PTR 16[esp]
518 mov edx, DWORD PTR 20[esp]
519 xor ecx, eax
520 xor edx, ebx
521 mov eax, DWORD PTR [esi]
522 mov ebx, DWORD PTR 4[esi]
523L019dj7:
524 ror edx, 16
525 mov BYTE PTR 6[edi],dl
526 shr edx, 16
527L020dj6:
528 mov BYTE PTR 5[edi],dh
529L021dj5:
530 mov BYTE PTR 4[edi],dl
531L022dj4:
532 mov DWORD PTR [edi],ecx
533 jmp $L023djend
534L024dj3:
535 ror ecx, 16
536 mov BYTE PTR 2[edi],cl
537 shl ecx, 16
538L025dj2:
539 mov BYTE PTR 1[esi],ch
540L026dj1:
541 mov BYTE PTR [esi], cl
542$L023djend:
543 jmp $L007finish
544$L007finish:
545 mov ecx, DWORD PTR 60[esp]
546 add esp, 24
547 mov DWORD PTR [ecx],eax
548 mov DWORD PTR 4[ecx],ebx
549 pop edi
550 pop esi
551 pop ebx
552 pop ebp
553 ret
554$L008cbc_enc_jmp_table:
555 DD 0
556 DD L016ej1
557 DD L015ej2
558 DD L014ej3
559 DD L012ej4
560 DD L011ej5
561 DD L010ej6
562 DD L009ej7
563L027cbc_dec_jmp_table:
564 DD 0
565 DD L026dj1
566 DD L025dj2
567 DD L024dj3
568 DD L022dj4
569 DD L021dj5
570 DD L020dj6
571 DD L019dj7
572_RC5_32_cbc_encrypt ENDP
573_TEXT ENDS
574END
diff --git a/src/lib/libcrypto/rc5/asm/r586unix.cpp b/src/lib/libcrypto/rc5/asm/r586unix.cpp
new file mode 100644
index 0000000000..a25dd5a9a4
--- /dev/null
+++ b/src/lib/libcrypto/rc5/asm/r586unix.cpp
@@ -0,0 +1,628 @@
1/* Run the C pre-processor over this file with one of the following defined
2 * ELF - elf object files,
3 * OUT - a.out object files,
4 * BSDI - BSDI style a.out object files
5 * SOL - Solaris style elf
6 */
7
8#define TYPE(a,b) .type a,b
9#define SIZE(a,b) .size a,b
10
11#if defined(OUT) || defined(BSDI)
12#define RC5_32_encrypt _RC5_32_encrypt
13#define RC5_32_decrypt _RC5_32_decrypt
14#define RC5_32_cbc_encrypt _RC5_32_cbc_encrypt
15
16#endif
17
18#ifdef OUT
19#define OK 1
20#define ALIGN 4
21#endif
22
23#ifdef BSDI
24#define OK 1
25#define ALIGN 4
26#undef SIZE
27#undef TYPE
28#define SIZE(a,b)
29#define TYPE(a,b)
30#endif
31
32#if defined(ELF) || defined(SOL)
33#define OK 1
34#define ALIGN 16
35#endif
36
37#ifndef OK
38You need to define one of
39ELF - elf systems - linux-elf, NetBSD and DG-UX
40OUT - a.out systems - linux-a.out and FreeBSD
41SOL - solaris systems, which are elf with strange comment lines
42BSDI - a.out with a very primative version of as.
43#endif
44
45/* Let the Assembler begin :-) */
46 /* Don't even think of reading this code */
47 /* It was automatically generated by rc5-586.pl */
48 /* Which is a perl program used to generate the x86 assember for */
49 /* any of elf, a.out, BSDI,Win32, or Solaris */
50 /* eric <eay@cryptsoft.com> */
51
52 .file "rc5-586.s"
53 .version "01.01"
54gcc2_compiled.:
55.text
56 .align ALIGN
57.globl RC5_32_encrypt
58 TYPE(RC5_32_encrypt,@function)
59RC5_32_encrypt:
60
61 pushl %ebp
62 pushl %esi
63 pushl %edi
64 movl 16(%esp), %edx
65 movl 20(%esp), %ebp
66 /* Load the 2 words */
67 movl (%edx), %edi
68 movl 4(%edx), %esi
69 pushl %ebx
70 movl (%ebp), %ebx
71 addl 4(%ebp), %edi
72 addl 8(%ebp), %esi
73 xorl %esi, %edi
74 movl 12(%ebp), %eax
75 movl %esi, %ecx
76 roll %cl, %edi
77 addl %eax, %edi
78 xorl %edi, %esi
79 movl 16(%ebp), %eax
80 movl %edi, %ecx
81 roll %cl, %esi
82 addl %eax, %esi
83 xorl %esi, %edi
84 movl 20(%ebp), %eax
85 movl %esi, %ecx
86 roll %cl, %edi
87 addl %eax, %edi
88 xorl %edi, %esi
89 movl 24(%ebp), %eax
90 movl %edi, %ecx
91 roll %cl, %esi
92 addl %eax, %esi
93 xorl %esi, %edi
94 movl 28(%ebp), %eax
95 movl %esi, %ecx
96 roll %cl, %edi
97 addl %eax, %edi
98 xorl %edi, %esi
99 movl 32(%ebp), %eax
100 movl %edi, %ecx
101 roll %cl, %esi
102 addl %eax, %esi
103 xorl %esi, %edi
104 movl 36(%ebp), %eax
105 movl %esi, %ecx
106 roll %cl, %edi
107 addl %eax, %edi
108 xorl %edi, %esi
109 movl 40(%ebp), %eax
110 movl %edi, %ecx
111 roll %cl, %esi
112 addl %eax, %esi
113 xorl %esi, %edi
114 movl 44(%ebp), %eax
115 movl %esi, %ecx
116 roll %cl, %edi
117 addl %eax, %edi
118 xorl %edi, %esi
119 movl 48(%ebp), %eax
120 movl %edi, %ecx
121 roll %cl, %esi
122 addl %eax, %esi
123 xorl %esi, %edi
124 movl 52(%ebp), %eax
125 movl %esi, %ecx
126 roll %cl, %edi
127 addl %eax, %edi
128 xorl %edi, %esi
129 movl 56(%ebp), %eax
130 movl %edi, %ecx
131 roll %cl, %esi
132 addl %eax, %esi
133 xorl %esi, %edi
134 movl 60(%ebp), %eax
135 movl %esi, %ecx
136 roll %cl, %edi
137 addl %eax, %edi
138 xorl %edi, %esi
139 movl 64(%ebp), %eax
140 movl %edi, %ecx
141 roll %cl, %esi
142 addl %eax, %esi
143 xorl %esi, %edi
144 movl 68(%ebp), %eax
145 movl %esi, %ecx
146 roll %cl, %edi
147 addl %eax, %edi
148 xorl %edi, %esi
149 movl 72(%ebp), %eax
150 movl %edi, %ecx
151 roll %cl, %esi
152 addl %eax, %esi
153 cmpl $8, %ebx
154 je .L000rc5_exit
155 xorl %esi, %edi
156 movl 76(%ebp), %eax
157 movl %esi, %ecx
158 roll %cl, %edi
159 addl %eax, %edi
160 xorl %edi, %esi
161 movl 80(%ebp), %eax
162 movl %edi, %ecx
163 roll %cl, %esi
164 addl %eax, %esi
165 xorl %esi, %edi
166 movl 84(%ebp), %eax
167 movl %esi, %ecx
168 roll %cl, %edi
169 addl %eax, %edi
170 xorl %edi, %esi
171 movl 88(%ebp), %eax
172 movl %edi, %ecx
173 roll %cl, %esi
174 addl %eax, %esi
175 xorl %esi, %edi
176 movl 92(%ebp), %eax
177 movl %esi, %ecx
178 roll %cl, %edi
179 addl %eax, %edi
180 xorl %edi, %esi
181 movl 96(%ebp), %eax
182 movl %edi, %ecx
183 roll %cl, %esi
184 addl %eax, %esi
185 xorl %esi, %edi
186 movl 100(%ebp), %eax
187 movl %esi, %ecx
188 roll %cl, %edi
189 addl %eax, %edi
190 xorl %edi, %esi
191 movl 104(%ebp), %eax
192 movl %edi, %ecx
193 roll %cl, %esi
194 addl %eax, %esi
195 cmpl $12, %ebx
196 je .L000rc5_exit
197 xorl %esi, %edi
198 movl 108(%ebp), %eax
199 movl %esi, %ecx
200 roll %cl, %edi
201 addl %eax, %edi
202 xorl %edi, %esi
203 movl 112(%ebp), %eax
204 movl %edi, %ecx
205 roll %cl, %esi
206 addl %eax, %esi
207 xorl %esi, %edi
208 movl 116(%ebp), %eax
209 movl %esi, %ecx
210 roll %cl, %edi
211 addl %eax, %edi
212 xorl %edi, %esi
213 movl 120(%ebp), %eax
214 movl %edi, %ecx
215 roll %cl, %esi
216 addl %eax, %esi
217 xorl %esi, %edi
218 movl 124(%ebp), %eax
219 movl %esi, %ecx
220 roll %cl, %edi
221 addl %eax, %edi
222 xorl %edi, %esi
223 movl 128(%ebp), %eax
224 movl %edi, %ecx
225 roll %cl, %esi
226 addl %eax, %esi
227 xorl %esi, %edi
228 movl 132(%ebp), %eax
229 movl %esi, %ecx
230 roll %cl, %edi
231 addl %eax, %edi
232 xorl %edi, %esi
233 movl 136(%ebp), %eax
234 movl %edi, %ecx
235 roll %cl, %esi
236 addl %eax, %esi
237.L000rc5_exit:
238 movl %edi, (%edx)
239 movl %esi, 4(%edx)
240 popl %ebx
241 popl %edi
242 popl %esi
243 popl %ebp
244 ret
245.RC5_32_encrypt_end:
246 SIZE(RC5_32_encrypt,.RC5_32_encrypt_end-RC5_32_encrypt)
247.ident "desasm.pl"
248.text
249 .align ALIGN
250.globl RC5_32_decrypt
251 TYPE(RC5_32_decrypt,@function)
252RC5_32_decrypt:
253
254 pushl %ebp
255 pushl %esi
256 pushl %edi
257 movl 16(%esp), %edx
258 movl 20(%esp), %ebp
259 /* Load the 2 words */
260 movl (%edx), %edi
261 movl 4(%edx), %esi
262 pushl %ebx
263 movl (%ebp), %ebx
264 cmpl $12, %ebx
265 je .L001rc5_dec_12
266 cmpl $8, %ebx
267 je .L002rc5_dec_8
268 movl 136(%ebp), %eax
269 subl %eax, %esi
270 movl %edi, %ecx
271 rorl %cl, %esi
272 xorl %edi, %esi
273 movl 132(%ebp), %eax
274 subl %eax, %edi
275 movl %esi, %ecx
276 rorl %cl, %edi
277 xorl %esi, %edi
278 movl 128(%ebp), %eax
279 subl %eax, %esi
280 movl %edi, %ecx
281 rorl %cl, %esi
282 xorl %edi, %esi
283 movl 124(%ebp), %eax
284 subl %eax, %edi
285 movl %esi, %ecx
286 rorl %cl, %edi
287 xorl %esi, %edi
288 movl 120(%ebp), %eax
289 subl %eax, %esi
290 movl %edi, %ecx
291 rorl %cl, %esi
292 xorl %edi, %esi
293 movl 116(%ebp), %eax
294 subl %eax, %edi
295 movl %esi, %ecx
296 rorl %cl, %edi
297 xorl %esi, %edi
298 movl 112(%ebp), %eax
299 subl %eax, %esi
300 movl %edi, %ecx
301 rorl %cl, %esi
302 xorl %edi, %esi
303 movl 108(%ebp), %eax
304 subl %eax, %edi
305 movl %esi, %ecx
306 rorl %cl, %edi
307 xorl %esi, %edi
308.L001rc5_dec_12:
309 movl 104(%ebp), %eax
310 subl %eax, %esi
311 movl %edi, %ecx
312 rorl %cl, %esi
313 xorl %edi, %esi
314 movl 100(%ebp), %eax
315 subl %eax, %edi
316 movl %esi, %ecx
317 rorl %cl, %edi
318 xorl %esi, %edi
319 movl 96(%ebp), %eax
320 subl %eax, %esi
321 movl %edi, %ecx
322 rorl %cl, %esi
323 xorl %edi, %esi
324 movl 92(%ebp), %eax
325 subl %eax, %edi
326 movl %esi, %ecx
327 rorl %cl, %edi
328 xorl %esi, %edi
329 movl 88(%ebp), %eax
330 subl %eax, %esi
331 movl %edi, %ecx
332 rorl %cl, %esi
333 xorl %edi, %esi
334 movl 84(%ebp), %eax
335 subl %eax, %edi
336 movl %esi, %ecx
337 rorl %cl, %edi
338 xorl %esi, %edi
339 movl 80(%ebp), %eax
340 subl %eax, %esi
341 movl %edi, %ecx
342 rorl %cl, %esi
343 xorl %edi, %esi
344 movl 76(%ebp), %eax
345 subl %eax, %edi
346 movl %esi, %ecx
347 rorl %cl, %edi
348 xorl %esi, %edi
349.L002rc5_dec_8:
350 movl 72(%ebp), %eax
351 subl %eax, %esi
352 movl %edi, %ecx
353 rorl %cl, %esi
354 xorl %edi, %esi
355 movl 68(%ebp), %eax
356 subl %eax, %edi
357 movl %esi, %ecx
358 rorl %cl, %edi
359 xorl %esi, %edi
360 movl 64(%ebp), %eax
361 subl %eax, %esi
362 movl %edi, %ecx
363 rorl %cl, %esi
364 xorl %edi, %esi
365 movl 60(%ebp), %eax
366 subl %eax, %edi
367 movl %esi, %ecx
368 rorl %cl, %edi
369 xorl %esi, %edi
370 movl 56(%ebp), %eax
371 subl %eax, %esi
372 movl %edi, %ecx
373 rorl %cl, %esi
374 xorl %edi, %esi
375 movl 52(%ebp), %eax
376 subl %eax, %edi
377 movl %esi, %ecx
378 rorl %cl, %edi
379 xorl %esi, %edi
380 movl 48(%ebp), %eax
381 subl %eax, %esi
382 movl %edi, %ecx
383 rorl %cl, %esi
384 xorl %edi, %esi
385 movl 44(%ebp), %eax
386 subl %eax, %edi
387 movl %esi, %ecx
388 rorl %cl, %edi
389 xorl %esi, %edi
390 movl 40(%ebp), %eax
391 subl %eax, %esi
392 movl %edi, %ecx
393 rorl %cl, %esi
394 xorl %edi, %esi
395 movl 36(%ebp), %eax
396 subl %eax, %edi
397 movl %esi, %ecx
398 rorl %cl, %edi
399 xorl %esi, %edi
400 movl 32(%ebp), %eax
401 subl %eax, %esi
402 movl %edi, %ecx
403 rorl %cl, %esi
404 xorl %edi, %esi
405 movl 28(%ebp), %eax
406 subl %eax, %edi
407 movl %esi, %ecx
408 rorl %cl, %edi
409 xorl %esi, %edi
410 movl 24(%ebp), %eax
411 subl %eax, %esi
412 movl %edi, %ecx
413 rorl %cl, %esi
414 xorl %edi, %esi
415 movl 20(%ebp), %eax
416 subl %eax, %edi
417 movl %esi, %ecx
418 rorl %cl, %edi
419 xorl %esi, %edi
420 movl 16(%ebp), %eax
421 subl %eax, %esi
422 movl %edi, %ecx
423 rorl %cl, %esi
424 xorl %edi, %esi
425 movl 12(%ebp), %eax
426 subl %eax, %edi
427 movl %esi, %ecx
428 rorl %cl, %edi
429 xorl %esi, %edi
430 subl 8(%ebp), %esi
431 subl 4(%ebp), %edi
432.L003rc5_exit:
433 movl %edi, (%edx)
434 movl %esi, 4(%edx)
435 popl %ebx
436 popl %edi
437 popl %esi
438 popl %ebp
439 ret
440.RC5_32_decrypt_end:
441 SIZE(RC5_32_decrypt,.RC5_32_decrypt_end-RC5_32_decrypt)
442.ident "desasm.pl"
443.text
444 .align ALIGN
445.globl RC5_32_cbc_encrypt
446 TYPE(RC5_32_cbc_encrypt,@function)
447RC5_32_cbc_encrypt:
448
449 pushl %ebp
450 pushl %ebx
451 pushl %esi
452 pushl %edi
453 movl 28(%esp), %ebp
454 /* getting iv ptr from parameter 4 */
455 movl 36(%esp), %ebx
456 movl (%ebx), %esi
457 movl 4(%ebx), %edi
458 pushl %edi
459 pushl %esi
460 pushl %edi
461 pushl %esi
462 movl %esp, %ebx
463 movl 36(%esp), %esi
464 movl 40(%esp), %edi
465 /* getting encrypt flag from parameter 5 */
466 movl 56(%esp), %ecx
467 /* get and push parameter 3 */
468 movl 48(%esp), %eax
469 pushl %eax
470 pushl %ebx
471 cmpl $0, %ecx
472 jz .L004decrypt
473 andl $4294967288, %ebp
474 movl 8(%esp), %eax
475 movl 12(%esp), %ebx
476 jz .L005encrypt_finish
477.L006encrypt_loop:
478 movl (%esi), %ecx
479 movl 4(%esi), %edx
480 xorl %ecx, %eax
481 xorl %edx, %ebx
482 movl %eax, 8(%esp)
483 movl %ebx, 12(%esp)
484 call RC5_32_encrypt
485 movl 8(%esp), %eax
486 movl 12(%esp), %ebx
487 movl %eax, (%edi)
488 movl %ebx, 4(%edi)
489 addl $8, %esi
490 addl $8, %edi
491 subl $8, %ebp
492 jnz .L006encrypt_loop
493.L005encrypt_finish:
494 movl 52(%esp), %ebp
495 andl $7, %ebp
496 jz .L007finish
497 xorl %ecx, %ecx
498 xorl %edx, %edx
499 movl .L008cbc_enc_jmp_table(,%ebp,4),%ebp
500 jmp *%ebp
501.L009ej7:
502 movb 6(%esi), %dh
503 sall $8, %edx
504.L010ej6:
505 movb 5(%esi), %dh
506.L011ej5:
507 movb 4(%esi), %dl
508.L012ej4:
509 movl (%esi), %ecx
510 jmp .L013ejend
511.L014ej3:
512 movb 2(%esi), %ch
513 sall $8, %ecx
514.L015ej2:
515 movb 1(%esi), %ch
516.L016ej1:
517 movb (%esi), %cl
518.L013ejend:
519 xorl %ecx, %eax
520 xorl %edx, %ebx
521 movl %eax, 8(%esp)
522 movl %ebx, 12(%esp)
523 call RC5_32_encrypt
524 movl 8(%esp), %eax
525 movl 12(%esp), %ebx
526 movl %eax, (%edi)
527 movl %ebx, 4(%edi)
528 jmp .L007finish
529.align ALIGN
530.L004decrypt:
531 andl $4294967288, %ebp
532 movl 16(%esp), %eax
533 movl 20(%esp), %ebx
534 jz .L017decrypt_finish
535.L018decrypt_loop:
536 movl (%esi), %eax
537 movl 4(%esi), %ebx
538 movl %eax, 8(%esp)
539 movl %ebx, 12(%esp)
540 call RC5_32_decrypt
541 movl 8(%esp), %eax
542 movl 12(%esp), %ebx
543 movl 16(%esp), %ecx
544 movl 20(%esp), %edx
545 xorl %eax, %ecx
546 xorl %ebx, %edx
547 movl (%esi), %eax
548 movl 4(%esi), %ebx
549 movl %ecx, (%edi)
550 movl %edx, 4(%edi)
551 movl %eax, 16(%esp)
552 movl %ebx, 20(%esp)
553 addl $8, %esi
554 addl $8, %edi
555 subl $8, %ebp
556 jnz .L018decrypt_loop
557.L017decrypt_finish:
558 movl 52(%esp), %ebp
559 andl $7, %ebp
560 jz .L007finish
561 movl (%esi), %eax
562 movl 4(%esi), %ebx
563 movl %eax, 8(%esp)
564 movl %ebx, 12(%esp)
565 call RC5_32_decrypt
566 movl 8(%esp), %eax
567 movl 12(%esp), %ebx
568 movl 16(%esp), %ecx
569 movl 20(%esp), %edx
570 xorl %eax, %ecx
571 xorl %ebx, %edx
572 movl (%esi), %eax
573 movl 4(%esi), %ebx
574.L019dj7:
575 rorl $16, %edx
576 movb %dl, 6(%edi)
577 shrl $16, %edx
578.L020dj6:
579 movb %dh, 5(%edi)
580.L021dj5:
581 movb %dl, 4(%edi)
582.L022dj4:
583 movl %ecx, (%edi)
584 jmp .L023djend
585.L024dj3:
586 rorl $16, %ecx
587 movb %cl, 2(%edi)
588 sall $16, %ecx
589.L025dj2:
590 movb %ch, 1(%esi)
591.L026dj1:
592 movb %cl, (%esi)
593.L023djend:
594 jmp .L007finish
595.align ALIGN
596.L007finish:
597 movl 60(%esp), %ecx
598 addl $24, %esp
599 movl %eax, (%ecx)
600 movl %ebx, 4(%ecx)
601 popl %edi
602 popl %esi
603 popl %ebx
604 popl %ebp
605 ret
606.align ALIGN
607.L008cbc_enc_jmp_table:
608 .long 0
609 .long .L016ej1
610 .long .L015ej2
611 .long .L014ej3
612 .long .L012ej4
613 .long .L011ej5
614 .long .L010ej6
615 .long .L009ej7
616.align ALIGN
617.L027cbc_dec_jmp_table:
618 .long 0
619 .long .L026dj1
620 .long .L025dj2
621 .long .L024dj3
622 .long .L022dj4
623 .long .L021dj5
624 .long .L020dj6
625 .long .L019dj7
626.RC5_32_cbc_encrypt_end:
627 SIZE(RC5_32_cbc_encrypt,.RC5_32_cbc_encrypt_end-RC5_32_cbc_encrypt)
628.ident "desasm.pl"
diff --git a/src/lib/libcrypto/rc5/asm/rc5-586.pl b/src/lib/libcrypto/rc5/asm/rc5-586.pl
new file mode 100644
index 0000000000..172bd9ee1b
--- /dev/null
+++ b/src/lib/libcrypto/rc5/asm/rc5-586.pl
@@ -0,0 +1,109 @@
1#!/usr/bin/perl
2
3push(@INC,"perlasm","../../perlasm");
4require "x86asm.pl";
5require "cbc.pl";
6
7&asm_init($ARGV[0],"rc5-586.pl");
8
9$RC5_MAX_ROUNDS=16;
10$RC5_32_OFF=($RC5_MAX_ROUNDS+2)*4;
11$A="edi";
12$B="esi";
13$S="ebp";
14$tmp1="eax";
15$r="ebx";
16$tmpc="ecx";
17$tmp4="edx";
18
19&RC5_32_encrypt("RC5_32_encrypt",1);
20&RC5_32_encrypt("RC5_32_decrypt",0);
21&cbc("RC5_32_cbc_encrypt","RC5_32_encrypt","RC5_32_decrypt",0,4,5,3,-1,-1);
22&asm_finish();
23
24sub RC5_32_encrypt
25 {
26 local($name,$enc)=@_;
27
28 &function_begin_B($name,"");
29
30 &comment("");
31
32 &push("ebp");
33 &push("esi");
34 &push("edi");
35 &mov($tmp4,&wparam(0));
36 &mov($S,&wparam(1));
37
38 &comment("Load the 2 words");
39 &mov($A,&DWP(0,$tmp4,"",0));
40 &mov($B,&DWP(4,$tmp4,"",0));
41
42 &push($r);
43 &mov($r, &DWP(0,$S,"",0));
44
45 # encrypting part
46
47 if ($enc)
48 {
49 &add($A, &DWP(4+0,$S,"",0));
50 &add($B, &DWP(4+4,$S,"",0));
51
52 for ($i=0; $i<$RC5_MAX_ROUNDS; $i++)
53 {
54 &xor($A, $B);
55 &mov($tmp1, &DWP(12+$i*8,$S,"",0));
56 &mov($tmpc, $B);
57 &rotl($A, &LB("ecx"));
58 &add($A, $tmp1);
59
60 &xor($B, $A);
61 &mov($tmp1, &DWP(16+$i*8,$S,"",0));
62 &mov($tmpc, $A);
63 &rotl($B, &LB("ecx"));
64 &add($B, $tmp1);
65 if (($i == 7) || ($i == 11))
66 {
67 &cmp($r, $i+1);
68 &je(&label("rc5_exit"));
69 }
70 }
71 }
72 else
73 {
74 &cmp($r, 12);
75 &je(&label("rc5_dec_12"));
76 &cmp($r, 8);
77 &je(&label("rc5_dec_8"));
78 for ($i=$RC5_MAX_ROUNDS; $i > 0; $i--)
79 {
80 &set_label("rc5_dec_$i") if ($i == 12) || ($i == 8);
81 &mov($tmp1, &DWP($i*8+8,$S,"",0));
82 &sub($B, $tmp1);
83 &mov($tmpc, $A);
84 &rotr($B, &LB("ecx"));
85 &xor($B, $A);
86
87 &mov($tmp1, &DWP($i*8+4,$S,"",0));
88 &sub($A, $tmp1);
89 &mov($tmpc, $B);
90 &rotr($A, &LB("ecx"));
91 &xor($A, $B);
92 }
93 &sub($B, &DWP(4+4,$S,"",0));
94 &sub($A, &DWP(4+0,$S,"",0));
95 }
96
97 &set_label("rc5_exit");
98 &mov(&DWP(0,$tmp4,"",0),$A);
99 &mov(&DWP(4,$tmp4,"",0),$B);
100
101 &pop("ebx");
102 &pop("edi");
103 &pop("esi");
104 &pop("ebp");
105 &ret();
106 &function_end_B($name);
107 }
108
109