From e82f18fab47b698d93971f576f962a3068132912 Mon Sep 17 00:00:00 2001 From: cvs2svn Date: Mon, 5 Oct 1998 20:13:17 +0000 Subject: This commit was manufactured by cvs2git to create tag 'SSLeay_0_9_0b'. --- src/lib/libcrypto/rc4/Makefile.ssl | 108 ++++++++++ src/lib/libcrypto/rc4/Makefile.uni | 102 ++++++++++ src/lib/libcrypto/rc4/asm/r4-win32.asm | 314 +++++++++++++++++++++++++++++ src/lib/libcrypto/rc4/asm/rx86unix.cpp | 358 +++++++++++++++++++++++++++++++++ src/lib/libcrypto/rc4/rc4.org | 103 ++++++++++ src/lib/libcrypto/rc4/rc4_locl.org | 70 +++++++ 6 files changed, 1055 insertions(+) create mode 100644 src/lib/libcrypto/rc4/Makefile.ssl create mode 100644 src/lib/libcrypto/rc4/Makefile.uni create mode 100644 src/lib/libcrypto/rc4/asm/r4-win32.asm create mode 100644 src/lib/libcrypto/rc4/asm/rx86unix.cpp create mode 100644 src/lib/libcrypto/rc4/rc4.org create mode 100644 src/lib/libcrypto/rc4/rc4_locl.org (limited to 'src/lib/libcrypto/rc4') diff --git a/src/lib/libcrypto/rc4/Makefile.ssl b/src/lib/libcrypto/rc4/Makefile.ssl new file mode 100644 index 0000000000..19c1e980f3 --- /dev/null +++ b/src/lib/libcrypto/rc4/Makefile.ssl @@ -0,0 +1,108 @@ +# +# SSLeay/crypto/rc4/Makefile +# + +DIR= rc4 +TOP= ../.. +CC= cc +INCLUDES= +CFLAG=-g +INSTALLTOP=/usr/local/ssl +MAKE= make -f Makefile.ssl +MAKEDEPEND= makedepend -f Makefile.ssl +MAKEFILE= Makefile.ssl +AR= ar r + +RC4_ENC=rc4_enc.o +# or use +#RC4_ENC=asm/rx86-elf.o +#RC4_ENC=asm/rx86-out.o +#RC4_ENC=asm/rx86-sol.o +#RC4_ENC=asm/rx86bdsi.o + +CFLAGS= $(INCLUDES) $(CFLAG) + +GENERAL=Makefile +TEST=rc4test.c +APPS= + +LIB=$(TOP)/libcrypto.a +LIBSRC=rc4_skey.c rc4_enc.c +LIBOBJ=rc4_skey.o $(RC4_ENC) + +SRC= $(LIBSRC) + +EXHEADER= rc4.h +HEADER= $(EXHEADER) rc4_locl.h + +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/rx86-elf.o: asm/rx86unix.cpp + $(CPP) -DELF asm/rx86unix.cpp | as -o asm/rx86-elf.o + +# solaris +asm/rx86-sol.o: asm/rx86unix.cpp + $(CC) -E -DSOL asm/rx86unix.cpp | sed 's/^#.*//' > asm/rx86-sol.s + as -o asm/rx86-sol.o asm/rx86-sol.s + rm -f asm/rx86-sol.s + +# a.out +asm/rx86-out.o: asm/rx86unix.cpp + $(CPP) -DOUT asm/rx86unix.cpp | as -o asm/rx86-out.o + +# bsdi +asm/rx86bsdi.o: asm/rx86unix.cpp + $(CPP) -DBSDI asm/rx86unix.cpp | as -o asm/rx86bsdi.o + +asm/rx86unix.cpp: + (cd asm; perl rc4-586.pl cpp >rx86unix.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/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 *.obj lib tags core .pure .nfs* *.old *.bak fluff asm/*.o + +errors: + +# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/lib/libcrypto/rc4/Makefile.uni b/src/lib/libcrypto/rc4/Makefile.uni new file mode 100644 index 0000000000..79dc17b8d1 --- /dev/null +++ b/src/lib/libcrypto/rc4/Makefile.uni @@ -0,0 +1,102 @@ +# Targets +# make - twidle the options yourself :-) +# make cc - standard cc options +# make gcc - standard gcc options +# make x86-elf - linux-elf etc +# make x86-out - linux-a.out, FreeBSD etc +# make x86-solaris +# make x86-bdsi + +DIR= rc4 +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 + +RC4_ENC=rc4_enc.o +# or use +#RC4_ENC=asm/rx86-elf.o +#RC4_ENC=asm/rx86-out.o +#RC4_ENC=asm/rx86-sol.o +#RC4_ENC=asm/rx86bdsi.o + +CFLAGS= $(INCLUDES) $(CFLAG) + +GENERAL=Makefile +TEST=rc4test +APPS=rc4speed + +LIB=librc4.a +LIBSRC=rc4_skey.c rc4_enc.c +LIBOBJ=rc4_skey.o $(RC4_ENC) + +SRC= $(LIBSRC) + +EXHEADER= rc4.h +HEADER= $(EXHEADER) rc4_locl.h + +ALL= $(GENERAL) $(SRC) $(HEADER) + +all: $(LIB) $(TEST) $(APPS) + +$(LIB): $(LIBOBJ) + $(AR) $(LIB) $(LIBOBJ) + sh $(TOP)/ranlib.sh $(LIB) + +# elf +asm/rx86-elf.o: asm/rx86unix.cpp + $(CPP) -DELF asm/rx86unix.cpp | as -o asm/rx86-elf.o + +# solaris +asm/rx86-sol.o: asm/rx86unix.cpp + $(CC) -E -DSOL asm/rx86unix.cpp | sed 's/^#.*//' > asm/rx86-sol.s + as -o asm/rx86-sol.o asm/rx86-sol.s + rm -f asm/rx86-sol.s + +# a.out +asm/rx86-out.o: asm/rx86unix.cpp + $(CPP) -DOUT asm/rx86unix.cpp | as -o asm/rx86-out.o + +# bsdi +asm/rx86bsdi.o: asm/rx86unix.cpp + $(CPP) -DBSDI asm/rx86unix.cpp | as -o asm/rx86bsdi.o + +asm/rx86unix.cpp: + (cd asm; perl rc4-586.pl cpp >rx86unix.cpp) + +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/src/lib/libcrypto/rc4/asm/r4-win32.asm b/src/lib/libcrypto/rc4/asm/r4-win32.asm new file mode 100644 index 0000000000..70b0f7484c --- /dev/null +++ b/src/lib/libcrypto/rc4/asm/r4-win32.asm @@ -0,0 +1,314 @@ + ; Don't even think of reading this code + ; It was automatically generated by rc4-586.pl + ; Which is a perl program used to generate the x86 assember for + ; any of elf, a.out, BSDI,Win32, or Solaris + ; eric + ; + TITLE rc4-586.asm + .386 +.model FLAT +_TEXT SEGMENT +PUBLIC _RC4 + +_RC4 PROC NEAR + ; + push ebp + push ebx + mov ebp, DWORD PTR 12[esp] + mov ebx, DWORD PTR 16[esp] + push esi + push edi + mov ecx, DWORD PTR [ebp] + mov edx, DWORD PTR 4[ebp] + mov esi, DWORD PTR 28[esp] + inc ecx + sub esp, 12 + add ebp, 8 + and ecx, 255 + lea ebx, DWORD PTR [esi+ebx-8] + mov edi, DWORD PTR 44[esp] + mov DWORD PTR 8[esp],ebx + mov eax, DWORD PTR [ecx*4+ebp] + cmp ebx, esi + jl $L000end +L001start: + add esi, 8 + ; Round 0 + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov eax, DWORD PTR [ecx*4+ebp] + mov BYTE PTR [esp], bl + ; Round 1 + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov eax, DWORD PTR [ecx*4+ebp] + mov BYTE PTR 1[esp],bl + ; Round 2 + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov eax, DWORD PTR [ecx*4+ebp] + mov BYTE PTR 2[esp],bl + ; Round 3 + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov eax, DWORD PTR [ecx*4+ebp] + mov BYTE PTR 3[esp],bl + ; Round 4 + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov eax, DWORD PTR [ecx*4+ebp] + mov BYTE PTR 4[esp],bl + ; Round 5 + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov eax, DWORD PTR [ecx*4+ebp] + mov BYTE PTR 5[esp],bl + ; Round 6 + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov eax, DWORD PTR [ecx*4+ebp] + mov BYTE PTR 6[esp],bl + ; Round 7 + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + add edi, 8 + mov BYTE PTR 7[esp],bl + ; apply the cipher text + mov eax, DWORD PTR [esp] + mov ebx, DWORD PTR [esi-8] + xor eax, ebx + mov ebx, DWORD PTR [esi-4] + mov DWORD PTR [edi-8],eax + mov eax, DWORD PTR 4[esp] + xor eax, ebx + mov ebx, DWORD PTR 8[esp] + mov DWORD PTR [edi-4],eax + mov eax, DWORD PTR [ecx*4+ebp] + cmp esi, ebx + jle L001start +$L000end: + ; Round 0 + add ebx, 8 + inc esi + cmp ebx, esi + jl $L002finished + mov DWORD PTR 8[esp],ebx + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov eax, DWORD PTR [ecx*4+ebp] + mov bh, BYTE PTR [esi-1] + xor bl, bh + mov BYTE PTR [edi], bl + ; Round 1 + mov ebx, DWORD PTR 8[esp] + cmp ebx, esi + jle $L002finished + inc esi + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov eax, DWORD PTR [ecx*4+ebp] + mov bh, BYTE PTR [esi-1] + xor bl, bh + mov BYTE PTR 1[edi],bl + ; Round 2 + mov ebx, DWORD PTR 8[esp] + cmp ebx, esi + jle $L002finished + inc esi + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov eax, DWORD PTR [ecx*4+ebp] + mov bh, BYTE PTR [esi-1] + xor bl, bh + mov BYTE PTR 2[edi],bl + ; Round 3 + mov ebx, DWORD PTR 8[esp] + cmp ebx, esi + jle $L002finished + inc esi + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov eax, DWORD PTR [ecx*4+ebp] + mov bh, BYTE PTR [esi-1] + xor bl, bh + mov BYTE PTR 3[edi],bl + ; Round 4 + mov ebx, DWORD PTR 8[esp] + cmp ebx, esi + jle $L002finished + inc esi + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov eax, DWORD PTR [ecx*4+ebp] + mov bh, BYTE PTR [esi-1] + xor bl, bh + mov BYTE PTR 4[edi],bl + ; Round 5 + mov ebx, DWORD PTR 8[esp] + cmp ebx, esi + jle $L002finished + inc esi + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov eax, DWORD PTR [ecx*4+ebp] + mov bh, BYTE PTR [esi-1] + xor bl, bh + mov BYTE PTR 5[edi],bl + ; Round 6 + mov ebx, DWORD PTR 8[esp] + cmp ebx, esi + jle $L002finished + inc esi + add edx, eax + and edx, 255 + inc ecx + mov ebx, DWORD PTR [edx*4+ebp] + mov DWORD PTR [ecx*4+ebp-4],ebx + add ebx, eax + and ecx, 255 + and ebx, 255 + mov DWORD PTR [edx*4+ebp],eax + nop + mov ebx, DWORD PTR [ebx*4+ebp] + mov bh, BYTE PTR [esi-1] + xor bl, bh + mov BYTE PTR 6[edi],bl +$L002finished: + dec ecx + add esp, 12 + mov DWORD PTR [ebp-4],edx + mov BYTE PTR [ebp-8],cl + pop edi + pop esi + pop ebx + pop ebp + ret +_RC4 ENDP +_TEXT ENDS +END diff --git a/src/lib/libcrypto/rc4/asm/rx86unix.cpp b/src/lib/libcrypto/rc4/asm/rx86unix.cpp new file mode 100644 index 0000000000..ec1d72a110 --- /dev/null +++ b/src/lib/libcrypto/rc4/asm/rx86unix.cpp @@ -0,0 +1,358 @@ +/* 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 RC4 _RC4 + +#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 rc4-586.pl */ + /* Which is a perl program used to generate the x86 assember for */ + /* any of elf, a.out, BSDI,Win32, or Solaris */ + /* eric */ + + .file "rc4-586.s" + .version "01.01" +gcc2_compiled.: +.text + .align ALIGN +.globl RC4 + TYPE(RC4,@function) +RC4: + + pushl %ebp + pushl %ebx + movl 12(%esp), %ebp + movl 16(%esp), %ebx + pushl %esi + pushl %edi + movl (%ebp), %ecx + movl 4(%ebp), %edx + movl 28(%esp), %esi + incl %ecx + subl $12, %esp + addl $8, %ebp + andl $255, %ecx + leal -8(%ebx,%esi,), %ebx + movl 44(%esp), %edi + movl %ebx, 8(%esp) + movl (%ebp,%ecx,4), %eax + cmpl %esi, %ebx + jl .L000end +.L001start: + addl $8, %esi + /* Round 0 */ + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movl (%ebp,%ecx,4), %eax + movb %bl, (%esp) + /* Round 1 */ + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movl (%ebp,%ecx,4), %eax + movb %bl, 1(%esp) + /* Round 2 */ + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movl (%ebp,%ecx,4), %eax + movb %bl, 2(%esp) + /* Round 3 */ + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movl (%ebp,%ecx,4), %eax + movb %bl, 3(%esp) + /* Round 4 */ + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movl (%ebp,%ecx,4), %eax + movb %bl, 4(%esp) + /* Round 5 */ + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movl (%ebp,%ecx,4), %eax + movb %bl, 5(%esp) + /* Round 6 */ + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movl (%ebp,%ecx,4), %eax + movb %bl, 6(%esp) + /* Round 7 */ + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + addl $8, %edi + movb %bl, 7(%esp) + /* apply the cipher text */ + movl (%esp), %eax + movl -8(%esi), %ebx + xorl %ebx, %eax + movl -4(%esi), %ebx + movl %eax, -8(%edi) + movl 4(%esp), %eax + xorl %ebx, %eax + movl 8(%esp), %ebx + movl %eax, -4(%edi) + movl (%ebp,%ecx,4), %eax + cmpl %ebx, %esi + jle .L001start +.L000end: + /* Round 0 */ + addl $8, %ebx + incl %esi + cmpl %esi, %ebx + jl .L002finished + movl %ebx, 8(%esp) + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movl (%ebp,%ecx,4), %eax + movb -1(%esi), %bh + xorb %bh, %bl + movb %bl, (%edi) + /* Round 1 */ + movl 8(%esp), %ebx + cmpl %esi, %ebx + jle .L002finished + incl %esi + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movl (%ebp,%ecx,4), %eax + movb -1(%esi), %bh + xorb %bh, %bl + movb %bl, 1(%edi) + /* Round 2 */ + movl 8(%esp), %ebx + cmpl %esi, %ebx + jle .L002finished + incl %esi + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movl (%ebp,%ecx,4), %eax + movb -1(%esi), %bh + xorb %bh, %bl + movb %bl, 2(%edi) + /* Round 3 */ + movl 8(%esp), %ebx + cmpl %esi, %ebx + jle .L002finished + incl %esi + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movl (%ebp,%ecx,4), %eax + movb -1(%esi), %bh + xorb %bh, %bl + movb %bl, 3(%edi) + /* Round 4 */ + movl 8(%esp), %ebx + cmpl %esi, %ebx + jle .L002finished + incl %esi + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movl (%ebp,%ecx,4), %eax + movb -1(%esi), %bh + xorb %bh, %bl + movb %bl, 4(%edi) + /* Round 5 */ + movl 8(%esp), %ebx + cmpl %esi, %ebx + jle .L002finished + incl %esi + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movl (%ebp,%ecx,4), %eax + movb -1(%esi), %bh + xorb %bh, %bl + movb %bl, 5(%edi) + /* Round 6 */ + movl 8(%esp), %ebx + cmpl %esi, %ebx + jle .L002finished + incl %esi + addl %eax, %edx + andl $255, %edx + incl %ecx + movl (%ebp,%edx,4), %ebx + movl %ebx, -4(%ebp,%ecx,4) + addl %eax, %ebx + andl $255, %ecx + andl $255, %ebx + movl %eax, (%ebp,%edx,4) + nop + movl (%ebp,%ebx,4), %ebx + movb -1(%esi), %bh + xorb %bh, %bl + movb %bl, 6(%edi) +.L002finished: + decl %ecx + addl $12, %esp + movl %edx, -4(%ebp) + movb %cl, -8(%ebp) + popl %edi + popl %esi + popl %ebx + popl %ebp + ret +.RC4_end: + SIZE(RC4,.RC4_end-RC4) +.ident "RC4" diff --git a/src/lib/libcrypto/rc4/rc4.org b/src/lib/libcrypto/rc4/rc4.org new file mode 100644 index 0000000000..c558651af8 --- /dev/null +++ b/src/lib/libcrypto/rc4/rc4.org @@ -0,0 +1,103 @@ +/* crypto/rc4/rc4.org */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + * + * Always modify rc4.org since rc4.h is automatically generated from + * it during SSLeay configuration. + * + * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + */ + +#ifndef HEADER_RC4_H +#define HEADER_RC4_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* using int types make the structure larger but make the code faster + * on most boxes I have tested - up to %20 faster. */ +#define RC4_INT unsigned int + +typedef struct rc4_key_st + { + RC4_INT x,y; + RC4_INT data[256]; + } RC4_KEY; + +#ifndef NOPROTO + +char *RC4_options(void); +void RC4_set_key(RC4_KEY *key, int len, unsigned char *data); +void RC4(RC4_KEY *key, unsigned long len, unsigned char *indata, + unsigned char *outdata); + +#else + +char *RC4_options(); +void RC4_set_key(); +void RC4(); + +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/lib/libcrypto/rc4/rc4_locl.org b/src/lib/libcrypto/rc4/rc4_locl.org new file mode 100644 index 0000000000..1ef4455fb7 --- /dev/null +++ b/src/lib/libcrypto/rc4/rc4_locl.org @@ -0,0 +1,70 @@ +/* crypto/rc4/rc4_locl.org */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + * + * Always modify bf_locl.org since bf_locl.h is automatically generated from + * it during SSLeay configuration. + * + * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + */ + +/* if this is defined data[i] is used instead of *data, this is a %20 + * speedup on x86 */ +#undef RC4_INDEX + -- cgit v1.2.3-55-g6feb