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