summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2016-02-09 11:26:14 +0000
committerMatt Caswell <matt@openssl.org>2016-02-09 15:11:38 +0000
commitb184e3ef73200cb3b7914a603b43a5b8a074c85f (patch)
tree95533e5aa6e9a0ae6e17605fc76441324cdc8ee9 /include
parentbc66265da8f4c8830cfaf229c985bc391075aa9d (diff)
Provide framework for auto initialise/deinitialise of the library
This commit provides the basis and core code for an auto initialisation and deinitialisation framework for libcrypto and libssl. The intention is to remove the need (in many circumstances) to call explicit initialise and deinitialise functions. Explicit initialisation will still be an option, and if non-default initialisation is needed then it will be required. Similarly for de-initialisation (although this will be a lot easier since it will bring all de-initialisation into a single function). Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'include')
-rw-r--r--include/openssl/crypto.h55
-rw-r--r--include/openssl/ssl.h9
2 files changed, 64 insertions, 0 deletions
diff --git a/include/openssl/crypto.h b/include/openssl/crypto.h
index 1251aa13d9..dd1089dc6c 100644
--- a/include/openssl/crypto.h
+++ b/include/openssl/crypto.h
@@ -546,6 +546,61 @@ int CRYPTO_memcmp(const volatile void * volatile in_a,
const volatile void * volatile in_b,
size_t len);
+/* Standard initialisation options */
+# define OPENSSL_INIT_NO_LOAD_CRYPTO_STRINGS 0x000001
+# define OPENSSL_INIT_LOAD_CRYPTO_STRINGS 0x000002
+# define OPENSSL_INIT_ADD_ALL_CIPHERS 0x000004
+# define OPENSSL_INIT_ADD_ALL_DIGESTS 0x000008
+# define OPENSSL_INIT_NO_ADD_ALL_CIPHERS 0x000010
+# define OPENSSL_INIT_NO_ADD_ALL_DIGESTS 0x000020
+# define OPENSSL_INIT_LOAD_CONFIG 0x000040
+# define OPENSSL_INIT_NO_LOAD_CONFIG 0x000080
+# define OPENSSL_INIT_ASYNC 0x000100
+# define OPENSSL_INIT_ENGINE_RDRAND 0x000200
+# define OPENSSL_INIT_ENGINE_DYNAMIC 0x000400
+# define OPENSSL_INIT_ENGINE_OPENSSL 0x000800
+# define OPENSSL_INIT_ENGINE_CRYPTODEV 0x001000
+# define OPENSSL_INIT_ENGINE_CAPI 0x002000
+# define OPENSSL_INIT_ENGINE_PADLOCK 0x004000
+# define OPENSSL_INIT_ENGINE_DASYNC 0x008000
+/* OPENSSL_INIT flag 0x010000 reserved for internal use */
+/* Max OPENSSL_INIT flag value is 0x80000000 */
+
+/* openssl and dasync not counted as builtin */
+# define OPENSSL_INIT_ENGINE_ALL_BUILTIN \
+ (OPENSSL_INIT_ENGINE_RDRAND | OPENSSL_INIT_ENGINE_DYNAMIC \
+ | OPENSSL_INIT_ENGINE_CRYPTODEV | OPENSSL_INIT_ENGINE_CAPI | \
+ OPENSSL_INIT_ENGINE_PADLOCK)
+
+
+
+/* Optional settings for initialisation */
+# define OPENSSL_INIT_SET_END 0
+# define OPENSSL_INIT_SET_CONF_FILENAME 1
+
+typedef struct ossl_init_settings_st {
+ int name;
+ union {
+ int type_int;
+ long type_long;
+ int32_t type_int32_t;
+ uint32_t type_uint32_t;
+ int64_t type_int64_t;
+ uint64_t type_uint64_t;
+ size_t type_size_t;
+ const char *type_string;
+ void *type_void_ptr;
+ } value;
+} OPENSSL_INIT_SETTINGS;
+
+typedef struct ossl_init_stop_st OPENSSL_INIT_STOP;
+
+/* Library initialisation functions */
+void OPENSSL_INIT_library_stop(void);
+void OPENSSL_INIT_crypto_library_start(uint64_t opts,
+ const OPENSSL_INIT_SETTINGS *settings);
+int OPENSSL_INIT_register_stop_handler(void (*handler)(void));
+
/* BEGIN ERROR CODES */
/*
* The following lines are auto generated by the script mkerr.pl. Any changes
diff --git a/include/openssl/ssl.h b/include/openssl/ssl.h
index 7bc46c5f78..ac61ccbdbb 100644
--- a/include/openssl/ssl.h
+++ b/include/openssl/ssl.h
@@ -1927,6 +1927,15 @@ int (*SSL_CTX_get_security_callback(const SSL_CTX *ctx)) (SSL *s,
void SSL_CTX_set0_security_ex_data(SSL_CTX *ctx, void *ex);
__owur void *SSL_CTX_get0_security_ex_data(const SSL_CTX *ctx);
+#define OPENSSL_INIT_NO_LOAD_SSL_STRINGS 0x0100000000
+#define OPENSSL_INIT_LOAD_SSL_STRINGS 0x0200000000
+
+#define OPENSSL_INIT_SSL_DEFAULT \
+ (OPENSSL_INIT_LOAD_SSL_STRINGS | OPENSSL_INIT_LOAD_CRYPTO_STRINGS)
+
+void OPENSSL_INIT_ssl_library_start(uint64_t opts,
+ const OPENSSL_INIT_SETTINGS *settings);
+
# ifndef OPENSSL_NO_UNIT_TEST
__owur const struct openssl_ssl_test_functions *SSL_test_functions(void);
# endif