xref: /onnv-gate/usr/src/cmd/cmd-crypto/kmfcfg/util.h (revision 5626:1f8878c75f54)
13089Swyllys /*
23089Swyllys  * CDDL HEADER START
33089Swyllys  *
43089Swyllys  * The contents of this file are subject to the terms of the
53089Swyllys  * Common Development and Distribution License (the "License").
63089Swyllys  * You may not use this file except in compliance with the License.
73089Swyllys  *
83089Swyllys  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
93089Swyllys  * or http://www.opensolaris.org/os/licensing.
103089Swyllys  * See the License for the specific language governing permissions
113089Swyllys  * and limitations under the License.
123089Swyllys  *
133089Swyllys  * When distributing Covered Code, include this CDDL HEADER in each
143089Swyllys  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
153089Swyllys  * If applicable, add the following below this CDDL HEADER, with the
163089Swyllys  * fields enclosed by brackets "[]" replaced with your own identifying
173089Swyllys  * information: Portions Copyright [yyyy] [name of copyright owner]
183089Swyllys  *
193089Swyllys  * CDDL HEADER END
203089Swyllys  *
21*5626Shylee  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
223089Swyllys  * Use is subject to license terms.
233089Swyllys  */
243089Swyllys #ifndef	_UTIL_H
253089Swyllys #define	_UTIL_H
263089Swyllys 
273089Swyllys #pragma ident	"%Z%%M%	%I%	%E% SMI"
283089Swyllys 
293089Swyllys #ifdef	__cplusplus
303089Swyllys extern "C" {
313089Swyllys #endif
323089Swyllys 
333089Swyllys #include <kmfapiP.h>
343089Swyllys 
353089Swyllys 
363089Swyllys typedef struct _policy_list {
373089Swyllys 	KMF_POLICY_RECORD plc;
383089Swyllys 	struct _policy_list *next;
393089Swyllys } POLICY_LIST;
403089Swyllys 
413089Swyllys void free_policy_list(POLICY_LIST *);
423089Swyllys int getopt_av(int, char * const *, const char *);
433089Swyllys 
443089Swyllys int load_policies(char *, POLICY_LIST **);
453089Swyllys int get_boolean(char *);
463089Swyllys char *get_string(char *, int *err_flag);
473089Swyllys int parseEKUOIDs(char *, KMF_POLICY_RECORD *);
483089Swyllys int parseEKUNames(char *, KMF_POLICY_RECORD *);
493089Swyllys uint16_t parseKUlist(char *);
503089Swyllys void print_sanity_error(KMF_RETURN);
513089Swyllys 
52*5626Shylee conf_entry_t *get_keystore_entry(char *);
53*5626Shylee 
543089Swyllys #define	KC_OK			0
553089Swyllys #define	KC_ERR_USAGE		1
563089Swyllys #define	KC_ERR_LOADDB		2
573089Swyllys #define	KC_ERR_FIND_POLICY	3
583089Swyllys #define	KC_ERR_DELETE_POLICY	4
593089Swyllys #define	KC_ERR_ADD_POLICY	5
603089Swyllys #define	KC_ERR_VERIFY_POLICY	6
613089Swyllys #define	KC_ERR_INCOMPLETE_POLICY 7
623089Swyllys #define	KC_ERR_MEMORY		8
633089Swyllys #define	KC_ERR_ACCESS		9
64*5626Shylee #define	KC_ERR_INSTALL		10
65*5626Shylee #define	KC_ERR_UNINSTALL	11
66*5626Shylee #define	KC_ERR_MODIFY_PLUGIN	12
67*5626Shylee 
68*5626Shylee #define	CONF_TEMPFILE	"/etc/crypto/kmfXXXXXX"
693089Swyllys 
703089Swyllys #ifdef __cplusplus
713089Swyllys }
723089Swyllys #endif
733089Swyllys #endif /* _UTIL_H */
74