summaryrefslogtreecommitdiffstats
path: root/crypto/rc5
diff options
context:
space:
mode:
authorRalf S. Engelschall <rse@openssl.org>1998-12-21 10:56:39 +0000
committerRalf S. Engelschall <rse@openssl.org>1998-12-21 10:56:39 +0000
commit58964a492275ca9a59a0cd9c8155cb2491b4b909 (patch)
treec7b16876a5789463bbbb468ef4829c8129b3d718 /crypto/rc5
parentd02b48c63a58ea4367a0e905979f140b7d090f86 (diff)
Import of old SSLeay release: SSLeay 0.9.0b
Diffstat (limited to 'crypto/rc5')
-rw-r--r--crypto/rc5/Makefile.ssl107
-rw-r--r--crypto/rc5/Makefile.uni72
-rw-r--r--crypto/rc5/asm/r5-win32.asm574
-rw-r--r--crypto/rc5/asm/r586unix.cpp628
-rw-r--r--crypto/rc5/asm/rc5-586.pl109
-rw-r--r--crypto/rc5/rc5.h122
-rw-r--r--crypto/rc5/rc5_ecb.c82
-rw-r--r--crypto/rc5/rc5_enc.c223
-rw-r--r--crypto/rc5/rc5_locl.h187
-rw-r--r--crypto/rc5/rc5_skey.c116
-rw-r--r--crypto/rc5/rc5cfb64.c127
-rw-r--r--crypto/rc5/rc5ofb64.c115
-rw-r--r--crypto/rc5/rc5s.cpp70
-rw-r--r--crypto/rc5/rc5speed.c293
-rw-r--r--crypto/rc5/rc5test.c379
15 files changed, 3204 insertions, 0 deletions
diff --git a/crypto/rc5/Makefile.ssl b/crypto/rc5/Makefile.ssl
new file mode 100644
index 0000000000..5e98ee2348
--- /dev/null
+++ b/crypto/rc5/Makefile.ssl
@@ -0,0 +1,107 @@
+#
+# SSLeay/crypto/rc5/Makefile
+#
+
+DIR= rc5
+TOP= ../..
+CC= cc
+CPP= $(CC) -E
+INCLUDES=
+CFLAG=-g
+INSTALLTOP=/usr/local/ssl
+MAKE= make -f Makefile.ssl
+MAKEDEPEND= makedepend -f Makefile.ssl
+MAKEFILE= Makefile.ssl
+AR= ar r
+
+RC5_ENC= rc5_enc.o
+# or use
+#DES_ENC= r586-elf.o
+
+CFLAGS= $(INCLUDES) $(CFLAG)
+
+GENERAL=Makefile
+TEST=rc5test.c
+APPS=
+
+LIB=$(TOP)/libcrypto.a
+LIBSRC=rc5_skey.c rc5_ecb.c rc5_enc.c rc5cfb64.c rc5ofb64.c
+LIBOBJ=rc5_skey.o rc5_ecb.o $(RC5_ENC) rc5cfb64.o rc5ofb64.o
+
+SRC= $(LIBSRC)
+
+EXHEADER= rc5.h
+HEADER= rc5_locl.h $(EXHEADER)
+
+ALL= $(GENERAL) $(SRC) $(HEADER)
+
+top:
+ (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
+
+all: lib
+
+lib: $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
+ sh $(TOP)/util/ranlib.sh $(LIB)
+ @touch lib
+
+# elf
+asm/r586-elf.o: asm/r586unix.cpp
+ $(CPP) -DELF asm/r586unix.cpp | as -o asm/r586-elf.o
+
+# solaris
+asm/r586-sol.o: asm/r586unix.cpp
+ $(CC) -E -DSOL asm/r586unix.cpp | sed 's/^#.*//' > asm/r586-sol.s
+ as -o asm/r586-sol.o asm/r586-sol.s
+ rm -f asm/r586-sol.s
+
+# a.out
+asm/r586-out.o: asm/r586unix.cpp
+ $(CPP) -DOUT asm/r586unix.cpp | as -o asm/r586-out.o
+
+# bsdi
+asm/r586bsdi.o: asm/r586unix.cpp
+ $(CPP) -DBSDI asm/r586unix.cpp | as -o asm/r586bsdi.o
+
+asm/r586unix.cpp:
+ (cd asm; perl rc5-586.pl cpp >r586unix.cpp)
+
+files:
+ perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
+
+links:
+ /bin/rm -f Makefile
+ $(TOP)/util/point.sh Makefile.ssl Makefile ;
+ $(TOP)/util/point.sh ../../doc/rc5.doc rc5.doc ;
+ $(TOP)/util/mklink.sh ../../include $(EXHEADER)
+ $(TOP)/util/mklink.sh ../../test $(TEST)
+ $(TOP)/util/mklink.sh ../../apps $(APPS)
+
+install:
+ @for i in $(EXHEADER) ; \
+ do \
+ (cp $$i $(INSTALLTOP)/include/$$i; \
+ chmod 644 $(INSTALLTOP)/include/$$i ); \
+ done;
+
+tags:
+ ctags $(SRC)
+
+tests:
+
+lint:
+ lint -DLINT $(INCLUDES) $(SRC)>fluff
+
+depend:
+ $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC)
+
+dclean:
+ perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
+ mv -f Makefile.new $(MAKEFILE)
+
+clean:
+ /bin/rm -f *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
+
+errors:
+
+# DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/crypto/rc5/Makefile.uni b/crypto/rc5/Makefile.uni
new file mode 100644
index 0000000000..e50b3f2d19
--- /dev/null
+++ b/crypto/rc5/Makefile.uni
@@ -0,0 +1,72 @@
+# Targets
+# make - twidle the options yourself :-)
+# make cc - standard cc options
+# make gcc - standard gcc options
+
+DIR= rc2
+TOP= .
+CC= gcc
+CFLAG= -O3 -fomit-frame-pointer
+
+CPP= $(CC) -E
+INCLUDES=
+INSTALLTOP=/usr/local/lib
+MAKE= make
+MAKEDEPEND= makedepend
+MAKEFILE= Makefile.uni
+AR= ar r
+
+IDEA_ENC=rc2_cbc.o
+
+CFLAGS= $(INCLUDES) $(CFLAG)
+
+GENERAL=Makefile
+TEST=rc2test
+APPS=rc2speed
+
+LIB=librc2.a
+LIBSRC=rc2_skey.c rc2_ecb.c rc2_cbc.c rc2cfb64.c rc2ofb64.c
+LIBOBJ=rc2_skey.o rc2_ecb.o $(IDEA_ENC) rc2cfb64.o rc2ofb64.o
+
+SRC= $(LIBSRC)
+
+EXHEADER= rc2.h
+HEADER= rc2_locl.h $(EXHEADER)
+
+ALL= $(GENERAL) $(SRC) $(HEADER)
+
+all: $(LIB) $(TEST) $(APPS)
+
+$(LIB): $(LIBOBJ)
+ $(AR) $(LIB) $(LIBOBJ)
+ sh $(TOP)/ranlib.sh $(LIB)
+
+test: $(TEST)
+ ./$(TEST)
+
+$(TEST): $(TEST).c $(LIB)
+ $(CC) -o $(TEST) $(CFLAGS) $(TEST).c $(LIB)
+
+$(APPS): $(APPS).c $(LIB)
+ $(CC) -o $(APPS) $(CFLAGS) $(APPS).c $(LIB)
+
+lint:
+ lint -DLINT $(INCLUDES) $(SRC)>fluff
+
+depend:
+ $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC)
+
+dclean:
+ perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
+ mv -f Makefile.new $(MAKEFILE)
+
+clean:
+ /bin/rm -f $(LIB) $(TEST) $(APPS) *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
+
+cc:
+ $(MAKE) CC="cc" CFLAG="-O" all
+
+gcc:
+ $(MAKE) CC="gcc" CFLAGS="-O3 -fomit-frame-pointer" all
+
+# DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/crypto/rc5/asm/r5-win32.asm b/crypto/rc5/asm/r5-win32.asm
new file mode 100644
index 0000000000..f43d3711f0
--- /dev/null
+++ b/crypto/rc5/asm/r5-win32.asm
@@ -0,0 +1,574 @@
+ ; Don't even think of reading this code
+ ; It was automatically generated by rc5-586.pl
+ ; Which is a perl program used to generate the x86 assember for
+ ; any of elf, a.out, BSDI,Win32, or Solaris
+ ; eric <eay@cryptsoft.com>
+ ;
+ TITLE rc5-586.asm
+ .386
+.model FLAT
+_TEXT SEGMENT
+PUBLIC _RC5_32_encrypt
+
+_RC5_32_encrypt PROC NEAR
+ ;
+ push ebp
+ push esi
+ push edi
+ mov edx, DWORD PTR 16[esp]
+ mov ebp, DWORD PTR 20[esp]
+ ; Load the 2 words
+ mov edi, DWORD PTR [edx]
+ mov esi, DWORD PTR 4[edx]
+ push ebx
+ mov ebx, DWORD PTR [ebp]
+ add edi, DWORD PTR 4[ebp]
+ add esi, DWORD PTR 8[ebp]
+ xor edi, esi
+ mov eax, DWORD PTR 12[ebp]
+ mov ecx, esi
+ rol edi, cl
+ add edi, eax
+ xor esi, edi
+ mov eax, DWORD PTR 16[ebp]
+ mov ecx, edi
+ rol esi, cl
+ add esi, eax
+ xor edi, esi
+ mov eax, DWORD PTR 20[ebp]
+ mov ecx, esi
+ rol edi, cl
+ add edi, eax
+ xor esi, edi
+ mov eax, DWORD PTR 24[ebp]
+ mov ecx, edi
+ rol esi, cl
+ add esi, eax
+ xor edi, esi
+ mov eax, DWORD PTR 28[ebp]
+ mov ecx, esi
+ rol edi, cl
+ add edi, eax
+ xor esi, edi
+ mov eax, DWORD PTR 32[ebp]
+ mov ecx, edi
+ rol esi, cl
+ add esi, eax
+ xor edi, esi
+ mov eax, DWORD PTR 36[ebp]
+ mov ecx, esi
+ rol edi, cl
+ add edi, eax
+ xor esi, edi
+ mov eax, DWORD PTR 40[ebp]
+ mov ecx, edi
+ rol esi, cl
+ add esi, eax
+ xor edi, esi
+ mov eax, DWORD PTR 44[ebp]
+ mov ecx, esi
+ rol edi, cl
+ add edi, eax
+ xor esi, edi
+ mov eax, DWORD PTR 48[ebp]
+ mov ecx, edi
+ rol esi, cl
+ add esi, eax
+ xor edi, esi
+ mov eax, DWORD PTR 52[ebp]
+ mov ecx, esi
+ rol edi, cl
+ add edi, eax
+ xor esi, edi
+ mov eax, DWORD PTR 56[ebp]
+ mov ecx, edi
+ rol esi, cl
+ add esi, eax
+ xor edi, esi
+ mov eax, DWORD PTR 60[ebp]
+ mov ecx, esi
+ rol edi, cl
+ add edi, eax
+ xor esi, edi
+ mov eax, DWORD PTR 64[ebp]
+ mov ecx, edi
+ rol esi, cl
+ add esi, eax
+ xor edi, esi
+ mov eax, DWORD PTR 68[ebp]
+ mov ecx, esi
+ rol edi, cl
+ add edi, eax
+ xor esi, edi
+ mov eax, DWORD PTR 72[ebp]
+ mov ecx, edi
+ rol esi, cl
+ add esi, eax
+ cmp ebx, 8
+ je $L000rc5_exit
+ xor edi, esi
+ mov eax, DWORD PTR 76[ebp]
+ mov ecx, esi
+ rol edi, cl
+ add edi, eax
+ xor esi, edi
+ mov eax, DWORD PTR 80[ebp]
+ mov ecx, edi
+ rol esi, cl
+ add esi, eax
+ xor edi, esi
+ mov eax, DWORD PTR 84[ebp]
+ mov ecx, esi
+ rol edi, cl
+ add edi, eax
+ xor esi, edi
+ mov eax, DWORD PTR 88[ebp]
+ mov ecx, edi
+ rol esi, cl
+ add esi, eax
+ xor edi, esi
+ mov eax, DWORD PTR 92[ebp]
+ mov ecx, esi
+ rol edi, cl
+ add edi, eax
+ xor esi, edi
+ mov eax, DWORD PTR 96[ebp]
+ mov ecx, edi
+ rol esi, cl
+ add esi, eax
+ xor edi, esi
+ mov eax, DWORD PTR 100[ebp]
+ mov ecx, esi
+ rol edi, cl
+ add edi, eax
+ xor esi, edi
+ mov eax, DWORD PTR 104[ebp]
+ mov ecx, edi
+ rol esi, cl
+ add esi, eax
+ cmp ebx, 12
+ je $L000rc5_exit
+ xor edi, esi
+ mov eax, DWORD PTR 108[ebp]
+ mov ecx, esi
+ rol edi, cl
+ add edi, eax
+ xor esi, edi
+ mov eax, DWORD PTR 112[ebp]
+ mov ecx, edi
+ rol esi, cl
+ add esi, eax
+ xor edi, esi
+ mov eax, DWORD PTR 116[ebp]
+ mov ecx, esi
+ rol edi, cl
+ add edi, eax
+ xor esi, edi
+ mov eax, DWORD PTR 120[ebp]
+ mov ecx, edi
+ rol esi, cl
+ add esi, eax
+ xor edi, esi
+ mov eax, DWORD PTR 124[ebp]
+ mov ecx, esi
+ rol edi, cl
+ add edi, eax
+ xor esi, edi
+ mov eax, DWORD PTR 128[ebp]
+ mov ecx, edi
+ rol esi, cl
+ add esi, eax
+ xor edi, esi
+ mov eax, DWORD PTR 132[ebp]
+ mov ecx, esi
+ rol edi, cl
+ add edi, eax
+ xor esi, edi
+ mov eax, DWORD PTR 136[ebp]
+ mov ecx, edi
+ rol esi, cl
+ add esi, eax
+$L000rc5_exit:
+ mov DWORD PTR [edx],edi
+ mov DWORD PTR 4[edx],esi
+ pop ebx
+ pop edi
+ pop esi
+ pop ebp
+ ret
+_RC5_32_encrypt ENDP
+_TEXT ENDS
+_TEXT SEGMENT
+PUBLIC _RC5_32_decrypt
+
+_RC5_32_decrypt PROC NEAR
+ ;
+ push ebp
+ push esi
+ push edi
+ mov edx, DWORD PTR 16[esp]
+ mov ebp, DWORD PTR 20[esp]
+ ; Load the 2 words
+ mov edi, DWORD PTR [edx]
+ mov esi, DWORD PTR 4[edx]
+ push ebx
+ mov ebx, DWORD PTR [ebp]
+ cmp ebx, 12
+ je $L001rc5_dec_12
+ cmp ebx, 8
+ je $L002rc5_dec_8
+ mov eax, DWORD PTR 136[ebp]
+ sub esi, eax
+ mov ecx, edi
+ ror esi, cl
+ xor esi, edi
+ mov eax, DWORD PTR 132[ebp]
+ sub edi, eax
+ mov ecx, esi
+ ror edi, cl
+ xor edi, esi
+ mov eax, DWORD PTR 128[ebp]
+ sub esi, eax
+ mov ecx, edi
+ ror esi, cl
+ xor esi, edi
+ mov eax, DWORD PTR 124[ebp]
+ sub edi, eax
+ mov ecx, esi
+ ror edi, cl
+ xor edi, esi
+ mov eax, DWORD PTR 120[ebp]
+ sub esi, eax
+ mov ecx, edi
+ ror esi, cl
+ xor esi, edi
+ mov eax, DWORD PTR 116[ebp]
+ sub edi, eax
+ mov ecx, esi
+ ror edi, cl
+ xor edi, esi
+ mov eax, DWORD PTR 112[ebp]
+ sub esi, eax
+ mov ecx, edi
+ ror esi, cl
+ xor esi, edi
+ mov eax, DWORD PTR 108[ebp]
+ sub edi, eax
+ mov ecx, esi
+ ror edi, cl
+ xor edi, esi
+$L001rc5_dec_12:
+ mov eax, DWORD PTR 104[ebp]
+ sub esi, eax
+ mov ecx, edi
+ ror esi, cl
+ xor esi, edi
+ mov eax, DWORD PTR 100[ebp]
+ sub edi, eax
+ mov ecx, esi
+ ror edi, cl
+ xor edi, esi
+ mov eax, DWORD PTR 96[ebp]
+ sub esi, eax
+ mov ecx, edi
+ ror esi, cl
+ xor esi, edi
+ mov eax, DWORD PTR 92[ebp]
+ sub edi, eax
+ mov ecx, esi
+ ror edi, cl
+ xor edi, esi
+ mov eax, DWORD PTR 88[ebp]
+ sub esi, eax
+ mov ecx, edi
+ ror esi, cl
+ xor esi, edi
+ mov eax, DWORD PTR 84[ebp]
+ sub edi, eax
+ mov ecx, esi
+ ror edi, cl
+ xor edi, esi
+ mov eax, DWORD PTR 80[ebp]
+ sub esi, eax
+ mov ecx, edi
+ ror esi, cl
+ xor esi, edi
+ mov eax, DWORD PTR 76[ebp]
+ sub edi, eax
+ mov ecx, esi
+ ror edi, cl
+ xor edi, esi
+$L002rc5_dec_8:
+ mov eax, DWORD PTR 72[ebp]
+ sub esi, eax
+ mov ecx, edi
+ ror esi, cl
+ xor esi, edi
+ mov eax, DWORD PTR 68[ebp]
+ sub edi, eax
+ mov ecx, esi
+ ror edi, cl
+ xor edi, esi
+ mov eax, DWORD PTR 64[ebp]
+ sub esi, eax
+ mov ecx, edi
+ ror esi, cl
+ xor esi, edi
+ mov eax, DWORD PTR 60[ebp]
+ sub edi, eax
+ mov ecx, esi
+ ror edi, cl
+ xor edi, esi
+ mov eax, DWORD PTR 56[ebp]
+ sub esi, eax
+ mov ecx, edi
+ ror esi, cl
+ xor esi, edi
+ mov eax, DWORD PTR 52[ebp]
+ sub edi, eax
+ mov ecx, esi
+ ror edi, cl
+ xor edi, esi
+ mov eax, DWORD PTR 48[ebp]
+ sub esi, eax
+ mov ecx, edi
+ ror esi, cl
+ xor esi, edi
+ mov eax, DWORD PTR 44[ebp]
+ sub edi, eax
+ mov ecx, esi
+ ror edi, cl
+ xor edi, esi
+ mov eax, DWORD PTR 40[ebp]
+ sub esi, eax
+ mov ecx, edi
+ ror esi, cl
+ xor esi, edi
+ mov eax, DWORD PTR 36[ebp]
+ sub edi, eax
+ mov ecx, esi
+ ror edi, cl
+ xor edi, esi
+ mov eax, DWORD PTR 32[ebp]
+ sub esi, eax
+ mov ecx, edi
+ ror esi, cl
+ xor esi, edi
+ mov eax, DWORD PTR 28[ebp]
+ sub edi, eax
+ mov ecx, esi
+ ror edi, cl
+ xor edi, esi
+ mov eax, DWORD PTR 24[ebp]
+ sub esi, eax
+ mov ecx, edi
+ ror esi, cl
+ xor esi, edi
+ mov eax, DWORD PTR 20[ebp]
+ sub edi, eax
+ mov ecx, esi
+ ror edi, cl
+ xor edi, esi
+ mov eax, DWORD PTR 16[ebp]
+ sub esi, eax
+ mov ecx, edi
+ ror esi, cl
+ xor esi, edi
+ mov eax, DWORD PTR 12[ebp]
+ sub edi, eax
+ mov ecx, esi
+ ror edi, cl
+ xor edi, esi
+ sub esi, DWORD PTR 8[ebp]
+ sub edi, DWORD PTR 4[ebp]
+L003rc5_exit:
+ mov DWORD PTR [edx],edi
+ mov DWORD PTR 4[edx],esi
+ pop ebx
+ pop edi
+ pop esi
+ pop ebp
+ ret
+_RC5_32_decrypt ENDP
+_TEXT ENDS
+_TEXT SEGMENT
+PUBLIC _RC5_32_cbc_encrypt
+
+_RC5_32_cbc_encrypt PROC NEAR
+ ;
+ push ebp
+ push ebx
+ push esi
+ push edi
+ mov ebp, DWORD PTR 28[esp]
+ ; getting iv ptr from parameter 4
+ mov ebx, DWORD PTR 36[esp]
+ mov esi, DWORD PTR [ebx]
+ mov edi, DWORD PTR 4[ebx]
+ push edi
+ push esi
+ push edi
+ push esi
+ mov ebx, esp
+ mov esi, DWORD PTR 36[esp]
+ mov edi, DWORD PTR 40[esp]
+ ; getting encrypt flag from parameter 5
+ mov ecx, DWORD PTR 56[esp]
+ ; get and push parameter 3
+ mov eax, DWORD PTR 48[esp]
+ push eax
+ push ebx
+ cmp ecx, 0
+ jz $L004decrypt
+ and ebp, 4294967288
+ mov eax, DWORD PTR 8[esp]
+ mov ebx, DWORD PTR 12[esp]
+ jz $L005encrypt_finish
+L006encrypt_loop:
+ mov ecx, DWORD PTR [esi]
+ mov edx, DWORD PTR 4[esi]
+ xor eax, ecx
+ xor ebx, edx
+ mov DWORD PTR 8[esp],eax
+ mov DWORD PTR 12[esp],ebx
+ call _RC5_32_encrypt
+ mov eax, DWORD PTR 8[esp]
+ mov ebx, DWORD PTR 12[esp]
+ mov DWORD PTR [edi],eax
+ mov DWORD PTR 4[edi],ebx
+ add esi, 8
+ add edi, 8
+ sub ebp, 8
+ jnz L006encrypt_loop
+$L005encrypt_finish:
+ mov ebp, DWORD PTR 52[esp]
+ and ebp, 7
+ jz $L007finish
+ xor ecx, ecx
+ xor edx, edx
+ mov ebp, DWORD PTR $L008cbc_enc_jmp_table[ebp*4]
+ jmp ebp
+L009ej7:
+ mov dh, BYTE PTR 6[esi]
+ shl edx, 8
+L010ej6:
+ mov dh, BYTE PTR 5[esi]
+L011ej5:
+ mov dl, BYTE PTR 4[esi]
+L012ej4:
+ mov ecx, DWORD PTR [esi]
+ jmp $L013ejend
+L014ej3:
+ mov ch, BYTE PTR 2[esi]
+ shl ecx, 8
+L015ej2:
+ mov ch, BYTE PTR 1[esi]
+L016ej1:
+ mov cl, BYTE PTR [esi]
+$L013ejend:
+ xor eax, ecx
+ xor ebx, edx
+ mov DWORD PTR 8[esp],eax
+ mov DWORD PTR 12[esp],ebx
+ call _RC5_32_encrypt
+ mov eax, DWORD PTR 8[esp]
+ mov ebx, DWORD PTR 12[esp]
+ mov DWORD PTR [edi],eax
+ mov DWORD PTR 4[edi],ebx
+ jmp $L007finish
+$L004decrypt:
+ and ebp, 4294967288
+ mov eax, DWORD PTR 16[esp]
+ mov ebx, DWORD PTR 20[esp]
+ jz $L017decrypt_finish
+L018decrypt_loop:
+ mov eax, DWORD PTR [esi]
+ mov ebx, DWORD PTR 4[esi]
+ mov DWORD PTR 8[esp],eax
+ mov DWORD PTR 12[esp],ebx
+ call _RC5_32_decrypt
+ mov eax, DWORD PTR 8[esp]
+ mov ebx, DWORD PTR 12[esp]
+ mov ecx, DWORD PTR 16[esp]
+ mov edx, DWORD PTR 20[esp]
+ xor ecx, eax
+ xor edx, ebx
+ mov eax, DWORD PTR [esi]
+ mov ebx, DWORD PTR 4[esi]
+ mov DWORD PTR [edi],ecx
+ mov DWORD PTR 4[edi],edx
+ mov DWORD PTR 16[esp],eax
+ mov DWORD PTR 20[esp],ebx
+ add esi, 8
+ add edi, 8
+ sub ebp, 8
+ jnz L018decrypt_loop
+$L017decrypt_finish:
+ mov ebp, DWORD PTR 52[esp]
+ and ebp, 7
+ jz $L007finish
+ mov eax, DWORD PTR [esi]
+ mov ebx, DWORD PTR 4[esi]
+ mov DWORD PTR 8[esp],eax
+ mov DWORD PTR 12[esp],ebx
+ call _RC5_32_decrypt
+ mov eax, DWORD PTR 8[esp]
+ mov ebx, DWORD PTR 12[esp]
+ mov ecx, DWORD PTR 16[esp]
+ mov edx, DWORD PTR 20[esp]
+ xor ecx, eax
+ xor edx, ebx
+ mov eax, DWORD PTR [esi]
+ mov ebx, DWORD PTR 4[esi]
+L019dj7:
+ ror edx, 16
+ mov BYTE PTR 6[edi],dl
+ shr edx, 16
+L020dj6:
+ mov BYTE PTR 5[edi],dh
+L021dj5:
+ mov BYTE PTR 4[edi],dl
+L022dj4:
+ mov DWORD PTR [edi],ecx
+ jmp $L023djend
+L024dj3:
+ ror ecx, 16
+ mov BYTE PTR 2[edi],cl
+ shl ecx, 16
+L025dj2:
+ mov BYTE PTR 1[esi],ch
+L026dj1:
+ mov BYTE PTR [esi], cl
+$L023djend:
+ jmp $L007finish
+$L007finish:
+ mov ecx, DWORD PTR 60[esp]
+ add esp, 24
+ mov DWORD PTR [ecx],eax
+ mov DWORD PTR 4[ecx],ebx
+ pop edi
+ pop esi
+ pop ebx
+ pop ebp
+ ret
+$L008cbc_enc_jmp_table:
+ DD 0
+ DD L016ej1
+ DD L015ej2
+ DD L014ej3
+ DD L012ej4
+ DD L011ej5
+ DD L010ej6
+ DD L009ej7
+L027cbc_dec_jmp_table:
+ DD 0
+ DD L026dj1
+ DD L025dj2
+ DD L024dj3
+ DD L022dj4
+ DD L021dj5
+ DD L020dj6
+ DD L019dj7
+_RC5_32_cbc_encrypt ENDP
+_TEXT ENDS
+END
diff --git a/crypto/rc5/asm/r586unix.cpp b/crypto/rc5/asm/r586unix.cpp
new file mode 100644
index 0000000000..a25dd5a9a4
--- /dev/null
+++ b/crypto/rc5/asm/r586unix.cpp
@@ -0,0 +1,628 @@
+/* Run the C pre-processor over this file with one of the following defined
+ * ELF - elf object files,
+ * OUT - a.out object files,
+ * BSDI - BSDI style a.out object files
+ * SOL - Solaris style elf
+ */
+
+#define TYPE(a,b) .type a,b
+#define SIZE(a,b) .size a,b
+
+#if defined(OUT) || defined(BSDI)
+#define RC5_32_encrypt _RC5_32_encrypt
+#define RC5_32_decrypt _RC5_32_decrypt
+#define RC5_32_cbc_encrypt _RC5_32_cbc_encrypt
+
+#endif
+
+#ifdef OUT
+#define OK 1
+#define ALIGN 4
+#endif
+
+#ifdef BSDI
+#define OK 1
+#define ALIGN 4
+#undef SIZE
+#undef TYPE
+#define SIZE(a,b)
+#define TYPE(a,b)
+#endif
+
+#if defined(ELF) || defined(SOL)
+#define OK 1
+#define ALIGN 16
+#endif
+
+#ifndef OK
+You need to define one of
+ELF - elf systems - linux-elf, NetBSD and DG-UX
+OUT - a.out systems - linux-a.out and FreeBSD
+SOL - solaris systems, which are elf with strange comment lines
+BSDI - a.out with a very primative version of as.
+#endif
+
+/* Let the Assembler begin :-) */
+ /* Don't even think of reading this code */
+ /* It was automatically generated by rc5-586.pl */
+ /* Which is a perl program used to generate the x86 assember for */
+ /* any of elf, a.out, BSDI,Win32, or Solaris */
+ /* eric <eay@cryptsoft.com> */
+
+ .file "rc5-586.s"
+ .version "01.01"
+gcc2_compiled.:
+.text
+ .align ALIGN
+.globl RC5_32_encrypt
+ TYPE(RC5_32_encrypt,@function)
+RC5_32_encrypt:
+
+ pushl %ebp
+ pushl %esi
+ pushl %edi
+ movl 16(%esp), %edx
+ movl 20(%esp), %ebp
+ /* Load the 2 words */
+ movl (%edx), %edi
+ movl 4(%edx), %esi
+ pushl %ebx
+ movl (%ebp), %ebx
+ addl 4(%ebp), %edi
+ addl 8(%ebp), %esi
+ xorl %esi, %edi
+ movl 12(%ebp), %eax
+ movl %esi, %ecx
+ roll %cl, %edi
+ addl %eax, %edi
+ xorl %edi, %esi
+ movl 16(%ebp), %eax
+ movl %edi, %ecx
+ roll %cl, %esi
+ addl %eax, %esi
+ xorl %esi, %edi
+ movl 20(%ebp), %eax
+ movl %esi, %ecx
+ roll %cl, %edi
+ addl %eax, %edi
+ xorl %edi, %esi
+ movl 24(%ebp), %eax
+ movl %edi, %ecx
+ roll %cl, %esi
+ addl %eax, %esi
+ xorl %esi, %edi
+ movl 28(%ebp), %eax
+ movl %esi, %ecx
+ roll %cl, %edi
+ addl %eax, %edi
+ xorl %edi, %esi
+ movl 32(%ebp), %eax
+ movl %edi, %ecx
+ roll %cl, %esi
+ addl %eax, %esi
+ xorl %esi, %edi
+ movl 36(%ebp), %eax
+ movl %esi, %ecx
+ roll %cl, %edi
+ addl %eax, %edi
+ xorl %edi, %esi
+ movl 40(%ebp), %eax
+ movl %edi, %ecx
+ roll %cl, %esi
+ addl %eax, %esi
+ xorl %esi, %edi
+ movl 44(%ebp), %eax
+ movl %esi, %ecx
+ roll %cl, %edi
+ addl %eax, %edi
+ xorl %edi, %esi
+ movl 48(%ebp), %eax
+ movl %edi, %ecx
+ roll %cl, %esi
+ addl %eax, %esi
+ xorl %esi, %edi
+ movl 52(%ebp), %eax
+ movl %esi, %ecx
+ roll %cl, %edi
+ addl %eax, %edi
+ xorl %edi, %esi
+ movl 56(%ebp), %eax
+ movl %edi, %ecx
+ roll %cl, %esi
+ addl %eax, %esi
+ xorl %esi, %edi
+ movl 60(%ebp), %eax
+ movl %esi, %ecx
+ roll %cl, %edi
+ addl %eax, %edi
+ xorl %edi, %esi
+ movl 64(%ebp), %eax
+ movl %edi, %ecx
+ roll %cl, %esi
+ addl %eax, %esi
+ xorl %esi, %edi
+ movl 68(%ebp), %eax
+ movl %esi, %ecx
+ roll %cl, %edi
+ addl %eax, %edi
+ xorl %edi, %esi
+ movl 72(%ebp), %eax
+ movl %edi, %ecx
+ roll %cl, %esi
+ addl %eax, %esi
+ cmpl $8, %ebx
+ je .L000rc5_exit
+ xorl %esi, %edi
+ movl 76(%ebp), %eax
+ movl %esi, %ecx
+ roll %cl, %edi
+ addl %eax, %edi
+ xorl %edi, %esi
+ movl 80(%ebp), %eax
+ movl %edi, %ecx
+ roll %cl, %esi
+ addl %eax, %esi
+ xorl %esi, %edi
+ movl 84(%ebp), %eax
+ movl %esi, %ecx
+ roll %cl, %edi
+ addl %eax, %edi
+ xorl %edi, %esi
+ movl 88(%ebp), %eax
+ movl %edi, %ecx
+ roll %cl, %esi
+ addl %eax, %esi
+ xorl %esi, %edi
+ movl 92(%ebp), %eax
+ movl %esi, %ecx
+ roll %cl, %edi
+ addl %eax, %edi
+ xorl %edi, %esi
+ movl 96(%ebp), %eax
+ movl %edi, %ecx
+ roll %cl, %esi
+ addl %eax, %esi
+ xorl %esi, %edi
+ movl 100(%ebp), %eax
+ movl %esi, %ecx
+ roll %cl, %edi
+ addl %eax, %edi
+ xorl %edi, %esi
+ movl 104(%ebp), %eax
+ movl %edi, %ecx
+ roll %cl, %esi
+ addl %eax, %esi
+ cmpl $12, %ebx
+ je .L000rc5_exit
+ xorl %esi, %edi
+ movl 108(%ebp), %eax
+ movl %esi, %ecx
+ roll %cl, %edi
+ addl %eax, %edi
+ xorl %edi, %esi
+ movl 112(%ebp), %eax
+ movl %edi, %ecx
+ roll %cl, %esi
+ addl %eax, %esi
+ xorl %esi, %edi
+ movl 116(%ebp), %eax
+ movl %esi, %ecx
+ roll %cl, %edi
+ addl %eax, %edi
+ xorl %edi, %esi
+ movl 120(%ebp), %eax
+ movl %edi, %ecx
+ roll %cl, %esi
+ addl %eax, %esi
+ xorl %esi, %edi
+ movl 124(%ebp), %eax
+ movl %esi, %ecx
+ roll %cl, %edi
+ addl %eax, %edi
+ xorl %edi, %esi
+ movl 128(%ebp), %eax
+ movl %edi, %ecx
+ roll %cl, %esi
+ addl %eax, %esi
+ xorl %esi, %edi
+ movl 132(%ebp), %eax
+ movl %esi, %ecx
+ roll %cl, %edi
+ addl %eax, %edi
+ xorl %edi, %esi
+ movl 136(%ebp), %eax
+ movl %edi, %ecx
+ roll %cl, %esi
+ addl %eax, %esi
+.L000rc5_exit:
+ movl %edi, (%edx)
+ movl %esi, 4(%edx)
+ popl %ebx
+ popl %edi
+ popl %esi
+ popl %ebp
+ ret
+.RC5_32_encrypt_end:
+ SIZE(RC5_32_encrypt,.RC5_32_encrypt_end-RC5_32_encrypt)
+.ident "desasm.pl"
+.text
+ .align ALIGN
+.globl RC5_32_decrypt
+ TYPE(RC5_32_decrypt,@function)
+RC5_32_decrypt:
+
+ pushl %ebp
+ pushl %esi
+ pushl %edi
+ movl 16(%esp), %edx
+ movl 20(%esp), %ebp
+ /* Load the 2 words */
+ movl (%edx), %edi
+ movl 4(%edx), %esi
+ pushl %ebx
+ movl (%ebp), %ebx
+ cmpl $12, %ebx
+ je .L001rc5_dec_12
+ cmpl $8, %ebx
+ je .L002rc5_dec_8
+ movl 136(%ebp), %eax
+ subl %eax, %esi
+ movl %edi, %ecx
+ rorl %cl, %esi
+ xorl %edi, %esi
+ movl 132(%ebp), %eax
+ subl %eax, %edi
+ movl %esi, %ecx
+ rorl %cl, %edi
+ xorl %esi, %edi
+ movl 128(%ebp), %eax
+ subl %eax, %esi
+ movl %edi, %ecx
+ rorl %cl, %esi
+ xorl %edi, %esi
+ movl 124(%ebp), %eax
+ subl %eax, %edi
+ movl %esi, %ecx
+ rorl %cl, %edi
+ xorl %esi, %edi
+ movl 120(%ebp), %eax
+ subl %eax, %esi
+ movl %edi, %ecx
+ rorl %cl, %esi
+ xorl %edi, %esi
+ movl 116(%ebp), %eax
+ subl %eax, %edi
+ movl %esi, %ecx
+ rorl %cl, %edi
+ xorl %esi, %edi
+ movl 112(%ebp), %eax
+ subl %eax, %esi
+ movl %edi, %ecx
+ rorl %cl, %esi
+ xorl %edi, %esi
+ movl 108(%ebp), %eax
+ subl %eax, %edi
+ movl %esi, %ecx
+ rorl %cl, %edi
+ xorl %esi, %edi
+.L001rc5_dec_12:
+ movl 104(%ebp), %eax
+ subl %eax, %esi
+ movl %edi, %ecx
+ rorl %cl, %esi
+ xorl %edi, %esi
+ movl 100(%ebp), %eax
+ subl %eax, %edi
+ movl %esi, %ecx
+ rorl %cl, %edi
+ xorl %esi, %edi
+ movl 96(%ebp), %eax
+ subl %eax, %esi
+ movl %edi, %ecx
+ rorl %cl, %esi
+ xorl %edi, %esi
+ movl 92(%ebp), %eax
+ subl %eax, %edi
+ movl %esi, %ecx
+ rorl %cl, %edi
+ xorl %esi, %edi
+ movl 88(%ebp), %eax
+ subl %eax, %esi
+ movl %edi, %ecx
+ rorl %cl, %esi
+ xorl %edi, %esi
+ movl 84(%ebp), %eax
+ subl %eax, %edi
+ movl %esi, %ecx
+ rorl %cl, %edi
+ xorl %esi, %edi
+ movl 80(%ebp), %eax
+ subl %eax, %esi
+ movl %edi, %ecx
+ rorl %cl, %esi
+ xorl %edi, %esi
+ movl 76(%ebp), %eax
+ subl %eax, %edi
+ movl %esi, %ecx
+ rorl %cl, %edi
+ xorl %esi, %edi
+.L002rc5_dec_8:
+ movl 72(%ebp), %eax
+ subl %eax, %esi
+ movl %edi, %ecx
+ rorl %cl, %esi
+ xorl %edi, %esi
+ movl 68(%ebp), %eax
+ subl %eax, %edi
+ movl %esi, %ecx
+ rorl %cl, %edi
+ xorl %esi, %edi
+ movl 64(%ebp), %eax
+ subl %eax, %esi
+ movl %edi, %ecx
+ rorl %cl, %esi
+ xorl %edi, %esi
+ movl 60(%ebp), %eax
+ subl %eax, %edi
+ movl %esi, %ecx
+ rorl %cl, %edi
+ xorl %esi, %edi
+ movl 56(%ebp), %eax
+ subl %eax, %esi
+ movl %edi, %ecx
+ rorl %cl, %esi
+ xorl %edi, %esi
+ movl 52(%ebp), %eax
+ subl %eax, %edi
+ movl %esi, %ecx
+ rorl %cl, %edi
+ xorl %esi, %edi
+ movl 48(%ebp), %eax
+ subl %eax, %esi
+ movl %edi, %ecx
+ rorl %cl, %esi
+ xorl %edi, %esi
+ movl 44(%ebp), %eax
+ subl %eax, %edi
+ movl %esi, %ecx
+ rorl %cl, %edi
+ xorl %esi, %edi
+ movl 40(%ebp), %eax
+ subl %eax, %esi
+ movl %edi, %ecx
+ rorl %cl, %esi
+ xorl %edi, %esi
+ movl 36(%ebp), %eax
+ subl %eax, %edi
+ movl %esi, %ecx
+ rorl %cl, %edi
+ xorl %esi, %edi
+ movl 32(%ebp), %eax
+ subl %eax, %esi
+ movl %edi, %ecx
+ rorl %cl, %esi
+ xorl %edi, %esi
+ movl 28(%ebp), %eax
+ subl %eax, %edi
+ movl %esi, %ecx
+ rorl %cl, %edi
+ xorl %esi, %edi
+ movl 24(%ebp), %eax
+ subl %eax, %esi
+ movl %edi, %ecx
+ rorl %cl, %esi
+ xorl %edi, %esi
+ movl 20(%ebp), %eax
+ subl %eax, %edi
+ movl %esi, %ecx
+ rorl %cl, %edi
+ xorl %esi, %edi
+ movl 16(%ebp), %eax
+ subl %eax, %esi
+ movl %edi, %ecx
+ rorl %cl, %esi
+ xorl %edi, %esi
+ movl 12(%ebp), %eax
+ subl %eax, %edi
+ movl %esi, %ecx
+ rorl %cl, %edi
+ xorl %esi, %edi
+ subl 8(%ebp), %esi
+