1*269e59f9SJan Pechanec /*
2*269e59f9SJan Pechanec  * CDDL HEADER START
3*269e59f9SJan Pechanec  *
4*269e59f9SJan Pechanec  * The contents of this file are subject to the terms of the
5*269e59f9SJan Pechanec  * Common Development and Distribution License (the "License").
6*269e59f9SJan Pechanec  * You may not use this file except in compliance with the License.
7*269e59f9SJan Pechanec  *
8*269e59f9SJan Pechanec  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*269e59f9SJan Pechanec  * or http://www.opensolaris.org/os/licensing.
10*269e59f9SJan Pechanec  * See the License for the specific language governing permissions
11*269e59f9SJan Pechanec  * and limitations under the License.
12*269e59f9SJan Pechanec  *
13*269e59f9SJan Pechanec  * When distributing Covered Code, include this CDDL HEADER in each
14*269e59f9SJan Pechanec  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*269e59f9SJan Pechanec  * If applicable, add the following below this CDDL HEADER, with the
16*269e59f9SJan Pechanec  * fields enclosed by brackets "[]" replaced with your own identifying
17*269e59f9SJan Pechanec  * information: Portions Copyright [yyyy] [name of copyright owner]
18*269e59f9SJan Pechanec  *
19*269e59f9SJan Pechanec  * CDDL HEADER END
20*269e59f9SJan Pechanec  *
21*269e59f9SJan Pechanec  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
22*269e59f9SJan Pechanec  *
23*269e59f9SJan Pechanec  * This is a private header file for the KMF certificate to name mapping
24*269e59f9SJan Pechanec  * framework.
25*269e59f9SJan Pechanec  */
26*269e59f9SJan Pechanec #ifndef _KMFMAPPER_H
27*269e59f9SJan Pechanec #define	_KMFMAPPER_H
28*269e59f9SJan Pechanec 
29*269e59f9SJan Pechanec #ifdef __cplusplus
30*269e59f9SJan Pechanec extern "C" {
31*269e59f9SJan Pechanec #endif
32*269e59f9SJan Pechanec 
33*269e59f9SJan Pechanec #define	MAPPER_NAME_TEMPLATE "kmf_mapper_%s.so.1"
34*269e59f9SJan Pechanec 
35*269e59f9SJan Pechanec #define	MAPPER_ERROR_STRING_FUNCTION "mapper_get_error_str"
36*269e59f9SJan Pechanec #define	MAP_CERT_TO_NAME_FUNCTION "mapper_map_cert_to_name"
37*269e59f9SJan Pechanec #define	MATCH_CERT_TO_NAME_FUNCTION "mapper_match_cert_to_name"
38*269e59f9SJan Pechanec #define	MAPPER_FINISH_FUNCTION "mapper_finalize"
39*269e59f9SJan Pechanec #define	MAPPER_INIT_FUNCTION "mapper_initialize"
40*269e59f9SJan Pechanec 
41*269e59f9SJan Pechanec /* KMF mapper policy record. */
42*269e59f9SJan Pechanec typedef struct {
43*269e59f9SJan Pechanec 	/*
44*269e59f9SJan Pechanec 	 * Those four attributes are initialized from the policy database and
45*269e59f9SJan Pechanec 	 * are not to be changed for the life of the KMF session.
46*269e59f9SJan Pechanec 	 */
47*269e59f9SJan Pechanec 	char *mapname;
48*269e59f9SJan Pechanec 	char *options;
49*269e59f9SJan Pechanec 	char *pathname;
50*269e59f9SJan Pechanec 	char *dir;
51*269e59f9SJan Pechanec 	/* Current mapper. */
52*269e59f9SJan Pechanec 	void *dldesc;
53*269e59f9SJan Pechanec 	/*
54*269e59f9SJan Pechanec 	 * The presently open mapper pathname and options. Can be based on the
55*269e59f9SJan Pechanec 	 * policy attributes or attributes provided directly to the
56*269e59f9SJan Pechanec 	 * kmf_cert_to_name_mapping_init(), thus overriding the policy settings.
57*269e59f9SJan Pechanec 	 */
58*269e59f9SJan Pechanec 	char *curpathname;
59*269e59f9SJan Pechanec 	char *curoptions;
60*269e59f9SJan Pechanec } KMF_MAPPER_RECORD;
61*269e59f9SJan Pechanec 
62*269e59f9SJan Pechanec /* KMF mapper state record. */
63*269e59f9SJan Pechanec typedef struct {
64*269e59f9SJan Pechanec 	/*
65*269e59f9SJan Pechanec 	 * (Processed) options. Transparent to KMF. Each mapper can store its
66*269e59f9SJan Pechanec 	 * data there since options can be unique to every KMF handle.
67*269e59f9SJan Pechanec 	 */
68*269e59f9SJan Pechanec 	void *options;
69*269e59f9SJan Pechanec 	/*
70*269e59f9SJan Pechanec 	 * If the mapper returns KMF_ERR_INTERNAL the application may ask for
71*269e59f9SJan Pechanec 	 * the internal mapper error string. That error code is stored here.
72*269e59f9SJan Pechanec 	 */
73*269e59f9SJan Pechanec 	uint32_t lastmappererr;
74*269e59f9SJan Pechanec } KMF_MAPPER_STATE;
75*269e59f9SJan Pechanec 
76*269e59f9SJan Pechanec #ifdef __cplusplus
77*269e59f9SJan Pechanec }
78*269e59f9SJan Pechanec #endif
79*269e59f9SJan Pechanec #endif /* _KMFMAPPER_H */
80