Stupid typo
[oweals/openssl.git] / crypto / rc4 / rc4_skey.c
index 083b53dfb8702378cd0051f2580ead991cd0eaa7..4478d1a4b3b3c29c5feab44c744386cfabd1adbc 100644 (file)
 #include <openssl/rc4.h>
 #include "rc4_locl.h"
 #include <openssl/opensslv.h>
+#include <openssl/crypto.h>
+#ifdef OPENSSL_FIPS
+#include <openssl/fips.h>
+#endif
+
 
-const char *RC4_version="RC4" OPENSSL_VERSION_PTEXT;
+const char RC4_version[]="RC4" OPENSSL_VERSION_PTEXT;
 
 const char *RC4_options(void)
        {
@@ -85,7 +90,11 @@ const char *RC4_options(void)
  * Date: Wed, 14 Sep 1994 06:35:31 GMT
  */
 
+#ifdef OPENSSL_FIPS
+void private_RC4_set_key(RC4_KEY *key, int len, const unsigned char *data)
+#else
 void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data)
+#endif
        {
         register RC4_INT tmp;
         register int id1,id2;
@@ -93,10 +102,6 @@ void RC4_set_key(RC4_KEY *key, int len, const 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
         key->x = 0;     
         key->y = 0;     
         id1=id2=0;     
@@ -123,14 +128,20 @@ void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data)
                 * implementations suffer from significant performance
                 * losses then, e.g. PIII exhibits >2x deterioration,
                 * and so does Opteron. In order to assure optimal
-                * all-round performance, let us [try to] detect P4 at
-                * run-time by checking upon HTT bit in CPU capability
+                * all-round performance, we detect P4 at run-time by
+                * checking upon reserved bit 20 in CPU capability
                 * vector and set up compressed key schedule, which is
                 * recognized by correspondingly updated assembler
-                * module...
+                * module... Bit 20 is set up by OPENSSL_ia32_cpuid.
+                *
                 *                              <appro@fy.chalmers.se>
                 */
+#ifdef OPENSSL_FIPS
+               unsigned long *ia32cap_ptr = OPENSSL_ia32cap_loc();
+               if (ia32cap_ptr && (*ia32cap_ptr & (1<<28))) {
+#else
                if (OPENSSL_ia32cap_P & (1<<28)) {
+#endif
                        unsigned char *cp=(unsigned char *)d;
 
                        for (i=0;i<256;i++) cp[i]=i;