199ebb4caSwyllys /*
299ebb4caSwyllys  * CDDL HEADER START
399ebb4caSwyllys  *
499ebb4caSwyllys  * The contents of this file are subject to the terms of the
599ebb4caSwyllys  * Common Development and Distribution License (the "License").
699ebb4caSwyllys  * You may not use this file except in compliance with the License.
799ebb4caSwyllys  *
899ebb4caSwyllys  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
999ebb4caSwyllys  * or http://www.opensolaris.org/os/licensing.
1099ebb4caSwyllys  * See the License for the specific language governing permissions
1199ebb4caSwyllys  * and limitations under the License.
1299ebb4caSwyllys  *
1399ebb4caSwyllys  * When distributing Covered Code, include this CDDL HEADER in each
1499ebb4caSwyllys  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1599ebb4caSwyllys  * If applicable, add the following below this CDDL HEADER, with the
1699ebb4caSwyllys  * fields enclosed by brackets "[]" replaced with your own identifying
1799ebb4caSwyllys  * information: Portions Copyright [yyyy] [name of copyright owner]
1899ebb4caSwyllys  *
1999ebb4caSwyllys  * CDDL HEADER END
2099ebb4caSwyllys  *
21*431deaa0Shylee  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
2299ebb4caSwyllys  * Use is subject to license terms.
2399ebb4caSwyllys  */
2499ebb4caSwyllys #ifndef	_UTIL_H
2599ebb4caSwyllys #define	_UTIL_H
2699ebb4caSwyllys 
2799ebb4caSwyllys #ifdef	__cplusplus
2899ebb4caSwyllys extern "C" {
2999ebb4caSwyllys #endif
3099ebb4caSwyllys 
3199ebb4caSwyllys #include <kmfapiP.h>
3299ebb4caSwyllys 
3399ebb4caSwyllys 
3499ebb4caSwyllys typedef struct _policy_list {
3599ebb4caSwyllys 	KMF_POLICY_RECORD plc;
3699ebb4caSwyllys 	struct _policy_list *next;
3799ebb4caSwyllys } POLICY_LIST;
3899ebb4caSwyllys 
3999ebb4caSwyllys void free_policy_list(POLICY_LIST *);
4099ebb4caSwyllys int getopt_av(int, char * const *, const char *);
4199ebb4caSwyllys 
4299ebb4caSwyllys int load_policies(char *, POLICY_LIST **);
4399ebb4caSwyllys int get_boolean(char *);
4499ebb4caSwyllys char *get_string(char *, int *err_flag);
4599ebb4caSwyllys int parseEKUOIDs(char *, KMF_POLICY_RECORD *);
4699ebb4caSwyllys int parseEKUNames(char *, KMF_POLICY_RECORD *);
4799ebb4caSwyllys uint16_t parseKUlist(char *);
4899ebb4caSwyllys void print_sanity_error(KMF_RETURN);
4999ebb4caSwyllys 
50*431deaa0Shylee conf_entry_t *get_keystore_entry(char *);
51*431deaa0Shylee 
5299ebb4caSwyllys #define	KC_OK			0
5399ebb4caSwyllys #define	KC_ERR_USAGE		1
5499ebb4caSwyllys #define	KC_ERR_LOADDB		2
5599ebb4caSwyllys #define	KC_ERR_FIND_POLICY	3
5699ebb4caSwyllys #define	KC_ERR_DELETE_POLICY	4
5799ebb4caSwyllys #define	KC_ERR_ADD_POLICY	5
5899ebb4caSwyllys #define	KC_ERR_VERIFY_POLICY	6
5999ebb4caSwyllys #define	KC_ERR_INCOMPLETE_POLICY 7
6099ebb4caSwyllys #define	KC_ERR_MEMORY		8
6199ebb4caSwyllys #define	KC_ERR_ACCESS		9
62*431deaa0Shylee #define	KC_ERR_INSTALL		10
63*431deaa0Shylee #define	KC_ERR_UNINSTALL	11
64*431deaa0Shylee #define	KC_ERR_MODIFY_PLUGIN	12
65*431deaa0Shylee 
66*431deaa0Shylee #define	CONF_TEMPFILE	"/etc/crypto/kmfXXXXXX"
6799ebb4caSwyllys 
6899ebb4caSwyllys #ifdef __cplusplus
6999ebb4caSwyllys }
7099ebb4caSwyllys #endif
7199ebb4caSwyllys #endif /* _UTIL_H */
72