Remove/rename some old files.
[openssl.git] / engines / e_capi_err.c
1 /*
2  * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
3  *
4  * Licensed under the OpenSSL license (the "License").  You may not use
5  * this file except in compliance with the License.  You can obtain a copy
6  * in the file LICENSE in the source distribution or at
7  * https://www.openssl.org/source/license.html
8  */
9
10 /*
11  * NOTE: this file was auto generated by the mkerr.pl script: any changes
12  * made to it will be overwritten when the script next updates this file,
13  * only reason strings will be preserved.
14  */
15
16 #include <stdio.h>
17 #include <openssl/err.h>
18 #include "e_capi_err.h"
19
20 /* BEGIN ERROR CODES */
21 #ifndef OPENSSL_NO_ERR
22
23 # define ERR_FUNC(func) ERR_PACK(0,func,0)
24 # define ERR_REASON(reason) ERR_PACK(0,0,reason)
25
26 static ERR_STRING_DATA CAPI_str_functs[] = {
27     {ERR_FUNC(CAPI_F_CAPI_CERT_GET_FNAME), "CAPI_CERT_GET_FNAME"},
28     {ERR_FUNC(CAPI_F_CAPI_CTRL), "CAPI_CTRL"},
29     {ERR_FUNC(CAPI_F_CAPI_CTX_NEW), "CAPI_CTX_NEW"},
30     {ERR_FUNC(CAPI_F_CAPI_CTX_SET_PROVNAME), "CAPI_CTX_SET_PROVNAME"},
31     {ERR_FUNC(CAPI_F_CAPI_DSA_DO_SIGN), "CAPI_DSA_DO_SIGN"},
32     {ERR_FUNC(CAPI_F_CAPI_GET_KEY), "CAPI_GET_KEY"},
33     {ERR_FUNC(CAPI_F_CAPI_GET_PKEY), "CAPI_GET_PKEY"},
34     {ERR_FUNC(CAPI_F_CAPI_GET_PROVNAME), "CAPI_GET_PROVNAME"},
35     {ERR_FUNC(CAPI_F_CAPI_GET_PROV_INFO), "CAPI_GET_PROV_INFO"},
36     {ERR_FUNC(CAPI_F_CAPI_INIT), "CAPI_INIT"},
37     {ERR_FUNC(CAPI_F_CAPI_LIST_CONTAINERS), "CAPI_LIST_CONTAINERS"},
38     {ERR_FUNC(CAPI_F_CAPI_LOAD_PRIVKEY), "CAPI_LOAD_PRIVKEY"},
39     {ERR_FUNC(CAPI_F_CAPI_OPEN_STORE), "CAPI_OPEN_STORE"},
40     {ERR_FUNC(CAPI_F_CAPI_RSA_PRIV_DEC), "CAPI_RSA_PRIV_DEC"},
41     {ERR_FUNC(CAPI_F_CAPI_RSA_PRIV_ENC), "CAPI_RSA_PRIV_ENC"},
42     {ERR_FUNC(CAPI_F_CAPI_RSA_SIGN), "CAPI_RSA_SIGN"},
43     {ERR_FUNC(CAPI_F_CAPI_VTRACE), "CAPI_VTRACE"},
44     {ERR_FUNC(CAPI_F_CERT_SELECT_DIALOG), "CERT_SELECT_DIALOG"},
45     {ERR_FUNC(CAPI_F_CLIENT_CERT_SELECT), "CLIENT_CERT_SELECT"},
46     {ERR_FUNC(CAPI_F_WIDE_TO_ASC), "WIDE_TO_ASC"},
47     {0, NULL}
48 };
49
50 static ERR_STRING_DATA CAPI_str_reasons[] = {
51     {ERR_REASON(CAPI_R_CANT_CREATE_HASH_OBJECT), "cant create hash object"},
52     {ERR_REASON(CAPI_R_CANT_FIND_CAPI_CONTEXT), "cant find capi context"},
53     {ERR_REASON(CAPI_R_CANT_GET_KEY), "cant get key"},
54     {ERR_REASON(CAPI_R_CANT_SET_HASH_VALUE), "cant set hash value"},
55     {ERR_REASON(CAPI_R_CRYPTACQUIRECONTEXT_ERROR),
56      "cryptacquirecontext error"},
57     {ERR_REASON(CAPI_R_CRYPTENUMPROVIDERS_ERROR), "cryptenumproviders error"},
58     {ERR_REASON(CAPI_R_DECRYPT_ERROR), "decrypt error"},
59     {ERR_REASON(CAPI_R_ENGINE_NOT_INITIALIZED), "engine not initialized"},
60     {ERR_REASON(CAPI_R_ENUMCONTAINERS_ERROR), "enumcontainers error"},
61     {ERR_REASON(CAPI_R_ERROR_ADDING_CERT), "error adding cert"},
62     {ERR_REASON(CAPI_R_ERROR_CREATING_STORE), "error creating store"},
63     {ERR_REASON(CAPI_R_ERROR_GETTING_FRIENDLY_NAME),
64      "error getting friendly name"},
65     {ERR_REASON(CAPI_R_ERROR_GETTING_KEY_PROVIDER_INFO),
66      "error getting key provider info"},
67     {ERR_REASON(CAPI_R_ERROR_OPENING_STORE), "error opening store"},
68     {ERR_REASON(CAPI_R_ERROR_SIGNING_HASH), "error signing hash"},
69     {ERR_REASON(CAPI_R_FILE_OPEN_ERROR), "file open error"},
70     {ERR_REASON(CAPI_R_FUNCTION_NOT_SUPPORTED), "function not supported"},
71     {ERR_REASON(CAPI_R_GETUSERKEY_ERROR), "getuserkey error"},
72     {ERR_REASON(CAPI_R_INVALID_DIGEST_LENGTH), "invalid digest length"},
73     {ERR_REASON(CAPI_R_INVALID_DSA_PUBLIC_KEY_BLOB_MAGIC_NUMBER),
74      "invalid dsa public key blob magic number"},
75     {ERR_REASON(CAPI_R_INVALID_LOOKUP_METHOD), "invalid lookup method"},
76     {ERR_REASON(CAPI_R_INVALID_PUBLIC_KEY_BLOB), "invalid public key blob"},
77     {ERR_REASON(CAPI_R_INVALID_RSA_PUBLIC_KEY_BLOB_MAGIC_NUMBER),
78      "invalid rsa public key blob magic number"},
79     {ERR_REASON(CAPI_R_PUBKEY_EXPORT_ERROR), "pubkey export error"},
80     {ERR_REASON(CAPI_R_PUBKEY_EXPORT_LENGTH_ERROR),
81      "pubkey export length error"},
82     {ERR_REASON(CAPI_R_UNKNOWN_COMMAND), "unknown command"},
83     {ERR_REASON(CAPI_R_UNSUPPORTED_ALGORITHM_NID),
84      "unsupported algorithm nid"},
85     {ERR_REASON(CAPI_R_UNSUPPORTED_PADDING), "unsupported padding"},
86     {ERR_REASON(CAPI_R_UNSUPPORTED_PUBLIC_KEY_ALGORITHM),
87      "unsupported public key algorithm"},
88     {ERR_REASON(CAPI_R_WIN32_ERROR), "win32 error"},
89     {0, NULL}
90 };
91
92 #endif
93
94 #ifdef CAPI_LIB_NAME
95 static ERR_STRING_DATA CAPI_lib_name[] = {
96     {0, CAPI_LIB_NAME},
97     {0, NULL}
98 };
99 #endif
100
101 static int CAPI_lib_error_code = 0;
102 static int CAPI_error_init = 1;
103
104 static void ERR_load_CAPI_strings(void)
105 {
106     if (CAPI_lib_error_code == 0)
107         CAPI_lib_error_code = ERR_get_next_error_library();
108
109     if (CAPI_error_init) {
110         CAPI_error_init = 0;
111 #ifndef OPENSSL_NO_ERR
112         ERR_load_strings(CAPI_lib_error_code, CAPI_str_functs);
113         ERR_load_strings(CAPI_lib_error_code, CAPI_str_reasons);
114 #endif
115
116 #ifdef CAPI_LIB_NAME
117         CAPI_lib_name->error = ERR_PACK(CAPI_lib_error_code, 0, 0);
118         ERR_load_strings(0, CAPI_lib_name);
119 #endif
120     }
121 }
122
123 static void ERR_unload_CAPI_strings(void)
124 {
125     if (CAPI_error_init == 0) {
126 #ifndef OPENSSL_NO_ERR
127         ERR_unload_strings(CAPI_lib_error_code, CAPI_str_functs);
128         ERR_unload_strings(CAPI_lib_error_code, CAPI_str_reasons);
129 #endif
130
131 #ifdef CAPI_LIB_NAME
132         ERR_unload_strings(0, CAPI_lib_name);
133 #endif
134         CAPI_error_init = 1;
135     }
136 }
137
138 static void ERR_CAPI_error(int function, int reason, char *file, int line)
139 {
140     if (CAPI_lib_error_code == 0)
141         CAPI_lib_error_code = ERR_get_next_error_library();
142     ERR_PUT_error(CAPI_lib_error_code, function, reason, file, line);
143 }