xref: /onnv-gate/usr/src/cmd/cmd-inet/usr.sbin/kssl/kssladm/kssladm.h (revision 11462:0e7751e37640)
1898Skais /*
2898Skais  * CDDL HEADER START
3898Skais  *
4898Skais  * The contents of this file are subject to the terms of the
51933Skrishna  * Common Development and Distribution License (the "License").
61933Skrishna  * You may not use this file except in compliance with the License.
7898Skais  *
8898Skais  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9898Skais  * or http://www.opensolaris.org/os/licensing.
10898Skais  * See the License for the specific language governing permissions
11898Skais  * and limitations under the License.
12898Skais  *
13898Skais  * When distributing Covered Code, include this CDDL HEADER in each
14898Skais  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15898Skais  * If applicable, add the following below this CDDL HEADER, with the
16898Skais  * fields enclosed by brackets "[]" replaced with your own identifying
17898Skais  * information: Portions Copyright [yyyy] [name of copyright owner]
18898Skais  *
19898Skais  * CDDL HEADER END
20898Skais  */
211933Skrishna 
22898Skais /*
23*11462Swyllys.ingersoll@sun.com  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
24898Skais  * Use is subject to license terms.
25898Skais  */
26898Skais 
27898Skais #ifndef _KSSLADM_H
28898Skais #define	_KSSLADM_H
29898Skais 
30898Skais /*
31898Skais  * Common routines and variables used by kssladm files.
32898Skais  */
33898Skais 
34898Skais #ifdef __cplusplus
35898Skais extern "C" {
36898Skais #endif
37898Skais 
38898Skais #include <netinet/in.h>
393408Swyllys #include <kmfapi.h>
40898Skais 
41898Skais #define	SUCCESS		0
42898Skais #define	FAILURE		1
43898Skais #define	ERROR_USAGE	2
44898Skais 
451933Skrishna #define	MAX_CHAIN_LENGTH	12
463408Swyllys #define	REPORT_KMF_ERROR(r, t, e) { \
47*11462Swyllys.ingersoll@sun.com 	(void) kmf_get_kmf_error_str(r, &e); \
483408Swyllys 	(void) fprintf(stderr, t ": %s\n", \
493408Swyllys 		(e != NULL ? e : "<unknown error>")); \
503408Swyllys 	if (e) free(e); \
513408Swyllys }
523408Swyllys 
533408Swyllys #define	MAX_ATTR_CNT	8
541933Skrishna 
55898Skais extern boolean_t verbose;
56898Skais 
57898Skais extern int do_create(int argc, char *argv[]);
58898Skais extern int do_delete(int argc, char *argv[]);
59898Skais extern void usage_create(boolean_t do_print);
60898Skais extern void usage_delete(boolean_t do_print);
61898Skais 
625536Swyllys extern int PEM_get_rsa_key_certs(KMF_HANDLE_T, const char *,
635536Swyllys     char *, KMF_RAW_KEY_DATA **, KMF_X509_DER_CERT **);
643408Swyllys 
655536Swyllys extern int PKCS12_get_rsa_key_certs(KMF_HANDLE_T, const char *,
665536Swyllys     const char *, KMF_RAW_KEY_DATA **, KMF_X509_DER_CERT **);
673408Swyllys 
68898Skais extern int get_passphrase(const char *password_file, char *buf, int buf_size);
69898Skais extern int kssl_send_command(char *buf, int cmd);
7010520SBhargava.Yenduri@Sun.COM extern int parse_and_set_addr(char *arg1, char *arg2,
7110520SBhargava.Yenduri@Sun.COM     struct sockaddr_in6 *addr);
72898Skais 
73898Skais #ifdef __cplusplus
74898Skais }
75898Skais #endif
76898Skais 
77898Skais #endif /* _KSSLADM_H */
78