1238384Sjkim/* e_gost_err.c */
2238384Sjkim/* ====================================================================
3238384Sjkim * Copyright (c) 1999-2009 The OpenSSL Project.  All rights reserved.
4238384Sjkim *
5238384Sjkim * Redistribution and use in source and binary forms, with or without
6238384Sjkim * modification, are permitted provided that the following conditions
7238384Sjkim * are met:
8238384Sjkim *
9238384Sjkim * 1. Redistributions of source code must retain the above copyright
10238384Sjkim *    notice, this list of conditions and the following disclaimer.
11238384Sjkim *
12238384Sjkim * 2. Redistributions in binary form must reproduce the above copyright
13238384Sjkim *    notice, this list of conditions and the following disclaimer in
14238384Sjkim *    the documentation and/or other materials provided with the
15238384Sjkim *    distribution.
16238384Sjkim *
17238384Sjkim * 3. All advertising materials mentioning features or use of this
18238384Sjkim *    software must display the following acknowledgment:
19238384Sjkim *    "This product includes software developed by the OpenSSL Project
20238384Sjkim *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
21238384Sjkim *
22238384Sjkim * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
23238384Sjkim *    endorse or promote products derived from this software without
24238384Sjkim *    prior written permission. For written permission, please contact
25238384Sjkim *    openssl-core@OpenSSL.org.
26238384Sjkim *
27238384Sjkim * 5. Products derived from this software may not be called "OpenSSL"
28238384Sjkim *    nor may "OpenSSL" appear in their names without prior written
29238384Sjkim *    permission of the OpenSSL Project.
30238384Sjkim *
31238384Sjkim * 6. Redistributions of any form whatsoever must retain the following
32238384Sjkim *    acknowledgment:
33238384Sjkim *    "This product includes software developed by the OpenSSL Project
34238384Sjkim *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
35238384Sjkim *
36238384Sjkim * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
37238384Sjkim * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38238384Sjkim * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
39238384Sjkim * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
40238384Sjkim * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41238384Sjkim * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
42238384Sjkim * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
43238384Sjkim * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44238384Sjkim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
45238384Sjkim * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46238384Sjkim * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
47238384Sjkim * OF THE POSSIBILITY OF SUCH DAMAGE.
48238384Sjkim * ====================================================================
49238384Sjkim *
50238384Sjkim * This product includes cryptographic software written by Eric Young
51238384Sjkim * (eay@cryptsoft.com).  This product includes software written by Tim
52238384Sjkim * Hudson (tjh@cryptsoft.com).
53238384Sjkim *
54238384Sjkim */
55238384Sjkim
56238384Sjkim/* NOTE: this file was auto generated by the mkerr.pl script: any changes
57238384Sjkim * made to it will be overwritten when the script next updates this file,
58238384Sjkim * only reason strings will be preserved.
59238384Sjkim */
60238384Sjkim
61238384Sjkim#include <stdio.h>
62238384Sjkim#include <openssl/err.h>
63238384Sjkim#include "e_gost_err.h"
64238384Sjkim
65238384Sjkim/* BEGIN ERROR CODES */
66238384Sjkim#ifndef OPENSSL_NO_ERR
67238384Sjkim
68238384Sjkim#define ERR_FUNC(func) ERR_PACK(0,func,0)
69238384Sjkim#define ERR_REASON(reason) ERR_PACK(0,0,reason)
70238384Sjkim
71238384Sjkimstatic ERR_STRING_DATA GOST_str_functs[]=
72238384Sjkim	{
73238384Sjkim{ERR_FUNC(GOST_F_DECODE_GOST_ALGOR_PARAMS),	"DECODE_GOST_ALGOR_PARAMS"},
74238384Sjkim{ERR_FUNC(GOST_F_ENCODE_GOST_ALGOR_PARAMS),	"ENCODE_GOST_ALGOR_PARAMS"},
75238384Sjkim{ERR_FUNC(GOST_F_FILL_GOST2001_PARAMS),	"FILL_GOST2001_PARAMS"},
76238384Sjkim{ERR_FUNC(GOST_F_FILL_GOST94_PARAMS),	"FILL_GOST94_PARAMS"},
77238384Sjkim{ERR_FUNC(GOST_F_GET_ENCRYPTION_PARAMS),	"GET_ENCRYPTION_PARAMS"},
78238384Sjkim{ERR_FUNC(GOST_F_GOST2001_COMPUTE_PUBLIC),	"GOST2001_COMPUTE_PUBLIC"},
79238384Sjkim{ERR_FUNC(GOST_F_GOST2001_DO_SIGN),	"GOST2001_DO_SIGN"},
80238384Sjkim{ERR_FUNC(GOST_F_GOST2001_DO_VERIFY),	"GOST2001_DO_VERIFY"},
81238384Sjkim{ERR_FUNC(GOST_F_GOST2001_KEYGEN),	"GOST2001_KEYGEN"},
82238384Sjkim{ERR_FUNC(GOST_F_GOST89_GET_ASN1_PARAMETERS),	"GOST89_GET_ASN1_PARAMETERS"},
83238384Sjkim{ERR_FUNC(GOST_F_GOST89_SET_ASN1_PARAMETERS),	"GOST89_SET_ASN1_PARAMETERS"},
84238384Sjkim{ERR_FUNC(GOST_F_GOST94_COMPUTE_PUBLIC),	"GOST94_COMPUTE_PUBLIC"},
85238384Sjkim{ERR_FUNC(GOST_F_GOST_CIPHER_CTL),	"GOST_CIPHER_CTL"},
86238384Sjkim{ERR_FUNC(GOST_F_GOST_DO_SIGN),	"GOST_DO_SIGN"},
87238384Sjkim{ERR_FUNC(GOST_F_GOST_DO_VERIFY),	"GOST_DO_VERIFY"},
88238384Sjkim{ERR_FUNC(GOST_F_GOST_IMIT_CTRL),	"GOST_IMIT_CTRL"},
89238384Sjkim{ERR_FUNC(GOST_F_GOST_IMIT_FINAL),	"GOST_IMIT_FINAL"},
90238384Sjkim{ERR_FUNC(GOST_F_GOST_IMIT_UPDATE),	"GOST_IMIT_UPDATE"},
91238384Sjkim{ERR_FUNC(GOST_F_PARAM_COPY_GOST01),	"PARAM_COPY_GOST01"},
92238384Sjkim{ERR_FUNC(GOST_F_PARAM_COPY_GOST94),	"PARAM_COPY_GOST94"},
93238384Sjkim{ERR_FUNC(GOST_F_PKEY_GOST01CP_DECRYPT),	"PKEY_GOST01CP_DECRYPT"},
94238384Sjkim{ERR_FUNC(GOST_F_PKEY_GOST01CP_ENCRYPT),	"PKEY_GOST01CP_ENCRYPT"},
95238384Sjkim{ERR_FUNC(GOST_F_PKEY_GOST01CP_KEYGEN),	"PKEY_GOST01CP_KEYGEN"},
96238384Sjkim{ERR_FUNC(GOST_F_PKEY_GOST01_PARAMGEN),	"PKEY_GOST01_PARAMGEN"},
97238384Sjkim{ERR_FUNC(GOST_F_PKEY_GOST2001_DERIVE),	"PKEY_GOST2001_DERIVE"},
98238384Sjkim{ERR_FUNC(GOST_F_PKEY_GOST94CP_DECRYPT),	"PKEY_GOST94CP_DECRYPT"},
99238384Sjkim{ERR_FUNC(GOST_F_PKEY_GOST94CP_ENCRYPT),	"PKEY_GOST94CP_ENCRYPT"},
100238384Sjkim{ERR_FUNC(GOST_F_PKEY_GOST94CP_KEYGEN),	"PKEY_GOST94CP_KEYGEN"},
101238384Sjkim{ERR_FUNC(GOST_F_PKEY_GOST94_PARAMGEN),	"PKEY_GOST94_PARAMGEN"},
102238384Sjkim{ERR_FUNC(GOST_F_PKEY_GOST_CTRL),	"PKEY_GOST_CTRL"},
103238384Sjkim{ERR_FUNC(GOST_F_PKEY_GOST_CTRL01_STR),	"PKEY_GOST_CTRL01_STR"},
104238384Sjkim{ERR_FUNC(GOST_F_PKEY_GOST_CTRL94_STR),	"PKEY_GOST_CTRL94_STR"},
105238384Sjkim{ERR_FUNC(GOST_F_PKEY_GOST_MAC_CTRL),	"PKEY_GOST_MAC_CTRL"},
106238384Sjkim{ERR_FUNC(GOST_F_PKEY_GOST_MAC_CTRL_STR),	"PKEY_GOST_MAC_CTRL_STR"},
107238384Sjkim{ERR_FUNC(GOST_F_PKEY_GOST_MAC_KEYGEN),	"PKEY_GOST_MAC_KEYGEN"},
108238384Sjkim{ERR_FUNC(GOST_F_PRINT_GOST_01),	"PRINT_GOST_01"},
109238384Sjkim{ERR_FUNC(GOST_F_PRIV_DECODE_GOST),	"PRIV_DECODE_GOST"},
110238384Sjkim{ERR_FUNC(GOST_F_PUB_DECODE_GOST01),	"PUB_DECODE_GOST01"},
111238384Sjkim{ERR_FUNC(GOST_F_PUB_DECODE_GOST94),	"PUB_DECODE_GOST94"},
112238384Sjkim{ERR_FUNC(GOST_F_PUB_ENCODE_GOST01),	"PUB_ENCODE_GOST01"},
113238384Sjkim{ERR_FUNC(GOST_F_UNPACK_CC_SIGNATURE),	"UNPACK_CC_SIGNATURE"},
114238384Sjkim{ERR_FUNC(GOST_F_UNPACK_CP_SIGNATURE),	"UNPACK_CP_SIGNATURE"},
115238384Sjkim{0,NULL}
116238384Sjkim	};
117238384Sjkim
118238384Sjkimstatic ERR_STRING_DATA GOST_str_reasons[]=
119238384Sjkim	{
120238384Sjkim{ERR_REASON(GOST_R_BAD_KEY_PARAMETERS_FORMAT),"bad key parameters format"},
121238384Sjkim{ERR_REASON(GOST_R_BAD_PKEY_PARAMETERS_FORMAT),"bad pkey parameters format"},
122238384Sjkim{ERR_REASON(GOST_R_CANNOT_PACK_EPHEMERAL_KEY),"cannot pack ephemeral key"},
123238384Sjkim{ERR_REASON(GOST_R_CTRL_CALL_FAILED)     ,"ctrl call failed"},
124238384Sjkim{ERR_REASON(GOST_R_ERROR_COMPUTING_SHARED_KEY),"error computing shared key"},
125238384Sjkim{ERR_REASON(GOST_R_ERROR_PACKING_KEY_TRANSPORT_INFO),"error packing key transport info"},
126238384Sjkim{ERR_REASON(GOST_R_ERROR_PARSING_KEY_TRANSPORT_INFO),"error parsing key transport info"},
127238384Sjkim{ERR_REASON(GOST_R_INCOMPATIBLE_ALGORITHMS),"incompatible algorithms"},
128238384Sjkim{ERR_REASON(GOST_R_INCOMPATIBLE_PEER_KEY),"incompatible peer key"},
129238384Sjkim{ERR_REASON(GOST_R_INVALID_CIPHER_PARAMS),"invalid cipher params"},
130238384Sjkim{ERR_REASON(GOST_R_INVALID_CIPHER_PARAM_OID),"invalid cipher param oid"},
131238384Sjkim{ERR_REASON(GOST_R_INVALID_DIGEST_TYPE)  ,"invalid digest type"},
132238384Sjkim{ERR_REASON(GOST_R_INVALID_GOST94_PARMSET),"invalid gost94 parmset"},
133238384Sjkim{ERR_REASON(GOST_R_INVALID_IV_LENGTH)    ,"invalid iv length"},
134238384Sjkim{ERR_REASON(GOST_R_INVALID_MAC_KEY_LENGTH),"invalid mac key length"},
135238384Sjkim{ERR_REASON(GOST_R_INVALID_PARAMSET)     ,"invalid paramset"},
136238384Sjkim{ERR_REASON(GOST_R_KEY_IS_NOT_INITALIZED),"key is not initalized"},
137238384Sjkim{ERR_REASON(GOST_R_KEY_IS_NOT_INITIALIZED),"key is not initialized"},
138238384Sjkim{ERR_REASON(GOST_R_KEY_PARAMETERS_MISSING),"key parameters missing"},
139238384Sjkim{ERR_REASON(GOST_R_MAC_KEY_NOT_SET)      ,"mac key not set"},
140238384Sjkim{ERR_REASON(GOST_R_MALLOC_FAILURE)       ,"malloc failure"},
141238384Sjkim{ERR_REASON(GOST_R_NO_MEMORY)            ,"no memory"},
142238384Sjkim{ERR_REASON(GOST_R_NO_PARAMETERS_SET)    ,"no parameters set"},
143238384Sjkim{ERR_REASON(GOST_R_NO_PEER_KEY)          ,"no peer key"},
144238384Sjkim{ERR_REASON(GOST_R_NO_PRIVATE_PART_OF_NON_EPHEMERAL_KEYPAIR),"no private part of non ephemeral keypair"},
145238384Sjkim{ERR_REASON(GOST_R_PUBLIC_KEY_UNDEFINED) ,"public key undefined"},
146238384Sjkim{ERR_REASON(GOST_R_RANDOM_GENERATOR_ERROR),"random generator error"},
147238384Sjkim{ERR_REASON(GOST_R_RANDOM_GENERATOR_FAILURE),"random generator failure"},
148238384Sjkim{ERR_REASON(GOST_R_RANDOM_NUMBER_GENERATOR_FAILED),"random number generator failed"},
149238384Sjkim{ERR_REASON(GOST_R_SIGNATURE_MISMATCH)   ,"signature mismatch"},
150238384Sjkim{ERR_REASON(GOST_R_SIGNATURE_PARTS_GREATER_THAN_Q),"signature parts greater than q"},
151238384Sjkim{ERR_REASON(GOST_R_UKM_NOT_SET)          ,"ukm not set"},
152238384Sjkim{ERR_REASON(GOST_R_UNSUPPORTED_CIPHER_CTL_COMMAND),"unsupported cipher ctl command"},
153238384Sjkim{ERR_REASON(GOST_R_UNSUPPORTED_PARAMETER_SET),"unsupported parameter set"},
154238384Sjkim{0,NULL}
155238384Sjkim	};
156238384Sjkim
157238384Sjkim#endif
158238384Sjkim
159238384Sjkim#ifdef GOST_LIB_NAME
160238384Sjkimstatic ERR_STRING_DATA GOST_lib_name[]=
161238384Sjkim        {
162238384Sjkim{0	,GOST_LIB_NAME},
163238384Sjkim{0,NULL}
164238384Sjkim	};
165238384Sjkim#endif
166238384Sjkim
167238384Sjkim
168238384Sjkimstatic int GOST_lib_error_code=0;
169238384Sjkimstatic int GOST_error_init=1;
170238384Sjkim
171238384Sjkimvoid ERR_load_GOST_strings(void)
172238384Sjkim	{
173238384Sjkim	if (GOST_lib_error_code == 0)
174238384Sjkim		GOST_lib_error_code=ERR_get_next_error_library();
175238384Sjkim
176238384Sjkim	if (GOST_error_init)
177238384Sjkim		{
178238384Sjkim		GOST_error_init=0;
179238384Sjkim#ifndef OPENSSL_NO_ERR
180238384Sjkim		ERR_load_strings(GOST_lib_error_code,GOST_str_functs);
181238384Sjkim		ERR_load_strings(GOST_lib_error_code,GOST_str_reasons);
182238384Sjkim#endif
183238384Sjkim
184238384Sjkim#ifdef GOST_LIB_NAME
185238384Sjkim		GOST_lib_name->error = ERR_PACK(GOST_lib_error_code,0,0);
186238384Sjkim		ERR_load_strings(0,GOST_lib_name);
187238384Sjkim#endif
188238384Sjkim		}
189238384Sjkim	}
190238384Sjkim
191238384Sjkimvoid ERR_unload_GOST_strings(void)
192238384Sjkim	{
193238384Sjkim	if (GOST_error_init == 0)
194238384Sjkim		{
195238384Sjkim#ifndef OPENSSL_NO_ERR
196238384Sjkim		ERR_unload_strings(GOST_lib_error_code,GOST_str_functs);
197238384Sjkim		ERR_unload_strings(GOST_lib_error_code,GOST_str_reasons);
198238384Sjkim#endif
199238384Sjkim
200238384Sjkim#ifdef GOST_LIB_NAME
201238384Sjkim		ERR_unload_strings(0,GOST_lib_name);
202238384Sjkim#endif
203238384Sjkim		GOST_error_init=1;
204238384Sjkim		}
205238384Sjkim	}
206238384Sjkim
207238384Sjkimvoid ERR_GOST_error(int function, int reason, char *file, int line)
208238384Sjkim	{
209238384Sjkim	if (GOST_lib_error_code == 0)
210238384Sjkim		GOST_lib_error_code=ERR_get_next_error_library();
211238384Sjkim	ERR_PUT_error(GOST_lib_error_code,function,reason,file,line);
212238384Sjkim	}
213