1183234Ssimon/* e_capi_err.c */
2183234Ssimon/* ====================================================================
3238405Sjkim * Copyright (c) 1999-2009 The OpenSSL Project.  All rights reserved.
4183234Ssimon *
5183234Ssimon * Redistribution and use in source and binary forms, with or without
6183234Ssimon * modification, are permitted provided that the following conditions
7183234Ssimon * are met:
8183234Ssimon *
9183234Ssimon * 1. Redistributions of source code must retain the above copyright
10183234Ssimon *    notice, this list of conditions and the following disclaimer.
11183234Ssimon *
12183234Ssimon * 2. Redistributions in binary form must reproduce the above copyright
13183234Ssimon *    notice, this list of conditions and the following disclaimer in
14183234Ssimon *    the documentation and/or other materials provided with the
15183234Ssimon *    distribution.
16183234Ssimon *
17183234Ssimon * 3. All advertising materials mentioning features or use of this
18183234Ssimon *    software must display the following acknowledgment:
19183234Ssimon *    "This product includes software developed by the OpenSSL Project
20183234Ssimon *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
21183234Ssimon *
22183234Ssimon * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
23183234Ssimon *    endorse or promote products derived from this software without
24183234Ssimon *    prior written permission. For written permission, please contact
25183234Ssimon *    openssl-core@OpenSSL.org.
26183234Ssimon *
27183234Ssimon * 5. Products derived from this software may not be called "OpenSSL"
28183234Ssimon *    nor may "OpenSSL" appear in their names without prior written
29183234Ssimon *    permission of the OpenSSL Project.
30183234Ssimon *
31183234Ssimon * 6. Redistributions of any form whatsoever must retain the following
32183234Ssimon *    acknowledgment:
33183234Ssimon *    "This product includes software developed by the OpenSSL Project
34183234Ssimon *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
35183234Ssimon *
36183234Ssimon * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
37183234Ssimon * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38183234Ssimon * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
39183234Ssimon * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
40183234Ssimon * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41183234Ssimon * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
42183234Ssimon * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
43183234Ssimon * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44183234Ssimon * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
45183234Ssimon * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46183234Ssimon * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
47183234Ssimon * OF THE POSSIBILITY OF SUCH DAMAGE.
48183234Ssimon * ====================================================================
49183234Ssimon *
50183234Ssimon * This product includes cryptographic software written by Eric Young
51183234Ssimon * (eay@cryptsoft.com).  This product includes software written by Tim
52183234Ssimon * Hudson (tjh@cryptsoft.com).
53183234Ssimon *
54183234Ssimon */
55183234Ssimon
56183234Ssimon/* NOTE: this file was auto generated by the mkerr.pl script: any changes
57183234Ssimon * made to it will be overwritten when the script next updates this file,
58183234Ssimon * only reason strings will be preserved.
59183234Ssimon */
60183234Ssimon
61183234Ssimon#include <stdio.h>
62183234Ssimon#include <openssl/err.h>
63183234Ssimon#include "e_capi_err.h"
64183234Ssimon
65183234Ssimon/* BEGIN ERROR CODES */
66183234Ssimon#ifndef OPENSSL_NO_ERR
67183234Ssimon
68183234Ssimon#define ERR_FUNC(func) ERR_PACK(0,func,0)
69183234Ssimon#define ERR_REASON(reason) ERR_PACK(0,0,reason)
70183234Ssimon
71183234Ssimonstatic ERR_STRING_DATA CAPI_str_functs[]=
72183234Ssimon	{
73183234Ssimon{ERR_FUNC(CAPI_F_CAPI_CERT_GET_FNAME),	"CAPI_CERT_GET_FNAME"},
74183234Ssimon{ERR_FUNC(CAPI_F_CAPI_CTRL),	"CAPI_CTRL"},
75183234Ssimon{ERR_FUNC(CAPI_F_CAPI_CTX_NEW),	"CAPI_CTX_NEW"},
76183234Ssimon{ERR_FUNC(CAPI_F_CAPI_CTX_SET_PROVNAME),	"CAPI_CTX_SET_PROVNAME"},
77183234Ssimon{ERR_FUNC(CAPI_F_CAPI_DSA_DO_SIGN),	"CAPI_DSA_DO_SIGN"},
78183234Ssimon{ERR_FUNC(CAPI_F_CAPI_GET_KEY),	"CAPI_GET_KEY"},
79183234Ssimon{ERR_FUNC(CAPI_F_CAPI_GET_PKEY),	"CAPI_GET_PKEY"},
80183234Ssimon{ERR_FUNC(CAPI_F_CAPI_GET_PROVNAME),	"CAPI_GET_PROVNAME"},
81183234Ssimon{ERR_FUNC(CAPI_F_CAPI_GET_PROV_INFO),	"CAPI_GET_PROV_INFO"},
82183234Ssimon{ERR_FUNC(CAPI_F_CAPI_INIT),	"CAPI_INIT"},
83183234Ssimon{ERR_FUNC(CAPI_F_CAPI_LIST_CONTAINERS),	"CAPI_LIST_CONTAINERS"},
84183234Ssimon{ERR_FUNC(CAPI_F_CAPI_LOAD_PRIVKEY),	"CAPI_LOAD_PRIVKEY"},
85183234Ssimon{ERR_FUNC(CAPI_F_CAPI_OPEN_STORE),	"CAPI_OPEN_STORE"},
86183234Ssimon{ERR_FUNC(CAPI_F_CAPI_RSA_PRIV_DEC),	"CAPI_RSA_PRIV_DEC"},
87183234Ssimon{ERR_FUNC(CAPI_F_CAPI_RSA_PRIV_ENC),	"CAPI_RSA_PRIV_ENC"},
88183234Ssimon{ERR_FUNC(CAPI_F_CAPI_RSA_SIGN),	"CAPI_RSA_SIGN"},
89183234Ssimon{ERR_FUNC(CAPI_F_CERT_SELECT_DIALOG),	"CERT_SELECT_DIALOG"},
90183234Ssimon{ERR_FUNC(CAPI_F_CLIENT_CERT_SELECT),	"CLIENT_CERT_SELECT"},
91183234Ssimon{ERR_FUNC(CAPI_F_WIDE_TO_ASC),	"WIDE_TO_ASC"},
92183234Ssimon{0,NULL}
93183234Ssimon	};
94183234Ssimon
95183234Ssimonstatic ERR_STRING_DATA CAPI_str_reasons[]=
96183234Ssimon	{
97183234Ssimon{ERR_REASON(CAPI_R_CANT_CREATE_HASH_OBJECT),"cant create hash object"},
98183234Ssimon{ERR_REASON(CAPI_R_CANT_FIND_CAPI_CONTEXT),"cant find capi context"},
99183234Ssimon{ERR_REASON(CAPI_R_CANT_GET_KEY)         ,"cant get key"},
100183234Ssimon{ERR_REASON(CAPI_R_CANT_SET_HASH_VALUE)  ,"cant set hash value"},
101183234Ssimon{ERR_REASON(CAPI_R_CRYPTACQUIRECONTEXT_ERROR),"cryptacquirecontext error"},
102183234Ssimon{ERR_REASON(CAPI_R_CRYPTENUMPROVIDERS_ERROR),"cryptenumproviders error"},
103183234Ssimon{ERR_REASON(CAPI_R_DECRYPT_ERROR)        ,"decrypt error"},
104183234Ssimon{ERR_REASON(CAPI_R_ENGINE_NOT_INITIALIZED),"engine not initialized"},
105183234Ssimon{ERR_REASON(CAPI_R_ENUMCONTAINERS_ERROR) ,"enumcontainers error"},
106183234Ssimon{ERR_REASON(CAPI_R_ERROR_ADDING_CERT)    ,"error adding cert"},
107183234Ssimon{ERR_REASON(CAPI_R_ERROR_CREATING_STORE) ,"error creating store"},
108183234Ssimon{ERR_REASON(CAPI_R_ERROR_GETTING_FRIENDLY_NAME),"error getting friendly name"},
109183234Ssimon{ERR_REASON(CAPI_R_ERROR_GETTING_KEY_PROVIDER_INFO),"error getting key provider info"},
110183234Ssimon{ERR_REASON(CAPI_R_ERROR_OPENING_STORE)  ,"error opening store"},
111183234Ssimon{ERR_REASON(CAPI_R_ERROR_SIGNING_HASH)   ,"error signing hash"},
112183234Ssimon{ERR_REASON(CAPI_R_FUNCTION_NOT_SUPPORTED),"function not supported"},
113183234Ssimon{ERR_REASON(CAPI_R_GETUSERKEY_ERROR)     ,"getuserkey error"},
114183234Ssimon{ERR_REASON(CAPI_R_INVALID_DIGEST_LENGTH),"invalid digest length"},
115183234Ssimon{ERR_REASON(CAPI_R_INVALID_DSA_PUBLIC_KEY_BLOB_MAGIC_NUMBER),"invalid dsa public key blob magic number"},
116183234Ssimon{ERR_REASON(CAPI_R_INVALID_LOOKUP_METHOD),"invalid lookup method"},
117183234Ssimon{ERR_REASON(CAPI_R_INVALID_PUBLIC_KEY_BLOB),"invalid public key blob"},
118183234Ssimon{ERR_REASON(CAPI_R_INVALID_RSA_PUBLIC_KEY_BLOB_MAGIC_NUMBER),"invalid rsa public key blob magic number"},
119183234Ssimon{ERR_REASON(CAPI_R_PUBKEY_EXPORT_ERROR)  ,"pubkey export error"},
120183234Ssimon{ERR_REASON(CAPI_R_PUBKEY_EXPORT_LENGTH_ERROR),"pubkey export length error"},
121183234Ssimon{ERR_REASON(CAPI_R_UNKNOWN_COMMAND)      ,"unknown command"},
122183234Ssimon{ERR_REASON(CAPI_R_UNSUPPORTED_ALGORITHM_NID),"unsupported algorithm nid"},
123183234Ssimon{ERR_REASON(CAPI_R_UNSUPPORTED_PADDING)  ,"unsupported padding"},
124183234Ssimon{ERR_REASON(CAPI_R_UNSUPPORTED_PUBLIC_KEY_ALGORITHM),"unsupported public key algorithm"},
125205128Ssimon{ERR_REASON(CAPI_R_WIN32_ERROR)          ,"win32 error"},
126183234Ssimon{0,NULL}
127183234Ssimon	};
128183234Ssimon
129183234Ssimon#endif
130183234Ssimon
131183234Ssimon#ifdef CAPI_LIB_NAME
132183234Ssimonstatic ERR_STRING_DATA CAPI_lib_name[]=
133183234Ssimon        {
134183234Ssimon{0	,CAPI_LIB_NAME},
135183234Ssimon{0,NULL}
136183234Ssimon	};
137183234Ssimon#endif
138183234Ssimon
139183234Ssimon
140183234Ssimonstatic int CAPI_lib_error_code=0;
141183234Ssimonstatic int CAPI_error_init=1;
142183234Ssimon
143183234Ssimonstatic void ERR_load_CAPI_strings(void)
144183234Ssimon	{
145183234Ssimon	if (CAPI_lib_error_code == 0)
146183234Ssimon		CAPI_lib_error_code=ERR_get_next_error_library();
147183234Ssimon
148183234Ssimon	if (CAPI_error_init)
149183234Ssimon		{
150183234Ssimon		CAPI_error_init=0;
151183234Ssimon#ifndef OPENSSL_NO_ERR
152183234Ssimon		ERR_load_strings(CAPI_lib_error_code,CAPI_str_functs);
153183234Ssimon		ERR_load_strings(CAPI_lib_error_code,CAPI_str_reasons);
154183234Ssimon#endif
155183234Ssimon
156183234Ssimon#ifdef CAPI_LIB_NAME
157183234Ssimon		CAPI_lib_name->error = ERR_PACK(CAPI_lib_error_code,0,0);
158183234Ssimon		ERR_load_strings(0,CAPI_lib_name);
159183234Ssimon#endif
160183234Ssimon		}
161183234Ssimon	}
162183234Ssimon
163183234Ssimonstatic void ERR_unload_CAPI_strings(void)
164183234Ssimon	{
165183234Ssimon	if (CAPI_error_init == 0)
166183234Ssimon		{
167183234Ssimon#ifndef OPENSSL_NO_ERR
168183234Ssimon		ERR_unload_strings(CAPI_lib_error_code,CAPI_str_functs);
169183234Ssimon		ERR_unload_strings(CAPI_lib_error_code,CAPI_str_reasons);
170183234Ssimon#endif
171183234Ssimon
172183234Ssimon#ifdef CAPI_LIB_NAME
173183234Ssimon		ERR_unload_strings(0,CAPI_lib_name);
174183234Ssimon#endif
175183234Ssimon		CAPI_error_init=1;
176183234Ssimon		}
177183234Ssimon	}
178183234Ssimon
179183234Ssimonstatic void ERR_CAPI_error(int function, int reason, char *file, int line)
180183234Ssimon	{
181183234Ssimon	if (CAPI_lib_error_code == 0)
182183234Ssimon		CAPI_lib_error_code=ERR_get_next_error_library();
183183234Ssimon	ERR_PUT_error(CAPI_lib_error_code,function,reason,file,line);
184183234Ssimon	}
185