security/nss/lib/ckfw/nssmkey/minst.c

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 #include "ckmk.h"
     7 /*
     8  * nssmkey/minstance.c
     9  *
    10  * This file implements the NSSCKMDInstance object for the 
    11  * "nssmkey" cryptoki module.
    12  */
    14 /*
    15  * NSSCKMDInstance methods
    16  */
    18 static CK_ULONG
    19 ckmk_mdInstance_GetNSlots
    20 (
    21   NSSCKMDInstance *mdInstance,
    22   NSSCKFWInstance *fwInstance,
    23   CK_RV *pError
    24 )
    25 {
    26   return (CK_ULONG)1;
    27 }
    29 static CK_VERSION
    30 ckmk_mdInstance_GetCryptokiVersion
    31 (
    32   NSSCKMDInstance *mdInstance,
    33   NSSCKFWInstance *fwInstance
    34 )
    35 {
    36   return nss_ckmk_CryptokiVersion;
    37 }
    39 static NSSUTF8 *
    40 ckmk_mdInstance_GetManufacturerID
    41 (
    42   NSSCKMDInstance *mdInstance,
    43   NSSCKFWInstance *fwInstance,
    44   CK_RV *pError
    45 )
    46 {
    47   return (NSSUTF8 *)nss_ckmk_ManufacturerID;
    48 }
    50 static NSSUTF8 *
    51 ckmk_mdInstance_GetLibraryDescription
    52 (
    53   NSSCKMDInstance *mdInstance,
    54   NSSCKFWInstance *fwInstance,
    55   CK_RV *pError
    56 )
    57 {
    58   return (NSSUTF8 *)nss_ckmk_LibraryDescription;
    59 }
    61 static CK_VERSION
    62 ckmk_mdInstance_GetLibraryVersion
    63 (
    64   NSSCKMDInstance *mdInstance,
    65   NSSCKFWInstance *fwInstance
    66 )
    67 {
    68   return nss_ckmk_LibraryVersion;
    69 }
    71 static CK_RV
    72 ckmk_mdInstance_GetSlots
    73 (
    74   NSSCKMDInstance *mdInstance,
    75   NSSCKFWInstance *fwInstance,
    76   NSSCKMDSlot *slots[]
    77 )
    78 {
    79   slots[0] = (NSSCKMDSlot *)&nss_ckmk_mdSlot;
    80   return CKR_OK;
    81 }
    83 static CK_BBOOL
    84 ckmk_mdInstance_ModuleHandlesSessionObjects
    85 (
    86   NSSCKMDInstance *mdInstance,
    87   NSSCKFWInstance *fwInstance
    88 )
    89 {
    90   /* we don't want to allow any session object creation, at least
    91    * until we can investigate whether or not we can use those objects
    92    */
    93   return CK_TRUE;
    94 }
    96 NSS_IMPLEMENT_DATA const NSSCKMDInstance
    97 nss_ckmk_mdInstance = {
    98   (void *)NULL, /* etc */
    99   NULL, /* Initialize */
   100   NULL, /* Finalize */
   101   ckmk_mdInstance_GetNSlots,
   102   ckmk_mdInstance_GetCryptokiVersion,
   103   ckmk_mdInstance_GetManufacturerID,
   104   ckmk_mdInstance_GetLibraryDescription,
   105   ckmk_mdInstance_GetLibraryVersion,
   106   ckmk_mdInstance_ModuleHandlesSessionObjects, 
   107   /*NULL, /* HandleSessionObjects */
   108   ckmk_mdInstance_GetSlots,
   109   NULL, /* WaitForSlotEvent */
   110   (void *)NULL /* null terminator */
   111 };

mercurial