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

builtinsInternalObject nss_builtins_data []
const PRUint32 nss_builtins_nObjects
const CK_VERSION nss_builtins_CryptokiVersion
const CK_VERSION nss_builtins_LibraryVersion
const CK_VERSION nss_builtins_HardwareVersion
const CK_VERSION nss_builtins_FirmwareVersion
const NSSUTF8 nss_builtins_ManufacturerID []
const NSSUTF8 nss_builtins_LibraryDescription []
const NSSUTF8 nss_builtins_SlotDescription []
const NSSUTF8 nss_builtins_TokenLabel []
const NSSUTF8 nss_builtins_TokenModel []
const NSSUTF8 nss_builtins_TokenSerialNumber []
const NSSCKMDInstance nss_builtins_mdInstance
const NSSCKMDSlot nss_builtins_mdSlot
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;
}
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;
}
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;
}

Variable Documentation

Definition at line 60 of file constants.c.

builtinsInternalObject nss_builtins_data[]

Definition at line 15524 of file certdata.c.

Definition at line 75 of file constants.c.

Definition at line 70 of file constants.c.

Definition at line 83 of file constants.c.

Definition at line 65 of file constants.c.

Definition at line 80 of file constants.c.

const NSSCKMDInstance nss_builtins_mdInstance

Definition at line 125 of file binst.c.

Definition at line 114 of file bslot.c.

Definition at line 154 of file btoken.c.

Definition at line 15762 of file certdata.c.

Definition at line 86 of file constants.c.

Definition at line 89 of file constants.c.

Definition at line 92 of file constants.c.

Definition at line 96 of file constants.c.