diff options
author | Richard Levitte <levitte@openssl.org> | 2020-11-04 12:23:19 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2020-11-13 09:35:02 +0100 |
commit | 9311d0c471ca2eaa259e8c1bbbeb7c46394c7ba2 (patch) | |
tree | e82c26569e5a952980e65a746af920beed602aab /crypto/dso | |
parent | 31a6b52f6db009c639c67387a707dd235f29a430 (diff) |
Convert all {NAME}err() in crypto/ to their corresponding ERR_raise() call
This includes error reporting for libcrypto sub-libraries in surprising
places.
This was done using util/err-to-raise
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13318)
Diffstat (limited to 'crypto/dso')
-rw-r--r-- | crypto/dso/dso_dl.c | 28 | ||||
-rw-r--r-- | crypto/dso/dso_dlfcn.c | 28 | ||||
-rw-r--r-- | crypto/dso/dso_lib.c | 56 | ||||
-rw-r--r-- | crypto/dso/dso_vms.c | 24 | ||||
-rw-r--r-- | crypto/dso/dso_win32.c | 60 |
5 files changed, 98 insertions, 98 deletions
diff --git a/crypto/dso/dso_dl.c b/crypto/dso/dso_dl.c index 5469789345..721fb14c83 100644 --- a/crypto/dso/dso_dl.c +++ b/crypto/dso/dso_dl.c @@ -61,7 +61,7 @@ static int dl_load(DSO *dso) char *filename = DSO_convert_filename(dso, NULL); if (filename == NULL) { - DSOerr(DSO_F_DL_LOAD, DSO_R_NO_FILENAME); + ERR_raise(ERR_LIB_DSO, DSO_R_NO_FILENAME); goto err; } ptr = shl_load(filename, BIND_IMMEDIATE | @@ -69,13 +69,13 @@ static int dl_load(DSO *dso) DYNAMIC_PATH), 0L); if (ptr == NULL) { char errbuf[160]; - DSOerr(DSO_F_DL_LOAD, DSO_R_LOAD_FAILED); + ERR_raise(ERR_LIB_DSO, DSO_R_LOAD_FAILED); if (openssl_strerror_r(errno, errbuf, sizeof(errbuf))) ERR_add_error_data(4, "filename(", filename, "): ", errbuf); goto err; } if (!sk_push(dso->meth_data, (char *)ptr)) { - DSOerr(DSO_F_DL_LOAD, DSO_R_STACK_ERROR); + ERR_raise(ERR_LIB_DSO, DSO_R_STACK_ERROR); goto err; } /* @@ -96,7 +96,7 @@ static int dl_unload(DSO *dso) { shl_t ptr; if (dso == NULL) { - DSOerr(DSO_F_DL_UNLOAD, ERR_R_PASSED_NULL_PARAMETER); + ERR_raise(ERR_LIB_DSO, ERR_R_PASSED_NULL_PARAMETER); return 0; } if (sk_num(dso->meth_data) < 1) @@ -104,7 +104,7 @@ static int dl_unload(DSO *dso) /* Is this statement legal? */ ptr = (shl_t) sk_pop(dso->meth_data); if (ptr == NULL) { - DSOerr(DSO_F_DL_UNLOAD, DSO_R_NULL_HANDLE); + ERR_raise(ERR_LIB_DSO, DSO_R_NULL_HANDLE); /* * Should push the value back onto the stack in case of a retry. */ @@ -121,21 +121,21 @@ static DSO_FUNC_TYPE dl_bind_func(DSO *dso, const char *symname) void *sym; if ((dso == NULL) || (symname == NULL)) { - DSOerr(DSO_F_DL_BIND_FUNC, ERR_R_PASSED_NULL_PARAMETER); + ERR_raise(ERR_LIB_DSO, ERR_R_PASSED_NULL_PARAMETER); return NULL; } if (sk_num(dso->meth_data) < 1) { - DSOerr(DSO_F_DL_BIND_FUNC, DSO_R_STACK_ERROR); + ERR_raise(ERR_LIB_DSO, 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_FUNC, DSO_R_NULL_HANDLE); + ERR_raise(ERR_LIB_DSO, DSO_R_NULL_HANDLE); return NULL; } if (shl_findsym(&ptr, symname, TYPE_UNDEFINED, &sym) < 0) { char errbuf[160]; - DSOerr(DSO_F_DL_BIND_FUNC, DSO_R_SYM_FAILURE); + ERR_raise(ERR_LIB_DSO, DSO_R_SYM_FAILURE); if (openssl_strerror_r(errno, errbuf, sizeof(errbuf))) ERR_add_error_data(4, "symname(", symname, "): ", errbuf); return NULL; @@ -148,7 +148,7 @@ static char *dl_merger(DSO *dso, const char *filespec1, const char *filespec2) char *merged; if (!filespec1 && !filespec2) { - DSOerr(DSO_F_DL_MERGER, ERR_R_PASSED_NULL_PARAMETER); + ERR_raise(ERR_LIB_DSO, ERR_R_PASSED_NULL_PARAMETER); return NULL; } /* @@ -158,7 +158,7 @@ static char *dl_merger(DSO *dso, const char *filespec1, const char *filespec2) if (!filespec2 || filespec1[0] == '/') { merged = OPENSSL_strdup(filespec1); if (merged == NULL) { - DSOerr(DSO_F_DL_MERGER, ERR_R_MALLOC_FAILURE); + ERR_raise(ERR_LIB_DSO, ERR_R_MALLOC_FAILURE); return NULL; } } @@ -168,7 +168,7 @@ static char *dl_merger(DSO *dso, const char *filespec1, const char *filespec2) else if (!filespec1) { merged = OPENSSL_strdup(filespec2); if (merged == NULL) { - DSOerr(DSO_F_DL_MERGER, ERR_R_MALLOC_FAILURE); + ERR_raise(ERR_LIB_DSO, ERR_R_MALLOC_FAILURE); return NULL; } } else @@ -191,7 +191,7 @@ static char *dl_merger(DSO *dso, const char *filespec1, const char *filespec2) } merged = OPENSSL_malloc(len + 2); if (merged == NULL) { - DSOerr(DSO_F_DL_MERGER, ERR_R_MALLOC_FAILURE); + ERR_raise(ERR_LIB_DSO, ERR_R_MALLOC_FAILURE); return NULL; } strcpy(merged, filespec2); @@ -224,7 +224,7 @@ static char *dl_name_converter(DSO *dso, const char *filename) } translated = OPENSSL_malloc(rsize); if (translated == NULL) { - DSOerr(DSO_F_DL_NAME_CONVERTER, DSO_R_NAME_TRANSLATION_FAILED); + ERR_raise(ERR_LIB_DSO, DSO_R_NAME_TRANSLATION_FAILED); return NULL; } if (transform) { diff --git a/crypto/dso/dso_dlfcn.c b/crypto/dso/dso_dlfcn.c index b34984b919..4137d7d9f8 100644 --- a/crypto/dso/dso_dlfcn.c +++ b/crypto/dso/dso_dlfcn.c @@ -102,7 +102,7 @@ static int dlfcn_load(DSO *dso) int saveerrno = get_last_sys_error(); if (filename == NULL) { - DSOerr(DSO_F_DLFCN_LOAD, DSO_R_NO_FILENAME); + ERR_raise(ERR_LIB_DSO, DSO_R_NO_FILENAME); goto err; } # ifdef RTLD_GLOBAL @@ -115,7 +115,7 @@ static int dlfcn_load(DSO *dso) # endif ptr = dlopen(filename, flags); if (ptr == NULL) { - DSOerr(DSO_F_DLFCN_LOAD, DSO_R_LOAD_FAILED); + ERR_raise(ERR_LIB_DSO, DSO_R_LOAD_FAILED); ERR_add_error_data(4, "filename(", filename, "): ", dlerror()); goto err; } @@ -125,7 +125,7 @@ static int dlfcn_load(DSO *dso) */ set_sys_error(saveerrno); if (!sk_void_push(dso->meth_data, (char *)ptr)) { - DSOerr(DSO_F_DLFCN_LOAD, DSO_R_STACK_ERROR); + ERR_raise(ERR_LIB_DSO, DSO_R_STACK_ERROR); goto err; } /* Success */ @@ -143,14 +143,14 @@ static int dlfcn_unload(DSO *dso) { void *ptr; if (dso == NULL) { - DSOerr(DSO_F_DLFCN_UNLOAD, ERR_R_PASSED_NULL_PARAMETER); + ERR_raise(ERR_LIB_DSO, ERR_R_PASSED_NULL_PARAMETER); return 0; } if (sk_void_num(dso->meth_data) < 1) return 1; ptr = sk_void_pop(dso->meth_data); if (ptr == NULL) { - DSOerr(DSO_F_DLFCN_UNLOAD, DSO_R_NULL_HANDLE); + ERR_raise(ERR_LIB_DSO, DSO_R_NULL_HANDLE); /* * Should push the value back onto the stack in case of a retry. */ @@ -171,21 +171,21 @@ static DSO_FUNC_TYPE dlfcn_bind_func(DSO *dso, const char *symname) } u; if ((dso == NULL) || (symname == NULL)) { - DSOerr(DSO_F_DLFCN_BIND_FUNC, ERR_R_PASSED_NULL_PARAMETER); + ERR_raise(ERR_LIB_DSO, ERR_R_PASSED_NULL_PARAMETER); return NULL; } if (sk_void_num(dso->meth_data) < 1) { - DSOerr(DSO_F_DLFCN_BIND_FUNC, DSO_R_STACK_ERROR); + ERR_raise(ERR_LIB_DSO, 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_FUNC, DSO_R_NULL_HANDLE); + ERR_raise(ERR_LIB_DSO, DSO_R_NULL_HANDLE); return NULL; } u.dlret = dlsym(ptr, symname); if (u.dlret == NULL) { - DSOerr(DSO_F_DLFCN_BIND_FUNC, DSO_R_SYM_FAILURE); + ERR_raise(ERR_LIB_DSO, DSO_R_SYM_FAILURE); ERR_add_error_data(4, "symname(", symname, "): ", dlerror()); return NULL; } @@ -198,7 +198,7 @@ static char *dlfcn_merger(DSO *dso, const char *filespec1, char *merged; if (!filespec1 && !filespec2) { - DSOerr(DSO_F_DLFCN_MERGER, ERR_R_PASSED_NULL_PARAMETER); + ERR_raise(ERR_LIB_DSO, ERR_R_PASSED_NULL_PARAMETER); return NULL; } /* @@ -208,7 +208,7 @@ static char *dlfcn_merger(DSO *dso, const char *filespec1, if (!filespec2 || (filespec1 != NULL && filespec1[0] == '/')) { merged = OPENSSL_strdup(filespec1); if (merged == NULL) { - DSOerr(DSO_F_DLFCN_MERGER, ERR_R_MALLOC_FAILURE); + ERR_raise(ERR_LIB_DSO, ERR_R_MALLOC_FAILURE); return NULL; } } @@ -218,7 +218,7 @@ static char *dlfcn_merger(DSO *dso, const char *filespec1, else if (!filespec1) { merged = OPENSSL_strdup(filespec2); if (merged == NULL) { - DSOerr(DSO_F_DLFCN_MERGER, ERR_R_MALLOC_FAILURE); + ERR_raise(ERR_LIB_DSO, ERR_R_MALLOC_FAILURE); return NULL; } } else { @@ -240,7 +240,7 @@ static char *dlfcn_merger(DSO *dso, const char *filespec1, } merged = OPENSSL_malloc(len + 2); if (merged == NULL) { - DSOerr(DSO_F_DLFCN_MERGER, ERR_R_MALLOC_FAILURE); + ERR_raise(ERR_LIB_DSO, ERR_R_MALLOC_FAILURE); return NULL; } strcpy(merged, filespec2); @@ -266,7 +266,7 @@ static char *dlfcn_name_converter(DSO *dso, const char *filename) } translated = OPENSSL_malloc(rsize); if (translated == NULL) { - DSOerr(DSO_F_DLFCN_NAME_CONVERTER, DSO_R_NAME_TRANSLATION_FAILED); + ERR_raise(ERR_LIB_DSO, DSO_R_NAME_TRANSLATION_FAILED); return NULL; } if (transform) { diff --git a/crypto/dso/dso_lib.c b/crypto/dso/dso_lib.c index 6e2b8d944d..4850e96a4b 100644 --- a/crypto/dso/dso_lib.c +++ b/crypto/dso/dso_lib.c @@ -26,13 +26,13 @@ static DSO *DSO_new_method(DSO_METHOD *meth) } ret = OPENSSL_zalloc(sizeof(*ret)); if (ret == NULL) { - DSOerr(DSO_F_DSO_NEW_METHOD, ERR_R_MALLOC_FAILURE); + ERR_raise(ERR_LIB_DSO, ERR_R_MALLOC_FAILURE); return NULL; } ret->meth_data = sk_void_new_null(); if (ret->meth_data == NULL) { /* sk_new doesn't generate any errors so we do */ - DSOerr(DSO_F_DSO_NEW_METHOD, ERR_R_MALLOC_FAILURE); + ERR_raise(ERR_LIB_DSO, ERR_R_MALLOC_FAILURE); OPENSSL_free(ret); return NULL; } @@ -40,7 +40,7 @@ static DSO *DSO_new_method(DSO_METHOD *meth) ret->references = 1; ret->lock = CRYPTO_THREAD_lock_new(); if (ret->lock == NULL) { - DSOerr(DSO_F_DSO_NEW_METHOD, ERR_R_MALLOC_FAILURE); + ERR_raise(ERR_LIB_DSO, ERR_R_MALLOC_FAILURE); sk_void_free(ret->meth_data); OPENSSL_free(ret); return NULL; @@ -76,13 +76,13 @@ int DSO_free(DSO *dso) if ((dso->flags & DSO_FLAG_NO_UNLOAD_ON_FREE) == 0) { if ((dso->meth->dso_unload != NULL) && !dso->meth->dso_unload(dso)) { - DSOerr(DSO_F_DSO_FREE, DSO_R_UNLOAD_FAILED); + ERR_raise(ERR_LIB_DSO, DSO_R_UNLOAD_FAILED); return 0; } } if ((dso->meth->finish != NULL) && !dso->meth->finish(dso)) { - DSOerr(DSO_F_DSO_FREE, DSO_R_FINISH_FAILED); + ERR_raise(ERR_LIB_DSO, DSO_R_FINISH_FAILED); return 0; } @@ -104,7 +104,7 @@ int DSO_up_ref(DSO *dso) int i; if (dso == NULL) { - DSOerr(DSO_F_DSO_UP_REF, ERR_R_PASSED_NULL_PARAMETER); + ERR_raise(ERR_LIB_DSO, ERR_R_PASSED_NULL_PARAMETER); return 0; } @@ -124,20 +124,20 @@ DSO *DSO_load(DSO *dso, const char *filename, DSO_METHOD *meth, int flags) if (dso == NULL) { ret = DSO_new_method(meth); if (ret == NULL) { - DSOerr(DSO_F_DSO_LOAD, ERR_R_MALLOC_FAILURE); + ERR_raise(ERR_LIB_DSO, ERR_R_MALLOC_FAILURE); goto err; } allocated = 1; /* Pass the provided flags to the new DSO object */ if (DSO_ctrl(ret, DSO_CTRL_SET_FLAGS, flags, NULL) < 0) { - DSOerr(DSO_F_DSO_LOAD, DSO_R_CTRL_FAILED); + ERR_raise(ERR_LIB_DSO, DSO_R_CTRL_FAILED); goto err; } } else ret = dso; /* Don't load if we're currently already loaded */ if (ret->filename != NULL) { - DSOerr(DSO_F_DSO_LOAD, DSO_R_DSO_ALREADY_LOADED); + ERR_raise(ERR_LIB_DSO, DSO_R_DSO_ALREADY_LOADED); goto err; } /* @@ -146,20 +146,20 @@ DSO *DSO_load(DSO *dso, const char *filename, DSO_METHOD *meth, int flags) */ if (filename != NULL) if (!DSO_set_filename(ret, filename)) { - DSOerr(DSO_F_DSO_LOAD, DSO_R_SET_FILENAME_FAILED); + ERR_raise(ERR_LIB_DSO, DSO_R_SET_FILENAME_FAILED); goto err; } filename = ret->filename; if (filename == NULL) { - DSOerr(DSO_F_DSO_LOAD, DSO_R_NO_FILENAME); + ERR_raise(ERR_LIB_DSO, DSO_R_NO_FILENAME); goto err; } if (ret->meth->dso_load == NULL) { - DSOerr(DSO_F_DSO_LOAD, DSO_R_UNSUPPORTED); + ERR_raise(ERR_LIB_DSO, DSO_R_UNSUPPORTED); goto err; } if (!ret->meth->dso_load(ret)) { - DSOerr(DSO_F_DSO_LOAD, DSO_R_LOAD_FAILED); + ERR_raise(ERR_LIB_DSO, DSO_R_LOAD_FAILED); goto err; } /* Load succeeded */ @@ -175,15 +175,15 @@ DSO_FUNC_TYPE DSO_bind_func(DSO *dso, const char *symname) DSO_FUNC_TYPE ret = NULL; if ((dso == NULL) || (symname == NULL)) { - DSOerr(DSO_F_DSO_BIND_FUNC, ERR_R_PASSED_NULL_PARAMETER); + ERR_raise(ERR_LIB_DSO, ERR_R_PASSED_NULL_PARAMETER); return NULL; } if (dso->meth->dso_bind_func == NULL) { - DSOerr(DSO_F_DSO_BIND_FUNC, DSO_R_UNSUPPORTED); + ERR_raise(ERR_LIB_DSO, DSO_R_UNSUPPORTED); return NULL; } if ((ret = dso->meth->dso_bind_func(dso, symname)) == NULL) { - DSOerr(DSO_F_DSO_BIND_FUNC, DSO_R_SYM_FAILURE); + ERR_raise(ERR_LIB_DSO, DSO_R_SYM_FAILURE); return NULL; } /* Success */ @@ -202,7 +202,7 @@ DSO_FUNC_TYPE DSO_bind_func(DSO *dso, const char *symname) long DSO_ctrl(DSO *dso, int cmd, long larg, void *parg) { if (dso == NULL) { - DSOerr(DSO_F_DSO_CTRL, ERR_R_PASSED_NULL_PARAMETER); + ERR_raise(ERR_LIB_DSO, ERR_R_PASSED_NULL_PARAMETER); return -1; } /* @@ -222,7 +222,7 @@ long DSO_ctrl(DSO *dso, int cmd, long larg, void *parg) break; } if ((dso->meth == NULL) || (dso->meth->dso_ctrl == NULL)) { - DSOerr(DSO_F_DSO_CTRL, DSO_R_UNSUPPORTED); + ERR_raise(ERR_LIB_DSO, DSO_R_UNSUPPORTED); return -1; } return dso->meth->dso_ctrl(dso, cmd, larg, parg); @@ -231,7 +231,7 @@ long DSO_ctrl(DSO *dso, int cmd, long larg, void *parg) const char *DSO_get_filename(DSO *dso) { if (dso == NULL) { - DSOerr(DSO_F_DSO_GET_FILENAME, ERR_R_PASSED_NULL_PARAMETER); + ERR_raise(ERR_LIB_DSO, ERR_R_PASSED_NULL_PARAMETER); return NULL; } return dso->filename; @@ -242,17 +242,17 @@ int DSO_set_filename(DSO *dso, const char *filename) char *copied; if ((dso == NULL) || (filename == NULL)) { - DSOerr(DSO_F_DSO_SET_FILENAME, ERR_R_PASSED_NULL_PARAMETER); + ERR_raise(ERR_LIB_DSO, ERR_R_PASSED_NULL_PARAMETER); return 0; } if (dso->loaded_filename) { - DSOerr(DSO_F_DSO_SET_FILENAME, DSO_R_DSO_ALREADY_LOADED); + ERR_raise(ERR_LIB_DSO, DSO_R_DSO_ALREADY_LOADED); return 0; } /* We'll duplicate filename */ copied = OPENSSL_strdup(filename); if (copied == NULL) { - DSOerr(DSO_F_DSO_SET_FILENAME, ERR_R_MALLOC_FAILURE); + ERR_raise(ERR_LIB_DSO, ERR_R_MALLOC_FAILURE); return 0; } OPENSSL_free(dso->filename); @@ -265,7 +265,7 @@ char *DSO_merge(DSO *dso, const char *filespec1, const char *filespec2) char *result = NULL; if (dso == NULL || filespec1 == NULL) { - DSOerr(DSO_F_DSO_MERGE, ERR_R_PASSED_NULL_PARAMETER); + ERR_raise(ERR_LIB_DSO, ERR_R_PASSED_NULL_PARAMETER); return NULL; } if ((dso->flags & DSO_FLAG_NO_NAME_TRANSLATION) == 0) { @@ -282,13 +282,13 @@ char *DSO_convert_filename(DSO *dso, const char *filename) char *result = NULL; if (dso == NULL) { - DSOerr(DSO_F_DSO_CONVERT_FILENAME, ERR_R_PASSED_NULL_PARAMETER); + ERR_raise(ERR_LIB_DSO, ERR_R_PASSED_NULL_PARAMETER); return NULL; } if (filename == NULL) filename = dso->filename; if (filename == NULL) { - DSOerr(DSO_F_DSO_CONVERT_FILENAME, DSO_R_NO_FILENAME); + ERR_raise(ERR_LIB_DSO, DSO_R_NO_FILENAME); return NULL; } if ((dso->flags & DSO_FLAG_NO_NAME_TRANSLATION) == 0) { @@ -300,7 +300,7 @@ char *DSO_convert_filename(DSO *dso, const char *filename) if (result == NULL) { result = OPENSSL_strdup(filename); if (result == NULL) { - DSOerr(DSO_F_DSO_CONVERT_FILENAME, ERR_R_MALLOC_FAILURE); + ERR_raise(ERR_LIB_DSO, ERR_R_MALLOC_FAILURE); return NULL; } } @@ -313,7 +313,7 @@ int DSO_pathbyaddr(void *addr, char *path, int sz) if (meth == NULL) meth = DSO_METHOD_openssl(); if (meth->pathbyaddr == NULL) { - DSOerr(DSO_F_DSO_PATHBYADDR, DSO_R_UNSUPPORTED); + ERR_raise(ERR_LIB_DSO, DSO_R_UNSUPPORTED); return -1; } return (*meth->pathbyaddr) (addr, path, sz); @@ -343,7 +343,7 @@ void *DSO_global_lookup(const char *name) if (meth == NULL) meth = DSO_METHOD_openssl(); if (meth->globallookup == NULL) { - DSOerr(DSO_F_DSO_GLOBAL_LOOKUP, DSO_R_UNSUPPORTED); + ERR_raise(ERR_LIB_DSO, DSO_R_UNSUPPORTED); return NULL; } return (*meth->globallookup) (name); diff --git a/crypto/dso/dso_vms.c b/crypto/dso/dso_vms.c index d1993ceb4a..90b94992b4 100644 --- a/crypto/dso/dso_vms.c +++ b/crypto/dso/dso_vms.c @@ -106,7 +106,7 @@ static int vms_load(DSO *dso) const char *ext = NULL; /* possible extension to add */ if (filename == NULL) { - DSOerr(DSO_F_VMS_LOAD, DSO_R_NO_FILENAME); + ERR_raise(ERR_LIB_DSO, DSO_R_NO_FILENAME); goto err; } @@ -169,13 +169,13 @@ static int vms_load(DSO *dso) /* Check that we won't get buffer overflows */ if (sp2 - sp1 > FILENAME_MAX || (sp1 - filename) + strlen(sp2) > FILENAME_MAX) { - DSOerr(DSO_F_VMS_LOAD, DSO_R_FILENAME_TOO_BIG); + ERR_raise(ERR_LIB_DSO, DSO_R_FILENAME_TOO_BIG); goto err; } p = DSO_MALLOC(sizeof(*p)); if (p == NULL) { - DSOerr(DSO_F_VMS_LOAD, ERR_R_MALLOC_FAILURE); + ERR_raise(ERR_LIB_DSO, ERR_R_MALLOC_FAILURE); goto err; } @@ -201,7 +201,7 @@ static int vms_load(DSO *dso) p->imagename_dsc.dsc$a_pointer = p->imagename; if (!sk_void_push(dso->meth_data, (char *)p)) { - DSOerr(DSO_F_VMS_LOAD, DSO_R_STACK_ERROR); + ERR_raise(ERR_LIB_DSO, DSO_R_STACK_ERROR); goto err; } @@ -224,14 +224,14 @@ static int vms_unload(DSO *dso) { DSO_VMS_INTERNAL *p; if (dso == NULL) { - DSOerr(DSO_F_VMS_UNLOAD, ERR_R_PASSED_NULL_PARAMETER); + ERR_raise(ERR_LIB_DSO, ERR_R_PASSED_NULL_PARAMETER); return 0; } if (sk_void_num(dso->meth_data) < 1) return 1; p = (DSO_VMS_INTERNAL *)sk_void_pop(dso->meth_data); if (p == NULL) { - DSOerr(DSO_F_VMS_UNLOAD, DSO_R_NULL_HANDLE); + ERR_raise(ERR_LIB_DSO, DSO_R_NULL_HANDLE); return 0; } /* Cleanup */ @@ -287,7 +287,7 @@ void vms_bind_sym(DSO *dso, const char *symname, void **sym) *sym = NULL; if ((dso == NULL) || (symname == NULL)) { - DSOerr(DSO_F_VMS_BIND_SYM, ERR_R_PASSED_NULL_PARAMETER); + ERR_raise(ERR_LIB_DSO, ERR_R_PASSED_NULL_PARAMETER); return; } # if __INITIAL_POINTER_SIZE == 64 @@ -302,13 +302,13 @@ void vms_bind_sym(DSO *dso, const char *symname, void **sym) symname_dsc.dsc$a_pointer = SYMNAME; if (sk_void_num(dso->meth_data) < 1) { - DSOerr(DSO_F_VMS_BIND_SYM, DSO_R_STACK_ERROR); + ERR_raise(ERR_LIB_DSO, DSO_R_STACK_ERROR); return; } ptr = (DSO_VMS_INTERNAL *)sk_void_value(dso->meth_data, sk_void_num(dso->meth_data) - 1); if (ptr == NULL) { - DSOerr(DSO_F_VMS_BIND_SYM, DSO_R_NULL_HANDLE); + ERR_raise(ERR_LIB_DSO, DSO_R_NULL_HANDLE); return; } @@ -336,7 +336,7 @@ void vms_bind_sym(DSO *dso, const char *symname, void **sym) else { errstring[length] = '\0'; - DSOerr(DSO_F_VMS_BIND_SYM, DSO_R_SYM_FAILURE); + ERR_raise(ERR_LIB_DSO, DSO_R_SYM_FAILURE); if (ptr->imagename_dsc.dsc$w_length) ERR_add_error_data(9, "Symbol ", symname, @@ -436,7 +436,7 @@ static char *vms_merger(DSO *dso, const char *filespec1, else { errstring[length] = '\0'; - DSOerr(DSO_F_VMS_MERGER, DSO_R_FAILURE); + ERR_raise(ERR_LIB_DSO, DSO_R_FAILURE); ERR_add_error_data(7, "filespec \"", filespec1, "\", ", "defaults \"", filespec2, "\": ", errstring); @@ -451,7 +451,7 @@ static char *vms_merger(DSO *dso, const char *filespec1, merged[nam.NAMX_ESL] = '\0'; return merged; malloc_err: - DSOerr(DSO_F_VMS_MERGER, ERR_R_MALLOC_FAILURE); + ERR_raise(ERR_LIB_DSO, ERR_R_MALLOC_FAILURE); } static char *vms_name_converter(DSO *dso, const char *filename) diff --git a/crypto/dso/dso_win32.c b/crypto/dso/dso_win32.c index 7248fc2878..3b4d596220 100644 --- a/crypto/dso/dso_win32.c +++ b/crypto/dso/dso_win32.c @@ -100,23 +100,23 @@ static int win32_load(DSO *dso) char *filename = DSO_convert_filename(dso, NULL); if (filename == NULL) { - DSOerr(DSO_F_WIN32_LOAD, DSO_R_NO_FILENAME); + ERR_raise(ERR_LIB_DSO, DSO_R_NO_FILENAME); goto err; } h = LoadLibraryA(filename); if (h == NULL) { - DSOerr(DSO_F_WIN32_LOAD, DSO_R_LOAD_FAILED); + ERR_raise(ERR_LIB_DSO, DSO_R_LOAD_FAILED); ERR_add_error_data(3, "filename(", filename, ")"); goto err; } p = OPENSSL_malloc(sizeof(*p)); if (p == NULL) { - DSOerr(DSO_F_WIN32_LOAD, ERR_R_MALLOC_FAILURE); + ERR_raise(ERR_LIB_DSO, ERR_R_MALLOC_FAILURE); goto err; } *p = h; if (!sk_void_push(dso->meth_data, p)) { - DSOerr(DSO_F_WIN32_LOAD, DSO_R_STACK_ERROR); + ERR_raise(ERR_LIB_DSO, DSO_R_STACK_ERROR); goto err; } /* Success */ @@ -135,18 +135,18 @@ static int win32_unload(DSO *dso) { HINSTANCE *p; if (dso == NULL) { - DSOerr(DSO_F_WIN32_UNLOAD, ERR_R_PASSED_NULL_PARAMETER); + ERR_raise(ERR_LIB_DSO, ERR_R_PASSED_NULL_PARAMETER); return 0; } if (sk_void_num(dso->meth_data) < 1) return 1; p = sk_void_pop(dso->meth_data); if (p == NULL) { - DSOerr(DSO_F_WIN32_UNLOAD, DSO_R_NULL_HANDLE); + ERR_raise(ERR_LIB_DSO, DSO_R_NULL_HANDLE); return 0; } if (!FreeLibrary(*p)) { - DSOerr(DSO_F_WIN32_UNLOAD, DSO_R_UNLOAD_FAILED); + ERR_raise(ERR_LIB_DSO, DSO_R_UNLOAD_FAILED); /* * We should push the value back onto the stack in case of a retry. */ @@ -167,21 +167,21 @@ static DSO_FUNC_TYPE win32_bind_func(DSO *dso, const char *symname) } sym; if ((dso == NULL) || (symname == NULL)) { - DSOerr(DSO_F_WIN32_BIND_FUNC, ERR_R_PASSED_NULL_PARAMETER); + ERR_raise(ERR_LIB_DSO, ERR_R_PASSED_NULL_PARAMETER); return NULL; } if (sk_void_num(dso->meth_data) < 1) { - DSOerr(DSO_F_WIN32_BIND_FUNC, DSO_R_STACK_ERROR); + ERR_raise(ERR_LIB_DSO, 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_FUNC, DSO_R_NULL_HANDLE); + ERR_raise(ERR_LIB_DSO, DSO_R_NULL_HANDLE); return NULL; } sym.f = GetProcAddress(*ptr, symname); if (sym.p == NULL) { - DSOerr(DSO_F_WIN32_BIND_FUNC, DSO_R_SYM_FAILURE); + ERR_raise(ERR_LIB_DSO, DSO_R_SYM_FAILURE); ERR_add_error_data(3, "symname(", symname, ")"); return NULL; } @@ -210,13 +210,13 @@ static struct file_st *win32_splitter(DSO *dso, const char *filename, char last; if (!filename) { - DSOerr(DSO_F_WIN32_SPLITTER, DSO_R_NO_FILENAME); + ERR_raise(ERR_LIB_DSO, DSO_R_NO_FILENAME); return NULL; } result = OPENSSL_zalloc(sizeof(*result)); if (result == NULL) { - DSOerr(DSO_F_WIN32_SPLITTER, ERR_R_MALLOC_FAILURE); + ERR_raise(ERR_LIB_DSO, ERR_R_MALLOC_FAILURE); return NULL; } @@ -235,7 +235,7 @@ static struct file_st *win32_splitter(DSO *dso, const char *filename, switch (last) { case ':': if (position != IN_DEVICE) { - DSOerr(DSO_F_WIN32_SPLITTER, DSO_R_INCORRECT_FILE_SYNTAX); + ERR_raise(ERR_LIB_DSO, DSO_R_INCORRECT_FILE_SYNTAX); OPENSSL_free(result); return NULL; } @@ -308,7 +308,7 @@ static char *win32_joiner(DSO *dso, const struct file_st *file_split) const char *start; if (!file_split) { - DSOerr(DSO_F_WIN32_JOINER, ERR_R_PASSED_NULL_PARAMETER); + ERR_raise(ERR_LIB_DSO, ERR_R_PASSED_NULL_PARAMETER); return NULL; } if (file_split->node) { @@ -329,13 +329,13 @@ static char *win32_joiner(DSO *dso, const struct file_st *file_split) len += file_split->filelen; if (!len) { - DSOerr(DSO_F_WIN32_JOINER, DSO_R_EMPTY_FILE_STRUCTURE); + ERR_raise(ERR_LIB_DSO, DSO_R_EMPTY_FILE_STRUCTURE); return NULL; } result = OPENSSL_malloc(len + 1); if (result == NULL) { - DSOerr(DSO_F_WIN32_JOINER, ERR_R_MALLOC_FAILURE); + ERR_raise(ERR_LIB_DSO, ERR_R_MALLOC_FAILURE); return NULL; } @@ -395,30 +395,30 @@ static char *win32_merger(DSO *dso, const char *filespec1, struct file_st *filespec2_split = NULL; if (!filespec1 && !filespec2) { - DSOerr(DSO_F_WIN32_MERGER, ERR_R_PASSED_NULL_PARAMETER); + ERR_raise(ERR_LIB_DSO, ERR_R_PASSED_NULL_PARAMETER); return NULL; } if (!filespec2) { merged = OPENSSL_strdup(filespec1); if (merged == NULL) { - DSOerr(DSO_F_WIN32_MERGER, ERR_R_MALLOC_FAILURE); + ERR_raise(ERR_LIB_DSO, ERR_R_MALLOC_FAILURE); return NULL; } } else if (!filespec1) { merged = OPENSSL_strdup(filespec2); if (merged == NULL) { - DSOerr(DSO_F_WIN32_MERGER, ERR_R_MALLOC_FAILURE); + ERR_raise(ERR_LIB_DSO, ERR_R_MALLOC_FAILURE); return NULL; } } else { filespec1_split = win32_splitter(dso, filespec1, 0); if (!filespec1_split) { - DSOerr(DSO_F_WIN32_MERGER, ERR_R_MALLOC_FAILURE); + ERR_raise(ERR_LIB_DSO, ERR_R_MALLOC_FAILURE); return NULL; } filespec2_split = win32_splitter(dso, filespec2, 1); if (!filespec2_split) { - DSOerr(DSO_F_WIN32_MERGER, ERR_R_MALLOC_FAILURE); + ERR_raise(ERR_LIB_DSO, ERR_R_MALLOC_FAILURE); OPENSSL_free(filespec1_split); return NULL; } @@ -466,7 +466,7 @@ static char *win32_name_converter(DSO *dso, const char *filename) /* We will simply duplicate filename */ translated = OPENSSL_malloc(len + 1); if (translated == NULL) { - DSOerr(DSO_F_WIN32_NAME_CONVERTER, DSO_R_NAME_TRANSLATION_FAILED); + ERR_raise(ERR_LIB_DSO, DSO_R_NAME_TRANSLATION_FAILED); return NULL; } if (transform) @@ -522,7 +522,7 @@ static int win32_pathbyaddr(void *addr, char *path, int sz) dll = LoadLibrary(TEXT(DLLNAME)); if (dll == NULL) { - DSOerr(DSO_F_WIN32_PATHBYADDR, DSO_R_UNSUPPORTED); + ERR_raise(ERR_LIB_DSO, DSO_R_UNSUPPORTED); return -1; } @@ -530,7 +530,7 @@ static int win32_pathbyaddr(void *addr, char *path, int sz) GetProcAddress(dll, "CreateToolhelp32Snapshot"); if (create_snap == NULL) { FreeLibrary(dll); - DSOerr(DSO_F_WIN32_PATHBYADDR, DSO_R_UNSUPPORTED); + ERR_raise(ERR_LIB_DSO, DSO_R_UNSUPPORTED); return -1; } /* We take the rest for granted... */ @@ -550,7 +550,7 @@ static int win32_pathbyaddr(void *addr, char *path, int sz) hModuleSnap = (*create_snap) (TH32CS_SNAPMODULE, 0); if (hModuleSnap == INVALID_HANDLE_VALUE) { FreeLibrary(dll); - DSOerr(DSO_F_WIN32_PATHBYADDR, DSO_R_UNSUPPORTED); + ERR_raise(ERR_LIB_DSO, DSO_R_UNSUPPORTED); return -1; } @@ -559,7 +559,7 @@ static int win32_pathbyaddr(void *addr, char *path, int sz) if (!(*module_first) (hModuleSnap, &me32)) { (*close_snap) (hModuleSnap); FreeLibrary(dll); - DSOerr(DSO_F_WIN32_PATHBYADDR, DSO_R_FAILURE); + ERR_raise(ERR_LIB_DSO, DSO_R_FAILURE); return -1; } @@ -621,7 +621,7 @@ static void *win32_globallookup(const char *name) dll = LoadLibrary(TEXT(DLLNAME)); if (dll == NULL) { - DSOerr(DSO_F_WIN32_GLOBALLOOKUP, DSO_R_UNSUPPORTED); + ERR_raise(ERR_LIB_DSO, DSO_R_UNSUPPORTED); return NULL; } @@ -629,7 +629,7 @@ static void *win32_globallookup(const char *name) GetProcAddress(dll, "CreateToolhelp32Snapshot"); if (create_snap == NULL) { FreeLibrary(dll); - DSOerr(DSO_F_WIN32_GLOBALLOOKUP, DSO_R_UNSUPPORTED); + ERR_raise(ERR_LIB_DSO, DSO_R_UNSUPPORTED); return NULL; } /* We take the rest for granted... */ @@ -645,7 +645,7 @@ static void *win32_globallookup(const char *name) hModuleSnap = (*create_snap) (TH32CS_SNAPMODULE, 0); if (hModuleSnap == INVALID_HANDLE_VALUE) { FreeLibrary(dll); - DSOerr(DSO_F_WIN32_GLOBALLOOKUP, DSO_R_UNSUPPORTED); + ERR_raise(ERR_LIB_DSO, DSO_R_UNSUPPORTED); return NULL; } |