Check for errors allocating the error strings.
[openssl.git] / crypto / dso / dso_err.c
1 /*
2  * Generated by util/mkerr.pl DO NOT EDIT
3  * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
4  *
5  * Licensed under the OpenSSL license (the "License").  You may not use
6  * this file except in compliance with the License.  You can obtain a copy
7  * in the file LICENSE in the source distribution or at
8  * https://www.openssl.org/source/license.html
9  */
10
11 #include <stdio.h>
12 #include <openssl/err.h>
13 #include "internal/dso.h"
14
15 /* BEGIN ERROR CODES */
16 #ifndef OPENSSL_NO_ERR
17
18 # define ERR_FUNC(func) ERR_PACK(ERR_LIB_DSO,func,0)
19 # define ERR_REASON(reason) ERR_PACK(ERR_LIB_DSO,0,reason)
20
21 static ERR_STRING_DATA DSO_str_functs[] = {
22     {ERR_FUNC(DSO_F_DLFCN_BIND_FUNC), "dlfcn_bind_func"},
23     {ERR_FUNC(DSO_F_DLFCN_LOAD), "dlfcn_load"},
24     {ERR_FUNC(DSO_F_DLFCN_MERGER), "dlfcn_merger"},
25     {ERR_FUNC(DSO_F_DLFCN_NAME_CONVERTER), "dlfcn_name_converter"},
26     {ERR_FUNC(DSO_F_DLFCN_UNLOAD), "dlfcn_unload"},
27     {ERR_FUNC(DSO_F_DL_BIND_FUNC), "dl_bind_func"},
28     {ERR_FUNC(DSO_F_DL_LOAD), "dl_load"},
29     {ERR_FUNC(DSO_F_DL_MERGER), "dl_merger"},
30     {ERR_FUNC(DSO_F_DL_NAME_CONVERTER), "dl_name_converter"},
31     {ERR_FUNC(DSO_F_DL_UNLOAD), "dl_unload"},
32     {ERR_FUNC(DSO_F_DSO_BIND_FUNC), "DSO_bind_func"},
33     {ERR_FUNC(DSO_F_DSO_CONVERT_FILENAME), "DSO_convert_filename"},
34     {ERR_FUNC(DSO_F_DSO_CTRL), "DSO_ctrl"},
35     {ERR_FUNC(DSO_F_DSO_FREE), "DSO_free"},
36     {ERR_FUNC(DSO_F_DSO_GET_FILENAME), "DSO_get_filename"},
37     {ERR_FUNC(DSO_F_DSO_GLOBAL_LOOKUP), "DSO_global_lookup"},
38     {ERR_FUNC(DSO_F_DSO_LOAD), "DSO_load"},
39     {ERR_FUNC(DSO_F_DSO_MERGE), "DSO_merge"},
40     {ERR_FUNC(DSO_F_DSO_NEW_METHOD), "DSO_new_method"},
41     {ERR_FUNC(DSO_F_DSO_SET_FILENAME), "DSO_set_filename"},
42     {ERR_FUNC(DSO_F_DSO_UP_REF), "DSO_up_ref"},
43     {ERR_FUNC(DSO_F_VMS_BIND_SYM), "vms_bind_sym"},
44     {ERR_FUNC(DSO_F_VMS_LOAD), "vms_load"},
45     {ERR_FUNC(DSO_F_VMS_MERGER), "vms_merger"},
46     {ERR_FUNC(DSO_F_VMS_UNLOAD), "vms_unload"},
47     {ERR_FUNC(DSO_F_WIN32_BIND_FUNC), "win32_bind_func"},
48     {ERR_FUNC(DSO_F_WIN32_GLOBALLOOKUP), "win32_globallookup"},
49     {ERR_FUNC(DSO_F_WIN32_JOINER), "win32_joiner"},
50     {ERR_FUNC(DSO_F_WIN32_LOAD), "win32_load"},
51     {ERR_FUNC(DSO_F_WIN32_MERGER), "win32_merger"},
52     {ERR_FUNC(DSO_F_WIN32_NAME_CONVERTER), "win32_name_converter"},
53     {ERR_FUNC(DSO_F_WIN32_SPLITTER), "win32_splitter"},
54     {ERR_FUNC(DSO_F_WIN32_UNLOAD), "win32_unload"},
55     {0, NULL}
56 };
57
58 static ERR_STRING_DATA DSO_str_reasons[] = {
59     {ERR_REASON(DSO_R_CTRL_FAILED), "control command failed"},
60     {ERR_REASON(DSO_R_DSO_ALREADY_LOADED), "dso already loaded"},
61     {ERR_REASON(DSO_R_EMPTY_FILE_STRUCTURE), "empty file structure"},
62     {ERR_REASON(DSO_R_FAILURE), "failure"},
63     {ERR_REASON(DSO_R_FILENAME_TOO_BIG), "filename too big"},
64     {ERR_REASON(DSO_R_FINISH_FAILED), "cleanup method function failed"},
65     {ERR_REASON(DSO_R_INCORRECT_FILE_SYNTAX), "incorrect file syntax"},
66     {ERR_REASON(DSO_R_LOAD_FAILED), "could not load the shared library"},
67     {ERR_REASON(DSO_R_NAME_TRANSLATION_FAILED), "name translation failed"},
68     {ERR_REASON(DSO_R_NO_FILENAME), "no filename"},
69     {ERR_REASON(DSO_R_NULL_HANDLE), "a null shared library handle was used"},
70     {ERR_REASON(DSO_R_SET_FILENAME_FAILED), "set filename failed"},
71     {ERR_REASON(DSO_R_STACK_ERROR), "the meth_data stack is corrupt"},
72     {ERR_REASON(DSO_R_SYM_FAILURE),
73      "could not bind to the requested symbol name"},
74     {ERR_REASON(DSO_R_UNLOAD_FAILED), "could not unload the shared library"},
75     {ERR_REASON(DSO_R_UNSUPPORTED), "functionality not supported"},
76     {0, NULL}
77 };
78
79 #endif
80
81 int ERR_load_DSO_strings(void)
82 {
83 #ifndef OPENSSL_NO_ERR
84
85     if (ERR_func_error_string(DSO_str_functs[0].error) == NULL) {
86         ERR_load_strings(0, DSO_str_functs);
87         ERR_load_strings(0, DSO_str_reasons);
88     }
89 #endif
90     return 1;
91 }