1160814Ssimon/* e_gmp_err.c */
2160814Ssimon/* ====================================================================
3160814Ssimon * Copyright (c) 1999-2005 The OpenSSL Project.  All rights reserved.
4160814Ssimon *
5160814Ssimon * Redistribution and use in source and binary forms, with or without
6160814Ssimon * modification, are permitted provided that the following conditions
7160814Ssimon * are met:
8160814Ssimon *
9160814Ssimon * 1. Redistributions of source code must retain the above copyright
10296341Sdelphij *    notice, this list of conditions and the following disclaimer.
11160814Ssimon *
12160814Ssimon * 2. Redistributions in binary form must reproduce the above copyright
13160814Ssimon *    notice, this list of conditions and the following disclaimer in
14160814Ssimon *    the documentation and/or other materials provided with the
15160814Ssimon *    distribution.
16160814Ssimon *
17160814Ssimon * 3. All advertising materials mentioning features or use of this
18160814Ssimon *    software must display the following acknowledgment:
19160814Ssimon *    "This product includes software developed by the OpenSSL Project
20160814Ssimon *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
21160814Ssimon *
22160814Ssimon * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
23160814Ssimon *    endorse or promote products derived from this software without
24160814Ssimon *    prior written permission. For written permission, please contact
25160814Ssimon *    openssl-core@OpenSSL.org.
26160814Ssimon *
27160814Ssimon * 5. Products derived from this software may not be called "OpenSSL"
28160814Ssimon *    nor may "OpenSSL" appear in their names without prior written
29160814Ssimon *    permission of the OpenSSL Project.
30160814Ssimon *
31160814Ssimon * 6. Redistributions of any form whatsoever must retain the following
32160814Ssimon *    acknowledgment:
33160814Ssimon *    "This product includes software developed by the OpenSSL Project
34160814Ssimon *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
35160814Ssimon *
36160814Ssimon * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
37160814Ssimon * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38160814Ssimon * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
39160814Ssimon * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
40160814Ssimon * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41160814Ssimon * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
42160814Ssimon * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
43160814Ssimon * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44160814Ssimon * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
45160814Ssimon * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46160814Ssimon * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
47160814Ssimon * OF THE POSSIBILITY OF SUCH DAMAGE.
48160814Ssimon * ====================================================================
49160814Ssimon *
50160814Ssimon * This product includes cryptographic software written by Eric Young
51160814Ssimon * (eay@cryptsoft.com).  This product includes software written by Tim
52160814Ssimon * Hudson (tjh@cryptsoft.com).
53160814Ssimon *
54160814Ssimon */
55160814Ssimon
56296341Sdelphij/*
57296341Sdelphij * NOTE: this file was auto generated by the mkerr.pl script: any changes
58160814Ssimon * made to it will be overwritten when the script next updates this file,
59160814Ssimon * only reason strings will be preserved.
60160814Ssimon */
61160814Ssimon
62160814Ssimon#include <stdio.h>
63160814Ssimon#include <openssl/err.h>
64160814Ssimon#include "e_gmp_err.h"
65160814Ssimon
66160814Ssimon/* BEGIN ERROR CODES */
67160814Ssimon#ifndef OPENSSL_NO_ERR
68160814Ssimon
69296341Sdelphij# define ERR_FUNC(func) ERR_PACK(0,func,0)
70296341Sdelphij# define ERR_REASON(reason) ERR_PACK(0,0,reason)
71160814Ssimon
72296341Sdelphijstatic ERR_STRING_DATA GMP_str_functs[] = {
73296341Sdelphij    {ERR_FUNC(GMP_F_E_GMP_CTRL), "E_GMP_CTRL"},
74296341Sdelphij    {ERR_FUNC(GMP_F_E_GMP_RSA_MOD_EXP), "E_GMP_RSA_MOD_EXP"},
75296341Sdelphij    {0, NULL}
76296341Sdelphij};
77160814Ssimon
78296341Sdelphijstatic ERR_STRING_DATA GMP_str_reasons[] = {
79296341Sdelphij    {ERR_REASON(GMP_R_CTRL_COMMAND_NOT_IMPLEMENTED),
80296341Sdelphij     "ctrl command not implemented"},
81296341Sdelphij    {ERR_REASON(GMP_R_KEY_CONTEXT_ERROR), "key context error"},
82296341Sdelphij    {ERR_REASON(GMP_R_MISSING_KEY_COMPONENTS), "missing key components"},
83296341Sdelphij    {0, NULL}
84296341Sdelphij};
85160814Ssimon
86160814Ssimon#endif
87160814Ssimon
88160814Ssimon#ifdef GMP_LIB_NAME
89296341Sdelphijstatic ERR_STRING_DATA GMP_lib_name[] = {
90296341Sdelphij    {0, GMP_LIB_NAME},
91296341Sdelphij    {0, NULL}
92296341Sdelphij};
93160814Ssimon#endif
94160814Ssimon
95296341Sdelphijstatic int GMP_lib_error_code = 0;
96296341Sdelphijstatic int GMP_error_init = 1;
97160814Ssimon
98160814Ssimonstatic void ERR_load_GMP_strings(void)
99296341Sdelphij{
100296341Sdelphij    if (GMP_lib_error_code == 0)
101296341Sdelphij        GMP_lib_error_code = ERR_get_next_error_library();
102160814Ssimon
103296341Sdelphij    if (GMP_error_init) {
104296341Sdelphij        GMP_error_init = 0;
105160814Ssimon#ifndef OPENSSL_NO_ERR
106296341Sdelphij        ERR_load_strings(GMP_lib_error_code, GMP_str_functs);
107296341Sdelphij        ERR_load_strings(GMP_lib_error_code, GMP_str_reasons);
108160814Ssimon#endif
109160814Ssimon
110160814Ssimon#ifdef GMP_LIB_NAME
111296341Sdelphij        GMP_lib_name->error = ERR_PACK(GMP_lib_error_code, 0, 0);
112296341Sdelphij        ERR_load_strings(0, GMP_lib_name);
113160814Ssimon#endif
114296341Sdelphij    }
115296341Sdelphij}
116160814Ssimon
117160814Ssimonstatic void ERR_unload_GMP_strings(void)
118296341Sdelphij{
119296341Sdelphij    if (GMP_error_init == 0) {
120160814Ssimon#ifndef OPENSSL_NO_ERR
121296341Sdelphij        ERR_unload_strings(GMP_lib_error_code, GMP_str_functs);
122296341Sdelphij        ERR_unload_strings(GMP_lib_error_code, GMP_str_reasons);
123160814Ssimon#endif
124160814Ssimon
125160814Ssimon#ifdef GMP_LIB_NAME
126296341Sdelphij        ERR_unload_strings(0, GMP_lib_name);
127160814Ssimon#endif
128296341Sdelphij        GMP_error_init = 1;
129296341Sdelphij    }
130296341Sdelphij}
131160814Ssimon
132160814Ssimonstatic void ERR_GMP_error(int function, int reason, char *file, int line)
133296341Sdelphij{
134296341Sdelphij    if (GMP_lib_error_code == 0)
135296341Sdelphij        GMP_lib_error_code = ERR_get_next_error_library();
136296341Sdelphij    ERR_PUT_error(GMP_lib_error_code, function, reason, file, line);
137296341Sdelphij}
138