Add functions to set ECDSA_METHOD structure.
[openssl.git] / crypto / dso / dso.h
index 2cf6e1ae1270d044d6c41be505526ada6f2b60cb..23a35e1354d5644f4a243e885a85f1e320249a46 100644 (file)
@@ -95,6 +95,13 @@ extern "C" {
  */
 #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);
 
@@ -102,14 +109,14 @@ typedef struct dso_st DSO;
 
 /* 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 independantly of a DSO object) and a
+ * (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 independantly of
+ * 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
@@ -118,7 +125,7 @@ typedef char* (*DSO_NAME_CONVERTER_FUNC)(DSO *, const char *);
  * 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 string string takes priority.  One could see
+ * 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. */
@@ -163,6 +170,11 @@ typedef struct dso_meth_st
        /* [De]Initialisation handlers. */
        int (*init)(DSO *dso);
        int (*finish)(DSO *dso);
+
+       /* Return pathname of the module containing location */
+       int (*pathbyaddr)(void *addr,char *path,int sz);
+       /* Perform global symbol lookup, i.e. among *all* modules */
+       void *(*globallookup)(const char *symname);
        } DSO_METHOD;
 
 /**********************************************************************/
@@ -176,7 +188,7 @@ struct dso_st
         * for use in the dso_bind handler. All in all, let each
         * method control its own destiny. "Handles" and such go in
         * a STACK. */
-       STACK *meth_data;
+       STACK_OF(void) *meth_data;
        int references;
        int flags;
        /* For use by applications etc ... use this for your bits'n'pieces,
@@ -190,7 +202,7 @@ struct dso_st
         * be used in DSO_load() in place of meth->dso_merger. NB: This
         * should normally set using DSO_set_merger(). */
        DSO_MERGER_FUNC merger;
-       /* This is populated with (a copy of) the platform-independant
+       /* This is populated with (a copy of) the platform-independent
         * filename used for this DSO. */
        char *filename;
        /* This is populated with (a copy of) the translated filename by which
@@ -219,7 +231,7 @@ long        DSO_ctrl(DSO *dso, int cmd, long larg, void *parg);
  * replaced. Return value is non-zero for success. */
 int    DSO_set_name_converter(DSO *dso, DSO_NAME_CONVERTER_FUNC cb,
                                DSO_NAME_CONVERTER_FUNC *oldcb);
-/* These functions can be used to get/set the platform-independant filename
+/* 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);
@@ -289,6 +301,30 @@ DSO_METHOD *DSO_METHOD_win32(void);
 /* If VMS is defined, use shared images. If not, return NULL. */
 DSO_METHOD *DSO_METHOD_vms(void);
 
+/* This function writes null-terminated pathname of DSO module
+ * containing 'addr' into 'sz' large caller-provided 'path' and
+ * returns the number of characters [including trailing zero]
+ * written to it. If 'sz' is 0 or negative, 'path' is ignored and
+ * required amount of charachers [including trailing zero] to
+ * accomodate pathname is returned. If 'addr' is NULL, then
+ * pathname of cryptolib itself is returned. Negative or zero
+ * return value denotes error.
+ */
+int DSO_pathbyaddr(void *addr,char *path,int sz);
+
+/* 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);
+
+/* If BeOS is defined, use shared images. If not, return NULL. */
+DSO_METHOD *DSO_METHOD_beos(void);
+
 /* 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.
@@ -298,6 +334,11 @@ 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
@@ -317,21 +358,30 @@ void ERR_load_DSO_strings(void);
 #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_PATHBYADDR                            140
 #define DSO_F_DSO_SET_FILENAME                          129
 #define DSO_F_DSO_SET_NAME_CONVERTER                    122
 #define DSO_F_DSO_UP_REF                                114
-#define DSO_F_VMS_BIND_VAR                              115
+#define DSO_F_GLOBAL_LOOKUP_FUNC                        138
+#define DSO_F_PATHBYADDR                                137
+#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_PATHBYADDR                          141
+#define DSO_F_WIN32_SPLITTER                            136
 #define DSO_F_WIN32_UNLOAD                              121
 
 /* Reason codes. */
@@ -345,6 +395,7 @@ void ERR_load_DSO_strings(void);
 #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