pk11_api.c File Reference

#include <config.h>
#include <string.h>
#include <dlfcn.h>
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/once.h>
#include <isc/stdio.h>
#include <isc/thread.h>
#include <isc/util.h>
#include <pkcs11/cryptoki.h>
#include <pkcs11/pkcs11.h>
#include <pk11/pk11.h>
#include <pk11/internal.h>

Go to the source code of this file.

Defines

#define KEEP_PKCS11_NAMES

Functions

CK_RV pkcs_C_Initialize (CK_VOID_PTR pReserved)
CK_RV pkcs_C_Finalize (CK_VOID_PTR pReserved)
CK_RV pkcs_C_GetSlotList (CK_BBOOL tokenPresent, CK_SLOT_ID_PTR pSlotList, CK_ULONG_PTR pulCount)
CK_RV pkcs_C_GetTokenInfo (CK_SLOT_ID slotID, CK_TOKEN_INFO_PTR pInfo)
CK_RV pkcs_C_GetMechanismInfo (CK_SLOT_ID slotID, CK_MECHANISM_TYPE type, CK_MECHANISM_INFO_PTR pInfo)
CK_RV pkcs_C_OpenSession (CK_SLOT_ID slotID, CK_FLAGS flags, CK_VOID_PTR pApplication, CK_RV(*Notify)(CK_SESSION_HANDLE hSession, CK_NOTIFICATION event, CK_VOID_PTR pApplication), CK_SESSION_HANDLE_PTR phSession)
CK_RV pkcs_C_CloseSession (CK_SESSION_HANDLE hSession)
CK_RV pkcs_C_Login (CK_SESSION_HANDLE hSession, CK_USER_TYPE userType, CK_CHAR_PTR pPin, CK_ULONG usPinLen)
CK_RV pkcs_C_Logout (CK_SESSION_HANDLE hSession)
CK_RV pkcs_C_CreateObject (CK_SESSION_HANDLE hSession, CK_ATTRIBUTE_PTR pTemplate, CK_ULONG usCount, CK_OBJECT_HANDLE_PTR phObject)
CK_RV pkcs_C_DestroyObject (CK_SESSION_HANDLE hSession, CK_OBJECT_HANDLE hObject)
CK_RV pkcs_C_GetAttributeValue (CK_SESSION_HANDLE hSession, CK_OBJECT_HANDLE hObject, CK_ATTRIBUTE_PTR pTemplate, CK_ULONG usCount)
CK_RV pkcs_C_SetAttributeValue (CK_SESSION_HANDLE hSession, CK_OBJECT_HANDLE hObject, CK_ATTRIBUTE_PTR pTemplate, CK_ULONG usCount)
CK_RV pkcs_C_FindObjectsInit (CK_SESSION_HANDLE hSession, CK_ATTRIBUTE_PTR pTemplate, CK_ULONG usCount)
CK_RV pkcs_C_FindObjects (CK_SESSION_HANDLE hSession, CK_OBJECT_HANDLE_PTR phObject, CK_ULONG usMaxObjectCount, CK_ULONG_PTR pusObjectCount)
CK_RV pkcs_C_FindObjectsFinal (CK_SESSION_HANDLE hSession)
CK_RV pkcs_C_EncryptInit (CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism, CK_OBJECT_HANDLE hKey)
CK_RV pkcs_C_Encrypt (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pData, CK_ULONG ulDataLen, CK_BYTE_PTR pEncryptedData, CK_ULONG_PTR pulEncryptedDataLen)
CK_RV pkcs_C_DigestInit (CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism)
CK_RV pkcs_C_DigestUpdate (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pPart, CK_ULONG ulPartLen)
CK_RV pkcs_C_DigestFinal (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pDigest, CK_ULONG_PTR pulDigestLen)
CK_RV pkcs_C_SignInit (CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism, CK_OBJECT_HANDLE hKey)
CK_RV pkcs_C_Sign (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pData, CK_ULONG ulDataLen, CK_BYTE_PTR pSignature, CK_ULONG_PTR pulSignatureLen)
CK_RV pkcs_C_SignUpdate (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pPart, CK_ULONG ulPartLen)
CK_RV pkcs_C_SignFinal (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pSignature, CK_ULONG_PTR pulSignatureLen)
CK_RV pkcs_C_VerifyInit (CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism, CK_OBJECT_HANDLE hKey)
CK_RV pkcs_C_Verify (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pData, CK_ULONG ulDataLen, CK_BYTE_PTR pSignature, CK_ULONG ulSignatureLen)
CK_RV pkcs_C_VerifyUpdate (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pPart, CK_ULONG ulPartLen)
CK_RV pkcs_C_VerifyFinal (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pSignature, CK_ULONG ulSignatureLen)
CK_RV pkcs_C_GenerateKey (CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism, CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount, CK_OBJECT_HANDLE_PTR phKey)
CK_RV pkcs_C_GenerateKeyPair (CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism, CK_ATTRIBUTE_PTR pPublicKeyTemplate, CK_ULONG usPublicKeyAttributeCount, CK_ATTRIBUTE_PTR pPrivateKeyTemplate, CK_ULONG usPrivateKeyAttributeCount, CK_OBJECT_HANDLE_PTR phPrivateKey, CK_OBJECT_HANDLE_PTR phPublicKey)
CK_RV pkcs_C_DeriveKey (CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism, CK_OBJECT_HANDLE hBaseKey, CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulAttributeCount, CK_OBJECT_HANDLE_PTR phKey)
CK_RV pkcs_C_SeedRandom (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pSeed, CK_ULONG ulSeedLen)
CK_RV pkcs_C_GenerateRandom (CK_SESSION_HANDLE hSession, CK_BYTE_PTR RandomData, CK_ULONG ulRandomLen)

Variables

static void * hPK11 = NULL


Detailed Description

Definition in file pk11_api.c.


Define Documentation

#define KEEP_PKCS11_NAMES

Definition at line 36 of file pk11_api.c.


Function Documentation

CK_RV pkcs_C_Initialize ( CK_VOID_PTR  pReserved  ) 

Definition at line 43 of file pk11_api.c.

References CKR_LIBRARY_ALREADY_INITIALIZED, CKR_LIBRARY_FAILED_TO_LOAD, CKR_SYMBOL_RESOLUTION_FAILED, hPK11, and pk11_get_lib_name().

Referenced by pk11_initialize().

CK_RV pkcs_C_Finalize ( CK_VOID_PTR  pReserved  ) 

Definition at line 60 of file pk11_api.c.

References CKR_LIBRARY_FAILED_TO_LOAD, CKR_OK, CKR_SYMBOL_RESOLUTION_FAILED, and hPK11.

Referenced by pk11_finalize().

CK_RV pkcs_C_GetSlotList ( CK_BBOOL  tokenPresent,
CK_SLOT_ID_PTR  pSlotList,
CK_ULONG_PTR  pulCount 
)

Definition at line 77 of file pk11_api.c.

References CKR_LIBRARY_FAILED_TO_LOAD, CKR_SYMBOL_RESOLUTION_FAILED, and hPK11.

Referenced by choose_slots().

CK_RV pkcs_C_GetTokenInfo ( CK_SLOT_ID  slotID,
CK_TOKEN_INFO_PTR  pInfo 
)

Definition at line 95 of file pk11_api.c.

References CKR_LIBRARY_FAILED_TO_LOAD, CKR_SYMBOL_RESOLUTION_FAILED, and hPK11.

Referenced by choose_slots().

CK_RV pkcs_C_GetMechanismInfo ( CK_SLOT_ID  slotID,
CK_MECHANISM_TYPE  type,
CK_MECHANISM_INFO_PTR  pInfo 
)

Definition at line 111 of file pk11_api.c.

References CKR_LIBRARY_FAILED_TO_LOAD, CKR_SYMBOL_RESOLUTION_FAILED, and hPK11.

Referenced by choose_slots().

CK_RV pkcs_C_OpenSession ( CK_SLOT_ID  slotID,
CK_FLAGS  flags,
CK_VOID_PTR  pApplication,
CK_RV(*)(CK_SESSION_HANDLE hSession, CK_NOTIFICATION event, CK_VOID_PTR pApplication Notify,
CK_SESSION_HANDLE_PTR  phSession 
)

Definition at line 130 of file pk11_api.c.

References CKR_LIBRARY_FAILED_TO_LOAD, CKR_SYMBOL_RESOLUTION_FAILED, hPK11, and pk11_get_lib_name().

Referenced by setup_session().

CK_RV pkcs_C_CloseSession ( CK_SESSION_HANDLE  hSession  ) 

Definition at line 154 of file pk11_api.c.

References CKR_LIBRARY_FAILED_TO_LOAD, CKR_SYMBOL_RESOLUTION_FAILED, and hPK11.

Referenced by free_session_list().

CK_RV pkcs_C_Login ( CK_SESSION_HANDLE  hSession,
CK_USER_TYPE  userType,
CK_CHAR_PTR  pPin,
CK_ULONG  usPinLen 
)

Definition at line 170 of file pk11_api.c.

References CKR_LIBRARY_FAILED_TO_LOAD, CKR_SYMBOL_RESOLUTION_FAILED, and hPK11.

Referenced by token_login().

CK_RV pkcs_C_Logout ( CK_SESSION_HANDLE  hSession  ) 

Definition at line 188 of file pk11_api.c.

References CKR_LIBRARY_FAILED_TO_LOAD, CKR_SYMBOL_RESOLUTION_FAILED, and hPK11.

CK_RV pkcs_C_CreateObject ( CK_SESSION_HANDLE  hSession,
CK_ATTRIBUTE_PTR  pTemplate,
CK_ULONG  usCount,
CK_OBJECT_HANDLE_PTR  phObject 
)

Definition at line 204 of file pk11_api.c.

References CKR_LIBRARY_FAILED_TO_LOAD, CKR_SYMBOL_RESOLUTION_FAILED, and hPK11.

CK_RV pkcs_C_DestroyObject ( CK_SESSION_HANDLE  hSession,
CK_OBJECT_HANDLE  hObject 
)

Definition at line 222 of file pk11_api.c.

References CKR_LIBRARY_FAILED_TO_LOAD, CKR_SYMBOL_RESOLUTION_FAILED, and hPK11.

CK_RV pkcs_C_GetAttributeValue ( CK_SESSION_HANDLE  hSession,
CK_OBJECT_HANDLE  hObject,
CK_ATTRIBUTE_PTR  pTemplate,
CK_ULONG  usCount 
)

Definition at line 238 of file pk11_api.c.

References CKR_LIBRARY_FAILED_TO_LOAD, CKR_SYMBOL_RESOLUTION_FAILED, and hPK11.

CK_RV pkcs_C_SetAttributeValue ( CK_SESSION_HANDLE  hSession,
CK_OBJECT_HANDLE  hObject,
CK_ATTRIBUTE_PTR  pTemplate,
CK_ULONG  usCount 
)

Definition at line 257 of file pk11_api.c.

References CKR_LIBRARY_FAILED_TO_LOAD, CKR_SYMBOL_RESOLUTION_FAILED, and hPK11.

CK_RV pkcs_C_FindObjectsInit ( CK_SESSION_HANDLE  hSession,
CK_ATTRIBUTE_PTR  pTemplate,
CK_ULONG  usCount 
)

Definition at line 276 of file pk11_api.c.

References CKR_LIBRARY_FAILED_TO_LOAD, CKR_SYMBOL_RESOLUTION_FAILED, and hPK11.

CK_RV pkcs_C_FindObjects ( CK_SESSION_HANDLE  hSession,
CK_OBJECT_HANDLE_PTR  phObject,
CK_ULONG  usMaxObjectCount,
CK_ULONG_PTR  pusObjectCount 
)

Definition at line 294 of file pk11_api.c.

References CKR_LIBRARY_FAILED_TO_LOAD, CKR_SYMBOL_RESOLUTION_FAILED, and hPK11.

CK_RV pkcs_C_FindObjectsFinal ( CK_SESSION_HANDLE  hSession  ) 

Definition at line 312 of file pk11_api.c.

References CKR_LIBRARY_FAILED_TO_LOAD, CKR_SYMBOL_RESOLUTION_FAILED, and hPK11.

CK_RV pkcs_C_EncryptInit ( CK_SESSION_HANDLE  hSession,
CK_MECHANISM_PTR  pMechanism,
CK_OBJECT_HANDLE  hKey 
)

Definition at line 330 of file pk11_api.c.

References CKR_LIBRARY_FAILED_TO_LOAD, CKR_SYMBOL_RESOLUTION_FAILED, and hPK11.

CK_RV pkcs_C_Encrypt ( CK_SESSION_HANDLE  hSession,
CK_BYTE_PTR  pData,
CK_ULONG  ulDataLen,
CK_BYTE_PTR  pEncryptedData,
CK_ULONG_PTR  pulEncryptedDataLen 
)

Definition at line 348 of file pk11_api.c.

References CKR_LIBRARY_FAILED_TO_LOAD, CKR_SYMBOL_RESOLUTION_FAILED, and hPK11.

CK_RV pkcs_C_DigestInit ( CK_SESSION_HANDLE  hSession,
CK_MECHANISM_PTR  pMechanism 
)

Definition at line 368 of file pk11_api.c.

References CKR_LIBRARY_FAILED_TO_LOAD, CKR_SYMBOL_RESOLUTION_FAILED, and hPK11.

CK_RV pkcs_C_DigestUpdate ( CK_SESSION_HANDLE  hSession,
CK_BYTE_PTR  pPart,
CK_ULONG  ulPartLen 
)

Definition at line 384 of file pk11_api.c.

References CKR_LIBRARY_FAILED_TO_LOAD, CKR_SYMBOL_RESOLUTION_FAILED, and hPK11.

CK_RV pkcs_C_DigestFinal ( CK_SESSION_HANDLE  hSession,
CK_BYTE_PTR  pDigest,
CK_ULONG_PTR  pulDigestLen 
)

Definition at line 402 of file pk11_api.c.

References CKR_LIBRARY_FAILED_TO_LOAD, CKR_SYMBOL_RESOLUTION_FAILED, and hPK11.

CK_RV pkcs_C_SignInit ( CK_SESSION_HANDLE  hSession,
CK_MECHANISM_PTR  pMechanism,
CK_OBJECT_HANDLE  hKey 
)

Definition at line 420 of file pk11_api.c.

References CKR_LIBRARY_FAILED_TO_LOAD, CKR_SYMBOL_RESOLUTION_FAILED, and hPK11.

CK_RV pkcs_C_Sign ( CK_SESSION_HANDLE  hSession,
CK_BYTE_PTR  pData,
CK_ULONG  ulDataLen,
CK_BYTE_PTR  pSignature,
CK_ULONG_PTR  pulSignatureLen 
)

Definition at line 438 of file pk11_api.c.

References CKR_LIBRARY_FAILED_TO_LOAD, CKR_SYMBOL_RESOLUTION_FAILED, and hPK11.

CK_RV pkcs_C_SignUpdate ( CK_SESSION_HANDLE  hSession,
CK_BYTE_PTR  pPart,
CK_ULONG  ulPartLen 
)

Definition at line 457 of file pk11_api.c.

References CKR_LIBRARY_FAILED_TO_LOAD, CKR_SYMBOL_RESOLUTION_FAILED, and hPK11.

CK_RV pkcs_C_SignFinal ( CK_SESSION_HANDLE  hSession,
CK_BYTE_PTR  pSignature,
CK_ULONG_PTR  pulSignatureLen 
)

Definition at line 475 of file pk11_api.c.

References CKR_LIBRARY_FAILED_TO_LOAD, CKR_SYMBOL_RESOLUTION_FAILED, and hPK11.

CK_RV pkcs_C_VerifyInit ( CK_SESSION_HANDLE  hSession,
CK_MECHANISM_PTR  pMechanism,
CK_OBJECT_HANDLE  hKey 
)

Definition at line 493 of file pk11_api.c.

References CKR_LIBRARY_FAILED_TO_LOAD, CKR_SYMBOL_RESOLUTION_FAILED, and hPK11.

CK_RV pkcs_C_Verify ( CK_SESSION_HANDLE  hSession,
CK_BYTE_PTR  pData,
CK_ULONG  ulDataLen,
CK_BYTE_PTR  pSignature,
CK_ULONG  ulSignatureLen 
)

Definition at line 511 of file pk11_api.c.

References CKR_LIBRARY_FAILED_TO_LOAD, CKR_SYMBOL_RESOLUTION_FAILED, and hPK11.

CK_RV pkcs_C_VerifyUpdate ( CK_SESSION_HANDLE  hSession,
CK_BYTE_PTR  pPart,
CK_ULONG  ulPartLen 
)

Definition at line 530 of file pk11_api.c.

References CKR_LIBRARY_FAILED_TO_LOAD, CKR_SYMBOL_RESOLUTION_FAILED, and hPK11.

CK_RV pkcs_C_VerifyFinal ( CK_SESSION_HANDLE  hSession,
CK_BYTE_PTR  pSignature,
CK_ULONG  ulSignatureLen 
)

Definition at line 548 of file pk11_api.c.

References CKR_LIBRARY_FAILED_TO_LOAD, CKR_SYMBOL_RESOLUTION_FAILED, and hPK11.

CK_RV pkcs_C_GenerateKey ( CK_SESSION_HANDLE  hSession,
CK_MECHANISM_PTR  pMechanism,
CK_ATTRIBUTE_PTR  pTemplate,
CK_ULONG  ulCount,
CK_OBJECT_HANDLE_PTR  phKey 
)

Definition at line 566 of file pk11_api.c.

References CKR_LIBRARY_FAILED_TO_LOAD, CKR_SYMBOL_RESOLUTION_FAILED, and hPK11.

CK_RV pkcs_C_GenerateKeyPair ( CK_SESSION_HANDLE  hSession,
CK_MECHANISM_PTR  pMechanism,
CK_ATTRIBUTE_PTR  pPublicKeyTemplate,
CK_ULONG  usPublicKeyAttributeCount,
CK_ATTRIBUTE_PTR  pPrivateKeyTemplate,
CK_ULONG  usPrivateKeyAttributeCount,
CK_OBJECT_HANDLE_PTR  phPrivateKey,
CK_OBJECT_HANDLE_PTR  phPublicKey 
)

Definition at line 585 of file pk11_api.c.

References CKR_LIBRARY_FAILED_TO_LOAD, CKR_SYMBOL_RESOLUTION_FAILED, and hPK11.

CK_RV pkcs_C_DeriveKey ( CK_SESSION_HANDLE  hSession,
CK_MECHANISM_PTR  pMechanism,
CK_OBJECT_HANDLE  hBaseKey,
CK_ATTRIBUTE_PTR  pTemplate,
CK_ULONG  ulAttributeCount,
CK_OBJECT_HANDLE_PTR  phKey 
)

Definition at line 616 of file pk11_api.c.

References CKR_LIBRARY_FAILED_TO_LOAD, CKR_SYMBOL_RESOLUTION_FAILED, and hPK11.

CK_RV pkcs_C_SeedRandom ( CK_SESSION_HANDLE  hSession,
CK_BYTE_PTR  pSeed,
CK_ULONG  ulSeedLen 
)

Definition at line 640 of file pk11_api.c.

References CKR_LIBRARY_FAILED_TO_LOAD, CKR_SYMBOL_RESOLUTION_FAILED, and hPK11.

Referenced by pk11_rand_seed_fromfile().

CK_RV pkcs_C_GenerateRandom ( CK_SESSION_HANDLE  hSession,
CK_BYTE_PTR  RandomData,
CK_ULONG  ulRandomLen 
)

Definition at line 658 of file pk11_api.c.

References CKR_LIBRARY_FAILED_TO_LOAD, CKR_SYMBOL_RESOLUTION_FAILED, and hPK11.

Referenced by pk11_rand_bytes().


Variable Documentation

void* hPK11 = NULL [static]

Definition at line 40 of file pk11_api.c.

Referenced by pkcs_C_CloseSession(), pkcs_C_CreateObject(), pkcs_C_DeriveKey(), pkcs_C_DestroyObject(), pkcs_C_DigestFinal(), pkcs_C_DigestInit(), pkcs_C_DigestUpdate(), pkcs_C_Encrypt(), pkcs_C_EncryptInit(), pkcs_C_Finalize(), pkcs_C_FindObjects(), pkcs_C_FindObjectsFinal(), pkcs_C_FindObjectsInit(), pkcs_C_GenerateKey(), pkcs_C_GenerateKeyPair(), pkcs_C_GenerateRandom(), pkcs_C_GetAttributeValue(), pkcs_C_GetMechanismInfo(), pkcs_C_GetSlotList(), pkcs_C_GetTokenInfo(), pkcs_C_Initialize(), pkcs_C_Login(), pkcs_C_Logout(), pkcs_C_OpenSession(), pkcs_C_SeedRandom(), pkcs_C_SetAttributeValue(), pkcs_C_Sign(), pkcs_C_SignFinal(), pkcs_C_SignInit(), pkcs_C_SignUpdate(), pkcs_C_Verify(), pkcs_C_VerifyFinal(), pkcs_C_VerifyInit(), and pkcs_C_VerifyUpdate().


Generated on Tue Apr 28 17:41:19 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha