jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/pkcs11.h
author ascarpino
Mon, 23 Jan 2017 11:49:01 -0800
changeset 43248 5e15de85a1a0
parent 42693 jdk/src/jdk.crypto.token/share/native/libj2pkcs11/pkcs11.h@6645de32a866
permissions -rw-r--r--
8172527: Rename jdk.crypto.token to jdk.crypto.cryptoki Reviewed-by: mchung, wetmore
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/* pkcs11.h include file for PKCS #11. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
/* $Revision: 1.4 $ */
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
/* License to copy and use this software is granted provided that it is
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * identified as "RSA Security Inc. PKCS #11 Cryptographic Token Interface
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * (Cryptoki)" in all material mentioning or referencing this software.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * License is also granted to make and use derivative works provided that
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * such works are identified as "derived from the RSA Security Inc. PKCS #11
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 * Cryptographic Token Interface (Cryptoki)" in all material mentioning or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * referencing the derived work.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * RSA Security Inc. makes no representations concerning either the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * merchantability of this software or the suitability of this software for
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * any particular purpose. It is provided "as is" without express or implied
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 * warranty of any kind.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
#ifndef _PKCS11_H_
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
#define _PKCS11_H_ 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
#ifdef __cplusplus
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
extern "C" {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
/* Before including this file (pkcs11.h) (or pkcs11t.h by
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
 * itself), 6 platform-specific macros must be defined.  These
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
 * macros are described below, and typical definitions for them
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 * are also given.  Be advised that these definitions can depend
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 * on both the platform and the compiler used (and possibly also
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * on whether a Cryptoki library is linked statically or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * dynamically).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * In addition to defining these 6 macros, the packing convention
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * for Cryptoki structures should be set.  The Cryptoki
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * convention on packing is that structures should be 1-byte
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * aligned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * If you're using Microsoft Developer Studio 5.0 to produce
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * Win32 stuff, this might be done by using the following
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * preprocessor directive before including pkcs11.h or pkcs11t.h:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * #pragma pack(push, cryptoki, 1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * and using the following preprocessor directive after including
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * pkcs11.h or pkcs11t.h:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * #pragma pack(pop, cryptoki)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * If you're using an earlier version of Microsoft Developer
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * Studio to produce Win16 stuff, this might be done by using
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * the following preprocessor directive before including
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * pkcs11.h or pkcs11t.h:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * #pragma pack(1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * In a UNIX environment, you're on your own for this.  You might
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * not need to do (or be able to do!) anything.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * Now for the macros:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * 1. CK_PTR: The indirection string for making a pointer to an
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * object.  It can be used like this:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 * typedef CK_BYTE CK_PTR CK_BYTE_PTR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 * If you're using Microsoft Developer Studio 5.0 to produce
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 * Win32 stuff, it might be defined by:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 * #define CK_PTR *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 * If you're using an earlier version of Microsoft Developer
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 * Studio to produce Win16 stuff, it might be defined by:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 * #define CK_PTR far *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 * In a typical UNIX environment, it might be defined by:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
 * #define CK_PTR *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
 * 2. CK_DEFINE_FUNCTION(returnType, name): A macro which makes
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
 * an exportable Cryptoki library function definition out of a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
 * return type and a function name.  It should be used in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
 * following fashion to define the exposed Cryptoki functions in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
 * a Cryptoki library:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
 * CK_DEFINE_FUNCTION(CK_RV, C_Initialize)(
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
 *   CK_VOID_PTR pReserved
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
 * )
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
 * {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
 *   ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
 * }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
 * If you're using Microsoft Developer Studio 5.0 to define a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
 * function in a Win32 Cryptoki .dll, it might be defined by:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
 * #define CK_DEFINE_FUNCTION(returnType, name) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
 *   returnType __declspec(dllexport) name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
 * If you're using an earlier version of Microsoft Developer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
 * Studio to define a function in a Win16 Cryptoki .dll, it
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
 * might be defined by:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
 * #define CK_DEFINE_FUNCTION(returnType, name) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
 *   returnType __export _far _pascal name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
 * In a UNIX environment, it might be defined by:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
 * #define CK_DEFINE_FUNCTION(returnType, name) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
 *   returnType name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
 * 3. CK_DECLARE_FUNCTION(returnType, name): A macro which makes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
 * an importable Cryptoki library function declaration out of a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
 * return type and a function name.  It should be used in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
 * following fashion:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
 * extern CK_DECLARE_FUNCTION(CK_RV, C_Initialize)(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
 *   CK_VOID_PTR pReserved
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
 * );
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
 * If you're using Microsoft Developer Studio 5.0 to declare a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
 * function in a Win32 Cryptoki .dll, it might be defined by:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
 * #define CK_DECLARE_FUNCTION(returnType, name) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
 *   returnType __declspec(dllimport) name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
 * If you're using an earlier version of Microsoft Developer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
 * Studio to declare a function in a Win16 Cryptoki .dll, it
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
 * might be defined by:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
 * #define CK_DECLARE_FUNCTION(returnType, name) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
 *   returnType __export _far _pascal name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
 * In a UNIX environment, it might be defined by:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
 * #define CK_DECLARE_FUNCTION(returnType, name) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
 *   returnType name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
 * 4. CK_DECLARE_FUNCTION_POINTER(returnType, name): A macro
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
 * which makes a Cryptoki API function pointer declaration or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
 * function pointer type declaration out of a return type and a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
 * function name.  It should be used in the following fashion:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
 * // Define funcPtr to be a pointer to a Cryptoki API function
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
 * // taking arguments args and returning CK_RV.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
 * CK_DECLARE_FUNCTION_POINTER(CK_RV, funcPtr)(args);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
 * or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
 * // Define funcPtrType to be the type of a pointer to a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
 * // Cryptoki API function taking arguments args and returning
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
 * // CK_RV, and then define funcPtr to be a variable of type
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
 * // funcPtrType.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
 * typedef CK_DECLARE_FUNCTION_POINTER(CK_RV, funcPtrType)(args);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
 * funcPtrType funcPtr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
 * If you're using Microsoft Developer Studio 5.0 to access
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
 * functions in a Win32 Cryptoki .dll, in might be defined by:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
 * #define CK_DECLARE_FUNCTION_POINTER(returnType, name) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
 *   returnType __declspec(dllimport) (* name)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
 * If you're using an earlier version of Microsoft Developer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
 * Studio to access functions in a Win16 Cryptoki .dll, it might
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
 * be defined by:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
 * #define CK_DECLARE_FUNCTION_POINTER(returnType, name) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
 *   returnType __export _far _pascal (* name)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
 * In a UNIX environment, it might be defined by:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
 * #define CK_DECLARE_FUNCTION_POINTER(returnType, name) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
 *   returnType (* name)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
 * 5. CK_CALLBACK_FUNCTION(returnType, name): A macro which makes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
 * a function pointer type for an application callback out of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
 * a return type for the callback and a name for the callback.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
 * It should be used in the following fashion:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
 * CK_CALLBACK_FUNCTION(CK_RV, myCallback)(args);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
 * to declare a function pointer, myCallback, to a callback
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
 * which takes arguments args and returns a CK_RV.  It can also
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
 * be used like this:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
 * typedef CK_CALLBACK_FUNCTION(CK_RV, myCallbackType)(args);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
 * myCallbackType myCallback;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
 * If you're using Microsoft Developer Studio 5.0 to do Win32
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
 * Cryptoki development, it might be defined by:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
 * #define CK_CALLBACK_FUNCTION(returnType, name) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
 *   returnType (* name)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
 * If you're using an earlier version of Microsoft Developer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
 * Studio to do Win16 development, it might be defined by:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
 * #define CK_CALLBACK_FUNCTION(returnType, name) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
 *   returnType _far _pascal (* name)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
 * In a UNIX environment, it might be defined by:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
 * #define CK_CALLBACK_FUNCTION(returnType, name) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
 *   returnType (* name)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
 * 6. NULL_PTR: This macro is the value of a NULL pointer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
 * In any ANSI/ISO C environment (and in many others as well),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
 * this should best be defined by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
 * #ifndef NULL_PTR
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
 * #define NULL_PTR 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
 * #endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
/* All the various Cryptoki types and #define'd values are in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
 * file pkcs11t.h. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
#include "pkcs11t.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
#define __PASTE(x,y)      x##y
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
/* ==============================================================
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
 * Define the "extern" form of all the entry points.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
 * ==============================================================
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
#define CK_NEED_ARG_LIST  1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
#define CK_PKCS11_FUNCTION_INFO(name) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
  extern CK_DECLARE_FUNCTION(CK_RV, name)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
/* pkcs11f.h has all the information about the Cryptoki
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
 * function prototypes. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
#include "pkcs11f.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
#undef CK_NEED_ARG_LIST
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
#undef CK_PKCS11_FUNCTION_INFO
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
/* ==============================================================
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
 * Define the typedef form of all the entry points.  That is, for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
 * each Cryptoki function C_XXX, define a type CK_C_XXX which is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
 * a pointer to that kind of function.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
 * ==============================================================
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
#define CK_NEED_ARG_LIST  1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
#define CK_PKCS11_FUNCTION_INFO(name) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
  typedef CK_DECLARE_FUNCTION_POINTER(CK_RV, __PASTE(CK_,name))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
/* pkcs11f.h has all the information about the Cryptoki
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
 * function prototypes. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
#include "pkcs11f.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
#undef CK_NEED_ARG_LIST
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
#undef CK_PKCS11_FUNCTION_INFO
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
/* ==============================================================
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
 * Define structed vector of entry points.  A CK_FUNCTION_LIST
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
 * contains a CK_VERSION indicating a library's Cryptoki version
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
 * and then a whole slew of function pointers to the routines in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
 * the library.  This type was declared, but not defined, in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
 * pkcs11t.h.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
 * ==============================================================
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
#define CK_PKCS11_FUNCTION_INFO(name) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
  __PASTE(CK_,name) name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
struct CK_FUNCTION_LIST {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
  CK_VERSION    version;  /* Cryptoki version */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
/* Pile all the function pointers into the CK_FUNCTION_LIST. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
/* pkcs11f.h has all the information about the Cryptoki
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
 * function prototypes. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
#include "pkcs11f.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
};
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
#undef CK_PKCS11_FUNCTION_INFO
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
#undef __PASTE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
#ifdef __cplusplus
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
#endif