xref: /titanic_41/usr/src/common/net/wanboot/p12err.h (revision e4f5a11d4a234623168c1558fcdf4341e11769e1)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_P12ERR_H
28 #define	_P12ERR_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 extern void ERR_load_SUNW_strings(void);
37 extern void ERR_SUNW_error(int function, int reason, char *file, int line);
38 
39 #define	SUNW_LIB_NAME	"SUNW_PKCS12"
40 #define	SUNWerr(f, r)	ERR_SUNW_error((f), (r), __FILE__, __LINE__)
41 
42 /* Error codes for the SUNW functions. */
43 /* OpenSSL prefers codes to start at 100 */
44 
45 /* Function codes. */
46 typedef enum {
47 	SUNW_F_USE_X509CERT = 100,
48 	SUNW_F_USE_PKEY,
49 	SUNW_F_USE_TASTORE,
50 	SUNW_F_USE_CERTFILE,
51 	SUNW_F_USE_KEYFILE,
52 	SUNW_F_USE_TRUSTFILE,
53 	SUNW_F_READ_FILE,
54 	SUNW_F_DOPARSE,
55 	SUNW_F_PKCS12_PARSE,
56 	SUNW_F_PKCS12_CONTENTS,
57 	SUNW_F_PARSE_ONE_BAG,
58 	SUNW_F_PKCS12_CREATE,
59 	SUNW_F_SPLIT_CERTS,
60 	SUNW_F_FIND_LOCALKEYID,
61 	SUNW_F_SET_LOCALKEYID,
62 	SUNW_F_GET_LOCALKEYID,
63 	SUNW_F_GET_PKEY_FNAME,
64 	SUNW_F_APPEND_KEYS,
65 	SUNW_F_PEM_CONTENTS,
66 	SUNW_F_PEM_INFO,
67 	SUNW_F_ASC2BMPSTRING,
68 	SUNW_F_UTF82ASCSTR,
69 	SUNW_F_FINDATTR,
70 	SUNW_F_TYPE2ATTRIB,
71 	SUNW_F_MOVE_CERTS,
72 	SUNW_F_FIND_FNAME,
73 	SUNW_F_PARSE_OUTER,
74 	SUNW_F_CHECKFILE
75 } sunw_err_func_t;
76 
77 /* Reason codes. */
78 typedef enum {
79 	SUNW_R_INVALID_ARG = 100,
80 	SUNW_R_MEMORY_FAILURE,
81 	SUNW_R_MAC_VERIFY_FAILURE,
82 	SUNW_R_MAC_CREATE_FAILURE,
83 	SUNW_R_BAD_FILETYPE,
84 	SUNW_R_BAD_PKEY,
85 	SUNW_R_BAD_PKEYTYPE,
86 	SUNW_R_PKEY_READ_ERR,
87 	SUNW_R_NO_TRUST_ANCHOR,
88 	SUNW_R_READ_TRUST_ERR,
89 	SUNW_R_ADD_TRUST_ERR,
90 	SUNW_R_PKCS12_PARSE_ERR,
91 	SUNW_R_PKCS12_CREATE_ERR,
92 	SUNW_R_PARSE_BAG_ERR,
93 	SUNW_R_MAKE_BAG_ERR,
94 	SUNW_R_BAD_CERTTYPE,
95 	SUNW_R_PARSE_CERT_ERR,
96 	SUNW_R_BAD_LKID,
97 	SUNW_R_SET_LKID_ERR,
98 	SUNW_R_BAD_FNAME,
99 	SUNW_R_SET_FNAME_ERR,
100 	SUNW_R_BAD_TRUST,
101 	SUNW_R_BAD_BAGTYPE,
102 	SUNW_R_CERT_ERR,
103 	SUNW_R_PKEY_ERR,
104 	SUNW_R_READ_ERR,
105 	SUNW_R_ADD_ATTR_ERR,
106 	SUNW_R_STR_CONVERT_ERR,
107 	SUNW_R_PKCS12_EMPTY_ERR,
108 	SUNW_R_PASSWORD_ERR
109 } sunw_err_reason_t;
110 
111 #ifdef	__cplusplus
112 }
113 #endif
114 
115 #endif	/* _P12ERR_H */
116