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.

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

mercurial