Back to index

lightning-sunbird  0.9+nobinonly
Classes | Typedefs | Functions | Variables
builtins.h File Reference
#include "nssckmdt.h"
#include "nssckfw.h"
#include "base.h"
#include "ckt.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  builtinsInternalObjectStr

Typedefs

typedef struct builtinsInternalObjectStr

Functions

NSS_EXTERN NSSCKMDSession * nss_builtins_CreateSession (NSSCKFWSession *fwSession, CK_RV *pError)
NSS_EXTERN NSSCKMDFindObjects * nss_builtins_FindObjectsInit (NSSCKFWSession *fwSession, CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulAttributeCount, CK_RV *pError)
NSS_EXTERN NSSCKMDObject * nss_builtins_CreateMDObject (NSSArena *arena, builtinsInternalObject *io, CK_RV *pError)

Variables

NSS_EXTERN_DATA
builtinsInternalObject 
nss_builtins_data []
NSS_EXTERN_DATA const PRUint32 nss_builtins_nObjects
NSS_EXTERN_DATA const CK_VERSION nss_builtins_CryptokiVersion
NSS_EXTERN_DATA const NSSUTF8nss_builtins_ManufacturerID
NSS_EXTERN_DATA const NSSUTF8nss_builtins_LibraryDescription
NSS_EXTERN_DATA const CK_VERSION nss_builtins_LibraryVersion
NSS_EXTERN_DATA const NSSUTF8nss_builtins_SlotDescription
NSS_EXTERN_DATA const CK_VERSION nss_builtins_HardwareVersion
NSS_EXTERN_DATA const CK_VERSION nss_builtins_FirmwareVersion
NSS_EXTERN_DATA const NSSUTF8nss_builtins_TokenLabel
NSS_EXTERN_DATA const NSSUTF8nss_builtins_TokenModel
NSS_EXTERN_DATA const NSSUTF8nss_builtins_TokenSerialNumber
NSS_EXTERN_DATA const
NSSCKMDInstance 
nss_builtins_mdInstance
NSS_EXTERN_DATA const NSSCKMDSlot nss_builtins_mdSlot
NSS_EXTERN_DATA const NSSCKMDToken nss_builtins_mdToken

Class Documentation

struct builtinsInternalObjectStr

Definition at line 59 of file builtins.h.

Class Members
const NSSItem * items
NSSCKMDObject mdObject
CK_ULONG n
const CK_ATTRIBUTE_TYPE * types

Typedef Documentation

typedef struct builtinsInternalObjectStr

Definition at line 65 of file builtins.h.


Function Documentation

NSS_EXTERN NSSCKMDObject* nss_builtins_CreateMDObject ( NSSArena *  arena,
builtinsInternalObject *  io,
CK_RV pError 
)

Definition at line 245 of file bobject.c.

{
  if ( (void*)NULL == io->mdObject.etc) {
    (void) nsslibc_memcpy(&io->mdObject,&builtins_prototype_mdObject,
                                   sizeof(builtins_prototype_mdObject));
    io->mdObject.etc = (void *)io;
  }

  return &io->mdObject;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NSS_EXTERN NSSCKMDSession* nss_builtins_CreateSession ( NSSCKFWSession *  fwSession,
CK_RV pError 
)

Definition at line 69 of file bsession.c.

{
  NSSArena *arena;
  NSSCKMDSession *rv;

  arena = NSSCKFWSession_GetArena(fwSession, pError);
  if( (NSSArena *)NULL == arena ) {
    return (NSSCKMDSession *)NULL;
  }

  rv = nss_ZNEW(arena, NSSCKMDSession);
  if( (NSSCKMDSession *)NULL == rv ) {
    *pError = CKR_HOST_MEMORY;
    return (NSSCKMDSession *)NULL;
  }

  /* 
   * rv was zeroed when allocated, so we only 
   * need to set the non-zero members.
   */

  rv->etc = (void *)fwSession;
  /* rv->Close */
  /* rv->GetDeviceError */
  /* rv->Login */
  /* rv->Logout */
  /* rv->InitPIN */
  /* rv->SetPIN */
  /* rv->GetOperationStateLen */
  /* rv->GetOperationState */
  /* rv->SetOperationState */
  /* rv->CreateObject */
  /* rv->CopyObject */
  rv->FindObjectsInit = builtins_mdSession_FindObjectsInit;
  /* rv->SeedRandom */
  /* rv->GetRandom */
  /* rv->null */

  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NSS_EXTERN NSSCKMDFindObjects* nss_builtins_FindObjectsInit ( NSSCKFWSession *  fwSession,
CK_ATTRIBUTE_PTR  pTemplate,
CK_ULONG  ulAttributeCount,
CK_RV pError 
)

Definition at line 210 of file bfind.c.

{
  /* This could be made more efficient.  I'm rather rushed. */
  NSSArena *arena;
  NSSCKMDFindObjects *rv = (NSSCKMDFindObjects *)NULL;
  struct builtinsFOStr *fo = (struct builtinsFOStr *)NULL;
  builtinsInternalObject **temp = (builtinsInternalObject **)NULL;
  PRUint32 i;

  arena = NSSArena_Create();
  if( (NSSArena *)NULL == arena ) {
    goto loser;
  }

  rv = nss_ZNEW(arena, NSSCKMDFindObjects);
  if( (NSSCKMDFindObjects *)NULL == rv ) {
    *pError = CKR_HOST_MEMORY;
    goto loser;
  }

  fo = nss_ZNEW(arena, struct builtinsFOStr);
  if( (struct builtinsFOStr *)NULL == fo ) {
    *pError = CKR_HOST_MEMORY;
    goto loser;
  }

  fo->arena = arena;
  /* fo->n and fo->i are already zero */

  rv->etc = (void *)fo;
  rv->Final = builtins_mdFindObjects_Final;
  rv->Next = builtins_mdFindObjects_Next;
  rv->null = (void *)NULL;

  temp = nss_ZNEWARRAY((NSSArena *)NULL, builtinsInternalObject *, 
                       nss_builtins_nObjects);
  if( (builtinsInternalObject **)NULL == temp ) {
    *pError = CKR_HOST_MEMORY;
    goto loser;
  }

  for( i = 0; i < nss_builtins_nObjects; i++ ) {
    builtinsInternalObject *o = (builtinsInternalObject *)&nss_builtins_data[i];

    if( CK_TRUE == builtins_match(pTemplate, ulAttributeCount, o) ) {
      temp[ fo->n ] = o;
      fo->n++;
    }
  }

  fo->objs = nss_ZNEWARRAY(arena, builtinsInternalObject *, fo->n);
  if( (builtinsInternalObject **)NULL == fo->objs ) {
    *pError = CKR_HOST_MEMORY;
    goto loser;
  }

  (void)nsslibc_memcpy(fo->objs, temp, sizeof(builtinsInternalObject *) * fo->n);
  nss_ZFreeIf(temp);
  temp = (builtinsInternalObject **)NULL;

  return rv;

 loser:
  nss_ZFreeIf(temp);
  nss_ZFreeIf(fo);
  nss_ZFreeIf(rv);
  if ((NSSArena *)NULL != arena) {
     NSSArena_Destroy(arena);
  }
  return (NSSCKMDFindObjects *)NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 70 of file builtins.h.

NSS_EXTERN_DATA builtinsInternalObject nss_builtins_data[]

Definition at line 67 of file builtins.h.

Definition at line 76 of file builtins.h.

Definition at line 75 of file builtins.h.

Definition at line 72 of file builtins.h.

Definition at line 73 of file builtins.h.

Definition at line 71 of file builtins.h.

Definition at line 81 of file builtins.h.

Definition at line 82 of file builtins.h.

Definition at line 83 of file builtins.h.

Definition at line 68 of file builtins.h.

Definition at line 74 of file builtins.h.

Definition at line 77 of file builtins.h.

Definition at line 78 of file builtins.h.

Definition at line 79 of file builtins.h.