Blame nss/lib/ckfw/nssckmdt.h

Packit 40b132
/* This Source Code Form is subject to the terms of the Mozilla Public
Packit 40b132
 * License, v. 2.0. If a copy of the MPL was not distributed with this
Packit 40b132
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
Packit 40b132
Packit 40b132
#ifndef NSSCKMDT_H
Packit 40b132
#define NSSCKMDT_H
Packit 40b132
Packit 40b132
/*
Packit 40b132
 * nssckmdt.h
Packit 40b132
 *
Packit 40b132
 * This file specifies the basic types that must be implemented by
Packit 40b132
 * any Module using the NSS Cryptoki Framework.
Packit 40b132
 */
Packit 40b132
Packit 40b132
#ifndef NSSBASET_H
Packit 40b132
#include "nssbaset.h"
Packit 40b132
#endif /* NSSBASET_H */
Packit 40b132
Packit 40b132
#ifndef NSSCKT_H
Packit 40b132
#include "nssckt.h"
Packit 40b132
#endif /* NSSCKT_H */
Packit 40b132
Packit 40b132
#ifndef NSSCKFWT_H
Packit 40b132
#include "nssckfwt.h"
Packit 40b132
#endif /* NSSCKFWT_H */
Packit 40b132
Packit 40b132
typedef struct NSSCKMDInstanceStr NSSCKMDInstance;
Packit 40b132
typedef struct NSSCKMDSlotStr NSSCKMDSlot;
Packit 40b132
typedef struct NSSCKMDTokenStr NSSCKMDToken;
Packit 40b132
typedef struct NSSCKMDSessionStr NSSCKMDSession;
Packit 40b132
typedef struct NSSCKMDCryptoOperationStr NSSCKMDCryptoOperation;
Packit 40b132
typedef struct NSSCKMDFindObjectsStr NSSCKMDFindObjects;
Packit 40b132
typedef struct NSSCKMDMechanismStr NSSCKMDMechanism;
Packit 40b132
typedef struct NSSCKMDObjectStr NSSCKMDObject;
Packit 40b132
Packit 40b132
/*
Packit 40b132
 * NSSCKFWItem
Packit 40b132
 *
Packit 40b132
 * This is a structure used by modules to return object attributes.
Packit 40b132
 * The needsFreeing bit indicates whether the object needs to be freed.
Packit 40b132
 * If so, the framework will call the FreeAttribute function on the item
Packit 40b132
 * after it is done using it.
Packit 40b132
 *
Packit 40b132
 */
Packit 40b132
Packit 40b132
typedef struct {
Packit 40b132
  PRBool needsFreeing;
Packit 40b132
  NSSItem* item;
Packit 40b132
} NSSCKFWItem ;
Packit 40b132
Packit 40b132
/*
Packit 40b132
 * NSSCKMDInstance
Packit 40b132
 *
Packit 40b132
 * This is the basic handle for an instance of a PKCS#11 Module.
Packit 40b132
 * It is returned by the Module's CreateInstance routine, and
Packit 40b132
 * may be obtained from the corresponding NSSCKFWInstance object.
Packit 40b132
 * It contains a pointer for use by the Module, to store any
Packit 40b132
 * instance-related data, and it contains the EPV for a set of
Packit 40b132
 * routines which the Module may implement for use by the Framework.
Packit 40b132
 * Some of these routines are optional; others are mandatory.
Packit 40b132
 */
Packit 40b132
Packit 40b132
struct NSSCKMDInstanceStr {
Packit 40b132
  /*
Packit 40b132
   * The Module may use this pointer for its own purposes.
Packit 40b132
   */
Packit 40b132
  void *etc;
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine is called by the Framework to initialize
Packit 40b132
   * the Module.  This routine is optional; if unimplemented,
Packit 40b132
   * it won't be called.  If this routine returns an error,
Packit 40b132
   * then the initialization will fail.
Packit 40b132
   */
Packit 40b132
  CK_RV (PR_CALLBACK *Initialize)(
Packit 40b132
    NSSCKMDInstance *mdInstance,                                    
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    NSSUTF8 *configurationData
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine is called when the Framework is finalizing
Packit 40b132
   * the PKCS#11 Module.  It is the last thing called before
Packit 40b132
   * the NSSCKFWInstance's NSSArena is destroyed.  This routine
Packit 40b132
   * is optional; if unimplemented, it merely won't be called.
Packit 40b132
   */
Packit 40b132
  void (PR_CALLBACK *Finalize)(
Packit 40b132
    NSSCKMDInstance *mdInstance,                                    
Packit 40b132
    NSSCKFWInstance *fwInstance
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine gets the number of slots.  This value must
Packit 40b132
   * never change, once the instance is initialized.  This 
Packit 40b132
   * routine must be implemented.  It may return zero on error.
Packit 40b132
   */
Packit 40b132
  CK_ULONG (PR_CALLBACK *GetNSlots)(
Packit 40b132
    NSSCKMDInstance *mdInstance,                                    
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    CK_RV *pError
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns the version of the Cryptoki standard
Packit 40b132
   * to which this Module conforms.  This routine is optional;
Packit 40b132
   * if unimplemented, the Framework uses the version to which
Packit 40b132
   * ~it~ was implemented.
Packit 40b132
   */
Packit 40b132
  CK_VERSION (PR_CALLBACK *GetCryptokiVersion)(
Packit 40b132
    NSSCKMDInstance *mdInstance,                                    
Packit 40b132
    NSSCKFWInstance *fwInstance
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns a pointer to a UTF8-encoded string
Packit 40b132
   * containing the manufacturer ID for this Module.  Only
Packit 40b132
   * the characters completely encoded in the first thirty-
Packit 40b132
   * two bytes are significant.  This routine is optional.
Packit 40b132
   * The string returned is never freed; if dynamically generated,
Packit 40b132
   * the space for it should be allocated from the NSSArena
Packit 40b132
   * that may be obtained from the NSSCKFWInstance.  This
Packit 40b132
   * routine may return NULL upon error; however if *pError
Packit 40b132
   * is CKR_OK, the NULL will be considered the valid response.
Packit 40b132
   */
Packit 40b132
  NSSUTF8 *(PR_CALLBACK *GetManufacturerID)(
Packit 40b132
    NSSCKMDInstance *mdInstance,                                    
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    CK_RV *pError
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns a pointer to a UTF8-encoded string
Packit 40b132
   * containing a description of this Module library.  Only
Packit 40b132
   * the characters completely encoded in the first thirty-
Packit 40b132
   * two bytes are significant.  This routine is optional.
Packit 40b132
   * The string returned is never freed; if dynamically generated,
Packit 40b132
   * the space for it should be allocated from the NSSArena
Packit 40b132
   * that may be obtained from the NSSCKFWInstance.  This
Packit 40b132
   * routine may return NULL upon error; however if *pError
Packit 40b132
   * is CKR_OK, the NULL will be considered the valid response.
Packit 40b132
   */
Packit 40b132
  NSSUTF8 *(PR_CALLBACK *GetLibraryDescription)(
Packit 40b132
    NSSCKMDInstance *mdInstance,                                    
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    CK_RV *pError
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns the version of this Module library.
Packit 40b132
   * This routine is optional; if unimplemented, the Framework
Packit 40b132
   * will assume a Module library version of 0.1.
Packit 40b132
   */
Packit 40b132
  CK_VERSION (PR_CALLBACK *GetLibraryVersion)(
Packit 40b132
    NSSCKMDInstance *mdInstance,                                    
Packit 40b132
    NSSCKFWInstance *fwInstance
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns CK_TRUE if the Module wishes to
Packit 40b132
   * handle session objects.  This routine is optional.
Packit 40b132
   * If this routine is NULL, or if it exists but returns
Packit 40b132
   * CK_FALSE, the Framework will assume responsibility
Packit 40b132
   * for managing session objects.
Packit 40b132
   */
Packit 40b132
  CK_BBOOL (PR_CALLBACK *ModuleHandlesSessionObjects)(
Packit 40b132
    NSSCKMDInstance *mdInstance,                                    
Packit 40b132
    NSSCKFWInstance *fwInstance
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine stuffs pointers to NSSCKMDSlot objects into
Packit 40b132
   * the specified array; one for each slot supported by this
Packit 40b132
   * instance.  The Framework will determine the size needed
Packit 40b132
   * for the array by calling GetNSlots.  This routine is
Packit 40b132
   * required.
Packit 40b132
   */
Packit 40b132
  CK_RV (PR_CALLBACK *GetSlots)(
Packit 40b132
    NSSCKMDInstance *mdInstance,                                    
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    NSSCKMDSlot *slots[]
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This call returns a pointer to the slot in which an event
Packit 40b132
   * has occurred.  If the block argument is CK_TRUE, the call 
Packit 40b132
   * should block until a slot event occurs; if CK_FALSE, it 
Packit 40b132
   * should check to see if an event has occurred, occurred, 
Packit 40b132
   * but return NULL (and set *pError to CK_NO_EVENT) if one 
Packit 40b132
   * hasn't.  This routine is optional; if unimplemented, the
Packit 40b132
   * Framework will assume that no event has happened.  This
Packit 40b132
   * routine may return NULL upon error.
Packit 40b132
   */
Packit 40b132
  NSSCKMDSlot *(PR_CALLBACK *WaitForSlotEvent)(
Packit 40b132
    NSSCKMDInstance *mdInstance,                                    
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    CK_BBOOL block,
Packit 40b132
    CK_RV *pError
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This object may be extended in future versions of the
Packit 40b132
   * NSS Cryptoki Framework.  To allow for some flexibility
Packit 40b132
   * in the area of binary compatibility, this field should
Packit 40b132
   * be NULL.
Packit 40b132
   */
Packit 40b132
  void *null;
Packit 40b132
};
Packit 40b132
Packit 40b132
Packit 40b132
/*
Packit 40b132
 * NSSCKMDSlot
Packit 40b132
 *
Packit 40b132
 * This is the basic handle for a PKCS#11 Module Slot.  It is
Packit 40b132
 * created by the NSSCKMDInstance->GetSlots call, and may be
Packit 40b132
 * obtained from the Framework's corresponding NSSCKFWSlot
Packit 40b132
 * object.  It contains a pointer for use by the Module, to
Packit 40b132
 * store any slot-related data, and it contains the EPV for
Packit 40b132
 * a set of routines which the Module may implement for use
Packit 40b132
 * by the Framework.  Some of these routines are optional.
Packit 40b132
 */
Packit 40b132
Packit 40b132
struct NSSCKMDSlotStr {
Packit 40b132
  /*
Packit 40b132
   * The Module may use this pointer for its own purposes.
Packit 40b132
   */
Packit 40b132
  void *etc;
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine is called during the Framework initialization
Packit 40b132
   * step, after the Framework Instance has obtained the list
Packit 40b132
   * of slots (by calling NSSCKMDInstance->GetSlots).  Any slot-
Packit 40b132
   * specific initialization can be done here.  This routine is
Packit 40b132
   * optional; if unimplemented, it won't be called.  Note that
Packit 40b132
   * if this routine returns an error, the entire Framework
Packit 40b132
   * initialization for this Module will fail.
Packit 40b132
   */
Packit 40b132
  CK_RV (PR_CALLBACK *Initialize)(
Packit 40b132
    NSSCKMDSlot *mdSlot,
Packit 40b132
    NSSCKFWSlot *fwSlot,
Packit 40b132
    NSSCKMDInstance *mdInstance,                                    
Packit 40b132
    NSSCKFWInstance *fwInstance
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine is called when the Framework is finalizing
Packit 40b132
   * the PKCS#11 Module.  This call (for each of the slots)
Packit 40b132
   * is the last thing called before NSSCKMDInstance->Finalize.
Packit 40b132
   * This routine is optional; if unimplemented, it merely 
Packit 40b132
   * won't be called.  Note: In the rare circumstance that
Packit 40b132
   * the Framework initialization cannot complete (due to,
Packit 40b132
   * for example, memory limitations), this can be called with
Packit 40b132
   * a NULL value for fwSlot.
Packit 40b132
   */
Packit 40b132
  void (PR_CALLBACK *Destroy)(
Packit 40b132
    NSSCKMDSlot *mdSlot,
Packit 40b132
    NSSCKFWSlot *fwSlot,
Packit 40b132
    NSSCKMDInstance *mdInstance,                                    
Packit 40b132
    NSSCKFWInstance *fwInstance
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns a pointer to a UTF8-encoded string
Packit 40b132
   * containing a description of this slot.  Only the characters
Packit 40b132
   * completely encoded in the first sixty-four bytes are
Packit 40b132
   * significant.  This routine is optional.  The string 
Packit 40b132
   * returned is never freed; if dynamically generated,
Packit 40b132
   * the space for it should be allocated from the NSSArena
Packit 40b132
   * that may be obtained from the NSSCKFWInstance.  This
Packit 40b132
   * routine may return NULL upon error; however if *pError
Packit 40b132
   * is CKR_OK, the NULL will be considered the valid response.
Packit 40b132
   */
Packit 40b132
  NSSUTF8 *(PR_CALLBACK *GetSlotDescription)(
Packit 40b132
    NSSCKMDSlot *mdSlot,
Packit 40b132
    NSSCKFWSlot *fwSlot,
Packit 40b132
    NSSCKMDInstance *mdInstance,                                    
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    CK_RV *pError
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns a pointer to a UTF8-encoded string
Packit 40b132
   * containing a description of the manufacturer of this slot.
Packit 40b132
   * Only the characters completely encoded in the first thirty-
Packit 40b132
   * two bytes are significant.  This routine is optional.  
Packit 40b132
   * The string  returned is never freed; if dynamically generated,
Packit 40b132
   * the space for it should be allocated from the NSSArena
Packit 40b132
   * that may be obtained from the NSSCKFWInstance.  This
Packit 40b132
   * routine may return NULL upon error; however if *pError
Packit 40b132
   * is CKR_OK, the NULL will be considered the valid response.
Packit 40b132
   */
Packit 40b132
  NSSUTF8 *(PR_CALLBACK *GetManufacturerID)(
Packit 40b132
    NSSCKMDSlot *mdSlot,
Packit 40b132
    NSSCKFWSlot *fwSlot,
Packit 40b132
    NSSCKMDInstance *mdInstance,                                    
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    CK_RV *pError
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns CK_TRUE if a token is present in this
Packit 40b132
   * slot.  This routine is optional; if unimplemented, CK_TRUE
Packit 40b132
   * is assumed.
Packit 40b132
   */
Packit 40b132
  CK_BBOOL (PR_CALLBACK *GetTokenPresent)(
Packit 40b132
    NSSCKMDSlot *mdSlot,
Packit 40b132
    NSSCKFWSlot *fwSlot,
Packit 40b132
    NSSCKMDInstance *mdInstance,                                    
Packit 40b132
    NSSCKFWInstance *fwInstance
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns CK_TRUE if the slot supports removable
Packit 40b132
   * tokens.  This routine is optional; if unimplemented, CK_FALSE
Packit 40b132
   * is assumed.
Packit 40b132
   */
Packit 40b132
  CK_BBOOL (PR_CALLBACK *GetRemovableDevice)(
Packit 40b132
    NSSCKMDSlot *mdSlot,
Packit 40b132
    NSSCKFWSlot *fwSlot,
Packit 40b132
    NSSCKMDInstance *mdInstance,                                    
Packit 40b132
    NSSCKFWInstance *fwInstance
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns CK_TRUE if this slot is a hardware
Packit 40b132
   * device, or CK_FALSE if this slot is a software device.  This
Packit 40b132
   * routine is optional; if unimplemented, CK_FALSE is assumed.
Packit 40b132
   */
Packit 40b132
  CK_BBOOL (PR_CALLBACK *GetHardwareSlot)(
Packit 40b132
    NSSCKMDSlot *mdSlot,
Packit 40b132
    NSSCKFWSlot *fwSlot,
Packit 40b132
    NSSCKMDInstance *mdInstance,                                    
Packit 40b132
    NSSCKFWInstance *fwInstance
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns the version of this slot's hardware.
Packit 40b132
   * This routine is optional; if unimplemented, the Framework
Packit 40b132
   * will assume a hardware version of 0.1.
Packit 40b132
   */
Packit 40b132
  CK_VERSION (PR_CALLBACK *GetHardwareVersion)(
Packit 40b132
    NSSCKMDSlot *mdSlot,
Packit 40b132
    NSSCKFWSlot *fwSlot,
Packit 40b132
    NSSCKMDInstance *mdInstance,                                    
Packit 40b132
    NSSCKFWInstance *fwInstance
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns the version of this slot's firmware.
Packit 40b132
   * This routine is optional; if unimplemented, the Framework
Packit 40b132
   * will assume a hardware version of 0.1.
Packit 40b132
   */
Packit 40b132
  CK_VERSION (PR_CALLBACK *GetFirmwareVersion)(
Packit 40b132
    NSSCKMDSlot *mdSlot,
Packit 40b132
    NSSCKFWSlot *fwSlot,
Packit 40b132
    NSSCKMDInstance *mdInstance,                                    
Packit 40b132
    NSSCKFWInstance *fwInstance
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine should return a pointer to an NSSCKMDToken
Packit 40b132
   * object corresponding to the token in the specified slot.
Packit 40b132
   * The NSSCKFWToken object passed in has an NSSArena
Packit 40b132
   * available which is dedicated for this token.  This routine
Packit 40b132
   * must be implemented.  This routine may return NULL upon
Packit 40b132
   * error.
Packit 40b132
   */
Packit 40b132
  NSSCKMDToken *(PR_CALLBACK *GetToken)(
Packit 40b132
    NSSCKMDSlot *mdSlot,
Packit 40b132
    NSSCKFWSlot *fwSlot,
Packit 40b132
    NSSCKMDInstance *mdInstance,                                    
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    CK_RV *pError
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This object may be extended in future versions of the
Packit 40b132
   * NSS Cryptoki Framework.  To allow for some flexibility
Packit 40b132
   * in the area of binary compatibility, this field should
Packit 40b132
   * be NULL.
Packit 40b132
   */
Packit 40b132
  void *null;
Packit 40b132
};
Packit 40b132
Packit 40b132
/*
Packit 40b132
 * NSSCKMDToken
Packit 40b132
 *
Packit 40b132
 * This is the basic handle for a PKCS#11 Token.  It is created by
Packit 40b132
 * the NSSCKMDSlot->GetToken call, and may be obtained from the
Packit 40b132
 * Framework's corresponding NSSCKFWToken object.  It contains a
Packit 40b132
 * pointer for use by the Module, to store any token-related
Packit 40b132
 * data, and it contains the EPV for a set of routines which the
Packit 40b132
 * Module may implement for use by the Framework.  Some of these
Packit 40b132
 * routines are optional.
Packit 40b132
 */
Packit 40b132
Packit 40b132
struct NSSCKMDTokenStr {
Packit 40b132
  /*
Packit 40b132
   * The Module may use this pointer for its own purposes.
Packit 40b132
   */
Packit 40b132
  void *etc;
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine is used to prepare a Module token object for
Packit 40b132
   * use.  It is called after the NSSCKMDToken object is obtained
Packit 40b132
   * from NSSCKMDSlot->GetToken.  It is named "Setup" here because
Packit 40b132
   * Cryptoki already defines "InitToken" to do the process of
Packit 40b132
   * wiping out any existing state on a token and preparing it for
Packit 40b132
   * a new use.  This routine is optional; if unimplemented, it
Packit 40b132
   * merely won't be called.
Packit 40b132
   */
Packit 40b132
  CK_RV (PR_CALLBACK *Setup)(
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine is called by the Framework whenever it notices
Packit 40b132
   * that the token object is invalid.  (Typically this is when a 
Packit 40b132
   * routine indicates an error such as CKR_DEVICE_REMOVED).  This
Packit 40b132
   * call is the last thing called before the NSSArena in the
Packit 40b132
   * corresponding NSSCKFWToken is destroyed.  This routine is
Packit 40b132
   * optional; if unimplemented, it merely won't be called.
Packit 40b132
   */
Packit 40b132
  void (PR_CALLBACK *Invalidate)(
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine initialises the token in the specified slot.
Packit 40b132
   * This routine is optional; if unimplemented, the Framework
Packit 40b132
   * will fail this operation with an error of CKR_DEVICE_ERROR.
Packit 40b132
   */
Packit 40b132
Packit 40b132
  CK_RV (PR_CALLBACK *InitToken)(
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    NSSItem *pin,
Packit 40b132
    NSSUTF8 *label
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns a pointer to a UTF8-encoded string
Packit 40b132
   * containing this token's label.  Only the characters
Packit 40b132
   * completely encoded in the first thirty-two bytes are
Packit 40b132
   * significant.  This routine is optional.  The string 
Packit 40b132
   * returned is never freed; if dynamically generated,
Packit 40b132
   * the space for it should be allocated from the NSSArena
Packit 40b132
   * that may be obtained from the NSSCKFWInstance.  This
Packit 40b132
   * routine may return NULL upon error; however if *pError
Packit 40b132
   * is CKR_OK, the NULL will be considered the valid response.
Packit 40b132
   */
Packit 40b132
  NSSUTF8 *(PR_CALLBACK *GetLabel)(
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    CK_RV *pError
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns a pointer to a UTF8-encoded string
Packit 40b132
   * containing this token's manufacturer ID.  Only the characters
Packit 40b132
   * completely encoded in the first thirty-two bytes are
Packit 40b132
   * significant.  This routine is optional.  The string 
Packit 40b132
   * returned is never freed; if dynamically generated,
Packit 40b132
   * the space for it should be allocated from the NSSArena
Packit 40b132
   * that may be obtained from the NSSCKFWInstance.  This
Packit 40b132
   * routine may return NULL upon error; however if *pError
Packit 40b132
   * is CKR_OK, the NULL will be considered the valid response.
Packit 40b132
   */
Packit 40b132
  NSSUTF8 *(PR_CALLBACK *GetManufacturerID)(
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    CK_RV *pError
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns a pointer to a UTF8-encoded string
Packit 40b132
   * containing this token's model name.  Only the characters
Packit 40b132
   * completely encoded in the first thirty-two bytes are
Packit 40b132
   * significant.  This routine is optional.  The string 
Packit 40b132
   * returned is never freed; if dynamically generated,
Packit 40b132
   * the space for it should be allocated from the NSSArena
Packit 40b132
   * that may be obtained from the NSSCKFWInstance.  This
Packit 40b132
   * routine may return NULL upon error; however if *pError
Packit 40b132
   * is CKR_OK, the NULL will be considered the valid response.
Packit 40b132
   */
Packit 40b132
  NSSUTF8 *(PR_CALLBACK *GetModel)(
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    CK_RV *pError
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns a pointer to a UTF8-encoded string
Packit 40b132
   * containing this token's serial number.  Only the characters
Packit 40b132
   * completely encoded in the first thirty-two bytes are
Packit 40b132
   * significant.  This routine is optional.  The string 
Packit 40b132
   * returned is never freed; if dynamically generated,
Packit 40b132
   * the space for it should be allocated from the NSSArena
Packit 40b132
   * that may be obtained from the NSSCKFWInstance.  This
Packit 40b132
   * routine may return NULL upon error; however if *pError
Packit 40b132
   * is CKR_OK, the NULL will be considered the valid response.
Packit 40b132
   */
Packit 40b132
  NSSUTF8 *(PR_CALLBACK *GetSerialNumber)(
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    CK_RV *pError
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns CK_TRUE if the token has its own
Packit 40b132
   * random number generator.  This routine is optional; if
Packit 40b132
   * unimplemented, CK_FALSE is assumed.
Packit 40b132
   */
Packit 40b132
  CK_BBOOL (PR_CALLBACK *GetHasRNG)(
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns CK_TRUE if this token is write-protected.
Packit 40b132
   * This routine is optional; if unimplemented, CK_FALSE is
Packit 40b132
   * assumed.
Packit 40b132
   */
Packit 40b132
  CK_BBOOL (PR_CALLBACK *GetIsWriteProtected)(
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns CK_TRUE if this token requires a login.
Packit 40b132
   * This routine is optional; if unimplemented, CK_FALSE is
Packit 40b132
   * assumed.
Packit 40b132
   */
Packit 40b132
  CK_BBOOL (PR_CALLBACK *GetLoginRequired)(
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns CK_TRUE if the normal user's PIN on this
Packit 40b132
   * token has been initialised.  This routine is optional; if
Packit 40b132
   * unimplemented, CK_FALSE is assumed.
Packit 40b132
   */
Packit 40b132
  CK_BBOOL (PR_CALLBACK *GetUserPinInitialized)(
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns CK_TRUE if a successful save of a
Packit 40b132
   * session's cryptographic operations state ~always~ contains
Packit 40b132
   * all keys needed to restore the state of the session.  This
Packit 40b132
   * routine is optional; if unimplemented, CK_FALSE is assumed.
Packit 40b132
   */
Packit 40b132
  CK_BBOOL (PR_CALLBACK *GetRestoreKeyNotNeeded)(
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns CK_TRUE if the token has its own
Packit 40b132
   * hardware clock.  This routine is optional; if unimplemented,
Packit 40b132
   * CK_FALSE is assumed.
Packit 40b132
   */
Packit 40b132
  CK_BBOOL (PR_CALLBACK *GetHasClockOnToken)(
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns CK_TRUE if the token has a protected
Packit 40b132
   * authentication path.  This routine is optional; if
Packit 40b132
   * unimplemented, CK_FALSE is assumed.
Packit 40b132
   */
Packit 40b132
  CK_BBOOL (PR_CALLBACK *GetHasProtectedAuthenticationPath)(
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns CK_TRUE if the token supports dual
Packit 40b132
   * cryptographic operations within a single session.  This
Packit 40b132
   * routine is optional; if unimplemented, CK_FALSE is assumed.
Packit 40b132
   */
Packit 40b132
  CK_BBOOL (PR_CALLBACK *GetSupportsDualCryptoOperations)(
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * XXX fgmr-- should we have a call to return all the flags
Packit 40b132
   * at once, for folks who already know about Cryptoki?
Packit 40b132
   */
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns the maximum number of sessions that
Packit 40b132
   * may be opened on this token.  This routine is optional;
Packit 40b132
   * if unimplemented, the special value CK_UNAVAILABLE_INFORMATION
Packit 40b132
   * is assumed.  XXX fgmr-- or CK_EFFECTIVELY_INFINITE?
Packit 40b132
   */
Packit 40b132
  CK_ULONG (PR_CALLBACK *GetMaxSessionCount)(
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns the maximum number of read/write
Packit 40b132
   * sesisons that may be opened on this token.  This routine
Packit 40b132
   * is optional; if unimplemented, the special value
Packit 40b132
   * CK_UNAVAILABLE_INFORMATION is assumed.  XXX fgmr-- or 
Packit 40b132
   * CK_EFFECTIVELY_INFINITE?
Packit 40b132
   */
Packit 40b132
  CK_ULONG (PR_CALLBACK *GetMaxRwSessionCount)(
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns the maximum PIN code length that is
Packit 40b132
   * supported on this token.  This routine is optional;
Packit 40b132
   * if unimplemented, the special value CK_UNAVAILABLE_INFORMATION
Packit 40b132
   * is assumed.
Packit 40b132
   */
Packit 40b132
  CK_ULONG (PR_CALLBACK *GetMaxPinLen)(
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns the minimum PIN code length that is
Packit 40b132
   * supported on this token.  This routine is optional; if
Packit 40b132
   * unimplemented, the special value CK_UNAVAILABLE_INFORMATION
Packit 40b132
   *  is assumed.  XXX fgmr-- or 0?
Packit 40b132
   */
Packit 40b132
  CK_ULONG (PR_CALLBACK *GetMinPinLen)(
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns the total amount of memory on the token
Packit 40b132
   * in which public objects may be stored.  This routine is
Packit 40b132
   * optional; if unimplemented, the special value
Packit 40b132
   * CK_UNAVAILABLE_INFORMATION is assumed.
Packit 40b132
   */
Packit 40b132
  CK_ULONG (PR_CALLBACK *GetTotalPublicMemory)(
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns the amount of unused memory on the
Packit 40b132
   * token in which public objects may be stored.  This routine
Packit 40b132
   * is optional; if unimplemented, the special value
Packit 40b132
   * CK_UNAVAILABLE_INFORMATION is assumed.
Packit 40b132
   */
Packit 40b132
  CK_ULONG (PR_CALLBACK *GetFreePublicMemory)(
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns the total amount of memory on the token
Packit 40b132
   * in which private objects may be stored.  This routine is
Packit 40b132
   * optional; if unimplemented, the special value
Packit 40b132
   * CK_UNAVAILABLE_INFORMATION is assumed.
Packit 40b132
   */
Packit 40b132
  CK_ULONG (PR_CALLBACK *GetTotalPrivateMemory)(
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns the amount of unused memory on the
Packit 40b132
   * token in which private objects may be stored.  This routine
Packit 40b132
   * is optional; if unimplemented, the special value
Packit 40b132
   * CK_UNAVAILABLE_INFORMATION is assumed.
Packit 40b132
   */
Packit 40b132
  CK_ULONG (PR_CALLBACK *GetFreePrivateMemory)(
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns the version number of this token's
Packit 40b132
   * hardware.  This routine is optional; if unimplemented,
Packit 40b132
   * the value 0.1 is assumed.
Packit 40b132
   */
Packit 40b132
  CK_VERSION (PR_CALLBACK *GetHardwareVersion)(
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns the version number of this token's
Packit 40b132
   * firmware.  This routine is optional; if unimplemented,
Packit 40b132
   * the value 0.1 is assumed.
Packit 40b132
   */
Packit 40b132
  CK_VERSION (PR_CALLBACK *GetFirmwareVersion)(
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine stuffs the current UTC time, as obtained from
Packit 40b132
   * the token, into the sixteen-byte buffer in the form
Packit 40b132
   * YYYYMMDDhhmmss00.  This routine need only be implemented
Packit 40b132
   * by token which indicate that they have a real-time clock.
Packit 40b132
   * XXX fgmr-- think about time formats.
Packit 40b132
   */
Packit 40b132
  CK_RV (PR_CALLBACK *GetUTCTime)(
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    CK_CHAR utcTime[16]
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine creates a session on the token, and returns
Packit 40b132
   * the corresponding NSSCKMDSession object.  The value of
Packit 40b132
   * rw will be CK_TRUE if the session is to be a read/write 
Packit 40b132
   * session, or CK_FALSE otherwise.  An NSSArena dedicated to
Packit 40b132
   * the new session is available from the specified NSSCKFWSession.
Packit 40b132
   * This routine may return NULL upon error.
Packit 40b132
   */
Packit 40b132
  NSSCKMDSession *(PR_CALLBACK *OpenSession)(
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    CK_BBOOL rw,
Packit 40b132
    CK_RV *pError
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns the number of PKCS#11 Mechanisms
Packit 40b132
   * supported by this token.  This routine is optional; if
Packit 40b132
   * unimplemented, zero is assumed.
Packit 40b132
   */
Packit 40b132
  CK_ULONG (PR_CALLBACK *GetMechanismCount)(
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine stuffs into the specified array the types
Packit 40b132
   * of the mechanisms supported by this token.  The Framework
Packit 40b132
   * determines the size of the array by calling GetMechanismCount.
Packit 40b132
   */
Packit 40b132
  CK_RV (PR_CALLBACK *GetMechanismTypes)(
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    CK_MECHANISM_TYPE types[]
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns a pointer to a Module mechanism
Packit 40b132
   * object corresponding to a specified type.  This routine
Packit 40b132
   * need only exist for tokens implementing at least one
Packit 40b132
   * mechanism.
Packit 40b132
   */
Packit 40b132
  NSSCKMDMechanism *(PR_CALLBACK *GetMechanism)(
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    CK_MECHANISM_TYPE which,
Packit 40b132
    CK_RV *pError
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This object may be extended in future versions of the
Packit 40b132
   * NSS Cryptoki Framework.  To allow for some flexibility
Packit 40b132
   * in the area of binary compatibility, this field should
Packit 40b132
   * be NULL.
Packit 40b132
   */
Packit 40b132
  void *null;
Packit 40b132
};
Packit 40b132
Packit 40b132
/*
Packit 40b132
 * NSSCKMDSession
Packit 40b132
 *
Packit 40b132
 * This is the basic handle for a session on a PKCS#11 Token.  It
Packit 40b132
 * is created by NSSCKMDToken->OpenSession, and may be obtained
Packit 40b132
 * from the Framework's corresponding NSSCKFWSession object.  It
Packit 40b132
 * contains a pointer for use by the Module, to store any session-
Packit 40b132
 * realted data, and it contains the EPV for a set of routines
Packit 40b132
 * which the Module may implement for use by the Framework.  Some
Packit 40b132
 * of these routines are optional.
Packit 40b132
 */
Packit 40b132
Packit 40b132
struct NSSCKMDSessionStr {
Packit 40b132
  /*
Packit 40b132
   * The Module may use this pointer for its own purposes.
Packit 40b132
   */
Packit 40b132
  void *etc;
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine is called by the Framework when a session is
Packit 40b132
   * closed.  This call is the last thing called before the
Packit 40b132
   * NSSArena in the correspoinding NSSCKFWSession is destroyed.
Packit 40b132
   * This routine is optional; if unimplemented, it merely won't
Packit 40b132
   * be called.
Packit 40b132
   */
Packit 40b132
  void (PR_CALLBACK *Close)(
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine is used to get any device-specific error.
Packit 40b132
   * This routine is optional.
Packit 40b132
   */
Packit 40b132
  CK_ULONG (PR_CALLBACK *GetDeviceError)(
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine is used to log in a user to the token.  This
Packit 40b132
   * routine is optional, since the Framework's NSSCKFWSession
Packit 40b132
   * object keeps track of the login state.
Packit 40b132
   */
Packit 40b132
  CK_RV (PR_CALLBACK *Login)(
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    CK_USER_TYPE userType,
Packit 40b132
    NSSItem *pin,
Packit 40b132
    CK_STATE oldState,
Packit 40b132
    CK_STATE newState
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine is used to log out a user from the token.  This
Packit 40b132
   * routine is optional, since the Framework's NSSCKFWSession
Packit 40b132
   * object keeps track of the login state.
Packit 40b132
   */
Packit 40b132
  CK_RV (PR_CALLBACK *Logout)(
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    CK_STATE oldState,
Packit 40b132
    CK_STATE newState
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine is used to initialize the normal user's PIN or
Packit 40b132
   * password.  This will only be called in the "read/write
Packit 40b132
   * security officer functions" state.  If this token has a
Packit 40b132
   * protected authentication path, then the pin argument will
Packit 40b132
   * be NULL.  This routine is optional; if unimplemented, the
Packit 40b132
   * Framework will return the error CKR_TOKEN_WRITE_PROTECTED.
Packit 40b132
   */
Packit 40b132
  CK_RV (PR_CALLBACK *InitPIN)(
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    NSSItem *pin
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine is used to modify a user's PIN or password.  This
Packit 40b132
   * routine will only be called in the "read/write security officer
Packit 40b132
   * functions" or "read/write user functions" state.  If this token
Packit 40b132
   * has a protected authentication path, then the pin arguments
Packit 40b132
   * will be NULL.  This routine is optional; if unimplemented, the
Packit 40b132
   * Framework will return the error CKR_TOKEN_WRITE_PROTECTED.
Packit 40b132
   */
Packit 40b132
  CK_RV (PR_CALLBACK *SetPIN)(
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    NSSItem *oldPin,
Packit 40b132
    NSSItem *newPin
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine is used to find out how much space would be required
Packit 40b132
   * to save the current operational state.  This routine is optional;
Packit 40b132
   * if unimplemented, the Framework will reject any attempts to save
Packit 40b132
   * the operational state with the error CKR_STATE_UNSAVEABLE.  This
Packit 40b132
   * routine may return zero on error.
Packit 40b132
   */
Packit 40b132
  CK_ULONG (PR_CALLBACK *GetOperationStateLen)(
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    CK_RV *pError
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine is used to store the current operational state.  This
Packit 40b132
   * routine is only required if GetOperationStateLen is implemented 
Packit 40b132
   * and can return a nonzero value.  The buffer in the specified item
Packit 40b132
   * will be pre-allocated, and the length will specify the amount of
Packit 40b132
   * space available (which may be more than GetOperationStateLen
Packit 40b132
   * asked for, but which will not be smaller).
Packit 40b132
   */
Packit 40b132
  CK_RV (PR_CALLBACK *GetOperationState)(
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    NSSItem *buffer
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine is used to restore an operational state previously
Packit 40b132
   * obtained with GetOperationState.  The Framework will take pains
Packit 40b132
   * to be sure that the state is (or was at one point) valid; if the
Packit 40b132
   * Module notices that the state is invalid, it should return an
Packit 40b132
   * error, but it is not required to be paranoid about the issue.
Packit 40b132
   * [XXX fgmr-- should (can?) the framework verify the keys match up?]
Packit 40b132
   * This routine is required only if GetOperationState is implemented.
Packit 40b132
   */
Packit 40b132
  CK_RV (PR_CALLBACK *SetOperationState)(
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    NSSItem *state,
Packit 40b132
    NSSCKMDObject *mdEncryptionKey,
Packit 40b132
    NSSCKFWObject *fwEncryptionKey,
Packit 40b132
    NSSCKMDObject *mdAuthenticationKey,
Packit 40b132
    NSSCKFWObject *fwAuthenticationKey
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine is used to create an object.  The specified template
Packit 40b132
   * will only specify a session object if the Module has indicated 
Packit 40b132
   * that it wishes to handle its own session objects.  This routine
Packit 40b132
   * is optional; if unimplemented, the Framework will reject the
Packit 40b132
   * operation with the error CKR_TOKEN_WRITE_PROTECTED.  Space for
Packit 40b132
   * token objects should come from the NSSArena available from the
Packit 40b132
   * NSSCKFWToken object; space for session objects (if supported)
Packit 40b132
   * should come from the NSSArena available from the NSSCKFWSession
Packit 40b132
   * object.  The appropriate NSSArena pointer will, as a convenience,
Packit 40b132
   * be passed as the handyArenaPointer argument.  This routine may
Packit 40b132
   * return NULL upon error.
Packit 40b132
   */
Packit 40b132
  NSSCKMDObject *(PR_CALLBACK *CreateObject)(
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    NSSArena *handyArenaPointer,
Packit 40b132
    CK_ATTRIBUTE_PTR pTemplate,
Packit 40b132
    CK_ULONG ulAttributeCount,
Packit 40b132
    CK_RV *pError
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine is used to make a copy of an object.  It is entirely
Packit 40b132
   * optional; if unimplemented, the Framework will try to use
Packit 40b132
   * CreateObject instead.  If the Module has indicated that it does
Packit 40b132
   * not wish to handle session objects, then this routine will only
Packit 40b132
   * be called to copy a token object to another token object.
Packit 40b132
   * Otherwise, either the original object or the new may be of
Packit 40b132
   * either the token or session variety.  As with CreateObject, the
Packit 40b132
   * handyArenaPointer will point to the appropriate arena for the
Packit 40b132
   * new object.  This routine may return NULL upon error.
Packit 40b132
   */
Packit 40b132
  NSSCKMDObject *(PR_CALLBACK *CopyObject)(
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    NSSCKMDObject *mdOldObject,
Packit 40b132
    NSSCKFWObject *fwOldObject,
Packit 40b132
    NSSArena *handyArenaPointer,
Packit 40b132
    CK_ATTRIBUTE_PTR pTemplate,
Packit 40b132
    CK_ULONG ulAttributeCount,
Packit 40b132
    CK_RV *pError
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine is used to begin an object search.  This routine may
Packit 40b132
   * be unimplemented only if the Module does not handle session 
Packit 40b132
   * objects, and if none of its tokens have token objects.  The
Packit 40b132
   * NSSCKFWFindObjects pointer has an NSSArena that may be used for
Packit 40b132
   * storage for the life of this "find" operation.  This routine may
Packit 40b132
   * return NULL upon error.  If the Module can determine immediately
Packit 40b132
   * that the search will not find any matching objects, it may return
Packit 40b132
   * NULL, and specify CKR_OK as the error.
Packit 40b132
   */
Packit 40b132
  NSSCKMDFindObjects *(PR_CALLBACK *FindObjectsInit)(
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    CK_ATTRIBUTE_PTR pTemplate,
Packit 40b132
    CK_ULONG ulAttributeCount,
Packit 40b132
    CK_RV *pError
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine seeds the random-number generator.  It is
Packit 40b132
   * optional, even if GetRandom is implemented.  If unimplemented,
Packit 40b132
   * the Framework will issue the error CKR_RANDOM_SEED_NOT_SUPPORTED.
Packit 40b132
   */
Packit 40b132
  CK_RV (PR_CALLBACK *SeedRandom)(
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    NSSItem *seed
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine gets random data.  It is optional.  If unimplemented,
Packit 40b132
   * the Framework will issue the error CKR_RANDOM_NO_RNG.
Packit 40b132
   */
Packit 40b132
  CK_RV (PR_CALLBACK *GetRandom)(
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    NSSItem *buffer
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This object may be extended in future versions of the
Packit 40b132
   * NSS Cryptoki Framework.  To allow for some flexibility
Packit 40b132
   * in the area of binary compatibility, this field should
Packit 40b132
   * be NULL.
Packit 40b132
   */
Packit 40b132
  void *null;
Packit 40b132
};
Packit 40b132
Packit 40b132
/*
Packit 40b132
 * NSSCKMDFindObjects
Packit 40b132
 *
Packit 40b132
 * This is the basic handle for an object search.  It is
Packit 40b132
 * created by NSSCKMDSession->FindObjectsInit, and may be
Packit 40b132
 * obtained from the Framework's corresponding object.
Packit 40b132
 * It contains a pointer for use by the Module, to store
Packit 40b132
 * any search-related data, and it contains the EPV for a
Packit 40b132
 * set of routines which the Module may implement for use
Packit 40b132
 * by the Framework.  Some of these routines are optional.
Packit 40b132
 */
Packit 40b132
Packit 40b132
struct NSSCKMDFindObjectsStr {
Packit 40b132
  /*
Packit 40b132
   * The Module may use this pointer for its own purposes.
Packit 40b132
   */
Packit 40b132
  void *etc;
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine is called by the Framework to finish a
Packit 40b132
   * search operation.  Note that the Framework may finish
Packit 40b132
   * a search before it has completed.  This routine is
Packit 40b132
   * optional; if unimplemented, it merely won't be called.
Packit 40b132
   */
Packit 40b132
  void (PR_CALLBACK *Final)(
Packit 40b132
    NSSCKMDFindObjects *mdFindObjects,
Packit 40b132
    NSSCKFWFindObjects *fwFindObjects,
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine is used to obtain another pointer to an
Packit 40b132
   * object matching the search criteria.  This routine is
Packit 40b132
   * required.  If no (more) objects match the search, it
Packit 40b132
   * should return NULL and set the error to CKR_OK.
Packit 40b132
   */
Packit 40b132
  NSSCKMDObject *(PR_CALLBACK *Next)(
Packit 40b132
    NSSCKMDFindObjects *mdFindObjects,
Packit 40b132
    NSSCKFWFindObjects *fwFindObjects,
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    NSSArena *arena,
Packit 40b132
    CK_RV *pError
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This object may be extended in future versions of the
Packit 40b132
   * NSS Cryptoki Framework.  To allow for some flexibility
Packit 40b132
   * in the area of binary compatibility, this field should
Packit 40b132
   * be NULL.
Packit 40b132
   */
Packit 40b132
  void *null;
Packit 40b132
};
Packit 40b132
Packit 40b132
/*
Packit 40b132
 * NSSCKMDCryptoOperaion
Packit 40b132
 *
Packit 40b132
 * This is the basic handle for an encryption, decryption,
Packit 40b132
 * sign, verify, or hash opertion.
Packit 40b132
 * created by NSSCKMDMechanism->XXXXInit, and may be
Packit 40b132
 * obtained from the Framework's corresponding object.
Packit 40b132
 * It contains a pointer for use by the Module, to store
Packit 40b132
 * any intermediate data, and it contains the EPV for a
Packit 40b132
 * set of routines which the Module may implement for use
Packit 40b132
 * by the Framework.  Some of these routines are optional.
Packit 40b132
 */
Packit 40b132
Packit 40b132
struct NSSCKMDCryptoOperationStr {
Packit 40b132
  /*
Packit 40b132
   * The Module may use this pointer for its own purposes.
Packit 40b132
   */
Packit 40b132
  void *etc;
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine is called by the Framework clean up the mdCryptoOperation
Packit 40b132
   * structure.
Packit 40b132
   * This routine is optional; if unimplemented, it will be ignored.
Packit 40b132
   */
Packit 40b132
  void (PR_CALLBACK *Destroy)(
Packit 40b132
    NSSCKMDCryptoOperation *mdCryptoOperation,
Packit 40b132
    NSSCKFWCryptoOperation *fwCryptoOperation,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance
Packit 40b132
  );
Packit 40b132
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * how many bytes do we need to finish this buffer?
Packit 40b132
   * must be implemented if Final is implemented.
Packit 40b132
   */
Packit 40b132
  CK_ULONG (PR_CALLBACK *GetFinalLength)(
Packit 40b132
    NSSCKMDCryptoOperation *mdCryptoOperation,
Packit 40b132
    NSSCKFWCryptoOperation *fwCryptoOperation,
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    CK_RV *pError
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * how many bytes do we need to complete the next operation.
Packit 40b132
   * used in both Update and UpdateFinal.
Packit 40b132
   */
Packit 40b132
  CK_ULONG (PR_CALLBACK *GetOperationLength)(
Packit 40b132
    NSSCKMDCryptoOperation *mdCryptoOperation,
Packit 40b132
    NSSCKFWCryptoOperation *fwCryptoOperation,
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    const NSSItem   *inputBuffer,
Packit 40b132
    CK_RV *pError
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine is called by the Framework to finish a
Packit 40b132
   * search operation.  Note that the Framework may finish
Packit 40b132
   * a search before it has completed.  This routine is
Packit 40b132
   * optional; if unimplemented, it merely won't be called.
Packit 40b132
   * The respective final call with fail with CKR_FUNCTION_FAILED
Packit 40b132
   * Final should not free the mdCryptoOperation.
Packit 40b132
   */
Packit 40b132
  CK_RV(PR_CALLBACK *Final)(
Packit 40b132
    NSSCKMDCryptoOperation *mdCryptoOperation,
Packit 40b132
    NSSCKFWCryptoOperation *fwCryptoOperation,
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    NSSItem       *outputBuffer
Packit 40b132
  );
Packit 40b132
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine is called by the Framework to complete the
Packit 40b132
   * next step in an encryption/decryption operation.
Packit 40b132
   * This routine is optional; if unimplemented, the respective
Packit 40b132
   * update call with fail with CKR_FUNCTION_FAILED.
Packit 40b132
   * Update should not be implemented for signing/verification/digest
Packit 40b132
   * mechanisms.
Packit 40b132
   */
Packit 40b132
  CK_RV(PR_CALLBACK *Update)(
Packit 40b132
    NSSCKMDCryptoOperation *mdCryptoOperation,
Packit 40b132
    NSSCKFWCryptoOperation *fwCryptoOperation,
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    const NSSItem   *inputBuffer,
Packit 40b132
    NSSItem   *outputBuffer
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine is called by the Framework to complete the
Packit 40b132
   * next step in a signing/verification/digest operation.
Packit 40b132
   * This routine is optional; if unimplemented, the respective
Packit 40b132
   * update call with fail with CKR_FUNCTION_FAILED
Packit 40b132
   * Update should not be implemented for encryption/decryption
Packit 40b132
   * mechanisms.
Packit 40b132
   */
Packit 40b132
  CK_RV(PR_CALLBACK *DigestUpdate)(
Packit 40b132
    NSSCKMDCryptoOperation *mdCryptoOperation,
Packit 40b132
    NSSCKFWCryptoOperation *fwCryptoOperation,
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    const NSSItem   *inputBuffer
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine is called by the Framework to complete a
Packit 40b132
   * single step operation. This routine is optional; if unimplemented, 
Packit 40b132
   * the framework will use the Update and Final functions to complete
Packit 40b132
   * the operation.
Packit 40b132
   */
Packit 40b132
  CK_RV(PR_CALLBACK *UpdateFinal)(
Packit 40b132
    NSSCKMDCryptoOperation *mdCryptoOperation,
Packit 40b132
    NSSCKFWCryptoOperation *fwCryptoOperation,
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    const NSSItem   *inputBuffer,
Packit 40b132
    NSSItem   *outputBuffer
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine is called by the Framework to complete next
Packit 40b132
   * step in a combined operation. The Decrypt/Encrypt mechanism
Packit 40b132
   * should define and drive the combo step.
Packit 40b132
   * This routine is optional; if unimplemented, 
Packit 40b132
   * the framework will use the appropriate Update functions to complete
Packit 40b132
   * the operation.
Packit 40b132
   */
Packit 40b132
  CK_RV(PR_CALLBACK *UpdateCombo)(
Packit 40b132
    NSSCKMDCryptoOperation *mdCryptoOperation,
Packit 40b132
    NSSCKFWCryptoOperation *fwCryptoOperation,
Packit 40b132
    NSSCKMDCryptoOperation *mdPeerCryptoOperation,
Packit 40b132
    NSSCKFWCryptoOperation *fwPeerCryptoOperation,
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    const NSSItem   *inputBuffer,
Packit 40b132
    NSSItem   *outputBuffer
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * Hash a key directly into the digest
Packit 40b132
   */
Packit 40b132
  CK_RV(PR_CALLBACK *DigestKey)(
Packit 40b132
    NSSCKMDCryptoOperation *mdCryptoOperation,
Packit 40b132
    NSSCKFWCryptoOperation *fwCryptoOperation,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    NSSCKMDObject *mdKey,
Packit 40b132
    NSSCKFWObject *fwKey
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This object may be extended in future versions of the
Packit 40b132
   * NSS Cryptoki Framework.  To allow for some flexibility
Packit 40b132
   * in the area of binary compatibility, this field should
Packit 40b132
   * be NULL.
Packit 40b132
   */
Packit 40b132
  void *null;
Packit 40b132
};
Packit 40b132
Packit 40b132
/*
Packit 40b132
 * NSSCKMDMechanism
Packit 40b132
 *
Packit 40b132
 */
Packit 40b132
Packit 40b132
struct NSSCKMDMechanismStr {
Packit 40b132
  /*
Packit 40b132
   * The Module may use this pointer for its own purposes.
Packit 40b132
   */
Packit 40b132
  void *etc;
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This also frees the fwMechanism if appropriate.
Packit 40b132
   * If it is not supplied, the Framework will assume that the Token
Packit 40b132
   * Manages a static list of mechanisms and the function will not be called.
Packit 40b132
   */
Packit 40b132
  void (PR_CALLBACK *Destroy)(
Packit 40b132
    NSSCKMDMechanism *mdMechanism,
Packit 40b132
    NSSCKFWMechanism *fwMechanism,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance
Packit 40b132
  );
Packit 40b132
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns the minimum key size allowed for
Packit 40b132
   * this mechanism.  This routine is optional; if unimplemented,
Packit 40b132
   * zero will be assumed.  This routine may return zero on
Packit 40b132
   * error; if the error is CKR_OK, zero will be accepted as
Packit 40b132
   * a valid response.
Packit 40b132
   */
Packit 40b132
  CK_ULONG (PR_CALLBACK *GetMinKeySize)(
Packit 40b132
    NSSCKMDMechanism *mdMechanism,
Packit 40b132
    NSSCKFWMechanism *fwMechanism,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    CK_RV *pError
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns the maximum key size allowed for
Packit 40b132
   * this mechanism.  This routine is optional; if unimplemented,
Packit 40b132
   * zero will be assumed.  This routine may return zero on
Packit 40b132
   * error; if the error is CKR_OK, zero will be accepted as
Packit 40b132
   * a valid response.
Packit 40b132
   */
Packit 40b132
  CK_ULONG (PR_CALLBACK *GetMaxKeySize)(
Packit 40b132
    NSSCKMDMechanism *mdMechanism,
Packit 40b132
    NSSCKFWMechanism *fwMechanism,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    CK_RV *pError
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine is called to determine if the mechanism is
Packit 40b132
   * implemented in hardware or software.  It returns CK_TRUE
Packit 40b132
   * if it is done in hardware.
Packit 40b132
   */
Packit 40b132
  CK_BBOOL (PR_CALLBACK *GetInHardware)(
Packit 40b132
    NSSCKMDMechanism *mdMechanism,
Packit 40b132
    NSSCKFWMechanism *fwMechanism,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    CK_RV *pError
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * The crypto routines themselves.  Most crypto operations may
Packit 40b132
   * be performed in two ways, streaming and single-part.  The
Packit 40b132
   * streaming operations involve the use of (typically) three
Packit 40b132
   * calls-- an Init method to set up the operation, an Update
Packit 40b132
   * method to feed data to the operation, and a Final method to
Packit 40b132
   * obtain the final result.  Single-part operations involve
Packit 40b132
   * one method, to perform the crypto operation all at once.
Packit 40b132
   *
Packit 40b132
   * The NSS Cryptoki Framework can implement the single-part
Packit 40b132
   * operations in terms of the streaming operations on behalf
Packit 40b132
   * of the Module.  There are a few variances.
Packit 40b132
   *
Packit 40b132
   * Only the Init Functions are defined by the mechanism. Each
Packit 40b132
   * init function will return a NSSCKFWCryptoOperation which
Packit 40b132
   * can supply update, final, the single part updateFinal, and
Packit 40b132
   * the combo updateCombo functions.
Packit 40b132
   * 
Packit 40b132
   * For simplicity, the routines are listed in summary here:
Packit 40b132
   *
Packit 40b132
   *  EncryptInit,
Packit 40b132
   *  DecryptInit,
Packit 40b132
   *  DigestInit,
Packit 40b132
   *  SignInit, 
Packit 40b132
   *  SignRecoverInit;
Packit 40b132
   *  VerifyInit,
Packit 40b132
   *  VerifyRecoverInit;
Packit 40b132
   *
Packit 40b132
   * The key-management routines are
Packit 40b132
   *
Packit 40b132
   *  GenerateKey
Packit 40b132
   *  GenerateKeyPair
Packit 40b132
   *  WrapKey
Packit 40b132
   *  UnwrapKey
Packit 40b132
   *  DeriveKey
Packit 40b132
   *
Packit 40b132
   * All of these routines based on the Cryptoki API; 
Packit 40b132
   * see PKCS#11 for further information.
Packit 40b132
   */
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   */
Packit 40b132
  NSSCKMDCryptoOperation * (PR_CALLBACK *EncryptInit)(
Packit 40b132
    NSSCKMDMechanism *mdMechanism,
Packit 40b132
    NSSCKFWMechanism *fwMechanism,
Packit 40b132
    CK_MECHANISM_PTR  pMechanism,
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    NSSCKMDObject *mdKey,
Packit 40b132
    NSSCKFWObject *fwKey,
Packit 40b132
    CK_RV *pError
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   */
Packit 40b132
  NSSCKMDCryptoOperation * (PR_CALLBACK *DecryptInit)(
Packit 40b132
    NSSCKMDMechanism *mdMechanism,
Packit 40b132
    NSSCKFWMechanism *fwMechanism,
Packit 40b132
    CK_MECHANISM_PTR  pMechanism,
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    NSSCKMDObject *mdKey,
Packit 40b132
    NSSCKFWObject *fwKey,
Packit 40b132
    CK_RV *pError
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   */
Packit 40b132
  NSSCKMDCryptoOperation * (PR_CALLBACK *DigestInit)(
Packit 40b132
    NSSCKMDMechanism *mdMechanism,
Packit 40b132
    NSSCKFWMechanism *fwMechanism,
Packit 40b132
    CK_MECHANISM_PTR  pMechanism,
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    CK_RV *pError
Packit 40b132
  );
Packit 40b132
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   */
Packit 40b132
  NSSCKMDCryptoOperation * (PR_CALLBACK *SignInit)(
Packit 40b132
    NSSCKMDMechanism *mdMechanism,
Packit 40b132
    NSSCKFWMechanism *fwMechanism,
Packit 40b132
    CK_MECHANISM_PTR  pMechanism,
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    NSSCKMDObject *mdKey,
Packit 40b132
    NSSCKFWObject *fwKey,
Packit 40b132
    CK_RV *pError
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   */
Packit 40b132
  NSSCKMDCryptoOperation * (PR_CALLBACK *VerifyInit)(
Packit 40b132
    NSSCKMDMechanism *mdMechanism,
Packit 40b132
    NSSCKFWMechanism *fwMechanism,
Packit 40b132
    CK_MECHANISM_PTR  pMechanism,
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    NSSCKMDObject *mdKey,
Packit 40b132
    NSSCKFWObject *fwKey,
Packit 40b132
    CK_RV *pError
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   */
Packit 40b132
  NSSCKMDCryptoOperation * (PR_CALLBACK *SignRecoverInit)(
Packit 40b132
    NSSCKMDMechanism *mdMechanism,
Packit 40b132
    NSSCKFWMechanism *fwMechanism,
Packit 40b132
    CK_MECHANISM_PTR  pMechanism,
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    NSSCKMDObject *mdKey,
Packit 40b132
    NSSCKFWObject *fwKey,
Packit 40b132
    CK_RV *pError
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   */
Packit 40b132
  NSSCKMDCryptoOperation * (PR_CALLBACK *VerifyRecoverInit)(
Packit 40b132
    NSSCKMDMechanism *mdMechanism,
Packit 40b132
    NSSCKFWMechanism *fwMechanism,
Packit 40b132
    CK_MECHANISM_PTR  pMechanism,
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    NSSCKMDObject *mdKey,
Packit 40b132
    NSSCKFWObject *fwKey,
Packit 40b132
    CK_RV *pError
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * Key management operations.
Packit 40b132
   */
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine generates a key.  This routine may return NULL
Packit 40b132
   * upon error.
Packit 40b132
   */
Packit 40b132
  NSSCKMDObject *(PR_CALLBACK *GenerateKey)(
Packit 40b132
    NSSCKMDMechanism *mdMechanism,
Packit 40b132
    NSSCKFWMechanism *fwMechanism,
Packit 40b132
    CK_MECHANISM_PTR  pMechanism,
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    CK_ATTRIBUTE_PTR pTemplate,
Packit 40b132
    CK_ULONG ulAttributeCount,
Packit 40b132
    CK_RV *pError
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine generates a key pair.
Packit 40b132
   */
Packit 40b132
  CK_RV (PR_CALLBACK *GenerateKeyPair)(
Packit 40b132
    NSSCKMDMechanism *mdMechanism,
Packit 40b132
    NSSCKFWMechanism *fwMechanism,
Packit 40b132
    CK_MECHANISM_PTR  pMechanism,
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    CK_ATTRIBUTE_PTR pPublicKeyTemplate,
Packit 40b132
    CK_ULONG ulPublicKeyAttributeCount,
Packit 40b132
    CK_ATTRIBUTE_PTR pPrivateKeyTemplate,
Packit 40b132
    CK_ULONG ulPrivateKeyAttributeCount,
Packit 40b132
    NSSCKMDObject **pPublicKey,
Packit 40b132
    NSSCKMDObject **pPrivateKey
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine wraps a key.
Packit 40b132
   */
Packit 40b132
  CK_ULONG (PR_CALLBACK *GetWrapKeyLength)(
Packit 40b132
    NSSCKMDMechanism *mdMechanism,
Packit 40b132
    NSSCKFWMechanism *fwMechanism,
Packit 40b132
    CK_MECHANISM_PTR  pMechanism,
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    NSSCKMDObject *mdWrappingKey,
Packit 40b132
    NSSCKFWObject *fwWrappingKey,
Packit 40b132
    NSSCKMDObject *mdWrappedKey,
Packit 40b132
    NSSCKFWObject *fwWrappedKey,
Packit 40b132
    CK_RV *pError
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine wraps a key.
Packit 40b132
   */
Packit 40b132
  CK_RV (PR_CALLBACK *WrapKey)(
Packit 40b132
    NSSCKMDMechanism *mdMechanism,
Packit 40b132
    NSSCKFWMechanism *fwMechanism,
Packit 40b132
    CK_MECHANISM_PTR  pMechanism,
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    NSSCKMDObject *mdWrappingKey,
Packit 40b132
    NSSCKFWObject *fwWrappingKey,
Packit 40b132
    NSSCKMDObject *mdKeyObject,
Packit 40b132
    NSSCKFWObject *fwKeyObject,
Packit 40b132
    NSSItem *wrappedKey
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine unwraps a key.  This routine may return NULL
Packit 40b132
   * upon error.
Packit 40b132
   */
Packit 40b132
  NSSCKMDObject *(PR_CALLBACK *UnwrapKey)(
Packit 40b132
    NSSCKMDMechanism *mdMechanism,
Packit 40b132
    NSSCKFWMechanism *fwMechanism,
Packit 40b132
    CK_MECHANISM_PTR  pMechanism,
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    NSSCKMDObject *mdWrappingKey,
Packit 40b132
    NSSCKFWObject *fwWrappingKey,
Packit 40b132
    NSSItem *wrappedKey,
Packit 40b132
    CK_ATTRIBUTE_PTR pTemplate,
Packit 40b132
    CK_ULONG ulAttributeCount,
Packit 40b132
    CK_RV *pError
Packit 40b132
  );    
Packit 40b132
    
Packit 40b132
  /*
Packit 40b132
   * This routine derives a key.  This routine may return NULL
Packit 40b132
   * upon error.
Packit 40b132
   */
Packit 40b132
  NSSCKMDObject *(PR_CALLBACK *DeriveKey)(
Packit 40b132
    NSSCKMDMechanism *mdMechanism,
Packit 40b132
    NSSCKFWMechanism *fwMechanism,
Packit 40b132
    CK_MECHANISM_PTR  pMechanism,
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    NSSCKMDObject *mdBaseKey,
Packit 40b132
    NSSCKFWObject *fwBaseKey,
Packit 40b132
    CK_ATTRIBUTE_PTR pTemplate,
Packit 40b132
    CK_ULONG ulAttributeCount,
Packit 40b132
    CK_RV *pError
Packit 40b132
  );    
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This object may be extended in future versions of the
Packit 40b132
   * NSS Cryptoki Framework.  To allow for some flexibility
Packit 40b132
   * in the area of binary compatibility, this field should
Packit 40b132
   * be NULL.
Packit 40b132
   */
Packit 40b132
  void *null;
Packit 40b132
};
Packit 40b132
Packit 40b132
/*
Packit 40b132
 * NSSCKMDObject
Packit 40b132
 *
Packit 40b132
 * This is the basic handle for any object used by a PKCS#11 Module.
Packit 40b132
 * Modules must implement it if they support their own objects, and
Packit 40b132
 * the Framework supports it for Modules that do not handle session
Packit 40b132
 * objects.  This type contains a pointer for use by the implementor,
Packit 40b132
 * to store any object-specific data, and it contains an EPV for a
Packit 40b132
 * set of routines used to access the object.
Packit 40b132
 */
Packit 40b132
Packit 40b132
struct NSSCKMDObjectStr {
Packit 40b132
  /*
Packit 40b132
   * The implementation my use this pointer for its own purposes.
Packit 40b132
   */
Packit 40b132
  void *etc;
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine is called by the Framework when it is letting
Packit 40b132
   * go of an object handle.  It can be used by the Module to
Packit 40b132
   * free any resources tied up by an object "in use."  It is
Packit 40b132
   * optional.
Packit 40b132
   */
Packit 40b132
  void (PR_CALLBACK *Finalize)(
Packit 40b132
    NSSCKMDObject *mdObject,
Packit 40b132
    NSSCKFWObject *fwObject,
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine is used to completely destroy an object.
Packit 40b132
   * It is optional.  The parameter fwObject might be NULL
Packit 40b132
   * if the framework runs out of memory at the wrong moment.
Packit 40b132
   */
Packit 40b132
  CK_RV (PR_CALLBACK *Destroy)(
Packit 40b132
    NSSCKMDObject *mdObject,
Packit 40b132
    NSSCKFWObject *fwObject,
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This helper routine is used by the Framework, and is especially
Packit 40b132
   * useful when it is managing session objects on behalf of the
Packit 40b132
   * Module.  This routine is optional; if unimplemented, the
Packit 40b132
   * Framework will actually look up the CKA_TOKEN attribute.  In the
Packit 40b132
   * event of an error, just make something up-- the Framework will
Packit 40b132
   * find out soon enough anyway.
Packit 40b132
   */
Packit 40b132
  CK_BBOOL (PR_CALLBACK *IsTokenObject)(
Packit 40b132
    NSSCKMDObject *mdObject,
Packit 40b132
    NSSCKFWObject *fwObject,
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns the number of attributes of which this
Packit 40b132
   * object consists.  It is mandatory.  It can return zero on
Packit 40b132
   * error.
Packit 40b132
   */
Packit 40b132
  CK_ULONG (PR_CALLBACK *GetAttributeCount)(
Packit 40b132
    NSSCKMDObject *mdObject,
Packit 40b132
    NSSCKFWObject *fwObject,
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    CK_RV *pError
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine stuffs the attribute types into the provided array.
Packit 40b132
   * The array size (as obtained from GetAttributeCount) is passed in
Packit 40b132
   * as a check; return CKR_BUFFER_TOO_SMALL if the count is wrong
Packit 40b132
   * (either too big or too small).
Packit 40b132
   */
Packit 40b132
  CK_RV (PR_CALLBACK *GetAttributeTypes)(
Packit 40b132
    NSSCKMDObject *mdObject,
Packit 40b132
    NSSCKFWObject *fwObject,
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    CK_ATTRIBUTE_TYPE_PTR typeArray,
Packit 40b132
    CK_ULONG ulCount
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns the size (in bytes) of the specified
Packit 40b132
   * attribute.  It can return zero on error.
Packit 40b132
   */
Packit 40b132
  CK_ULONG (PR_CALLBACK *GetAttributeSize)(
Packit 40b132
    NSSCKMDObject *mdObject,
Packit 40b132
    NSSCKFWObject *fwObject,
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    CK_ATTRIBUTE_TYPE attribute,
Packit 40b132
    CK_RV *pError
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns an NSSCKFWItem structure.
Packit 40b132
   * The item pointer points to an NSSItem containing the attribute value.
Packit 40b132
   * The needsFreeing bit tells the framework whether to call the
Packit 40b132
   * FreeAttribute function . Upon error, an NSSCKFWItem structure
Packit 40b132
   * with a NULL NSSItem item pointer will be returned
Packit 40b132
   */
Packit 40b132
  NSSCKFWItem (PR_CALLBACK *GetAttribute)(
Packit 40b132
    NSSCKMDObject *mdObject,
Packit 40b132
    NSSCKFWObject *fwObject,
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    CK_ATTRIBUTE_TYPE attribute,
Packit 40b132
    CK_RV *pError
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns CKR_OK if the attribute could be freed.
Packit 40b132
   */
Packit 40b132
  CK_RV (PR_CALLBACK *FreeAttribute)(
Packit 40b132
    NSSCKFWItem * item
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine changes the specified attribute.  If unimplemented,
Packit 40b132
   * the object will be considered read-only.
Packit 40b132
   */
Packit 40b132
  CK_RV (PR_CALLBACK *SetAttribute)(
Packit 40b132
    NSSCKMDObject *mdObject,
Packit 40b132
    NSSCKFWObject *fwObject,
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    CK_ATTRIBUTE_TYPE attribute,
Packit 40b132
    NSSItem *value
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This routine returns the storage requirements of this object,
Packit 40b132
   * in bytes.  Cryptoki doesn't strictly define the definition,
Packit 40b132
   * but it should relate to the values returned by the "Get Memory"
Packit 40b132
   * routines of the NSSCKMDToken.  This routine is optional; if
Packit 40b132
   * unimplemented, the Framework will consider this information
Packit 40b132
   * sensitive.  This routine may return zero on error.  If the
Packit 40b132
   * specified error is CKR_OK, zero will be accepted as a valid
Packit 40b132
   * response.
Packit 40b132
   */
Packit 40b132
  CK_ULONG (PR_CALLBACK *GetObjectSize)(
Packit 40b132
    NSSCKMDObject *mdObject,
Packit 40b132
    NSSCKFWObject *fwObject,
Packit 40b132
    NSSCKMDSession *mdSession,
Packit 40b132
    NSSCKFWSession *fwSession,
Packit 40b132
    NSSCKMDToken *mdToken,
Packit 40b132
    NSSCKFWToken *fwToken,
Packit 40b132
    NSSCKMDInstance *mdInstance,
Packit 40b132
    NSSCKFWInstance *fwInstance,
Packit 40b132
    CK_RV *pError
Packit 40b132
  );
Packit 40b132
Packit 40b132
  /*
Packit 40b132
   * This object may be extended in future versions of the
Packit 40b132
   * NSS Cryptoki Framework.  To allow for some flexibility
Packit 40b132
   * in the area of binary compatibility, this field should
Packit 40b132
   * be NULL.
Packit 40b132
   */
Packit 40b132
  void *null;
Packit 40b132
};
Packit 40b132
Packit 40b132
Packit 40b132
#endif /* NSSCKMDT_H */