summaryrefslogtreecommitdiffstats
path: root/crypto/rc5
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2008-09-16 10:47:28 +0000
committerDr. Stephen Henson <steve@openssl.org>2008-09-16 10:47:28 +0000
commit96a259e81e47cf61d54eb0cb0dd05434eda2f301 (patch)
treede53299acb413b3d5cbe25d05e17f6f3aa8e422b /crypto/rc5
parent59f3477b8236fd431d2cee942b46e3034e0a7b10 (diff)
Merge FIPS low level algorithm blocking code. Give hard errors if non-FIPS
algorithms are use in FIPS mode using low level API. No effect in non-FIPS mode.
Diffstat (limited to 'crypto/rc5')
-rw-r--r--crypto/rc5/rc5.h5
-rw-r--r--crypto/rc5/rc5_skey.c17
2 files changed, 21 insertions, 1 deletions
diff --git a/crypto/rc5/rc5.h b/crypto/rc5/rc5.h
index 4b3c153b50..f73a2a02a4 100644
--- a/crypto/rc5/rc5.h
+++ b/crypto/rc5/rc5.h
@@ -94,7 +94,10 @@ typedef struct rc5_key_st
RC5_32_INT data[2*(RC5_16_ROUNDS+1)];
} RC5_32_KEY;
-
+#ifdef OPENSSL_FIPS
+void private_RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data,
+ int rounds);
+#endif
void RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data,
int rounds);
void RC5_32_ecb_encrypt(const unsigned char *in,unsigned char *out,RC5_32_KEY *key,
diff --git a/crypto/rc5/rc5_skey.c b/crypto/rc5/rc5_skey.c
index a2e00a41c5..247fa6500c 100644
--- a/crypto/rc5/rc5_skey.c
+++ b/crypto/rc5/rc5_skey.c
@@ -56,11 +56,28 @@
* [including the GNU Public Licence.]
*/
+#include <openssl/crypto.h>
#include <openssl/rc5.h>
+#ifdef OPENSSL_FIPS
+#include <openssl/fips.h>
+#endif
+
#include "rc5_locl.h"
+#ifdef OPENSSL_FIPS
+void RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data,
+ int rounds)
+ {
+ if (FIPS_mode())
+ FIPS_BAD_ABORT(RC5)
+ private_RC5_32_set_key(key, len, data, rounds);
+ }
+void private_RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data,
+ int rounds)
+#else
void RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data,
int rounds)
+#endif
{
RC5_32_INT L[64],l,ll,A,B,*S,k;
int i,j,m,c,t,ii,jj;