xref: /titanic_52/usr/src/lib/libkmf/include/kmfmapper.h (revision 269e59f9a28bf47e0f463e64fc5af4a408b73b21)
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 #pragma ident	"@(#)kmfmapper.h	1.1	08/02/27 SMI"
30*269e59f9SJan Pechanec 
31*269e59f9SJan Pechanec #ifdef __cplusplus
32*269e59f9SJan Pechanec extern "C" {
33*269e59f9SJan Pechanec #endif
34*269e59f9SJan Pechanec 
35*269e59f9SJan Pechanec #define	MAPPER_NAME_TEMPLATE "kmf_mapper_%s.so.1"
36*269e59f9SJan Pechanec 
37*269e59f9SJan Pechanec #define	MAPPER_ERROR_STRING_FUNCTION "mapper_get_error_str"
38*269e59f9SJan Pechanec #define	MAP_CERT_TO_NAME_FUNCTION "mapper_map_cert_to_name"
39*269e59f9SJan Pechanec #define	MATCH_CERT_TO_NAME_FUNCTION "mapper_match_cert_to_name"
40*269e59f9SJan Pechanec #define	MAPPER_FINISH_FUNCTION "mapper_finalize"
41*269e59f9SJan Pechanec #define	MAPPER_INIT_FUNCTION "mapper_initialize"
42*269e59f9SJan Pechanec 
43*269e59f9SJan Pechanec /* KMF mapper policy record. */
44*269e59f9SJan Pechanec typedef struct {
45*269e59f9SJan Pechanec 	/*
46*269e59f9SJan Pechanec 	 * Those four attributes are initialized from the policy database and
47*269e59f9SJan Pechanec 	 * are not to be changed for the life of the KMF session.
48*269e59f9SJan Pechanec 	 */
49*269e59f9SJan Pechanec 	char *mapname;
50*269e59f9SJan Pechanec 	char *options;
51*269e59f9SJan Pechanec 	char *pathname;
52*269e59f9SJan Pechanec 	char *dir;
53*269e59f9SJan Pechanec 	/* Current mapper. */
54*269e59f9SJan Pechanec 	void *dldesc;
55*269e59f9SJan Pechanec 	/*
56*269e59f9SJan Pechanec 	 * The presently open mapper pathname and options. Can be based on the
57*269e59f9SJan Pechanec 	 * policy attributes or attributes provided directly to the
58*269e59f9SJan Pechanec 	 * kmf_cert_to_name_mapping_init(), thus overriding the policy settings.
59*269e59f9SJan Pechanec 	 */
60*269e59f9SJan Pechanec 	char *curpathname;
61*269e59f9SJan Pechanec 	char *curoptions;
62*269e59f9SJan Pechanec } KMF_MAPPER_RECORD;
63*269e59f9SJan Pechanec 
64*269e59f9SJan Pechanec /* KMF mapper state record. */
65*269e59f9SJan Pechanec typedef struct {
66*269e59f9SJan Pechanec 	/*
67*269e59f9SJan Pechanec 	 * (Processed) options. Transparent to KMF. Each mapper can store its
68*269e59f9SJan Pechanec 	 * data there since options can be unique to every KMF handle.
69*269e59f9SJan Pechanec 	 */
70*269e59f9SJan Pechanec 	void *options;
71*269e59f9SJan Pechanec 	/*
72*269e59f9SJan Pechanec 	 * If the mapper returns KMF_ERR_INTERNAL the application may ask for
73*269e59f9SJan Pechanec 	 * the internal mapper error string. That error code is stored here.
74*269e59f9SJan Pechanec 	 */
75*269e59f9SJan Pechanec 	uint32_t lastmappererr;
76*269e59f9SJan Pechanec } KMF_MAPPER_STATE;
77*269e59f9SJan Pechanec 
78*269e59f9SJan Pechanec #ifdef __cplusplus
79*269e59f9SJan Pechanec }
80*269e59f9SJan Pechanec #endif
81*269e59f9SJan Pechanec #endif /* _KMFMAPPER_H */
82