security/nss/lib/util/pkcs11f.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial