diff options
Diffstat (limited to 'src/lib/libcrypto/dso')
-rw-r--r-- | src/lib/libcrypto/dso/dso_dlfcn.c | 40 | ||||
-rw-r--r-- | src/lib/libcrypto/dso/dso_err.c | 52 | ||||
-rw-r--r-- | src/lib/libcrypto/dso/dso_lib.c | 71 |
3 files changed, 55 insertions, 108 deletions
diff --git a/src/lib/libcrypto/dso/dso_dlfcn.c b/src/lib/libcrypto/dso/dso_dlfcn.c index f22e641bab..95afd26b82 100644 --- a/src/lib/libcrypto/dso/dso_dlfcn.c +++ b/src/lib/libcrypto/dso/dso_dlfcn.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dso_dlfcn.c,v 1.28 2015/02/07 13:19:15 doug Exp $ */ | 1 | /* $OpenBSD: dso_dlfcn.c,v 1.29 2017/01/29 17:49:23 beck Exp $ */ |
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 | */ |
@@ -119,7 +119,7 @@ dlfcn_load(DSO *dso) | |||
119 | int flags = RTLD_LAZY; | 119 | int flags = RTLD_LAZY; |
120 | 120 | ||
121 | if (filename == NULL) { | 121 | if (filename == NULL) { |
122 | DSOerr(DSO_F_DLFCN_LOAD, DSO_R_NO_FILENAME); | 122 | DSOerror(DSO_R_NO_FILENAME); |
123 | goto err; | 123 | goto err; |
124 | } | 124 | } |
125 | 125 | ||
@@ -127,13 +127,13 @@ dlfcn_load(DSO *dso) | |||
127 | flags |= RTLD_GLOBAL; | 127 | flags |= RTLD_GLOBAL; |
128 | ptr = dlopen(filename, flags); | 128 | ptr = dlopen(filename, flags); |
129 | if (ptr == NULL) { | 129 | if (ptr == NULL) { |
130 | DSOerr(DSO_F_DLFCN_LOAD, DSO_R_LOAD_FAILED); | 130 | DSOerror(DSO_R_LOAD_FAILED); |
131 | ERR_asprintf_error_data("filename(%s): %s", filename, | 131 | ERR_asprintf_error_data("filename(%s): %s", filename, |
132 | dlerror()); | 132 | dlerror()); |
133 | goto err; | 133 | goto err; |
134 | } | 134 | } |
135 | if (!sk_void_push(dso->meth_data, (char *)ptr)) { | 135 | if (!sk_void_push(dso->meth_data, (char *)ptr)) { |
136 | DSOerr(DSO_F_DLFCN_LOAD, DSO_R_STACK_ERROR); | 136 | DSOerror(DSO_R_STACK_ERROR); |
137 | goto err; | 137 | goto err; |
138 | } | 138 | } |
139 | /* Success */ | 139 | /* Success */ |
@@ -153,14 +153,14 @@ dlfcn_unload(DSO *dso) | |||
153 | { | 153 | { |
154 | void *ptr; | 154 | void *ptr; |
155 | if (dso == NULL) { | 155 | if (dso == NULL) { |
156 | DSOerr(DSO_F_DLFCN_UNLOAD, ERR_R_PASSED_NULL_PARAMETER); | 156 | DSOerror(ERR_R_PASSED_NULL_PARAMETER); |
157 | return (0); | 157 | return (0); |
158 | } | 158 | } |
159 | if (sk_void_num(dso->meth_data) < 1) | 159 | if (sk_void_num(dso->meth_data) < 1) |
160 | return (1); | 160 | return (1); |
161 | ptr = sk_void_pop(dso->meth_data); | 161 | ptr = sk_void_pop(dso->meth_data); |
162 | if (ptr == NULL) { | 162 | if (ptr == NULL) { |
163 | DSOerr(DSO_F_DLFCN_UNLOAD, DSO_R_NULL_HANDLE); | 163 | DSOerror(DSO_R_NULL_HANDLE); |
164 | /* Should push the value back onto the stack in | 164 | /* Should push the value back onto the stack in |
165 | * case of a retry. */ | 165 | * case of a retry. */ |
166 | sk_void_push(dso->meth_data, ptr); | 166 | sk_void_push(dso->meth_data, ptr); |
@@ -177,21 +177,21 @@ dlfcn_bind_var(DSO *dso, const char *symname) | |||
177 | void *ptr, *sym; | 177 | void *ptr, *sym; |
178 | 178 | ||
179 | if ((dso == NULL) || (symname == NULL)) { | 179 | if ((dso == NULL) || (symname == NULL)) { |
180 | DSOerr(DSO_F_DLFCN_BIND_VAR, ERR_R_PASSED_NULL_PARAMETER); | 180 | DSOerror(ERR_R_PASSED_NULL_PARAMETER); |
181 | return (NULL); | 181 | return (NULL); |
182 | } | 182 | } |
183 | if (sk_void_num(dso->meth_data) < 1) { | 183 | if (sk_void_num(dso->meth_data) < 1) { |
184 | DSOerr(DSO_F_DLFCN_BIND_VAR, DSO_R_STACK_ERROR); | 184 | DSOerror(DSO_R_STACK_ERROR); |
185 | return (NULL); | 185 | return (NULL); |
186 | } | 186 | } |
187 | ptr = sk_void_value(dso->meth_data, sk_void_num(dso->meth_data) - 1); | 187 | ptr = sk_void_value(dso->meth_data, sk_void_num(dso->meth_data) - 1); |
188 | if (ptr == NULL) { | 188 | if (ptr == NULL) { |
189 | DSOerr(DSO_F_DLFCN_BIND_VAR, DSO_R_NULL_HANDLE); | 189 | DSOerror(DSO_R_NULL_HANDLE); |
190 | return (NULL); | 190 | return (NULL); |
191 | } | 191 | } |
192 | sym = dlsym(ptr, symname); | 192 | sym = dlsym(ptr, symname); |
193 | if (sym == NULL) { | 193 | if (sym == NULL) { |
194 | DSOerr(DSO_F_DLFCN_BIND_VAR, DSO_R_SYM_FAILURE); | 194 | DSOerror(DSO_R_SYM_FAILURE); |
195 | ERR_asprintf_error_data("symname(%s): %s", symname, dlerror()); | 195 | ERR_asprintf_error_data("symname(%s): %s", symname, dlerror()); |
196 | return (NULL); | 196 | return (NULL); |
197 | } | 197 | } |
@@ -208,21 +208,21 @@ dlfcn_bind_func(DSO *dso, const char *symname) | |||
208 | } u; | 208 | } u; |
209 | 209 | ||
210 | if ((dso == NULL) || (symname == NULL)) { | 210 | if ((dso == NULL) || (symname == NULL)) { |
211 | DSOerr(DSO_F_DLFCN_BIND_FUNC, ERR_R_PASSED_NULL_PARAMETER); | 211 | DSOerror(ERR_R_PASSED_NULL_PARAMETER); |
212 | return (NULL); | 212 | return (NULL); |
213 | } | 213 | } |
214 | if (sk_void_num(dso->meth_data) < 1) { | 214 | if (sk_void_num(dso->meth_data) < 1) { |
215 | DSOerr(DSO_F_DLFCN_BIND_FUNC, DSO_R_STACK_ERROR); | 215 | DSOerror(DSO_R_STACK_ERROR); |
216 | return (NULL); | 216 | return (NULL); |
217 | } | 217 | } |
218 | ptr = sk_void_value(dso->meth_data, sk_void_num(dso->meth_data) - 1); | 218 | ptr = sk_void_value(dso->meth_data, sk_void_num(dso->meth_data) - 1); |
219 | if (ptr == NULL) { | 219 | if (ptr == NULL) { |
220 | DSOerr(DSO_F_DLFCN_BIND_FUNC, DSO_R_NULL_HANDLE); | 220 | DSOerror(DSO_R_NULL_HANDLE); |
221 | return (NULL); | 221 | return (NULL); |
222 | } | 222 | } |
223 | u.dlret = dlsym(ptr, symname); | 223 | u.dlret = dlsym(ptr, symname); |
224 | if (u.dlret == NULL) { | 224 | if (u.dlret == NULL) { |
225 | DSOerr(DSO_F_DLFCN_BIND_FUNC, DSO_R_SYM_FAILURE); | 225 | DSOerror(DSO_R_SYM_FAILURE); |
226 | ERR_asprintf_error_data("symname(%s): %s", symname, dlerror()); | 226 | ERR_asprintf_error_data("symname(%s): %s", symname, dlerror()); |
227 | return (NULL); | 227 | return (NULL); |
228 | } | 228 | } |
@@ -235,8 +235,7 @@ dlfcn_merger(DSO *dso, const char *filespec1, const char *filespec2) | |||
235 | char *merged; | 235 | char *merged; |
236 | 236 | ||
237 | if (!filespec1 && !filespec2) { | 237 | if (!filespec1 && !filespec2) { |
238 | DSOerr(DSO_F_DLFCN_MERGER, | 238 | DSOerror(ERR_R_PASSED_NULL_PARAMETER); |
239 | ERR_R_PASSED_NULL_PARAMETER); | ||
240 | return (NULL); | 239 | return (NULL); |
241 | } | 240 | } |
242 | /* If the first file specification is a rooted path, it rules. | 241 | /* If the first file specification is a rooted path, it rules. |
@@ -244,7 +243,7 @@ dlfcn_merger(DSO *dso, const char *filespec1, const char *filespec2) | |||
244 | if (!filespec2 || (filespec1 != NULL && filespec1[0] == '/')) { | 243 | if (!filespec2 || (filespec1 != NULL && filespec1[0] == '/')) { |
245 | merged = strdup(filespec1); | 244 | merged = strdup(filespec1); |
246 | if (!merged) { | 245 | if (!merged) { |
247 | DSOerr(DSO_F_DLFCN_MERGER, ERR_R_MALLOC_FAILURE); | 246 | DSOerror(ERR_R_MALLOC_FAILURE); |
248 | return (NULL); | 247 | return (NULL); |
249 | } | 248 | } |
250 | } | 249 | } |
@@ -252,7 +251,7 @@ dlfcn_merger(DSO *dso, const char *filespec1, const char *filespec2) | |||
252 | else if (!filespec1) { | 251 | else if (!filespec1) { |
253 | merged = strdup(filespec2); | 252 | merged = strdup(filespec2); |
254 | if (!merged) { | 253 | if (!merged) { |
255 | DSOerr(DSO_F_DLFCN_MERGER, ERR_R_MALLOC_FAILURE); | 254 | DSOerror(ERR_R_MALLOC_FAILURE); |
256 | return (NULL); | 255 | return (NULL); |
257 | } | 256 | } |
258 | } else | 257 | } else |
@@ -273,7 +272,7 @@ dlfcn_merger(DSO *dso, const char *filespec1, const char *filespec2) | |||
273 | } | 272 | } |
274 | merged = malloc(len + 2); | 273 | merged = malloc(len + 2); |
275 | if (!merged) { | 274 | if (!merged) { |
276 | DSOerr(DSO_F_DLFCN_MERGER, ERR_R_MALLOC_FAILURE); | 275 | DSOerror(ERR_R_MALLOC_FAILURE); |
277 | return (NULL); | 276 | return (NULL); |
278 | } | 277 | } |
279 | strlcpy(merged, filespec2, len + 2); | 278 | strlcpy(merged, filespec2, len + 2); |
@@ -306,8 +305,7 @@ dlfcn_name_converter(DSO *dso, const char *filename) | |||
306 | } | 305 | } |
307 | 306 | ||
308 | if (translated == NULL) | 307 | if (translated == NULL) |
309 | DSOerr(DSO_F_DLFCN_NAME_CONVERTER, | 308 | DSOerror(DSO_R_NAME_TRANSLATION_FAILED); |
310 | DSO_R_NAME_TRANSLATION_FAILED); | ||
311 | return (translated); | 309 | return (translated); |
312 | } | 310 | } |
313 | 311 | ||
diff --git a/src/lib/libcrypto/dso/dso_err.c b/src/lib/libcrypto/dso/dso_err.c index b8514a4aef..be6375a3a7 100644 --- a/src/lib/libcrypto/dso/dso_err.c +++ b/src/lib/libcrypto/dso/dso_err.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dso_err.c,v 1.8 2014/07/10 22:45:56 jsing Exp $ */ | 1 | /* $OpenBSD: dso_err.c,v 1.9 2017/01/29 17:49:23 beck Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -72,55 +72,7 @@ | |||
72 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_DSO,0,reason) | 72 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_DSO,0,reason) |
73 | 73 | ||
74 | static ERR_STRING_DATA DSO_str_functs[]= { | 74 | static ERR_STRING_DATA DSO_str_functs[]= { |
75 | {ERR_FUNC(DSO_F_BEOS_BIND_FUNC), "BEOS_BIND_FUNC"}, | 75 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, |
76 | {ERR_FUNC(DSO_F_BEOS_BIND_VAR), "BEOS_BIND_VAR"}, | ||
77 | {ERR_FUNC(DSO_F_BEOS_LOAD), "BEOS_LOAD"}, | ||
78 | {ERR_FUNC(DSO_F_BEOS_NAME_CONVERTER), "BEOS_NAME_CONVERTER"}, | ||
79 | {ERR_FUNC(DSO_F_BEOS_UNLOAD), "BEOS_UNLOAD"}, | ||
80 | {ERR_FUNC(DSO_F_DLFCN_BIND_FUNC), "DLFCN_BIND_FUNC"}, | ||
81 | {ERR_FUNC(DSO_F_DLFCN_BIND_VAR), "DLFCN_BIND_VAR"}, | ||
82 | {ERR_FUNC(DSO_F_DLFCN_LOAD), "DLFCN_LOAD"}, | ||
83 | {ERR_FUNC(DSO_F_DLFCN_MERGER), "DLFCN_MERGER"}, | ||
84 | {ERR_FUNC(DSO_F_DLFCN_NAME_CONVERTER), "DLFCN_NAME_CONVERTER"}, | ||
85 | {ERR_FUNC(DSO_F_DLFCN_UNLOAD), "DLFCN_UNLOAD"}, | ||
86 | {ERR_FUNC(DSO_F_DL_BIND_FUNC), "DL_BIND_FUNC"}, | ||
87 | {ERR_FUNC(DSO_F_DL_BIND_VAR), "DL_BIND_VAR"}, | ||
88 | {ERR_FUNC(DSO_F_DL_LOAD), "DL_LOAD"}, | ||
89 | {ERR_FUNC(DSO_F_DL_MERGER), "DL_MERGER"}, | ||
90 | {ERR_FUNC(DSO_F_DL_NAME_CONVERTER), "DL_NAME_CONVERTER"}, | ||
91 | {ERR_FUNC(DSO_F_DL_UNLOAD), "DL_UNLOAD"}, | ||
92 | {ERR_FUNC(DSO_F_DSO_BIND_FUNC), "DSO_bind_func"}, | ||
93 | {ERR_FUNC(DSO_F_DSO_BIND_VAR), "DSO_bind_var"}, | ||
94 | {ERR_FUNC(DSO_F_DSO_CONVERT_FILENAME), "DSO_convert_filename"}, | ||
95 | {ERR_FUNC(DSO_F_DSO_CTRL), "DSO_ctrl"}, | ||
96 | {ERR_FUNC(DSO_F_DSO_FREE), "DSO_free"}, | ||
97 | {ERR_FUNC(DSO_F_DSO_GET_FILENAME), "DSO_get_filename"}, | ||
98 | {ERR_FUNC(DSO_F_DSO_GET_LOADED_FILENAME), "DSO_get_loaded_filename"}, | ||
99 | {ERR_FUNC(DSO_F_DSO_GLOBAL_LOOKUP), "DSO_global_lookup"}, | ||
100 | {ERR_FUNC(DSO_F_DSO_LOAD), "DSO_load"}, | ||
101 | {ERR_FUNC(DSO_F_DSO_MERGE), "DSO_merge"}, | ||
102 | {ERR_FUNC(DSO_F_DSO_NEW_METHOD), "DSO_new_method"}, | ||
103 | {ERR_FUNC(DSO_F_DSO_PATHBYADDR), "DSO_pathbyaddr"}, | ||
104 | {ERR_FUNC(DSO_F_DSO_SET_FILENAME), "DSO_set_filename"}, | ||
105 | {ERR_FUNC(DSO_F_DSO_SET_NAME_CONVERTER), "DSO_set_name_converter"}, | ||
106 | {ERR_FUNC(DSO_F_DSO_UP_REF), "DSO_up_ref"}, | ||
107 | {ERR_FUNC(DSO_F_GLOBAL_LOOKUP_FUNC), "GLOBAL_LOOKUP_FUNC"}, | ||
108 | {ERR_FUNC(DSO_F_PATHBYADDR), "PATHBYADDR"}, | ||
109 | {ERR_FUNC(DSO_F_VMS_BIND_SYM), "VMS_BIND_SYM"}, | ||
110 | {ERR_FUNC(DSO_F_VMS_LOAD), "VMS_LOAD"}, | ||
111 | {ERR_FUNC(DSO_F_VMS_MERGER), "VMS_MERGER"}, | ||
112 | {ERR_FUNC(DSO_F_VMS_UNLOAD), "VMS_UNLOAD"}, | ||
113 | {ERR_FUNC(DSO_F_WIN32_BIND_FUNC), "WIN32_BIND_FUNC"}, | ||
114 | {ERR_FUNC(DSO_F_WIN32_BIND_VAR), "WIN32_BIND_VAR"}, | ||
115 | {ERR_FUNC(DSO_F_WIN32_GLOBALLOOKUP), "WIN32_GLOBALLOOKUP"}, | ||
116 | {ERR_FUNC(DSO_F_WIN32_GLOBALLOOKUP_FUNC), "WIN32_GLOBALLOOKUP_FUNC"}, | ||
117 | {ERR_FUNC(DSO_F_WIN32_JOINER), "WIN32_JOINER"}, | ||
118 | {ERR_FUNC(DSO_F_WIN32_LOAD), "WIN32_LOAD"}, | ||
119 | {ERR_FUNC(DSO_F_WIN32_MERGER), "WIN32_MERGER"}, | ||
120 | {ERR_FUNC(DSO_F_WIN32_NAME_CONVERTER), "WIN32_NAME_CONVERTER"}, | ||
121 | {ERR_FUNC(DSO_F_WIN32_PATHBYADDR), "WIN32_PATHBYADDR"}, | ||
122 | {ERR_FUNC(DSO_F_WIN32_SPLITTER), "WIN32_SPLITTER"}, | ||
123 | {ERR_FUNC(DSO_F_WIN32_UNLOAD), "WIN32_UNLOAD"}, | ||
124 | {0, NULL} | 76 | {0, NULL} |
125 | }; | 77 | }; |
126 | 78 | ||
diff --git a/src/lib/libcrypto/dso/dso_lib.c b/src/lib/libcrypto/dso/dso_lib.c index 3002e4d99c..7902fbcc6e 100644 --- a/src/lib/libcrypto/dso/dso_lib.c +++ b/src/lib/libcrypto/dso/dso_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dso_lib.c,v 1.18 2014/07/11 08:44:48 jsing Exp $ */ | 1 | /* $OpenBSD: dso_lib.c,v 1.19 2017/01/29 17:49:23 beck Exp $ */ |
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 | */ |
@@ -111,13 +111,13 @@ DSO_new_method(DSO_METHOD *meth) | |||
111 | default_DSO_meth = DSO_METHOD_openssl(); | 111 | default_DSO_meth = DSO_METHOD_openssl(); |
112 | ret = calloc(1, sizeof(DSO)); | 112 | ret = calloc(1, sizeof(DSO)); |
113 | if (ret == NULL) { | 113 | if (ret == NULL) { |
114 | DSOerr(DSO_F_DSO_NEW_METHOD, ERR_R_MALLOC_FAILURE); | 114 | DSOerror(ERR_R_MALLOC_FAILURE); |
115 | return (NULL); | 115 | return (NULL); |
116 | } | 116 | } |
117 | ret->meth_data = sk_void_new_null(); | 117 | ret->meth_data = sk_void_new_null(); |
118 | if (ret->meth_data == NULL) { | 118 | if (ret->meth_data == NULL) { |
119 | /* sk_new doesn't generate any errors so we do */ | 119 | /* sk_new doesn't generate any errors so we do */ |
120 | DSOerr(DSO_F_DSO_NEW_METHOD, ERR_R_MALLOC_FAILURE); | 120 | DSOerror(ERR_R_MALLOC_FAILURE); |
121 | free(ret); | 121 | free(ret); |
122 | return (NULL); | 122 | return (NULL); |
123 | } | 123 | } |
@@ -139,7 +139,7 @@ DSO_free(DSO *dso) | |||
139 | int i; | 139 | int i; |
140 | 140 | ||
141 | if (dso == NULL) { | 141 | if (dso == NULL) { |
142 | DSOerr(DSO_F_DSO_FREE, ERR_R_PASSED_NULL_PARAMETER); | 142 | DSOerror(ERR_R_PASSED_NULL_PARAMETER); |
143 | return (0); | 143 | return (0); |
144 | } | 144 | } |
145 | 145 | ||
@@ -148,12 +148,12 @@ DSO_free(DSO *dso) | |||
148 | return (1); | 148 | return (1); |
149 | 149 | ||
150 | if ((dso->meth->dso_unload != NULL) && !dso->meth->dso_unload(dso)) { | 150 | if ((dso->meth->dso_unload != NULL) && !dso->meth->dso_unload(dso)) { |
151 | DSOerr(DSO_F_DSO_FREE, DSO_R_UNLOAD_FAILED); | 151 | DSOerror(DSO_R_UNLOAD_FAILED); |
152 | return (0); | 152 | return (0); |
153 | } | 153 | } |
154 | 154 | ||
155 | if ((dso->meth->finish != NULL) && !dso->meth->finish(dso)) { | 155 | if ((dso->meth->finish != NULL) && !dso->meth->finish(dso)) { |
156 | DSOerr(DSO_F_DSO_FREE, DSO_R_FINISH_FAILED); | 156 | DSOerror(DSO_R_FINISH_FAILED); |
157 | return (0); | 157 | return (0); |
158 | } | 158 | } |
159 | 159 | ||
@@ -175,7 +175,7 @@ int | |||
175 | DSO_up_ref(DSO *dso) | 175 | DSO_up_ref(DSO *dso) |
176 | { | 176 | { |
177 | if (dso == NULL) { | 177 | if (dso == NULL) { |
178 | DSOerr(DSO_F_DSO_UP_REF, ERR_R_PASSED_NULL_PARAMETER); | 178 | DSOerror(ERR_R_PASSED_NULL_PARAMETER); |
179 | return (0); | 179 | return (0); |
180 | } | 180 | } |
181 | 181 | ||
@@ -192,40 +192,40 @@ DSO_load(DSO *dso, const char *filename, DSO_METHOD *meth, int flags) | |||
192 | if (dso == NULL) { | 192 | if (dso == NULL) { |
193 | ret = DSO_new_method(meth); | 193 | ret = DSO_new_method(meth); |
194 | if (ret == NULL) { | 194 | if (ret == NULL) { |
195 | DSOerr(DSO_F_DSO_LOAD, ERR_R_MALLOC_FAILURE); | 195 | DSOerror(ERR_R_MALLOC_FAILURE); |
196 | goto err; | 196 | goto err; |
197 | } | 197 | } |
198 | allocated = 1; | 198 | allocated = 1; |
199 | /* Pass the provided flags to the new DSO object */ | 199 | /* Pass the provided flags to the new DSO object */ |
200 | if (DSO_ctrl(ret, DSO_CTRL_SET_FLAGS, flags, NULL) < 0) { | 200 | if (DSO_ctrl(ret, DSO_CTRL_SET_FLAGS, flags, NULL) < 0) { |
201 | DSOerr(DSO_F_DSO_LOAD, DSO_R_CTRL_FAILED); | 201 | DSOerror(DSO_R_CTRL_FAILED); |
202 | goto err; | 202 | goto err; |
203 | } | 203 | } |
204 | } else | 204 | } else |
205 | ret = dso; | 205 | ret = dso; |
206 | /* Don't load if we're currently already loaded */ | 206 | /* Don't load if we're currently already loaded */ |
207 | if (ret->filename != NULL) { | 207 | if (ret->filename != NULL) { |
208 | DSOerr(DSO_F_DSO_LOAD, DSO_R_DSO_ALREADY_LOADED); | 208 | DSOerror(DSO_R_DSO_ALREADY_LOADED); |
209 | goto err; | 209 | goto err; |
210 | } | 210 | } |
211 | /* filename can only be NULL if we were passed a dso that already has | 211 | /* filename can only be NULL if we were passed a dso that already has |
212 | * one set. */ | 212 | * one set. */ |
213 | if (filename != NULL) | 213 | if (filename != NULL) |
214 | if (!DSO_set_filename(ret, filename)) { | 214 | if (!DSO_set_filename(ret, filename)) { |
215 | DSOerr(DSO_F_DSO_LOAD, DSO_R_SET_FILENAME_FAILED); | 215 | DSOerror(DSO_R_SET_FILENAME_FAILED); |
216 | goto err; | 216 | goto err; |
217 | } | 217 | } |
218 | filename = ret->filename; | 218 | filename = ret->filename; |
219 | if (filename == NULL) { | 219 | if (filename == NULL) { |
220 | DSOerr(DSO_F_DSO_LOAD, DSO_R_NO_FILENAME); | 220 | DSOerror(DSO_R_NO_FILENAME); |
221 | goto err; | 221 | goto err; |
222 | } | 222 | } |
223 | if (ret->meth->dso_load == NULL) { | 223 | if (ret->meth->dso_load == NULL) { |
224 | DSOerr(DSO_F_DSO_LOAD, DSO_R_UNSUPPORTED); | 224 | DSOerror(DSO_R_UNSUPPORTED); |
225 | goto err; | 225 | goto err; |
226 | } | 226 | } |
227 | if (!ret->meth->dso_load(ret)) { | 227 | if (!ret->meth->dso_load(ret)) { |
228 | DSOerr(DSO_F_DSO_LOAD, DSO_R_LOAD_FAILED); | 228 | DSOerror(DSO_R_LOAD_FAILED); |
229 | goto err; | 229 | goto err; |
230 | } | 230 | } |
231 | /* Load succeeded */ | 231 | /* Load succeeded */ |
@@ -243,15 +243,15 @@ DSO_bind_var(DSO *dso, const char *symname) | |||
243 | void *ret = NULL; | 243 | void *ret = NULL; |
244 | 244 | ||
245 | if ((dso == NULL) || (symname == NULL)) { | 245 | if ((dso == NULL) || (symname == NULL)) { |
246 | DSOerr(DSO_F_DSO_BIND_VAR, ERR_R_PASSED_NULL_PARAMETER); | 246 | DSOerror(ERR_R_PASSED_NULL_PARAMETER); |
247 | return (NULL); | 247 | return (NULL); |
248 | } | 248 | } |
249 | if (dso->meth->dso_bind_var == NULL) { | 249 | if (dso->meth->dso_bind_var == NULL) { |
250 | DSOerr(DSO_F_DSO_BIND_VAR, DSO_R_UNSUPPORTED); | 250 | DSOerror(DSO_R_UNSUPPORTED); |
251 | return (NULL); | 251 | return (NULL); |
252 | } | 252 | } |
253 | if ((ret = dso->meth->dso_bind_var(dso, symname)) == NULL) { | 253 | if ((ret = dso->meth->dso_bind_var(dso, symname)) == NULL) { |
254 | DSOerr(DSO_F_DSO_BIND_VAR, DSO_R_SYM_FAILURE); | 254 | DSOerror(DSO_R_SYM_FAILURE); |
255 | return (NULL); | 255 | return (NULL); |
256 | } | 256 | } |
257 | /* Success */ | 257 | /* Success */ |
@@ -264,15 +264,15 @@ DSO_bind_func(DSO *dso, const char *symname) | |||
264 | DSO_FUNC_TYPE ret = NULL; | 264 | DSO_FUNC_TYPE ret = NULL; |
265 | 265 | ||
266 | if ((dso == NULL) || (symname == NULL)) { | 266 | if ((dso == NULL) || (symname == NULL)) { |
267 | DSOerr(DSO_F_DSO_BIND_FUNC, ERR_R_PASSED_NULL_PARAMETER); | 267 | DSOerror(ERR_R_PASSED_NULL_PARAMETER); |
268 | return (NULL); | 268 | return (NULL); |
269 | } | 269 | } |
270 | if (dso->meth->dso_bind_func == NULL) { | 270 | if (dso->meth->dso_bind_func == NULL) { |
271 | DSOerr(DSO_F_DSO_BIND_FUNC, DSO_R_UNSUPPORTED); | 271 | DSOerror(DSO_R_UNSUPPORTED); |
272 | return (NULL); | 272 | return (NULL); |
273 | } | 273 | } |
274 | if ((ret = dso->meth->dso_bind_func(dso, symname)) == NULL) { | 274 | if ((ret = dso->meth->dso_bind_func(dso, symname)) == NULL) { |
275 | DSOerr(DSO_F_DSO_BIND_FUNC, DSO_R_SYM_FAILURE); | 275 | DSOerror(DSO_R_SYM_FAILURE); |
276 | return (NULL); | 276 | return (NULL); |
277 | } | 277 | } |
278 | /* Success */ | 278 | /* Success */ |
@@ -291,7 +291,7 @@ long | |||
291 | DSO_ctrl(DSO *dso, int cmd, long larg, void *parg) | 291 | DSO_ctrl(DSO *dso, int cmd, long larg, void *parg) |
292 | { | 292 | { |
293 | if (dso == NULL) { | 293 | if (dso == NULL) { |
294 | DSOerr(DSO_F_DSO_CTRL, ERR_R_PASSED_NULL_PARAMETER); | 294 | DSOerror(ERR_R_PASSED_NULL_PARAMETER); |
295 | return (-1); | 295 | return (-1); |
296 | } | 296 | } |
297 | /* We should intercept certain generic commands and only pass control | 297 | /* We should intercept certain generic commands and only pass control |
@@ -310,7 +310,7 @@ DSO_ctrl(DSO *dso, int cmd, long larg, void *parg) | |||
310 | break; | 310 | break; |
311 | } | 311 | } |
312 | if ((dso->meth == NULL) || (dso->meth->dso_ctrl == NULL)) { | 312 | if ((dso->meth == NULL) || (dso->meth->dso_ctrl == NULL)) { |
313 | DSOerr(DSO_F_DSO_CTRL, DSO_R_UNSUPPORTED); | 313 | DSOerror(DSO_R_UNSUPPORTED); |
314 | return (-1); | 314 | return (-1); |
315 | } | 315 | } |
316 | return (dso->meth->dso_ctrl(dso, cmd, larg, parg)); | 316 | return (dso->meth->dso_ctrl(dso, cmd, larg, parg)); |
@@ -321,8 +321,7 @@ DSO_set_name_converter(DSO *dso, DSO_NAME_CONVERTER_FUNC cb, | |||
321 | DSO_NAME_CONVERTER_FUNC *oldcb) | 321 | DSO_NAME_CONVERTER_FUNC *oldcb) |
322 | { | 322 | { |
323 | if (dso == NULL) { | 323 | if (dso == NULL) { |
324 | DSOerr(DSO_F_DSO_SET_NAME_CONVERTER, | 324 | DSOerror(ERR_R_PASSED_NULL_PARAMETER); |
325 | ERR_R_PASSED_NULL_PARAMETER); | ||
326 | return (0); | 325 | return (0); |
327 | } | 326 | } |
328 | if (oldcb) | 327 | if (oldcb) |
@@ -335,7 +334,7 @@ const char * | |||
335 | DSO_get_filename(DSO *dso) | 334 | DSO_get_filename(DSO *dso) |
336 | { | 335 | { |
337 | if (dso == NULL) { | 336 | if (dso == NULL) { |
338 | DSOerr(DSO_F_DSO_GET_FILENAME, ERR_R_PASSED_NULL_PARAMETER); | 337 | DSOerror(ERR_R_PASSED_NULL_PARAMETER); |
339 | return (NULL); | 338 | return (NULL); |
340 | } | 339 | } |
341 | return (dso->filename); | 340 | return (dso->filename); |
@@ -347,17 +346,17 @@ DSO_set_filename(DSO *dso, const char *filename) | |||
347 | char *copied; | 346 | char *copied; |
348 | 347 | ||
349 | if ((dso == NULL) || (filename == NULL)) { | 348 | if ((dso == NULL) || (filename == NULL)) { |
350 | DSOerr(DSO_F_DSO_SET_FILENAME, ERR_R_PASSED_NULL_PARAMETER); | 349 | DSOerror(ERR_R_PASSED_NULL_PARAMETER); |
351 | return (0); | 350 | return (0); |
352 | } | 351 | } |
353 | if (dso->loaded_filename) { | 352 | if (dso->loaded_filename) { |
354 | DSOerr(DSO_F_DSO_SET_FILENAME, DSO_R_DSO_ALREADY_LOADED); | 353 | DSOerror(DSO_R_DSO_ALREADY_LOADED); |
355 | return (0); | 354 | return (0); |
356 | } | 355 | } |
357 | /* We'll duplicate filename */ | 356 | /* We'll duplicate filename */ |
358 | copied = strdup(filename); | 357 | copied = strdup(filename); |
359 | if (copied == NULL) { | 358 | if (copied == NULL) { |
360 | DSOerr(DSO_F_DSO_SET_FILENAME, ERR_R_MALLOC_FAILURE); | 359 | DSOerror(ERR_R_MALLOC_FAILURE); |
361 | return (0); | 360 | return (0); |
362 | } | 361 | } |
363 | free(dso->filename); | 362 | free(dso->filename); |
@@ -371,7 +370,7 @@ DSO_merge(DSO *dso, const char *filespec1, const char *filespec2) | |||
371 | char *result = NULL; | 370 | char *result = NULL; |
372 | 371 | ||
373 | if (dso == NULL || filespec1 == NULL) { | 372 | if (dso == NULL || filespec1 == NULL) { |
374 | DSOerr(DSO_F_DSO_MERGE, ERR_R_PASSED_NULL_PARAMETER); | 373 | DSOerror(ERR_R_PASSED_NULL_PARAMETER); |
375 | return (NULL); | 374 | return (NULL); |
376 | } | 375 | } |
377 | if ((dso->flags & DSO_FLAG_NO_NAME_TRANSLATION) == 0) { | 376 | if ((dso->flags & DSO_FLAG_NO_NAME_TRANSLATION) == 0) { |
@@ -390,13 +389,13 @@ DSO_convert_filename(DSO *dso, const char *filename) | |||
390 | char *result = NULL; | 389 | char *result = NULL; |
391 | 390 | ||
392 | if (dso == NULL) { | 391 | if (dso == NULL) { |
393 | DSOerr(DSO_F_DSO_CONVERT_FILENAME, ERR_R_PASSED_NULL_PARAMETER); | 392 | DSOerror(ERR_R_PASSED_NULL_PARAMETER); |
394 | return (NULL); | 393 | return (NULL); |
395 | } | 394 | } |
396 | if (filename == NULL) | 395 | if (filename == NULL) |
397 | filename = dso->filename; | 396 | filename = dso->filename; |
398 | if (filename == NULL) { | 397 | if (filename == NULL) { |
399 | DSOerr(DSO_F_DSO_CONVERT_FILENAME, DSO_R_NO_FILENAME); | 398 | DSOerror(DSO_R_NO_FILENAME); |
400 | return (NULL); | 399 | return (NULL); |
401 | } | 400 | } |
402 | if ((dso->flags & DSO_FLAG_NO_NAME_TRANSLATION) == 0) { | 401 | if ((dso->flags & DSO_FLAG_NO_NAME_TRANSLATION) == 0) { |
@@ -408,8 +407,7 @@ DSO_convert_filename(DSO *dso, const char *filename) | |||
408 | if (result == NULL) { | 407 | if (result == NULL) { |
409 | result = strdup(filename); | 408 | result = strdup(filename); |
410 | if (result == NULL) { | 409 | if (result == NULL) { |
411 | DSOerr(DSO_F_DSO_CONVERT_FILENAME, | 410 | DSOerror(ERR_R_MALLOC_FAILURE); |
412 | ERR_R_MALLOC_FAILURE); | ||
413 | return (NULL); | 411 | return (NULL); |
414 | } | 412 | } |
415 | } | 413 | } |
@@ -420,8 +418,7 @@ const char * | |||
420 | DSO_get_loaded_filename(DSO *dso) | 418 | DSO_get_loaded_filename(DSO *dso) |
421 | { | 419 | { |
422 | if (dso == NULL) { | 420 | if (dso == NULL) { |
423 | DSOerr(DSO_F_DSO_GET_LOADED_FILENAME, | 421 | DSOerror(ERR_R_PASSED_NULL_PARAMETER); |
424 | ERR_R_PASSED_NULL_PARAMETER); | ||
425 | return (NULL); | 422 | return (NULL); |
426 | } | 423 | } |
427 | return (dso->loaded_filename); | 424 | return (dso->loaded_filename); |
@@ -434,7 +431,7 @@ DSO_pathbyaddr(void *addr, char *path, int sz) | |||
434 | if (meth == NULL) | 431 | if (meth == NULL) |
435 | meth = DSO_METHOD_openssl(); | 432 | meth = DSO_METHOD_openssl(); |
436 | if (meth->pathbyaddr == NULL) { | 433 | if (meth->pathbyaddr == NULL) { |
437 | DSOerr(DSO_F_DSO_PATHBYADDR, DSO_R_UNSUPPORTED); | 434 | DSOerror(DSO_R_UNSUPPORTED); |
438 | return -1; | 435 | return -1; |
439 | } | 436 | } |
440 | return (*meth->pathbyaddr)(addr, path, sz); | 437 | return (*meth->pathbyaddr)(addr, path, sz); |
@@ -447,7 +444,7 @@ DSO_global_lookup(const char *name) | |||
447 | if (meth == NULL) | 444 | if (meth == NULL) |
448 | meth = DSO_METHOD_openssl(); | 445 | meth = DSO_METHOD_openssl(); |
449 | if (meth->globallookup == NULL) { | 446 | if (meth->globallookup == NULL) { |
450 | DSOerr(DSO_F_DSO_GLOBAL_LOOKUP, DSO_R_UNSUPPORTED); | 447 | DSOerror(DSO_R_UNSUPPORTED); |
451 | return NULL; | 448 | return NULL; |
452 | } | 449 | } |
453 | return (*meth->globallookup)(name); | 450 | return (*meth->globallookup)(name); |