diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2008-09-16 10:47:28 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2008-09-16 10:47:28 +0000 |
commit | 96a259e81e47cf61d54eb0cb0dd05434eda2f301 (patch) | |
tree | de53299acb413b3d5cbe25d05e17f6f3aa8e422b /crypto/idea | |
parent | 59f3477b8236fd431d2cee942b46e3034e0a7b10 (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/idea')
-rw-r--r-- | crypto/idea/i_skey.c | 17 | ||||
-rw-r--r-- | crypto/idea/idea.h | 3 |
2 files changed, 20 insertions, 0 deletions
diff --git a/crypto/idea/i_skey.c b/crypto/idea/i_skey.c index 3b1bbd8a45..fa75b14466 100644 --- a/crypto/idea/i_skey.c +++ b/crypto/idea/i_skey.c @@ -57,10 +57,27 @@ */ #include <openssl/idea.h> +#include <openssl/crypto.h> +#ifdef OPENSSL_FIPS +#include <openssl/fips.h> +#endif + #include "idea_lcl.h" static IDEA_INT inverse(unsigned int xin); + +#ifdef OPENSSL_FIPS +void idea_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks) + { + if (FIPS_mode()) + FIPS_BAD_ABORT(IDEA) + private_idea_set_encrypt_key(key, ks); + } +void private_idea_set_encrypt_key(const unsigned char *key, + IDEA_KEY_SCHEDULE *ks) +#else void idea_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks) +#endif { int i; register IDEA_INT *kt,*kf,r0,r1,r2; diff --git a/crypto/idea/idea.h b/crypto/idea/idea.h index bf97a37e39..a137d4cbce 100644 --- a/crypto/idea/idea.h +++ b/crypto/idea/idea.h @@ -83,6 +83,9 @@ typedef struct idea_key_st const char *idea_options(void); void idea_ecb_encrypt(const unsigned char *in, unsigned char *out, IDEA_KEY_SCHEDULE *ks); +#ifdef OPENSSL_FIPS +void private_idea_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks); +#endif void idea_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks); void idea_set_decrypt_key(const IDEA_KEY_SCHEDULE *ek, IDEA_KEY_SCHEDULE *dk); void idea_cbc_encrypt(const unsigned char *in, unsigned char *out, |