Transfer error redirection to fips.h, add OPENSSL_FIPSAPI to source files
that use it.
diff --git a/crypto/bn/bn_add.c b/crypto/bn/bn_add.c
index 9405163..f8e6729 100644
--- a/crypto/bn/bn_add.c
+++ b/crypto/bn/bn_add.c
@@ -56,6 +56,8 @@
  * [including the GNU Public Licence.]
  */
 
+#define OPENSSL_FIPSAPI
+
 #include <stdio.h>
 #include "cryptlib.h"
 #include "bn_lcl.h"
diff --git a/crypto/bn/bn_div.c b/crypto/bn/bn_div.c
index 802a43d..a6a9558 100644
--- a/crypto/bn/bn_div.c
+++ b/crypto/bn/bn_div.c
@@ -56,6 +56,8 @@
  * [including the GNU Public Licence.]
  */
 
+#define OPENSSL_FIPSAPI
+
 #include <stdio.h>
 #include <openssl/bn.h>
 #include "cryptlib.h"
diff --git a/crypto/bn/bn_exp2.c b/crypto/bn/bn_exp2.c
index bd0c34b..a00c115 100644
--- a/crypto/bn/bn_exp2.c
+++ b/crypto/bn/bn_exp2.c
@@ -109,6 +109,8 @@
  *
  */
 
+#define OPENSSL_FIPSAPI
+
 #include <stdio.h>
 #include "cryptlib.h"
 #include "bn_lcl.h"
diff --git a/crypto/bn/bn_gcd.c b/crypto/bn/bn_gcd.c
index 45b417b..adef79e 100644
--- a/crypto/bn/bn_gcd.c
+++ b/crypto/bn/bn_gcd.c
@@ -109,6 +109,8 @@
  *
  */
 
+#define OPENSSL_FIPSAPI
+
 #include "cryptlib.h"
 #include "bn_lcl.h"
 
diff --git a/crypto/bn/bn_mod.c b/crypto/bn/bn_mod.c
index 77d6ddb..49c74fb 100644
--- a/crypto/bn/bn_mod.c
+++ b/crypto/bn/bn_mod.c
@@ -111,6 +111,8 @@
  * [including the GNU Public Licence.]
  */
 
+#define OPENSSL_FIPSAPI
+
 #include "cryptlib.h"
 #include "bn_lcl.h"
 
diff --git a/crypto/dh/dh_gen.c b/crypto/dh/dh_gen.c
index 82e5600..9749b72 100644
--- a/crypto/dh/dh_gen.c
+++ b/crypto/dh/dh_gen.c
@@ -61,6 +61,8 @@
  *  - Geoff
  */
 
+#define OPENSSL_FIPSAPI
+
 #include <stdio.h>
 #include "cryptlib.h"
 #include <openssl/bn.h>
diff --git a/crypto/dh/dh_key.c b/crypto/dh/dh_key.c
index 99c722b..bba83be 100644
--- a/crypto/dh/dh_key.c
+++ b/crypto/dh/dh_key.c
@@ -56,6 +56,8 @@
  * [including the GNU Public Licence.]
  */
 
+#define OPENSSL_FIPSAPI
+
 #include <stdio.h>
 #include "cryptlib.h"
 #include <openssl/bn.h>
diff --git a/crypto/dsa/dsa_key.c b/crypto/dsa/dsa_key.c
index 5cacc04..a90b3c4 100644
--- a/crypto/dsa/dsa_key.c
+++ b/crypto/dsa/dsa_key.c
@@ -56,6 +56,8 @@
  * [including the GNU Public Licence.]
  */
 
+#define OPENSSL_FIPSAPI
+
 #include <stdio.h>
 #include <time.h>
 #include "cryptlib.h"
diff --git a/crypto/dsa/dsa_ossl.c b/crypto/dsa/dsa_ossl.c
index fd75708..8fa39e9 100644
--- a/crypto/dsa/dsa_ossl.c
+++ b/crypto/dsa/dsa_ossl.c
@@ -58,6 +58,8 @@
 
 /* Original version from Steven Schoch <schoch@sheba.arc.nasa.gov> */
 
+#define OPENSSL_FIPSAPI
+
 #include <stdio.h>
 #include "cryptlib.h"
 #include <openssl/bn.h>
diff --git a/crypto/err/err.h b/crypto/err/err.h
index 37aee6f..3d71e42 100644
--- a/crypto/err/err.h
+++ b/crypto/err/err.h
@@ -137,11 +137,6 @@
 #define ERR_PUT_error(a,b,c,d,e)	ERR_put_error(a,b,c,NULL,0)
 #endif
 
-#if defined(OPENSSL_FIPSCANISTER) && !defined(OPENSSL_NO_FIPS_ERR)
-#define ERR_put_error FIPS_put_error
-#define ERR_add_error_data FIPS_add_error_data
-#endif
-
 #ifdef OPENSSL_FIPS
 void FIPS_set_error_callbacks(
 	void (*put_cb)(int lib, int func,int reason,const char *file,int line),
diff --git a/crypto/evp/e_aes.c b/crypto/evp/e_aes.c
index 32c9033..b4da40d 100644
--- a/crypto/evp/e_aes.c
+++ b/crypto/evp/e_aes.c
@@ -48,6 +48,8 @@
  *
  */
 
+#define OPENSSL_FIPSAPI
+
 #include <openssl/opensslconf.h>
 #ifndef OPENSSL_NO_AES
 #include <openssl/evp.h>
diff --git a/crypto/fips_err.c b/crypto/fips_err.c
deleted file mode 100644
index 09f1174..0000000
--- a/crypto/fips_err.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <openssl/opensslconf.h>
-
-#ifdef OPENSSL_FIPS
-# include "fips_err.h"
-#else
-static void *dummy=&dummy;
-#endif
diff --git a/crypto/rsa/rsa_crpt.c b/crypto/rsa/rsa_crpt.c
index 7750366..6a0cf39 100644
--- a/crypto/rsa/rsa_crpt.c
+++ b/crypto/rsa/rsa_crpt.c
@@ -56,6 +56,8 @@
  * [including the GNU Public Licence.]
  */
 
+#define OPENSSL_FIPSAPI
+
 #include <stdio.h>
 #include <openssl/crypto.h>
 #include "cryptlib.h"
diff --git a/crypto/rsa/rsa_none.c b/crypto/rsa/rsa_none.c
index e6f3e62..b8d01a9 100644
--- a/crypto/rsa/rsa_none.c
+++ b/crypto/rsa/rsa_none.c
@@ -56,6 +56,8 @@
  * [including the GNU Public Licence.]
  */
 
+#define OPENSSL_FIPSAPI
+
 #include <stdio.h>
 #include "cryptlib.h"
 #include <openssl/bn.h>
diff --git a/crypto/rsa/rsa_pk1.c b/crypto/rsa/rsa_pk1.c
index 8560755..0cce4bf 100644
--- a/crypto/rsa/rsa_pk1.c
+++ b/crypto/rsa/rsa_pk1.c
@@ -56,6 +56,8 @@
  * [including the GNU Public Licence.]
  */
 
+#define OPENSSL_FIPSAPI
+
 #include <stdio.h>
 #include "cryptlib.h"
 #include <openssl/bn.h>
diff --git a/crypto/rsa/rsa_ssl.c b/crypto/rsa/rsa_ssl.c
index cfeff15..1831fcf 100644
--- a/crypto/rsa/rsa_ssl.c
+++ b/crypto/rsa/rsa_ssl.c
@@ -56,6 +56,8 @@
  * [including the GNU Public Licence.]
  */
 
+#define OPENSSL_FIPSAPI
+
 #include <stdio.h>
 #include "cryptlib.h"
 #include <openssl/bn.h>
diff --git a/crypto/rsa/rsa_x931.c b/crypto/rsa/rsa_x931.c
index 21548e3..f037f4e 100644
--- a/crypto/rsa/rsa_x931.c
+++ b/crypto/rsa/rsa_x931.c
@@ -56,6 +56,8 @@
  *
  */
 
+#define OPENSSL_FIPSAPI
+
 #include <stdio.h>
 #include "cryptlib.h"
 #include <openssl/bn.h>
diff --git a/crypto/rsa/rsa_x931g.c b/crypto/rsa/rsa_x931g.c
index 42c262a..1ccd0a1 100644
--- a/crypto/rsa/rsa_x931g.c
+++ b/crypto/rsa/rsa_x931g.c
@@ -56,6 +56,8 @@
  * [including the GNU Public Licence.]
  */
 
+#define OPENSSL_FIPSAPI
+
 #include <stdio.h>
 #include <string.h>
 #include <time.h>
diff --git a/fips/fips.h b/fips/fips.h
index ea01f9f..9d7c370 100644
--- a/fips/fips.h
+++ b/fips/fips.h
@@ -120,6 +120,9 @@
 #define CRYPTO_malloc FIPS_malloc
 #define CRYPTO_free FIPS_free
 
+#define ERR_put_error FIPS_put_error
+#define ERR_add_error_data FIPS_add_error_data
+
 #define EVP_MD_CTX_init FIPS_md_ctx_init
 #define EVP_MD_CTX_cleanup FIPS_md_ctx_cleanup
 #define EVP_MD_CTX_create FIPS_md_ctx_create
diff --git a/fips/hmac/fips_hmac_selftest.c b/fips/hmac/fips_hmac_selftest.c
index 73455ff..a3967a4 100644
--- a/fips/hmac/fips_hmac_selftest.c
+++ b/fips/hmac/fips_hmac_selftest.c
@@ -47,6 +47,8 @@
  *
  */
 
+#define OPENSSL_FIPSAPI
+
 #include <string.h>
 #include <openssl/err.h>
 #include <openssl/fips.h>
diff --git a/fips/rand/fips_rand_selftest.c b/fips/rand/fips_rand_selftest.c
index 2194a76..f352cc6 100644
--- a/fips/rand/fips_rand_selftest.c
+++ b/fips/rand/fips_rand_selftest.c
@@ -47,6 +47,8 @@
  *
  */
 
+#define OPENSSL_FIPSAPI
+
 #include <string.h>
 #include <openssl/err.h>
 #include <openssl/fips.h>
diff --git a/fips/utl/fips_err.c b/fips/utl/fips_err.c
index d595244..ddc9176 100644
--- a/fips/utl/fips_err.c
+++ b/fips/utl/fips_err.c
@@ -51,6 +51,8 @@
  * ====================================================================
  */
 
+#define OPENSSL_FIPSAPI
+
 #include <openssl/err.h>
 #include <openssl/fips.h>