NVIDIA DriveOS Linux NSR SDK API Reference
7.0.3.0 Release
pkcs11.h
Go to the documentation of this file.
1
/* Copyright (c) OASIS Open 2016-2019. All Rights Reserved.
2
* Distributed under the terms of the OASIS IPR Policy,
3
* [http://www.oasis-open.org/policies-guidelines/ipr], AS-IS, WITHOUT ANY
4
* IMPLIED OR EXPRESS WARRANTY; there is no warranty of MERCHANTABILITY, FITNESS FOR A
5
* PARTICULAR PURPOSE or NONINFRINGEMENT of the rights of others.
6
*/
7
8
#ifndef _PKCS11_H_
9
#define _PKCS11_H_ 1
10
11
#ifdef __cplusplus
12
extern
"C"
{
13
#endif
14
15
/* Before including this file (pkcs11.h) (or pkcs11t.h by
16
* itself), 5 platform-specific macros must be defined. These
17
* macros are described below, and typical definitions for them
18
* are also given. Be advised that these definitions can depend
19
* on both the platform and the compiler used (and possibly also
20
* on whether a Cryptoki library is linked statically or
21
* dynamically).
22
*
23
* In addition to defining these 5 macros, the packing convention
24
* for Cryptoki structures should be set. The Cryptoki
25
* convention on packing is that structures should be 1-byte
26
* aligned.
27
*
28
* If you're using Windows this might be done by using the following
29
* preprocessor directive before including pkcs11.h or pkcs11t.h:
30
*
31
* #pragma pack(push, cryptoki, 1)
32
*
33
* and using the following preprocessor directive after including
34
* pkcs11.h or pkcs11t.h:
35
*
36
* #pragma pack(pop, cryptoki)
37
*
38
* In a UNIX environment, you're on your own for this. You might
39
* not need to do (or be able to do!) anything.
40
*
41
*
42
* Now for the macros:
43
*
44
*
45
* 1. CK_PTR: The indirection string for making a pointer to an
46
* object. It can be used like this:
47
*
48
* typedef CK_BYTE CK_PTR CK_BYTE_PTR;
49
*
50
* If you're using windows, it might be defined by:
51
*
52
* #define CK_PTR *
53
*
54
* In a typical UNIX environment, it might be defined by:
55
*
56
* #define CK_PTR *
57
*
58
*
59
* 2. CK_DECLARE_FUNCTION(returnType, name): A macro which makes
60
* an importable Cryptoki library function declaration out of a
61
* return type and a function name. It should be used in the
62
* following fashion:
63
*
64
* extern CK_DECLARE_FUNCTION(CK_RV, C_Initialize)(
65
* CK_VOID_PTR pReserved
66
* );
67
*
68
* If you're using Windows to declare a function in a Win32 cryptoki .dll,
69
* it might be defined by:
70
*
71
* #define CK_DECLARE_FUNCTION(returnType, name) \
72
* returnType __declspec(dllimport) name
73
*
74
* In a UNIX environment, it might be defined by:
75
*
76
* #define CK_DECLARE_FUNCTION(returnType, name) \
77
* returnType name
78
*
79
*
80
* 3. CK_DECLARE_FUNCTION_POINTER(returnType, name): A macro
81
* which makes a Cryptoki API function pointer declaration or
82
* function pointer type declaration out of a return type and a
83
* function name. It should be used in the following fashion:
84
*
85
* // Define funcPtr to be a pointer to a Cryptoki API function
86
* // taking arguments args and returning CK_RV.
87
* CK_DECLARE_FUNCTION_POINTER(CK_RV, funcPtr)(args);
88
*
89
* or
90
*
91
* // Define funcPtrType to be the type of a pointer to a
92
* // Cryptoki API function taking arguments args and returning
93
* // CK_RV, and then define funcPtr to be a variable of type
94
* // funcPtrType.
95
* typedef CK_DECLARE_FUNCTION_POINTER(CK_RV, funcPtrType)(args);
96
* funcPtrType funcPtr;
97
*
98
* If you're using Windows to access
99
* functions in a Win32 Cryptoki .dll, in might be defined by:
100
*
101
* #define CK_DECLARE_FUNCTION_POINTER(returnType, name) \
102
* returnType __declspec(dllimport) (* name)
103
*
104
* In a UNIX environment, it might be defined by:
105
*
106
* #define CK_DECLARE_FUNCTION_POINTER(returnType, name) \
107
* returnType (* name)
108
*
109
*
110
* 4. CK_CALLBACK_FUNCTION(returnType, name): A macro which makes
111
* a function pointer type for an application callback out of
112
* a return type for the callback and a name for the callback.
113
* It should be used in the following fashion:
114
*
115
* CK_CALLBACK_FUNCTION(CK_RV, myCallback)(args);
116
*
117
* to declare a function pointer, myCallback, to a callback
118
* which takes arguments args and returns a CK_RV. It can also
119
* be used like this:
120
*
121
* typedef CK_CALLBACK_FUNCTION(CK_RV, myCallbackType)(args);
122
* myCallbackType myCallback;
123
*
124
* If you're using Windows, it might be defined by:
125
*
126
* #define CK_CALLBACK_FUNCTION(returnType, name) \
127
* returnType (* name)
128
*
129
* In a UNIX environment, it might be defined by:
130
*
131
* #define CK_CALLBACK_FUNCTION(returnType, name) \
132
* returnType (* name)
133
*
134
*
135
* 5. NULL_PTR: This macro is the value of a NULL pointer.
136
*
137
* In any ANSI/ISO C environment (and in many others as well),
138
* this should best be defined by
139
*
140
* #ifndef NULL_PTR
141
* #define NULL_PTR 0
142
* #endif
143
*/
144
145
146
/* All the various Cryptoki types and #define'd values are in the
147
* file pkcs11t.h.
148
*/
149
#include "
pkcs11t.h
"
150
151
#define __PASTE(x,y) x##y
152
153
154
/* ==============================================================
155
* Define the "extern" form of all the entry points.
156
* ==============================================================
157
*/
158
159
#define CK_NEED_ARG_LIST 1
160
#define CK_PKCS11_FUNCTION_INFO(name) \
161
extern CK_DECLARE_FUNCTION(CK_RV, name)
162
163
/* pkcs11f.h has all the information about the Cryptoki
164
* function prototypes.
165
*/
166
#include "
pkcs11f.h
"
167
168
#undef CK_NEED_ARG_LIST
169
#undef CK_PKCS11_FUNCTION_INFO
170
171
172
/* ==============================================================
173
* Define the typedef form of all the entry points. That is, for
174
* each Cryptoki function C_XXX, define a type CK_C_XXX which is
175
* a pointer to that kind of function.
176
* ==============================================================
177
*/
178
179
#define CK_NEED_ARG_LIST 1
180
#define CK_PKCS11_FUNCTION_INFO(name) \
181
typedef CK_DECLARE_FUNCTION_POINTER(CK_RV, __PASTE(CK_,name))
182
183
/* pkcs11f.h has all the information about the Cryptoki
184
* function prototypes.
185
*/
186
#include "
pkcs11f.h
"
187
188
#undef CK_NEED_ARG_LIST
189
#undef CK_PKCS11_FUNCTION_INFO
190
191
192
/* ==============================================================
193
* Define structed vector of entry points. A CK_FUNCTION_LIST
194
* contains a CK_VERSION indicating a library's Cryptoki version
195
* and then a whole slew of function pointers to the routines in
196
* the library. This type was declared, but not defined, in
197
* pkcs11t.h.
198
* ==============================================================
199
*/
200
201
#define CK_PKCS11_FUNCTION_INFO(name) \
202
__PASTE(CK_,name) name;
203
204
/* Create the 3.0 Function list */
205
struct
CK_FUNCTION_LIST_3_0
{
206
207
CK_VERSION
version
;
/* Cryptoki version */
208
209
/* Pile all the function pointers into the CK_FUNCTION_LIST. */
210
/* pkcs11f.h has all the information about the Cryptoki
211
* function prototypes.
212
*/
213
#include "
pkcs11f.h
"
214
215
};
216
217
#define CK_PKCS11_2_0_ONLY 1
218
219
/* Continue to define the old CK_FUNCTION_LIST */
220
struct
CK_FUNCTION_LIST
{
221
222
CK_VERSION
version
;
/* Cryptoki version */
223
224
/* Pile all the function pointers into the CK_FUNCTION_LIST. */
225
/* pkcs11f.h has all the information about the Cryptoki
226
* function prototypes.
227
*/
228
#include "
pkcs11f.h
"
229
230
};
231
232
#undef CK_PKCS11_FUNCTION_INFO
233
#undef CK_PKCS11_2_0_ONLY
234
235
236
#undef __PASTE
237
238
#ifdef __cplusplus
239
}
240
#endif
241
242
#endif
/* _PKCS11_H_ */
CK_FUNCTION_LIST_3_0
Definition:
pkcs11.h:205
CK_FUNCTION_LIST
Definition:
pkcs11.h:220
CK_FUNCTION_LIST::version
CK_VERSION version
Definition:
pkcs11.h:222
CK_FUNCTION_LIST_3_0::version
CK_VERSION version
Definition:
pkcs11.h:207
CK_VERSION
Definition:
pkcs11t.h:79
pkcs11f.h
pkcs11t.h
Privacy Policy
|
Manage My Privacy
|
Do Not Sell or Share My Data
|
Terms of Service
|
Accessibility
|
Corporate Policies
|
Product Security
|
Contact
© 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
Subject to Change | For test and development only.
Thu May 8 2025 00:05:08 | PR-10721-6.0