Back to index

lightning-sunbird  0.9+nobinonly
Functions
slot.c File Reference
#include "ckdbm.h"

Go to the source code of this file.

Functions

static CK_RV nss_dbm_mdSlot_Initialize (NSSCKMDSlot *mdSlot, NSSCKFWSlot *fwSlot, NSSCKMDInstance *mdInstance, NSSCKFWInstance *fwInstance)
static void nss_dbm_mdSlot_Destroy (NSSCKMDSlot *mdSlot, NSSCKFWSlot *fwSlot, NSSCKMDInstance *mdInstance, NSSCKFWInstance *fwInstance)
static NSSUTF8nss_dbm_mdSlot_GetSlotDescription (NSSCKMDSlot *mdSlot, NSSCKFWSlot *fwSlot, NSSCKMDInstance *mdInstance, NSSCKFWInstance *fwInstance, CK_RV *pError)
static NSSUTF8nss_dbm_mdSlot_GetManufacturerID (NSSCKMDSlot *mdSlot, NSSCKFWSlot *fwSlot, NSSCKMDInstance *mdInstance, NSSCKFWInstance *fwInstance, CK_RV *pError)
static CK_BBOOL nss_dbm_mdSlot_GetTokenPresent (NSSCKMDSlot *mdSlot, NSSCKFWSlot *fwSlot, NSSCKMDInstance *mdInstance, NSSCKFWInstance *fwInstance)
static CK_BBOOL nss_dbm_mdSlot_GetRemovableDevice (NSSCKMDSlot *mdSlot, NSSCKFWSlot *fwSlot, NSSCKMDInstance *mdInstance, NSSCKFWInstance *fwInstance)
static NSSCKMDToken * nss_dbm_mdSlot_GetToken (NSSCKMDSlot *mdSlot, NSSCKFWSlot *fwSlot, NSSCKMDInstance *mdInstance, NSSCKFWInstance *fwInstance, CK_RV *pError)
NSS_IMPLEMENT NSSCKMDSlot * nss_dbm_mdSlot_factory (nss_dbm_instance_t *instance, char *filename, int flags, CK_RV *pError)

Function Documentation

static void nss_dbm_mdSlot_Destroy ( NSSCKMDSlot *  mdSlot,
NSSCKFWSlot *  fwSlot,
NSSCKMDInstance *  mdInstance,
NSSCKFWInstance *  fwInstance 
) [static]

Definition at line 70 of file slot.c.

{
  nss_dbm_slot_t *slot = (nss_dbm_slot_t *)mdSlot->etc;

  if( (nss_dbm_db_t *)NULL != slot->token_db ) {
    nss_dbm_db_close(slot->token_db);
    slot->token_db = (nss_dbm_db_t *)NULL;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

NSS_IMPLEMENT NSSCKMDSlot* nss_dbm_mdSlot_factory ( nss_dbm_instance_t *  instance,
char *  filename,
int  flags,
CK_RV pError 
)

Definition at line 176 of file slot.c.

{
  nss_dbm_slot_t *slot;
  NSSCKMDSlot *rv;

  slot = nss_ZNEW(instance->arena, nss_dbm_slot_t);
  if( (nss_dbm_slot_t *)NULL == slot ) {
    *pError = CKR_HOST_MEMORY;
    return (NSSCKMDSlot *)NULL;
  }

  slot->instance = instance;
  slot->filename = filename;
  slot->flags = flags;
  slot->token_db = (nss_dbm_db_t *)NULL;

  rv = nss_ZNEW(instance->arena, NSSCKMDSlot);
  if( (NSSCKMDSlot *)NULL == rv ) {
    *pError = CKR_HOST_MEMORY;
    return (NSSCKMDSlot *)NULL;
  }

  rv->etc = (void *)slot;
  rv->Initialize = nss_dbm_mdSlot_Initialize;
  rv->Destroy = nss_dbm_mdSlot_Destroy;
  rv->GetSlotDescription = nss_dbm_mdSlot_GetSlotDescription;
  rv->GetManufacturerID = nss_dbm_mdSlot_GetManufacturerID;
  rv->GetTokenPresent = nss_dbm_mdSlot_GetTokenPresent;
  rv->GetRemovableDevice = nss_dbm_mdSlot_GetRemovableDevice;
  /*  GetHardwareSlot */
  /*  GetHardwareVersion */
  /*  GetFirmwareVersion */
  rv->GetToken = nss_dbm_mdSlot_GetToken;
  rv->null = (void *)NULL;

  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static NSSUTF8* nss_dbm_mdSlot_GetManufacturerID ( NSSCKMDSlot *  mdSlot,
NSSCKFWSlot *  fwSlot,
NSSCKMDInstance *  mdInstance,
NSSCKFWInstance *  fwInstance,
CK_RV pError 
) [static]

Definition at line 100 of file slot.c.

{
  return "Berkeley";
}

Here is the caller graph for this function:

static CK_BBOOL nss_dbm_mdSlot_GetRemovableDevice ( NSSCKMDSlot *  mdSlot,
NSSCKFWSlot *  fwSlot,
NSSCKMDInstance *  mdInstance,
NSSCKFWInstance *  fwInstance 
) [static]

Definition at line 131 of file slot.c.

{
  /*
   * Well, this supports "tokens" (databases) that aren't there, so in
   * that sense they're removable.  It'd be nice to handle databases
   * that suddenly disappear (NFS-mounted home directories and network
   * errors, for instance) but that's a harder problem.  We'll say
   * we support removable devices, badly.
   */

  return CK_TRUE;
}

Here is the caller graph for this function:

static NSSUTF8* nss_dbm_mdSlot_GetSlotDescription ( NSSCKMDSlot *  mdSlot,
NSSCKFWSlot *  fwSlot,
NSSCKMDInstance *  mdInstance,
NSSCKFWInstance *  fwInstance,
CK_RV pError 
) [static]

Definition at line 87 of file slot.c.

{
  return "Database";
}

Here is the caller graph for this function:

static NSSCKMDToken* nss_dbm_mdSlot_GetToken ( NSSCKMDSlot *  mdSlot,
NSSCKFWSlot *  fwSlot,
NSSCKMDInstance *  mdInstance,
NSSCKFWInstance *  fwInstance,
CK_RV pError 
) [static]

Definition at line 162 of file slot.c.

{
  nss_dbm_slot_t *slot = (nss_dbm_slot_t *)mdSlot->etc;
  return nss_dbm_mdToken_factory(slot, pError);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static CK_BBOOL nss_dbm_mdSlot_GetTokenPresent ( NSSCKMDSlot *  mdSlot,
NSSCKFWSlot *  fwSlot,
NSSCKMDInstance *  mdInstance,
NSSCKFWInstance *  fwInstance 
) [static]

Definition at line 113 of file slot.c.

{
  nss_dbm_slot_t *slot = (nss_dbm_slot_t *)mdSlot->etc;

  if( (nss_dbm_db_t *)NULL == slot->token_db ) {
    return CK_FALSE;
  } else {
    return CK_TRUE;
  }
}

Here is the caller graph for this function:

static CK_RV nss_dbm_mdSlot_Initialize ( NSSCKMDSlot *  mdSlot,
NSSCKFWSlot *  fwSlot,
NSSCKMDInstance *  mdInstance,
NSSCKFWInstance *  fwInstance 
) [static]

Definition at line 45 of file slot.c.

{
  nss_dbm_slot_t *slot = (nss_dbm_slot_t *)mdSlot->etc;
  nss_dbm_instance_t *instance = (nss_dbm_instance_t *)mdInstance->etc;
  CK_RV rv = CKR_OK;

  slot->token_db = nss_dbm_db_open(instance->arena, fwInstance, slot->filename, 
                                   slot->flags, &rv);
  if( (nss_dbm_db_t *)NULL == slot->token_db ) {
    if( CKR_TOKEN_NOT_PRESENT == rv ) {
      /* This is not an error-- just means "the token isn't there" */
      rv = CKR_OK;
    }
  }

  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function: