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