summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Relyea <rrelyea@redhat.com>2015-09-04 11:36:43 -0700
committerRobert Relyea <rrelyea@redhat.com>2015-09-04 11:36:43 -0700
commit25cbc970a03488be0372665e99ec10e3d0ee16b0 (patch)
tree4d8f45e6a328268ae8938b0f7c9e50d407f7fad0
parentd08c90afd81d8c796a4c2fa6b007d5447115ba42 (diff)
downloadnss-hg-25cbc970a03488be0372665e99ec10e3d0ee16b0.tar.gz
Make sure NSS_NO_INIT_SUPPORT is in lg as well as softoken and freebl.
If NSS_NO_INIT_SUPPORT is set, don't even try to enable on dll load constructor.
-rw-r--r--lib/freebl/fipsfreebl.c4
-rw-r--r--lib/softoken/fipstest.c5
-rw-r--r--lib/softoken/legacydb/Makefile14
-rw-r--r--lib/softoken/legacydb/lgfips.c12
4 files changed, 25 insertions, 10 deletions
diff --git a/lib/freebl/fipsfreebl.c b/lib/freebl/fipsfreebl.c
index 2e393b456..346ac544a 100644
--- a/lib/freebl/fipsfreebl.c
+++ b/lib/freebl/fipsfreebl.c
@@ -26,6 +26,7 @@
* platforms have a link line way of invoking this function.
*/
+#ifndef NSS_NO_INIT_SUPPORT
/* The pragma */
#if defined(USE_INIT_PRAGMA)
#pragma init(bl_startup_tests)
@@ -33,7 +34,7 @@
/* GCC Attribute */
-#if defined(__GNUC__) && !defined(NSS_NO_INIT_SUPPORT)
+#if defined(__GNUC__)
#define INIT_FUNCTION __attribute__((constructor))
#else
#define INIT_FUNCTION
@@ -76,6 +77,7 @@ BOOL WINAPI DllMain(
return TRUE; // Successful DLL_PROCESS_ATTACH.
}
#endif
+#endif /* !NSS_NO_INIT_SUPPORT */
/* insert other platform dependent init entry points here, or modify
* the linker line */
diff --git a/lib/softoken/fipstest.c b/lib/softoken/fipstest.c
index 60918c923..fdb48e287 100644
--- a/lib/softoken/fipstest.c
+++ b/lib/softoken/fipstest.c
@@ -18,14 +18,14 @@
* or the GCC attribute. Some platforms suppor a pre-defined name, and some
* platforms have a link line way of invoking this function.
*/
-
+#ifndef NSS_NO_INIT_SUPPORT
/* The pragma */
#if defined(USE_INIT_PRAGMA)
#pragma init(sftk_startup_tests)
#endif
/* GCC Attribute */
-#if defined(__GNUC__) && !defined(NSS_NO_INIT_SUPPORT)
+#if defined(__GNUC__)
#define INIT_FUNCTION __attribute__((constructor))
#else
#define INIT_FUNCTION
@@ -67,6 +67,7 @@ BOOL WINAPI DllMain(
return TRUE; // Successful DLL_PROCESS_ATTACH.
}
#endif
+#endif /* !NSS_NO_INIT_SUPPORT */
diff --git a/lib/softoken/legacydb/Makefile b/lib/softoken/legacydb/Makefile
index 616c65fbd..b7e94cae3 100644
--- a/lib/softoken/legacydb/Makefile
+++ b/lib/softoken/legacydb/Makefile
@@ -20,7 +20,19 @@ include $(CORE_DEPTH)/coreconf/config.mk
# (3) Include "component" configuration information. (OPTIONAL) #
#######################################################################
-
+ifdef NSS_NO_INIT_SUPPORT
+ DEFINES += -DNSS_NO_INIT_SUPPORT
+endif
+ifeq ($(OS_TARGET),Linux)
+ifeq ($(CPU_ARCH),ppc)
+ifdef USE_64
+ DEFINES += -DNSS_NO_INIT_SUPPORT
+endif # USE_64
+endif # ppc
+else # !Linux
+ # turn off no init support everywhere for now
+ DEFINES += -DNSS_NO_INIT_SUPPORT
+endif # Linux
#######################################################################
# (4) Include "local" platform-dependent assignments (OPTIONAL). #
diff --git a/lib/softoken/legacydb/lgfips.c b/lib/softoken/legacydb/lgfips.c
index 414cee6b1..1e4c40c95 100644
--- a/lib/softoken/legacydb/lgfips.c
+++ b/lib/softoken/legacydb/lgfips.c
@@ -16,7 +16,7 @@
* or the GCC attribute. Some platforms suppor a pre-defined name, and some
* platforms have a link line way of invoking this function.
*/
-
+#ifndef NSS_NO_INIT_SUPPORT
/* The pragma */
#if defined(USE_INIT_PRAGMA)
#pragma init(lg_startup_tests)
@@ -66,6 +66,7 @@ BOOL WINAPI DllMain(
return TRUE; // Successful DLL_PROCESS_ATTACH.
}
#endif
+#endif /* !NSS_NO_INIT_SUPPORT */
static PRBool lg_self_tests_ran = PR_FALSE;
static PRBool lg_self_tests_success = PR_FALSE;
@@ -101,13 +102,12 @@ lg_startup_tests(void)
PRBool
lg_FIPSEntryOK() {
-#ifdef NO_INIT_SUPPORT
+#ifdef NSS_NO_INIT_SUPPORT
/* this should only be set on platforms that can't handle one of the INIT
* schemes. This code allows those platforms to continue to function,
- * though they don't meet the strict NIST requirements. If NO_INIT_SUPPORT
- * is not set, and init support has not been properly enabled, softken
- * will always fail because of the test below */
- */
+ * though they don't meet the strict NIST requirements.
+ * If NSS_NO_INIT_SUPPORT is not set, and init support has not been
+ * properly enabled, softken will always fail because of the test below */
if (!lg_self_tests_ran) {
lg_startup_tests();
}