7fd239087e8b3f75c7e2dd82987b92e5553b43de
[openssl.git] / crypto / pkcs12 / pk12err.c
1 /* lib/pkcs12/pkcs12_err.c */
2 /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
3  * All rights reserved.
4  *
5  * This package is an SSL implementation written
6  * by Eric Young (eay@cryptsoft.com).
7  * The implementation was written so as to conform with Netscapes SSL.
8  * 
9  * This library is free for commercial and non-commercial use as long as
10  * the following conditions are aheared to.  The following conditions
11  * apply to all code found in this distribution, be it the RC4, RSA,
12  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
13  * included with this distribution is covered by the same copyright terms
14  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15  * 
16  * Copyright remains Eric Young's, and as such any Copyright notices in
17  * the code are not to be removed.
18  * If this package is used in a product, Eric Young should be given attribution
19  * as the author of the parts of the library used.
20  * This can be in the form of a textual message at program startup or
21  * in documentation (online or textual) provided with the package.
22  * 
23  * Redistribution and use in source and binary forms, with or without
24  * modification, are permitted provided that the following conditions
25  * are met:
26  * 1. Redistributions of source code must retain the copyright
27  *    notice, this list of conditions and the following disclaimer.
28  * 2. Redistributions in binary form must reproduce the above copyright
29  *    notice, this list of conditions and the following disclaimer in the
30  *    documentation and/or other materials provided with the distribution.
31  * 3. All advertising materials mentioning features or use of this software
32  *    must display the following acknowledgement:
33  *    "This product includes cryptographic software written by
34  *     Eric Young (eay@cryptsoft.com)"
35  *    The word 'cryptographic' can be left out if the rouines from the library
36  *    being used are not cryptographic related :-).
37  * 4. If you include any Windows specific code (or a derivative thereof) from 
38  *    the apps directory (application code) you must include an acknowledgement:
39  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40  * 
41  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51  * SUCH DAMAGE.
52  * 
53  * The licence and distribution terms for any publically available version or
54  * derivative of this code cannot be changed.  i.e. this code cannot simply be
55  * copied and put under another distribution licence
56  * [including the GNU Public Licence.]
57  */
58 #include <stdio.h>
59 #include <openssl/err.h>
60 #include <openssl/pkcs12.h>
61
62 /* BEGIN ERROR CODES */
63 #ifndef NO_ERR
64 static ERR_STRING_DATA PKCS12_str_functs[]=
65         {
66 {ERR_PACK(0,PKCS12_F_ADD_FRIENDLYNAME,0),       "ADD_FRIENDLYNAME"},
67 {ERR_PACK(0,PKCS12_F_ADD_FRIENDLYNAME_ASC,0),   "ADD_FRIENDLYNAME_ASC"},
68 {ERR_PACK(0,PKCS12_F_ADD_FRIENDLYNAME_UNI,0),   "ADD_FRIENDLYNAME_UNI"},
69 {ERR_PACK(0,PKCS12_F_PARSE_BAGS,0),     "PARSE_BAGS"},
70 {ERR_PACK(0,PKCS12_F_PKCS12_ADD_LOCALKEYID,0),  "PKCS12_add_localkeyid"},
71 {ERR_PACK(0,PKCS12_F_PKCS12_CREATE,0),  "PKCS12_create"},
72 {ERR_PACK(0,PKCS12_F_PKCS12_DECRYPT_D2I,0),     "PKCS12_decrypt_d2i"},
73 {ERR_PACK(0,PKCS12_F_PKCS12_GEN_MAC,0), "PKCS12_gen_mac"},
74 {ERR_PACK(0,PKCS12_F_PKCS12_I2D_ENCRYPT,0),     "PKCS12_i2d_encrypt"},
75 {ERR_PACK(0,PKCS12_F_PKCS12_INIT,0),    "PKCS12_init"},
76 {ERR_PACK(0,PKCS12_F_PKCS12_KEY_GEN_ASC,0),     "PKCS12_key_gen_asc"},
77 {ERR_PACK(0,PKCS12_F_PKCS12_KEY_GEN_UNI,0),     "PKCS12_key_gen_uni"},
78 {ERR_PACK(0,PKCS12_F_PKCS12_MAKE_SAFEBAG,0),    "PKCS12_MAKE_SAFEBAG"},
79 {ERR_PACK(0,PKCS12_F_PKCS12_MAKE_SHKEYBAG,0),   "PKCS12_MAKE_SHKEYBAG"},
80 {ERR_PACK(0,PKCS12_F_PKCS12_PACK_P7DATA,0),     "PKCS12_pack_p7data"},
81 {ERR_PACK(0,PKCS12_F_PKCS12_PACK_P7ENCDATA,0),  "PKCS12_pack_p7encdata"},
82 {ERR_PACK(0,PKCS12_F_PKCS12_PACK_P7_DATA,0),    "PKCS12_PACK_P7_DATA"},
83 {ERR_PACK(0,PKCS12_F_PKCS12_PACK_SAFEBAG,0),    "PKCS12_pack_safebag"},
84 {ERR_PACK(0,PKCS12_F_PKCS12_PARSE,0),   "PKCS12_parse"},
85 {ERR_PACK(0,PKCS12_F_PKCS12_PBE_CRYPT,0),       "PKCS12_pbe_crypt"},
86 {ERR_PACK(0,PKCS12_F_PKCS12_PBE_KEYIVGEN,0),    "PKCS12_PBE_KEYIVGEN"},
87 {ERR_PACK(0,PKCS12_F_PKCS12_PKCS12_SET_MAC,0),  "PKCS12_PKCS12_SET_MAC"},
88 {ERR_PACK(0,PKCS12_F_PKCS12_SETUP_MAC,0),       "PKCS12_setup_mac"},
89 {ERR_PACK(0,PKCS12_F_PKCS12_SET_MAC,0), "PKCS12_set_mac"},
90 {ERR_PACK(0,PKCS12_F_PKCS8_ADD_KEYUSAGE,0),     "PKCS8_add_keyusage"},
91 {ERR_PACK(0,PKCS12_F_PKCS8_ENCRYPT,0),  "PKCS8_encrypt"},
92 {ERR_PACK(0,PKCS12_F_VERIFY_MAC,0),     "VERIFY_MAC"},
93 {0,NULL},
94         };
95
96 static ERR_STRING_DATA PKCS12_str_reasons[]=
97         {
98 {PKCS12_R_CANT_PACK_STRUCTURE            ,"cant pack structure"},
99 {PKCS12_R_DECODE_ERROR                   ,"decode error"},
100 {PKCS12_R_ENCODE_ERROR                   ,"encode error"},
101 {PKCS12_R_ENCRYPT_ERROR                  ,"encrypt error"},
102 {PKCS12_R_INVALID_NULL_ARGUMENT          ,"invalid null argument"},
103 {PKCS12_R_INVALID_NULL_PKCS12_POINTER    ,"invalid null pkcs12 pointer"},
104 {PKCS12_R_IV_GEN_ERROR                   ,"iv gen error"},
105 {PKCS12_R_KEY_GEN_ERROR                  ,"key gen error"},
106 {PKCS12_R_MAC_ABSENT                     ,"mac absent"},
107 {PKCS12_R_MAC_GENERATION_ERROR           ,"mac generation error"},
108 {PKCS12_R_MAC_SETUP_ERROR                ,"mac setup error"},
109 {PKCS12_R_MAC_STRING_SET_ERROR           ,"mac string set error"},
110 {PKCS12_R_MAC_VERIFY_ERROR               ,"mac verify error"},
111 {PKCS12_R_MAC_VERIFY_FAILURE             ,"mac verify failure"},
112 {PKCS12_R_PARSE_ERROR                    ,"parse error"},
113 {PKCS12_R_PKCS12_ALGOR_CIPHERINIT_ERROR  ,"pkcs12 algor cipherinit error"},
114 {PKCS12_R_PKCS12_CIPHERFINAL_ERROR       ,"pkcs12 cipherfinal error"},
115 {PKCS12_R_PKCS12_PBE_CRYPT_ERROR         ,"pkcs12 pbe crypt error"},
116 {PKCS12_R_UNKNOWN_DIGEST_ALGORITHM       ,"unknown digest algorithm"},
117 {PKCS12_R_UNSUPPORTED_PKCS12_MODE        ,"unsupported pkcs12 mode"},
118 {0,NULL},
119         };
120
121 #endif
122
123 void ERR_load_PKCS12_strings(void)
124         {
125         static int init=1;
126
127         if (init)
128                 {
129                 init=0;
130 #ifndef NO_ERR
131                 ERR_load_strings(ERR_LIB_PKCS12,PKCS12_str_functs);
132                 ERR_load_strings(ERR_LIB_PKCS12,PKCS12_str_reasons);
133 #endif
134
135                 }
136         }