xref: /titanic_41/usr/src/cmd/cmd-inet/usr.sbin/kssl/kssladm/kssladm.h (revision 9f0bc604621fbb9b9b038e6de7da8f9c46e28608)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _KSSLADM_H
28 #define	_KSSLADM_H
29 
30 /*
31  * Common routines and variables used by kssladm files.
32  */
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 #include <netinet/in.h>
39 #include <kmfapi.h>
40 
41 #define	SUCCESS		0
42 #define	FAILURE		1
43 #define	ERROR_USAGE	2
44 
45 #define	MAX_CHAIN_LENGTH	12
46 #define	REPORT_KMF_ERROR(r, t, e) { \
47 	(void) kmf_get_kmf_error_str(r, &e); \
48 	(void) fprintf(stderr, t ": %s\n", \
49 		(e != NULL ? e : "<unknown error>")); \
50 	if (e) free(e); \
51 }
52 
53 #define	MAX_ATTR_CNT	8
54 
55 extern boolean_t verbose;
56 
57 extern int do_create(int argc, char *argv[]);
58 extern int do_delete(int argc, char *argv[]);
59 extern void usage_create(boolean_t do_print);
60 extern void usage_delete(boolean_t do_print);
61 
62 extern int PEM_get_rsa_key_certs(KMF_HANDLE_T, const char *,
63     char *, KMF_RAW_KEY_DATA **, KMF_X509_DER_CERT **);
64 
65 extern int PKCS12_get_rsa_key_certs(KMF_HANDLE_T, const char *,
66     const char *, KMF_RAW_KEY_DATA **, KMF_X509_DER_CERT **);
67 
68 extern int get_passphrase(const char *password_file, char *buf, int buf_size);
69 extern int kssl_send_command(char *buf, int cmd);
70 extern int parse_and_set_addr(char *arg1, char *arg2,
71     struct sockaddr_in6 *addr);
72 
73 #ifdef __cplusplus
74 }
75 #endif
76 
77 #endif /* _KSSLADM_H */
78