[openssl] master update

shane.lontis at oracle.com shane.lontis at oracle.com
Sat Dec 21 23:45:58 UTC 2019


The branch master has been updated
       via  390b18a7a2b795b085c39b380e64d0f86b3801e5 (commit)
      from  169e422edd07d4faf9cc3931dcc738b0b7402fd0 (commit)


- Log -----------------------------------------------------------------
commit 390b18a7a2b795b085c39b380e64d0f86b3801e5
Author: Shane Lontis <shane.lontis at oracle.com>
Date:   Sun Dec 22 09:44:38 2019 +1000

    Add fips self test DEP for solaris and hpux
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/10640)

-----------------------------------------------------------------------

Summary of changes:
 providers/fips/selftest.c | 37 +++++++++++++++++++++++++++++++------
 1 file changed, 31 insertions(+), 6 deletions(-)

diff --git a/providers/fips/selftest.c b/providers/fips/selftest.c
index 5dcc0adf43..91e4bb07f5 100644
--- a/providers/fips/selftest.c
+++ b/providers/fips/selftest.c
@@ -50,6 +50,10 @@ DEFINE_RUN_ONCE_STATIC(do_fips_self_test_init)
     return self_test_lock != NULL;
 }
 
+#define DEP_DECLARE()                                                          \
+void init(void);                                                               \
+void cleanup(void);
+
 /*
  * This is the Default Entry Point (DEP) code. Every platform must have a DEP.
  * See FIPS 140-2 IG 9.10
@@ -70,34 +74,55 @@ DEFINE_RUN_ONCE_STATIC(do_fips_self_test_init)
  */
 # endif
 
+DEP_DECLARE()
+# define DEP_INIT_ATTRIBUTE
+# define DEP_FINI_ATTRIBUTE
 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
 {
     switch (fdwReason) {
     case DLL_PROCESS_ATTACH:
-        FIPS_state = FIPS_STATE_SELFTEST;
+        init();
         break;
     case DLL_PROCESS_DETACH:
-        CRYPTO_THREAD_lock_free(self_test_lock);
+        cleanup();
         break;
     default:
         break;
     }
     return TRUE;
 }
+#elif defined(__sun)
+
+DEP_DECLARE() /* must be declared before pragma */
+# define DEP_INIT_ATTRIBUTE
+# define DEP_FINI_ATTRIBUTE
+# pragma init(init)
+# pragma fini(cleanup)
+
+#elif defined(__hpux)
+
+DEP_DECLARE()
+# define DEP_INIT_ATTRIBUTE
+# define DEP_FINI_ATTRIBUTE
+# pragma init "init"
+# pragma fini "cleanup"
+
 #elif defined(__GNUC__)
+# define DEP_INIT_ATTRIBUTE static __attribute__((constructor))
+# define DEP_FINI_ATTRIBUTE static __attribute__((destructor))
+#endif
 
-static __attribute__((constructor)) void init(void)
+#if defined(DEP_INIT_ATTRIBUTE) && defined(DEP_FINI_ATTRIBUTE)
+DEP_INIT_ATTRIBUTE void init(void)
 {
     FIPS_state = FIPS_STATE_SELFTEST;
 }
 
-
-static __attribute__((destructor)) void cleanup(void)
+DEP_FINI_ATTRIBUTE void cleanup(void)
 {
     CRYPTO_THREAD_lock_free(self_test_lock);
 }
-
 #endif
 
 /*


More information about the openssl-commits mailing list