andre@0: /* This Source Code Form is subject to the terms of the Mozilla Public andre@0: * License, v. 2.0. If a copy of the MPL was not distributed with this andre@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ andre@0: andre@0: #include "builtins.h" andre@0: andre@0: /* andre@0: * builtins/instance.c andre@0: * andre@0: * This file implements the NSSCKMDInstance object for the andre@0: * "builtin objects" cryptoki module. andre@0: */ andre@0: andre@0: /* andre@0: * NSSCKMDInstance methods andre@0: */ andre@0: andre@0: static CK_ULONG andre@0: builtins_mdInstance_GetNSlots andre@0: ( andre@0: NSSCKMDInstance *mdInstance, andre@0: NSSCKFWInstance *fwInstance, andre@0: CK_RV *pError andre@0: ) andre@0: { andre@0: return (CK_ULONG)1; andre@0: } andre@0: andre@0: static CK_VERSION andre@0: builtins_mdInstance_GetCryptokiVersion andre@0: ( andre@0: NSSCKMDInstance *mdInstance, andre@0: NSSCKFWInstance *fwInstance andre@0: ) andre@0: { andre@0: return nss_builtins_CryptokiVersion; andre@0: } andre@0: andre@0: static NSSUTF8 * andre@0: builtins_mdInstance_GetManufacturerID andre@0: ( andre@0: NSSCKMDInstance *mdInstance, andre@0: NSSCKFWInstance *fwInstance, andre@0: CK_RV *pError andre@0: ) andre@0: { andre@0: return (NSSUTF8 *)nss_builtins_ManufacturerID; andre@0: } andre@0: andre@0: static NSSUTF8 * andre@0: builtins_mdInstance_GetLibraryDescription andre@0: ( andre@0: NSSCKMDInstance *mdInstance, andre@0: NSSCKFWInstance *fwInstance, andre@0: CK_RV *pError andre@0: ) andre@0: { andre@0: return (NSSUTF8 *)nss_builtins_LibraryDescription; andre@0: } andre@0: andre@0: static CK_VERSION andre@0: builtins_mdInstance_GetLibraryVersion andre@0: ( andre@0: NSSCKMDInstance *mdInstance, andre@0: NSSCKFWInstance *fwInstance andre@0: ) andre@0: { andre@0: extern const char __nss_builtins_rcsid[]; andre@0: extern const char __nss_builtins_sccsid[]; andre@0: volatile char c; /* force a reference that won't get optimized away */ andre@0: andre@0: c = __nss_builtins_rcsid[0] + __nss_builtins_sccsid[0]; andre@0: return nss_builtins_LibraryVersion; andre@0: } andre@0: andre@0: static CK_RV andre@0: builtins_mdInstance_GetSlots andre@0: ( andre@0: NSSCKMDInstance *mdInstance, andre@0: NSSCKFWInstance *fwInstance, andre@0: NSSCKMDSlot *slots[] andre@0: ) andre@0: { andre@0: slots[0] = (NSSCKMDSlot *)&nss_builtins_mdSlot; andre@0: return CKR_OK; andre@0: } andre@0: andre@0: const NSSCKMDInstance andre@0: nss_builtins_mdInstance = { andre@0: (void *)NULL, /* etc */ andre@0: NULL, /* Initialize */ andre@0: NULL, /* Finalize */ andre@0: builtins_mdInstance_GetNSlots, andre@0: builtins_mdInstance_GetCryptokiVersion, andre@0: builtins_mdInstance_GetManufacturerID, andre@0: builtins_mdInstance_GetLibraryDescription, andre@0: builtins_mdInstance_GetLibraryVersion, andre@0: NULL, /* ModuleHandlesSessionObjects -- defaults to false */ andre@0: builtins_mdInstance_GetSlots, andre@0: NULL, /* WaitForSlotEvent */ andre@0: (void *)NULL /* null terminator */ andre@0: };