summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2011-01-27 15:22:26 +0000
committerDr. Stephen Henson <steve@openssl.org>2011-01-27 15:22:26 +0000
commit7c8ced94c32131f24d469d2899f3339f77c47aa1 (patch)
tree7dad16d42ed83f3d03917fc25d46fefa4647a2cc /crypto
parentd5df1b3f0db030c2202cbcc7c0ca9921d3db2ce0 (diff)
Change OPENSSL_FIPSEVP to OPENSSL_FIPSAPI as it doesn't just refer
to EVP any more. Move locking #define into fips.h. Set FIPS locking callbacks at same time as OpenSSL locking callbacks.
Diffstat (limited to 'crypto')
-rw-r--r--crypto/bn/bn_mont.c2
-rw-r--r--crypto/crypto.h4
-rw-r--r--crypto/dsa/dsa_gen.c2
-rw-r--r--crypto/evp/evp.h2
-rw-r--r--crypto/hmac/hmac.c2
-rw-r--r--crypto/lock.c9
-rw-r--r--crypto/rand/md_rand.c2
-rw-r--r--crypto/rsa/rsa_eay.c2
-rw-r--r--crypto/rsa/rsa_oaep.c2
-rw-r--r--crypto/rsa/rsa_pss.c2
10 files changed, 17 insertions, 12 deletions
diff --git a/crypto/bn/bn_mont.c b/crypto/bn/bn_mont.c
index b00a8cf340..2f7fb843a9 100644
--- a/crypto/bn/bn_mont.c
+++ b/crypto/bn/bn_mont.c
@@ -116,7 +116,7 @@
* sections 3.8 and 4.2 in http://security.ece.orst.edu/koc/papers/r01rsasw.pdf
*/
-#define OPENSSL_FIPSEVP
+#define OPENSSL_FIPSAPI
#include <stdio.h>
#include "cryptlib.h"
diff --git a/crypto/crypto.h b/crypto/crypto.h
index 84d3520ec2..5089c65882 100644
--- a/crypto/crypto.h
+++ b/crypto/crypto.h
@@ -249,10 +249,6 @@ typedef struct openssl_item_st
#define CRYPTO_add(a,b,c) ((*(a))+=(b))
#endif
-#if defined(OPENSSL_FIPSCANISTER) && defined(OPENSSL_FIPSEVP)
-#define CRYPTO_lock FIPS_lock
-#endif
-
/* Some applications as well as some parts of OpenSSL need to allocate
and deallocate locks in a dynamic fashion. The following typedef
makes this possible in a type-safe manner. */
diff --git a/crypto/dsa/dsa_gen.c b/crypto/dsa/dsa_gen.c
index 8096a15eb2..d5a41c249a 100644
--- a/crypto/dsa/dsa_gen.c
+++ b/crypto/dsa/dsa_gen.c
@@ -73,7 +73,7 @@
#ifndef OPENSSL_NO_SHA
-#define OPENSSL_FIPSEVP
+#define OPENSSL_FIPSAPI
#include <stdio.h>
#include "cryptlib.h"
diff --git a/crypto/evp/evp.h b/crypto/evp/evp.h
index 0db6f15ac9..086da7c794 100644
--- a/crypto/evp/evp.h
+++ b/crypto/evp/evp.h
@@ -551,7 +551,7 @@ int FIPS_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
#endif
-#if defined(OPENSSL_FIPSCANISTER) && defined(OPENSSL_FIPSEVP)
+#if defined(OPENSSL_FIPSCANISTER) && defined(OPENSSL_FIPSAPI)
#define EVP_MD_CTX_init FIPS_md_ctx_init
#define EVP_MD_CTX_cleanup FIPS_md_ctx_cleanup
diff --git a/crypto/hmac/hmac.c b/crypto/hmac/hmac.c
index 88941bdb45..dc28d8da87 100644
--- a/crypto/hmac/hmac.c
+++ b/crypto/hmac/hmac.c
@@ -56,7 +56,7 @@
* [including the GNU Public Licence.]
*/
-#define OPENSSL_FIPSEVP
+#define OPENSSL_FIPSAPI
#include <stdio.h>
#include <stdlib.h>
diff --git a/crypto/lock.c b/crypto/lock.c
index 49db044fc1..bbce52addb 100644
--- a/crypto/lock.c
+++ b/crypto/lock.c
@@ -116,6 +116,9 @@
#include "cryptlib.h"
#include <openssl/safestack.h>
+#ifdef OPENSSL_FIPS
+#include <openssl/fips.h>
+#endif
#if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN16)
static double SSLeay_MSVC5_hack=0.0; /* and for VC1.5 */
@@ -380,6 +383,9 @@ void CRYPTO_set_dynlock_create_callback(struct CRYPTO_dynlock_value *(*func)
void CRYPTO_set_dynlock_lock_callback(void (*func)(int mode,
struct CRYPTO_dynlock_value *l, const char *file, int line))
{
+#ifdef OPENSSL_FIPS
+ FIPS_set_locking_callback(CRYPTO_lock);
+#endif
dynlock_lock_callback=func;
}
@@ -405,6 +411,9 @@ int (*CRYPTO_get_add_lock_callback(void))(int *num,int mount,int type,
void CRYPTO_set_locking_callback(void (*func)(int mode,int type,
const char *file,int line))
{
+#ifdef OPENSSL_FIPS
+ FIPS_set_locking_callback(CRYPTO_lock);
+#endif
locking_callback=func;
}
diff --git a/crypto/rand/md_rand.c b/crypto/rand/md_rand.c
index a06fd209d9..87d4bfb75d 100644
--- a/crypto/rand/md_rand.c
+++ b/crypto/rand/md_rand.c
@@ -109,7 +109,7 @@
*
*/
-#define OPENSSL_FIPSEVP
+#define OPENSSL_FIPSAPI
#ifdef MD_RAND_DEBUG
# ifndef NDEBUG
diff --git a/crypto/rsa/rsa_eay.c b/crypto/rsa/rsa_eay.c
index 1f18854f06..b088d0dbf5 100644
--- a/crypto/rsa/rsa_eay.c
+++ b/crypto/rsa/rsa_eay.c
@@ -109,7 +109,7 @@
*
*/
-#define OPENSSL_FIPSEVP
+#define OPENSSL_FIPSAPI
#include <stdio.h>
#include "cryptlib.h"
diff --git a/crypto/rsa/rsa_oaep.c b/crypto/rsa/rsa_oaep.c
index bf8dd044b1..eaae712236 100644
--- a/crypto/rsa/rsa_oaep.c
+++ b/crypto/rsa/rsa_oaep.c
@@ -18,7 +18,7 @@
* an equivalent notion.
*/
-#define OPENSSL_FIPSEVP
+#define OPENSSL_FIPSAPI
#if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA1)
diff --git a/crypto/rsa/rsa_pss.c b/crypto/rsa/rsa_pss.c
index 794de9dff6..e8f6798bbd 100644
--- a/crypto/rsa/rsa_pss.c
+++ b/crypto/rsa/rsa_pss.c
@@ -56,7 +56,7 @@
*
*/
-#define OPENSSL_FIPSEVP
+#define OPENSSL_FIPSAPI
#include <stdio.h>
#include "cryptlib.h"