| OLD | NEW |
| (Empty) |
| 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/. */ | |
| 4 | |
| 5 #include "builtins.h" | |
| 6 | |
| 7 /* | |
| 8 * builtins/token.c | |
| 9 * | |
| 10 * This file implements the NSSCKMDToken object for the | |
| 11 * "builtin objects" cryptoki module. | |
| 12 */ | |
| 13 | |
| 14 static NSSUTF8 * | |
| 15 builtins_mdToken_GetLabel( | |
| 16 NSSCKMDToken *mdToken, | |
| 17 NSSCKFWToken *fwToken, | |
| 18 NSSCKMDInstance *mdInstance, | |
| 19 NSSCKFWInstance *fwInstance, | |
| 20 CK_RV *pError) | |
| 21 { | |
| 22 return (NSSUTF8 *)nss_builtins_TokenLabel; | |
| 23 } | |
| 24 | |
| 25 static NSSUTF8 * | |
| 26 builtins_mdToken_GetManufacturerID( | |
| 27 NSSCKMDToken *mdToken, | |
| 28 NSSCKFWToken *fwToken, | |
| 29 NSSCKMDInstance *mdInstance, | |
| 30 NSSCKFWInstance *fwInstance, | |
| 31 CK_RV *pError) | |
| 32 { | |
| 33 return (NSSUTF8 *)nss_builtins_ManufacturerID; | |
| 34 } | |
| 35 | |
| 36 static NSSUTF8 * | |
| 37 builtins_mdToken_GetModel( | |
| 38 NSSCKMDToken *mdToken, | |
| 39 NSSCKFWToken *fwToken, | |
| 40 NSSCKMDInstance *mdInstance, | |
| 41 NSSCKFWInstance *fwInstance, | |
| 42 CK_RV *pError) | |
| 43 { | |
| 44 return (NSSUTF8 *)nss_builtins_TokenModel; | |
| 45 } | |
| 46 | |
| 47 static NSSUTF8 * | |
| 48 builtins_mdToken_GetSerialNumber( | |
| 49 NSSCKMDToken *mdToken, | |
| 50 NSSCKFWToken *fwToken, | |
| 51 NSSCKMDInstance *mdInstance, | |
| 52 NSSCKFWInstance *fwInstance, | |
| 53 CK_RV *pError) | |
| 54 { | |
| 55 return (NSSUTF8 *)nss_builtins_TokenSerialNumber; | |
| 56 } | |
| 57 | |
| 58 static CK_BBOOL | |
| 59 builtins_mdToken_GetIsWriteProtected( | |
| 60 NSSCKMDToken *mdToken, | |
| 61 NSSCKFWToken *fwToken, | |
| 62 NSSCKMDInstance *mdInstance, | |
| 63 NSSCKFWInstance *fwInstance) | |
| 64 { | |
| 65 return CK_TRUE; | |
| 66 } | |
| 67 | |
| 68 static CK_VERSION | |
| 69 builtins_mdToken_GetHardwareVersion( | |
| 70 NSSCKMDToken *mdToken, | |
| 71 NSSCKFWToken *fwToken, | |
| 72 NSSCKMDInstance *mdInstance, | |
| 73 NSSCKFWInstance *fwInstance) | |
| 74 { | |
| 75 return nss_builtins_HardwareVersion; | |
| 76 } | |
| 77 | |
| 78 static CK_VERSION | |
| 79 builtins_mdToken_GetFirmwareVersion( | |
| 80 NSSCKMDToken *mdToken, | |
| 81 NSSCKFWToken *fwToken, | |
| 82 NSSCKMDInstance *mdInstance, | |
| 83 NSSCKFWInstance *fwInstance) | |
| 84 { | |
| 85 return nss_builtins_FirmwareVersion; | |
| 86 } | |
| 87 | |
| 88 static NSSCKMDSession * | |
| 89 builtins_mdToken_OpenSession( | |
| 90 NSSCKMDToken *mdToken, | |
| 91 NSSCKFWToken *fwToken, | |
| 92 NSSCKMDInstance *mdInstance, | |
| 93 NSSCKFWInstance *fwInstance, | |
| 94 NSSCKFWSession *fwSession, | |
| 95 CK_BBOOL rw, | |
| 96 CK_RV *pError) | |
| 97 { | |
| 98 return nss_builtins_CreateSession(fwSession, pError); | |
| 99 } | |
| 100 | |
| 101 const NSSCKMDToken | |
| 102 nss_builtins_mdToken = { | |
| 103 (void *)NULL, /* etc */ | |
| 104 NULL, /* Setup */ | |
| 105 NULL, /* Invalidate */ | |
| 106 NULL, /* InitToken -- default errs */ | |
| 107 builtins_mdToken_GetLabel, | |
| 108 builtins_mdToken_GetManufacturerID, | |
| 109 builtins_mdToken_GetModel, | |
| 110 builtins_mdToken_GetSerialNumber, | |
| 111 NULL, /* GetHasRNG -- default is false */ | |
| 112 builtins_mdToken_GetIsWriteProtected, | |
| 113 NULL, /* GetLoginRequired -- default is false */ | |
| 114 NULL, /* GetUserPinInitialized -- default is false */ | |
| 115 NULL, /* GetRestoreKeyNotNeeded -- irrelevant */ | |
| 116 NULL, /* GetHasClockOnToken -- default is false */ | |
| 117 NULL, /* GetHasProtectedAuthenticationPath -- default is false */ | |
| 118 NULL, /* GetSupportsDualCryptoOperations -- default is false */ | |
| 119 NULL, /* GetMaxSessionCount -- default is CK_UNAVAILABLE_INFORMATION */ | |
| 120 NULL, /* GetMaxRwSessionCount -- default is CK_UNAVAILABLE_INFORMATION *
/ | |
| 121 NULL, /* GetMaxPinLen -- irrelevant */ | |
| 122 NULL, /* GetMinPinLen -- irrelevant */ | |
| 123 NULL, /* GetTotalPublicMemory -- default is CK_UNAVAILABLE_INFORMATION *
/ | |
| 124 NULL, /* GetFreePublicMemory -- default is CK_UNAVAILABLE_INFORMATION */ | |
| 125 NULL, /* GetTotalPrivateMemory -- default is CK_UNAVAILABLE_INFORMATION
*/ | |
| 126 NULL, /* GetFreePrivateMemory -- default is CK_UNAVAILABLE_INFORMATION *
/ | |
| 127 builtins_mdToken_GetHardwareVersion, | |
| 128 builtins_mdToken_GetFirmwareVersion, | |
| 129 NULL, /* GetUTCTime -- no clock */ | |
| 130 builtins_mdToken_OpenSession, | |
| 131 NULL, /* GetMechanismCount -- default is zero */ | |
| 132 NULL, /* GetMechanismTypes -- irrelevant */ | |
| 133 NULL, /* GetMechanism -- irrelevant */ | |
| 134 (void *)NULL /* null terminator */ | |
| 135 }; | |
| OLD | NEW |