summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/dso
diff options
context:
space:
mode:
authordjm <>2008-09-06 12:15:56 +0000
committerdjm <>2008-09-06 12:15:56 +0000
commit5a3c0a05c7f2c5d3c584b7c8d6aec836dd724c80 (patch)
treeaba68249883aa9d2361d92eef69a81d0c4961732 /src/lib/libcrypto/dso
parentf6198d4d0ab97685dc56be2d48715ed39fcc74b9 (diff)
downloadopenbsd-5a3c0a05c7f2c5d3c584b7c8d6aec836dd724c80.tar.gz
openbsd-5a3c0a05c7f2c5d3c584b7c8d6aec836dd724c80.tar.bz2
openbsd-5a3c0a05c7f2c5d3c584b7c8d6aec836dd724c80.zip
import of OpenSSL 0.9.8h
Diffstat (limited to 'src/lib/libcrypto/dso')
-rw-r--r--src/lib/libcrypto/dso/dso.h52
-rw-r--r--src/lib/libcrypto/dso/dso_dlfcn.c114
-rw-r--r--src/lib/libcrypto/dso/dso_err.c22
-rw-r--r--src/lib/libcrypto/dso/dso_lib.c29
-rw-r--r--src/lib/libcrypto/dso/dso_null.c2
5 files changed, 173 insertions, 46 deletions
diff --git a/src/lib/libcrypto/dso/dso.h b/src/lib/libcrypto/dso/dso.h
index aa721f7feb..3e51913a72 100644
--- a/src/lib/libcrypto/dso/dso.h
+++ b/src/lib/libcrypto/dso/dso.h
@@ -1,4 +1,4 @@
1/* dso.h */ 1/* dso.h -*- mode:C; c-file-style: "eay" -*- */
2/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL 2/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL
3 * project 2000. 3 * project 2000.
4 */ 4 */
@@ -95,6 +95,13 @@ extern "C" {
95 */ 95 */
96#define DSO_FLAG_UPCASE_SYMBOL 0x10 96#define DSO_FLAG_UPCASE_SYMBOL 0x10
97 97
98/* This flag loads the library with public symbols.
99 * Meaning: The exported symbols of this library are public
100 * to all libraries loaded after this library.
101 * At the moment only implemented in unix.
102 */
103#define DSO_FLAG_GLOBAL_SYMBOLS 0x20
104
98 105
99typedef void (*DSO_FUNC_TYPE)(void); 106typedef void (*DSO_FUNC_TYPE)(void);
100 107
@@ -107,6 +114,22 @@ typedef struct dso_st DSO;
107 * condition) or a newly allocated string containing the transformed form that 114 * condition) or a newly allocated string containing the transformed form that
108 * the caller will need to free with OPENSSL_free() when done. */ 115 * the caller will need to free with OPENSSL_free() when done. */
109typedef char* (*DSO_NAME_CONVERTER_FUNC)(DSO *, const char *); 116typedef char* (*DSO_NAME_CONVERTER_FUNC)(DSO *, const char *);
117/* The function prototype used for method functions (or caller-provided
118 * callbacks) that merge two file specifications. They are passed a
119 * DSO structure pointer (or NULL if they are to be used independantly of
120 * a DSO object) and two file specifications to merge. They should
121 * either return NULL (if there is an error condition) or a newly allocated
122 * string containing the result of merging that the caller will need
123 * to free with OPENSSL_free() when done.
124 * Here, merging means that bits and pieces are taken from each of the
125 * file specifications and added together in whatever fashion that is
126 * sensible for the DSO method in question. The only rule that really
127 * applies is that if the two specification contain pieces of the same
128 * type, the copy from the first string takes priority. One could see
129 * it as the first specification is the one given by the user and the
130 * second being a bunch of defaults to add on if they're missing in the
131 * first. */
132typedef char* (*DSO_MERGER_FUNC)(DSO *, const char *, const char *);
110 133
111typedef struct dso_meth_st 134typedef struct dso_meth_st
112 { 135 {
@@ -140,6 +163,9 @@ typedef struct dso_meth_st
140 /* The default DSO_METHOD-specific function for converting filenames to 163 /* The default DSO_METHOD-specific function for converting filenames to
141 * a canonical native form. */ 164 * a canonical native form. */
142 DSO_NAME_CONVERTER_FUNC dso_name_converter; 165 DSO_NAME_CONVERTER_FUNC dso_name_converter;
166 /* The default DSO_METHOD-specific function for converting filenames to
167 * a canonical native form. */
168 DSO_MERGER_FUNC dso_merger;
143 169
144 /* [De]Initialisation handlers. */ 170 /* [De]Initialisation handlers. */
145 int (*init)(DSO *dso); 171 int (*init)(DSO *dso);
@@ -164,9 +190,13 @@ struct dso_st
164 * don't touch meth_data! */ 190 * don't touch meth_data! */
165 CRYPTO_EX_DATA ex_data; 191 CRYPTO_EX_DATA ex_data;
166 /* If this callback function pointer is set to non-NULL, then it will 192 /* If this callback function pointer is set to non-NULL, then it will
167 * be used on DSO_load() in place of meth->dso_name_converter. NB: This 193 * be used in DSO_load() in place of meth->dso_name_converter. NB: This
168 * should normally set using DSO_set_name_converter(). */ 194 * should normally set using DSO_set_name_converter(). */
169 DSO_NAME_CONVERTER_FUNC name_converter; 195 DSO_NAME_CONVERTER_FUNC name_converter;
196 /* If this callback function pointer is set to non-NULL, then it will
197 * be used in DSO_load() in place of meth->dso_merger. NB: This
198 * should normally set using DSO_set_merger(). */
199 DSO_MERGER_FUNC merger;
170 /* This is populated with (a copy of) the platform-independant 200 /* This is populated with (a copy of) the platform-independant
171 * filename used for this DSO. */ 201 * filename used for this DSO. */
172 char *filename; 202 char *filename;
@@ -209,6 +239,11 @@ int DSO_set_filename(DSO *dso, const char *filename);
209 * caller-created DSO_METHODs can do the same thing. A non-NULL return value 239 * caller-created DSO_METHODs can do the same thing. A non-NULL return value
210 * will need to be OPENSSL_free()'d. */ 240 * will need to be OPENSSL_free()'d. */
211char *DSO_convert_filename(DSO *dso, const char *filename); 241char *DSO_convert_filename(DSO *dso, const char *filename);
242/* This function will invoke the DSO's merger callback to merge two file
243 * specifications, or if the callback isn't set it will instead use the
244 * DSO_METHOD's merger. A non-NULL return value will need to be
245 * OPENSSL_free()'d. */
246char *DSO_merge(DSO *dso, const char *filespec1, const char *filespec2);
212/* If the DSO is currently loaded, this returns the filename that it was loaded 247/* If the DSO is currently loaded, this returns the filename that it was loaded
213 * under, otherwise it returns NULL. So it is also useful as a test as to 248 * under, otherwise it returns NULL. So it is also useful as a test as to
214 * whether the DSO is currently loaded. NB: This will not necessarily return 249 * whether the DSO is currently loaded. NB: This will not necessarily return
@@ -273,11 +308,13 @@ void ERR_load_DSO_strings(void);
273#define DSO_F_DLFCN_BIND_FUNC 100 308#define DSO_F_DLFCN_BIND_FUNC 100
274#define DSO_F_DLFCN_BIND_VAR 101 309#define DSO_F_DLFCN_BIND_VAR 101
275#define DSO_F_DLFCN_LOAD 102 310#define DSO_F_DLFCN_LOAD 102
311#define DSO_F_DLFCN_MERGER 130
276#define DSO_F_DLFCN_NAME_CONVERTER 123 312#define DSO_F_DLFCN_NAME_CONVERTER 123
277#define DSO_F_DLFCN_UNLOAD 103 313#define DSO_F_DLFCN_UNLOAD 103
278#define DSO_F_DL_BIND_FUNC 104 314#define DSO_F_DL_BIND_FUNC 104
279#define DSO_F_DL_BIND_VAR 105 315#define DSO_F_DL_BIND_VAR 105
280#define DSO_F_DL_LOAD 106 316#define DSO_F_DL_LOAD 106
317#define DSO_F_DL_MERGER 131
281#define DSO_F_DL_NAME_CONVERTER 124 318#define DSO_F_DL_NAME_CONVERTER 124
282#define DSO_F_DL_UNLOAD 107 319#define DSO_F_DL_UNLOAD 107
283#define DSO_F_DSO_BIND_FUNC 108 320#define DSO_F_DSO_BIND_FUNC 108
@@ -288,27 +325,36 @@ void ERR_load_DSO_strings(void);
288#define DSO_F_DSO_GET_FILENAME 127 325#define DSO_F_DSO_GET_FILENAME 127
289#define DSO_F_DSO_GET_LOADED_FILENAME 128 326#define DSO_F_DSO_GET_LOADED_FILENAME 128
290#define DSO_F_DSO_LOAD 112 327#define DSO_F_DSO_LOAD 112
328#define DSO_F_DSO_MERGE 132
291#define DSO_F_DSO_NEW_METHOD 113 329#define DSO_F_DSO_NEW_METHOD 113
292#define DSO_F_DSO_SET_FILENAME 129 330#define DSO_F_DSO_SET_FILENAME 129
293#define DSO_F_DSO_SET_NAME_CONVERTER 122 331#define DSO_F_DSO_SET_NAME_CONVERTER 122
294#define DSO_F_DSO_UP_REF 114 332#define DSO_F_DSO_UP_REF 114
295#define DSO_F_VMS_BIND_VAR 115 333#define DSO_F_VMS_BIND_SYM 115
296#define DSO_F_VMS_LOAD 116 334#define DSO_F_VMS_LOAD 116
335#define DSO_F_VMS_MERGER 133
297#define DSO_F_VMS_UNLOAD 117 336#define DSO_F_VMS_UNLOAD 117
298#define DSO_F_WIN32_BIND_FUNC 118 337#define DSO_F_WIN32_BIND_FUNC 118
299#define DSO_F_WIN32_BIND_VAR 119 338#define DSO_F_WIN32_BIND_VAR 119
339#define DSO_F_WIN32_JOINER 135
300#define DSO_F_WIN32_LOAD 120 340#define DSO_F_WIN32_LOAD 120
341#define DSO_F_WIN32_MERGER 134
301#define DSO_F_WIN32_NAME_CONVERTER 125 342#define DSO_F_WIN32_NAME_CONVERTER 125
343#define DSO_F_WIN32_SPLITTER 136
302#define DSO_F_WIN32_UNLOAD 121 344#define DSO_F_WIN32_UNLOAD 121
303 345
304/* Reason codes. */ 346/* Reason codes. */
305#define DSO_R_CTRL_FAILED 100 347#define DSO_R_CTRL_FAILED 100
306#define DSO_R_DSO_ALREADY_LOADED 110 348#define DSO_R_DSO_ALREADY_LOADED 110
349#define DSO_R_EMPTY_FILE_STRUCTURE 113
350#define DSO_R_FAILURE 114
307#define DSO_R_FILENAME_TOO_BIG 101 351#define DSO_R_FILENAME_TOO_BIG 101
308#define DSO_R_FINISH_FAILED 102 352#define DSO_R_FINISH_FAILED 102
353#define DSO_R_INCORRECT_FILE_SYNTAX 115
309#define DSO_R_LOAD_FAILED 103 354#define DSO_R_LOAD_FAILED 103
310#define DSO_R_NAME_TRANSLATION_FAILED 109 355#define DSO_R_NAME_TRANSLATION_FAILED 109
311#define DSO_R_NO_FILENAME 111 356#define DSO_R_NO_FILENAME 111
357#define DSO_R_NO_FILE_SPECIFICATION 116
312#define DSO_R_NULL_HANDLE 104 358#define DSO_R_NULL_HANDLE 104
313#define DSO_R_SET_FILENAME_FAILED 112 359#define DSO_R_SET_FILENAME_FAILED 112
314#define DSO_R_STACK_ERROR 105 360#define DSO_R_STACK_ERROR 105
diff --git a/src/lib/libcrypto/dso/dso_dlfcn.c b/src/lib/libcrypto/dso/dso_dlfcn.c
index 0422a4859a..1fd10104c5 100644
--- a/src/lib/libcrypto/dso/dso_dlfcn.c
+++ b/src/lib/libcrypto/dso/dso_dlfcn.c
@@ -1,4 +1,4 @@
1/* dso_dlfcn.c */ 1/* dso_dlfcn.c -*- mode:C; c-file-style: "eay" -*- */
2/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL 2/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL
3 * project 2000. 3 * project 2000.
4 */ 4 */
@@ -56,10 +56,6 @@
56 * 56 *
57 */ 57 */
58 58
59#ifdef __linux
60#define _GNU_SOURCE
61#endif
62
63#include <stdio.h> 59#include <stdio.h>
64#include "cryptlib.h" 60#include "cryptlib.h"
65#include <openssl/dso.h> 61#include <openssl/dso.h>
@@ -89,6 +85,8 @@ static int dlfcn_finish(DSO *dso);
89static long dlfcn_ctrl(DSO *dso, int cmd, long larg, void *parg); 85static long dlfcn_ctrl(DSO *dso, int cmd, long larg, void *parg);
90#endif 86#endif
91static char *dlfcn_name_converter(DSO *dso, const char *filename); 87static char *dlfcn_name_converter(DSO *dso, const char *filename);
88static char *dlfcn_merger(DSO *dso, const char *filespec1,
89 const char *filespec2);
92 90
93static DSO_METHOD dso_meth_dlfcn = { 91static DSO_METHOD dso_meth_dlfcn = {
94 "OpenSSL 'dlfcn' shared library method", 92 "OpenSSL 'dlfcn' shared library method",
@@ -103,6 +101,7 @@ static DSO_METHOD dso_meth_dlfcn = {
103#endif 101#endif
104 NULL, /* ctrl */ 102 NULL, /* ctrl */
105 dlfcn_name_converter, 103 dlfcn_name_converter,
104 dlfcn_merger,
106 NULL, /* init */ 105 NULL, /* init */
107 NULL /* finish */ 106 NULL /* finish */
108 }; 107 };
@@ -145,13 +144,19 @@ static int dlfcn_load(DSO *dso)
145 void *ptr = NULL; 144 void *ptr = NULL;
146 /* See applicable comments in dso_dl.c */ 145 /* See applicable comments in dso_dl.c */
147 char *filename = DSO_convert_filename(dso, NULL); 146 char *filename = DSO_convert_filename(dso, NULL);
147 int flags = DLOPEN_FLAG;
148 148
149 if(filename == NULL) 149 if(filename == NULL)
150 { 150 {
151 DSOerr(DSO_F_DLFCN_LOAD,DSO_R_NO_FILENAME); 151 DSOerr(DSO_F_DLFCN_LOAD,DSO_R_NO_FILENAME);
152 goto err; 152 goto err;
153 } 153 }
154 ptr = dlopen(filename, DLOPEN_FLAG); 154
155#ifdef RTLD_GLOBAL
156 if (dso->flags & DSO_FLAG_GLOBAL_SYMBOLS)
157 flags |= RTLD_GLOBAL;
158#endif
159 ptr = dlopen(filename, flags);
155 if(ptr == NULL) 160 if(ptr == NULL)
156 { 161 {
157 DSOerr(DSO_F_DLFCN_LOAD,DSO_R_LOAD_FAILED); 162 DSOerr(DSO_F_DLFCN_LOAD,DSO_R_LOAD_FAILED);
@@ -250,7 +255,7 @@ static DSO_FUNC_TYPE dlfcn_bind_func(DSO *dso, const char *symname)
250 DSOerr(DSO_F_DLFCN_BIND_FUNC,DSO_R_NULL_HANDLE); 255 DSOerr(DSO_F_DLFCN_BIND_FUNC,DSO_R_NULL_HANDLE);
251 return(NULL); 256 return(NULL);
252 } 257 }
253 *(void**)(tsym) = dlsym(ptr, symname); 258 *(void **)(tsym) = dlsym(ptr, symname);
254 if(sym == NULL) 259 if(sym == NULL)
255 { 260 {
256 DSOerr(DSO_F_DLFCN_BIND_FUNC,DSO_R_SYM_FAILURE); 261 DSOerr(DSO_F_DLFCN_BIND_FUNC,DSO_R_SYM_FAILURE);
@@ -260,6 +265,73 @@ static DSO_FUNC_TYPE dlfcn_bind_func(DSO *dso, const char *symname)
260 return(sym); 265 return(sym);
261 } 266 }
262 267
268static char *dlfcn_merger(DSO *dso, const char *filespec1,
269 const char *filespec2)
270 {
271 char *merged;
272
273 if(!filespec1 && !filespec2)
274 {
275 DSOerr(DSO_F_DLFCN_MERGER,
276 ERR_R_PASSED_NULL_PARAMETER);
277 return(NULL);
278 }
279 /* If the first file specification is a rooted path, it rules.
280 same goes if the second file specification is missing. */
281 if (!filespec2 || filespec1[0] == '/')
282 {
283 merged = OPENSSL_malloc(strlen(filespec1) + 1);
284 if(!merged)
285 {
286 DSOerr(DSO_F_DLFCN_MERGER,
287 ERR_R_MALLOC_FAILURE);
288 return(NULL);
289 }
290 strcpy(merged, filespec1);
291 }
292 /* If the first file specification is missing, the second one rules. */
293 else if (!filespec1)
294 {
295 merged = OPENSSL_malloc(strlen(filespec2) + 1);
296 if(!merged)
297 {
298 DSOerr(DSO_F_DLFCN_MERGER,
299 ERR_R_MALLOC_FAILURE);
300 return(NULL);
301 }
302 strcpy(merged, filespec2);
303 }
304 else
305 /* This part isn't as trivial as it looks. It assumes that
306 the second file specification really is a directory, and
307 makes no checks whatsoever. Therefore, the result becomes
308 the concatenation of filespec2 followed by a slash followed
309 by filespec1. */
310 {
311 int spec2len, len;
312
313 spec2len = (filespec2 ? strlen(filespec2) : 0);
314 len = spec2len + (filespec1 ? strlen(filespec1) : 0);
315
316 if(filespec2 && filespec2[spec2len - 1] == '/')
317 {
318 spec2len--;
319 len--;
320 }
321 merged = OPENSSL_malloc(len + 2);
322 if(!merged)
323 {
324 DSOerr(DSO_F_DLFCN_MERGER,
325 ERR_R_MALLOC_FAILURE);
326 return(NULL);
327 }
328 strcpy(merged, filespec2);
329 merged[spec2len] = '/';
330 strcpy(&merged[spec2len + 1], filespec1);
331 }
332 return(merged);
333 }
334
263static char *dlfcn_name_converter(DSO *dso, const char *filename) 335static char *dlfcn_name_converter(DSO *dso, const char *filename)
264 { 336 {
265 char *translated; 337 char *translated;
@@ -294,32 +366,4 @@ static char *dlfcn_name_converter(DSO *dso, const char *filename)
294 return(translated); 366 return(translated);
295 } 367 }
296 368
297#ifdef OPENSSL_FIPS
298static void dlfcn_ref_point(){}
299
300int DSO_pathbyaddr(void *addr,char *path,int sz)
301 {
302 Dl_info dli;
303 int len;
304
305 if (addr == NULL)
306 {
307 union { void(*f)(void); void *p; } t = { dlfcn_ref_point };
308 addr = t.p;
309 }
310
311 if (dladdr(addr,&dli))
312 {
313 len = (int)strlen(dli.dli_fname);
314 if (sz <= 0) return len+1;
315 if (len >= sz) len=sz-1;
316 memcpy(path,dli.dli_fname,len);
317 path[len++]=0;
318 return len;
319 }
320
321 ERR_add_error_data(4, "dlfcn_pathbyaddr(): ", dlerror());
322 return -1;
323 }
324#endif
325#endif /* DSO_DLFCN */ 369#endif /* DSO_DLFCN */
diff --git a/src/lib/libcrypto/dso/dso_err.c b/src/lib/libcrypto/dso/dso_err.c
index 581677cc36..a8b0a210de 100644
--- a/src/lib/libcrypto/dso/dso_err.c
+++ b/src/lib/libcrypto/dso/dso_err.c
@@ -73,11 +73,13 @@ static ERR_STRING_DATA DSO_str_functs[]=
73{ERR_FUNC(DSO_F_DLFCN_BIND_FUNC), "DLFCN_BIND_FUNC"}, 73{ERR_FUNC(DSO_F_DLFCN_BIND_FUNC), "DLFCN_BIND_FUNC"},
74{ERR_FUNC(DSO_F_DLFCN_BIND_VAR), "DLFCN_BIND_VAR"}, 74{ERR_FUNC(DSO_F_DLFCN_BIND_VAR), "DLFCN_BIND_VAR"},
75{ERR_FUNC(DSO_F_DLFCN_LOAD), "DLFCN_LOAD"}, 75{ERR_FUNC(DSO_F_DLFCN_LOAD), "DLFCN_LOAD"},
76{ERR_FUNC(DSO_F_DLFCN_MERGER), "DLFCN_MERGER"},
76{ERR_FUNC(DSO_F_DLFCN_NAME_CONVERTER), "DLFCN_NAME_CONVERTER"}, 77{ERR_FUNC(DSO_F_DLFCN_NAME_CONVERTER), "DLFCN_NAME_CONVERTER"},
77{ERR_FUNC(DSO_F_DLFCN_UNLOAD), "DLFCN_UNLOAD"}, 78{ERR_FUNC(DSO_F_DLFCN_UNLOAD), "DLFCN_UNLOAD"},
78{ERR_FUNC(DSO_F_DL_BIND_FUNC), "DL_BIND_FUNC"}, 79{ERR_FUNC(DSO_F_DL_BIND_FUNC), "DL_BIND_FUNC"},
79{ERR_FUNC(DSO_F_DL_BIND_VAR), "DL_BIND_VAR"}, 80{ERR_FUNC(DSO_F_DL_BIND_VAR), "DL_BIND_VAR"},
80{ERR_FUNC(DSO_F_DL_LOAD), "DL_LOAD"}, 81{ERR_FUNC(DSO_F_DL_LOAD), "DL_LOAD"},
82{ERR_FUNC(DSO_F_DL_MERGER), "DL_MERGER"},
81{ERR_FUNC(DSO_F_DL_NAME_CONVERTER), "DL_NAME_CONVERTER"}, 83{ERR_FUNC(DSO_F_DL_NAME_CONVERTER), "DL_NAME_CONVERTER"},
82{ERR_FUNC(DSO_F_DL_UNLOAD), "DL_UNLOAD"}, 84{ERR_FUNC(DSO_F_DL_UNLOAD), "DL_UNLOAD"},
83{ERR_FUNC(DSO_F_DSO_BIND_FUNC), "DSO_bind_func"}, 85{ERR_FUNC(DSO_F_DSO_BIND_FUNC), "DSO_bind_func"},
@@ -88,17 +90,22 @@ static ERR_STRING_DATA DSO_str_functs[]=
88{ERR_FUNC(DSO_F_DSO_GET_FILENAME), "DSO_get_filename"}, 90{ERR_FUNC(DSO_F_DSO_GET_FILENAME), "DSO_get_filename"},
89{ERR_FUNC(DSO_F_DSO_GET_LOADED_FILENAME), "DSO_get_loaded_filename"}, 91{ERR_FUNC(DSO_F_DSO_GET_LOADED_FILENAME), "DSO_get_loaded_filename"},
90{ERR_FUNC(DSO_F_DSO_LOAD), "DSO_load"}, 92{ERR_FUNC(DSO_F_DSO_LOAD), "DSO_load"},
93{ERR_FUNC(DSO_F_DSO_MERGE), "DSO_merge"},
91{ERR_FUNC(DSO_F_DSO_NEW_METHOD), "DSO_new_method"}, 94{ERR_FUNC(DSO_F_DSO_NEW_METHOD), "DSO_new_method"},
92{ERR_FUNC(DSO_F_DSO_SET_FILENAME), "DSO_set_filename"}, 95{ERR_FUNC(DSO_F_DSO_SET_FILENAME), "DSO_set_filename"},
93{ERR_FUNC(DSO_F_DSO_SET_NAME_CONVERTER), "DSO_set_name_converter"}, 96{ERR_FUNC(DSO_F_DSO_SET_NAME_CONVERTER), "DSO_set_name_converter"},
94{ERR_FUNC(DSO_F_DSO_UP_REF), "DSO_up_ref"}, 97{ERR_FUNC(DSO_F_DSO_UP_REF), "DSO_up_ref"},
95{ERR_FUNC(DSO_F_VMS_BIND_VAR), "VMS_BIND_VAR"}, 98{ERR_FUNC(DSO_F_VMS_BIND_SYM), "VMS_BIND_SYM"},
96{ERR_FUNC(DSO_F_VMS_LOAD), "VMS_LOAD"}, 99{ERR_FUNC(DSO_F_VMS_LOAD), "VMS_LOAD"},
100{ERR_FUNC(DSO_F_VMS_MERGER), "VMS_MERGER"},
97{ERR_FUNC(DSO_F_VMS_UNLOAD), "VMS_UNLOAD"}, 101{ERR_FUNC(DSO_F_VMS_UNLOAD), "VMS_UNLOAD"},
98{ERR_FUNC(DSO_F_WIN32_BIND_FUNC), "WIN32_BIND_FUNC"}, 102{ERR_FUNC(DSO_F_WIN32_BIND_FUNC), "WIN32_BIND_FUNC"},
99{ERR_FUNC(DSO_F_WIN32_BIND_VAR), "WIN32_BIND_VAR"}, 103{ERR_FUNC(DSO_F_WIN32_BIND_VAR), "WIN32_BIND_VAR"},
104{ERR_FUNC(DSO_F_WIN32_JOINER), "WIN32_JOINER"},
100{ERR_FUNC(DSO_F_WIN32_LOAD), "WIN32_LOAD"}, 105{ERR_FUNC(DSO_F_WIN32_LOAD), "WIN32_LOAD"},
106{ERR_FUNC(DSO_F_WIN32_MERGER), "WIN32_MERGER"},
101{ERR_FUNC(DSO_F_WIN32_NAME_CONVERTER), "WIN32_NAME_CONVERTER"}, 107{ERR_FUNC(DSO_F_WIN32_NAME_CONVERTER), "WIN32_NAME_CONVERTER"},
108{ERR_FUNC(DSO_F_WIN32_SPLITTER), "WIN32_SPLITTER"},
102{ERR_FUNC(DSO_F_WIN32_UNLOAD), "WIN32_UNLOAD"}, 109{ERR_FUNC(DSO_F_WIN32_UNLOAD), "WIN32_UNLOAD"},
103{0,NULL} 110{0,NULL}
104 }; 111 };
@@ -107,11 +114,15 @@ static ERR_STRING_DATA DSO_str_reasons[]=
107 { 114 {
108{ERR_REASON(DSO_R_CTRL_FAILED) ,"control command failed"}, 115{ERR_REASON(DSO_R_CTRL_FAILED) ,"control command failed"},
109{ERR_REASON(DSO_R_DSO_ALREADY_LOADED) ,"dso already loaded"}, 116{ERR_REASON(DSO_R_DSO_ALREADY_LOADED) ,"dso already loaded"},
117{ERR_REASON(DSO_R_EMPTY_FILE_STRUCTURE) ,"empty file structure"},
118{ERR_REASON(DSO_R_FAILURE) ,"failure"},
110{ERR_REASON(DSO_R_FILENAME_TOO_BIG) ,"filename too big"}, 119{ERR_REASON(DSO_R_FILENAME_TOO_BIG) ,"filename too big"},
111{ERR_REASON(DSO_R_FINISH_FAILED) ,"cleanup method function failed"}, 120{ERR_REASON(DSO_R_FINISH_FAILED) ,"cleanup method function failed"},
121{ERR_REASON(DSO_R_INCORRECT_FILE_SYNTAX) ,"incorrect file syntax"},
112{ERR_REASON(DSO_R_LOAD_FAILED) ,"could not load the shared library"}, 122{ERR_REASON(DSO_R_LOAD_FAILED) ,"could not load the shared library"},
113{ERR_REASON(DSO_R_NAME_TRANSLATION_FAILED),"name translation failed"}, 123{ERR_REASON(DSO_R_NAME_TRANSLATION_FAILED),"name translation failed"},
114{ERR_REASON(DSO_R_NO_FILENAME) ,"no filename"}, 124{ERR_REASON(DSO_R_NO_FILENAME) ,"no filename"},
125{ERR_REASON(DSO_R_NO_FILE_SPECIFICATION) ,"no file specification"},
115{ERR_REASON(DSO_R_NULL_HANDLE) ,"a null shared library handle was used"}, 126{ERR_REASON(DSO_R_NULL_HANDLE) ,"a null shared library handle was used"},
116{ERR_REASON(DSO_R_SET_FILENAME_FAILED) ,"set filename failed"}, 127{ERR_REASON(DSO_R_SET_FILENAME_FAILED) ,"set filename failed"},
117{ERR_REASON(DSO_R_STACK_ERROR) ,"the meth_data stack is corrupt"}, 128{ERR_REASON(DSO_R_STACK_ERROR) ,"the meth_data stack is corrupt"},
@@ -125,15 +136,12 @@ static ERR_STRING_DATA DSO_str_reasons[]=
125 136
126void ERR_load_DSO_strings(void) 137void ERR_load_DSO_strings(void)
127 { 138 {
128 static int init=1; 139#ifndef OPENSSL_NO_ERR
129 140
130 if (init) 141 if (ERR_func_error_string(DSO_str_functs[0].error) == NULL)
131 { 142 {
132 init=0;
133#ifndef OPENSSL_NO_ERR
134 ERR_load_strings(0,DSO_str_functs); 143 ERR_load_strings(0,DSO_str_functs);
135 ERR_load_strings(0,DSO_str_reasons); 144 ERR_load_strings(0,DSO_str_reasons);
136#endif
137
138 } 145 }
146#endif
139 } 147 }
diff --git a/src/lib/libcrypto/dso/dso_lib.c b/src/lib/libcrypto/dso/dso_lib.c
index 48d9fdb25e..49bdd71309 100644
--- a/src/lib/libcrypto/dso/dso_lib.c
+++ b/src/lib/libcrypto/dso/dso_lib.c
@@ -1,4 +1,4 @@
1/* dso_lib.c */ 1/* dso_lib.c -*- mode:C; c-file-style: "eay" -*- */
2/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL 2/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL
3 * project 2000. 3 * project 2000.
4 */ 4 */
@@ -390,6 +390,33 @@ int DSO_set_filename(DSO *dso, const char *filename)
390 return(1); 390 return(1);
391 } 391 }
392 392
393char *DSO_merge(DSO *dso, const char *filespec1, const char *filespec2)
394 {
395 char *result = NULL;
396
397 if(dso == NULL || filespec1 == NULL)
398 {
399 DSOerr(DSO_F_DSO_MERGE,ERR_R_PASSED_NULL_PARAMETER);
400 return(NULL);
401 }
402 if(filespec1 == NULL)
403 filespec1 = dso->filename;
404 if(filespec1 == NULL)
405 {
406 DSOerr(DSO_F_DSO_MERGE,DSO_R_NO_FILE_SPECIFICATION);
407 return(NULL);
408 }
409 if((dso->flags & DSO_FLAG_NO_NAME_TRANSLATION) == 0)
410 {
411 if(dso->merger != NULL)
412 result = dso->merger(dso, filespec1, filespec2);
413 else if(dso->meth->dso_merger != NULL)
414 result = dso->meth->dso_merger(dso,
415 filespec1, filespec2);
416 }
417 return(result);
418 }
419
393char *DSO_convert_filename(DSO *dso, const char *filename) 420char *DSO_convert_filename(DSO *dso, const char *filename)
394 { 421 {
395 char *result = NULL; 422 char *result = NULL;
diff --git a/src/lib/libcrypto/dso/dso_null.c b/src/lib/libcrypto/dso/dso_null.c
index fa13a7cb0f..4972984651 100644
--- a/src/lib/libcrypto/dso/dso_null.c
+++ b/src/lib/libcrypto/dso/dso_null.c
@@ -75,6 +75,8 @@ static DSO_METHOD dso_meth_null = {
75 NULL, /* unbind_func */ 75 NULL, /* unbind_func */
76#endif 76#endif
77 NULL, /* ctrl */ 77 NULL, /* ctrl */
78 NULL, /* dso_name_converter */
79 NULL, /* dso_merger */
78 NULL, /* init */ 80 NULL, /* init */
79 NULL /* finish */ 81 NULL /* finish */
80 }; 82 };