summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xConfigure8
-rw-r--r--TABLE18
-rw-r--r--crypto/rc4/Makefile3
-rw-r--r--crypto/rc4/rc4.h39
-rw-r--r--crypto/rc4/rc4_enc.c197
-rw-r--r--crypto/rc4/rc4_locl.h75
-rw-r--r--crypto/rc4/rc4_skey.c17
7 files changed, 236 insertions, 121 deletions
diff --git a/Configure b/Configure
index d43ba3610..c639e930f 100755
--- a/Configure
+++ b/Configure
@@ -270,10 +270,10 @@ my %table=(
"hpux64-parisc2-gcc","gcc:-O3 -DB_ENDIAN -DMD32_XARRAY::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:asm/pa-risc2W.o:::::::::dlfcn:hpux64-shared:-fpic::.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
# IA-64 targets
-"hpux-ia64-cc","cc:-Ae +DD32 +O3 +Olit=all -z -DB_ENDIAN::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:asm/ia64-cpp.o:::::::::dlfcn:hpux-shared:+Z::.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"hpux-ia64-cc","cc:-Ae +DD32 +O3 +Olit=all -z -DB_ENDIAN::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT:asm/ia64-cpp.o::::::asm/rc4-ia64.o:::dlfcn:hpux-shared:+Z::.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
# Frank Geurts <frank.geurts@nl.abnamro.com> has patiently assisted with
# with debugging of the following config.
-"hpux64-ia64-cc","cc:-Ae +DD64 +O3 +Olit=all -z -DB_ENDIAN::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:asm/ia64-cpp.o:::::::::dlfcn:hpux64-shared:+Z::.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"hpux64-ia64-cc","cc:-Ae +DD64 +O3 +Olit=all -z -DB_ENDIAN::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT:asm/ia64-cpp.o::::::asm/rc4-ia64.o:::dlfcn:hpux64-shared:+Z::.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
# More attempts at unified 10.X and 11.X targets for HP C compiler.
#
@@ -397,8 +397,8 @@ my %table=(
"linux-m68k", "gcc:-DB_ENDIAN -DTERMIO -O2 -fomit-frame-pointer -Wall::-D_REENTRANT:::BN_LLONG::",
"linux-s390", "gcc:-DB_ENDIAN -DTERMIO -DNO_ASM -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"linux-s390x", "gcc:-DB_ENDIAN -DTERMIO -DNO_ASM -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-"linux-ia64", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK RC4_CHAR:asm/ia64.o:::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-"linux-ia64-ecc", "ecc:-DL_ENDIAN -DTERMIO -O2 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK RC4_CHAR:asm/ia64.o:::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"linux-ia64", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK:asm/ia64.o::::::asm/rc4-ia64.o:::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"linux-ia64-ecc", "ecc:-DL_ENDIAN -DTERMIO -O2 -Wall -no_cpprt::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK:asm/ia64.o::::::asm/rc4-ia64.o:::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"linux-x86_64", "gcc:-m64 -DL_ENDIAN -DTERMIO -O3 -Wall -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK BF_PTR2 DES_INT DES_UNROLL:asm/x86_64-gcc.o::::::asm/rc4-amd64.o:::dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"linux-em64t", "gcc:-m64 -DL_ENDIAN -DTERMIO -O3 -Wall -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK RC4_CHAR BF_PTR2 DES_INT DES_UNROLL:asm/x86_64-gcc.o:::::::::dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"NetBSD-sparc", "gcc:-DTERMIOS -O3 -fomit-frame-pointer -mv8 -Wall -DB_ENDIAN::(unknown):::BN_LLONG MD2_CHAR RC4_INDEX DES_UNROLL::::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
diff --git a/TABLE b/TABLE
index 02674089e..fd6f80c60 100644
--- a/TABLE
+++ b/TABLE
@@ -2357,14 +2357,14 @@ $unistd =
$thread_cflag = -D_REENTRANT
$sys_id =
$lflags = -ldl
-$bn_ops = SIXTY_FOUR_BIT MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT
+$bn_ops = SIXTY_FOUR_BIT MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT
$bn_obj = asm/ia64-cpp.o
$des_obj =
$bf_obj =
$md5_obj =
$sha1_obj =
$cast_obj =
-$rc4_obj =
+$rc4_obj = asm/rc4-ia64.o
$rmd160_obj =
$rc5_obj =
$dso_scheme = dlfcn
@@ -2632,14 +2632,14 @@ $unistd =
$thread_cflag = -D_REENTRANT
$sys_id =
$lflags = -ldl
-$bn_ops = SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT
+$bn_ops = SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT
$bn_obj = asm/ia64-cpp.o
$des_obj =
$bf_obj =
$md5_obj =
$sha1_obj =
$cast_obj =
-$rc4_obj =
+$rc4_obj = asm/rc4-ia64.o
$rmd160_obj =
$rc5_obj =
$dso_scheme = dlfcn
@@ -3132,14 +3132,14 @@ $unistd =
$thread_cflag = -D_REENTRANT
$sys_id =
$lflags = -ldl
-$bn_ops = SIXTY_FOUR_BIT_LONG RC4_CHUNK RC4_CHAR
+$bn_ops = SIXTY_FOUR_BIT_LONG RC4_CHUNK
$bn_obj = asm/ia64.o
$des_obj =
$bf_obj =
$md5_obj =
$sha1_obj =
$cast_obj =
-$rc4_obj =
+$rc4_obj = asm/rc4-ia64.o
$rmd160_obj =
$rc5_obj =
$dso_scheme = dlfcn
@@ -3152,19 +3152,19 @@ $arflags =
*** linux-ia64-ecc
$cc = ecc
-$cflags = -DL_ENDIAN -DTERMIO -O2 -Wall
+$cflags = -DL_ENDIAN -DTERMIO -O2 -Wall -no_cpprt
$unistd =
$thread_cflag = -D_REENTRANT
$sys_id =
$lflags = -ldl
-$bn_ops = SIXTY_FOUR_BIT_LONG RC4_CHUNK RC4_CHAR
+$bn_ops = SIXTY_FOUR_BIT_LONG RC4_CHUNK
$bn_obj = asm/ia64.o
$des_obj =
$bf_obj =
$md5_obj =
$sha1_obj =
$cast_obj =
-$rc4_obj =
+$rc4_obj = asm/rc4-ia64.o
$rmd160_obj =
$rc5_obj =
$dso_scheme = dlfcn
diff --git a/crypto/rc4/Makefile b/crypto/rc4/Makefile
index a39e1d56c..2380a6265 100644
--- a/crypto/rc4/Makefile
+++ b/crypto/rc4/Makefile
@@ -68,6 +68,9 @@ asm/rx86unix.cpp: asm/rc4-586.pl ../perlasm/x86asm.pl
asm/rc4-amd64.s: asm/rc4-amd64.pl; $(PERL) $< $@
+asm/rc4-ia64.s: asm/rc4-ia64.S
+ $(CC) $(CFLAGS) -E asm/rc4-ia64.S > $@
+
files:
$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
diff --git a/crypto/rc4/rc4.h b/crypto/rc4/rc4.h
index c558651af..6878abc5e 100644
--- a/crypto/rc4/rc4.h
+++ b/crypto/rc4/rc4.h
@@ -1,4 +1,4 @@
-/* crypto/rc4/rc4.org */
+/* crypto/rc4/rc4.h */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -56,46 +56,35 @@
* [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 OPENSSL_NO_RC4
+#error RC4 is disabled.
+#endif
+
+#include <openssl/opensslconf.h> /* RC4_INT */
+
#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];
+#if defined(__ia64) || defined(__ia64__) || defined(_M_IA64)
+ /* see crypto/rc4/asm/rc4-ia64.S for further details... */
+ RC4_INT pad[512-256-2];
+#endif
} 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,
+const char *RC4_options(void);
+void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data);
+void RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata,
unsigned char *outdata);
-#else
-
-char *RC4_options();
-void RC4_set_key();
-void RC4();
-
-#endif
-
#ifdef __cplusplus
}
#endif
diff --git a/crypto/rc4/rc4_enc.c b/crypto/rc4/rc4_enc.c
index 26da6d520..81a97ea3b 100644
--- a/crypto/rc4/rc4_enc.c
+++ b/crypto/rc4/rc4_enc.c
@@ -56,7 +56,7 @@
* [including the GNU Public Licence.]
*/
-#include "rc4.h"
+#include <openssl/rc4.h>
#include "rc4_locl.h"
/* RC4 as implemented from a posting from
@@ -67,11 +67,8 @@
* Date: Wed, 14 Sep 1994 06:35:31 GMT
*/
-void RC4(key, len, indata, outdata)
-RC4_KEY *key;
-unsigned long len;
-unsigned char *indata;
-unsigned char *outdata;
+void RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata,
+ unsigned char *outdata)
{
register RC4_INT *d;
register RC4_INT x,y,tx,ty;
@@ -80,7 +77,195 @@ unsigned char *outdata;
x=key->x;
y=key->y;
d=key->data;
+#if defined(__ia64) || defined(__ia64__) || defined(_M_IA64)
+ /* see crypto/rc4/asm/rc4-ia64.S for further details... */
+ d=(RC4_INT *)(((size_t)(d+255))&~(sizeof(key->data)-1));
+#endif
+
+#if defined(RC4_CHUNK)
+ /*
+ * The original reason for implementing this(*) was the fact that
+ * pre-21164a Alpha CPUs don't have byte load/store instructions
+ * and e.g. a byte store has to be done with 64-bit load, shift,
+ * and, or and finally 64-bit store. Peaking data and operating
+ * at natural word size made it possible to reduce amount of
+ * instructions as well as to perform early read-ahead without
+ * suffering from RAW (read-after-write) hazard. This resulted
+ * in ~40%(**) performance improvement on 21064 box with gcc.
+ * But it's not only Alpha users who win here:-) Thanks to the
+ * early-n-wide read-ahead this implementation also exhibits
+ * >40% speed-up on SPARC and 20-30% on 64-bit MIPS (depending
+ * on sizeof(RC4_INT)).
+ *
+ * (*) "this" means code which recognizes the case when input
+ * and output pointers appear to be aligned at natural CPU
+ * word boundary
+ * (**) i.e. according to 'apps/openssl speed rc4' benchmark,
+ * crypto/rc4/rc4speed.c exhibits almost 70% speed-up...
+ *
+ * Cavets.
+ *
+ * - RC4_CHUNK="unsigned long long" should be a #1 choice for
+ * UltraSPARC. Unfortunately gcc generates very slow code
+ * (2.5-3 times slower than one generated by Sun's WorkShop
+ * C) and therefore gcc (at least 2.95 and earlier) should
+ * always be told that RC4_CHUNK="unsigned long".
+ *
+ * <appro@fy.chalmers.se>
+ */
+
+# define RC4_STEP ( \
+ x=(x+1) &0xff, \
+ tx=d[x], \
+ y=(tx+y)&0xff, \
+ ty=d[y], \
+ d[y]=tx, \
+ d[x]=ty, \
+ (RC4_CHUNK)d[(tx+ty)&0xff]\
+ )
+
+ if ( ( ((unsigned long)indata & (sizeof(RC4_CHUNK)-1)) |
+ ((unsigned long)outdata & (sizeof(RC4_CHUNK)-1)) ) == 0 )
+ {
+ RC4_CHUNK ichunk,otp;
+ const union { long one; char little; } is_endian = {1};
+
+ /*
+ * I reckon we can afford to implement both endian
+ * cases and to decide which way to take at run-time
+ * because the machine code appears to be very compact
+ * and redundant 1-2KB is perfectly tolerable (i.e.
+ * in case the compiler fails to eliminate it:-). By
+ * suggestion from Terrel Larson <terr@terralogic.net>
+ * who also stands for the is_endian union:-)
+ *
+ * Special notes.
+ *
+ * - is_endian is declared automatic as doing otherwise
+ * (declaring static) prevents gcc from eliminating
+ * the redundant code;
+ * - compilers (those I've tried) don't seem to have
+ * problems eliminating either the operators guarded
+ * by "if (sizeof(RC4_CHUNK)==8)" or the condition
+ * expressions themselves so I've got 'em to replace
+ * corresponding #ifdefs from the previous version;
+ * - I chose to let the redundant switch cases when
+ * sizeof(RC4_CHUNK)!=8 be (were also #ifdefed
+ * before);
+ * - in case you wonder "&(sizeof(RC4_CHUNK)*8-1)" in
+ * [LB]ESHFT guards against "shift is out of range"
+ * warnings when sizeof(RC4_CHUNK)!=8
+ *
+ * <appro@fy.chalmers.se>
+ */
+ if (!is_endian.little)
+ { /* BIG-ENDIAN CASE */
+# define BESHFT(c) (((sizeof(RC4_CHUNK)-(c)-1)*8)&(sizeof(RC4_CHUNK)*8-1))
+ for (;len&-sizeof(RC4_CHUNK);len-=sizeof(RC4_CHUNK))
+ {
+ ichunk = *(RC4_CHUNK *)indata;
+ otp = RC4_STEP<<BESHFT(0);
+ otp |= RC4_STEP<<BESHFT(1);
+ otp |= RC4_STEP<<BESHFT(2);
+ otp |= RC4_STEP<<BESHFT(3);
+ if (sizeof(RC4_CHUNK)==8)
+ {
+ otp |= RC4_STEP<<BESHFT(4);
+ otp |= RC4_STEP<<BESHFT(5);
+ otp |= RC4_STEP<<BESHFT(6);
+ otp |= RC4_STEP<<BESHFT(7);
+ }
+ *(RC4_CHUNK *)outdata = otp^ichunk;
+ indata += sizeof(RC4_CHUNK);
+ outdata += sizeof(RC4_CHUNK);
+ }
+ if (len)
+ {
+ RC4_CHUNK mask=(RC4_CHUNK)-1, ochunk;
+ ichunk = *(RC4_CHUNK *)indata;
+ ochunk = *(RC4_CHUNK *)outdata;
+ otp = 0;
+ i = BESHFT(0);
+ mask <<= (sizeof(RC4_CHUNK)-len)<<3;
+ switch (len&(sizeof(RC4_CHUNK)-1))
+ {
+ case 7: otp = RC4_STEP<<i, i-=8;
+ case 6: otp |= RC4_STEP<<i, i-=8;
+ case 5: otp |= RC4_STEP<<i, i-=8;
+ case 4: otp |= RC4_STEP<<i, i-=8;
+ case 3: otp |= RC4_STEP<<i, i-=8;
+ case 2: otp |= RC4_STEP<<i, i-=8;
+ case 1: otp |= RC4_STEP<<i, i-=8;
+ case 0: ; /*
+ * it's never the case,
+ * but it has to be here
+ * for ultrix?
+ */
+ }
+ ochunk &= ~mask;
+ ochunk |= (otp^ichunk) & mask;
+ *(RC4_CHUNK *)outdata = ochunk;
+ }
+ key->x=x;
+ key->y=y;
+ return;
+ }
+ else
+ { /* LITTLE-ENDIAN CASE */
+# define LESHFT(c) (((c)*8)&(sizeof(RC4_CHUNK)*8-1))
+ for (;len&-sizeof(RC4_CHUNK);len-=sizeof(RC4_CHUNK))
+ {
+ ichunk = *(RC4_CHUNK *)indata;
+ otp = RC4_STEP;
+ otp |= RC4_STEP<<8;
+ otp |= RC4_STEP<<16;
+ otp |= RC4_STEP<<24;
+ if (sizeof(RC4_CHUNK)==8)
+ {
+ otp |= RC4_STEP<<LESHFT(4);
+ otp |= RC4_STEP<<LESHFT(5);
+ otp |= RC4_STEP<<LESHFT(6);
+ otp |= RC4_STEP<<LESHFT(7);
+ }
+ *(RC4_CHUNK *)outdata = otp^ichunk;
+ indata += sizeof(RC4_CHUNK);
+ outdata += sizeof(RC4_CHUNK);
+ }
+ if (len)
+ {
+ RC4_CHUNK mask=(RC4_CHUNK)-1, ochunk;
+
+ ichunk = *(RC4_CHUNK *)indata;
+ ochunk = *(RC4_CHUNK *)outdata;
+ otp = 0;
+ i = 0;
+ mask >>= (sizeof(RC4_CHUNK)-len)<<3;
+ switch (len&(sizeof(RC4_CHUNK)-1))
+ {
+ case 7: otp = RC4_STEP, i+=8;
+ case 6: otp |= RC4_STEP<<i, i+=8;
+ case 5: otp |= RC4_STEP<<i, i+=8;
+ case 4: otp |= RC4_STEP<<i, i+=8;
+ case 3: otp |= RC4_STEP<<i, i+=8;
+ case 2: otp |= RC4_STEP<<i, i+=8;
+ case 1: otp |= RC4_STEP<<i, i+=8;
+ case 0: ; /*
+ * it's never the case,
+ * but it has to be here
+ * for ultrix?
+ */
+ }
+ ochunk &= ~mask;
+ ochunk |= (otp^ichunk) & mask;
+ *(RC4_CHUNK *)outdata = ochunk;
+ }
+ key->x=x;
+ key->y=y;
+ return;
+ }
+ }
+#endif
#define LOOP(in,out) \
x=((x+1)&0xff); \
tx=d[x]; \
diff --git a/crypto/rc4/rc4_locl.h b/crypto/rc4/rc4_locl.h
index 1ef4455fb..c712e1632 100644
--- a/crypto/rc4/rc4_locl.h
+++ b/crypto/rc4/rc4_locl.h
@@ -1,70 +1,5 @@
-/* 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
-
+#ifndef HEADER_RC4_LOCL_H
+#define HEADER_RC4_LOCL_H
+#include <openssl/opensslconf.h>
+#include <cryptlib.h>
+#endif
diff --git a/crypto/rc4/rc4_skey.c b/crypto/rc4/rc4_skey.c
index 03e69e16c..ca69a5a7e 100644
--- a/crypto/rc4/rc4_skey.c
+++ b/crypto/rc4/rc4_skey.c
@@ -56,12 +56,13 @@
* [including the GNU Public Licence.]
*/
-#include "rc4.h"
+#include <openssl/rc4.h>
#include "rc4_locl.h"
+#include <openssl/opensslv.h>
-char *RC4_version="RC4 part of SSLeay 0.9.1a 06-Jul-1998";
+const char *RC4_version="RC4" OPENSSL_VERSION_PTEXT;
-char *RC4_options()
+const char *RC4_options(void)
{
#ifdef RC4_INDEX
if (sizeof(RC4_INT) == 1)
@@ -84,10 +85,7 @@ char *RC4_options()
* Date: Wed, 14 Sep 1994 06:35:31 GMT
*/
-void RC4_set_key(key, len, data)
-RC4_KEY *key;
-int len;
-register unsigned char *data;
+void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data)
{
register RC4_INT tmp;
register int id1,id2;
@@ -95,6 +93,11 @@ register unsigned char *data;
unsigned int i;
d= &(key->data[0]);
+#if defined(__ia64) || defined(__ia64__) || defined(_M_IA64)
+ /* see crypto/rc4/asm/rc4-ia64.S for further details... */
+ d=(RC4_INT *)(((size_t)(d+255))&~(sizeof(key->data)-1));
+#endif
+
for (i=0; i<256; i++)
d[i]=i;
key->x = 0;