99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys/*
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys * CDDL HEADER START
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys *
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys * The contents of this file are subject to the terms of the
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys * Common Development and Distribution License (the "License").
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys * You may not use this file except in compliance with the License.
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys *
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys * or http://www.opensolaris.org/os/licensing.
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys * See the License for the specific language governing permissions
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys * and limitations under the License.
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys *
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys * When distributing Covered Code, include this CDDL HEADER in each
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys * If applicable, add the following below this CDDL HEADER, with the
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys * fields enclosed by brackets "[]" replaced with your own identifying
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys * information: Portions Copyright [yyyy] [name of copyright owner]
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys *
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys * CDDL HEADER END
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys *
431deaa01ac039d796fdfaf86b909a75e7d9ac48hylee * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys * Use is subject to license terms.
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys */
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys#ifndef _UTIL_H
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys#define _UTIL_H
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys#pragma ident "%Z%%M% %I% %E% SMI"
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys#ifdef __cplusplus
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllysextern "C" {
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys#endif
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys#include <kmfapiP.h>
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllystypedef struct _policy_list {
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys KMF_POLICY_RECORD plc;
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys struct _policy_list *next;
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys} POLICY_LIST;
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllysvoid free_policy_list(POLICY_LIST *);
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllysint getopt_av(int, char * const *, const char *);
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllysint load_policies(char *, POLICY_LIST **);
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllysint get_boolean(char *);
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllyschar *get_string(char *, int *err_flag);
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllysint parseEKUOIDs(char *, KMF_POLICY_RECORD *);
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllysint parseEKUNames(char *, KMF_POLICY_RECORD *);
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllysuint16_t parseKUlist(char *);
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllysvoid print_sanity_error(KMF_RETURN);
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys
431deaa01ac039d796fdfaf86b909a75e7d9ac48hyleeconf_entry_t *get_keystore_entry(char *);
431deaa01ac039d796fdfaf86b909a75e7d9ac48hylee
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys#define KC_OK 0
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys#define KC_ERR_USAGE 1
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys#define KC_ERR_LOADDB 2
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys#define KC_ERR_FIND_POLICY 3
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys#define KC_ERR_DELETE_POLICY 4
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys#define KC_ERR_ADD_POLICY 5
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys#define KC_ERR_VERIFY_POLICY 6
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys#define KC_ERR_INCOMPLETE_POLICY 7
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys#define KC_ERR_MEMORY 8
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys#define KC_ERR_ACCESS 9
431deaa01ac039d796fdfaf86b909a75e7d9ac48hylee#define KC_ERR_INSTALL 10
431deaa01ac039d796fdfaf86b909a75e7d9ac48hylee#define KC_ERR_UNINSTALL 11
431deaa01ac039d796fdfaf86b909a75e7d9ac48hylee#define KC_ERR_MODIFY_PLUGIN 12
431deaa01ac039d796fdfaf86b909a75e7d9ac48hylee
431deaa01ac039d796fdfaf86b909a75e7d9ac48hylee#define CONF_TEMPFILE "/etc/crypto/kmfXXXXXX"
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys#ifdef __cplusplus
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys}
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys#endif
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys#endif /* _UTIL_H */