1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/nss/lib/ckfw/nssmkey/minst.c Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,111 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#include "ckmk.h" 1.9 + 1.10 +/* 1.11 + * nssmkey/minstance.c 1.12 + * 1.13 + * This file implements the NSSCKMDInstance object for the 1.14 + * "nssmkey" cryptoki module. 1.15 + */ 1.16 + 1.17 +/* 1.18 + * NSSCKMDInstance methods 1.19 + */ 1.20 + 1.21 +static CK_ULONG 1.22 +ckmk_mdInstance_GetNSlots 1.23 +( 1.24 + NSSCKMDInstance *mdInstance, 1.25 + NSSCKFWInstance *fwInstance, 1.26 + CK_RV *pError 1.27 +) 1.28 +{ 1.29 + return (CK_ULONG)1; 1.30 +} 1.31 + 1.32 +static CK_VERSION 1.33 +ckmk_mdInstance_GetCryptokiVersion 1.34 +( 1.35 + NSSCKMDInstance *mdInstance, 1.36 + NSSCKFWInstance *fwInstance 1.37 +) 1.38 +{ 1.39 + return nss_ckmk_CryptokiVersion; 1.40 +} 1.41 + 1.42 +static NSSUTF8 * 1.43 +ckmk_mdInstance_GetManufacturerID 1.44 +( 1.45 + NSSCKMDInstance *mdInstance, 1.46 + NSSCKFWInstance *fwInstance, 1.47 + CK_RV *pError 1.48 +) 1.49 +{ 1.50 + return (NSSUTF8 *)nss_ckmk_ManufacturerID; 1.51 +} 1.52 + 1.53 +static NSSUTF8 * 1.54 +ckmk_mdInstance_GetLibraryDescription 1.55 +( 1.56 + NSSCKMDInstance *mdInstance, 1.57 + NSSCKFWInstance *fwInstance, 1.58 + CK_RV *pError 1.59 +) 1.60 +{ 1.61 + return (NSSUTF8 *)nss_ckmk_LibraryDescription; 1.62 +} 1.63 + 1.64 +static CK_VERSION 1.65 +ckmk_mdInstance_GetLibraryVersion 1.66 +( 1.67 + NSSCKMDInstance *mdInstance, 1.68 + NSSCKFWInstance *fwInstance 1.69 +) 1.70 +{ 1.71 + return nss_ckmk_LibraryVersion; 1.72 +} 1.73 + 1.74 +static CK_RV 1.75 +ckmk_mdInstance_GetSlots 1.76 +( 1.77 + NSSCKMDInstance *mdInstance, 1.78 + NSSCKFWInstance *fwInstance, 1.79 + NSSCKMDSlot *slots[] 1.80 +) 1.81 +{ 1.82 + slots[0] = (NSSCKMDSlot *)&nss_ckmk_mdSlot; 1.83 + return CKR_OK; 1.84 +} 1.85 + 1.86 +static CK_BBOOL 1.87 +ckmk_mdInstance_ModuleHandlesSessionObjects 1.88 +( 1.89 + NSSCKMDInstance *mdInstance, 1.90 + NSSCKFWInstance *fwInstance 1.91 +) 1.92 +{ 1.93 + /* we don't want to allow any session object creation, at least 1.94 + * until we can investigate whether or not we can use those objects 1.95 + */ 1.96 + return CK_TRUE; 1.97 +} 1.98 + 1.99 +NSS_IMPLEMENT_DATA const NSSCKMDInstance 1.100 +nss_ckmk_mdInstance = { 1.101 + (void *)NULL, /* etc */ 1.102 + NULL, /* Initialize */ 1.103 + NULL, /* Finalize */ 1.104 + ckmk_mdInstance_GetNSlots, 1.105 + ckmk_mdInstance_GetCryptokiVersion, 1.106 + ckmk_mdInstance_GetManufacturerID, 1.107 + ckmk_mdInstance_GetLibraryDescription, 1.108 + ckmk_mdInstance_GetLibraryVersion, 1.109 + ckmk_mdInstance_ModuleHandlesSessionObjects, 1.110 + /*NULL, /* HandleSessionObjects */ 1.111 + ckmk_mdInstance_GetSlots, 1.112 + NULL, /* WaitForSlotEvent */ 1.113 + (void *)NULL /* null terminator */ 1.114 +};