diff options
Diffstat (limited to 'src/lib/libcrypto/rc2/rc2_skey.c')
-rw-r--r-- | src/lib/libcrypto/rc2/rc2_skey.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/lib/libcrypto/rc2/rc2_skey.c b/src/lib/libcrypto/rc2/rc2_skey.c index 4953642056..9652865188 100644 --- a/src/lib/libcrypto/rc2/rc2_skey.c +++ b/src/lib/libcrypto/rc2/rc2_skey.c | |||
@@ -57,6 +57,8 @@ | |||
57 | */ | 57 | */ |
58 | 58 | ||
59 | #include <openssl/rc2.h> | 59 | #include <openssl/rc2.h> |
60 | #include <openssl/crypto.h> | ||
61 | #include <openssl/fips.h> | ||
60 | #include "rc2_locl.h" | 62 | #include "rc2_locl.h" |
61 | 63 | ||
62 | static unsigned char key_table[256]={ | 64 | static unsigned char key_table[256]={ |
@@ -84,17 +86,25 @@ static unsigned char key_table[256]={ | |||
84 | 0xfe,0x7f,0xc1,0xad, | 86 | 0xfe,0x7f,0xc1,0xad, |
85 | }; | 87 | }; |
86 | 88 | ||
87 | #if defined(_MSC_VER) && defined(_ARM_) | ||
88 | #pragma optimize("g",off) | ||
89 | #endif | ||
90 | |||
91 | /* It has come to my attention that there are 2 versions of the RC2 | 89 | /* It has come to my attention that there are 2 versions of the RC2 |
92 | * key schedule. One which is normal, and anther which has a hook to | 90 | * key schedule. One which is normal, and anther which has a hook to |
93 | * use a reduced key length. | 91 | * use a reduced key length. |
94 | * BSAFE uses the 'retarded' version. What I previously shipped is | 92 | * BSAFE uses the 'retarded' version. What I previously shipped is |
95 | * the same as specifying 1024 for the 'bits' parameter. Bsafe uses | 93 | * the same as specifying 1024 for the 'bits' parameter. Bsafe uses |
96 | * a version where the bits parameter is the same as len*8 */ | 94 | * a version where the bits parameter is the same as len*8 */ |
95 | |||
96 | #ifdef OPENSSL_FIPS | ||
97 | void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits) | ||
98 | { | ||
99 | if (FIPS_mode()) | ||
100 | FIPS_BAD_ABORT(RC2) | ||
101 | private_RC2_set_key(key, len, data, bits); | ||
102 | } | ||
103 | void private_RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, | ||
104 | int bits) | ||
105 | #else | ||
97 | void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits) | 106 | void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits) |
107 | #endif | ||
98 | { | 108 | { |
99 | int i,j; | 109 | int i,j; |
100 | unsigned char *k; | 110 | unsigned char *k; |
@@ -140,6 +150,3 @@ void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits) | |||
140 | *(ki--)=((k[i]<<8)|k[i-1])&0xffff; | 150 | *(ki--)=((k[i]<<8)|k[i-1])&0xffff; |
141 | } | 151 | } |
142 | 152 | ||
143 | #if defined(_MSC_VER) | ||
144 | #pragma optimize("",on) | ||
145 | #endif | ||