Updates for auto init/deinit review comments
authorMatt Caswell <matt@openssl.org>
Tue, 9 Feb 2016 13:12:34 +0000 (13:12 +0000)
committerMatt Caswell <matt@openssl.org>
Tue, 9 Feb 2016 15:12:02 +0000 (15:12 +0000)
Fixes for the auto-init/deinit code based on review comments

Reviewed-by: Richard Levitte <levitte@openssl.org>
INSTALL
INSTALL.WIN
apps/openssl.c
crypto/conf/conf_sap.c
crypto/init.c
doc/crypto/OPENSSL_INIT_crypto_library_start.pod
doc/ssl/OPENSSL_INIT_ssl_library_start.pod
include/openssl/evp.h
ssl/ssl_init.c
util/libeay.num

diff --git a/INSTALL b/INSTALL
index 5bb720995fd07f55288ef4fcc7b19286d9a7e5c5..520de7bf67bf639ee7619f671d193a1568c75cea 100644 (file)
--- a/INSTALL
+++ b/INSTALL
  you can still use "no-threads" to suppress an annoying warning message
  from the Configure script.)
 
  you can still use "no-threads" to suppress an annoying warning message
  from the Configure script.)
 
- OpenSSL provides in built support for two threading models: pthreads (found on
+ OpenSSL provides built-in support for two threading models: pthreads (found on
  most UNIX/Linux systems), and Windows threads. No other threading models are
  supported. If your platform does not provide pthreads or Windows threads then
  you should Configure with the "no-threads" option.
  most UNIX/Linux systems), and Windows threads. No other threading models are
  supported. If your platform does not provide pthreads or Windows threads then
  you should Configure with the "no-threads" option.
index ceb8d1ee39d36dd6ea993c5e7bc00a73a1e220a2..d57923886c59dc46483f2bd43b5d12161844e735 100644 (file)
  your application code small "shim" snippet, which provides glue between
  OpenSSL BIO layer and your compiler run-time. See the OPENSSL_Applink
  manual page for further details.
  your application code small "shim" snippet, which provides glue between
  OpenSSL BIO layer and your compiler run-time. See the OPENSSL_Applink
  manual page for further details.
-
- Support for older Windows platforms
- -----------------------------------
-
- By default OpenSSL will use functions and capabilities of the Windows platform
- only available in Windows Vista, Windows Server 2008 or later. It is possible
- to enable support for older platforms by defining _WIN32_WINNT at Configure
- time.
-
-  > perl Configure VC-WIN32 --prefix=c:\some\openssl\dir -D_WIN32_WINNT=0x0501
-
- The value 0x0501 above corresponds to Windows XP which is the oldest supported
- platform. The value 0x0600 corresponds to Windows Vista and Windows Server
- 2008. Refer to the Windows documentation for other possible values. Note that
- by forcing support for an older OpenSSL version this may mean less optimal
- approaches are used instead.
index febfc598e8c94a49cb12be54076a0fe818694157..e558b71d224b156cb887d5b5e0b3a1151911c856 100644 (file)
@@ -173,7 +173,7 @@ static int apps_startup()
 
     /* Set non-default library initialisation settings */
     OPENSSL_INIT_crypto_library_start(OPENSSL_INIT_ENGINE_ALL_BUILTIN
 
     /* Set non-default library initialisation settings */
     OPENSSL_INIT_crypto_library_start(OPENSSL_INIT_ENGINE_ALL_BUILTIN
-                                   | OPENSSL_INIT_LOAD_CONFIG, NULL);
+                                      | OPENSSL_INIT_LOAD_CONFIG, NULL);
 
     setup_ui_method();
 
 
     setup_ui_method();
 
index bb1dcc502f040902841eac03575585bd11f53570..ff19167e248fe98d6ab9fa6f59649639e300f24a 100644 (file)
@@ -81,8 +81,7 @@ void OPENSSL_config(const char *config_name)
         { OPENSSL_INIT_SET_CONF_FILENAME, .value.type_string = config_name },
         { OPENSSL_INIT_SET_END, .value.type_int = 0 }
     };
         { OPENSSL_INIT_SET_CONF_FILENAME, .value.type_string = config_name },
         { OPENSSL_INIT_SET_END, .value.type_int = 0 }
     };
-    OPENSSL_INIT_crypto_library_start(OPENSSL_INIT_LOAD_CONFIG,
-                                      (const OPENSSL_INIT_SETTINGS *)&settings);
+    OPENSSL_INIT_crypto_library_start(OPENSSL_INIT_LOAD_CONFIG, settings);
 }
 
 void openssl_config_internal(const char *config_name)
 }
 
 void openssl_config_internal(const char *config_name)
index 1bfde6973ceb41c114296ea50f2188f03fc336dd..b9cc6a1f76556bb4339be10a81844263fec83bb8 100644 (file)
  *
  */
 
  *
  */
 
-#include <openssl/e_os2.h>
-
-#if defined(OPENSSL_SYS_WINDOWS) && !defined(_WIN32_WINNT)
-/*
- * We default to requiring Windows Vista, Windows Server 2008 or later. We can
- * support lower versions if _WIN32_WINNT is explicity defined to something
- * less
- */
-# define _WIN32_WINNT 0x0600
-#endif
-
 #include <internal/cryptlib_int.h>
 #include <openssl/err.h>
 #include <openssl/evp.h>
 #include <internal/cryptlib_int.h>
 #include <openssl/err.h>
 #include <openssl/evp.h>
index bea0e62f935ddee28aafb2be14c7a33044ebd9a6..16f95fe604769fa9bb7bb7770563e38545d4d15c 100644 (file)
@@ -2,7 +2,7 @@
 
 =head1 NAME
 
 
 =head1 NAME
 
-OPENSSL_INIT_library_stop, OPENSSL_INIT_crypto_library_start,
+OPENSSL_INIT_crypto_library_start, OPENSSL_INIT_library_stop,
 OPENSSL_INIT_register_stop_handler, OPENSSL_INIT_thread_stop - OpenSSL
 initialisation and deinitialisation functions
 
 OPENSSL_INIT_register_stop_handler, OPENSSL_INIT_thread_stop - OpenSSL
 initialisation and deinitialisation functions
 
@@ -32,10 +32,12 @@ However, there way be situations when explicit initialisation is desirable or
 needed, for example when some non-default initialisation is required. The
 function OPENSSL_INIT_crypto_library_start() can be used for this purpose for
 libcrypto (see also L<OPENSSL_INIT_ssl_library_start(3)> for the libssl
 needed, for example when some non-default initialisation is required. The
 function OPENSSL_INIT_crypto_library_start() can be used for this purpose for
 libcrypto (see also L<OPENSSL_INIT_ssl_library_start(3)> for the libssl
-equivalent). In order to perform non-default initialisation it MUST be called
-prior to any other calls of this function. As numerous internal OpenSSL
-functions also call this, this usually means you should call it prior to ANY
-other OpenSSL function calls.
+equivalent).
+
+Numerous internal OpenSSL functions call OPENSSL_INIT_crypto_library_start().
+Therefore, in order to perform non-default initialisation,
+OPENSSL_INIT_crypto_library_start() MUST be called by application code prior to
+any other OpenSSL function calls.
 
 The B<opts> parameter specifies which aspects of libcrypto should be
 initialised. Valid options are:
 
 The B<opts> parameter specifies which aspects of libcrypto should be
 initialised. Valid options are:
@@ -166,8 +168,7 @@ configuration file is assumed. For example
      { OPENSSL_INIT_SET_CONF_FILENAME, .value.type_string = "myconf.cnf" },
      { OPENSSL_INIT_SET_END, .value.type_int = 0 }
  };
      { OPENSSL_INIT_SET_CONF_FILENAME, .value.type_string = "myconf.cnf" },
      { OPENSSL_INIT_SET_END, .value.type_int = 0 }
  };
- OPENSSL_INIT_crypto_library_start(OPENSSL_INIT_LOAD_CONFIG,
-                                   (const OPENSSL_INIT_SETTINGS *)&settings);
+ OPENSSL_INIT_crypto_library_start(OPENSSL_INIT_LOAD_CONFIG, settings);
 
 The B<settings> parameter must be an array of OPENSSL_INIT_SETTINGS values
 terminated with an OPENSSL_INIT_SET_END entry.
 
 The B<settings> parameter must be an array of OPENSSL_INIT_SETTINGS values
 terminated with an OPENSSL_INIT_SET_END entry.
@@ -221,6 +222,6 @@ L<OPENSSL_INIT_ssl_library_start(3)>
 
 The OPENSSL_INIT_library_stop, OPENSSL_INIT_crypto_library_start,
 OPENSSL_INIT_register_stop_handler and OPENSSL_INIT_thread_stop functions were
 
 The OPENSSL_INIT_library_stop, OPENSSL_INIT_crypto_library_start,
 OPENSSL_INIT_register_stop_handler and OPENSSL_INIT_thread_stop functions were
-first added in OpenSSL 1.1.0.
+added in OpenSSL 1.1.0.
 
 =cut
 
 =cut
index bcd39127f759d2d51f4522bd6de231cd70463723..c0f598df30de1bf553f1ebd9b2567b7814737ad3 100644 (file)
@@ -28,10 +28,12 @@ needed, for example when some non-default initialisation is required. The
 function OPENSSL_INIT_ssl_library_start() can be used for this purpose. Calling
 this function will explicitly initialise BOTH libcrypto and libssl. To
 explicitly initialise ONLY libcrypto see the
 function OPENSSL_INIT_ssl_library_start() can be used for this purpose. Calling
 this function will explicitly initialise BOTH libcrypto and libssl. To
 explicitly initialise ONLY libcrypto see the
-L<OPENSSL_INIT_crypto_library_start(3)> function. In order to perform
-non-default initialisation it MUST be called prior to any other calls of this
-function. As numerous internal OpenSSL functions also call this, this usually
-means you should call it prior to ANY other OpenSSL function calls.
+L<OPENSSL_INIT_crypto_library_start(3)> function.
+
+Numerous internal OpenSSL functions call OPENSSL_INIT_ssl_library_start().
+Therefore, in order to perform non-default initialisation,
+OPENSSL_INIT_ssl_library_start() MUST be called by application code prior to
+any other OpenSSL function calls.
 
 The B<opts> parameter specifies which aspects of libssl and libcrypto should be
 initialised. Valid options for libcrypto are described on the
 
 The B<opts> parameter specifies which aspects of libssl and libcrypto should be
 initialised. Valid options for libcrypto are described on the
@@ -73,6 +75,6 @@ L<OPENSSL_INIT_crypto_library_start(3)>
 
 =head1 HISTORY
 
 
 =head1 HISTORY
 
-The OPENSSL_INIT_ssl_library_start function was first added in OpenSSL 1.1.0.
+The OPENSSL_INIT_ssl_library_start function was added in OpenSSL 1.1.0.
 
 =cut
 
 =cut
index 91305b87b9d86690aee712fdbafae7d2b96e30b3..e3c75e9d3077e7c4d9123d12afdae1e885698589 100644 (file)
@@ -876,7 +876,7 @@ const EVP_CIPHER *EVP_seed_ofb(void);
                                       | OPENSSL_INIT_LOAD_CONFIG, NULL)
 #  define OPENSSL_add_all_algorithms_noconf() \
     OPENSSL_INIT_crypto_library_start(OPENSSL_INIT_ADD_ALL_CIPHERS \
                                       | OPENSSL_INIT_LOAD_CONFIG, NULL)
 #  define OPENSSL_add_all_algorithms_noconf() \
     OPENSSL_INIT_crypto_library_start(OPENSSL_INIT_ADD_ALL_CIPHERS \
-                                   OPENSSL_INIT_ADD_ALL_DIGESTS, NULL)
+                                      | OPENSSL_INIT_ADD_ALL_DIGESTS, NULL)
 
 # ifdef OPENSSL_LOAD_CONF
 #  define OpenSSL_add_all_algorithms() \
 
 # ifdef OPENSSL_LOAD_CONF
 #  define OpenSSL_add_all_algorithms() \
index 1bccba1cd85aa2dd62d62e012615b050b28d6618..f1aa2c401afe3ca667be9db4624d652c2e3760a8 100644 (file)
  *
  */
 
  *
  */
 
-#include <openssl/e_os2.h>
-
-#if defined(OPENSSL_SYS_WINDOWS) && !defined(_WIN32_WINNT)
-/*
- * We default to requiring Windows Vista, Windows Server 2008 or later. We can
- * support lower versions if _WIN32_WINNT is explicity defined to something
- * less
- */
-# define _WIN32_WINNT 0x0600
-#endif
+#include "e_os.h"
 
 #include <openssl/crypto.h>
 #include <openssl/evp.h>
 
 #include <openssl/crypto.h>
 #include <openssl/evp.h>
index fdb48fb81fb3ad87d6f0fbcf9f92c2e62fc1bb8f..48b235bf71e2abfbabd6462552636c42646550ac 100755 (executable)
@@ -4815,3 +4815,4 @@ PKCS12_SAFEBAG_get0_pkcs8               5209      1_1_0   EXIST::FUNCTION:
 OPENSSL_INIT_library_stop               5210   1_1_0   EXIST::FUNCTION:
 OPENSSL_INIT_register_stop_handler      5211   1_1_0   EXIST::FUNCTION:
 OPENSSL_INIT_crypto_library_start       5212   1_1_0   EXIST::FUNCTION:
 OPENSSL_INIT_library_stop               5210   1_1_0   EXIST::FUNCTION:
 OPENSSL_INIT_register_stop_handler      5211   1_1_0   EXIST::FUNCTION:
 OPENSSL_INIT_crypto_library_start       5212   1_1_0   EXIST::FUNCTION:
+OPENSSL_INIT_thread_stop                5213   1_1_0   EXIST::FUNCTION: