aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorRich Salz <rsalz@akamai.com>2016-01-27 18:43:25 -0500
committerRich Salz <rsalz@openssl.org>2016-01-27 19:05:50 -0500
commit3e9e810f2e047effb1056211794d2d12ec2b04e7 (patch)
tree26c730915e8c56590fa8fc148da2651dab7f7c8c /crypto
parent8ed40b83ec19aab146a3df701c83066c8788a7a8 (diff)
downloadopenssl-3e9e810f2e047effb1056211794d2d12ec2b04e7.tar.gz
Remove outdated legacy crypto options
Many options for supporting optimizations for legacy crypto on legacy platforms have been removed. This simplifies the source code and does not really penalize anyone. DES_PTR (always on) DES_RISC1, DES_RISC2 (always off) DES_INT (always 'unsigned int') DES_UNROLL (always on) BF_PTR (always on) BF_PTR2 (removed) MD2_CHAR, MD2_LONG (always 'unsigned char') IDEA_SHORT, IDEA_LONG (always 'unsigned int') RC2_SHORT, RC2_LONG (always 'unsigned int') RC4_LONG (only int and char (for assembler) are supported) RC4_CHUNK (always long), RC_CHUNK_LL (removed) RC4_INDEX (always on) And also make D_ENCRYPT macro more clear (@appro) This is done in consultation with Andy. Reviewed-by: Andy Polyakov <appro@openssl.org>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/bf/bf_ecb.c6
-rw-r--r--crypto/bf/bf_enc.c80
-rw-r--r--crypto/bf/bf_locl.h113
-rw-r--r--crypto/des/des_enc.c40
-rw-r--r--crypto/des/des_locl.h171
-rw-r--r--crypto/des/ecb_enc.c25
-rw-r--r--crypto/des/fcrypt_b.c21
-rw-r--r--crypto/idea/i_ecb.c5
-rw-r--r--crypto/include/internal/bf_conf.h.in69
-rw-r--r--crypto/include/internal/des_conf.h.in130
-rw-r--r--crypto/include/internal/rc4_conf.h.in75
-rw-r--r--crypto/rc4/rc4_enc.c229
-rw-r--r--crypto/rc4/rc4_locl.h3
-rw-r--r--crypto/rc4/rc4_skey.c11
14 files changed, 44 insertions, 934 deletions
diff --git a/crypto/bf/bf_ecb.c b/crypto/bf/bf_ecb.c
index dfee789ffc..a7640d88b3 100644
--- a/crypto/bf/bf_ecb.c
+++ b/crypto/bf/bf_ecb.c
@@ -67,13 +67,7 @@
const char *BF_options(void)
{
-#ifdef BF_PTR
return ("blowfish(ptr)");
-#elif defined(BF_PTR2)
- return ("blowfish(ptr2)");
-#else
- return ("blowfish(idx)");
-#endif
}
void BF_ecb_encrypt(const unsigned char *in, unsigned char *out,
diff --git a/crypto/bf/bf_enc.c b/crypto/bf/bf_enc.c
index 76d427048a..04eb39134a 100644
--- a/crypto/bf/bf_enc.c
+++ b/crypto/bf/bf_enc.c
@@ -71,7 +71,6 @@ to modify the code.
void BF_encrypt(BF_LONG *data, const BF_KEY *key)
{
-#ifndef BF_PTR2
register BF_LONG l, r;
register const BF_LONG *p, *s;
@@ -105,50 +104,14 @@ void BF_encrypt(BF_LONG *data, const BF_KEY *key)
# endif
r ^= p[BF_ROUNDS + 1];
- data[1] = l & 0xffffffffL;
- data[0] = r & 0xffffffffL;
-#else
- register BF_LONG l, r, t, *k;
-
- l = data[0];
- r = data[1];
- k = (BF_LONG *)key;
-
- l ^= k[0];
- BF_ENC(r, l, k, 1);
- BF_ENC(l, r, k, 2);
- BF_ENC(r, l, k, 3);
- BF_ENC(l, r, k, 4);
- BF_ENC(r, l, k, 5);
- BF_ENC(l, r, k, 6);
- BF_ENC(r, l, k, 7);
- BF_ENC(l, r, k, 8);
- BF_ENC(r, l, k, 9);
- BF_ENC(l, r, k, 10);
- BF_ENC(r, l, k, 11);
- BF_ENC(l, r, k, 12);
- BF_ENC(r, l, k, 13);
- BF_ENC(l, r, k, 14);
- BF_ENC(r, l, k, 15);
- BF_ENC(l, r, k, 16);
-# if BF_ROUNDS == 20
- BF_ENC(r, l, k, 17);
- BF_ENC(l, r, k, 18);
- BF_ENC(r, l, k, 19);
- BF_ENC(l, r, k, 20);
-# endif
- r ^= k[BF_ROUNDS + 1];
-
- data[1] = l & 0xffffffffL;
- data[0] = r & 0xffffffffL;
-#endif
+ data[1] = l & 0xffffffffU;
+ data[0] = r & 0xffffffffU;
}
#ifndef BF_DEFAULT_OPTIONS
void BF_decrypt(BF_LONG *data, const BF_KEY *key)
{
-# ifndef BF_PTR2
register BF_LONG l, r;
register const BF_LONG *p, *s;
@@ -182,43 +145,8 @@ void BF_decrypt(BF_LONG *data, const BF_KEY *key)
BF_ENC(l, r, s, p[1]);
r ^= p[0];
- data[1] = l & 0xffffffffL;
- data[0] = r & 0xffffffffL;
-# else
- register BF_LONG l, r, t, *k;
-
- l = data[0];
- r = data[1];
- k = (BF_LONG *)key;
-
- l ^= k[BF_ROUNDS + 1];
-# if BF_ROUNDS == 20
- BF_ENC(r, l, k, 20);
- BF_ENC(l, r, k, 19);
- BF_ENC(r, l, k, 18);
- BF_ENC(l, r, k, 17);
-# endif
- BF_ENC(r, l, k, 16);
- BF_ENC(l, r, k, 15);
- BF_ENC(r, l, k, 14);
- BF_ENC(l, r, k, 13);
- BF_ENC(r, l, k, 12);
- BF_ENC(l, r, k, 11);
- BF_ENC(r, l, k, 10);
- BF_ENC(l, r, k, 9);
- BF_ENC(r, l, k, 8);
- BF_ENC(l, r, k, 7);
- BF_ENC(r, l, k, 6);
- BF_ENC(l, r, k, 5);
- BF_ENC(r, l, k, 4);
- BF_ENC(l, r, k, 3);
- BF_ENC(r, l, k, 2);
- BF_ENC(l, r, k, 1);
- r ^= k[0];
-
- data[1] = l & 0xffffffffL;
- data[0] = r & 0xffffffffL;
-# endif
+ data[1] = l & 0xffffffffU;
+ data[0] = r & 0xffffffffU;
}
void BF_cbc_encrypt(const unsigned char *in, unsigned char *out, long length,
diff --git a/crypto/bf/bf_locl.h b/crypto/bf/bf_locl.h
index ecdf388241..5ad9ec2949 100644
--- a/crypto/bf/bf_locl.h
+++ b/crypto/bf/bf_locl.h
@@ -58,52 +58,6 @@
#ifndef HEADER_BF_LOCL_H
# define HEADER_BF_LOCL_H
# include <openssl/opensslconf.h>
-# include "internal/bf_conf.h"
-
-# undef c2l
-# define c2l(c,l) (l =((unsigned long)(*((c)++))) , \
- l|=((unsigned long)(*((c)++)))<< 8L, \
- l|=((unsigned long)(*((c)++)))<<16L, \
- l|=((unsigned long)(*((c)++)))<<24L)
-
-/* NOTE - c is not incremented as per c2l */
-# undef c2ln
-# define c2ln(c,l1,l2,n) { \
- c+=n; \
- l1=l2=0; \
- switch (n) { \
- case 8: l2 =((unsigned long)(*(--(c))))<<24L; \
- case 7: l2|=((unsigned long)(*(--(c))))<<16L; \
- case 6: l2|=((unsigned long)(*(--(c))))<< 8L; \
- case 5: l2|=((unsigned long)(*(--(c)))); \
- case 4: l1 =((unsigned long)(*(--(c))))<<24L; \
- case 3: l1|=((unsigned long)(*(--(c))))<<16L; \
- case 2: l1|=((unsigned long)(*(--(c))))<< 8L; \
- case 1: l1|=((unsigned long)(*(--(c)))); \
- } \
- }
-
-# undef l2c
-# define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \
- *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \
- *((c)++)=(unsigned char)(((l)>>16L)&0xff), \
- *((c)++)=(unsigned char)(((l)>>24L)&0xff))
-
-/* NOTE - c is not incremented as per l2c */
-# undef l2cn
-# define l2cn(l1,l2,c,n) { \
- c+=n; \
- switch (n) { \
- case 8: *(--(c))=(unsigned char)(((l2)>>24L)&0xff); \
- case 7: *(--(c))=(unsigned char)(((l2)>>16L)&0xff); \
- case 6: *(--(c))=(unsigned char)(((l2)>> 8L)&0xff); \
- case 5: *(--(c))=(unsigned char)(((l2) )&0xff); \
- case 4: *(--(c))=(unsigned char)(((l1)>>24L)&0xff); \
- case 3: *(--(c))=(unsigned char)(((l1)>>16L)&0xff); \
- case 2: *(--(c))=(unsigned char)(((l1)>> 8L)&0xff); \
- case 1: *(--(c))=(unsigned char)(((l1) )&0xff); \
- } \
- }
/* NOTE - c is not incremented as per n2l */
# define n2ln(c,l1,l2,n) { \
@@ -153,69 +107,12 @@
* to lookup array 0
*/
-# if defined(BF_PTR2)
-
-/*
- * This is basically a special Intel version. Point is that Intel
- * doesn't have many registers, but offers a reach choice of addressing
- * modes. So we spare some registers by directly traversing BF_KEY
- * structure and hiring the most decorated addressing mode. The code
- * generated by EGCS is *perfectly* competitive with assembler
- * implementation!
- */
-# define BF_ENC(LL,R,KEY,Pi) (\
- LL^=KEY[Pi], \
- t= KEY[BF_ROUNDS+2 + 0 + ((R>>24)&0xFF)], \
- t+= KEY[BF_ROUNDS+2 + 256 + ((R>>16)&0xFF)], \
- t^= KEY[BF_ROUNDS+2 + 512 + ((R>>8 )&0xFF)], \
- t+= KEY[BF_ROUNDS+2 + 768 + ((R )&0xFF)], \
- LL^=t \
- )
-
-# elif defined(BF_PTR)
-
-# ifndef BF_LONG_LOG2
-# define BF_LONG_LOG2 2 /* default to BF_LONG being 32 bits */
-# endif
-# define BF_M (0xFF<<BF_LONG_LOG2)
-# define BF_0 (24-BF_LONG_LOG2)
-# define BF_1 (16-BF_LONG_LOG2)
-# define BF_2 ( 8-BF_LONG_LOG2)
-# define BF_3 BF_LONG_LOG2 /* left shift */
-
-/*
- * This is normally very good on RISC platforms where normally you
- * have to explicitly "multiply" array index by sizeof(BF_LONG)
- * in order to calculate the effective address. This implementation
- * excuses CPU from this extra work. Power[PC] uses should have most
- * fun as (R>>BF_i)&BF_M gets folded into a single instruction, namely
- * rlwinm. So let'em double-check if their compiler does it.
- */
-
-# define BF_ENC(LL,R,S,P) ( \
- LL^=P, \
- LL^= (((*(BF_LONG *)((unsigned char *)&(S[ 0])+((R>>BF_0)&BF_M))+ \
- *(BF_LONG *)((unsigned char *)&(S[256])+((R>>BF_1)&BF_M)))^ \
- *(BF_LONG *)((unsigned char *)&(S[512])+((R>>BF_2)&BF_M)))+ \
- *(BF_LONG *)((unsigned char *)&(S[768])+((R<<BF_3)&BF_M))) \
- )
-# else
-
-/*
- * This is a *generic* version. Seem to perform best on platforms that
- * offer explicit support for extraction of 8-bit nibbles preferably
- * complemented with "multiplying" of array index by sizeof(BF_LONG).
- * For the moment of this writing the list comprises Alpha CPU featuring
- * extbl and s[48]addq instructions.
- */
-
-# define BF_ENC(LL,R,S,P) ( \
+# define BF_ENC(LL,R,S,P) ( \
LL^=P, \
- LL^=((( S[ ((int)(R>>24)&0xff)] + \
- S[0x0100+((int)(R>>16)&0xff)])^ \
- S[0x0200+((int)(R>> 8)&0xff)])+ \
- S[0x0300+((int)(R )&0xff)])&0xffffffffL \
+ LL^=((( S[ ((R>>24)&0xff)] + \
+ S[0x0100+((R>>16)&0xff)])^ \
+ S[0x0200+((R>> 8)&0xff)])+ \
+ S[0x0300+((R )&0xff)])&0xffffffffU \
)
-# endif
#endif
diff --git a/crypto/des/des_enc.c b/crypto/des/des_enc.c
index 613735190f..1f827f216e 100644
--- a/crypto/des/des_enc.c
+++ b/crypto/des/des_enc.c
@@ -62,12 +62,6 @@
void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc)
{
register DES_LONG l, r, t, u;
-#ifdef DES_PTR
- register const unsigned char *des_SP = (const unsigned char *)DES_SPtrans;
-#endif
-#ifndef DES_UNROLL
- register int i;
-#endif
register DES_LONG *s;
r = data[0];
@@ -92,7 +86,6 @@ void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc)
* loop
*/
if (enc) {
-#ifdef DES_UNROLL
D_ENCRYPT(l, r, 0); /* 1 */
D_ENCRYPT(r, l, 2); /* 2 */
D_ENCRYPT(l, r, 4); /* 3 */
@@ -109,14 +102,7 @@ void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc)
D_ENCRYPT(r, l, 26); /* 14 */
D_ENCRYPT(l, r, 28); /* 15 */
D_ENCRYPT(r, l, 30); /* 16 */
-#else
- for (i = 0; i < 32; i += 4) {
- D_ENCRYPT(l, r, i + 0); /* 1 */
- D_ENCRYPT(r, l, i + 2); /* 2 */
- }
-#endif
} else {
-#ifdef DES_UNROLL
D_ENCRYPT(l, r, 30); /* 16 */
D_ENCRYPT(r, l, 28); /* 15 */
D_ENCRYPT(l, r, 26); /* 14 */
@@ -133,12 +119,6 @@ void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc)
D_ENCRYPT(r, l, 4); /* 3 */
D_ENCRYPT(l, r, 2); /* 2 */
D_ENCRYPT(r, l, 0); /* 1 */
-#else
- for (i = 30; i > 0; i -= 4) {
- D_ENCRYPT(l, r, i - 0); /* 16 */
- D_ENCRYPT(r, l, i - 2); /* 15 */
- }
-#endif
}
/* rotate and clear the top bits on machines with 8byte longs */
@@ -154,12 +134,6 @@ void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc)
void DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc)
{
register DES_LONG l, r, t, u;
-#ifdef DES_PTR
- register const unsigned char *des_SP = (const unsigned char *)DES_SPtrans;
-#endif
-#ifndef DES_UNROLL
- register int i;
-#endif
register DES_LONG *s;
r = data[0];
@@ -182,7 +156,6 @@ void DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc)
* loop
*/
if (enc) {
-#ifdef DES_UNROLL
D_ENCRYPT(l, r, 0); /* 1 */
D_ENCRYPT(r, l, 2); /* 2 */
D_ENCRYPT(l, r, 4); /* 3 */
@@ -199,14 +172,7 @@ void DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc)
D_ENCRYPT(r, l, 26); /* 14 */
D_ENCRYPT(l, r, 28); /* 15 */
D_ENCRYPT(r, l, 30); /* 16 */
-#else
- for (i = 0; i < 32; i += 4) {
- D_ENCRYPT(l, r, i + 0); /* 1 */
- D_ENCRYPT(r, l, i + 2); /* 2 */
- }
-#endif
} else {
-#ifdef DES_UNROLL
D_ENCRYPT(l, r, 30); /* 16 */
D_ENCRYPT(r, l, 28); /* 15 */
D_ENCRYPT(l, r, 26); /* 14 */
@@ -223,12 +189,6 @@ void DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc)
D_ENCRYPT(r, l, 4); /* 3 */
D_ENCRYPT(l, r, 2); /* 2 */
D_ENCRYPT(r, l, 0); /* 1 */
-#else
- for (i = 30; i > 0; i -= 4) {
- D_ENCRYPT(l, r, i - 0); /* 16 */
- D_ENCRYPT(r, l, i - 2); /* 15 */
- }
-#endif
}
/* rotate and clear the top bits on machines with 8byte longs */
data[0] = ROTATE(l, 3) & 0xffffffffL;
diff --git a/crypto/des/des_locl.h b/crypto/des/des_locl.h
index 651eb3a61c..7ed783cb37 100644
--- a/crypto/des/des_locl.h
+++ b/crypto/des/des_locl.h
@@ -60,8 +60,6 @@
# include <openssl/e_os2.h>
-# include "internal/des_conf.h"
-
# if defined(OPENSSL_SYS_WIN32)
# ifndef OPENSSL_SYS_MSDOS
# define OPENSSL_SYS_MSDOS
@@ -205,171 +203,23 @@
# endif
/*
- * The changes to this macro may help or hinder, depending on the compiler
- * and the architecture. gcc2 always seems to do well :-). Inspired by Dana
- * How <how@isl.stanford.edu> DO NOT use the alternative version on machines
- * with 8 byte longs. It does not seem to work on the Alpha, even when
- * DES_LONG is 4 bytes, probably an issue of accessing non-word aligned
- * objects :-(
- */
-# ifdef DES_PTR
-
-/*
* It recently occurred to me that 0^0^0^0^0^0^0 == 0, so there is no reason
* to not xor all the sub items together. This potentially saves a register
* since things can be xored directly into L
*/
-# if defined(DES_RISC1) || defined(DES_RISC2)
-# ifdef DES_RISC1
-# define D_ENCRYPT(LL,R,S) { \
- unsigned int u1,u2,u3; \
- LOAD_DATA(R,S,u,t,E0,E1,u1); \
- u2=(int)u>>8L; \
- u1=(int)u&0xfc; \
- u2&=0xfc; \
- t=ROTATE(t,4); \
- u>>=16L; \
- LL^= *(const DES_LONG *)(des_SP +u1); \
- LL^= *(const DES_LONG *)(des_SP+0x200+u2); \
- u3=(int)(u>>8L); \
- u1=(int)u&0xfc; \
- u3&=0xfc; \
- LL^= *(const DES_LONG *)(des_SP+0x400+u1); \
- LL^= *(const DES_LONG *)(des_SP+0x600+u3); \
- u2=(int)t>>8L; \
- u1=(int)t&0xfc; \
- u2&=0xfc; \
- t>>=16L; \
- LL^= *(const DES_LONG *)(des_SP+0x100+u1); \
- LL^= *(const DES_LONG *)(des_SP+0x300+u2); \
- u3=(int)t>>8L; \
- u1=(int)t&0xfc; \
- u3&=0xfc; \
- LL^= *(const DES_LONG *)(des_SP+0x500+u1); \
- LL^= *(const DES_LONG *)(des_SP+0x700+u3); }
-# endif
-# ifdef DES_RISC2
-# define D_ENCRYPT(LL,R,S) { \
- unsigned int u1,u2,s1,s2; \
- LOAD_DATA(R,S,u,t,E0,E1,u1); \
- u2=(int)u>>8L; \
- u1=(int)u&0xfc; \
- u2&=0xfc; \
- t=ROTATE(t,4); \
- LL^= *(const DES_LONG *)(des_SP +u1); \
- LL^= *(const DES_LONG *)(des_SP+0x200+u2); \
- s1=(int)(u>>16L); \
- s2=(int)(u>>24L); \
- s1&=0xfc; \
- s2&=0xfc; \
- LL^= *(const DES_LONG *)(des_SP+0x400+s1); \
- LL^= *(const DES_LONG *)(des_SP+0x600+s2); \
- u2=(int)t>>8L; \
- u1=(int)t&0xfc; \
- u2&=0xfc; \
- LL^= *(const DES_LONG *)(des_SP+0x100+u1); \
- LL^= *(const DES_LONG *)(des_SP+0x300+u2); \
- s1=(int)(t>>16L); \
- s2=(int)(t>>24L); \
- s1&=0xfc; \
- s2&=0xfc; \
- LL^= *(const DES_LONG *)(des_SP+0x500+s1); \
- LL^= *(const DES_LONG *)(des_SP+0x700+s2); }
-# endif
-# else
-# define D_ENCRYPT(LL,R,S) { \
+# define D_ENCRYPT(LL,R,S) { \
LOAD_DATA_tmp(R,S,u,t,E0,E1); \
t=ROTATE(t,4); \
LL^= \
- *(const DES_LONG *)(des_SP +((u )&0xfc))^ \
- *(const DES_LONG *)(des_SP+0x200+((u>> 8L)&0xfc))^ \
- *(const DES_LONG *)(des_SP+0x400+((u>>16L)&0xfc))^ \
- *(const DES_LONG *)(des_SP+0x600+((u>>24L)&0xfc))^ \
- *(const DES_LONG *)(des_SP+0x100+((t )&0xfc))^ \
- *(const DES_LONG *)(des_SP+0x300+((t>> 8L)&0xfc))^ \
- *(const DES_LONG *)(des_SP+0x500+((t>>16L)&0xfc))^ \
- *(const DES_LONG *)(des_SP+0x700+((t>>24L)&0xfc)); }
-# endif
-
-# else /* original version */
-
-# if defined(DES_RISC1) || defined(DES_RISC2)
-# ifdef DES_RISC1
-# define D_ENCRYPT(LL,R,S) {\
- unsigned int u1,u2,u3; \
- LOAD_DATA(R,S,u,t,E0,E1,u1); \
- u>>=2L; \
- t=ROTATE(t,6); \
- u2=(int)u>>8L; \
- u1=(int)u&0x3f; \
- u2&=0x3f; \
- u>>=16L; \
- LL^=DES_SPtrans[0][u1]; \
- LL^=DES_SPtrans[2][u2]; \
- u3=(int)u>>8L; \
- u1=(int)u&0x3f; \
- u3&=0x3f; \
- LL^=DES_SPtrans[4][u1]; \
- LL^=DES_SPtrans[6][u3]; \
- u2=(int)t>>8L; \
- u1=(int)t&0x3f; \
- u2&=0x3f; \
- t>>=16L; \
- LL^=DES_SPtrans[1][u1]; \
- LL^=DES_SPtrans[3][u2]; \
- u3=(int)t>>8L; \
- u1=(int)t&0x3f; \
- u3&=0x3f; \
- LL^=DES_SPtrans[5][u1]; \
- LL^=DES_SPtrans[7][u3]; }
-# endif
-# ifdef DES_RISC2
-# define D_ENCRYPT(LL,R,S) {\
- unsigned int u1,u2,s1,s2; \
- LOAD_DATA(R,S,u,t,E0,E1,u1); \
- u>>=2L; \
- t=ROTATE(t,6); \
- u2=(int)u>>8L; \
- u1=(int)u&0x3f; \
- u2&=0x3f; \
- LL^=DES_SPtrans[0][u1]; \
- LL^=DES_SPtrans[2][u2]; \
- s1=(int)u>>16L; \
- s2=(int)u>>24L; \
- s1&=0x3f; \
- s2&=0x3f; \
- LL^=DES_SPtrans[4][s1]; \
- LL^=DES_SPtrans[6][s2]; \
- u2=(int)t>>8L; \
- u1=(int)t&0x3f; \
- u2&=0x3f; \
- LL^=DES_SPtrans[1][u1]; \
- LL^=DES_SPtrans[3][u2]; \
- s1=(int)t>>16; \
- s2=(int)t>>24L; \
- s1&=0x3f; \
- s2&=0x3f; \
- LL^=DES_SPtrans[5][s1]; \
- LL^=DES_SPtrans[7][s2]; }
-# endif
-
-# else
-
-# define D_ENCRYPT(LL,R,S) {\
- LOAD_DATA_tmp(R,S,u,t,E0,E1); \
- t=ROTATE(t,4); \
- LL^=\
- DES_SPtrans[0][(u>> 2L)&0x3f]^ \
- DES_SPtrans[2][(u>>10L)&0x3f]^ \
- DES_SPtrans[4][(u>>18L)&0x3f]^ \
- DES_SPtrans[6][(u>>26L)&0x3f]^ \
- DES_SPtrans[1][(t>> 2L)&0x3f]^ \
- DES_SPtrans[3][(t>>10L)&0x3f]^ \
- DES_SPtrans[5][(t>>18L)&0x3f]^ \
- DES_SPtrans[7][(t>>26L)&0x3f]; }
-# endif
-# endif
+ DES_SPtrans[0][(u>> 2L)&0x3f]^ \
+ DES_SPtrans[2][(u>>10L)&0x3f]^ \
+ DES_SPtrans[4][(u>>18L)&0x3f]^ \
+ DES_SPtrans[6][(u>>26L)&0x3f]^ \
+ DES_SPtrans[1][(t>> 2L)&0x3f]^ \
+ DES_SPtrans[3][(t>>10L)&0x3f]^ \
+ DES_SPtrans[5][(t>>18L)&0x3f]^ \
+ DES_SPtrans[7][(t>>26L)&0x3f]; }
/*-
* IP and FP
@@ -438,7 +288,4 @@ extern const DES_LONG DES_SPtrans[8][64];
void fcrypt_body(DES_LONG *out, DES_key_schedule *ks,
DES_LONG Eswap0, DES_LONG Eswap1);
-# ifdef OPENSSL_SMALL_FOOTPRINT
-# undef DES_UNROLL
-# endif
#endif
diff --git a/crypto/des/ecb_enc.c b/crypto/des/ecb_enc.c
index 56a6a0b4da..109ffd430f 100644
--- a/crypto/des/ecb_enc.c
+++ b/crypto/des/ecb_enc.c
@@ -66,34 +66,13 @@ const char *DES_options(void)
static char buf[32];
if (init) {
- const char *ptr, *unroll, *risc, *size;
+ const char *size;
-#ifdef DES_PTR
- ptr = "ptr";
-#else
- ptr = "idx";
-#endif
-#if defined(DES_RISC1) || defined(DES_RISC2)
-# ifdef DES_RISC1
- risc = "risc1";
-# endif
-# ifdef DES_RISC2
- risc = "risc2";
-# endif
-#else
- risc = "cisc";
-#endif
-#ifdef DES_UNROLL
- unroll = "16";
-#else
- unroll = "2";
-#endif
if (sizeof(DES_LONG) != sizeof(long))
size = "int";
else
size = "long";
- BIO_snprintf(buf, sizeof buf, "des(%s,%s,%s,%s)", ptr, risc, unroll,
- size);
+ BIO_snprintf(buf, sizeof buf, "des(%s)", size);
init = 0;
}
return (buf);
diff --git a/crypto/des/fcrypt_b.c b/crypto/des/fcrypt_b.c
index 8fb9350c87..6e02ac7c3c 100644
--- a/crypto/des/fcrypt_b.c
+++ b/crypto/des/fcrypt_b.c
@@ -80,9 +80,6 @@ void fcrypt_body(DES_LONG *out, DES_key_schedule *ks, DES_LONG Eswap0,
DES_LONG Eswap1)
{
register DES_LONG l, r, t, u;
-#ifdef DES_PTR
- register const unsigned char *des_SP = (const unsigned char *)DES_SPtrans;
-#endif
register DES_LONG *s;
register int j;
register DES_LONG E0, E1;
@@ -95,14 +92,6 @@ void fcrypt_body(DES_LONG *out, DES_key_schedule *ks, DES_LONG Eswap0,
E1 = Eswap1;
for (j = 0; j < 25; j++) {
-#ifndef DES_UNROLL
- register int i;
-
- for (i = 0; i < 32; i += 4) {
- D_ENCRYPT(l, r, i + 0); /* 1 */
- D_ENCRYPT(r, l, i + 2); /* 2 */
- }
-#else
D_ENCRYPT(l, r, 0); /* 1 */
D_ENCRYPT(r, l, 2); /* 2 */
D_ENCRYPT(l, r, 4); /* 3 */
@@ -119,8 +108,6 @@ void fcrypt_body(DES_LONG *out, DES_key_schedule *ks, DES_LONG Eswap0,
D_ENCRYPT(r, l, 26); /* 14 */
D_ENCRYPT(l, r, 28); /* 15 */
D_ENCRYPT(r, l, 30); /* 16 */
-#endif
-
t = l;
l = r;
r = t;
@@ -128,11 +115,11 @@ void fcrypt_body(DES_LONG *out, DES_key_schedule *ks, DES_LONG Eswap0,
l = ROTATE(l, 3) & 0xffffffffL;
r = ROTATE(r, 3) & 0xffffffffL;
- PERM_OP(l, r, t, 1, 0x55555555L);
- PERM_OP(r, l, t, 8, 0x00ff00ffL);
- PERM_OP(l, r, t, 2, 0x33333333L);
+ PERM_OP(l, r, t, 1, 0x55555555L);
+ PERM_OP(r, l, t, 8, 0x00ff00ffL);
+ PERM_OP(l, r, t, 2, 0x33333333L);
PERM_OP(r, l, t, 16, 0x0000ffffL);
- PERM_OP(l, r, t, 4, 0x0f0f0f0fL);
+ PERM_OP(l, r, t, 4, 0x0f0f0f0fL);
out[0] = r;
out[1] = l;
diff --git a/crypto/idea/i_ecb.c b/crypto/idea/i_ecb.c
index c018c1504f..e7eeb4f937 100644
--- a/crypto/idea/i_ecb.c
+++ b/crypto/idea/i_ecb.c
@@ -61,10 +61,7 @@
const char *idea_options(void)
{
- if (sizeof(short) != sizeof(IDEA_INT))
- return ("idea(int)");
- else
- return ("idea(short)");
+ return ("idea(int)");
}
void idea_ecb_encrypt(const unsigned char *in, unsigned char *out,
diff --git a/crypto/include/internal/bf_conf.h.in b/crypto/include/internal/bf_conf.h.in
deleted file mode 100644
index 552faae98e..0000000000
--- a/crypto/include/internal/bf_conf.h.in
+++ /dev/null
@@ -1,69 +0,0 @@
-{- join("\n",map { "/* $_ */" } @autowarntext) -}
-/* ====================================================================
- * Copyright (c) 2016 The OpenSSL Project. All rights reserved.
- *
- * 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 above 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 acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core@openssl.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED 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 OpenSSL PROJECT OR
- * ITS 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.
- * ====================================================================
- *
- * This product includes cryptographic software written by Eric Young
- * (eay@cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh@cryptsoft.com).
- *
- */
-
-#ifndef HEADER_BF_CONF_H
-# define HEADER_BF_CONF_H
-
-{-
- if ($config{bf_ptr} == 0) {
- "#undef BF_PTR";
- } elsif ($config{bf_ptr} == 1) {
- "#define BF_PTR";
- } elsif ($config{bf_ptr} == 2) {
- "#define BF_PTR2";
- }
--}
-
-#endif
diff --git a/crypto/include/internal/des_conf.h.in b/crypto/include/internal/des_conf.h.in
deleted file mode 100644
index 2c4369bd78..0000000000
--- a/crypto/include/internal/des_conf.h.in
+++ /dev/null
@@ -1,130 +0,0 @@
-{- join("\n",map { "/* $_ */" } @autowarntext) -}
-/* ====================================================================
- * Copyright (c) 2016 The OpenSSL Project. All rights reserved.
- *
- * 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 above 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 acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core@openssl.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED 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 OpenSSL PROJECT OR
- * ITS 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.
- * ====================================================================
- *
- * This product includes cryptographic software written by Eric Young
- * (eay@cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh@cryptsoft.com).
- *
- */
-
-#ifndef HEADER_DES_CONF_H
-# define HEADER_DES_CONF_H
-
-/* the following is tweaked from a config script, that is why it is a
- * protected undef/define */
-# ifndef DES_PTR
-{- $config{des_ptr} ? "#define" : "#undef" -} DES_PTR
-# endif
-
-/* This helps C compiler generate the correct code for multiple functional
- * units. It reduces register dependancies at the expense of 2 more
- * registers */
-# ifndef DES_RISC1
-{- $config{des_risc1} ? "#define" : "#undef" -} DES_RISC1
-# endif
-
-# ifndef DES_RISC2
-{- $config{des_risc2} ? "#define" : "#undef" -} DES_RISC2
-# endif
-
-# if defined(DES_RISC1) && defined(DES_RISC2)
-# error YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
-# endif
-
-/* Unroll the inner loop, this sometimes helps, sometimes hinders.
- * Very mucy CPU dependant */
-# ifndef DES_UNROLL
-{- $config{des_unroll} ? "#define" : "#undef" -} DES_UNROLL
-# endif
-
-/*
- * These default values were supplied by
- * Peter Gutman <pgut001@cs.auckland.ac.nz>
- * They are only used if nothing else has been defined
- */
-# if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
-
-/*
- * Special defines which change the way the code is built depending on the
- * CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
- * even newer MIPS CPU's, but at the moment one size fits all for
- * optimization options. Older Sparc's work better with only UNROLL, but
- * there's no way to tell at compile time what it is you're running on.
- */
-
-# if defined(sparc) || defined(__sparc__) /* Newer Sparc's */
-# define DES_PTR
-# define DES_RISC1
-# define DES_UNROLL
-# elif defined( __ultrix ) /* Older MIPS */
-# define DES_PTR
-# define DES_RISC2
-# define DES_UNROLL
-# elif defined( __osf1__ ) /* Alpha */
-# define DES_PTR
-# define DES_RISC2
-# elif defined ( _AIX ) /* RS6000 */
- /* Unknown */
-# elif defined( __hpux ) /* HP-PA */
- /* Unknown */
-# elif defined( __aux ) /* 68K */
- /* Unknown */
-# elif defined( __sgi ) /* Newer MIPS */
-# define DES_PTR
-# define DES_RISC2
-# define DES_UNROLL
-# elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
-# define DES_PTR
-# define DES_RISC1
-# define DES_UNROLL
-# endif
-
-# endif
-
-#endif
diff --git a/crypto/include/internal/rc4_conf.h.in b/crypto/include/internal/rc4_conf.h.in
deleted file mode 100644
index b5b2bd3fc0..0000000000
--- a/crypto/include/internal/rc4_conf.h.in
+++ /dev/null
@@ -1,75 +0,0 @@
-{- join("\n",map { "/* $_ */" } @autowarntext) -}
-/* ====================================================================
- * Copyright (c) 2016 The OpenSSL Project. All rights reserved.
- *
- * 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 above 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 acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core@openssl.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED 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 OpenSSL PROJECT OR
- * ITS 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.
- * ====================================================================
- *
- * This product includes cryptographic software written by Eric Young
- * (eay@cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh@cryptsoft.com).
- *
- */
-
-#ifndef HEADER_RC4_CONF_H
-# define HEADER_RC4_CONF_H
-
-# if !defined(RC4_CHUNK)
-/*
- * This enables code handling data aligned at natural CPU word
- * boundary. See crypto/rc4/rc4_enc.c for further details.
- */
-{-
- $config{rc4_chunk}
- ? "#define RC4_CHUNK ".$config{rc4_chunk}
- : "#undef RC4_CHUNK";
--}
-# endif
-
-/* if this is defined data[i] is used instead of *data, this is a %20
- * speedup on x86 */
-{- $config{rc4_idx} ? "#define" : "#undef" -} RC4_INDEX
-
-#endif
diff --git a/crypto/rc4/rc4_enc.c b/crypto/rc4/rc4_enc.c
index 79f00e7129..e7397b43c7 100644
--- a/crypto/rc4/rc4_enc.c
+++ b/crypto/rc4/rc4_enc.c
@@ -78,197 +78,6 @@ void RC4(RC4_KEY *key, size_t len, const unsigned char *indata,
y = key->y;
d = key->data;
-#if defined(RC4_CHUNK) && !defined(PEDANTIC)
- /*-
- * 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 ((((size_t)indata & (sizeof(RC4_CHUNK) - 1)) |
- ((size_t)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 & (0 - 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 & (0 - 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]; \
@@ -277,27 +86,19 @@ void RC4(RC4_KEY *key, size_t len, const unsigned char *indata,
d[y]=tx; \
(out) = d[(tx+ty)&0xff]^ (in);
-#ifndef RC4_INDEX
-# define RC4_LOOP(a,b,i) LOOP(*((a)++),*((b)++))
-#else
-# define RC4_LOOP(a,b,i) LOOP(a[i],b[i])
-#endif
-
i = len >> 3;
if (i) {
for (;;) {
- RC4_LOOP(indata, outdata, 0);
- RC4_LOOP(indata, outdata, 1);
- RC4_LOOP(indata, outdata, 2);
- RC4_LOOP(indata, outdata, 3);
- RC4_LOOP(indata, outdata, 4);
- RC4_LOOP(indata, outdata, 5);
- RC4_LOOP(indata, outdata, 6);
- RC4_LOOP(indata, outdata, 7);
-#ifdef RC4_INDEX
+ LOOP(indata[0], outdata[0]);
+ LOOP(indata[1], outdata[1]);
+ LOOP(indata[2], outdata[2]);
+ LOOP(indata[3], outdata[3]);
+ LOOP(indata[4], outdata[4]);
+ LOOP(indata[5], outdata[5]);
+ LOOP(indata[6], outdata[6]);
+ LOOP(indata[7], outdata[7]);
indata += 8;
outdata += 8;
-#endif
if (--i == 0)
break;
}
@@ -305,25 +106,25 @@ void RC4(RC4_KEY *key, size_t len, const unsigned char *indata,
i = len & 0x07;
if (i) {
for (;;) {
- RC4_LOOP(indata, outdata, 0);
+ LOOP(indata[0], outdata[0]);
if (--i == 0)
break;
- RC4_LOOP(indata, outdata, 1);
+ LOOP(indata[1], outdata[1]);
if (--i == 0)
break;
- RC4_LOOP(indata, outdata, 2);
+ LOOP(indata[2], outdata[2]);
if (--i == 0)
break;
- RC4_LOOP(indata, outdata, 3);
+ LOOP(indata[3], outdata[3]);
if (--i == 0)
break;
- RC4_LOOP(indata, outdata, 4);
+ LOOP(indata[4], outdata[4]);
if (--i == 0)
break;
- RC4_LOOP(indata, outdata, 5);
+ LOOP(indata[5], outdata[5]);
if (--i == 0)
break;
- RC4_LOOP(indata, outdata, 6);
+ LOOP(indata[6], outdata[6]);
if (--i == 0)
break;
}
diff --git a/crypto/rc4/rc4_locl.h b/crypto/rc4/rc4_locl.h
index 3ed48d8d25..3ab25705cc 100644
--- a/crypto/rc4/rc4_locl.h
+++ b/crypto/rc4/rc4_locl.h
@@ -1,6 +1,7 @@
#ifndef HEADER_RC4_LOCL_H
# define HEADER_RC4_LOCL_H
+
# include <openssl/opensslconf.h>
# include "internal/cryptlib.h"
-# include "internal/rc4_conf.h"
+
#endif
diff --git a/crypto/rc4/rc4_skey.c b/crypto/rc4/rc4_skey.c
index 2e6cc2ddcb..9931a61008 100644
--- a/crypto/rc4/rc4_skey.c
+++ b/crypto/rc4/rc4_skey.c
@@ -61,17 +61,10 @@
const char *RC4_options(void)
{
-#ifdef RC4_INDEX
if (sizeof(RC4_INT) == 1)
- return ("rc4(idx,char)");
+ return ("rc4(char)");
else
- return ("rc4(idx,int)");
-#else
- if (sizeof(RC4_INT) == 1)
- return ("rc4(ptr,char)");
- else
- return ("rc4(ptr,int)");
-#endif
+ return ("rc4(int)");
}
/*-