Provide framework for auto initialise/deinitialise of the library
[openssl.git] / include / openssl / crypto.h
index 1251aa1..dd1089d 100644 (file)
@@ -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