mirror of
https://github.com/openssl/openssl.git
synced 2025-04-12 20:30:52 +08:00
Remove several unused undocumented functions.
Removed the following: DSO_bind_var, DSO_bind_var, DSO_get_default_method, DSO_get_loaded_filename, DSO_get_loaded_filename, DSO_get_method, DSO_new_method, DSO_pathbyaddr, DSO_set_default_method, DSO_set_method, DSO_set_name_converter, DSO_set_name_converter Reviewed-by: Richard Levitte <levitte@openssl.org>
This commit is contained in:
parent
de70582410
commit
3d8b2ec42b
crypto/dso
include/openssl
util
@ -67,26 +67,22 @@
|
||||
|
||||
static int dl_load(DSO *dso);
|
||||
static int dl_unload(DSO *dso);
|
||||
static void *dl_bind_var(DSO *dso, const char *symname);
|
||||
static DSO_FUNC_TYPE dl_bind_func(DSO *dso, const char *symname);
|
||||
static char *dl_name_converter(DSO *dso, const char *filename);
|
||||
static char *dl_merger(DSO *dso, const char *filespec1,
|
||||
const char *filespec2);
|
||||
static int dl_pathbyaddr(void *addr, char *path, int sz);
|
||||
static void *dl_globallookup(const char *name);
|
||||
|
||||
static DSO_METHOD dso_meth_dl = {
|
||||
"OpenSSL 'dl' shared library method",
|
||||
dl_load,
|
||||
dl_unload,
|
||||
dl_bind_var,
|
||||
dl_bind_func,
|
||||
NULL, /* ctrl */
|
||||
dl_name_converter,
|
||||
dl_merger,
|
||||
NULL, /* init */
|
||||
NULL, /* finish */
|
||||
dl_pathbyaddr,
|
||||
dl_globallookup
|
||||
};
|
||||
|
||||
@ -164,32 +160,6 @@ static int dl_unload(DSO *dso)
|
||||
return (1);
|
||||
}
|
||||
|
||||
static void *dl_bind_var(DSO *dso, const char *symname)
|
||||
{
|
||||
shl_t ptr;
|
||||
void *sym;
|
||||
|
||||
if ((dso == NULL) || (symname == NULL)) {
|
||||
DSOerr(DSO_F_DL_BIND_VAR, ERR_R_PASSED_NULL_PARAMETER);
|
||||
return (NULL);
|
||||
}
|
||||
if (sk_num(dso->meth_data) < 1) {
|
||||
DSOerr(DSO_F_DL_BIND_VAR, DSO_R_STACK_ERROR);
|
||||
return (NULL);
|
||||
}
|
||||
ptr = (shl_t) sk_value(dso->meth_data, sk_num(dso->meth_data) - 1);
|
||||
if (ptr == NULL) {
|
||||
DSOerr(DSO_F_DL_BIND_VAR, DSO_R_NULL_HANDLE);
|
||||
return (NULL);
|
||||
}
|
||||
if (shl_findsym(&ptr, symname, TYPE_UNDEFINED, &sym) < 0) {
|
||||
DSOerr(DSO_F_DL_BIND_VAR, DSO_R_SYM_FAILURE);
|
||||
ERR_add_error_data(4, "symname(", symname, "): ", strerror(errno));
|
||||
return (NULL);
|
||||
}
|
||||
return (sym);
|
||||
}
|
||||
|
||||
static DSO_FUNC_TYPE dl_bind_func(DSO *dso, const char *symname)
|
||||
{
|
||||
shl_t ptr;
|
||||
@ -310,38 +280,6 @@ static char *dl_name_converter(DSO *dso, const char *filename)
|
||||
return (translated);
|
||||
}
|
||||
|
||||
static int dl_pathbyaddr(void *addr, char *path, int sz)
|
||||
{
|
||||
struct shl_descriptor inf;
|
||||
int i, len;
|
||||
|
||||
if (addr == NULL) {
|
||||
union {
|
||||
int (*f) (void *, char *, int);
|
||||
void *p;
|
||||
} t = {
|
||||
dl_pathbyaddr
|
||||
};
|
||||
addr = t.p;
|
||||
}
|
||||
|
||||
for (i = -1; shl_get_r(i, &inf) == 0; i++) {
|
||||
if (((size_t)addr >= inf.tstart && (size_t)addr < inf.tend) ||
|
||||
((size_t)addr >= inf.dstart && (size_t)addr < inf.dend)) {
|
||||
len = (int)strlen(inf.filename);
|
||||
if (sz <= 0)
|
||||
return len + 1;
|
||||
if (len >= sz)
|
||||
len = sz - 1;
|
||||
memcpy(path, inf.filename, len);
|
||||
path[len++] = 0;
|
||||
return len;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void *dl_globallookup(const char *name)
|
||||
{
|
||||
void *ret;
|
||||
|
@ -89,26 +89,22 @@
|
||||
|
||||
static int dlfcn_load(DSO *dso);
|
||||
static int dlfcn_unload(DSO *dso);
|
||||
static void *dlfcn_bind_var(DSO *dso, const char *symname);
|
||||
static DSO_FUNC_TYPE dlfcn_bind_func(DSO *dso, const char *symname);
|
||||
static char *dlfcn_name_converter(DSO *dso, const char *filename);
|
||||
static char *dlfcn_merger(DSO *dso, const char *filespec1,
|
||||
const char *filespec2);
|
||||
static int dlfcn_pathbyaddr(void *addr, char *path, int sz);
|
||||
static void *dlfcn_globallookup(const char *name);
|
||||
|
||||
static DSO_METHOD dso_meth_dlfcn = {
|
||||
"OpenSSL 'dlfcn' shared library method",
|
||||
dlfcn_load,
|
||||
dlfcn_unload,
|
||||
dlfcn_bind_var,
|
||||
dlfcn_bind_func,
|
||||
NULL, /* ctrl */
|
||||
dlfcn_name_converter,
|
||||
dlfcn_merger,
|
||||
NULL, /* init */
|
||||
NULL, /* finish */
|
||||
dlfcn_pathbyaddr,
|
||||
dlfcn_globallookup
|
||||
};
|
||||
|
||||
@ -203,32 +199,6 @@ static int dlfcn_unload(DSO *dso)
|
||||
return (1);
|
||||
}
|
||||
|
||||
static void *dlfcn_bind_var(DSO *dso, const char *symname)
|
||||
{
|
||||
void *ptr, *sym;
|
||||
|
||||
if ((dso == NULL) || (symname == NULL)) {
|
||||
DSOerr(DSO_F_DLFCN_BIND_VAR, ERR_R_PASSED_NULL_PARAMETER);
|
||||
return (NULL);
|
||||
}
|
||||
if (sk_void_num(dso->meth_data) < 1) {
|
||||
DSOerr(DSO_F_DLFCN_BIND_VAR, DSO_R_STACK_ERROR);
|
||||
return (NULL);
|
||||
}
|
||||
ptr = sk_void_value(dso->meth_data, sk_void_num(dso->meth_data) - 1);
|
||||
if (ptr == NULL) {
|
||||
DSOerr(DSO_F_DLFCN_BIND_VAR, DSO_R_NULL_HANDLE);
|
||||
return (NULL);
|
||||
}
|
||||
sym = dlsym(ptr, symname);
|
||||
if (sym == NULL) {
|
||||
DSOerr(DSO_F_DLFCN_BIND_VAR, DSO_R_SYM_FAILURE);
|
||||
ERR_add_error_data(4, "symname(", symname, "): ", dlerror());
|
||||
return (NULL);
|
||||
}
|
||||
return (sym);
|
||||
}
|
||||
|
||||
static DSO_FUNC_TYPE dlfcn_bind_func(DSO *dso, const char *symname)
|
||||
{
|
||||
void *ptr;
|
||||
@ -385,38 +355,6 @@ static int dladdr(void *address, Dl_info *dl)
|
||||
}
|
||||
# endif /* __sgi */
|
||||
|
||||
static int dlfcn_pathbyaddr(void *addr, char *path, int sz)
|
||||
{
|
||||
# ifdef HAVE_DLINFO
|
||||
Dl_info dli;
|
||||
int len;
|
||||
|
||||
if (addr == NULL) {
|
||||
union {
|
||||
int (*f) (void *, char *, int);
|
||||
void *p;
|
||||
} t = {
|
||||
dlfcn_pathbyaddr
|
||||
};
|
||||
addr = t.p;
|
||||
}
|
||||
|
||||
if (dladdr(addr, &dli)) {
|
||||
len = (int)strlen(dli.dli_fname);
|
||||
if (sz <= 0)
|
||||
return len + 1;
|
||||
if (len >= sz)
|
||||
len = sz - 1;
|
||||
memcpy(path, dli.dli_fname, len);
|
||||
path[len++] = 0;
|
||||
return len;
|
||||
}
|
||||
|
||||
ERR_add_error_data(2, "dlfcn_pathbyaddr(): ", dlerror());
|
||||
# endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void *dlfcn_globallookup(const char *name)
|
||||
{
|
||||
void *ret = NULL, *handle = dlopen(NULL, RTLD_LAZY);
|
||||
|
@ -67,53 +67,38 @@
|
||||
# define ERR_REASON(reason) ERR_PACK(ERR_LIB_DSO,0,reason)
|
||||
|
||||
static ERR_STRING_DATA DSO_str_functs[] = {
|
||||
{ERR_FUNC(DSO_F_BEOS_BIND_FUNC), "BEOS_BIND_FUNC"},
|
||||
{ERR_FUNC(DSO_F_BEOS_BIND_VAR), "BEOS_BIND_VAR"},
|
||||
{ERR_FUNC(DSO_F_BEOS_LOAD), "BEOS_LOAD"},
|
||||
{ERR_FUNC(DSO_F_BEOS_NAME_CONVERTER), "BEOS_NAME_CONVERTER"},
|
||||
{ERR_FUNC(DSO_F_BEOS_UNLOAD), "BEOS_UNLOAD"},
|
||||
{ERR_FUNC(DSO_F_DLFCN_BIND_FUNC), "dlfcn_bind_func"},
|
||||
{ERR_FUNC(DSO_F_DLFCN_BIND_VAR), "dlfcn_bind_var"},
|
||||
{ERR_FUNC(DSO_F_DLFCN_LOAD), "dlfcn_load"},
|
||||
{ERR_FUNC(DSO_F_DLFCN_MERGER), "dlfcn_merger"},
|
||||
{ERR_FUNC(DSO_F_DLFCN_NAME_CONVERTER), "dlfcn_name_converter"},
|
||||
{ERR_FUNC(DSO_F_DLFCN_UNLOAD), "dlfcn_unload"},
|
||||
{ERR_FUNC(DSO_F_DL_BIND_FUNC), "dl_bind_func"},
|
||||
{ERR_FUNC(DSO_F_DL_BIND_VAR), "dl_bind_var"},
|
||||
{ERR_FUNC(DSO_F_DL_LOAD), "dl_load"},
|
||||
{ERR_FUNC(DSO_F_DL_MERGER), "dl_merger"},
|
||||
{ERR_FUNC(DSO_F_DL_NAME_CONVERTER), "dl_name_converter"},
|
||||
{ERR_FUNC(DSO_F_DL_UNLOAD), "dl_unload"},
|
||||
{ERR_FUNC(DSO_F_DSO_BIND_FUNC), "DSO_bind_func"},
|
||||
{ERR_FUNC(DSO_F_DSO_BIND_VAR), "DSO_bind_var"},
|
||||
{ERR_FUNC(DSO_F_DSO_CONVERT_FILENAME), "DSO_convert_filename"},
|
||||
{ERR_FUNC(DSO_F_DSO_CTRL), "DSO_ctrl"},
|
||||
{ERR_FUNC(DSO_F_DSO_FREE), "DSO_free"},
|
||||
{ERR_FUNC(DSO_F_DSO_GET_FILENAME), "DSO_get_filename"},
|
||||
{ERR_FUNC(DSO_F_DSO_GET_LOADED_FILENAME), "DSO_get_loaded_filename"},
|
||||
{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_PATHBYADDR), "DSO_pathbyaddr"},
|
||||
{ERR_FUNC(DSO_F_DSO_SET_FILENAME), "DSO_set_filename"},
|
||||
{ERR_FUNC(DSO_F_DSO_SET_NAME_CONVERTER), "DSO_set_name_converter"},
|
||||
{ERR_FUNC(DSO_F_DSO_UP_REF), "DSO_up_ref"},
|
||||
{ERR_FUNC(DSO_F_GLOBAL_LOOKUP_FUNC), "GLOBAL_LOOKUP_FUNC"},
|
||||
{ERR_FUNC(DSO_F_PATHBYADDR), "PATHBYADDR"},
|
||||
{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_BIND_VAR), "win32_bind_var"},
|
||||
{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"},
|
||||
{ERR_FUNC(DSO_F_WIN32_NAME_CONVERTER), "win32_name_converter"},
|
||||
{ERR_FUNC(DSO_F_WIN32_PATHBYADDR), "win32_pathbyaddr"},
|
||||
{ERR_FUNC(DSO_F_WIN32_SPLITTER), "win32_splitter"},
|
||||
{ERR_FUNC(DSO_F_WIN32_UNLOAD), "win32_unload"},
|
||||
{0, NULL}
|
||||
|
@ -60,35 +60,7 @@
|
||||
|
||||
static DSO_METHOD *default_DSO_meth = NULL;
|
||||
|
||||
DSO *DSO_new(void)
|
||||
{
|
||||
return (DSO_new_method(NULL));
|
||||
}
|
||||
|
||||
void DSO_set_default_method(DSO_METHOD *meth)
|
||||
{
|
||||
default_DSO_meth = meth;
|
||||
}
|
||||
|
||||
DSO_METHOD *DSO_get_default_method(void)
|
||||
{
|
||||
return (default_DSO_meth);
|
||||
}
|
||||
|
||||
DSO_METHOD *DSO_get_method(DSO *dso)
|
||||
{
|
||||
return (dso->meth);
|
||||
}
|
||||
|
||||
DSO_METHOD *DSO_set_method(DSO *dso, DSO_METHOD *meth)
|
||||
{
|
||||
DSO_METHOD *mtmp;
|
||||
mtmp = dso->meth;
|
||||
dso->meth = meth;
|
||||
return (mtmp);
|
||||
}
|
||||
|
||||
DSO *DSO_new_method(DSO_METHOD *meth)
|
||||
static DSO *DSO_new_method(DSO_METHOD *meth)
|
||||
{
|
||||
DSO *ret;
|
||||
|
||||
@ -112,12 +84,8 @@ DSO *DSO_new_method(DSO_METHOD *meth)
|
||||
OPENSSL_free(ret);
|
||||
return (NULL);
|
||||
}
|
||||
if (meth == NULL)
|
||||
ret->meth = default_DSO_meth;
|
||||
else
|
||||
ret->meth = meth;
|
||||
ret->meth = default_DSO_meth;
|
||||
ret->references = 1;
|
||||
|
||||
ret->lock = CRYPTO_THREAD_lock_new();
|
||||
if (ret->lock == NULL) {
|
||||
sk_void_free(ret->meth_data);
|
||||
@ -133,6 +101,11 @@ DSO *DSO_new_method(DSO_METHOD *meth)
|
||||
return ret;
|
||||
}
|
||||
|
||||
DSO *DSO_new(void)
|
||||
{
|
||||
return DSO_new_method(NULL);
|
||||
}
|
||||
|
||||
int DSO_free(DSO *dso)
|
||||
{
|
||||
int i;
|
||||
@ -242,26 +215,6 @@ DSO *DSO_load(DSO *dso, const char *filename, DSO_METHOD *meth, int flags)
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
void *DSO_bind_var(DSO *dso, const char *symname)
|
||||
{
|
||||
void *ret = NULL;
|
||||
|
||||
if ((dso == NULL) || (symname == NULL)) {
|
||||
DSOerr(DSO_F_DSO_BIND_VAR, ERR_R_PASSED_NULL_PARAMETER);
|
||||
return (NULL);
|
||||
}
|
||||
if (dso->meth->dso_bind_var == NULL) {
|
||||
DSOerr(DSO_F_DSO_BIND_VAR, DSO_R_UNSUPPORTED);
|
||||
return (NULL);
|
||||
}
|
||||
if ((ret = dso->meth->dso_bind_var(dso, symname)) == NULL) {
|
||||
DSOerr(DSO_F_DSO_BIND_VAR, DSO_R_SYM_FAILURE);
|
||||
return (NULL);
|
||||
}
|
||||
/* Success */
|
||||
return (ret);
|
||||
}
|
||||
|
||||
DSO_FUNC_TYPE DSO_bind_func(DSO *dso, const char *symname)
|
||||
{
|
||||
DSO_FUNC_TYPE ret = NULL;
|
||||
@ -320,19 +273,6 @@ long DSO_ctrl(DSO *dso, int cmd, long larg, void *parg)
|
||||
return (dso->meth->dso_ctrl(dso, cmd, larg, parg));
|
||||
}
|
||||
|
||||
int DSO_set_name_converter(DSO *dso, DSO_NAME_CONVERTER_FUNC cb,
|
||||
DSO_NAME_CONVERTER_FUNC *oldcb)
|
||||
{
|
||||
if (dso == NULL) {
|
||||
DSOerr(DSO_F_DSO_SET_NAME_CONVERTER, ERR_R_PASSED_NULL_PARAMETER);
|
||||
return (0);
|
||||
}
|
||||
if (oldcb)
|
||||
*oldcb = dso->name_converter;
|
||||
dso->name_converter = cb;
|
||||
return (1);
|
||||
}
|
||||
|
||||
const char *DSO_get_filename(DSO *dso)
|
||||
{
|
||||
if (dso == NULL) {
|
||||
@ -412,27 +352,6 @@ char *DSO_convert_filename(DSO *dso, const char *filename)
|
||||
return (result);
|
||||
}
|
||||
|
||||
const char *DSO_get_loaded_filename(DSO *dso)
|
||||
{
|
||||
if (dso == NULL) {
|
||||
DSOerr(DSO_F_DSO_GET_LOADED_FILENAME, ERR_R_PASSED_NULL_PARAMETER);
|
||||
return (NULL);
|
||||
}
|
||||
return (dso->loaded_filename);
|
||||
}
|
||||
|
||||
int DSO_pathbyaddr(void *addr, char *path, int sz)
|
||||
{
|
||||
DSO_METHOD *meth = default_DSO_meth;
|
||||
if (meth == NULL)
|
||||
meth = DSO_METHOD_openssl();
|
||||
if (meth->pathbyaddr == NULL) {
|
||||
DSOerr(DSO_F_DSO_PATHBYADDR, DSO_R_UNSUPPORTED);
|
||||
return -1;
|
||||
}
|
||||
return (*meth->pathbyaddr) (addr, path, sz);
|
||||
}
|
||||
|
||||
void *DSO_global_lookup(const char *name)
|
||||
{
|
||||
DSO_METHOD *meth = default_DSO_meth;
|
||||
|
@ -72,8 +72,6 @@ struct dso_meth_st {
|
||||
int (*dso_load) (DSO *dso);
|
||||
/* Unloads a shared library */
|
||||
int (*dso_unload) (DSO *dso);
|
||||
/* Binds a variable */
|
||||
void *(*dso_bind_var) (DSO *dso, const char *symname);
|
||||
/*
|
||||
* Binds a function - assumes a return type of DSO_FUNC_TYPE. This should
|
||||
* be cast to the real function prototype by the caller. Platforms that
|
||||
@ -100,8 +98,6 @@ 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);
|
||||
};
|
||||
|
@ -84,7 +84,6 @@ void *_malloc32(__size_t);
|
||||
|
||||
static int vms_load(DSO *dso);
|
||||
static int vms_unload(DSO *dso);
|
||||
static void *vms_bind_var(DSO *dso, const char *symname);
|
||||
static DSO_FUNC_TYPE vms_bind_func(DSO *dso, const char *symname);
|
||||
static char *vms_name_converter(DSO *dso, const char *filename);
|
||||
static char *vms_merger(DSO *dso, const char *filespec1,
|
||||
@ -94,7 +93,6 @@ static DSO_METHOD dso_meth_vms = {
|
||||
"OpenSSL 'VMS' shared library method",
|
||||
vms_load,
|
||||
NULL, /* unload */
|
||||
vms_bind_var,
|
||||
vms_bind_func,
|
||||
NULL, /* ctrl */
|
||||
vms_name_converter,
|
||||
@ -404,13 +402,6 @@ void vms_bind_sym(DSO *dso, const char *symname, void **sym)
|
||||
return;
|
||||
}
|
||||
|
||||
static void *vms_bind_var(DSO *dso, const char *symname)
|
||||
{
|
||||
void *sym = 0;
|
||||
vms_bind_sym(dso, symname, &sym);
|
||||
return sym;
|
||||
}
|
||||
|
||||
static DSO_FUNC_TYPE vms_bind_func(DSO *dso, const char *symname)
|
||||
{
|
||||
DSO_FUNC_TYPE sym = 0;
|
||||
|
@ -108,12 +108,10 @@ static HINSTANCE LoadLibraryA(LPCSTR lpLibFileName)
|
||||
|
||||
static int win32_load(DSO *dso);
|
||||
static int win32_unload(DSO *dso);
|
||||
static void *win32_bind_var(DSO *dso, const char *symname);
|
||||
static DSO_FUNC_TYPE win32_bind_func(DSO *dso, const char *symname);
|
||||
static char *win32_name_converter(DSO *dso, const char *filename);
|
||||
static char *win32_merger(DSO *dso, const char *filespec1,
|
||||
const char *filespec2);
|
||||
static int win32_pathbyaddr(void *addr, char *path, int sz);
|
||||
static void *win32_globallookup(const char *name);
|
||||
|
||||
static const char *openssl_strnchr(const char *string, int c, size_t len);
|
||||
@ -122,14 +120,12 @@ static DSO_METHOD dso_meth_win32 = {
|
||||
"OpenSSL 'win32' shared library method",
|
||||
win32_load,
|
||||
win32_unload,
|
||||
win32_bind_var,
|
||||
win32_bind_func,
|
||||
NULL, /* ctrl */
|
||||
win32_name_converter,
|
||||
win32_merger,
|
||||
NULL, /* init */
|
||||
NULL, /* finish */
|
||||
win32_pathbyaddr,
|
||||
win32_globallookup
|
||||
};
|
||||
|
||||
@ -208,40 +204,6 @@ static int win32_unload(DSO *dso)
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Using GetProcAddress for variables? TODO: Check this out in the Win32 API
|
||||
* docs, there's probably a variant for variables.
|
||||
*/
|
||||
static void *win32_bind_var(DSO *dso, const char *symname)
|
||||
{
|
||||
HINSTANCE *ptr;
|
||||
union {
|
||||
void *p;
|
||||
FARPROC f;
|
||||
} sym;
|
||||
|
||||
if ((dso == NULL) || (symname == NULL)) {
|
||||
DSOerr(DSO_F_WIN32_BIND_VAR, ERR_R_PASSED_NULL_PARAMETER);
|
||||
return (NULL);
|
||||
}
|
||||
if (sk_void_num(dso->meth_data) < 1) {
|
||||
DSOerr(DSO_F_WIN32_BIND_VAR, DSO_R_STACK_ERROR);
|
||||
return (NULL);
|
||||
}
|
||||
ptr = sk_void_value(dso->meth_data, sk_void_num(dso->meth_data) - 1);
|
||||
if (ptr == NULL) {
|
||||
DSOerr(DSO_F_WIN32_BIND_VAR, DSO_R_NULL_HANDLE);
|
||||
return (NULL);
|
||||
}
|
||||
sym.f = GetProcAddress(*ptr, symname);
|
||||
if (sym.p == NULL) {
|
||||
DSOerr(DSO_F_WIN32_BIND_VAR, DSO_R_SYM_FAILURE);
|
||||
ERR_add_error_data(3, "symname(", symname, ")");
|
||||
return (NULL);
|
||||
}
|
||||
return (sym.p);
|
||||
}
|
||||
|
||||
static DSO_FUNC_TYPE win32_bind_func(DSO *dso, const char *symname)
|
||||
{
|
||||
HINSTANCE *ptr;
|
||||
@ -593,106 +555,6 @@ typedef HANDLE(WINAPI *CREATETOOLHELP32SNAPSHOT) (DWORD, DWORD);
|
||||
typedef BOOL(WINAPI *CLOSETOOLHELP32SNAPSHOT) (HANDLE);
|
||||
typedef BOOL(WINAPI *MODULE32) (HANDLE, MODULEENTRY32 *);
|
||||
|
||||
static int win32_pathbyaddr(void *addr, char *path, int sz)
|
||||
{
|
||||
HMODULE dll;
|
||||
HANDLE hModuleSnap = INVALID_HANDLE_VALUE;
|
||||
MODULEENTRY32 me32;
|
||||
CREATETOOLHELP32SNAPSHOT create_snap;
|
||||
CLOSETOOLHELP32SNAPSHOT close_snap;
|
||||
MODULE32 module_first, module_next;
|
||||
|
||||
if (addr == NULL) {
|
||||
union {
|
||||
int (*f) (void *, char *, int);
|
||||
void *p;
|
||||
} t = {
|
||||
win32_pathbyaddr
|
||||
};
|
||||
addr = t.p;
|
||||
}
|
||||
|
||||
dll = LoadLibrary(TEXT(DLLNAME));
|
||||
if (dll == NULL) {
|
||||
DSOerr(DSO_F_WIN32_PATHBYADDR, DSO_R_UNSUPPORTED);
|
||||
return -1;
|
||||
}
|
||||
|
||||
create_snap = (CREATETOOLHELP32SNAPSHOT)
|
||||
GetProcAddress(dll, "CreateToolhelp32Snapshot");
|
||||
if (create_snap == NULL) {
|
||||
FreeLibrary(dll);
|
||||
DSOerr(DSO_F_WIN32_PATHBYADDR, DSO_R_UNSUPPORTED);
|
||||
return -1;
|
||||
}
|
||||
/* We take the rest for granted... */
|
||||
# ifdef _WIN32_WCE
|
||||
close_snap = (CLOSETOOLHELP32SNAPSHOT)
|
||||
GetProcAddress(dll, "CloseToolhelp32Snapshot");
|
||||
# else
|
||||
close_snap = (CLOSETOOLHELP32SNAPSHOT) CloseHandle;
|
||||
# endif
|
||||
module_first = (MODULE32) GetProcAddress(dll, "Module32First");
|
||||
module_next = (MODULE32) GetProcAddress(dll, "Module32Next");
|
||||
|
||||
hModuleSnap = (*create_snap) (TH32CS_SNAPMODULE, 0);
|
||||
if (hModuleSnap == INVALID_HANDLE_VALUE) {
|
||||
FreeLibrary(dll);
|
||||
DSOerr(DSO_F_WIN32_PATHBYADDR, DSO_R_UNSUPPORTED);
|
||||
return -1;
|
||||
}
|
||||
|
||||
me32.dwSize = sizeof(me32);
|
||||
|
||||
if (!(*module_first) (hModuleSnap, &me32)) {
|
||||
(*close_snap) (hModuleSnap);
|
||||
FreeLibrary(dll);
|
||||
DSOerr(DSO_F_WIN32_PATHBYADDR, DSO_R_FAILURE);
|
||||
return -1;
|
||||
}
|
||||
|
||||
do {
|
||||
if ((BYTE *) addr >= me32.modBaseAddr &&
|
||||
(BYTE *) addr < me32.modBaseAddr + me32.modBaseSize) {
|
||||
(*close_snap) (hModuleSnap);
|
||||
FreeLibrary(dll);
|
||||
# ifdef _WIN32_WCE
|
||||
# if _WIN32_WCE >= 101
|
||||
return WideCharToMultiByte(CP_ACP, 0, me32.szExePath, -1,
|
||||
path, sz, NULL, NULL);
|
||||
# else
|
||||
{
|
||||
int i, len = (int)wcslen(me32.szExePath);
|
||||
if (sz <= 0)
|
||||
return len + 1;
|
||||
if (len >= sz)
|
||||
len = sz - 1;
|
||||
for (i = 0; i < len; i++)
|
||||
path[i] = (char)me32.szExePath[i];
|
||||
path[len++] = 0;
|
||||
return len;
|
||||
}
|
||||
# endif
|
||||
# else
|
||||
{
|
||||
int len = (int)strlen(me32.szExePath);
|
||||
if (sz <= 0)
|
||||
return len + 1;
|
||||
if (len >= sz)
|
||||
len = sz - 1;
|
||||
memcpy(path, me32.szExePath, len);
|
||||
path[len++] = 0;
|
||||
return len;
|
||||
}
|
||||
# endif
|
||||
}
|
||||
} while ((*module_next) (hModuleSnap, &me32));
|
||||
|
||||
(*close_snap) (hModuleSnap);
|
||||
FreeLibrary(dll);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void *win32_globallookup(const char *name)
|
||||
{
|
||||
HMODULE dll;
|
||||
|
@ -72,15 +72,13 @@ extern "C" {
|
||||
|
||||
/*
|
||||
* By default, DSO_load() will translate the provided filename into a form
|
||||
* typical for the platform (more specifically the DSO_METHOD) 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". The
|
||||
* behaviour can be overriden by setting the name_converter callback in the
|
||||
* DSO object (using DSO_set_name_converter()). 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
|
||||
* 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
|
||||
@ -138,20 +136,11 @@ typedef char *(*DSO_NAME_CONVERTER_FUNC)(DSO *, const char *);
|
||||
typedef char *(*DSO_MERGER_FUNC)(DSO *, const char *, const char *);
|
||||
|
||||
DSO *DSO_new(void);
|
||||
DSO *DSO_new_method(DSO_METHOD *method);
|
||||
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);
|
||||
|
||||
/*
|
||||
* This function sets the DSO's name_converter callback. If it is non-NULL,
|
||||
* then it will be used instead of the associated DSO_METHOD's function. If
|
||||
* oldcb is non-NULL then it is set to the function pointer value being
|
||||
* 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-independent filename
|
||||
* used for a DSO. NB: set will fail if the DSO is already loaded.
|
||||
@ -176,34 +165,16 @@ char *DSO_convert_filename(DSO *dso, const char *filename);
|
||||
* OPENSSL_free()'d.
|
||||
*/
|
||||
char *DSO_merge(DSO *dso, const char *filespec1, const char *filespec2);
|
||||
/*
|
||||
* If the DSO is currently loaded, this returns the filename that it was
|
||||
* loaded under, otherwise it returns NULL. So it is also useful as a test as
|
||||
* to whether the DSO is currently loaded. NB: This will not necessarily
|
||||
* return the same value as DSO_convert_filename(dso, dso->filename), because
|
||||
* the DSO_METHOD's load function may have tried a variety of filenames (with
|
||||
* and/or without the aid of the converters) before settling on the one it
|
||||
* actually loaded.
|
||||
*/
|
||||
const char *DSO_get_loaded_filename(DSO *dso);
|
||||
|
||||
void DSO_set_default_method(DSO_METHOD *meth);
|
||||
DSO_METHOD *DSO_get_default_method(void);
|
||||
DSO_METHOD *DSO_get_method(DSO *dso);
|
||||
DSO_METHOD *DSO_set_method(DSO *dso, DSO_METHOD *meth);
|
||||
|
||||
/*
|
||||
* The all-singing all-dancing load function, you normally pass NULL for the
|
||||
* first and third parameters. Use DSO_up and DSO_free for subsequent
|
||||
* 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 variable inside a shared library. */
|
||||
void *DSO_bind_var(DSO *dso, const char *symname);
|
||||
|
||||
/* This function binds to a function inside a shared library. */
|
||||
DSO_FUNC_TYPE DSO_bind_func(DSO *dso, const char *symname);
|
||||
|
||||
@ -214,17 +185,6 @@ DSO_FUNC_TYPE DSO_bind_func(DSO *dso, const char *symname);
|
||||
*/
|
||||
DSO_METHOD *DSO_METHOD_openssl(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 accommodate 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
|
||||
@ -264,7 +224,6 @@ void ERR_load_DSO_strings(void);
|
||||
# define DSO_F_DL_NAME_CONVERTER 124
|
||||
# define DSO_F_DL_UNLOAD 107
|
||||
# define DSO_F_DSO_BIND_FUNC 108
|
||||
# define DSO_F_DSO_BIND_VAR 109
|
||||
# define DSO_F_DSO_CONVERT_FILENAME 126
|
||||
# define DSO_F_DSO_CTRL 110
|
||||
# define DSO_F_DSO_FREE 111
|
||||
@ -274,12 +233,9 @@ void ERR_load_DSO_strings(void);
|
||||
# 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_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
|
||||
@ -292,7 +248,6 @@ void ERR_load_DSO_strings(void);
|
||||
# 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
|
||||
|
||||
|
@ -355,7 +355,7 @@ ASN1_SEQUENCE_it 348 1_1_0 EXIST:!EXPORT_VAR_AS_FUNCTION:
|
||||
ASN1_SEQUENCE_it 348 1_1_0 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
|
||||
TS_RESP_CTX_get_tst_info 349 1_1_0 EXIST::FUNCTION:TS
|
||||
RC4 350 1_1_0 EXIST::FUNCTION:RC4
|
||||
DSO_get_loaded_filename 351 1_1_0 EXIST::FUNCTION:
|
||||
DSO_get_loaded_filename 351 1_1_0 NOEXIST::FUNCTION:
|
||||
PKCS7_stream 352 1_1_0 EXIST::FUNCTION:
|
||||
i2t_ASN1_OBJECT 353 1_1_0 EXIST::FUNCTION:
|
||||
EC_GROUP_get0_generator 354 1_1_0 EXIST::FUNCTION:EC
|
||||
@ -812,7 +812,7 @@ CRYPTO_ocb128_encrypt 791 1_1_0 EXIST::FUNCTION:OCB
|
||||
EXTENDED_KEY_USAGE_new 792 1_1_0 EXIST::FUNCTION:
|
||||
EVP_EncryptFinal 793 1_1_0 EXIST::FUNCTION:
|
||||
PEM_write_ECPrivateKey 794 1_1_0 EXIST::FUNCTION:EC
|
||||
DSO_bind_var 795 1_1_0 EXIST::FUNCTION:
|
||||
DSO_bind_var 795 1_1_0 NOEXIST::FUNCTION:
|
||||
EVP_CIPHER_meth_set_get_asn1_params 796 1_1_0 EXIST::FUNCTION:
|
||||
PKCS7_dataInit 797 1_1_0 EXIST::FUNCTION:
|
||||
EVP_PKEY_CTX_set_app_data 798 1_1_0 EXIST::FUNCTION:
|
||||
@ -869,7 +869,7 @@ DES_ecb_encrypt 846 1_1_0 EXIST::FUNCTION:DES
|
||||
EVP_camellia_256_ecb 847 1_1_0 EXIST::FUNCTION:CAMELLIA
|
||||
PEM_read_RSA_PUBKEY 848 1_1_0 EXIST::FUNCTION:RSA
|
||||
d2i_NETSCAPE_SPKAC 849 1_1_0 EXIST::FUNCTION:
|
||||
DSO_set_default_method 850 1_1_0 EXIST::FUNCTION:
|
||||
DSO_set_default_method 850 1_1_0 NOEXIST::FUNCTION:
|
||||
ASN1_TIME_check 851 1_1_0 EXIST::FUNCTION:
|
||||
PKCS7_DIGEST_new 852 1_1_0 EXIST::FUNCTION:
|
||||
i2d_TS_TST_INFO_fp 853 1_1_0 EXIST::FUNCTION:STDIO,TS
|
||||
@ -1398,7 +1398,7 @@ i2v_GENERAL_NAME 1355 1_1_0 EXIST::FUNCTION:
|
||||
PKCS7_ENC_CONTENT_new 1356 1_1_0 EXIST::FUNCTION:
|
||||
CRYPTO_realloc 1357 1_1_0 EXIST::FUNCTION:
|
||||
BIO_ctrl_pending 1358 1_1_0 EXIST::FUNCTION:
|
||||
DSO_set_method 1359 1_1_0 EXIST::FUNCTION:
|
||||
DSO_set_method 1359 1_1_0 NOEXIST::FUNCTION:
|
||||
EVP_MD_meth_new 1360 1_1_0 EXIST::FUNCTION:
|
||||
X509_sign_ctx 1361 1_1_0 EXIST::FUNCTION:
|
||||
BN_is_odd 1362 1_1_0 EXIST::FUNCTION:
|
||||
@ -1433,7 +1433,7 @@ EVP_PKEY_meth_set_cleanup 1388 1_1_0 EXIST::FUNCTION:
|
||||
PROXY_CERT_INFO_EXTENSION_free 1389 1_1_0 EXIST::FUNCTION:
|
||||
X509_dup 1390 1_1_0 EXIST::FUNCTION:
|
||||
EDIPARTYNAME_free 1391 1_1_0 EXIST::FUNCTION:
|
||||
DSO_new_method 1392 1_1_0 EXIST::FUNCTION:
|
||||
DSO_new_method 1392 1_1_0 NOEXIST::FUNCTION:
|
||||
X509_CRL_add0_revoked 1393 1_1_0 EXIST::FUNCTION:
|
||||
GENERAL_NAME_set0_value 1394 1_1_0 EXIST::FUNCTION:
|
||||
X509_ATTRIBUTE_dup 1395 1_1_0 EXIST::FUNCTION:
|
||||
@ -2492,7 +2492,7 @@ EVP_MD_CTX_md_data 2412 1_1_0 EXIST::FUNCTION:
|
||||
ASN1_PCTX_set_nm_flags 2413 1_1_0 EXIST::FUNCTION:
|
||||
BIO_ctrl 2414 1_1_0 EXIST::FUNCTION:
|
||||
X509_CRL_set_default_method 2415 1_1_0 EXIST::FUNCTION:
|
||||
DSO_pathbyaddr 2416 1_1_0 EXIST::FUNCTION:
|
||||
DSO_pathbyaddr 2416 1_1_0 NOEXIST::FUNCTION:
|
||||
d2i_RSAPublicKey_fp 2417 1_1_0 EXIST::FUNCTION:RSA,STDIO
|
||||
UI_method_get_flusher 2418 1_1_0 EXIST::FUNCTION:
|
||||
EC_POINT_dbl 2419 1_1_0 EXIST::FUNCTION:EC
|
||||
@ -3046,7 +3046,7 @@ EC_GROUP_get_curve_GFp 2940 1_1_0 EXIST::FUNCTION:EC
|
||||
ASYNC_block_pause 2941 1_1_0 EXIST::FUNCTION:
|
||||
OCSP_SINGLERESP_get_ext 2942 1_1_0 EXIST::FUNCTION:
|
||||
CRYPTO_strdup 2943 1_1_0 EXIST::FUNCTION:
|
||||
DSO_get_default_method 2944 1_1_0 EXIST::FUNCTION:
|
||||
DSO_get_default_method 2944 1_1_0 NOEXIST::FUNCTION:
|
||||
i2d_X509_CRL_bio 2945 1_1_0 EXIST::FUNCTION:
|
||||
EVP_PKEY_asn1_set_item 2946 1_1_0 EXIST::FUNCTION:
|
||||
CRYPTO_ccm128_encrypt 2947 1_1_0 EXIST::FUNCTION:
|
||||
@ -3438,7 +3438,7 @@ CTLOG_free 3325 1_1_0 EXIST::FUNCTION:CT
|
||||
EVP_CIPHER_meth_dup 3326 1_1_0 EXIST::FUNCTION:
|
||||
CMS_get1_crls 3327 1_1_0 EXIST::FUNCTION:CMS
|
||||
X509_aux_print 3328 1_1_0 EXIST::FUNCTION:
|
||||
DSO_set_name_converter 3329 1_1_0 EXIST::FUNCTION:
|
||||
DSO_set_name_converter 3329 1_1_0 NOEXIST::FUNCTION:
|
||||
OPENSSL_thread_stop 3330 1_1_0 EXIST::FUNCTION:
|
||||
X509_policy_node_get0_parent 3331 1_1_0 EXIST::FUNCTION:
|
||||
X509_PKEY_free 3332 1_1_0 EXIST::FUNCTION:
|
||||
@ -4002,7 +4002,7 @@ BN_bn2mpi 3872 1_1_0 EXIST::FUNCTION:
|
||||
X509_STORE_CTX_cleanup 3873 1_1_0 EXIST::FUNCTION:
|
||||
OCSP_onereq_get0_id 3874 1_1_0 EXIST::FUNCTION:
|
||||
X509_get_default_cert_dir 3875 1_1_0 EXIST::FUNCTION:
|
||||
DSO_get_method 3876 1_1_0 EXIST::FUNCTION:
|
||||
DSO_get_method 3876 1_1_0 NOEXIST::FUNCTION:
|
||||
PROXY_POLICY_free 3877 1_1_0 EXIST::FUNCTION:
|
||||
PEM_write_DSAPrivateKey 3878 1_1_0 EXIST::FUNCTION:DSA
|
||||
sk_delete_ptr 3879 1_1_0 EXIST::FUNCTION:
|
||||
|
Loading…
x
Reference in New Issue
Block a user