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