xref: /titanic_50/usr/src/cmd/cmd-inet/usr.sbin/kssl/kssladm/kssladm.h (revision 1bdd6c0e3710e91cb1f31aa78de33cb638494480)
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 2007 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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 /*
33  * Common routines and variables used by kssladm files.
34  */
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 #include <netinet/in.h>
41 #include <kmfapi.h>
42 
43 #define	SUCCESS		0
44 #define	FAILURE		1
45 #define	ERROR_USAGE	2
46 
47 #define	MAX_CHAIN_LENGTH	12
48 #define	REPORT_KMF_ERROR(r, t, e) { \
49 	(void) KMF_GetKMFErrorString(r, &e); \
50 	(void) fprintf(stderr, t ": %s\n", \
51 		(e != NULL ? e : "<unknown error>")); \
52 	if (e) free(e); \
53 }
54 
55 #define	MAX_ATTR_CNT	8
56 
57 extern boolean_t verbose;
58 
59 extern int do_create(int argc, char *argv[]);
60 extern int do_delete(int argc, char *argv[]);
61 extern void usage_create(boolean_t do_print);
62 extern void usage_delete(boolean_t do_print);
63 
64 extern int PEM_get_rsa_key_certs(KMF_HANDLE_T, const char *,
65     char *, KMF_RAW_KEY_DATA **, KMF_X509_DER_CERT **);
66 
67 extern int PKCS12_get_rsa_key_certs(KMF_HANDLE_T, const char *,
68     const char *, KMF_RAW_KEY_DATA **, KMF_X509_DER_CERT **);
69 
70 extern int get_passphrase(const char *password_file, char *buf, int buf_size);
71 extern int kssl_send_command(char *buf, int cmd);
72 extern int parse_and_set_addr(char *arg1, char *arg2, struct sockaddr_in *addr);
73 
74 #ifdef __cplusplus
75 }
76 #endif
77 
78 #endif /* _KSSLADM_H */
79