xref: /illumos-gate/usr/src/cmd/cmd-crypto/kmfcfg/util.h (revision 431deaa01ac039d796fdfaf86b909a75e7d9ac48)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
2899ebb4caSwyllys 
2999ebb4caSwyllys #ifdef	__cplusplus
3099ebb4caSwyllys extern "C" {
3199ebb4caSwyllys #endif
3299ebb4caSwyllys 
3399ebb4caSwyllys #include <kmfapiP.h>
3499ebb4caSwyllys 
3599ebb4caSwyllys 
3699ebb4caSwyllys typedef struct _policy_list {
3799ebb4caSwyllys 	KMF_POLICY_RECORD plc;
3899ebb4caSwyllys 	struct _policy_list *next;
3999ebb4caSwyllys } POLICY_LIST;
4099ebb4caSwyllys 
4199ebb4caSwyllys void free_policy_list(POLICY_LIST *);
4299ebb4caSwyllys int getopt_av(int, char * const *, const char *);
4399ebb4caSwyllys 
4499ebb4caSwyllys int load_policies(char *, POLICY_LIST **);
4599ebb4caSwyllys int get_boolean(char *);
4699ebb4caSwyllys char *get_string(char *, int *err_flag);
4799ebb4caSwyllys int parseEKUOIDs(char *, KMF_POLICY_RECORD *);
4899ebb4caSwyllys int parseEKUNames(char *, KMF_POLICY_RECORD *);
4999ebb4caSwyllys uint16_t parseKUlist(char *);
5099ebb4caSwyllys void print_sanity_error(KMF_RETURN);
5199ebb4caSwyllys 
52*431deaa0Shylee conf_entry_t *get_keystore_entry(char *);
53*431deaa0Shylee 
5499ebb4caSwyllys #define	KC_OK			0
5599ebb4caSwyllys #define	KC_ERR_USAGE		1
5699ebb4caSwyllys #define	KC_ERR_LOADDB		2
5799ebb4caSwyllys #define	KC_ERR_FIND_POLICY	3
5899ebb4caSwyllys #define	KC_ERR_DELETE_POLICY	4
5999ebb4caSwyllys #define	KC_ERR_ADD_POLICY	5
6099ebb4caSwyllys #define	KC_ERR_VERIFY_POLICY	6
6199ebb4caSwyllys #define	KC_ERR_INCOMPLETE_POLICY 7
6299ebb4caSwyllys #define	KC_ERR_MEMORY		8
6399ebb4caSwyllys #define	KC_ERR_ACCESS		9
64*431deaa0Shylee #define	KC_ERR_INSTALL		10
65*431deaa0Shylee #define	KC_ERR_UNINSTALL	11
66*431deaa0Shylee #define	KC_ERR_MODIFY_PLUGIN	12
67*431deaa0Shylee 
68*431deaa0Shylee #define	CONF_TEMPFILE	"/etc/crypto/kmfXXXXXX"
6999ebb4caSwyllys 
7099ebb4caSwyllys #ifdef __cplusplus
7199ebb4caSwyllys }
7299ebb4caSwyllys #endif
7399ebb4caSwyllys #endif /* _UTIL_H */
74