1238384Sjkim/* e_gost_err.c */
2238384Sjkim/* ====================================================================
3284285Sjkim * Copyright (c) 1999-2015 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
10280304Sjkim *    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
56280304Sjkim/*
57280304Sjkim * NOTE: this file was auto generated by the mkerr.pl script: any changes
58238384Sjkim * made to it will be overwritten when the script next updates this file,
59238384Sjkim * only reason strings will be preserved.
60238384Sjkim */
61238384Sjkim
62238384Sjkim#include <stdio.h>
63238384Sjkim#include <openssl/err.h>
64238384Sjkim#include "e_gost_err.h"
65238384Sjkim
66238384Sjkim/* BEGIN ERROR CODES */
67238384Sjkim#ifndef OPENSSL_NO_ERR
68238384Sjkim
69280304Sjkim# define ERR_FUNC(func) ERR_PACK(0,func,0)
70280304Sjkim# define ERR_REASON(reason) ERR_PACK(0,0,reason)
71238384Sjkim
72280304Sjkimstatic ERR_STRING_DATA GOST_str_functs[] = {
73280304Sjkim    {ERR_FUNC(GOST_F_DECODE_GOST_ALGOR_PARAMS), "DECODE_GOST_ALGOR_PARAMS"},
74280304Sjkim    {ERR_FUNC(GOST_F_ENCODE_GOST_ALGOR_PARAMS), "ENCODE_GOST_ALGOR_PARAMS"},
75280304Sjkim    {ERR_FUNC(GOST_F_FILL_GOST2001_PARAMS), "FILL_GOST2001_PARAMS"},
76280304Sjkim    {ERR_FUNC(GOST_F_FILL_GOST94_PARAMS), "FILL_GOST94_PARAMS"},
77280304Sjkim    {ERR_FUNC(GOST_F_GET_ENCRYPTION_PARAMS), "GET_ENCRYPTION_PARAMS"},
78280304Sjkim    {ERR_FUNC(GOST_F_GOST2001_COMPUTE_PUBLIC), "GOST2001_COMPUTE_PUBLIC"},
79280304Sjkim    {ERR_FUNC(GOST_F_GOST2001_DO_SIGN), "GOST2001_DO_SIGN"},
80280304Sjkim    {ERR_FUNC(GOST_F_GOST2001_DO_VERIFY), "GOST2001_DO_VERIFY"},
81280304Sjkim    {ERR_FUNC(GOST_F_GOST2001_KEYGEN), "GOST2001_KEYGEN"},
82280304Sjkim    {ERR_FUNC(GOST_F_GOST89_GET_ASN1_PARAMETERS),
83280304Sjkim     "GOST89_GET_ASN1_PARAMETERS"},
84280304Sjkim    {ERR_FUNC(GOST_F_GOST89_SET_ASN1_PARAMETERS),
85280304Sjkim     "GOST89_SET_ASN1_PARAMETERS"},
86280304Sjkim    {ERR_FUNC(GOST_F_GOST94_COMPUTE_PUBLIC), "GOST94_COMPUTE_PUBLIC"},
87280304Sjkim    {ERR_FUNC(GOST_F_GOST_CIPHER_CTL), "GOST_CIPHER_CTL"},
88280304Sjkim    {ERR_FUNC(GOST_F_GOST_DO_SIGN), "GOST_DO_SIGN"},
89280304Sjkim    {ERR_FUNC(GOST_F_GOST_DO_VERIFY), "GOST_DO_VERIFY"},
90280304Sjkim    {ERR_FUNC(GOST_F_GOST_IMIT_CTRL), "GOST_IMIT_CTRL"},
91280304Sjkim    {ERR_FUNC(GOST_F_GOST_IMIT_FINAL), "GOST_IMIT_FINAL"},
92280304Sjkim    {ERR_FUNC(GOST_F_GOST_IMIT_UPDATE), "GOST_IMIT_UPDATE"},
93284285Sjkim    {ERR_FUNC(GOST_F_GOST_SIGN_KEYGEN), "GOST_SIGN_KEYGEN"},
94280304Sjkim    {ERR_FUNC(GOST_F_PARAM_COPY_GOST01), "PARAM_COPY_GOST01"},
95280304Sjkim    {ERR_FUNC(GOST_F_PARAM_COPY_GOST94), "PARAM_COPY_GOST94"},
96280304Sjkim    {ERR_FUNC(GOST_F_PKEY_GOST01CP_DECRYPT), "PKEY_GOST01CP_DECRYPT"},
97280304Sjkim    {ERR_FUNC(GOST_F_PKEY_GOST01CP_ENCRYPT), "PKEY_GOST01CP_ENCRYPT"},
98280304Sjkim    {ERR_FUNC(GOST_F_PKEY_GOST01CP_KEYGEN), "PKEY_GOST01CP_KEYGEN"},
99280304Sjkim    {ERR_FUNC(GOST_F_PKEY_GOST01_PARAMGEN), "PKEY_GOST01_PARAMGEN"},
100280304Sjkim    {ERR_FUNC(GOST_F_PKEY_GOST2001_DERIVE), "PKEY_GOST2001_DERIVE"},
101280304Sjkim    {ERR_FUNC(GOST_F_PKEY_GOST94CP_DECRYPT), "PKEY_GOST94CP_DECRYPT"},
102280304Sjkim    {ERR_FUNC(GOST_F_PKEY_GOST94CP_ENCRYPT), "PKEY_GOST94CP_ENCRYPT"},
103280304Sjkim    {ERR_FUNC(GOST_F_PKEY_GOST94CP_KEYGEN), "PKEY_GOST94CP_KEYGEN"},
104280304Sjkim    {ERR_FUNC(GOST_F_PKEY_GOST94_PARAMGEN), "PKEY_GOST94_PARAMGEN"},
105280304Sjkim    {ERR_FUNC(GOST_F_PKEY_GOST_CTRL), "PKEY_GOST_CTRL"},
106280304Sjkim    {ERR_FUNC(GOST_F_PKEY_GOST_CTRL01_STR), "PKEY_GOST_CTRL01_STR"},
107280304Sjkim    {ERR_FUNC(GOST_F_PKEY_GOST_CTRL94_STR), "PKEY_GOST_CTRL94_STR"},
108280304Sjkim    {ERR_FUNC(GOST_F_PKEY_GOST_MAC_CTRL), "PKEY_GOST_MAC_CTRL"},
109280304Sjkim    {ERR_FUNC(GOST_F_PKEY_GOST_MAC_CTRL_STR), "PKEY_GOST_MAC_CTRL_STR"},
110280304Sjkim    {ERR_FUNC(GOST_F_PKEY_GOST_MAC_KEYGEN), "PKEY_GOST_MAC_KEYGEN"},
111280304Sjkim    {ERR_FUNC(GOST_F_PRINT_GOST_01), "PRINT_GOST_01"},
112280304Sjkim    {ERR_FUNC(GOST_F_PRIV_DECODE_GOST), "PRIV_DECODE_GOST"},
113280304Sjkim    {ERR_FUNC(GOST_F_PUB_DECODE_GOST01), "PUB_DECODE_GOST01"},
114280304Sjkim    {ERR_FUNC(GOST_F_PUB_DECODE_GOST94), "PUB_DECODE_GOST94"},
115280304Sjkim    {ERR_FUNC(GOST_F_PUB_ENCODE_GOST01), "PUB_ENCODE_GOST01"},
116280304Sjkim    {ERR_FUNC(GOST_F_UNPACK_CC_SIGNATURE), "UNPACK_CC_SIGNATURE"},
117280304Sjkim    {ERR_FUNC(GOST_F_UNPACK_CP_SIGNATURE), "UNPACK_CP_SIGNATURE"},
118280304Sjkim    {0, NULL}
119280304Sjkim};
120238384Sjkim
121280304Sjkimstatic ERR_STRING_DATA GOST_str_reasons[] = {
122280304Sjkim    {ERR_REASON(GOST_R_BAD_KEY_PARAMETERS_FORMAT),
123280304Sjkim     "bad key parameters format"},
124280304Sjkim    {ERR_REASON(GOST_R_BAD_PKEY_PARAMETERS_FORMAT),
125280304Sjkim     "bad pkey parameters format"},
126280304Sjkim    {ERR_REASON(GOST_R_CANNOT_PACK_EPHEMERAL_KEY),
127280304Sjkim     "cannot pack ephemeral key"},
128280304Sjkim    {ERR_REASON(GOST_R_CTRL_CALL_FAILED), "ctrl call failed"},
129280304Sjkim    {ERR_REASON(GOST_R_ERROR_COMPUTING_SHARED_KEY),
130280304Sjkim     "error computing shared key"},
131280304Sjkim    {ERR_REASON(GOST_R_ERROR_PACKING_KEY_TRANSPORT_INFO),
132280304Sjkim     "error packing key transport info"},
133280304Sjkim    {ERR_REASON(GOST_R_ERROR_PARSING_KEY_TRANSPORT_INFO),
134280304Sjkim     "error parsing key transport info"},
135280304Sjkim    {ERR_REASON(GOST_R_INCOMPATIBLE_ALGORITHMS), "incompatible algorithms"},
136280304Sjkim    {ERR_REASON(GOST_R_INCOMPATIBLE_PEER_KEY), "incompatible peer key"},
137280304Sjkim    {ERR_REASON(GOST_R_INVALID_CIPHER_PARAMS), "invalid cipher params"},
138280304Sjkim    {ERR_REASON(GOST_R_INVALID_CIPHER_PARAM_OID), "invalid cipher param oid"},
139280304Sjkim    {ERR_REASON(GOST_R_INVALID_DIGEST_TYPE), "invalid digest type"},
140280304Sjkim    {ERR_REASON(GOST_R_INVALID_GOST94_PARMSET), "invalid gost94 parmset"},
141280304Sjkim    {ERR_REASON(GOST_R_INVALID_IV_LENGTH), "invalid iv length"},
142280304Sjkim    {ERR_REASON(GOST_R_INVALID_MAC_KEY_LENGTH), "invalid mac key length"},
143280304Sjkim    {ERR_REASON(GOST_R_INVALID_PARAMSET), "invalid paramset"},
144280304Sjkim    {ERR_REASON(GOST_R_KEY_IS_NOT_INITALIZED), "key is not initalized"},
145280304Sjkim    {ERR_REASON(GOST_R_KEY_IS_NOT_INITIALIZED), "key is not initialized"},
146280304Sjkim    {ERR_REASON(GOST_R_KEY_PARAMETERS_MISSING), "key parameters missing"},
147280304Sjkim    {ERR_REASON(GOST_R_MAC_KEY_NOT_SET), "mac key not set"},
148280304Sjkim    {ERR_REASON(GOST_R_MALLOC_FAILURE), "malloc failure"},
149280304Sjkim    {ERR_REASON(GOST_R_NO_MEMORY), "no memory"},
150280304Sjkim    {ERR_REASON(GOST_R_NO_PARAMETERS_SET), "no parameters set"},
151280304Sjkim    {ERR_REASON(GOST_R_NO_PEER_KEY), "no peer key"},
152280304Sjkim    {ERR_REASON(GOST_R_NO_PRIVATE_PART_OF_NON_EPHEMERAL_KEYPAIR),
153280304Sjkim     "no private part of non ephemeral keypair"},
154280304Sjkim    {ERR_REASON(GOST_R_PUBLIC_KEY_UNDEFINED), "public key undefined"},
155280304Sjkim    {ERR_REASON(GOST_R_RANDOM_GENERATOR_ERROR), "random generator error"},
156280304Sjkim    {ERR_REASON(GOST_R_RANDOM_GENERATOR_FAILURE), "random generator failure"},
157280304Sjkim    {ERR_REASON(GOST_R_RANDOM_NUMBER_GENERATOR_FAILED),
158280304Sjkim     "random number generator failed"},
159280304Sjkim    {ERR_REASON(GOST_R_SIGNATURE_MISMATCH), "signature mismatch"},
160280304Sjkim    {ERR_REASON(GOST_R_SIGNATURE_PARTS_GREATER_THAN_Q),
161280304Sjkim     "signature parts greater than q"},
162280304Sjkim    {ERR_REASON(GOST_R_UKM_NOT_SET), "ukm not set"},
163280304Sjkim    {ERR_REASON(GOST_R_UNSUPPORTED_CIPHER_CTL_COMMAND),
164280304Sjkim     "unsupported cipher ctl command"},
165280304Sjkim    {ERR_REASON(GOST_R_UNSUPPORTED_PARAMETER_SET),
166280304Sjkim     "unsupported parameter set"},
167280304Sjkim    {0, NULL}
168280304Sjkim};
169238384Sjkim
170238384Sjkim#endif
171238384Sjkim
172238384Sjkim#ifdef GOST_LIB_NAME
173280304Sjkimstatic ERR_STRING_DATA GOST_lib_name[] = {
174280304Sjkim    {0, GOST_LIB_NAME},
175280304Sjkim    {0, NULL}
176280304Sjkim};
177238384Sjkim#endif
178238384Sjkim
179280304Sjkimstatic int GOST_lib_error_code = 0;
180280304Sjkimstatic int GOST_error_init = 1;
181238384Sjkim
182238384Sjkimvoid ERR_load_GOST_strings(void)
183280304Sjkim{
184280304Sjkim    if (GOST_lib_error_code == 0)
185280304Sjkim        GOST_lib_error_code = ERR_get_next_error_library();
186238384Sjkim
187280304Sjkim    if (GOST_error_init) {
188280304Sjkim        GOST_error_init = 0;
189238384Sjkim#ifndef OPENSSL_NO_ERR
190280304Sjkim        ERR_load_strings(GOST_lib_error_code, GOST_str_functs);
191280304Sjkim        ERR_load_strings(GOST_lib_error_code, GOST_str_reasons);
192238384Sjkim#endif
193238384Sjkim
194238384Sjkim#ifdef GOST_LIB_NAME
195280304Sjkim        GOST_lib_name->error = ERR_PACK(GOST_lib_error_code, 0, 0);
196280304Sjkim        ERR_load_strings(0, GOST_lib_name);
197238384Sjkim#endif
198280304Sjkim    }
199280304Sjkim}
200238384Sjkim
201238384Sjkimvoid ERR_unload_GOST_strings(void)
202280304Sjkim{
203280304Sjkim    if (GOST_error_init == 0) {
204238384Sjkim#ifndef OPENSSL_NO_ERR
205280304Sjkim        ERR_unload_strings(GOST_lib_error_code, GOST_str_functs);
206280304Sjkim        ERR_unload_strings(GOST_lib_error_code, GOST_str_reasons);
207238384Sjkim#endif
208238384Sjkim
209238384Sjkim#ifdef GOST_LIB_NAME
210280304Sjkim        ERR_unload_strings(0, GOST_lib_name);
211238384Sjkim#endif
212280304Sjkim        GOST_error_init = 1;
213280304Sjkim    }
214280304Sjkim}
215238384Sjkim
216238384Sjkimvoid ERR_GOST_error(int function, int reason, char *file, int line)
217280304Sjkim{
218280304Sjkim    if (GOST_lib_error_code == 0)
219280304Sjkim        GOST_lib_error_code = ERR_get_next_error_library();
220280304Sjkim    ERR_PUT_error(GOST_lib_error_code, function, reason, file, line);
221280304Sjkim}
222