From: Rich Salz Date: Wed, 23 Mar 2016 12:54:52 +0000 (-0400) Subject: Move dso.h to internal X-Git-Tag: OpenSSL_1_1_0-pre5~239 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=921de151d2052c794cf6ad82fe76da92717577f7;p=oweals%2Fopenssl.git Move dso.h to internal Reviewed-by: Richard Levitte --- diff --git a/crypto/asn1/asn_moid.c b/crypto/asn1/asn_moid.c index 168bc46bcf..8198874aa9 100644 --- a/crypto/asn1/asn_moid.c +++ b/crypto/asn1/asn_moid.c @@ -61,7 +61,6 @@ #include #include "internal/cryptlib.h" #include -#include #include #include "internal/asn1_int.h" diff --git a/crypto/comp/c_zlib.c b/crypto/comp/c_zlib.c index 138d686601..07c45d0dfc 100644 --- a/crypto/comp/c_zlib.c +++ b/crypto/comp/c_zlib.c @@ -123,7 +123,7 @@ static COMP_METHOD zlib_stateful_method = { * OPENSSL_SYS_WIN32) */ # ifdef ZLIB_SHARED -# include +# include "internal/dso.h" /* Function pointers */ typedef int (*compress_ft) (Bytef *dest, uLongf * destLen, diff --git a/crypto/conf/conf_mall.c b/crypto/conf/conf_mall.c index 8480c2f1c5..a5c961df02 100644 --- a/crypto/conf/conf_mall.c +++ b/crypto/conf/conf_mall.c @@ -60,7 +60,6 @@ #include #include "internal/cryptlib.h" #include -#include #include #include #include diff --git a/crypto/conf/conf_mod.c b/crypto/conf/conf_mod.c index d78396bbdf..aede656045 100644 --- a/crypto/conf/conf_mod.c +++ b/crypto/conf/conf_mod.c @@ -61,7 +61,7 @@ #include #include "internal/cryptlib.h" #include -#include +#include "internal/dso.h" #include #define DSO_mod_init_name "OPENSSL_init" diff --git a/crypto/conf/conf_sap.c b/crypto/conf/conf_sap.c index 9cc7a931f5..2198c2fe17 100644 --- a/crypto/conf/conf_sap.c +++ b/crypto/conf/conf_sap.c @@ -60,7 +60,6 @@ #include #include "internal/cryptlib.h" #include -#include #include #include #include diff --git a/crypto/dso/dso_err.c b/crypto/dso/dso_err.c index 750807c990..136c4fe5b4 100644 --- a/crypto/dso/dso_err.c +++ b/crypto/dso/dso_err.c @@ -1,5 +1,5 @@ /* ==================================================================== - * Copyright (c) 1999-2015 The OpenSSL Project. All rights reserved. + * Copyright (c) 1999-2016 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -58,7 +58,9 @@ * only reason strings will be preserved. */ -#include "dso_locl.h" +#include +#include +#include "internal/dso.h" /* BEGIN ERROR CODES */ #ifndef OPENSSL_NO_ERR @@ -85,16 +87,15 @@ static ERR_STRING_DATA DSO_str_functs[] = { {ERR_FUNC(DSO_F_DSO_GLOBAL_LOOKUP), "DSO_global_lookup"}, {ERR_FUNC(DSO_F_DSO_LOAD), "DSO_load"}, {ERR_FUNC(DSO_F_DSO_MERGE), "DSO_merge"}, + {ERR_FUNC(DSO_F_DSO_NEW_METHOD), "DSO_new_method"}, {ERR_FUNC(DSO_F_DSO_SET_FILENAME), "DSO_set_filename"}, {ERR_FUNC(DSO_F_DSO_UP_REF), "DSO_up_ref"}, - {ERR_FUNC(DSO_F_GLOBAL_LOOKUP_FUNC), "GLOBAL_LOOKUP_FUNC"}, {ERR_FUNC(DSO_F_VMS_BIND_SYM), "vms_bind_sym"}, {ERR_FUNC(DSO_F_VMS_LOAD), "vms_load"}, {ERR_FUNC(DSO_F_VMS_MERGER), "vms_merger"}, {ERR_FUNC(DSO_F_VMS_UNLOAD), "vms_unload"}, {ERR_FUNC(DSO_F_WIN32_BIND_FUNC), "win32_bind_func"}, {ERR_FUNC(DSO_F_WIN32_GLOBALLOOKUP), "win32_globallookup"}, - {ERR_FUNC(DSO_F_WIN32_GLOBALLOOKUP_FUNC), "WIN32_GLOBALLOOKUP_FUNC"}, {ERR_FUNC(DSO_F_WIN32_JOINER), "win32_joiner"}, {ERR_FUNC(DSO_F_WIN32_LOAD), "win32_load"}, {ERR_FUNC(DSO_F_WIN32_MERGER), "win32_merger"}, @@ -115,7 +116,6 @@ static ERR_STRING_DATA DSO_str_reasons[] = { {ERR_REASON(DSO_R_LOAD_FAILED), "could not load the shared library"}, {ERR_REASON(DSO_R_NAME_TRANSLATION_FAILED), "name translation failed"}, {ERR_REASON(DSO_R_NO_FILENAME), "no filename"}, - {ERR_REASON(DSO_R_NO_FILE_SPECIFICATION), "no file specification"}, {ERR_REASON(DSO_R_NULL_HANDLE), "a null shared library handle was used"}, {ERR_REASON(DSO_R_SET_FILENAME_FAILED), "set filename failed"}, {ERR_REASON(DSO_R_STACK_ERROR), "the meth_data stack is corrupt"}, diff --git a/crypto/dso/dso_locl.h b/crypto/dso/dso_locl.h index a4c54a7691..622e69ef83 100644 --- a/crypto/dso/dso_locl.h +++ b/crypto/dso/dso_locl.h @@ -8,7 +8,7 @@ */ #include #include "internal/cryptlib.h" -#include +#include "internal/dso.h" #include "internal/dso_conf.h" /**********************************************************************/ diff --git a/crypto/engine/eng_dyn.c b/crypto/engine/eng_dyn.c index bdfc00cce6..c7553e1c47 100644 --- a/crypto/engine/eng_dyn.c +++ b/crypto/engine/eng_dyn.c @@ -57,7 +57,7 @@ */ #include "eng_int.h" -#include +#include "internal/dso.h" #include /* diff --git a/crypto/engine/eng_openssl.c b/crypto/engine/eng_openssl.c index 2bf91b365f..fc0784f413 100644 --- a/crypto/engine/eng_openssl.c +++ b/crypto/engine/eng_openssl.c @@ -65,7 +65,6 @@ #include #include "internal/cryptlib.h" #include -#include #include #include #include diff --git a/crypto/err/err_all.c b/crypto/err/err_all.c index a79a84e544..25f7d411eb 100644 --- a/crypto/err/err_all.c +++ b/crypto/err/err_all.c @@ -74,7 +74,7 @@ #include #include #include -#include +#include "internal/dso.h" #include #include #include diff --git a/crypto/err/openssl.ec b/crypto/err/openssl.ec index 2e156600ad..a969d7a290 100644 --- a/crypto/err/openssl.ec +++ b/crypto/err/openssl.ec @@ -23,7 +23,7 @@ L PKCS7 include/openssl/pkcs7.h crypto/pkcs7/pkcs7err.c L X509V3 include/openssl/x509v3.h crypto/x509v3/v3err.c L PKCS12 include/openssl/pkcs12.h crypto/pkcs12/pk12err.c L RAND include/openssl/rand.h crypto/rand/rand_err.c -L DSO include/openssl/dso.h crypto/dso/dso_err.c +L DSO include/internal/dso.h crypto/dso/dso_err.c L ENGINE include/openssl/engine.h crypto/engine/eng_err.c L OCSP include/openssl/ocsp.h crypto/ocsp/ocsp_err.c L UI include/openssl/ui.h crypto/ui/ui_err.c diff --git a/crypto/evp/evp_cnf.c b/crypto/evp/evp_cnf.c index 7a365276e8..45e82c9246 100644 --- a/crypto/evp/evp_cnf.c +++ b/crypto/evp/evp_cnf.c @@ -61,7 +61,6 @@ #include #include "internal/cryptlib.h" #include -#include #include #include diff --git a/engines/e_chil.c b/engines/e_chil.c index 97eacfc31c..b09d5259a9 100644 --- a/engines/e_chil.c +++ b/engines/e_chil.c @@ -61,7 +61,7 @@ #include #include #include -#include +#include "internal/dso.h" #include #include #include diff --git a/engines/e_padlock.c b/engines/e_padlock.c index c5377b55bb..96e7483729 100644 --- a/engines/e_padlock.c +++ b/engines/e_padlock.c @@ -67,7 +67,6 @@ #include #include -#include #include #include #ifndef OPENSSL_NO_AES diff --git a/include/internal/dso.h b/include/internal/dso.h new file mode 100644 index 0000000000..eeb16b12d2 --- /dev/null +++ b/include/internal/dso.h @@ -0,0 +1,276 @@ +/* + * Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL project + * 2000. + */ +/* ==================================================================== + * Copyright (c) 2000 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_DSO_H +# define HEADER_DSO_H + +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/* These values are used as commands to DSO_ctrl() */ +# define DSO_CTRL_GET_FLAGS 1 +# define DSO_CTRL_SET_FLAGS 2 +# define DSO_CTRL_OR_FLAGS 3 + +/* + * By default, DSO_load() will translate the provided filename into a form + * typical for the platform using the dso_name_converter function of the + * method. Eg. win32 will transform "blah" into "blah.dll", and dlfcn will + * transform it into "libblah.so". This callback could even utilise the + * DSO_METHOD's converter too if it only wants to override behaviour for + * one or two possible DSO methods. However, the following flag can be + * set in a DSO to prevent *any* native name-translation at all - eg. if + * the caller has prompted the user for a path to a driver library so the + * filename should be interpreted as-is. + */ +# define DSO_FLAG_NO_NAME_TRANSLATION 0x01 +/* + * An extra flag to give if only the extension should be added as + * translation. This is obviously only of importance on Unix and other + * operating systems where the translation also may prefix the name with + * something, like 'lib', and ignored everywhere else. This flag is also + * ignored if DSO_FLAG_NO_NAME_TRANSLATION is used at the same time. + */ +# define DSO_FLAG_NAME_TRANSLATION_EXT_ONLY 0x02 + +/* + * The following flag controls the translation of symbol names to upper case. + * This is currently only being implemented for OpenVMS. + */ +# define DSO_FLAG_UPCASE_SYMBOL 0x10 + +/* + * This flag loads the library with public symbols. Meaning: The exported + * symbols of this library are public to all libraries loaded after this + * library. At the moment only implemented in unix. + */ +# define DSO_FLAG_GLOBAL_SYMBOLS 0x20 + +typedef void (*DSO_FUNC_TYPE) (void); + +typedef struct dso_st DSO; +typedef struct dso_meth_st DSO_METHOD; + +/* + * The function prototype used for method functions (or caller-provided + * callbacks) that transform filenames. They are passed a DSO structure + * pointer (or NULL if they are to be used independently of a DSO object) and + * a filename to transform. They should either return NULL (if there is an + * error condition) or a newly allocated string containing the transformed + * form that the caller will need to free with OPENSSL_free() when done. + */ +typedef char *(*DSO_NAME_CONVERTER_FUNC)(DSO *, const char *); +/* + * The function prototype used for method functions (or caller-provided + * callbacks) that merge two file specifications. They are passed a DSO + * structure pointer (or NULL if they are to be used independently of a DSO + * object) and two file specifications to merge. They should either return + * NULL (if there is an error condition) or a newly allocated string + * containing the result of merging that the caller will need to free with + * OPENSSL_free() when done. Here, merging means that bits and pieces are + * taken from each of the file specifications and added together in whatever + * fashion that is sensible for the DSO method in question. The only rule + * that really applies is that if the two specification contain pieces of the + * same type, the copy from the first string takes priority. One could see + * it as the first specification is the one given by the user and the second + * being a bunch of defaults to add on if they're missing in the first. + */ +typedef char *(*DSO_MERGER_FUNC)(DSO *, const char *, const char *); + +DSO *DSO_new(void); +int DSO_free(DSO *dso); +int DSO_flags(DSO *dso); +int DSO_up_ref(DSO *dso); +long DSO_ctrl(DSO *dso, int cmd, long larg, void *parg); + +/* + * These functions can be used to get/set the platform-independent filename + * used for a DSO. NB: set will fail if the DSO is already loaded. + */ +const char *DSO_get_filename(DSO *dso); +int DSO_set_filename(DSO *dso, const char *filename); +/* + * This function will invoke the DSO's name_converter callback to translate a + * filename, or if the callback isn't set it will instead use the DSO_METHOD's + * converter. If "filename" is NULL, the "filename" in the DSO itself will be + * used. If the DSO_FLAG_NO_NAME_TRANSLATION flag is set, then the filename is + * simply duplicated. NB: This function is usually called from within a + * DSO_METHOD during the processing of a DSO_load() call, and is exposed so + * that caller-created DSO_METHODs can do the same thing. A non-NULL return + * value will need to be OPENSSL_free()'d. + */ +char *DSO_convert_filename(DSO *dso, const char *filename); +/* + * This function will invoke the DSO's merger callback to merge two file + * specifications, or if the callback isn't set it will instead use the + * DSO_METHOD's merger. A non-NULL return value will need to be + * OPENSSL_free()'d. + */ +char *DSO_merge(DSO *dso, const char *filespec1, const char *filespec2); + +/* + * The all-singing all-dancing load function, you normally pass NULL for the + * first and third parameters. Use DSO_up_ref and DSO_free for subsequent + * reference count handling. Any flags passed in will be set in the + * constructed DSO after its init() function but before the load operation. + * If 'dso' is non-NULL, 'flags' is ignored. + */ +DSO *DSO_load(DSO *dso, const char *filename, DSO_METHOD *meth, int flags); + +/* This function binds to a function inside a shared library. */ +DSO_FUNC_TYPE DSO_bind_func(DSO *dso, const char *symname); + +/* + * This method is the default, but will beg, borrow, or steal whatever method + * should be the default on any particular platform (including + * DSO_METH_null() if necessary). + */ +DSO_METHOD *DSO_METHOD_openssl(void); + +/* + * This function should be used with caution! It looks up symbols in *all* + * loaded modules and if module gets unloaded by somebody else attempt to + * dereference the pointer is doomed to have fatal consequences. Primary + * usage for this function is to probe *core* system functionality, e.g. + * check if getnameinfo(3) is available at run-time without bothering about + * OS-specific details such as libc.so.versioning or where does it actually + * reside: in libc itself or libsocket. + */ +void *DSO_global_lookup(const char *name); + +/* BEGIN ERROR CODES */ +/* + * The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_DSO_strings(void); + +/* Error codes for the DSO functions. */ + +/* Function codes. */ +# define DSO_F_BEOS_BIND_FUNC 144 +# define DSO_F_BEOS_BIND_VAR 145 +# define DSO_F_BEOS_LOAD 146 +# define DSO_F_BEOS_NAME_CONVERTER 147 +# define DSO_F_BEOS_UNLOAD 148 +# define DSO_F_DLFCN_BIND_FUNC 100 +# define DSO_F_DLFCN_BIND_VAR 101 +# define DSO_F_DLFCN_LOAD 102 +# define DSO_F_DLFCN_MERGER 130 +# define DSO_F_DLFCN_NAME_CONVERTER 123 +# define DSO_F_DLFCN_UNLOAD 103 +# define DSO_F_DL_BIND_FUNC 104 +# define DSO_F_DL_BIND_VAR 105 +# define DSO_F_DL_LOAD 106 +# define DSO_F_DL_MERGER 131 +# define DSO_F_DL_NAME_CONVERTER 124 +# define DSO_F_DL_UNLOAD 107 +# define DSO_F_DSO_BIND_FUNC 108 +# define DSO_F_DSO_CONVERT_FILENAME 126 +# define DSO_F_DSO_CTRL 110 +# define DSO_F_DSO_FREE 111 +# define DSO_F_DSO_GET_FILENAME 127 +# define DSO_F_DSO_GET_LOADED_FILENAME 128 +# define DSO_F_DSO_GLOBAL_LOOKUP 139 +# define DSO_F_DSO_LOAD 112 +# define DSO_F_DSO_MERGE 132 +# define DSO_F_DSO_NEW_METHOD 113 +# define DSO_F_DSO_SET_FILENAME 129 +# define DSO_F_DSO_UP_REF 114 +# define DSO_F_GLOBAL_LOOKUP_FUNC 138 +# define DSO_F_VMS_BIND_SYM 115 +# define DSO_F_VMS_LOAD 116 +# define DSO_F_VMS_MERGER 133 +# define DSO_F_VMS_UNLOAD 117 +# define DSO_F_WIN32_BIND_FUNC 118 +# define DSO_F_WIN32_BIND_VAR 119 +# define DSO_F_WIN32_GLOBALLOOKUP 142 +# define DSO_F_WIN32_GLOBALLOOKUP_FUNC 143 +# define DSO_F_WIN32_JOINER 135 +# define DSO_F_WIN32_LOAD 120 +# define DSO_F_WIN32_MERGER 134 +# define DSO_F_WIN32_NAME_CONVERTER 125 +# define DSO_F_WIN32_SPLITTER 136 +# define DSO_F_WIN32_UNLOAD 121 + +/* Reason codes. */ +# define DSO_R_CTRL_FAILED 100 +# define DSO_R_DSO_ALREADY_LOADED 110 +# define DSO_R_EMPTY_FILE_STRUCTURE 113 +# define DSO_R_FAILURE 114 +# define DSO_R_FILENAME_TOO_BIG 101 +# define DSO_R_FINISH_FAILED 102 +# define DSO_R_INCORRECT_FILE_SYNTAX 115 +# define DSO_R_LOAD_FAILED 103 +# define DSO_R_NAME_TRANSLATION_FAILED 109 +# define DSO_R_NO_FILENAME 111 +# define DSO_R_NO_FILE_SPECIFICATION 116 +# define DSO_R_NULL_HANDLE 104 +# define DSO_R_SET_FILENAME_FAILED 112 +# define DSO_R_STACK_ERROR 105 +# define DSO_R_SYM_FAILURE 106 +# define DSO_R_UNLOAD_FAILED 107 +# define DSO_R_UNSUPPORTED 108 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/openssl/dso.h b/include/openssl/dso.h deleted file mode 100644 index eeb16b12d2..0000000000 --- a/include/openssl/dso.h +++ /dev/null @@ -1,276 +0,0 @@ -/* - * Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL project - * 2000. - */ -/* ==================================================================== - * Copyright (c) 2000 The OpenSSL Project. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" - * - * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * licensing@OpenSSL.org. - * - * 5. Products derived from this software may not be called "OpenSSL" - * nor may "OpenSSL" appear in their names without prior written - * permission of the OpenSSL Project. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" - * - * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This product includes cryptographic software written by Eric Young - * (eay@cryptsoft.com). This product includes software written by Tim - * Hudson (tjh@cryptsoft.com). - * - */ - -#ifndef HEADER_DSO_H -# define HEADER_DSO_H - -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/* These values are used as commands to DSO_ctrl() */ -# define DSO_CTRL_GET_FLAGS 1 -# define DSO_CTRL_SET_FLAGS 2 -# define DSO_CTRL_OR_FLAGS 3 - -/* - * By default, DSO_load() will translate the provided filename into a form - * typical for the platform using the dso_name_converter function of the - * method. Eg. win32 will transform "blah" into "blah.dll", and dlfcn will - * transform it into "libblah.so". This callback could even utilise the - * DSO_METHOD's converter too if it only wants to override behaviour for - * one or two possible DSO methods. However, the following flag can be - * set in a DSO to prevent *any* native name-translation at all - eg. if - * the caller has prompted the user for a path to a driver library so the - * filename should be interpreted as-is. - */ -# define DSO_FLAG_NO_NAME_TRANSLATION 0x01 -/* - * An extra flag to give if only the extension should be added as - * translation. This is obviously only of importance on Unix and other - * operating systems where the translation also may prefix the name with - * something, like 'lib', and ignored everywhere else. This flag is also - * ignored if DSO_FLAG_NO_NAME_TRANSLATION is used at the same time. - */ -# define DSO_FLAG_NAME_TRANSLATION_EXT_ONLY 0x02 - -/* - * The following flag controls the translation of symbol names to upper case. - * This is currently only being implemented for OpenVMS. - */ -# define DSO_FLAG_UPCASE_SYMBOL 0x10 - -/* - * This flag loads the library with public symbols. Meaning: The exported - * symbols of this library are public to all libraries loaded after this - * library. At the moment only implemented in unix. - */ -# define DSO_FLAG_GLOBAL_SYMBOLS 0x20 - -typedef void (*DSO_FUNC_TYPE) (void); - -typedef struct dso_st DSO; -typedef struct dso_meth_st DSO_METHOD; - -/* - * The function prototype used for method functions (or caller-provided - * callbacks) that transform filenames. They are passed a DSO structure - * pointer (or NULL if they are to be used independently of a DSO object) and - * a filename to transform. They should either return NULL (if there is an - * error condition) or a newly allocated string containing the transformed - * form that the caller will need to free with OPENSSL_free() when done. - */ -typedef char *(*DSO_NAME_CONVERTER_FUNC)(DSO *, const char *); -/* - * The function prototype used for method functions (or caller-provided - * callbacks) that merge two file specifications. They are passed a DSO - * structure pointer (or NULL if they are to be used independently of a DSO - * object) and two file specifications to merge. They should either return - * NULL (if there is an error condition) or a newly allocated string - * containing the result of merging that the caller will need to free with - * OPENSSL_free() when done. Here, merging means that bits and pieces are - * taken from each of the file specifications and added together in whatever - * fashion that is sensible for the DSO method in question. The only rule - * that really applies is that if the two specification contain pieces of the - * same type, the copy from the first string takes priority. One could see - * it as the first specification is the one given by the user and the second - * being a bunch of defaults to add on if they're missing in the first. - */ -typedef char *(*DSO_MERGER_FUNC)(DSO *, const char *, const char *); - -DSO *DSO_new(void); -int DSO_free(DSO *dso); -int DSO_flags(DSO *dso); -int DSO_up_ref(DSO *dso); -long DSO_ctrl(DSO *dso, int cmd, long larg, void *parg); - -/* - * These functions can be used to get/set the platform-independent filename - * used for a DSO. NB: set will fail if the DSO is already loaded. - */ -const char *DSO_get_filename(DSO *dso); -int DSO_set_filename(DSO *dso, const char *filename); -/* - * This function will invoke the DSO's name_converter callback to translate a - * filename, or if the callback isn't set it will instead use the DSO_METHOD's - * converter. If "filename" is NULL, the "filename" in the DSO itself will be - * used. If the DSO_FLAG_NO_NAME_TRANSLATION flag is set, then the filename is - * simply duplicated. NB: This function is usually called from within a - * DSO_METHOD during the processing of a DSO_load() call, and is exposed so - * that caller-created DSO_METHODs can do the same thing. A non-NULL return - * value will need to be OPENSSL_free()'d. - */ -char *DSO_convert_filename(DSO *dso, const char *filename); -/* - * This function will invoke the DSO's merger callback to merge two file - * specifications, or if the callback isn't set it will instead use the - * DSO_METHOD's merger. A non-NULL return value will need to be - * OPENSSL_free()'d. - */ -char *DSO_merge(DSO *dso, const char *filespec1, const char *filespec2); - -/* - * The all-singing all-dancing load function, you normally pass NULL for the - * first and third parameters. Use DSO_up_ref and DSO_free for subsequent - * reference count handling. Any flags passed in will be set in the - * constructed DSO after its init() function but before the load operation. - * If 'dso' is non-NULL, 'flags' is ignored. - */ -DSO *DSO_load(DSO *dso, const char *filename, DSO_METHOD *meth, int flags); - -/* This function binds to a function inside a shared library. */ -DSO_FUNC_TYPE DSO_bind_func(DSO *dso, const char *symname); - -/* - * This method is the default, but will beg, borrow, or steal whatever method - * should be the default on any particular platform (including - * DSO_METH_null() if necessary). - */ -DSO_METHOD *DSO_METHOD_openssl(void); - -/* - * This function should be used with caution! It looks up symbols in *all* - * loaded modules and if module gets unloaded by somebody else attempt to - * dereference the pointer is doomed to have fatal consequences. Primary - * usage for this function is to probe *core* system functionality, e.g. - * check if getnameinfo(3) is available at run-time without bothering about - * OS-specific details such as libc.so.versioning or where does it actually - * reside: in libc itself or libsocket. - */ -void *DSO_global_lookup(const char *name); - -/* BEGIN ERROR CODES */ -/* - * The following lines are auto generated by the script mkerr.pl. Any changes - * made after this point may be overwritten when the script is next run. - */ -void ERR_load_DSO_strings(void); - -/* Error codes for the DSO functions. */ - -/* Function codes. */ -# define DSO_F_BEOS_BIND_FUNC 144 -# define DSO_F_BEOS_BIND_VAR 145 -# define DSO_F_BEOS_LOAD 146 -# define DSO_F_BEOS_NAME_CONVERTER 147 -# define DSO_F_BEOS_UNLOAD 148 -# define DSO_F_DLFCN_BIND_FUNC 100 -# define DSO_F_DLFCN_BIND_VAR 101 -# define DSO_F_DLFCN_LOAD 102 -# define DSO_F_DLFCN_MERGER 130 -# define DSO_F_DLFCN_NAME_CONVERTER 123 -# define DSO_F_DLFCN_UNLOAD 103 -# define DSO_F_DL_BIND_FUNC 104 -# define DSO_F_DL_BIND_VAR 105 -# define DSO_F_DL_LOAD 106 -# define DSO_F_DL_MERGER 131 -# define DSO_F_DL_NAME_CONVERTER 124 -# define DSO_F_DL_UNLOAD 107 -# define DSO_F_DSO_BIND_FUNC 108 -# define DSO_F_DSO_CONVERT_FILENAME 126 -# define DSO_F_DSO_CTRL 110 -# define DSO_F_DSO_FREE 111 -# define DSO_F_DSO_GET_FILENAME 127 -# define DSO_F_DSO_GET_LOADED_FILENAME 128 -# define DSO_F_DSO_GLOBAL_LOOKUP 139 -# define DSO_F_DSO_LOAD 112 -# define DSO_F_DSO_MERGE 132 -# define DSO_F_DSO_NEW_METHOD 113 -# define DSO_F_DSO_SET_FILENAME 129 -# define DSO_F_DSO_UP_REF 114 -# define DSO_F_GLOBAL_LOOKUP_FUNC 138 -# define DSO_F_VMS_BIND_SYM 115 -# define DSO_F_VMS_LOAD 116 -# define DSO_F_VMS_MERGER 133 -# define DSO_F_VMS_UNLOAD 117 -# define DSO_F_WIN32_BIND_FUNC 118 -# define DSO_F_WIN32_BIND_VAR 119 -# define DSO_F_WIN32_GLOBALLOOKUP 142 -# define DSO_F_WIN32_GLOBALLOOKUP_FUNC 143 -# define DSO_F_WIN32_JOINER 135 -# define DSO_F_WIN32_LOAD 120 -# define DSO_F_WIN32_MERGER 134 -# define DSO_F_WIN32_NAME_CONVERTER 125 -# define DSO_F_WIN32_SPLITTER 136 -# define DSO_F_WIN32_UNLOAD 121 - -/* Reason codes. */ -# define DSO_R_CTRL_FAILED 100 -# define DSO_R_DSO_ALREADY_LOADED 110 -# define DSO_R_EMPTY_FILE_STRUCTURE 113 -# define DSO_R_FAILURE 114 -# define DSO_R_FILENAME_TOO_BIG 101 -# define DSO_R_FINISH_FAILED 102 -# define DSO_R_INCORRECT_FILE_SYNTAX 115 -# define DSO_R_LOAD_FAILED 103 -# define DSO_R_NAME_TRANSLATION_FAILED 109 -# define DSO_R_NO_FILENAME 111 -# define DSO_R_NO_FILE_SPECIFICATION 116 -# define DSO_R_NULL_HANDLE 104 -# define DSO_R_SET_FILENAME_FAILED 112 -# define DSO_R_STACK_ERROR 105 -# define DSO_R_SYM_FAILURE 106 -# define DSO_R_UNLOAD_FAILED 107 -# define DSO_R_UNSUPPORTED 108 - -#ifdef __cplusplus -} -#endif -#endif diff --git a/util/mkdef.pl b/util/mkdef.pl index 129e6b46bd..80bc61ae82 100755 --- a/util/mkdef.pl +++ b/util/mkdef.pl @@ -269,7 +269,7 @@ $crypto.=" include/openssl/engine.h"; # unless $no_engine; $crypto.=" include/openssl/stack.h" ; # unless $no_stack; $crypto.=" include/openssl/buffer.h" ; # unless $no_buffer; $crypto.=" include/openssl/bio.h" ; # unless $no_bio; -$crypto.=" include/openssl/dso.h" ; # unless $no_dso; +$crypto.=" include/internal/dso.h" ; # unless $no_dso; $crypto.=" include/openssl/lhash.h" ; # unless $no_lhash; $crypto.=" include/openssl/conf.h"; $crypto.=" include/openssl/txt_db.h";