Prepare for 0.9.8j release.
[oweals/openssl.git] / crypto / rc2 / rc2_skey.c
index 7143c4e591a914fd93f596e4d53a6e29581fdc1b..4e000e5b992a1428f381bdb1765846d482b005da 100644 (file)
  */
 
 #include <openssl/rc2.h>
+#include <openssl/crypto.h>
+#ifdef OPENSSL_FIPS
+#include <openssl/fips.h>
+#endif
+
 #include "rc2_locl.h"
 
 static unsigned char key_table[256]={
@@ -84,13 +89,29 @@ static unsigned char key_table[256]={
        0xfe,0x7f,0xc1,0xad,
        };
 
+#if defined(_MSC_VER) && defined(_ARM_)
+#pragma optimize("g",off)
+#endif
+
 /* It has come to my attention that there are 2 versions of the RC2
  * key schedule.  One which is normal, and anther which has a hook to
  * use a reduced key length.
  * BSAFE uses the 'retarded' version.  What I previously shipped is
  * the same as specifying 1024 for the 'bits' parameter.  Bsafe uses
  * a version where the bits parameter is the same as len*8 */
-void RC2_set_key(RC2_KEY *key, int len, unsigned char *data, int bits)
+
+#ifdef OPENSSL_FIPS
+void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits)
+       {
+       if (FIPS_mode())
+               FIPS_BAD_ABORT(RC2)
+       private_RC2_set_key(key, len, data, bits);
+       }
+void private_RC2_set_key(RC2_KEY *key, int len, const unsigned char *data,
+                                                               int bits)
+#else
+void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits)
+#endif
        {
        int i,j;
        unsigned char *k;
@@ -136,3 +157,6 @@ void RC2_set_key(RC2_KEY *key, int len, unsigned char *data, int bits)
                *(ki--)=((k[i]<<8)|k[i-1])&0xffff;
        }
 
+#if defined(_MSC_VER)
+#pragma optimize("",on)
+#endif