xref: /freebsd/crypto/openssl/engines/e_capi_err.c (revision d4eeb02986980bf33dd56c41ceb9fc5f180c0d47)
1 /*
2  * Generated by util/mkerr.pl DO NOT EDIT
3  * Copyright 1995-2017 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 <openssl/err.h>
12 #include "e_capi_err.h"
13 
14 #ifndef OPENSSL_NO_ERR
15 
16 static ERR_STRING_DATA CAPI_str_functs[] = {
17     {ERR_PACK(0, CAPI_F_CAPI_CERT_GET_FNAME, 0), "capi_cert_get_fname"},
18     {ERR_PACK(0, CAPI_F_CAPI_CTRL, 0), "capi_ctrl"},
19     {ERR_PACK(0, CAPI_F_CAPI_CTX_NEW, 0), "capi_ctx_new"},
20     {ERR_PACK(0, CAPI_F_CAPI_CTX_SET_PROVNAME, 0), "capi_ctx_set_provname"},
21     {ERR_PACK(0, CAPI_F_CAPI_DSA_DO_SIGN, 0), "capi_dsa_do_sign"},
22     {ERR_PACK(0, CAPI_F_CAPI_GET_KEY, 0), "capi_get_key"},
23     {ERR_PACK(0, CAPI_F_CAPI_GET_PKEY, 0), "capi_get_pkey"},
24     {ERR_PACK(0, CAPI_F_CAPI_GET_PROVNAME, 0), "capi_get_provname"},
25     {ERR_PACK(0, CAPI_F_CAPI_GET_PROV_INFO, 0), "capi_get_prov_info"},
26     {ERR_PACK(0, CAPI_F_CAPI_INIT, 0), "capi_init"},
27     {ERR_PACK(0, CAPI_F_CAPI_LIST_CONTAINERS, 0), "capi_list_containers"},
28     {ERR_PACK(0, CAPI_F_CAPI_LOAD_PRIVKEY, 0), "capi_load_privkey"},
29     {ERR_PACK(0, CAPI_F_CAPI_OPEN_STORE, 0), "capi_open_store"},
30     {ERR_PACK(0, CAPI_F_CAPI_RSA_PRIV_DEC, 0), "capi_rsa_priv_dec"},
31     {ERR_PACK(0, CAPI_F_CAPI_RSA_PRIV_ENC, 0), "capi_rsa_priv_enc"},
32     {ERR_PACK(0, CAPI_F_CAPI_RSA_SIGN, 0), "capi_rsa_sign"},
33     {ERR_PACK(0, CAPI_F_CAPI_VTRACE, 0), "capi_vtrace"},
34     {ERR_PACK(0, CAPI_F_CERT_SELECT_DIALOG, 0), "cert_select_dialog"},
35     {ERR_PACK(0, CAPI_F_CLIENT_CERT_SELECT, 0), ""},
36     {ERR_PACK(0, CAPI_F_WIDE_TO_ASC, 0), "wide_to_asc"},
37     {0, NULL}
38 };
39 
40 static ERR_STRING_DATA CAPI_str_reasons[] = {
41     {ERR_PACK(0, 0, CAPI_R_CANT_CREATE_HASH_OBJECT), "cant create hash object"},
42     {ERR_PACK(0, 0, CAPI_R_CANT_FIND_CAPI_CONTEXT), "cant find capi context"},
43     {ERR_PACK(0, 0, CAPI_R_CANT_GET_KEY), "cant get key"},
44     {ERR_PACK(0, 0, CAPI_R_CANT_SET_HASH_VALUE), "cant set hash value"},
45     {ERR_PACK(0, 0, CAPI_R_CRYPTACQUIRECONTEXT_ERROR),
46     "cryptacquirecontext error"},
47     {ERR_PACK(0, 0, CAPI_R_CRYPTENUMPROVIDERS_ERROR),
48     "cryptenumproviders error"},
49     {ERR_PACK(0, 0, CAPI_R_DECRYPT_ERROR), "decrypt error"},
50     {ERR_PACK(0, 0, CAPI_R_ENGINE_NOT_INITIALIZED), "engine not initialized"},
51     {ERR_PACK(0, 0, CAPI_R_ENUMCONTAINERS_ERROR), "enumcontainers error"},
52     {ERR_PACK(0, 0, CAPI_R_ERROR_ADDING_CERT), "error adding cert"},
53     {ERR_PACK(0, 0, CAPI_R_ERROR_CREATING_STORE), "error creating store"},
54     {ERR_PACK(0, 0, CAPI_R_ERROR_GETTING_FRIENDLY_NAME),
55     "error getting friendly name"},
56     {ERR_PACK(0, 0, CAPI_R_ERROR_GETTING_KEY_PROVIDER_INFO),
57     "error getting key provider info"},
58     {ERR_PACK(0, 0, CAPI_R_ERROR_OPENING_STORE), "error opening store"},
59     {ERR_PACK(0, 0, CAPI_R_ERROR_SIGNING_HASH), "error signing hash"},
60     {ERR_PACK(0, 0, CAPI_R_FILE_OPEN_ERROR), "file open error"},
61     {ERR_PACK(0, 0, CAPI_R_FUNCTION_NOT_SUPPORTED), "function not supported"},
62     {ERR_PACK(0, 0, CAPI_R_GETUSERKEY_ERROR), "getuserkey error"},
63     {ERR_PACK(0, 0, CAPI_R_INVALID_DIGEST_LENGTH), "invalid digest length"},
64     {ERR_PACK(0, 0, CAPI_R_INVALID_DSA_PUBLIC_KEY_BLOB_MAGIC_NUMBER),
65     "invalid dsa public key blob magic number"},
66     {ERR_PACK(0, 0, CAPI_R_INVALID_LOOKUP_METHOD), "invalid lookup method"},
67     {ERR_PACK(0, 0, CAPI_R_INVALID_PUBLIC_KEY_BLOB), "invalid public key blob"},
68     {ERR_PACK(0, 0, CAPI_R_INVALID_RSA_PUBLIC_KEY_BLOB_MAGIC_NUMBER),
69     "invalid rsa public key blob magic number"},
70     {ERR_PACK(0, 0, CAPI_R_PUBKEY_EXPORT_ERROR), "pubkey export error"},
71     {ERR_PACK(0, 0, CAPI_R_PUBKEY_EXPORT_LENGTH_ERROR),
72     "pubkey export length error"},
73     {ERR_PACK(0, 0, CAPI_R_UNKNOWN_COMMAND), "unknown command"},
74     {ERR_PACK(0, 0, CAPI_R_UNSUPPORTED_ALGORITHM_NID),
75     "unsupported algorithm nid"},
76     {ERR_PACK(0, 0, CAPI_R_UNSUPPORTED_PADDING), "unsupported padding"},
77     {ERR_PACK(0, 0, CAPI_R_UNSUPPORTED_PUBLIC_KEY_ALGORITHM),
78     "unsupported public key algorithm"},
79     {ERR_PACK(0, 0, CAPI_R_WIN32_ERROR), "win32 error"},
80     {0, NULL}
81 };
82 
83 #endif
84 
85 static int lib_code = 0;
86 static int error_loaded = 0;
87 
88 static int ERR_load_CAPI_strings(void)
89 {
90     if (lib_code == 0)
91         lib_code = ERR_get_next_error_library();
92 
93     if (!error_loaded) {
94 #ifndef OPENSSL_NO_ERR
95         ERR_load_strings(lib_code, CAPI_str_functs);
96         ERR_load_strings(lib_code, CAPI_str_reasons);
97 #endif
98         error_loaded = 1;
99     }
100     return 1;
101 }
102 
103 static void ERR_unload_CAPI_strings(void)
104 {
105     if (error_loaded) {
106 #ifndef OPENSSL_NO_ERR
107         ERR_unload_strings(lib_code, CAPI_str_functs);
108         ERR_unload_strings(lib_code, CAPI_str_reasons);
109 #endif
110         error_loaded = 0;
111     }
112 }
113 
114 static void ERR_CAPI_error(int function, int reason, char *file, int line)
115 {
116     if (lib_code == 0)
117         lib_code = ERR_get_next_error_library();
118     ERR_PUT_error(lib_code, function, reason, file, line);
119 }
120