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