diff options
Diffstat (limited to 'src/lib/libcrypto/rc4/rc4_skey.c')
| -rw-r--r-- | src/lib/libcrypto/rc4/rc4_skey.c | 36 |
1 files changed, 1 insertions, 35 deletions
diff --git a/src/lib/libcrypto/rc4/rc4_skey.c b/src/lib/libcrypto/rc4/rc4_skey.c index b22c40b0bd..fda27636e7 100644 --- a/src/lib/libcrypto/rc4/rc4_skey.c +++ b/src/lib/libcrypto/rc4/rc4_skey.c | |||
| @@ -85,7 +85,7 @@ const char *RC4_options(void) | |||
| 85 | * Date: Wed, 14 Sep 1994 06:35:31 GMT | 85 | * Date: Wed, 14 Sep 1994 06:35:31 GMT |
| 86 | */ | 86 | */ |
| 87 | 87 | ||
| 88 | void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data) | 88 | void private_RC4_set_key(RC4_KEY *key, int len, const unsigned char *data) |
| 89 | { | 89 | { |
| 90 | register RC4_INT tmp; | 90 | register RC4_INT tmp; |
| 91 | register int id1,id2; | 91 | register int id1,id2; |
| @@ -104,40 +104,6 @@ void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data) | |||
| 104 | d[(n)]=d[id2]; \ | 104 | d[(n)]=d[id2]; \ |
| 105 | d[id2]=tmp; } | 105 | d[id2]=tmp; } |
| 106 | 106 | ||
| 107 | #if defined(OPENSSL_CPUID_OBJ) && !defined(OPENSSL_NO_ASM) | ||
| 108 | # if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \ | ||
| 109 | defined(__INTEL__) || \ | ||
| 110 | defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) | ||
| 111 | if (sizeof(RC4_INT) > 1) { | ||
| 112 | /* | ||
| 113 | * Unlike all other x86 [and x86_64] implementations, | ||
| 114 | * Intel P4 core [including EM64T] was found to perform | ||
| 115 | * poorly with wider RC4_INT. Performance improvement | ||
| 116 | * for IA-32 hand-coded assembler turned out to be 2.8x | ||
| 117 | * if re-coded for RC4_CHAR! It's however inappropriate | ||
| 118 | * to just switch to RC4_CHAR for x86[_64], as non-P4 | ||
| 119 | * implementations suffer from significant performance | ||
| 120 | * losses then, e.g. PIII exhibits >2x deterioration, | ||
| 121 | * and so does Opteron. In order to assure optimal | ||
| 122 | * all-round performance, let us [try to] detect P4 at | ||
| 123 | * run-time by checking upon HTT bit in CPU capability | ||
| 124 | * vector and set up compressed key schedule, which is | ||
| 125 | * recognized by correspondingly updated assembler | ||
| 126 | * module... | ||
| 127 | * <appro@fy.chalmers.se> | ||
| 128 | */ | ||
| 129 | if (OPENSSL_ia32cap_P & (1<<28)) { | ||
| 130 | unsigned char *cp=(unsigned char *)d; | ||
| 131 | |||
| 132 | for (i=0;i<256;i++) cp[i]=i; | ||
| 133 | for (i=0;i<256;i++) SK_LOOP(cp,i); | ||
| 134 | /* mark schedule as compressed! */ | ||
| 135 | d[256/sizeof(RC4_INT)]=-1; | ||
| 136 | return; | ||
| 137 | } | ||
| 138 | } | ||
| 139 | # endif | ||
| 140 | #endif | ||
| 141 | for (i=0; i < 256; i++) d[i]=i; | 107 | for (i=0; i < 256; i++) d[i]=i; |
| 142 | for (i=0; i < 256; i+=4) | 108 | for (i=0; i < 256; i+=4) |
| 143 | { | 109 | { |
