xref: /titanic_52/usr/src/cmd/cmd-inet/usr.sbin/kssl/kssladm/kssladm.h (revision 9f0bc604621fbb9b9b038e6de7da8f9c46e28608)
1c28749e9Skais /*
2c28749e9Skais  * CDDL HEADER START
3c28749e9Skais  *
4c28749e9Skais  * The contents of this file are subject to the terms of the
5164c0dd6Skrishna  * Common Development and Distribution License (the "License").
6164c0dd6Skrishna  * You may not use this file except in compliance with the License.
7c28749e9Skais  *
8c28749e9Skais  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9c28749e9Skais  * or http://www.opensolaris.org/os/licensing.
10c28749e9Skais  * See the License for the specific language governing permissions
11c28749e9Skais  * and limitations under the License.
12c28749e9Skais  *
13c28749e9Skais  * When distributing Covered Code, include this CDDL HEADER in each
14c28749e9Skais  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15c28749e9Skais  * If applicable, add the following below this CDDL HEADER, with the
16c28749e9Skais  * fields enclosed by brackets "[]" replaced with your own identifying
17c28749e9Skais  * information: Portions Copyright [yyyy] [name of copyright owner]
18c28749e9Skais  *
19c28749e9Skais  * CDDL HEADER END
20c28749e9Skais  */
21164c0dd6Skrishna 
22c28749e9Skais /*
23*9f0bc604SWyllys Ingersoll  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
24c28749e9Skais  * Use is subject to license terms.
25c28749e9Skais  */
26c28749e9Skais 
27c28749e9Skais #ifndef _KSSLADM_H
28c28749e9Skais #define	_KSSLADM_H
29c28749e9Skais 
30c28749e9Skais /*
31c28749e9Skais  * Common routines and variables used by kssladm files.
32c28749e9Skais  */
33c28749e9Skais 
34c28749e9Skais #ifdef __cplusplus
35c28749e9Skais extern "C" {
36c28749e9Skais #endif
37c28749e9Skais 
38c28749e9Skais #include <netinet/in.h>
3971593db2Swyllys #include <kmfapi.h>
40c28749e9Skais 
41c28749e9Skais #define	SUCCESS		0
42c28749e9Skais #define	FAILURE		1
43c28749e9Skais #define	ERROR_USAGE	2
44c28749e9Skais 
45164c0dd6Skrishna #define	MAX_CHAIN_LENGTH	12
4671593db2Swyllys #define	REPORT_KMF_ERROR(r, t, e) { \
47*9f0bc604SWyllys Ingersoll 	(void) kmf_get_kmf_error_str(r, &e); \
4871593db2Swyllys 	(void) fprintf(stderr, t ": %s\n", \
4971593db2Swyllys 		(e != NULL ? e : "<unknown error>")); \
5071593db2Swyllys 	if (e) free(e); \
5171593db2Swyllys }
5271593db2Swyllys 
5371593db2Swyllys #define	MAX_ATTR_CNT	8
54164c0dd6Skrishna 
55c28749e9Skais extern boolean_t verbose;
56c28749e9Skais 
57c28749e9Skais extern int do_create(int argc, char *argv[]);
58c28749e9Skais extern int do_delete(int argc, char *argv[]);
59c28749e9Skais extern void usage_create(boolean_t do_print);
60c28749e9Skais extern void usage_delete(boolean_t do_print);
61c28749e9Skais 
625b3e1433Swyllys extern int PEM_get_rsa_key_certs(KMF_HANDLE_T, const char *,
635b3e1433Swyllys     char *, KMF_RAW_KEY_DATA **, KMF_X509_DER_CERT **);
6471593db2Swyllys 
655b3e1433Swyllys extern int PKCS12_get_rsa_key_certs(KMF_HANDLE_T, const char *,
665b3e1433Swyllys     const char *, KMF_RAW_KEY_DATA **, KMF_X509_DER_CERT **);
6771593db2Swyllys 
68c28749e9Skais extern int get_passphrase(const char *password_file, char *buf, int buf_size);
69c28749e9Skais extern int kssl_send_command(char *buf, int cmd);
702ec7cc7fSKrishna Yenduri extern int parse_and_set_addr(char *arg1, char *arg2,
712ec7cc7fSKrishna Yenduri     struct sockaddr_in6 *addr);
72c28749e9Skais 
73c28749e9Skais #ifdef __cplusplus
74c28749e9Skais }
75c28749e9Skais #endif
76c28749e9Skais 
77c28749e9Skais #endif /* _KSSLADM_H */
78