~ubuntu-branches/ubuntu/karmic/nss/karmic-updates

« back to all changes in this revision

Viewing changes to mozilla/security/nss/lib/util/pkcs11f.h

  • Committer: Bazaar Package Importer
  • Author(s): Alexander Sack
  • Date: 2009-06-16 13:23:47 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20090616132347-311ysb8oep74b98y
Tags: 3.12.3-0ubuntu1
* new upstream release 3.12.3 RTM (NSS_3_12_3_RTM) (LP: #387751)
* adjust patches to changed upstream code base
  - update debian/patches/38_kbsd.patch
* needs nspr >= 4.7.4
  - update debian/control
* update 85_security_load.patch to latest debian version
  - update debian/patches/85_security_load.patch
* add new symbols for 3.12.3
  - update debian/libnss3-1d.symbols

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ***** BEGIN LICENSE BLOCK *****
 
2
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
 
3
 *
 
4
 * The contents of this file are subject to the Mozilla Public License Version
 
5
 * 1.1 (the "License"); you may not use this file except in compliance with
 
6
 * the License. You may obtain a copy of the License at
 
7
 * http://www.mozilla.org/MPL/
 
8
 *
 
9
 * Software distributed under the License is distributed on an "AS IS" basis,
 
10
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 
11
 * for the specific language governing rights and limitations under the
 
12
 * License.
 
13
 *
 
14
 * The Original Code is the Netscape security libraries.
 
15
 *
 
16
 * The Initial Developer of the Original Code is
 
17
 * RSA Security INC.
 
18
 * Portions created by the Initial Developer are Copyright (C) 1994-2000
 
19
 * the Initial Developer. All Rights Reserved.
 
20
 *
 
21
 * Contributor(s):
 
22
 *
 
23
 * Alternatively, the contents of this file may be used under the terms of
 
24
 * either the GNU General Public License Version 2 or later (the "GPL"), or
 
25
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 
26
 * in which case the provisions of the GPL or the LGPL are applicable instead
 
27
 * of those above. If you wish to allow use of your version of this file only
 
28
 * under the terms of either the GPL or the LGPL, and not to allow others to
 
29
 * use your version of this file under the terms of the MPL, indicate your
 
30
 * decision by deleting the provisions above and replace them with the notice
 
31
 * and other provisions required by the GPL or the LGPL. If you do not delete
 
32
 * the provisions above, a recipient may use your version of this file under
 
33
 * the terms of any one of the MPL, the GPL or the LGPL.
 
34
 *
 
35
 * ***** END LICENSE BLOCK ***** */
 
36
/*
 
37
 * Copyright (C) 1994-1999 RSA Security Inc. Licence to copy this document
 
38
 * is granted provided that it is identified as "RSA Security In.c Public-Key
 
39
 * Cryptography Standards (PKCS)" in all material mentioning or referencing
 
40
 * this document.
 
41
 */
 
42
/* This function contains pretty much everything about all the */
 
43
/* PKCS #11  function prototypes.  Because this information is */
 
44
/* used for more than just declaring function prototypes, the */
 
45
/* order of the functions appearing herein is important, and */
 
46
/* should not be altered. */
 
47
 
 
48
 
 
49
 
 
50
/* General-purpose */
 
51
 
 
52
/* C_Initialize initializes the PKCS #11 library. */
 
53
CK_PKCS11_FUNCTION_INFO(C_Initialize)
 
54
#ifdef CK_NEED_ARG_LIST
 
55
(
 
56
  CK_VOID_PTR   pInitArgs  /* if this is not NULL_PTR, it gets
 
57
                            * cast to CK_C_INITIALIZE_ARGS_PTR
 
58
                            * and dereferenced */
 
59
);
 
60
#endif
 
61
 
 
62
 
 
63
/* C_Finalize indicates that an application is done with the
 
64
 * PKCS #11 library. */
 
65
CK_PKCS11_FUNCTION_INFO(C_Finalize)
 
66
#ifdef CK_NEED_ARG_LIST
 
67
(
 
68
  CK_VOID_PTR   pReserved  /* reserved.  Should be NULL_PTR */
 
69
);
 
70
#endif
 
71
 
 
72
 
 
73
/* C_GetInfo returns general information about PKCS #11. */
 
74
CK_PKCS11_FUNCTION_INFO(C_GetInfo)
 
75
#ifdef CK_NEED_ARG_LIST
 
76
(
 
77
  CK_INFO_PTR   pInfo  /* location that receives information */
 
78
);
 
79
#endif
 
80
 
 
81
 
 
82
/* C_GetFunctionList returns the function list. */
 
83
CK_PKCS11_FUNCTION_INFO(C_GetFunctionList)
 
84
#ifdef CK_NEED_ARG_LIST
 
85
(
 
86
  CK_FUNCTION_LIST_PTR_PTR ppFunctionList  /* receives pointer to
 
87
                                            * function list */
 
88
);
 
89
#endif
 
90
 
 
91
 
 
92
 
 
93
/* Slot and token management */
 
94
 
 
95
/* C_GetSlotList obtains a list of slots in the system. */
 
96
CK_PKCS11_FUNCTION_INFO(C_GetSlotList)
 
97
#ifdef CK_NEED_ARG_LIST
 
98
(
 
99
  CK_BBOOL       tokenPresent,  /* only slots with tokens? */
 
100
  CK_SLOT_ID_PTR pSlotList,     /* receives array of slot IDs */
 
101
  CK_ULONG_PTR   pulCount       /* receives number of slots */
 
102
);
 
103
#endif
 
104
 
 
105
 
 
106
/* C_GetSlotInfo obtains information about a particular slot in
 
107
 * the system. */
 
108
CK_PKCS11_FUNCTION_INFO(C_GetSlotInfo)
 
109
#ifdef CK_NEED_ARG_LIST
 
110
(
 
111
  CK_SLOT_ID       slotID,  /* the ID of the slot */
 
112
  CK_SLOT_INFO_PTR pInfo    /* receives the slot information */
 
113
);
 
114
#endif
 
115
 
 
116
 
 
117
/* C_GetTokenInfo obtains information about a particular token
 
118
 * in the system. */
 
119
CK_PKCS11_FUNCTION_INFO(C_GetTokenInfo)
 
120
#ifdef CK_NEED_ARG_LIST
 
121
(
 
122
  CK_SLOT_ID        slotID,  /* ID of the token's slot */
 
123
  CK_TOKEN_INFO_PTR pInfo    /* receives the token information */
 
124
);
 
125
#endif
 
126
 
 
127
 
 
128
/* C_GetMechanismList obtains a list of mechanism types
 
129
 * supported by a token. */
 
130
CK_PKCS11_FUNCTION_INFO(C_GetMechanismList)
 
131
#ifdef CK_NEED_ARG_LIST
 
132
(
 
133
  CK_SLOT_ID            slotID,          /* ID of token's slot */
 
134
  CK_MECHANISM_TYPE_PTR pMechanismList,  /* gets mech. array */
 
135
  CK_ULONG_PTR          pulCount         /* gets # of mechs. */
 
136
);
 
137
#endif
 
138
 
 
139
 
 
140
/* C_GetMechanismInfo obtains information about a particular
 
141
 * mechanism possibly supported by a token. */
 
142
CK_PKCS11_FUNCTION_INFO(C_GetMechanismInfo)
 
143
#ifdef CK_NEED_ARG_LIST
 
144
(
 
145
  CK_SLOT_ID            slotID,  /* ID of the token's slot */
 
146
  CK_MECHANISM_TYPE     type,    /* type of mechanism */
 
147
  CK_MECHANISM_INFO_PTR pInfo    /* receives mechanism info */
 
148
);
 
149
#endif
 
150
 
 
151
 
 
152
/* C_InitToken initializes a token. */
 
153
CK_PKCS11_FUNCTION_INFO(C_InitToken)
 
154
#ifdef CK_NEED_ARG_LIST
 
155
/* pLabel changed from CK_CHAR_PTR to CK_UTF8CHAR_PTR for v2.10 */
 
156
(
 
157
  CK_SLOT_ID         slotID,    /* ID of the token's slot */
 
158
  CK_UTF8CHAR_PTR    pPin,      /* the SO's initial PIN */
 
159
  CK_ULONG           ulPinLen,  /* length in bytes of the PIN */
 
160
  CK_UTF8CHAR_PTR    pLabel     /* 32-byte token label (blank padded) */
 
161
);
 
162
#endif
 
163
 
 
164
 
 
165
/* C_InitPIN initializes the normal user's PIN. */
 
166
CK_PKCS11_FUNCTION_INFO(C_InitPIN)
 
167
#ifdef CK_NEED_ARG_LIST
 
168
(
 
169
  CK_SESSION_HANDLE hSession,  /* the session's handle */
 
170
  CK_UTF8CHAR_PTR   pPin,      /* the normal user's PIN */
 
171
  CK_ULONG          ulPinLen   /* length in bytes of the PIN */
 
172
);
 
173
#endif
 
174
 
 
175
 
 
176
/* C_SetPIN modifies the PIN of the user who is logged in. */
 
177
CK_PKCS11_FUNCTION_INFO(C_SetPIN)
 
178
#ifdef CK_NEED_ARG_LIST
 
179
(
 
180
  CK_SESSION_HANDLE hSession,  /* the session's handle */
 
181
  CK_UTF8CHAR_PTR   pOldPin,   /* the old PIN */
 
182
  CK_ULONG          ulOldLen,  /* length of the old PIN */
 
183
  CK_UTF8CHAR_PTR   pNewPin,   /* the new PIN */
 
184
  CK_ULONG          ulNewLen   /* length of the new PIN */
 
185
);
 
186
#endif
 
187
 
 
188
 
 
189
 
 
190
/* Session management */
 
191
 
 
192
/* C_OpenSession opens a session between an application and a
 
193
 * token. */
 
194
CK_PKCS11_FUNCTION_INFO(C_OpenSession)
 
195
#ifdef CK_NEED_ARG_LIST
 
196
(
 
197
  CK_SLOT_ID            slotID,        /* the slot's ID */
 
198
  CK_FLAGS              flags,         /* from CK_SESSION_INFO */
 
199
  CK_VOID_PTR           pApplication,  /* passed to callback */
 
200
  CK_NOTIFY             Notify,        /* callback function */
 
201
  CK_SESSION_HANDLE_PTR phSession      /* gets session handle */
 
202
);
 
203
#endif
 
204
 
 
205
 
 
206
/* C_CloseSession closes a session between an application and a
 
207
 * token. */
 
208
CK_PKCS11_FUNCTION_INFO(C_CloseSession)
 
209
#ifdef CK_NEED_ARG_LIST
 
210
(
 
211
  CK_SESSION_HANDLE hSession  /* the session's handle */
 
212
);
 
213
#endif
 
214
 
 
215
 
 
216
/* C_CloseAllSessions closes all sessions with a token. */
 
217
CK_PKCS11_FUNCTION_INFO(C_CloseAllSessions)
 
218
#ifdef CK_NEED_ARG_LIST
 
219
(
 
220
  CK_SLOT_ID     slotID  /* the token's slot */
 
221
);
 
222
#endif
 
223
 
 
224
 
 
225
/* C_GetSessionInfo obtains information about the session. */
 
226
CK_PKCS11_FUNCTION_INFO(C_GetSessionInfo)
 
227
#ifdef CK_NEED_ARG_LIST
 
228
(
 
229
  CK_SESSION_HANDLE   hSession,  /* the session's handle */
 
230
  CK_SESSION_INFO_PTR pInfo      /* receives session info */
 
231
);
 
232
#endif
 
233
 
 
234
 
 
235
/* C_GetOperationState obtains the state of the cryptographic operation
 
236
 * in a session. */
 
237
CK_PKCS11_FUNCTION_INFO(C_GetOperationState)
 
238
#ifdef CK_NEED_ARG_LIST
 
239
(
 
240
  CK_SESSION_HANDLE hSession,             /* session's handle */
 
241
  CK_BYTE_PTR       pOperationState,      /* gets state */
 
242
  CK_ULONG_PTR      pulOperationStateLen  /* gets state length */
 
243
);
 
244
#endif
 
245
 
 
246
 
 
247
/* C_SetOperationState restores the state of the cryptographic
 
248
 * operation in a session. */
 
249
CK_PKCS11_FUNCTION_INFO(C_SetOperationState)
 
250
#ifdef CK_NEED_ARG_LIST
 
251
(
 
252
  CK_SESSION_HANDLE hSession,            /* session's handle */
 
253
  CK_BYTE_PTR      pOperationState,      /* holds state */
 
254
  CK_ULONG         ulOperationStateLen,  /* holds state length */
 
255
  CK_OBJECT_HANDLE hEncryptionKey,       /* en/decryption key */
 
256
  CK_OBJECT_HANDLE hAuthenticationKey    /* sign/verify key */
 
257
);
 
258
#endif
 
259
 
 
260
 
 
261
/* C_Login logs a user into a token. */
 
262
CK_PKCS11_FUNCTION_INFO(C_Login)
 
263
#ifdef CK_NEED_ARG_LIST
 
264
(
 
265
  CK_SESSION_HANDLE hSession,  /* the session's handle */
 
266
  CK_USER_TYPE      userType,  /* the user type */
 
267
  CK_UTF8CHAR_PTR   pPin,      /* the user's PIN */
 
268
  CK_ULONG          ulPinLen   /* the length of the PIN */
 
269
);
 
270
#endif
 
271
 
 
272
 
 
273
/* C_Logout logs a user out from a token. */
 
274
CK_PKCS11_FUNCTION_INFO(C_Logout)
 
275
#ifdef CK_NEED_ARG_LIST
 
276
(
 
277
  CK_SESSION_HANDLE hSession  /* the session's handle */
 
278
);
 
279
#endif
 
280
 
 
281
 
 
282
 
 
283
/* Object management */
 
284
 
 
285
/* C_CreateObject creates a new object. */
 
286
CK_PKCS11_FUNCTION_INFO(C_CreateObject)
 
287
#ifdef CK_NEED_ARG_LIST
 
288
(
 
289
  CK_SESSION_HANDLE hSession,    /* the session's handle */
 
290
  CK_ATTRIBUTE_PTR  pTemplate,   /* the object's template */
 
291
  CK_ULONG          ulCount,     /* attributes in template */
 
292
  CK_OBJECT_HANDLE_PTR phObject  /* gets new object's handle. */
 
293
);
 
294
#endif
 
295
 
 
296
 
 
297
/* C_CopyObject copies an object, creating a new object for the
 
298
 * copy. */
 
299
CK_PKCS11_FUNCTION_INFO(C_CopyObject)
 
300
#ifdef CK_NEED_ARG_LIST
 
301
(
 
302
  CK_SESSION_HANDLE    hSession,    /* the session's handle */
 
303
  CK_OBJECT_HANDLE     hObject,     /* the object's handle */
 
304
  CK_ATTRIBUTE_PTR     pTemplate,   /* template for new object */
 
305
  CK_ULONG             ulCount,     /* attributes in template */
 
306
  CK_OBJECT_HANDLE_PTR phNewObject  /* receives handle of copy */
 
307
);
 
308
#endif
 
309
 
 
310
 
 
311
/* C_DestroyObject destroys an object. */
 
312
CK_PKCS11_FUNCTION_INFO(C_DestroyObject)
 
313
#ifdef CK_NEED_ARG_LIST
 
314
(
 
315
  CK_SESSION_HANDLE hSession,  /* the session's handle */
 
316
  CK_OBJECT_HANDLE  hObject    /* the object's handle */
 
317
);
 
318
#endif
 
319
 
 
320
 
 
321
/* C_GetObjectSize gets the size of an object in bytes. */
 
322
CK_PKCS11_FUNCTION_INFO(C_GetObjectSize)
 
323
#ifdef CK_NEED_ARG_LIST
 
324
(
 
325
  CK_SESSION_HANDLE hSession,  /* the session's handle */
 
326
  CK_OBJECT_HANDLE  hObject,   /* the object's handle */
 
327
  CK_ULONG_PTR      pulSize    /* receives size of object */
 
328
);
 
329
#endif
 
330
 
 
331
 
 
332
/* C_GetAttributeValue obtains the value of one or more object
 
333
 * attributes. */
 
334
CK_PKCS11_FUNCTION_INFO(C_GetAttributeValue)
 
335
#ifdef CK_NEED_ARG_LIST
 
336
(
 
337
  CK_SESSION_HANDLE hSession,   /* the session's handle */
 
338
  CK_OBJECT_HANDLE  hObject,    /* the object's handle */
 
339
  CK_ATTRIBUTE_PTR  pTemplate,  /* specifies attrs; gets vals */
 
340
  CK_ULONG          ulCount     /* attributes in template */
 
341
);
 
342
#endif
 
343
 
 
344
 
 
345
/* C_SetAttributeValue modifies the value of one or more object
 
346
 * attributes */
 
347
CK_PKCS11_FUNCTION_INFO(C_SetAttributeValue)
 
348
#ifdef CK_NEED_ARG_LIST
 
349
(
 
350
  CK_SESSION_HANDLE hSession,   /* the session's handle */
 
351
  CK_OBJECT_HANDLE  hObject,    /* the object's handle */
 
352
  CK_ATTRIBUTE_PTR  pTemplate,  /* specifies attrs and values */
 
353
  CK_ULONG          ulCount     /* attributes in template */
 
354
);
 
355
#endif
 
356
 
 
357
 
 
358
/* C_FindObjectsInit initializes a search for token and session
 
359
 * objects that match a template. */
 
360
CK_PKCS11_FUNCTION_INFO(C_FindObjectsInit)
 
361
#ifdef CK_NEED_ARG_LIST
 
362
(
 
363
  CK_SESSION_HANDLE hSession,   /* the session's handle */
 
364
  CK_ATTRIBUTE_PTR  pTemplate,  /* attribute values to match */
 
365
  CK_ULONG          ulCount     /* attrs in search template */
 
366
);
 
367
#endif
 
368
 
 
369
 
 
370
/* C_FindObjects continues a search for token and session
 
371
 * objects that match a template, obtaining additional object
 
372
 * handles. */
 
373
CK_PKCS11_FUNCTION_INFO(C_FindObjects)
 
374
#ifdef CK_NEED_ARG_LIST
 
375
(
 
376
 CK_SESSION_HANDLE    hSession,          /* session's handle */
 
377
 CK_OBJECT_HANDLE_PTR phObject,          /* gets obj. handles */
 
378
 CK_ULONG             ulMaxObjectCount,  /* max handles to get */
 
379
 CK_ULONG_PTR         pulObjectCount     /* actual # returned */
 
380
);
 
381
#endif
 
382
 
 
383
 
 
384
/* C_FindObjectsFinal finishes a search for token and session
 
385
 * objects. */
 
386
CK_PKCS11_FUNCTION_INFO(C_FindObjectsFinal)
 
387
#ifdef CK_NEED_ARG_LIST
 
388
(
 
389
  CK_SESSION_HANDLE hSession  /* the session's handle */
 
390
);
 
391
#endif
 
392
 
 
393
 
 
394
 
 
395
/* Encryption and decryption */
 
396
 
 
397
/* C_EncryptInit initializes an encryption operation. */
 
398
CK_PKCS11_FUNCTION_INFO(C_EncryptInit)
 
399
#ifdef CK_NEED_ARG_LIST
 
400
(
 
401
  CK_SESSION_HANDLE hSession,    /* the session's handle */
 
402
  CK_MECHANISM_PTR  pMechanism,  /* the encryption mechanism */
 
403
  CK_OBJECT_HANDLE  hKey         /* handle of encryption key */
 
404
);
 
405
#endif
 
406
 
 
407
 
 
408
/* C_Encrypt encrypts single-part data. */
 
409
CK_PKCS11_FUNCTION_INFO(C_Encrypt)
 
410
#ifdef CK_NEED_ARG_LIST
 
411
(
 
412
  CK_SESSION_HANDLE hSession,            /* session's handle */
 
413
  CK_BYTE_PTR       pData,               /* the plaintext data */
 
414
  CK_ULONG          ulDataLen,           /* bytes of plaintext */
 
415
  CK_BYTE_PTR       pEncryptedData,      /* gets ciphertext */
 
416
  CK_ULONG_PTR      pulEncryptedDataLen  /* gets c-text size */
 
417
);
 
418
#endif
 
419
 
 
420
 
 
421
/* C_EncryptUpdate continues a multiple-part encryption
 
422
 * operation. */
 
423
CK_PKCS11_FUNCTION_INFO(C_EncryptUpdate)
 
424
#ifdef CK_NEED_ARG_LIST
 
425
(
 
426
  CK_SESSION_HANDLE hSession,           /* session's handle */
 
427
  CK_BYTE_PTR       pPart,              /* the plaintext data */
 
428
  CK_ULONG          ulPartLen,          /* plaintext data len */
 
429
  CK_BYTE_PTR       pEncryptedPart,     /* gets ciphertext */
 
430
  CK_ULONG_PTR      pulEncryptedPartLen /* gets c-text size */
 
431
);
 
432
#endif
 
433
 
 
434
 
 
435
/* C_EncryptFinal finishes a multiple-part encryption
 
436
 * operation. */
 
437
CK_PKCS11_FUNCTION_INFO(C_EncryptFinal)
 
438
#ifdef CK_NEED_ARG_LIST
 
439
(
 
440
  CK_SESSION_HANDLE hSession,                /* session handle */
 
441
  CK_BYTE_PTR       pLastEncryptedPart,      /* last c-text */
 
442
  CK_ULONG_PTR      pulLastEncryptedPartLen  /* gets last size */
 
443
);
 
444
#endif
 
445
 
 
446
 
 
447
/* C_DecryptInit initializes a decryption operation. */
 
448
CK_PKCS11_FUNCTION_INFO(C_DecryptInit)
 
449
#ifdef CK_NEED_ARG_LIST
 
450
(
 
451
  CK_SESSION_HANDLE hSession,    /* the session's handle */
 
452
  CK_MECHANISM_PTR  pMechanism,  /* the decryption mechanism */
 
453
  CK_OBJECT_HANDLE  hKey         /* handle of decryption key */
 
454
);
 
455
#endif
 
456
 
 
457
 
 
458
/* C_Decrypt decrypts encrypted data in a single part. */
 
459
CK_PKCS11_FUNCTION_INFO(C_Decrypt)
 
460
#ifdef CK_NEED_ARG_LIST
 
461
(
 
462
  CK_SESSION_HANDLE hSession,           /* session's handle */
 
463
  CK_BYTE_PTR       pEncryptedData,     /* ciphertext */
 
464
  CK_ULONG          ulEncryptedDataLen, /* ciphertext length */
 
465
  CK_BYTE_PTR       pData,              /* gets plaintext */
 
466
  CK_ULONG_PTR      pulDataLen          /* gets p-text size */
 
467
);
 
468
#endif
 
469
 
 
470
 
 
471
/* C_DecryptUpdate continues a multiple-part decryption
 
472
 * operation. */
 
473
CK_PKCS11_FUNCTION_INFO(C_DecryptUpdate)
 
474
#ifdef CK_NEED_ARG_LIST
 
475
(
 
476
  CK_SESSION_HANDLE hSession,            /* session's handle */
 
477
  CK_BYTE_PTR       pEncryptedPart,      /* encrypted data */
 
478
  CK_ULONG          ulEncryptedPartLen,  /* input length */
 
479
  CK_BYTE_PTR       pPart,               /* gets plaintext */
 
480
  CK_ULONG_PTR      pulPartLen           /* p-text size */
 
481
);
 
482
#endif
 
483
 
 
484
 
 
485
/* C_DecryptFinal finishes a multiple-part decryption
 
486
 * operation. */
 
487
CK_PKCS11_FUNCTION_INFO(C_DecryptFinal)
 
488
#ifdef CK_NEED_ARG_LIST
 
489
(
 
490
  CK_SESSION_HANDLE hSession,       /* the session's handle */
 
491
  CK_BYTE_PTR       pLastPart,      /* gets plaintext */
 
492
  CK_ULONG_PTR      pulLastPartLen  /* p-text size */
 
493
);
 
494
#endif
 
495
 
 
496
 
 
497
 
 
498
/* Message digesting */
 
499
 
 
500
/* C_DigestInit initializes a message-digesting operation. */
 
501
CK_PKCS11_FUNCTION_INFO(C_DigestInit)
 
502
#ifdef CK_NEED_ARG_LIST
 
503
(
 
504
  CK_SESSION_HANDLE hSession,   /* the session's handle */
 
505
  CK_MECHANISM_PTR  pMechanism  /* the digesting mechanism */
 
506
);
 
507
#endif
 
508
 
 
509
 
 
510
/* C_Digest digests data in a single part. */
 
511
CK_PKCS11_FUNCTION_INFO(C_Digest)
 
512
#ifdef CK_NEED_ARG_LIST
 
513
(
 
514
  CK_SESSION_HANDLE hSession,     /* the session's handle */
 
515
  CK_BYTE_PTR       pData,        /* data to be digested */
 
516
  CK_ULONG          ulDataLen,    /* bytes of data to digest */
 
517
  CK_BYTE_PTR       pDigest,      /* gets the message digest */
 
518
  CK_ULONG_PTR      pulDigestLen  /* gets digest length */
 
519
);
 
520
#endif
 
521
 
 
522
 
 
523
/* C_DigestUpdate continues a multiple-part message-digesting
 
524
 * operation. */
 
525
CK_PKCS11_FUNCTION_INFO(C_DigestUpdate)
 
526
#ifdef CK_NEED_ARG_LIST
 
527
(
 
528
  CK_SESSION_HANDLE hSession,  /* the session's handle */
 
529
  CK_BYTE_PTR       pPart,     /* data to be digested */
 
530
  CK_ULONG          ulPartLen  /* bytes of data to be digested */
 
531
);
 
532
#endif
 
533
 
 
534
 
 
535
/* C_DigestKey continues a multi-part message-digesting
 
536
 * operation, by digesting the value of a secret key as part of
 
537
 * the data already digested. */
 
538
CK_PKCS11_FUNCTION_INFO(C_DigestKey)
 
539
#ifdef CK_NEED_ARG_LIST
 
540
(
 
541
  CK_SESSION_HANDLE hSession,  /* the session's handle */
 
542
  CK_OBJECT_HANDLE  hKey       /* secret key to digest */
 
543
);
 
544
#endif
 
545
 
 
546
 
 
547
/* C_DigestFinal finishes a multiple-part message-digesting
 
548
 * operation. */
 
549
CK_PKCS11_FUNCTION_INFO(C_DigestFinal)
 
550
#ifdef CK_NEED_ARG_LIST
 
551
(
 
552
  CK_SESSION_HANDLE hSession,     /* the session's handle */
 
553
  CK_BYTE_PTR       pDigest,      /* gets the message digest */
 
554
  CK_ULONG_PTR      pulDigestLen  /* gets byte count of digest */
 
555
);
 
556
#endif
 
557
 
 
558
 
 
559
 
 
560
/* Signing and MACing */
 
561
 
 
562
/* C_SignInit initializes a signature (private key encryption)
 
563
 * operation, where the signature is (will be) an appendix to
 
564
 * the data, and plaintext cannot be recovered from the
 
565
 *signature. */
 
566
CK_PKCS11_FUNCTION_INFO(C_SignInit)
 
567
#ifdef CK_NEED_ARG_LIST
 
568
(
 
569
  CK_SESSION_HANDLE hSession,    /* the session's handle */
 
570
  CK_MECHANISM_PTR  pMechanism,  /* the signature mechanism */
 
571
  CK_OBJECT_HANDLE  hKey         /* handle of signature key */
 
572
);
 
573
#endif
 
574
 
 
575
 
 
576
/* C_Sign signs (encrypts with private key) data in a single
 
577
 * part, where the signature is (will be) an appendix to the
 
578
 * data, and plaintext cannot be recovered from the signature. */
 
579
CK_PKCS11_FUNCTION_INFO(C_Sign)
 
580
#ifdef CK_NEED_ARG_LIST
 
581
(
 
582
  CK_SESSION_HANDLE hSession,        /* the session's handle */
 
583
  CK_BYTE_PTR       pData,           /* the data to sign */
 
584
  CK_ULONG          ulDataLen,       /* count of bytes to sign */
 
585
  CK_BYTE_PTR       pSignature,      /* gets the signature */
 
586
  CK_ULONG_PTR      pulSignatureLen  /* gets signature length */
 
587
);
 
588
#endif
 
589
 
 
590
 
 
591
/* C_SignUpdate continues a multiple-part signature operation,
 
592
 * where the signature is (will be) an appendix to the data, 
 
593
 * and plaintext cannot be recovered from the signature. */
 
594
CK_PKCS11_FUNCTION_INFO(C_SignUpdate)
 
595
#ifdef CK_NEED_ARG_LIST
 
596
(
 
597
  CK_SESSION_HANDLE hSession,  /* the session's handle */
 
598
  CK_BYTE_PTR       pPart,     /* the data to sign */
 
599
  CK_ULONG          ulPartLen  /* count of bytes to sign */
 
600
);
 
601
#endif
 
602
 
 
603
 
 
604
/* C_SignFinal finishes a multiple-part signature operation, 
 
605
 * returning the signature. */
 
606
CK_PKCS11_FUNCTION_INFO(C_SignFinal)
 
607
#ifdef CK_NEED_ARG_LIST
 
608
(
 
609
  CK_SESSION_HANDLE hSession,        /* the session's handle */
 
610
  CK_BYTE_PTR       pSignature,      /* gets the signature */
 
611
  CK_ULONG_PTR      pulSignatureLen  /* gets signature length */
 
612
);
 
613
#endif
 
614
 
 
615
 
 
616
/* C_SignRecoverInit initializes a signature operation, where
 
617
 * the data can be recovered from the signature. */
 
618
CK_PKCS11_FUNCTION_INFO(C_SignRecoverInit)
 
619
#ifdef CK_NEED_ARG_LIST
 
620
(
 
621
  CK_SESSION_HANDLE hSession,   /* the session's handle */
 
622
  CK_MECHANISM_PTR  pMechanism, /* the signature mechanism */
 
623
  CK_OBJECT_HANDLE  hKey        /* handle of the signature key */
 
624
);
 
625
#endif
 
626
 
 
627
 
 
628
/* C_SignRecover signs data in a single operation, where the
 
629
 * data can be recovered from the signature. */
 
630
CK_PKCS11_FUNCTION_INFO(C_SignRecover)
 
631
#ifdef CK_NEED_ARG_LIST
 
632
(
 
633
  CK_SESSION_HANDLE hSession,        /* the session's handle */
 
634
  CK_BYTE_PTR       pData,           /* the data to sign */
 
635
  CK_ULONG          ulDataLen,       /* count of bytes to sign */
 
636
  CK_BYTE_PTR       pSignature,      /* gets the signature */
 
637
  CK_ULONG_PTR      pulSignatureLen  /* gets signature length */
 
638
);
 
639
#endif
 
640
 
 
641
 
 
642
 
 
643
/* Verifying signatures and MACs */
 
644
 
 
645
/* C_VerifyInit initializes a verification operation, where the
 
646
 * signature is an appendix to the data, and plaintext cannot
 
647
 *  cannot be recovered from the signature (e.g. DSA). */
 
648
CK_PKCS11_FUNCTION_INFO(C_VerifyInit)
 
649
#ifdef CK_NEED_ARG_LIST
 
650
(
 
651
  CK_SESSION_HANDLE hSession,    /* the session's handle */
 
652
  CK_MECHANISM_PTR  pMechanism,  /* the verification mechanism */
 
653
  CK_OBJECT_HANDLE  hKey         /* verification key */ 
 
654
);
 
655
#endif
 
656
 
 
657
 
 
658
/* C_Verify verifies a signature in a single-part operation, 
 
659
 * where the signature is an appendix to the data, and plaintext
 
660
 * cannot be recovered from the signature. */
 
661
CK_PKCS11_FUNCTION_INFO(C_Verify)
 
662
#ifdef CK_NEED_ARG_LIST
 
663
(
 
664
  CK_SESSION_HANDLE hSession,       /* the session's handle */
 
665
  CK_BYTE_PTR       pData,          /* signed data */
 
666
  CK_ULONG          ulDataLen,      /* length of signed data */
 
667
  CK_BYTE_PTR       pSignature,     /* signature */
 
668
  CK_ULONG          ulSignatureLen  /* signature length*/
 
669
);
 
670
#endif
 
671
 
 
672
 
 
673
/* C_VerifyUpdate continues a multiple-part verification
 
674
 * operation, where the signature is an appendix to the data, 
 
675
 * and plaintext cannot be recovered from the signature. */
 
676
CK_PKCS11_FUNCTION_INFO(C_VerifyUpdate)
 
677
#ifdef CK_NEED_ARG_LIST
 
678
(
 
679
  CK_SESSION_HANDLE hSession,  /* the session's handle */
 
680
  CK_BYTE_PTR       pPart,     /* signed data */
 
681
  CK_ULONG          ulPartLen  /* length of signed data */
 
682
);
 
683
#endif
 
684
 
 
685
 
 
686
/* C_VerifyFinal finishes a multiple-part verification
 
687
 * operation, checking the signature. */
 
688
CK_PKCS11_FUNCTION_INFO(C_VerifyFinal)
 
689
#ifdef CK_NEED_ARG_LIST
 
690
(
 
691
  CK_SESSION_HANDLE hSession,       /* the session's handle */
 
692
  CK_BYTE_PTR       pSignature,     /* signature to verify */
 
693
  CK_ULONG          ulSignatureLen  /* signature length */
 
694
);
 
695
#endif
 
696
 
 
697
 
 
698
/* C_VerifyRecoverInit initializes a signature verification
 
699
 * operation, where the data is recovered from the signature. */
 
700
CK_PKCS11_FUNCTION_INFO(C_VerifyRecoverInit)
 
701
#ifdef CK_NEED_ARG_LIST
 
702
(
 
703
  CK_SESSION_HANDLE hSession,    /* the session's handle */
 
704
  CK_MECHANISM_PTR  pMechanism,  /* the verification mechanism */
 
705
  CK_OBJECT_HANDLE  hKey         /* verification key */
 
706
);
 
707
#endif
 
708
 
 
709
 
 
710
/* C_VerifyRecover verifies a signature in a single-part
 
711
 * operation, where the data is recovered from the signature. */
 
712
CK_PKCS11_FUNCTION_INFO(C_VerifyRecover)
 
713
#ifdef CK_NEED_ARG_LIST
 
714
(
 
715
  CK_SESSION_HANDLE hSession,        /* the session's handle */
 
716
  CK_BYTE_PTR       pSignature,      /* signature to verify */
 
717
  CK_ULONG          ulSignatureLen,  /* signature length */
 
718
  CK_BYTE_PTR       pData,           /* gets signed data */
 
719
  CK_ULONG_PTR      pulDataLen       /* gets signed data len */
 
720
);
 
721
#endif
 
722
 
 
723
 
 
724
 
 
725
/* Dual-function cryptographic operations */
 
726
 
 
727
/* C_DigestEncryptUpdate continues a multiple-part digesting
 
728
 * and encryption operation. */
 
729
CK_PKCS11_FUNCTION_INFO(C_DigestEncryptUpdate)
 
730
#ifdef CK_NEED_ARG_LIST
 
731
(
 
732
  CK_SESSION_HANDLE hSession,            /* session's handle */
 
733
  CK_BYTE_PTR       pPart,               /* the plaintext data */
 
734
  CK_ULONG          ulPartLen,           /* plaintext length */
 
735
  CK_BYTE_PTR       pEncryptedPart,      /* gets ciphertext */
 
736
  CK_ULONG_PTR      pulEncryptedPartLen  /* gets c-text length */
 
737
);
 
738
#endif
 
739
 
 
740
 
 
741
/* C_DecryptDigestUpdate continues a multiple-part decryption and
 
742
 * digesting operation. */
 
743
CK_PKCS11_FUNCTION_INFO(C_DecryptDigestUpdate)
 
744
#ifdef CK_NEED_ARG_LIST
 
745
(
 
746
  CK_SESSION_HANDLE hSession,            /* session's handle */
 
747
  CK_BYTE_PTR       pEncryptedPart,      /* ciphertext */
 
748
  CK_ULONG          ulEncryptedPartLen,  /* ciphertext length */
 
749
  CK_BYTE_PTR       pPart,               /* gets plaintext */
 
750
  CK_ULONG_PTR      pulPartLen           /* gets plaintext len */
 
751
);
 
752
#endif
 
753
 
 
754
 
 
755
/* C_SignEncryptUpdate continues a multiple-part signing and
 
756
 * encryption operation. */
 
757
CK_PKCS11_FUNCTION_INFO(C_SignEncryptUpdate)
 
758
#ifdef CK_NEED_ARG_LIST
 
759
(
 
760
  CK_SESSION_HANDLE hSession,            /* session's handle */
 
761
  CK_BYTE_PTR       pPart,               /* the plaintext data */
 
762
  CK_ULONG          ulPartLen,           /* plaintext length */
 
763
  CK_BYTE_PTR       pEncryptedPart,      /* gets ciphertext */
 
764
  CK_ULONG_PTR      pulEncryptedPartLen  /* gets c-text length */
 
765
);
 
766
#endif
 
767
 
 
768
 
 
769
/* C_DecryptVerifyUpdate continues a multiple-part decryption and
 
770
 * verify operation. */
 
771
CK_PKCS11_FUNCTION_INFO(C_DecryptVerifyUpdate)
 
772
#ifdef CK_NEED_ARG_LIST
 
773
(
 
774
  CK_SESSION_HANDLE hSession,            /* session's handle */
 
775
  CK_BYTE_PTR       pEncryptedPart,      /* ciphertext */
 
776
  CK_ULONG          ulEncryptedPartLen,  /* ciphertext length */
 
777
  CK_BYTE_PTR       pPart,               /* gets plaintext */
 
778
  CK_ULONG_PTR      pulPartLen           /* gets p-text length */
 
779
);
 
780
#endif
 
781
 
 
782
 
 
783
 
 
784
/* Key management */
 
785
 
 
786
/* C_GenerateKey generates a secret key, creating a new key
 
787
 * object. */
 
788
CK_PKCS11_FUNCTION_INFO(C_GenerateKey)
 
789
#ifdef CK_NEED_ARG_LIST
 
790
(
 
791
  CK_SESSION_HANDLE    hSession,    /* the session's handle */
 
792
  CK_MECHANISM_PTR     pMechanism,  /* key generation mech. */
 
793
  CK_ATTRIBUTE_PTR     pTemplate,   /* template for new key */
 
794
  CK_ULONG             ulCount,     /* # of attrs in template */
 
795
  CK_OBJECT_HANDLE_PTR phKey        /* gets handle of new key */
 
796
);
 
797
#endif
 
798
 
 
799
 
 
800
/* C_GenerateKeyPair generates a public-key/private-key pair, 
 
801
 * creating new key objects. */
 
802
CK_PKCS11_FUNCTION_INFO(C_GenerateKeyPair)
 
803
#ifdef CK_NEED_ARG_LIST
 
804
(
 
805
  CK_SESSION_HANDLE    hSession,                    /* session
 
806
                                                     * handle */
 
807
  CK_MECHANISM_PTR     pMechanism,                  /* key-gen
 
808
                                                     * mech. */
 
809
  CK_ATTRIBUTE_PTR     pPublicKeyTemplate,          /* template
 
810
                                                     * for pub.
 
811
                                                     * key */
 
812
  CK_ULONG             ulPublicKeyAttributeCount,   /* # pub.
 
813
                                                     * attrs. */
 
814
  CK_ATTRIBUTE_PTR     pPrivateKeyTemplate,         /* template
 
815
                                                     * for priv.
 
816
                                                     * key */
 
817
  CK_ULONG             ulPrivateKeyAttributeCount,  /* # priv.
 
818
                                                     * attrs. */
 
819
  CK_OBJECT_HANDLE_PTR phPublicKey,                 /* gets pub.
 
820
                                                     * key
 
821
                                                     * handle */
 
822
  CK_OBJECT_HANDLE_PTR phPrivateKey                 /* gets
 
823
                                                     * priv. key
 
824
                                                     * handle */
 
825
);
 
826
#endif
 
827
 
 
828
 
 
829
/* C_WrapKey wraps (i.e., encrypts) a key. */
 
830
CK_PKCS11_FUNCTION_INFO(C_WrapKey)
 
831
#ifdef CK_NEED_ARG_LIST
 
832
(
 
833
  CK_SESSION_HANDLE hSession,        /* the session's handle */
 
834
  CK_MECHANISM_PTR  pMechanism,      /* the wrapping mechanism */
 
835
  CK_OBJECT_HANDLE  hWrappingKey,    /* wrapping key */
 
836
  CK_OBJECT_HANDLE  hKey,            /* key to be wrapped */
 
837
  CK_BYTE_PTR       pWrappedKey,     /* gets wrapped key */
 
838
  CK_ULONG_PTR      pulWrappedKeyLen /* gets wrapped key size */
 
839
);
 
840
#endif
 
841
 
 
842
 
 
843
/* C_UnwrapKey unwraps (decrypts) a wrapped key, creating a new
 
844
 * key object. */
 
845
CK_PKCS11_FUNCTION_INFO(C_UnwrapKey)
 
846
#ifdef CK_NEED_ARG_LIST
 
847
(
 
848
  CK_SESSION_HANDLE    hSession,          /* session's handle */
 
849
  CK_MECHANISM_PTR     pMechanism,        /* unwrapping mech. */
 
850
  CK_OBJECT_HANDLE     hUnwrappingKey,    /* unwrapping key */
 
851
  CK_BYTE_PTR          pWrappedKey,       /* the wrapped key */
 
852
  CK_ULONG             ulWrappedKeyLen,   /* wrapped key len */
 
853
  CK_ATTRIBUTE_PTR     pTemplate,         /* new key template */
 
854
  CK_ULONG             ulAttributeCount,  /* template length */
 
855
  CK_OBJECT_HANDLE_PTR phKey              /* gets new handle */
 
856
);
 
857
#endif
 
858
 
 
859
 
 
860
/* C_DeriveKey derives a key from a base key, creating a new key
 
861
 * object. */
 
862
CK_PKCS11_FUNCTION_INFO(C_DeriveKey)
 
863
#ifdef CK_NEED_ARG_LIST
 
864
(
 
865
  CK_SESSION_HANDLE    hSession,          /* session's handle */
 
866
  CK_MECHANISM_PTR     pMechanism,        /* key deriv. mech. */
 
867
  CK_OBJECT_HANDLE     hBaseKey,          /* base key */
 
868
  CK_ATTRIBUTE_PTR     pTemplate,         /* new key template */
 
869
  CK_ULONG             ulAttributeCount,  /* template length */
 
870
  CK_OBJECT_HANDLE_PTR phKey              /* gets new handle */
 
871
);
 
872
#endif
 
873
 
 
874
 
 
875
 
 
876
/* Random number generation */
 
877
 
 
878
/* C_SeedRandom mixes additional seed material into the token's
 
879
 * random number generator. */
 
880
CK_PKCS11_FUNCTION_INFO(C_SeedRandom)
 
881
#ifdef CK_NEED_ARG_LIST
 
882
(
 
883
  CK_SESSION_HANDLE hSession,  /* the session's handle */
 
884
  CK_BYTE_PTR       pSeed,     /* the seed material */
 
885
  CK_ULONG          ulSeedLen  /* length of seed material */
 
886
);
 
887
#endif
 
888
 
 
889
 
 
890
/* C_GenerateRandom generates random data. */
 
891
CK_PKCS11_FUNCTION_INFO(C_GenerateRandom)
 
892
#ifdef CK_NEED_ARG_LIST
 
893
(
 
894
  CK_SESSION_HANDLE hSession,    /* the session's handle */
 
895
  CK_BYTE_PTR       RandomData,  /* receives the random data */
 
896
  CK_ULONG          ulRandomLen  /* # of bytes to generate */
 
897
);
 
898
#endif
 
899
 
 
900
 
 
901
 
 
902
/* Parallel function management */
 
903
 
 
904
/* C_GetFunctionStatus is a legacy function; it obtains an
 
905
 * updated status of a function running in parallel with an
 
906
 * application. */
 
907
CK_PKCS11_FUNCTION_INFO(C_GetFunctionStatus)
 
908
#ifdef CK_NEED_ARG_LIST
 
909
(
 
910
  CK_SESSION_HANDLE hSession  /* the session's handle */
 
911
);
 
912
#endif
 
913
 
 
914
 
 
915
/* C_CancelFunction is a legacy function; it cancels a function
 
916
 * running in parallel. */
 
917
CK_PKCS11_FUNCTION_INFO(C_CancelFunction)
 
918
#ifdef CK_NEED_ARG_LIST
 
919
(
 
920
  CK_SESSION_HANDLE hSession  /* the session's handle */
 
921
);
 
922
#endif
 
923
 
 
924
 
 
925
 
 
926
/* Functions added in for PKCS #11 Version 2.01 or later */
 
927
 
 
928
/* C_WaitForSlotEvent waits for a slot event (token insertion,
 
929
 * removal, etc.) to occur. */
 
930
CK_PKCS11_FUNCTION_INFO(C_WaitForSlotEvent)
 
931
#ifdef CK_NEED_ARG_LIST
 
932
(
 
933
  CK_FLAGS flags,        /* blocking/nonblocking flag */
 
934
  CK_SLOT_ID_PTR pSlot,  /* location that receives the slot ID */
 
935
  CK_VOID_PTR pRserved   /* reserved.  Should be NULL_PTR */
 
936
);
 
937
#endif