| File: | root/firefox-clang/security/nss/lib/pk11wrap/debug_module.c |
| Warning: | line 3454, column 1 Opened stream never closed. Potential resource leak |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
| 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 | * The following handles the loading, unloading and management of | |||
| 6 | * various PCKS #11 modules | |||
| 7 | */ | |||
| 8 | #define FORCE_PR_LOG1 1 | |||
| 9 | #include "base.h" | |||
| 10 | #include "seccomon.h" | |||
| 11 | #include "pkcs11.h" | |||
| 12 | #include "secmod.h" | |||
| 13 | #include "prlink.h" | |||
| 14 | #include "pk11func.h" | |||
| 15 | #include "secmodi.h" | |||
| 16 | #include "secmodti.h" | |||
| 17 | #include "nssilock.h" | |||
| 18 | #include "secerr.h" | |||
| 19 | #include "prenv.h" | |||
| 20 | #include "utilpars.h" | |||
| 21 | #include "prio.h" | |||
| 22 | #include "prprf.h" | |||
| 23 | #include <stdio.h> | |||
| 24 | #include "prsystem.h" | |||
| 25 | ||||
| 26 | #define DEBUG_MODULE1 1 | |||
| 27 | ||||
| 28 | #ifdef DEBUG_MODULE1 | |||
| 29 | static char *modToDBG = NULL((void*)0); | |||
| 30 | ||||
| 31 | #include "debug_module.c" | |||
| 32 | #endif | |||
| 33 | ||||
| 34 | /* build the PKCS #11 2.01 lock files */ | |||
| 35 | CK_RV PR_CALLBACK | |||
| 36 | secmodCreateMutext(CK_VOID_PTR_PTR pmutex) | |||
| 37 | { | |||
| 38 | *pmutex = (CK_VOID_PTR)PZ_NewLock(nssILockOther)PR_NewLock(); | |||
| 39 | if (*pmutex) | |||
| 40 | return CKR_OK0x00000000UL; | |||
| 41 | return CKR_HOST_MEMORY0x00000002UL; | |||
| 42 | } | |||
| 43 | ||||
| 44 | CK_RV PR_CALLBACK | |||
| 45 | secmodDestroyMutext(CK_VOID_PTR mutext) | |||
| 46 | { | |||
| 47 | PZ_DestroyLock((PZLock *)mutext)PR_DestroyLock(((PRLock *)mutext)); | |||
| 48 | return CKR_OK0x00000000UL; | |||
| 49 | } | |||
| 50 | ||||
| 51 | CK_RV PR_CALLBACK | |||
| 52 | secmodLockMutext(CK_VOID_PTR mutext) | |||
| 53 | { | |||
| 54 | PZ_Lock((PZLock *)mutext)PR_Lock(((PRLock *)mutext)); | |||
| 55 | return CKR_OK0x00000000UL; | |||
| 56 | } | |||
| 57 | ||||
| 58 | CK_RV PR_CALLBACK | |||
| 59 | secmodUnlockMutext(CK_VOID_PTR mutext) | |||
| 60 | { | |||
| 61 | PZ_Unlock((PZLock *)mutext)PR_Unlock(((PRLock *)mutext)); | |||
| 62 | return CKR_OK0x00000000UL; | |||
| 63 | } | |||
| 64 | ||||
| 65 | static SECMODModuleID nextModuleID = 1; | |||
| 66 | static const CK_C_INITIALIZE_ARGS secmodLockFunctions = { | |||
| 67 | secmodCreateMutext, secmodDestroyMutext, secmodLockMutext, | |||
| 68 | secmodUnlockMutext, CKF_LIBRARY_CANT_CREATE_OS_THREADS0x00000001UL | CKF_OS_LOCKING_OK0x00000002UL, | |||
| 69 | NULL((void*)0) | |||
| 70 | }; | |||
| 71 | static const CK_C_INITIALIZE_ARGS secmodNoLockArgs = { | |||
| 72 | NULL((void*)0), NULL((void*)0), NULL((void*)0), NULL((void*)0), | |||
| 73 | CKF_LIBRARY_CANT_CREATE_OS_THREADS0x00000001UL, NULL((void*)0) | |||
| 74 | }; | |||
| 75 | ||||
| 76 | static PRBool loadSingleThreadedModules = PR_TRUE1; | |||
| 77 | static PRBool enforceAlreadyInitializedError = PR_TRUE1; | |||
| 78 | static PRBool finalizeModules = PR_TRUE1; | |||
| 79 | ||||
| 80 | /* set global options for NSS PKCS#11 module loader */ | |||
| 81 | SECStatus | |||
| 82 | pk11_setGlobalOptions(PRBool noSingleThreadedModules, | |||
| 83 | PRBool allowAlreadyInitializedModules, | |||
| 84 | PRBool dontFinalizeModules) | |||
| 85 | { | |||
| 86 | if (noSingleThreadedModules) { | |||
| 87 | loadSingleThreadedModules = PR_FALSE0; | |||
| 88 | } else { | |||
| 89 | loadSingleThreadedModules = PR_TRUE1; | |||
| 90 | } | |||
| 91 | if (allowAlreadyInitializedModules) { | |||
| 92 | enforceAlreadyInitializedError = PR_FALSE0; | |||
| 93 | } else { | |||
| 94 | enforceAlreadyInitializedError = PR_TRUE1; | |||
| 95 | } | |||
| 96 | if (dontFinalizeModules) { | |||
| 97 | finalizeModules = PR_FALSE0; | |||
| 98 | } else { | |||
| 99 | finalizeModules = PR_TRUE1; | |||
| 100 | } | |||
| 101 | return SECSuccess; | |||
| 102 | } | |||
| 103 | ||||
| 104 | PRBool | |||
| 105 | pk11_getFinalizeModulesOption(void) | |||
| 106 | { | |||
| 107 | return finalizeModules; | |||
| 108 | } | |||
| 109 | ||||
| 110 | /* | |||
| 111 | * Allow specification loading the same module more than once at init time. | |||
| 112 | * This enables 2 things. | |||
| 113 | * | |||
| 114 | * 1) we can load additional databases by manipulating secmod.db/pkcs11.txt. | |||
| 115 | * 2) we can handle the case where some library has already initialized NSS | |||
| 116 | * before the main application. | |||
| 117 | * | |||
| 118 | * oldModule is the module we have already initialized. | |||
| 119 | * char *modulespec is the full module spec for the library we want to | |||
| 120 | * initialize. | |||
| 121 | */ | |||
| 122 | static SECStatus | |||
| 123 | secmod_handleReload(SECMODModule *oldModule, SECMODModule *newModule) | |||
| 124 | { | |||
| 125 | PK11SlotInfo *slot; | |||
| 126 | char *modulespec; | |||
| 127 | char *newModuleSpec; | |||
| 128 | char **children; | |||
| 129 | CK_SLOT_ID *ids; | |||
| 130 | SECMODConfigList *conflist = NULL((void*)0); | |||
| 131 | SECStatus rv = SECFailure; | |||
| 132 | int count = 0; | |||
| 133 | ||||
| 134 | /* first look for tokens= key words from the module spec */ | |||
| 135 | modulespec = newModule->libraryParams; | |||
| 136 | newModuleSpec = secmod_ParseModuleSpecForTokens(PR_TRUE1, | |||
| 137 | newModule->isFIPS, modulespec, &children, &ids); | |||
| 138 | if (!newModuleSpec) { | |||
| 139 | return SECFailure; | |||
| 140 | } | |||
| 141 | ||||
| 142 | /* | |||
| 143 | * We are now trying to open a new slot on an already loaded module. | |||
| 144 | * If that slot represents a cert/key database, we don't want to open | |||
| 145 | * multiple copies of that same database. Unfortunately we understand | |||
| 146 | * the softoken flags well enough to be able to do this, so we can only get | |||
| 147 | * the list of already loaded databases if we are trying to open another | |||
| 148 | * internal module. | |||
| 149 | */ | |||
| 150 | if (oldModule->internal) { | |||
| 151 | conflist = secmod_GetConfigList(oldModule->isFIPS, | |||
| 152 | oldModule->libraryParams, &count); | |||
| 153 | } | |||
| 154 | ||||
| 155 | /* don't open multiple of the same db */ | |||
| 156 | if (conflist && secmod_MatchConfigList(newModuleSpec, conflist, count)) { | |||
| 157 | rv = SECSuccess; | |||
| 158 | goto loser; | |||
| 159 | } | |||
| 160 | slot = SECMOD_OpenNewSlot(oldModule, newModuleSpec); | |||
| 161 | if (slot) { | |||
| 162 | int newID; | |||
| 163 | char **thisChild; | |||
| 164 | CK_SLOT_ID *thisID; | |||
| 165 | char *oldModuleSpec; | |||
| 166 | ||||
| 167 | if (secmod_IsInternalKeySlot(newModule)) { | |||
| 168 | pk11_SetInternalKeySlotIfFirst(slot); | |||
| 169 | } | |||
| 170 | newID = slot->slotID; | |||
| 171 | PK11_FreeSlot(slot); | |||
| 172 | for (thisChild = children, thisID = ids; thisChild && *thisChild; | |||
| 173 | thisChild++, thisID++) { | |||
| 174 | if (conflist && | |||
| 175 | secmod_MatchConfigList(*thisChild, conflist, count)) { | |||
| 176 | *thisID = (CK_SLOT_ID)-1; | |||
| 177 | continue; | |||
| 178 | } | |||
| 179 | slot = SECMOD_OpenNewSlot(oldModule, *thisChild); | |||
| 180 | if (slot) { | |||
| 181 | *thisID = slot->slotID; | |||
| 182 | PK11_FreeSlot(slot); | |||
| 183 | } else { | |||
| 184 | *thisID = (CK_SLOT_ID)-1; | |||
| 185 | } | |||
| 186 | } | |||
| 187 | ||||
| 188 | /* update the old module initialization string in case we need to | |||
| 189 | * shutdown and reinit the whole mess (this is rare, but can happen | |||
| 190 | * when trying to stop smart card insertion/removal threads)... */ | |||
| 191 | oldModuleSpec = secmod_MkAppendTokensList(oldModule->arena, | |||
| 192 | oldModule->libraryParams, newModuleSpec, newID, | |||
| 193 | children, ids); | |||
| 194 | if (oldModuleSpec) { | |||
| 195 | oldModule->libraryParams = oldModuleSpec; | |||
| 196 | } | |||
| 197 | ||||
| 198 | rv = SECSuccess; | |||
| 199 | } | |||
| 200 | ||||
| 201 | loser: | |||
| 202 | secmod_FreeChildren(children, ids); | |||
| 203 | PORT_FreePORT_Free_Util(newModuleSpec); | |||
| 204 | if (conflist) { | |||
| 205 | secmod_FreeConfigList(conflist, count); | |||
| 206 | } | |||
| 207 | return rv; | |||
| 208 | } | |||
| 209 | ||||
| 210 | /* | |||
| 211 | * collect the steps we need to initialize a module in a single function | |||
| 212 | */ | |||
| 213 | SECStatus | |||
| 214 | secmod_ModuleInit(SECMODModule *mod, SECMODModule **reload, | |||
| 215 | PRBool *alreadyLoaded) | |||
| 216 | { | |||
| 217 | CK_C_INITIALIZE_ARGS moduleArgs; | |||
| 218 | CK_VOID_PTR pInitArgs; | |||
| 219 | CK_RV crv; | |||
| 220 | ||||
| 221 | if (reload) { | |||
| 222 | *reload = NULL((void*)0); | |||
| 223 | } | |||
| 224 | ||||
| 225 | if (!mod || !alreadyLoaded) { | |||
| 226 | PORT_SetErrorPORT_SetError_Util(SEC_ERROR_INVALID_ARGS); | |||
| 227 | return SECFailure; | |||
| 228 | } | |||
| 229 | ||||
| 230 | if (mod->libraryParams == NULL((void*)0)) { | |||
| 231 | if (mod->isThreadSafe) { | |||
| 232 | pInitArgs = (void *)&secmodLockFunctions; | |||
| 233 | } else { | |||
| 234 | pInitArgs = NULL((void*)0); | |||
| 235 | } | |||
| 236 | } else { | |||
| 237 | if (mod->isThreadSafe) { | |||
| 238 | moduleArgs = secmodLockFunctions; | |||
| 239 | } else { | |||
| 240 | moduleArgs = secmodNoLockArgs; | |||
| 241 | } | |||
| 242 | moduleArgs.LibraryParameters = (void *)mod->libraryParams; | |||
| 243 | pInitArgs = &moduleArgs; | |||
| 244 | } | |||
| 245 | crv = PK11_GETTAB(mod)((CK_FUNCTION_LIST_3_0_PTR)((mod)->functionList))->C_Initialize(pInitArgs); | |||
| 246 | if (CKR_CRYPTOKI_ALREADY_INITIALIZED0x00000191UL == crv) { | |||
| 247 | SECMODModule *oldModule = NULL((void*)0); | |||
| 248 | ||||
| 249 | /* Library has already been loaded once, if caller expects it, and it | |||
| 250 | * has additional configuration, try reloading it as well. */ | |||
| 251 | if (reload != NULL((void*)0) && mod->libraryParams) { | |||
| 252 | oldModule = secmod_FindModuleByFuncPtr(mod->functionList); | |||
| 253 | } | |||
| 254 | /* Library has been loaded by NSS. It means it may be capable of | |||
| 255 | * reloading */ | |||
| 256 | if (oldModule) { | |||
| 257 | SECStatus rv; | |||
| 258 | rv = secmod_handleReload(oldModule, mod); | |||
| 259 | if (rv == SECSuccess) { | |||
| 260 | /* This module should go away soon, since we've | |||
| 261 | * simply expanded the slots on the old module. | |||
| 262 | * When it goes away, it should not Finalize since | |||
| 263 | * that will close our old module as well. Setting | |||
| 264 | * the function list to NULL will prevent that close */ | |||
| 265 | mod->functionList = NULL((void*)0); | |||
| 266 | *reload = oldModule; | |||
| 267 | return SECSuccess; | |||
| 268 | } | |||
| 269 | SECMOD_DestroyModule(oldModule); | |||
| 270 | } | |||
| 271 | /* reload not possible, fall back to old semantics */ | |||
| 272 | if (!enforceAlreadyInitializedError) { | |||
| 273 | *alreadyLoaded = PR_TRUE1; | |||
| 274 | return SECSuccess; | |||
| 275 | } | |||
| 276 | } | |||
| 277 | if (crv != CKR_OK0x00000000UL) { | |||
| 278 | if (!mod->isThreadSafe || | |||
| 279 | crv == CKR_NSS_CERTDB_FAILED((0x80000000UL | 0x4E534350) + 1) || | |||
| 280 | crv == CKR_NSS_KEYDB_FAILED((0x80000000UL | 0x4E534350) + 2)) { | |||
| 281 | PORT_SetErrorPORT_SetError_Util(PK11_MapError(crv)); | |||
| 282 | return SECFailure; | |||
| 283 | } | |||
| 284 | /* If we had attempted to init a single threaded module "with" | |||
| 285 | * parameters and it failed, should we retry "without" parameters? | |||
| 286 | * (currently we don't retry in this scenario) */ | |||
| 287 | ||||
| 288 | if (!loadSingleThreadedModules) { | |||
| 289 | PORT_SetErrorPORT_SetError_Util(SEC_ERROR_INCOMPATIBLE_PKCS11); | |||
| 290 | return SECFailure; | |||
| 291 | } | |||
| 292 | /* If we arrive here, the module failed a ThreadSafe init. */ | |||
| 293 | mod->isThreadSafe = PR_FALSE0; | |||
| 294 | if (!mod->libraryParams) { | |||
| 295 | pInitArgs = NULL((void*)0); | |||
| 296 | } else { | |||
| 297 | moduleArgs = secmodNoLockArgs; | |||
| 298 | moduleArgs.LibraryParameters = (void *)mod->libraryParams; | |||
| 299 | pInitArgs = &moduleArgs; | |||
| 300 | } | |||
| 301 | crv = PK11_GETTAB(mod)((CK_FUNCTION_LIST_3_0_PTR)((mod)->functionList))->C_Initialize(pInitArgs); | |||
| 302 | if ((CKR_CRYPTOKI_ALREADY_INITIALIZED0x00000191UL == crv) && | |||
| 303 | (!enforceAlreadyInitializedError)) { | |||
| 304 | *alreadyLoaded = PR_TRUE1; | |||
| 305 | return SECSuccess; | |||
| 306 | } | |||
| 307 | if (crv != CKR_OK0x00000000UL) { | |||
| 308 | PORT_SetErrorPORT_SetError_Util(PK11_MapError(crv)); | |||
| 309 | return SECFailure; | |||
| 310 | } | |||
| 311 | } | |||
| 312 | return SECSuccess; | |||
| 313 | } | |||
| 314 | ||||
| 315 | /* | |||
| 316 | * set the hasRootCerts flags in the module so it can be stored back | |||
| 317 | * into the database. | |||
| 318 | */ | |||
| 319 | void | |||
| 320 | SECMOD_SetRootCerts(PK11SlotInfo *slot, SECMODModule *mod) | |||
| 321 | { | |||
| 322 | PK11PreSlotInfo *psi = NULL((void*)0); | |||
| 323 | int i; | |||
| 324 | ||||
| 325 | if (slot->hasRootCerts) { | |||
| 326 | for (i = 0; i < mod->slotInfoCount; i++) { | |||
| 327 | if (slot->slotID == mod->slotInfo[i].slotID) { | |||
| 328 | psi = &mod->slotInfo[i]; | |||
| 329 | break; | |||
| 330 | } | |||
| 331 | } | |||
| 332 | if (psi == NULL((void*)0)) { | |||
| 333 | /* allocate more slots */ | |||
| 334 | PK11PreSlotInfo *psi_list = (PK11PreSlotInfo *) | |||
| 335 | PORT_ArenaAllocPORT_ArenaAlloc_Util(mod->arena, | |||
| 336 | (mod->slotInfoCount + 1) * sizeof(PK11PreSlotInfo)); | |||
| 337 | /* copy the old ones */ | |||
| 338 | if (mod->slotInfoCount > 0) { | |||
| 339 | PORT_Memcpymemcpy(psi_list, mod->slotInfo, | |||
| 340 | (mod->slotInfoCount) * sizeof(PK11PreSlotInfo)); | |||
| 341 | } | |||
| 342 | /* assign psi to the last new slot */ | |||
| 343 | psi = &psi_list[mod->slotInfoCount]; | |||
| 344 | psi->slotID = slot->slotID; | |||
| 345 | psi->askpw = 0; | |||
| 346 | psi->timeout = 0; | |||
| 347 | psi->defaultFlags = 0; | |||
| 348 | ||||
| 349 | /* increment module count & store new list */ | |||
| 350 | mod->slotInfo = psi_list; | |||
| 351 | mod->slotInfoCount++; | |||
| 352 | } | |||
| 353 | psi->hasRootCerts = 1; | |||
| 354 | } | |||
| 355 | } | |||
| 356 | ||||
| 357 | #ifndef NSS_STATIC_SOFTOKEN | |||
| 358 | static const char *my_shlib_name = | |||
| 359 | SHLIB_PREFIX"lib" "nss" NSS_SHLIB_VERSION"3" "." SHLIB_SUFFIX"so"; | |||
| 360 | static const char *softoken_shlib_name = | |||
| 361 | SHLIB_PREFIX"lib" "softokn" SOFTOKEN_SHLIB_VERSION"3" "." SHLIB_SUFFIX"so"; | |||
| 362 | static const PRCallOnceType pristineCallOnce; | |||
| 363 | static PRCallOnceType loadSoftokenOnce; | |||
| 364 | static PRLibrary *softokenLib; | |||
| 365 | static PRInt32 softokenLoadCount; | |||
| 366 | ||||
| 367 | /* This function must be run only once. */ | |||
| 368 | /* determine if hybrid platform, then actually load the DSO. */ | |||
| 369 | static PRStatus | |||
| 370 | softoken_LoadDSO(void) | |||
| 371 | { | |||
| 372 | PRLibrary *handle; | |||
| 373 | ||||
| 374 | handle = PORT_LoadLibraryFromOrigin(my_shlib_name, | |||
| 375 | (PRFuncPtr)&softoken_LoadDSO, | |||
| 376 | softoken_shlib_name); | |||
| 377 | if (handle) { | |||
| 378 | softokenLib = handle; | |||
| 379 | return PR_SUCCESS; | |||
| 380 | } | |||
| 381 | return PR_FAILURE; | |||
| 382 | } | |||
| 383 | #else | |||
| 384 | CK_RV NSC_GetInterface(CK_UTF8CHAR_PTR pInterfaceName, | |||
| 385 | CK_VERSION_PTR pVersion, | |||
| 386 | CK_INTERFACE_PTR_PTR *ppInterface, CK_FLAGS flags); | |||
| 387 | char **NSC_ModuleDBFunc(unsigned long function, char *parameters, void *args); | |||
| 388 | #endif | |||
| 389 | ||||
| 390 | SECStatus | |||
| 391 | secmod_DetermineModuleFunctionList(SECMODModule *mod) | |||
| 392 | { | |||
| 393 | PRLibrary *library = NULL((void*)0); | |||
| 394 | CK_C_GetInterface ientry = NULL((void*)0); | |||
| 395 | CK_C_GetFunctionList fentry = NULL((void*)0); | |||
| 396 | char *disableUnload = NULL((void*)0); | |||
| 397 | #ifndef NSS_STATIC_SOFTOKEN | |||
| 398 | const char *nss_interface; | |||
| 399 | const char *nss_function; | |||
| 400 | #endif | |||
| 401 | CK_INTERFACE_PTR interface; | |||
| 402 | ||||
| 403 | /* internal modules get loaded from their internal list */ | |||
| 404 | if (mod->internal && (mod->dllName == NULL((void*)0))) { | |||
| 405 | #ifdef NSS_STATIC_SOFTOKEN | |||
| 406 | ientry = (CK_C_GetInterface)NSC_GetInterface; | |||
| 407 | #else | |||
| 408 | /* | |||
| 409 | * Loads softoken as a dynamic library, | |||
| 410 | * even though the rest of NSS assumes this as the "internal" module. | |||
| 411 | */ | |||
| 412 | if (!softokenLib && | |||
| 413 | PR_SUCCESS != PR_CallOnce(&loadSoftokenOnce, &softoken_LoadDSO)) | |||
| 414 | return SECFailure; | |||
| 415 | ||||
| 416 | PR_ATOMIC_INCREMENT(&softokenLoadCount)__sync_add_and_fetch(&softokenLoadCount, 1); | |||
| 417 | ||||
| 418 | if (mod->isFIPS) { | |||
| 419 | nss_interface = "FC_GetInterface"; | |||
| 420 | nss_function = "FC_GetFunctionList"; | |||
| 421 | } else { | |||
| 422 | nss_interface = "NSC_GetInterface"; | |||
| 423 | nss_function = "NSC_GetFunctionList"; | |||
| 424 | } | |||
| 425 | ||||
| 426 | ientry = (CK_C_GetInterface) | |||
| 427 | PR_FindSymbol(softokenLib, nss_interface); | |||
| 428 | if (!ientry) { | |||
| 429 | fentry = (CK_C_GetFunctionList) | |||
| 430 | PR_FindSymbol(softokenLib, nss_function); | |||
| 431 | if (!fentry) { | |||
| 432 | return SECFailure; | |||
| 433 | } | |||
| 434 | } | |||
| 435 | #endif | |||
| 436 | ||||
| 437 | if (mod->isModuleDB) { | |||
| 438 | mod->moduleDBFunc = (CK_C_GetFunctionList) | |||
| 439 | #ifdef NSS_STATIC_SOFTOKEN | |||
| 440 | NSC_ModuleDBFunc; | |||
| 441 | #else | |||
| 442 | PR_FindSymbol(softokenLib, "NSC_ModuleDBFunc"); | |||
| 443 | #endif | |||
| 444 | } | |||
| 445 | ||||
| 446 | if (mod->moduleDBOnly) { | |||
| 447 | mod->loaded = PR_TRUE1; | |||
| 448 | return SECSuccess; | |||
| 449 | } | |||
| 450 | } else { | |||
| 451 | /* Not internal, load the DLL and look up C_GetFunctionList */ | |||
| 452 | if (mod->dllName == NULL((void*)0)) { | |||
| 453 | return SECFailure; | |||
| 454 | } | |||
| 455 | ||||
| 456 | /* load the library. If this succeeds, then we have to remember to | |||
| 457 | * unload the library if anything goes wrong from here on out... | |||
| 458 | */ | |||
| 459 | #if defined(_WIN32) | |||
| 460 | if (nssUTF8_Length(mod->dllName, NULL((void*)0))) { | |||
| 461 | wchar_t *dllNameWide = _NSSUTIL_UTF8ToWide(mod->dllName); | |||
| 462 | if (dllNameWide) { | |||
| 463 | PRLibSpec libSpec; | |||
| 464 | libSpec.type = PR_LibSpec_PathnameU; | |||
| 465 | libSpec.value.pathname_u = dllNameWide; | |||
| 466 | library = PR_LoadLibraryWithFlags(libSpec, 0); | |||
| 467 | PORT_FreePORT_Free_Util(dllNameWide); | |||
| 468 | } | |||
| 469 | } | |||
| 470 | if (library == NULL((void*)0)) { | |||
| 471 | // fallback to system code page | |||
| 472 | library = PR_LoadLibrary(mod->dllName); | |||
| 473 | } | |||
| 474 | #else | |||
| 475 | library = PR_LoadLibrary(mod->dllName); | |||
| 476 | #endif // defined(_WIN32) | |||
| 477 | mod->library = (void *)library; | |||
| 478 | ||||
| 479 | if (library == NULL((void*)0)) { | |||
| 480 | return SECFailure; | |||
| 481 | } | |||
| 482 | ||||
| 483 | /* | |||
| 484 | * now we need to get the entry point to find the function pointers | |||
| 485 | */ | |||
| 486 | if (!mod->moduleDBOnly) { | |||
| 487 | ientry = (CK_C_GetInterface) | |||
| 488 | PR_FindSymbol(library, "C_GetInterface"); | |||
| 489 | if (!ientry) { | |||
| 490 | fentry = (CK_C_GetFunctionList) | |||
| 491 | PR_FindSymbol(library, "C_GetFunctionList"); | |||
| 492 | } | |||
| 493 | } | |||
| 494 | if (mod->isModuleDB) { | |||
| 495 | mod->moduleDBFunc = (void *) | |||
| 496 | PR_FindSymbol(library, "NSS_ReturnModuleSpecData"); | |||
| 497 | } | |||
| 498 | if (mod->moduleDBFunc == NULL((void*)0)) | |||
| 499 | mod->isModuleDB = PR_FALSE0; | |||
| 500 | if ((ientry == NULL((void*)0)) && (fentry == NULL((void*)0))) { | |||
| 501 | if (mod->isModuleDB) { | |||
| 502 | mod->loaded = PR_TRUE1; | |||
| 503 | mod->moduleDBOnly = PR_TRUE1; | |||
| 504 | return SECSuccess; | |||
| 505 | } | |||
| 506 | PR_UnloadLibrary(library); | |||
| 507 | return SECFailure; | |||
| 508 | } | |||
| 509 | } | |||
| 510 | ||||
| 511 | /* | |||
| 512 | * We need to get the function list | |||
| 513 | */ | |||
| 514 | if (ientry) { | |||
| 515 | /* we first try to get a FORK_SAFE interface */ | |||
| 516 | if ((*ientry)((CK_UTF8CHAR_PTR) "PKCS 11", NULL((void*)0), &interface, | |||
| 517 | CKF_INTERFACE_FORK_SAFE0x00000001UL) != CKR_OK0x00000000UL) { | |||
| 518 | /* one is not appearantly available, get a non-fork safe version */ | |||
| 519 | if ((*ientry)((CK_UTF8CHAR_PTR) "PKCS 11", NULL((void*)0), &interface, 0) != CKR_OK0x00000000UL) { | |||
| 520 | goto fail; | |||
| 521 | } | |||
| 522 | } | |||
| 523 | mod->functionList = interface->pFunctionList; | |||
| 524 | mod->flags = interface->flags; | |||
| 525 | /* if we have a fips indicator, grab it */ | |||
| 526 | if ((*ientry)((CK_UTF8CHAR_PTR) "Vendor NSS FIPS Interface", NULL((void*)0), | |||
| 527 | &interface, 0) == CKR_OK0x00000000UL) { | |||
| 528 | mod->fipsIndicator = ((CK_NSS_FIPS_FUNCTIONS *)(interface->pFunctionList))->NSC_NSSGetFIPSStatus; | |||
| 529 | } | |||
| 530 | } else { | |||
| 531 | if ((*fentry)((CK_FUNCTION_LIST_PTR *)&mod->functionList) != CKR_OK0x00000000UL) | |||
| 532 | goto fail; | |||
| 533 | mod->flags = 0; | |||
| 534 | } | |||
| 535 | ||||
| 536 | #ifdef DEBUG_MODULE1 | |||
| 537 | modToDBG = PR_GetEnvSecure("NSS_DEBUG_PKCS11_MODULE"); | |||
| 538 | if (modToDBG && strcmp(mod->commonName, modToDBG) == 0) { | |||
| 539 | mod->functionList = (void *)nss_InsertDeviceLog( | |||
| 540 | (CK_FUNCTION_LIST_3_0_PTR)mod->functionList); | |||
| 541 | } | |||
| 542 | #endif | |||
| 543 | ||||
| 544 | return SECSuccess; | |||
| 545 | ||||
| 546 | fail: | |||
| 547 | mod->functionList = NULL((void*)0); | |||
| 548 | disableUnload = PR_GetEnvSecure("NSS_DISABLE_UNLOAD"); | |||
| 549 | if (library && !disableUnload) { | |||
| 550 | PR_UnloadLibrary(library); | |||
| 551 | } | |||
| 552 | return SECFailure; | |||
| 553 | } | |||
| 554 | ||||
| 555 | SECStatus | |||
| 556 | secmod_InitializeModuleAndGetSlotInfo(SECMODModule *mod, SECMODModule **oldModule) | |||
| 557 | { | |||
| 558 | CK_INFO info; | |||
| 559 | CK_ULONG slotCount = 0; | |||
| 560 | SECStatus rv; | |||
| 561 | PRBool alreadyLoaded = PR_FALSE0; | |||
| 562 | ||||
| 563 | /* This test operation makes sure our locking system is | |||
| 564 | * consistent even if we are using non-thread safe tokens by | |||
| 565 | * simulating unsafe tokens with safe ones. */ | |||
| 566 | mod->isThreadSafe = !PR_GetEnvSecure("NSS_FORCE_TOKEN_LOCK"); | |||
| 567 | ||||
| 568 | /* Now we initialize the module */ | |||
| 569 | rv = secmod_ModuleInit(mod, oldModule, &alreadyLoaded); | |||
| 570 | if (rv != SECSuccess) { | |||
| 571 | goto fail; | |||
| 572 | } | |||
| 573 | ||||
| 574 | /* module has been reloaded, this module itself is done, | |||
| 575 | * return to the caller */ | |||
| 576 | if (mod->functionList == NULL((void*)0)) { | |||
| 577 | mod->loaded = PR_TRUE1; /* technically the module is loaded.. */ | |||
| 578 | return SECSuccess; | |||
| 579 | } | |||
| 580 | ||||
| 581 | /* check the version number */ | |||
| 582 | if (PK11_GETTAB(mod)((CK_FUNCTION_LIST_3_0_PTR)((mod)->functionList))->C_GetInfo(&info) != CKR_OK0x00000000UL) | |||
| 583 | goto fail2; | |||
| 584 | if (info.cryptokiVersion.major < 2) | |||
| 585 | goto fail2; | |||
| 586 | /* all 2.0 are a priori *not* thread safe */ | |||
| 587 | if ((info.cryptokiVersion.major == 2) && (info.cryptokiVersion.minor < 1)) { | |||
| 588 | if (!loadSingleThreadedModules) { | |||
| 589 | PORT_SetErrorPORT_SetError_Util(SEC_ERROR_INCOMPATIBLE_PKCS11); | |||
| 590 | goto fail2; | |||
| 591 | } else { | |||
| 592 | mod->isThreadSafe = PR_FALSE0; | |||
| 593 | } | |||
| 594 | } | |||
| 595 | mod->cryptokiVersion = info.cryptokiVersion; | |||
| 596 | ||||
| 597 | /* If we don't have a common name, get it from the PKCS 11 module */ | |||
| 598 | if ((mod->commonName == NULL((void*)0)) || (mod->commonName[0] == 0)) { | |||
| 599 | mod->commonName = PK11_MakeString(mod->arena, NULL((void*)0), | |||
| 600 | (char *)info.libraryDescription, sizeof(info.libraryDescription)); | |||
| 601 | if (mod->commonName == NULL((void*)0)) | |||
| 602 | goto fail2; | |||
| 603 | } | |||
| 604 | ||||
| 605 | /* initialize the Slots */ | |||
| 606 | if (PK11_GETTAB(mod)((CK_FUNCTION_LIST_3_0_PTR)((mod)->functionList))->C_GetSlotList(CK_FALSE0, NULL((void*)0), &slotCount) == CKR_OK0x00000000UL) { | |||
| 607 | CK_SLOT_ID *slotIDs; | |||
| 608 | int i; | |||
| 609 | CK_RV crv; | |||
| 610 | ||||
| 611 | mod->slots = (PK11SlotInfo **)PORT_ArenaAllocPORT_ArenaAlloc_Util(mod->arena, | |||
| 612 | sizeof(PK11SlotInfo *) * slotCount); | |||
| 613 | if (mod->slots == NULL((void*)0)) | |||
| 614 | goto fail2; | |||
| 615 | ||||
| 616 | slotIDs = (CK_SLOT_ID *)PORT_AllocPORT_Alloc_Util(sizeof(CK_SLOT_ID) * slotCount); | |||
| 617 | if (slotIDs == NULL((void*)0)) { | |||
| 618 | goto fail2; | |||
| 619 | } | |||
| 620 | crv = PK11_GETTAB(mod)((CK_FUNCTION_LIST_3_0_PTR)((mod)->functionList))->C_GetSlotList(CK_FALSE0, slotIDs, &slotCount); | |||
| 621 | if (crv != CKR_OK0x00000000UL) { | |||
| 622 | PORT_FreePORT_Free_Util(slotIDs); | |||
| 623 | goto fail2; | |||
| 624 | } | |||
| 625 | ||||
| 626 | /* Initialize each slot */ | |||
| 627 | for (i = 0; i < (int)slotCount; i++) { | |||
| 628 | mod->slots[i] = PK11_NewSlotInfo(mod); | |||
| 629 | PK11_InitSlot(mod, slotIDs[i], mod->slots[i]); | |||
| 630 | /* look down the slot info table */ | |||
| 631 | PK11_LoadSlotList(mod->slots[i], mod->slotInfo, mod->slotInfoCount); | |||
| 632 | SECMOD_SetRootCerts(mod->slots[i], mod); | |||
| 633 | /* explicitly mark the internal slot as such if IsInternalKeySlot() | |||
| 634 | * is set */ | |||
| 635 | if (secmod_IsInternalKeySlot(mod) && (i == (mod->isFIPS ? 0 : 1))) { | |||
| 636 | pk11_SetInternalKeySlotIfFirst(mod->slots[i]); | |||
| 637 | } | |||
| 638 | } | |||
| 639 | mod->slotCount = slotCount; | |||
| 640 | mod->slotInfoCount = 0; | |||
| 641 | PORT_FreePORT_Free_Util(slotIDs); | |||
| 642 | } | |||
| 643 | ||||
| 644 | mod->loaded = PR_TRUE1; | |||
| 645 | mod->moduleID = nextModuleID++; | |||
| 646 | return SECSuccess; | |||
| 647 | fail2: | |||
| 648 | if (enforceAlreadyInitializedError || (!alreadyLoaded)) { | |||
| 649 | PK11_GETTAB(mod)((CK_FUNCTION_LIST_3_0_PTR)((mod)->functionList))->C_Finalize(NULL((void*)0)); | |||
| 650 | } | |||
| 651 | fail: | |||
| 652 | mod->functionList = NULL((void*)0); | |||
| 653 | return SECFailure; | |||
| 654 | } | |||
| 655 | ||||
| 656 | /* | |||
| 657 | * load a new module into our address space and initialize it. | |||
| 658 | */ | |||
| 659 | SECStatus | |||
| 660 | secmod_LoadPKCS11Module(SECMODModule *mod, SECMODModule **oldModule) | |||
| 661 | { | |||
| 662 | SECStatus rv = SECFailure; | |||
| 663 | if (mod->loaded) { | |||
| 664 | return SECSuccess; | |||
| 665 | } | |||
| 666 | ||||
| 667 | mod->fipsIndicator = NULL((void*)0); | |||
| 668 | ||||
| 669 | rv = secmod_DetermineModuleFunctionList(mod); | |||
| 670 | if (rv != SECSuccess) { // The error code is set up by secmod_DetermineModuleFunctionList. | |||
| 671 | return rv; | |||
| 672 | } | |||
| 673 | ||||
| 674 | if (mod->loaded == PR_TRUE1) { | |||
| 675 | return SECSuccess; | |||
| 676 | } | |||
| 677 | ||||
| 678 | rv = secmod_InitializeModuleAndGetSlotInfo(mod, oldModule); | |||
| 679 | if (rv != SECSuccess) { // The error code is set up by secmod_InitializeModuleAndGetSlotInfo | |||
| 680 | return rv; | |||
| 681 | } | |||
| 682 | ||||
| 683 | return SECSuccess; | |||
| 684 | } | |||
| 685 | ||||
| 686 | /* | |||
| 687 | * load a new module using provided fentry function | |||
| 688 | */ | |||
| 689 | SECStatus | |||
| 690 | secmod_LoadPKCS11ModuleFromFunction(SECMODModule *mod, SECMODModule **oldModule, | |||
| 691 | CK_C_GetFunctionList fentry) | |||
| 692 | { | |||
| 693 | SECStatus rv = SECFailure; | |||
| 694 | CK_RV crv; | |||
| 695 | if (mod->loaded) { | |||
| 696 | return SECSuccess; | |||
| 697 | } | |||
| 698 | ||||
| 699 | mod->fipsIndicator = NULL((void*)0); | |||
| 700 | ||||
| 701 | if (!fentry) { | |||
| 702 | PORT_SetErrorPORT_SetError_Util(SEC_ERROR_INVALID_ARGS); | |||
| 703 | return SECFailure; | |||
| 704 | } | |||
| 705 | ||||
| 706 | crv = fentry((CK_FUNCTION_LIST_PTR *)&mod->functionList); | |||
| 707 | if (crv != CKR_OK0x00000000UL) { | |||
| 708 | mod->functionList = NULL((void*)0); | |||
| 709 | PORT_SetErrorPORT_SetError_Util(PK11_MapError(crv)); | |||
| 710 | return SECFailure; | |||
| 711 | } | |||
| 712 | ||||
| 713 | if (mod->functionList == NULL((void*)0)) { | |||
| 714 | PORT_SetErrorPORT_SetError_Util(SEC_ERROR_LIBRARY_FAILURE); | |||
| 715 | return SECFailure; | |||
| 716 | } | |||
| 717 | ||||
| 718 | mod->flags = 0; | |||
| 719 | rv = secmod_InitializeModuleAndGetSlotInfo(mod, oldModule); | |||
| 720 | if (rv != SECSuccess) { | |||
| 721 | return rv; | |||
| 722 | } | |||
| 723 | ||||
| 724 | return SECSuccess; | |||
| 725 | } | |||
| 726 | ||||
| 727 | SECStatus | |||
| 728 | SECMOD_UnloadModule(SECMODModule *mod) | |||
| 729 | { | |||
| 730 | PRLibrary *library; | |||
| 731 | char *disableUnload = NULL((void*)0); | |||
| 732 | ||||
| 733 | if (!mod->loaded) { | |||
| 734 | return SECFailure; | |||
| 735 | } | |||
| 736 | if (finalizeModules) { | |||
| 737 | if (mod->functionList && !mod->moduleDBOnly) { | |||
| 738 | PK11_GETTAB(mod)((CK_FUNCTION_LIST_3_0_PTR)((mod)->functionList))->C_Finalize(NULL((void*)0)); | |||
| 739 | } | |||
| 740 | } | |||
| 741 | mod->moduleID = 0; | |||
| 742 | mod->loaded = PR_FALSE0; | |||
| 743 | ||||
| 744 | /* do we want the semantics to allow unloading the internal library? | |||
| 745 | * if not, we should change this to SECFailure and move it above the | |||
| 746 | * mod->loaded = PR_FALSE; */ | |||
| 747 | if (mod->internal && (mod->dllName == NULL((void*)0))) { | |||
| 748 | #ifndef NSS_STATIC_SOFTOKEN | |||
| 749 | if (0 == PR_ATOMIC_DECREMENT(&softokenLoadCount)__sync_sub_and_fetch(&softokenLoadCount, 1)) { | |||
| 750 | if (softokenLib) { | |||
| 751 | disableUnload = PR_GetEnvSecure("NSS_DISABLE_UNLOAD"); | |||
| 752 | if (!disableUnload) { | |||
| 753 | #ifdef DEBUG1 | |||
| 754 | PRStatus status = PR_UnloadLibrary(softokenLib); | |||
| 755 | PORT_Assert(PR_SUCCESS == status)((PR_SUCCESS == status)?((void)0):PR_Assert("PR_SUCCESS == status" ,"/root/firefox-clang/security/nss/lib/pk11wrap/pk11load.c",755 )); | |||
| 756 | #else | |||
| 757 | PR_UnloadLibrary(softokenLib); | |||
| 758 | #endif | |||
| 759 | } | |||
| 760 | softokenLib = NULL((void*)0); | |||
| 761 | } | |||
| 762 | loadSoftokenOnce = pristineCallOnce; | |||
| 763 | } | |||
| 764 | #endif | |||
| 765 | return SECSuccess; | |||
| 766 | } | |||
| 767 | ||||
| 768 | library = (PRLibrary *)mod->library; | |||
| 769 | /* if no library, then we should not unload it */ | |||
| 770 | if (library == NULL((void*)0)) { | |||
| 771 | return SECSuccess; | |||
| 772 | } | |||
| 773 | ||||
| 774 | disableUnload = PR_GetEnvSecure("NSS_DISABLE_UNLOAD"); | |||
| 775 | if (!disableUnload) { | |||
| 776 | PR_UnloadLibrary(library); | |||
| 777 | } | |||
| 778 | return SECSuccess; | |||
| 779 | } | |||
| 780 | ||||
| 781 | void | |||
| 782 | nss_DumpModuleLog(void) | |||
| 783 | { | |||
| 784 | #ifdef DEBUG_MODULE1 | |||
| 785 | if (modToDBG) { | |||
| ||||
| 786 | print_final_statistics(); | |||
| 787 | } | |||
| 788 | #endif | |||
| 789 | } |
| 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 | #include "prlog.h" | ||||
| 5 | #include <stdio.h> | ||||
| 6 | #include "cert.h" /* for CERT_DerNameToAscii & CERT_Hexify */ | ||||
| 7 | |||||
| 8 | static PRLogModuleInfo *modlog = NULL((void*)0); | ||||
| 9 | |||||
| 10 | static CK_FUNCTION_LIST_3_0_PTR module_functions; | ||||
| 11 | |||||
| 12 | static CK_FUNCTION_LIST_3_0 debug_functions; | ||||
| 13 | |||||
| 14 | static void print_final_statistics(void); | ||||
| 15 | |||||
| 16 | #define STRINGstatic const char static const char | ||||
| 17 | STRINGstatic const char fmt_flags[] = " flags = 0x%x"; | ||||
| 18 | STRINGstatic const char fmt_hKey[] = " hKey = 0x%x"; | ||||
| 19 | STRINGstatic const char fmt_hObject[] = " hObject = 0x%x"; | ||||
| 20 | STRINGstatic const char fmt_hSession[] = " hSession = 0x%x"; | ||||
| 21 | STRINGstatic const char fmt_manufacturerID[] = " manufacturerID = \"%.32s\""; | ||||
| 22 | STRINGstatic const char fmt_pAssociatedData[] = " pAssociatedData = 0x%p"; | ||||
| 23 | STRINGstatic const char fmt_pCiphertext[] = " pCiphertext = 0x%p"; | ||||
| 24 | STRINGstatic const char fmt_pCiphertextPart[] = " pCiphertextPart = 0x%p"; | ||||
| 25 | STRINGstatic const char fmt_pData[] = " pData = 0x%p"; | ||||
| 26 | STRINGstatic const char fmt_pDigest[] = " pDigest = 0x%p"; | ||||
| 27 | STRINGstatic const char fmt_pEncryptedData[] = " pEncryptedData = 0x%p"; | ||||
| 28 | STRINGstatic const char fmt_pEncryptedPart[] = " pEncryptedPart = 0x%p"; | ||||
| 29 | STRINGstatic const char fmt_pInfo[] = " pInfo = 0x%p"; | ||||
| 30 | STRINGstatic const char fmt_pMechanism[] = " pMechanism = 0x%p"; | ||||
| 31 | STRINGstatic const char fmt_pOperationState[] = " pOperationState = 0x%p"; | ||||
| 32 | STRINGstatic const char fmt_pParameter[] = " pParameter = 0x%p"; | ||||
| 33 | STRINGstatic const char fmt_pPart[] = " pPart = 0x%p"; | ||||
| 34 | STRINGstatic const char fmt_pPlaintext[] = " pPlaintext = 0x%p"; | ||||
| 35 | STRINGstatic const char fmt_pPlaintextPart[] = " pPlaintextPart = 0x%p"; | ||||
| 36 | STRINGstatic const char fmt_pPin[] = " pPin = 0x%p"; | ||||
| 37 | STRINGstatic const char fmt_pSignature[] = " pSignature = 0x%p"; | ||||
| 38 | STRINGstatic const char fmt_pTemplate[] = " pTemplate = 0x%p"; | ||||
| 39 | STRINGstatic const char fmt_pWrappedKey[] = " pWrappedKey = 0x%p"; | ||||
| 40 | STRINGstatic const char fmt_phKey[] = " phKey = 0x%p"; | ||||
| 41 | STRINGstatic const char fmt_phObject[] = " phObject = 0x%p"; | ||||
| 42 | STRINGstatic const char fmt_pulCount[] = " pulCount = 0x%p"; | ||||
| 43 | STRINGstatic const char fmt_pulCiphertextLen[] = " pulCiphertextLen = 0x%p"; | ||||
| 44 | STRINGstatic const char fmt_pulCiphertextPartLen[] = " pulCiphertextPartLen = 0x%p"; | ||||
| 45 | STRINGstatic const char fmt_pulDataLen[] = " pulDataLen = 0x%p"; | ||||
| 46 | STRINGstatic const char fmt_pulDigestLen[] = " pulDigestLen = 0x%p"; | ||||
| 47 | STRINGstatic const char fmt_pulEncryptedPartLen[] = " pulEncryptedPartLen = 0x%p"; | ||||
| 48 | STRINGstatic const char fmt_pulPartLen[] = " pulPartLen = 0x%p"; | ||||
| 49 | STRINGstatic const char fmt_pulPlaintextLen[] = " pulPlaintextLen = 0x%p"; | ||||
| 50 | STRINGstatic const char fmt_pulPlaintextPartLen[] = " pulPlaintextPartLen = 0x%p"; | ||||
| 51 | STRINGstatic const char fmt_pulSignatureLen[] = " pulSignatureLen = 0x%p"; | ||||
| 52 | STRINGstatic const char fmt_slotID[] = " slotID = 0x%x"; | ||||
| 53 | STRINGstatic const char fmt_sphKey[] = " *phKey = 0x%x"; | ||||
| 54 | STRINGstatic const char fmt_spulCount[] = " *pulCount = 0x%x"; | ||||
| 55 | STRINGstatic const char fmt_spulDataLen[] = " *pulDataLen = 0x%x"; | ||||
| 56 | STRINGstatic const char fmt_spulDigestLen[] = " *pulDigestLen = 0x%x"; | ||||
| 57 | STRINGstatic const char fmt_spulEncryptedPartLen[] = " *pulEncryptedPartLen = 0x%x"; | ||||
| 58 | STRINGstatic const char fmt_spulPartLen[] = " *pulPartLen = 0x%x"; | ||||
| 59 | STRINGstatic const char fmt_spulSignatureLen[] = " *pulSignatureLen = 0x%x"; | ||||
| 60 | STRINGstatic const char fmt_ulAttributeCount[] = " ulAttributeCount = %d"; | ||||
| 61 | STRINGstatic const char fmt_ulCiphertextLen[] = " ulCiphertextLen = %d"; | ||||
| 62 | STRINGstatic const char fmt_ulCiphertextPartLen[] = " ulCiphertextPartLen = %d"; | ||||
| 63 | STRINGstatic const char fmt_ulCount[] = " ulCount = %d"; | ||||
| 64 | STRINGstatic const char fmt_ulDataLen[] = " ulDataLen = %d"; | ||||
| 65 | STRINGstatic const char fmt_ulEncryptedPartLen[] = " ulEncryptedPartLen = %d"; | ||||
| 66 | STRINGstatic const char fmt_ulAssociatedDataLen[] = " ulAssociatedDataLen = 0x%p"; | ||||
| 67 | STRINGstatic const char fmt_ulParameterLen[] = " ulParameterLen = 0x%p"; | ||||
| 68 | STRINGstatic const char fmt_ulPartLen[] = " ulPartLen = %d"; | ||||
| 69 | STRINGstatic const char fmt_ulPlaintextLen[] = " ulPlaintextLen = 0x%p"; | ||||
| 70 | STRINGstatic const char fmt_ulPlaintextPartLen[] = " ulPlaintextPartLen = 0x%p"; | ||||
| 71 | STRINGstatic const char fmt_ulPinLen[] = " ulPinLen = %d"; | ||||
| 72 | STRINGstatic const char fmt_ulSignatureLen[] = " ulSignatureLen = %d"; | ||||
| 73 | |||||
| 74 | STRINGstatic const char fmt_fwVersion[] = " firmware version: %d.%d"; | ||||
| 75 | STRINGstatic const char fmt_hwVersion[] = " hardware version: %d.%d"; | ||||
| 76 | STRINGstatic const char fmt_s_qsq_d[] = " %s = \"%s\" [%d]"; | ||||
| 77 | STRINGstatic const char fmt_s_s_d[] = " %s = %s [%d]"; | ||||
| 78 | STRINGstatic const char fmt_s_lu[] = " %s = %lu"; | ||||
| 79 | STRINGstatic const char fmt_invalid_handle[] = " (CK_INVALID_HANDLE)"; | ||||
| 80 | |||||
| 81 | static void | ||||
| 82 | get_attr_type_str(CK_ATTRIBUTE_TYPE atype, char *str, int len) | ||||
| 83 | { | ||||
| 84 | #define CASE(attr)case attr: a = "attr"; break \ | ||||
| 85 | case attr: \ | ||||
| 86 | a = #attr; \ | ||||
| 87 | break | ||||
| 88 | |||||
| 89 | const char *a = NULL((void*)0); | ||||
| 90 | |||||
| 91 | switch (atype) { | ||||
| 92 | CASE(CKA_CLASS)case 0x00000000UL: a = "CKA_CLASS"; break; | ||||
| 93 | CASE(CKA_TOKEN)case 0x00000001UL: a = "CKA_TOKEN"; break; | ||||
| 94 | CASE(CKA_PRIVATE)case 0x00000002UL: a = "CKA_PRIVATE"; break; | ||||
| 95 | CASE(CKA_LABEL)case 0x00000003UL: a = "CKA_LABEL"; break; | ||||
| 96 | CASE(CKA_APPLICATION)case 0x00000010UL: a = "CKA_APPLICATION"; break; | ||||
| 97 | CASE(CKA_VALUE)case 0x00000011UL: a = "CKA_VALUE"; break; | ||||
| 98 | CASE(CKA_OBJECT_ID)case 0x00000012UL: a = "CKA_OBJECT_ID"; break; | ||||
| 99 | CASE(CKA_CERTIFICATE_TYPE)case 0x00000080UL: a = "CKA_CERTIFICATE_TYPE"; break; | ||||
| 100 | CASE(CKA_CERTIFICATE_CATEGORY)case 0x00000087UL: a = "CKA_CERTIFICATE_CATEGORY"; break; | ||||
| 101 | CASE(CKA_ISSUER)case 0x00000081UL: a = "CKA_ISSUER"; break; | ||||
| 102 | CASE(CKA_SERIAL_NUMBER)case 0x00000082UL: a = "CKA_SERIAL_NUMBER"; break; | ||||
| 103 | CASE(CKA_AC_ISSUER)case 0x00000083UL: a = "CKA_AC_ISSUER"; break; | ||||
| 104 | CASE(CKA_OWNER)case 0x00000084UL: a = "CKA_OWNER"; break; | ||||
| 105 | CASE(CKA_ATTR_TYPES)case 0x00000085UL: a = "CKA_ATTR_TYPES"; break; | ||||
| 106 | CASE(CKA_TRUSTED)case 0x00000086UL: a = "CKA_TRUSTED"; break; | ||||
| 107 | CASE(CKA_KEY_TYPE)case 0x00000100UL: a = "CKA_KEY_TYPE"; break; | ||||
| 108 | CASE(CKA_SUBJECT)case 0x00000101UL: a = "CKA_SUBJECT"; break; | ||||
| 109 | CASE(CKA_ID)case 0x00000102UL: a = "CKA_ID"; break; | ||||
| 110 | CASE(CKA_SENSITIVE)case 0x00000103UL: a = "CKA_SENSITIVE"; break; | ||||
| 111 | CASE(CKA_ENCRYPT)case 0x00000104UL: a = "CKA_ENCRYPT"; break; | ||||
| 112 | CASE(CKA_DECRYPT)case 0x00000105UL: a = "CKA_DECRYPT"; break; | ||||
| 113 | CASE(CKA_WRAP)case 0x00000106UL: a = "CKA_WRAP"; break; | ||||
| 114 | CASE(CKA_UNWRAP)case 0x00000107UL: a = "CKA_UNWRAP"; break; | ||||
| 115 | CASE(CKA_SIGN)case 0x00000108UL: a = "CKA_SIGN"; break; | ||||
| 116 | CASE(CKA_SIGN_RECOVER)case 0x00000109UL: a = "CKA_SIGN_RECOVER"; break; | ||||
| 117 | CASE(CKA_VERIFY)case 0x0000010AUL: a = "CKA_VERIFY"; break; | ||||
| 118 | CASE(CKA_VERIFY_RECOVER)case 0x0000010BUL: a = "CKA_VERIFY_RECOVER"; break; | ||||
| 119 | CASE(CKA_DERIVE)case 0x0000010CUL: a = "CKA_DERIVE"; break; | ||||
| 120 | CASE(CKA_START_DATE)case 0x00000110UL: a = "CKA_START_DATE"; break; | ||||
| 121 | CASE(CKA_END_DATE)case 0x00000111UL: a = "CKA_END_DATE"; break; | ||||
| 122 | CASE(CKA_MODULUS)case 0x00000120UL: a = "CKA_MODULUS"; break; | ||||
| 123 | CASE(CKA_MODULUS_BITS)case 0x00000121UL: a = "CKA_MODULUS_BITS"; break; | ||||
| 124 | CASE(CKA_PUBLIC_EXPONENT)case 0x00000122UL: a = "CKA_PUBLIC_EXPONENT"; break; | ||||
| 125 | CASE(CKA_PRIVATE_EXPONENT)case 0x00000123UL: a = "CKA_PRIVATE_EXPONENT"; break; | ||||
| 126 | CASE(CKA_PRIME_1)case 0x00000124UL: a = "CKA_PRIME_1"; break; | ||||
| 127 | CASE(CKA_PRIME_2)case 0x00000125UL: a = "CKA_PRIME_2"; break; | ||||
| 128 | CASE(CKA_EXPONENT_1)case 0x00000126UL: a = "CKA_EXPONENT_1"; break; | ||||
| 129 | CASE(CKA_EXPONENT_2)case 0x00000127UL: a = "CKA_EXPONENT_2"; break; | ||||
| 130 | CASE(CKA_COEFFICIENT)case 0x00000128UL: a = "CKA_COEFFICIENT"; break; | ||||
| 131 | CASE(CKA_PRIME)case 0x00000130UL: a = "CKA_PRIME"; break; | ||||
| 132 | CASE(CKA_SUBPRIME)case 0x00000131UL: a = "CKA_SUBPRIME"; break; | ||||
| 133 | CASE(CKA_BASE)case 0x00000132UL: a = "CKA_BASE"; break; | ||||
| 134 | CASE(CKA_PRIME_BITS)case 0x00000133UL: a = "CKA_PRIME_BITS"; break; | ||||
| 135 | CASE(CKA_SUBPRIME_BITS)case 0x00000134UL: a = "CKA_SUBPRIME_BITS"; break; | ||||
| 136 | CASE(CKA_VALUE_BITS)case 0x00000160UL: a = "CKA_VALUE_BITS"; break; | ||||
| 137 | CASE(CKA_VALUE_LEN)case 0x00000161UL: a = "CKA_VALUE_LEN"; break; | ||||
| 138 | CASE(CKA_EXTRACTABLE)case 0x00000162UL: a = "CKA_EXTRACTABLE"; break; | ||||
| 139 | CASE(CKA_LOCAL)case 0x00000163UL: a = "CKA_LOCAL"; break; | ||||
| 140 | CASE(CKA_NEVER_EXTRACTABLE)case 0x00000164UL: a = "CKA_NEVER_EXTRACTABLE"; break; | ||||
| 141 | CASE(CKA_ALWAYS_SENSITIVE)case 0x00000165UL: a = "CKA_ALWAYS_SENSITIVE"; break; | ||||
| 142 | CASE(CKA_KEY_GEN_MECHANISM)case 0x00000166UL: a = "CKA_KEY_GEN_MECHANISM"; break; | ||||
| 143 | CASE(CKA_MODIFIABLE)case 0x00000170UL: a = "CKA_MODIFIABLE"; break; | ||||
| 144 | CASE(CKA_ECDSA_PARAMS)case 0x00000180UL: a = "CKA_ECDSA_PARAMS"; break; | ||||
| 145 | CASE(CKA_EC_POINT)case 0x00000181UL: a = "CKA_EC_POINT"; break; | ||||
| 146 | CASE(CKA_SECONDARY_AUTH)case 0x00000200UL: a = "CKA_SECONDARY_AUTH"; break; | ||||
| 147 | CASE(CKA_AUTH_PIN_FLAGS)case 0x00000201UL: a = "CKA_AUTH_PIN_FLAGS"; break; | ||||
| 148 | CASE(CKA_HW_FEATURE_TYPE)case 0x00000300UL: a = "CKA_HW_FEATURE_TYPE"; break; | ||||
| 149 | CASE(CKA_RESET_ON_INIT)case 0x00000301UL: a = "CKA_RESET_ON_INIT"; break; | ||||
| 150 | CASE(CKA_HAS_RESET)case 0x00000302UL: a = "CKA_HAS_RESET"; break; | ||||
| 151 | CASE(CKA_VENDOR_DEFINED)case 0x80000000UL: a = "CKA_VENDOR_DEFINED"; break; | ||||
| 152 | CASE(CKA_PROFILE_ID)case 0x00000601UL: a = "CKA_PROFILE_ID"; break; | ||||
| 153 | CASE(CKA_NSS_URL)case ((0x80000000UL | 0x4E534350) + 1): a = "CKA_NSS_URL"; break; | ||||
| 154 | CASE(CKA_NSS_EMAIL)case ((0x80000000UL | 0x4E534350) + 2): a = "CKA_NSS_EMAIL"; break; | ||||
| 155 | CASE(CKA_NSS_SMIME_INFO)case ((0x80000000UL | 0x4E534350) + 3): a = "CKA_NSS_SMIME_INFO" ; break; | ||||
| 156 | CASE(CKA_NSS_SMIME_TIMESTAMP)case ((0x80000000UL | 0x4E534350) + 4): a = "CKA_NSS_SMIME_TIMESTAMP" ; break; | ||||
| 157 | CASE(CKA_NSS_PKCS8_SALT)case ((0x80000000UL | 0x4E534350) + 5): a = "CKA_NSS_PKCS8_SALT" ; break; | ||||
| 158 | CASE(CKA_NSS_PASSWORD_CHECK)case ((0x80000000UL | 0x4E534350) + 6): a = "CKA_NSS_PASSWORD_CHECK" ; break; | ||||
| 159 | CASE(CKA_NSS_EXPIRES)case ((0x80000000UL | 0x4E534350) + 7): a = "CKA_NSS_EXPIRES" ; break; | ||||
| 160 | CASE(CKA_NSS_KRL)case ((0x80000000UL | 0x4E534350) + 8): a = "CKA_NSS_KRL"; break; | ||||
| 161 | CASE(CKA_NSS_PQG_COUNTER)case ((0x80000000UL | 0x4E534350) + 20): a = "CKA_NSS_PQG_COUNTER" ; break; | ||||
| 162 | CASE(CKA_NSS_PQG_SEED)case ((0x80000000UL | 0x4E534350) + 21): a = "CKA_NSS_PQG_SEED" ; break; | ||||
| 163 | CASE(CKA_NSS_PQG_H)case ((0x80000000UL | 0x4E534350) + 22): a = "CKA_NSS_PQG_H"; break; | ||||
| 164 | CASE(CKA_NSS_PQG_SEED_BITS)case ((0x80000000UL | 0x4E534350) + 23): a = "CKA_NSS_PQG_SEED_BITS" ; break; | ||||
| 165 | CASE(CKA_TRUST)case ((0x80000000UL | 0x4E534350) + 0x2000): a = "CKA_TRUST"; break; | ||||
| 166 | CASE(CKA_TRUST_DIGITAL_SIGNATURE)case (((0x80000000UL | 0x4E534350) + 0x2000) + 1): a = "CKA_TRUST_DIGITAL_SIGNATURE" ; break; | ||||
| 167 | CASE(CKA_TRUST_NON_REPUDIATION)case (((0x80000000UL | 0x4E534350) + 0x2000) + 2): a = "CKA_TRUST_NON_REPUDIATION" ; break; | ||||
| 168 | CASE(CKA_TRUST_KEY_ENCIPHERMENT)case (((0x80000000UL | 0x4E534350) + 0x2000) + 3): a = "CKA_TRUST_KEY_ENCIPHERMENT" ; break; | ||||
| 169 | CASE(CKA_TRUST_DATA_ENCIPHERMENT)case (((0x80000000UL | 0x4E534350) + 0x2000) + 4): a = "CKA_TRUST_DATA_ENCIPHERMENT" ; break; | ||||
| 170 | CASE(CKA_TRUST_KEY_AGREEMENT)case (((0x80000000UL | 0x4E534350) + 0x2000) + 5): a = "CKA_TRUST_KEY_AGREEMENT" ; break; | ||||
| 171 | CASE(CKA_TRUST_KEY_CERT_SIGN)case (((0x80000000UL | 0x4E534350) + 0x2000) + 6): a = "CKA_TRUST_KEY_CERT_SIGN" ; break; | ||||
| 172 | CASE(CKA_TRUST_CRL_SIGN)case (((0x80000000UL | 0x4E534350) + 0x2000) + 7): a = "CKA_TRUST_CRL_SIGN" ; break; | ||||
| 173 | CASE(CKA_TRUST_SERVER_AUTH)case (((0x80000000UL | 0x4E534350) + 0x2000) + 8): a = "CKA_TRUST_SERVER_AUTH" ; break; | ||||
| 174 | CASE(CKA_TRUST_CLIENT_AUTH)case (((0x80000000UL | 0x4E534350) + 0x2000) + 9): a = "CKA_TRUST_CLIENT_AUTH" ; break; | ||||
| 175 | CASE(CKA_TRUST_CODE_SIGNING)case (((0x80000000UL | 0x4E534350) + 0x2000) + 10): a = "CKA_TRUST_CODE_SIGNING" ; break; | ||||
| 176 | CASE(CKA_TRUST_EMAIL_PROTECTION)case (((0x80000000UL | 0x4E534350) + 0x2000) + 11): a = "CKA_TRUST_EMAIL_PROTECTION" ; break; | ||||
| 177 | CASE(CKA_TRUST_IPSEC_END_SYSTEM)case (((0x80000000UL | 0x4E534350) + 0x2000) + 12): a = "CKA_TRUST_IPSEC_END_SYSTEM" ; break; | ||||
| 178 | CASE(CKA_TRUST_IPSEC_TUNNEL)case (((0x80000000UL | 0x4E534350) + 0x2000) + 13): a = "CKA_TRUST_IPSEC_TUNNEL" ; break; | ||||
| 179 | CASE(CKA_TRUST_IPSEC_USER)case (((0x80000000UL | 0x4E534350) + 0x2000) + 14): a = "CKA_TRUST_IPSEC_USER" ; break; | ||||
| 180 | CASE(CKA_TRUST_TIME_STAMPING)case (((0x80000000UL | 0x4E534350) + 0x2000) + 15): a = "CKA_TRUST_TIME_STAMPING" ; break; | ||||
| 181 | CASE(CKA_CERT_SHA1_HASH)case (((0x80000000UL | 0x4E534350) + 0x2000) + 100): a = "CKA_CERT_SHA1_HASH" ; break; | ||||
| 182 | CASE(CKA_CERT_MD5_HASH)case (((0x80000000UL | 0x4E534350) + 0x2000) + 101): a = "CKA_CERT_MD5_HASH" ; break; | ||||
| 183 | CASE(CKA_NSS_DB)case 0xD5A0DB00L: a = "CKA_NSS_DB"; break; | ||||
| 184 | CASE(CKA_NSS_TRUST)case 0x80000001L: a = "CKA_NSS_TRUST"; break; | ||||
| 185 | default: | ||||
| 186 | break; | ||||
| 187 | } | ||||
| 188 | if (a) | ||||
| 189 | PR_snprintf(str, len, "%s", a); | ||||
| 190 | else | ||||
| 191 | PR_snprintf(str, len, "0x%p", atype); | ||||
| 192 | } | ||||
| 193 | |||||
| 194 | static void | ||||
| 195 | get_obj_class(CK_OBJECT_CLASS objClass, char *str, int len) | ||||
| 196 | { | ||||
| 197 | |||||
| 198 | const char *a = NULL((void*)0); | ||||
| 199 | |||||
| 200 | switch (objClass) { | ||||
| 201 | CASE(CKO_DATA)case 0x00000000UL: a = "CKO_DATA"; break; | ||||
| 202 | CASE(CKO_CERTIFICATE)case 0x00000001UL: a = "CKO_CERTIFICATE"; break; | ||||
| 203 | CASE(CKO_PUBLIC_KEY)case 0x00000002UL: a = "CKO_PUBLIC_KEY"; break; | ||||
| 204 | CASE(CKO_PRIVATE_KEY)case 0x00000003UL: a = "CKO_PRIVATE_KEY"; break; | ||||
| 205 | CASE(CKO_SECRET_KEY)case 0x00000004UL: a = "CKO_SECRET_KEY"; break; | ||||
| 206 | CASE(CKO_HW_FEATURE)case 0x00000005UL: a = "CKO_HW_FEATURE"; break; | ||||
| 207 | CASE(CKO_DOMAIN_PARAMETERS)case 0x00000006UL: a = "CKO_DOMAIN_PARAMETERS"; break; | ||||
| 208 | CASE(CKO_PROFILE)case 0x00000009UL: a = "CKO_PROFILE"; break; | ||||
| 209 | CASE(CKO_NSS_CRL)case ((0x80000000UL | 0x4E534350) + 1): a = "CKO_NSS_CRL"; break; | ||||
| 210 | CASE(CKO_NSS_SMIME)case ((0x80000000UL | 0x4E534350) + 2): a = "CKO_NSS_SMIME"; break; | ||||
| 211 | CASE(CKO_NSS_TRUST)case ((0x80000000UL | 0x4E534350) + 3): a = "CKO_NSS_TRUST"; break; | ||||
| 212 | CASE(CKO_NSS_BUILTIN_ROOT_LIST)case ((0x80000000UL | 0x4E534350) + 4): a = "CKO_NSS_BUILTIN_ROOT_LIST" ; break; | ||||
| 213 | default: | ||||
| 214 | break; | ||||
| 215 | } | ||||
| 216 | if (a) | ||||
| 217 | PR_snprintf(str, len, "%s", a); | ||||
| 218 | else | ||||
| 219 | PR_snprintf(str, len, "0x%p", objClass); | ||||
| 220 | } | ||||
| 221 | |||||
| 222 | static void | ||||
| 223 | get_profile_val(CK_PROFILE_ID profile, char *str, int len) | ||||
| 224 | { | ||||
| 225 | |||||
| 226 | const char *a = NULL((void*)0); | ||||
| 227 | |||||
| 228 | switch (profile) { | ||||
| 229 | CASE(CKP_INVALID_ID)case 0x00000000UL: a = "CKP_INVALID_ID"; break; | ||||
| 230 | CASE(CKP_BASELINE_PROVIDER)case 0x00000001UL: a = "CKP_BASELINE_PROVIDER"; break; | ||||
| 231 | CASE(CKP_EXTENDED_PROVIDER)case 0x00000002UL: a = "CKP_EXTENDED_PROVIDER"; break; | ||||
| 232 | CASE(CKP_AUTHENTICATION_TOKEN)case 0x00000003UL: a = "CKP_AUTHENTICATION_TOKEN"; break; | ||||
| 233 | CASE(CKP_PUBLIC_CERTIFICATES_TOKEN)case 0x00000004UL: a = "CKP_PUBLIC_CERTIFICATES_TOKEN"; break; | ||||
| 234 | default: | ||||
| 235 | break; | ||||
| 236 | } | ||||
| 237 | if (a) | ||||
| 238 | PR_snprintf(str, len, "%s", a); | ||||
| 239 | else | ||||
| 240 | PR_snprintf(str, len, "0x%p", profile); | ||||
| 241 | } | ||||
| 242 | |||||
| 243 | static void | ||||
| 244 | get_trust_val(CK_TRUST trust, char *str, int len) | ||||
| 245 | { | ||||
| 246 | const char *a = NULL((void*)0); | ||||
| 247 | |||||
| 248 | switch (trust) { | ||||
| 249 | CASE(CKT_NSS_TRUSTED)case ((0x80000000 | 0x4E534350) + 1): a = "CKT_NSS_TRUSTED"; break; | ||||
| 250 | CASE(CKT_NSS_TRUSTED_DELEGATOR)case ((0x80000000 | 0x4E534350) + 2): a = "CKT_NSS_TRUSTED_DELEGATOR" ; break; | ||||
| 251 | CASE(CKT_NSS_NOT_TRUSTED)case ((0x80000000 | 0x4E534350) + 10): a = "CKT_NSS_NOT_TRUSTED" ; break; | ||||
| 252 | CASE(CKT_NSS_MUST_VERIFY_TRUST)case ((0x80000000 | 0x4E534350) + 3): a = "CKT_NSS_MUST_VERIFY_TRUST" ; break; | ||||
| 253 | CASE(CKT_NSS_TRUST_UNKNOWN)case ((0x80000000 | 0x4E534350) + 5): a = "CKT_NSS_TRUST_UNKNOWN" ; break; | ||||
| 254 | CASE(CKT_NSS_VALID_DELEGATOR)case ((0x80000000 | 0x4E534350) + 11): a = "CKT_NSS_VALID_DELEGATOR" ; break; | ||||
| 255 | default: | ||||
| 256 | break; | ||||
| 257 | } | ||||
| 258 | if (a) | ||||
| 259 | PR_snprintf(str, len, "%s", a); | ||||
| 260 | else | ||||
| 261 | PR_snprintf(str, len, "0x%p", trust); | ||||
| 262 | } | ||||
| 263 | |||||
| 264 | static void | ||||
| 265 | log_rv(CK_RV rv) | ||||
| 266 | { | ||||
| 267 | const char *a = NULL((void*)0); | ||||
| 268 | |||||
| 269 | switch (rv) { | ||||
| 270 | CASE(CKR_OK)case 0x00000000UL: a = "CKR_OK"; break; | ||||
| 271 | CASE(CKR_CANCEL)case 0x00000001UL: a = "CKR_CANCEL"; break; | ||||
| 272 | CASE(CKR_HOST_MEMORY)case 0x00000002UL: a = "CKR_HOST_MEMORY"; break; | ||||
| 273 | CASE(CKR_SLOT_ID_INVALID)case 0x00000003UL: a = "CKR_SLOT_ID_INVALID"; break; | ||||
| 274 | CASE(CKR_GENERAL_ERROR)case 0x00000005UL: a = "CKR_GENERAL_ERROR"; break; | ||||
| 275 | CASE(CKR_FUNCTION_FAILED)case 0x00000006UL: a = "CKR_FUNCTION_FAILED"; break; | ||||
| 276 | CASE(CKR_ARGUMENTS_BAD)case 0x00000007UL: a = "CKR_ARGUMENTS_BAD"; break; | ||||
| 277 | CASE(CKR_NO_EVENT)case 0x00000008UL: a = "CKR_NO_EVENT"; break; | ||||
| 278 | CASE(CKR_NEED_TO_CREATE_THREADS)case 0x00000009UL: a = "CKR_NEED_TO_CREATE_THREADS"; break; | ||||
| 279 | CASE(CKR_CANT_LOCK)case 0x0000000AUL: a = "CKR_CANT_LOCK"; break; | ||||
| 280 | CASE(CKR_ATTRIBUTE_READ_ONLY)case 0x00000010UL: a = "CKR_ATTRIBUTE_READ_ONLY"; break; | ||||
| 281 | CASE(CKR_ATTRIBUTE_SENSITIVE)case 0x00000011UL: a = "CKR_ATTRIBUTE_SENSITIVE"; break; | ||||
| 282 | CASE(CKR_ATTRIBUTE_TYPE_INVALID)case 0x00000012UL: a = "CKR_ATTRIBUTE_TYPE_INVALID"; break; | ||||
| 283 | CASE(CKR_ATTRIBUTE_VALUE_INVALID)case 0x00000013UL: a = "CKR_ATTRIBUTE_VALUE_INVALID"; break; | ||||
| 284 | CASE(CKR_DATA_INVALID)case 0x00000020UL: a = "CKR_DATA_INVALID"; break; | ||||
| 285 | CASE(CKR_DATA_LEN_RANGE)case 0x00000021UL: a = "CKR_DATA_LEN_RANGE"; break; | ||||
| 286 | CASE(CKR_DEVICE_ERROR)case 0x00000030UL: a = "CKR_DEVICE_ERROR"; break; | ||||
| 287 | CASE(CKR_DEVICE_MEMORY)case 0x00000031UL: a = "CKR_DEVICE_MEMORY"; break; | ||||
| 288 | CASE(CKR_DEVICE_REMOVED)case 0x00000032UL: a = "CKR_DEVICE_REMOVED"; break; | ||||
| 289 | CASE(CKR_ENCRYPTED_DATA_INVALID)case 0x00000040UL: a = "CKR_ENCRYPTED_DATA_INVALID"; break; | ||||
| 290 | CASE(CKR_ENCRYPTED_DATA_LEN_RANGE)case 0x00000041UL: a = "CKR_ENCRYPTED_DATA_LEN_RANGE"; break; | ||||
| 291 | CASE(CKR_FUNCTION_CANCELED)case 0x00000050UL: a = "CKR_FUNCTION_CANCELED"; break; | ||||
| 292 | CASE(CKR_FUNCTION_NOT_PARALLEL)case 0x00000051UL: a = "CKR_FUNCTION_NOT_PARALLEL"; break; | ||||
| 293 | CASE(CKR_FUNCTION_NOT_SUPPORTED)case 0x00000054UL: a = "CKR_FUNCTION_NOT_SUPPORTED"; break; | ||||
| 294 | CASE(CKR_KEY_HANDLE_INVALID)case 0x00000060UL: a = "CKR_KEY_HANDLE_INVALID"; break; | ||||
| 295 | CASE(CKR_KEY_SIZE_RANGE)case 0x00000062UL: a = "CKR_KEY_SIZE_RANGE"; break; | ||||
| 296 | CASE(CKR_KEY_TYPE_INCONSISTENT)case 0x00000063UL: a = "CKR_KEY_TYPE_INCONSISTENT"; break; | ||||
| 297 | CASE(CKR_KEY_NOT_NEEDED)case 0x00000064UL: a = "CKR_KEY_NOT_NEEDED"; break; | ||||
| 298 | CASE(CKR_KEY_CHANGED)case 0x00000065UL: a = "CKR_KEY_CHANGED"; break; | ||||
| 299 | CASE(CKR_KEY_NEEDED)case 0x00000066UL: a = "CKR_KEY_NEEDED"; break; | ||||
| 300 | CASE(CKR_KEY_INDIGESTIBLE)case 0x00000067UL: a = "CKR_KEY_INDIGESTIBLE"; break; | ||||
| 301 | CASE(CKR_KEY_FUNCTION_NOT_PERMITTED)case 0x00000068UL: a = "CKR_KEY_FUNCTION_NOT_PERMITTED"; break; | ||||
| 302 | CASE(CKR_KEY_NOT_WRAPPABLE)case 0x00000069UL: a = "CKR_KEY_NOT_WRAPPABLE"; break; | ||||
| 303 | CASE(CKR_KEY_UNEXTRACTABLE)case 0x0000006AUL: a = "CKR_KEY_UNEXTRACTABLE"; break; | ||||
| 304 | CASE(CKR_MECHANISM_INVALID)case 0x00000070UL: a = "CKR_MECHANISM_INVALID"; break; | ||||
| 305 | CASE(CKR_MECHANISM_PARAM_INVALID)case 0x00000071UL: a = "CKR_MECHANISM_PARAM_INVALID"; break; | ||||
| 306 | CASE(CKR_OBJECT_HANDLE_INVALID)case 0x00000082UL: a = "CKR_OBJECT_HANDLE_INVALID"; break; | ||||
| 307 | CASE(CKR_OPERATION_ACTIVE)case 0x00000090UL: a = "CKR_OPERATION_ACTIVE"; break; | ||||
| 308 | CASE(CKR_OPERATION_NOT_INITIALIZED)case 0x00000091UL: a = "CKR_OPERATION_NOT_INITIALIZED"; break; | ||||
| 309 | CASE(CKR_PIN_INCORRECT)case 0x000000A0UL: a = "CKR_PIN_INCORRECT"; break; | ||||
| 310 | CASE(CKR_PIN_INVALID)case 0x000000A1UL: a = "CKR_PIN_INVALID"; break; | ||||
| 311 | CASE(CKR_PIN_LEN_RANGE)case 0x000000A2UL: a = "CKR_PIN_LEN_RANGE"; break; | ||||
| 312 | CASE(CKR_PIN_EXPIRED)case 0x000000A3UL: a = "CKR_PIN_EXPIRED"; break; | ||||
| 313 | CASE(CKR_PIN_LOCKED)case 0x000000A4UL: a = "CKR_PIN_LOCKED"; break; | ||||
| 314 | CASE(CKR_SESSION_CLOSED)case 0x000000B0UL: a = "CKR_SESSION_CLOSED"; break; | ||||
| 315 | CASE(CKR_SESSION_COUNT)case 0x000000B1UL: a = "CKR_SESSION_COUNT"; break; | ||||
| 316 | CASE(CKR_SESSION_HANDLE_INVALID)case 0x000000B3UL: a = "CKR_SESSION_HANDLE_INVALID"; break; | ||||
| 317 | CASE(CKR_SESSION_PARALLEL_NOT_SUPPORTED)case 0x000000B4UL: a = "CKR_SESSION_PARALLEL_NOT_SUPPORTED"; break; | ||||
| 318 | CASE(CKR_SESSION_READ_ONLY)case 0x000000B5UL: a = "CKR_SESSION_READ_ONLY"; break; | ||||
| 319 | CASE(CKR_SESSION_EXISTS)case 0x000000B6UL: a = "CKR_SESSION_EXISTS"; break; | ||||
| 320 | CASE(CKR_SESSION_READ_ONLY_EXISTS)case 0x000000B7UL: a = "CKR_SESSION_READ_ONLY_EXISTS"; break; | ||||
| 321 | CASE(CKR_SESSION_READ_WRITE_SO_EXISTS)case 0x000000B8UL: a = "CKR_SESSION_READ_WRITE_SO_EXISTS"; break; | ||||
| 322 | CASE(CKR_SIGNATURE_INVALID)case 0x000000C0UL: a = "CKR_SIGNATURE_INVALID"; break; | ||||
| 323 | CASE(CKR_SIGNATURE_LEN_RANGE)case 0x000000C1UL: a = "CKR_SIGNATURE_LEN_RANGE"; break; | ||||
| 324 | CASE(CKR_TEMPLATE_INCOMPLETE)case 0x000000D0UL: a = "CKR_TEMPLATE_INCOMPLETE"; break; | ||||
| 325 | CASE(CKR_TEMPLATE_INCONSISTENT)case 0x000000D1UL: a = "CKR_TEMPLATE_INCONSISTENT"; break; | ||||
| 326 | CASE(CKR_TOKEN_NOT_PRESENT)case 0x000000E0UL: a = "CKR_TOKEN_NOT_PRESENT"; break; | ||||
| 327 | CASE(CKR_TOKEN_NOT_RECOGNIZED)case 0x000000E1UL: a = "CKR_TOKEN_NOT_RECOGNIZED"; break; | ||||
| 328 | CASE(CKR_TOKEN_WRITE_PROTECTED)case 0x000000E2UL: a = "CKR_TOKEN_WRITE_PROTECTED"; break; | ||||
| 329 | CASE(CKR_UNWRAPPING_KEY_HANDLE_INVALID)case 0x000000F0UL: a = "CKR_UNWRAPPING_KEY_HANDLE_INVALID"; break; | ||||
| 330 | CASE(CKR_UNWRAPPING_KEY_SIZE_RANGE)case 0x000000F1UL: a = "CKR_UNWRAPPING_KEY_SIZE_RANGE"; break; | ||||
| 331 | CASE(CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT)case 0x000000F2UL: a = "CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT" ; break; | ||||
| 332 | CASE(CKR_USER_ALREADY_LOGGED_IN)case 0x00000100UL: a = "CKR_USER_ALREADY_LOGGED_IN"; break; | ||||
| 333 | CASE(CKR_USER_NOT_LOGGED_IN)case 0x00000101UL: a = "CKR_USER_NOT_LOGGED_IN"; break; | ||||
| 334 | CASE(CKR_USER_PIN_NOT_INITIALIZED)case 0x00000102UL: a = "CKR_USER_PIN_NOT_INITIALIZED"; break; | ||||
| 335 | CASE(CKR_USER_TYPE_INVALID)case 0x00000103UL: a = "CKR_USER_TYPE_INVALID"; break; | ||||
| 336 | CASE(CKR_USER_ANOTHER_ALREADY_LOGGED_IN)case 0x00000104UL: a = "CKR_USER_ANOTHER_ALREADY_LOGGED_IN"; break; | ||||
| 337 | CASE(CKR_USER_TOO_MANY_TYPES)case 0x00000105UL: a = "CKR_USER_TOO_MANY_TYPES"; break; | ||||
| 338 | CASE(CKR_WRAPPED_KEY_INVALID)case 0x00000110UL: a = "CKR_WRAPPED_KEY_INVALID"; break; | ||||
| 339 | CASE(CKR_WRAPPED_KEY_LEN_RANGE)case 0x00000112UL: a = "CKR_WRAPPED_KEY_LEN_RANGE"; break; | ||||
| 340 | CASE(CKR_WRAPPING_KEY_HANDLE_INVALID)case 0x00000113UL: a = "CKR_WRAPPING_KEY_HANDLE_INVALID"; break; | ||||
| 341 | CASE(CKR_WRAPPING_KEY_SIZE_RANGE)case 0x00000114UL: a = "CKR_WRAPPING_KEY_SIZE_RANGE"; break; | ||||
| 342 | CASE(CKR_WRAPPING_KEY_TYPE_INCONSISTENT)case 0x00000115UL: a = "CKR_WRAPPING_KEY_TYPE_INCONSISTENT"; break; | ||||
| 343 | CASE(CKR_RANDOM_SEED_NOT_SUPPORTED)case 0x00000120UL: a = "CKR_RANDOM_SEED_NOT_SUPPORTED"; break; | ||||
| 344 | CASE(CKR_RANDOM_NO_RNG)case 0x00000121UL: a = "CKR_RANDOM_NO_RNG"; break; | ||||
| 345 | CASE(CKR_DOMAIN_PARAMS_INVALID)case 0x00000130UL: a = "CKR_DOMAIN_PARAMS_INVALID"; break; | ||||
| 346 | CASE(CKR_BUFFER_TOO_SMALL)case 0x00000150UL: a = "CKR_BUFFER_TOO_SMALL"; break; | ||||
| 347 | CASE(CKR_SAVED_STATE_INVALID)case 0x00000160UL: a = "CKR_SAVED_STATE_INVALID"; break; | ||||
| 348 | CASE(CKR_INFORMATION_SENSITIVE)case 0x00000170UL: a = "CKR_INFORMATION_SENSITIVE"; break; | ||||
| 349 | CASE(CKR_STATE_UNSAVEABLE)case 0x00000180UL: a = "CKR_STATE_UNSAVEABLE"; break; | ||||
| 350 | CASE(CKR_CRYPTOKI_NOT_INITIALIZED)case 0x00000190UL: a = "CKR_CRYPTOKI_NOT_INITIALIZED"; break; | ||||
| 351 | CASE(CKR_CRYPTOKI_ALREADY_INITIALIZED)case 0x00000191UL: a = "CKR_CRYPTOKI_ALREADY_INITIALIZED"; break; | ||||
| 352 | CASE(CKR_MUTEX_BAD)case 0x000001A0UL: a = "CKR_MUTEX_BAD"; break; | ||||
| 353 | CASE(CKR_MUTEX_NOT_LOCKED)case 0x000001A1UL: a = "CKR_MUTEX_NOT_LOCKED"; break; | ||||
| 354 | CASE(CKR_FUNCTION_REJECTED)case 0x00000200UL: a = "CKR_FUNCTION_REJECTED"; break; | ||||
| 355 | CASE(CKR_ACTION_PROHIBITED)case 0x0000001BUL: a = "CKR_ACTION_PROHIBITED"; break; | ||||
| 356 | CASE(CKR_CURVE_NOT_SUPPORTED)case 0x00000140UL: a = "CKR_CURVE_NOT_SUPPORTED"; break; | ||||
| 357 | CASE(CKR_NEW_PIN_MODE)case 0x000001B0UL: a = "CKR_NEW_PIN_MODE"; break; | ||||
| 358 | CASE(CKR_NEXT_OTP)case 0x000001B1UL: a = "CKR_NEXT_OTP"; break; | ||||
| 359 | CASE(CKR_EXCEEDED_MAX_ITERATIONS)case 0x000001B5UL: a = "CKR_EXCEEDED_MAX_ITERATIONS"; break; | ||||
| 360 | CASE(CKR_FIPS_SELF_TEST_FAILED)case 0x000001B6UL: a = "CKR_FIPS_SELF_TEST_FAILED"; break; | ||||
| 361 | CASE(CKR_LIBRARY_LOAD_FAILED)case 0x000001B7UL: a = "CKR_LIBRARY_LOAD_FAILED"; break; | ||||
| 362 | CASE(CKR_PIN_TOO_WEAK)case 0x000001B8UL: a = "CKR_PIN_TOO_WEAK"; break; | ||||
| 363 | CASE(CKR_TOKEN_RESOURCE_EXCEEDED)case 0x00000201UL: a = "CKR_TOKEN_RESOURCE_EXCEEDED"; break; | ||||
| 364 | CASE(CKR_OPERATION_CANCEL_FAILED)case 0x00000202UL: a = "CKR_OPERATION_CANCEL_FAILED"; break; | ||||
| 365 | default: | ||||
| 366 | break; | ||||
| 367 | } | ||||
| 368 | if (a) | ||||
| 369 | PR_LOG(modlog, 1, (" rv = %s\n", a))do { if (((modlog)->level >= (1))) { PR_LogPrint (" rv = %s\n" , a); } } while (0); | ||||
| 370 | else | ||||
| 371 | PR_LOG(modlog, 1, (" rv = 0x%x\n", rv))do { if (((modlog)->level >= (1))) { PR_LogPrint (" rv = 0x%x\n" , rv); } } while (0); | ||||
| 372 | } | ||||
| 373 | |||||
| 374 | static void | ||||
| 375 | log_state(CK_STATE state) | ||||
| 376 | { | ||||
| 377 | const char *a = NULL((void*)0); | ||||
| 378 | |||||
| 379 | switch (state) { | ||||
| 380 | CASE(CKS_RO_PUBLIC_SESSION)case 0: a = "CKS_RO_PUBLIC_SESSION"; break; | ||||
| 381 | CASE(CKS_RO_USER_FUNCTIONS)case 1: a = "CKS_RO_USER_FUNCTIONS"; break; | ||||
| 382 | CASE(CKS_RW_PUBLIC_SESSION)case 2: a = "CKS_RW_PUBLIC_SESSION"; break; | ||||
| 383 | CASE(CKS_RW_USER_FUNCTIONS)case 3: a = "CKS_RW_USER_FUNCTIONS"; break; | ||||
| 384 | CASE(CKS_RW_SO_FUNCTIONS)case 4: a = "CKS_RW_SO_FUNCTIONS"; break; | ||||
| 385 | default: | ||||
| 386 | break; | ||||
| 387 | } | ||||
| 388 | if (a) | ||||
| 389 | PR_LOG(modlog, 1, (" state = %s\n", a))do { if (((modlog)->level >= (1))) { PR_LogPrint (" state = %s\n" , a); } } while (0); | ||||
| 390 | else | ||||
| 391 | PR_LOG(modlog, 1, (" state = 0x%x\n", state))do { if (((modlog)->level >= (1))) { PR_LogPrint (" state = 0x%x\n" , state); } } while (0); | ||||
| 392 | } | ||||
| 393 | |||||
| 394 | static void | ||||
| 395 | log_handle(PRLogModuleLevel level, const char *format, CK_ULONG handle) | ||||
| 396 | { | ||||
| 397 | char fmtBuf[80]; | ||||
| 398 | if (handle) | ||||
| 399 | PR_LOG(modlog, level, (format, handle))do { if (((modlog)->level >= (level))) { PR_LogPrint (format , handle); } } while (0); | ||||
| 400 | else { | ||||
| 401 | PL_strncpyz(fmtBuf, format, sizeof fmtBuf); | ||||
| 402 | PL_strcatn(fmtBuf, sizeof fmtBuf, fmt_invalid_handle); | ||||
| 403 | PR_LOG(modlog, level, (fmtBuf, handle))do { if (((modlog)->level >= (level))) { PR_LogPrint (fmtBuf , handle); } } while (0); | ||||
| 404 | } | ||||
| 405 | } | ||||
| 406 | |||||
| 407 | static void | ||||
| 408 | print_mechanism(CK_MECHANISM_PTR m) | ||||
| 409 | { | ||||
| 410 | |||||
| 411 | const char *a = NULL((void*)0); | ||||
| 412 | |||||
| 413 | switch (m->mechanism) { | ||||
| 414 | CASE(CKM_AES_CBC)case 0x00001082UL: a = "CKM_AES_CBC"; break; | ||||
| 415 | CASE(CKM_AES_CBC_ENCRYPT_DATA)case 0x00001105UL: a = "CKM_AES_CBC_ENCRYPT_DATA"; break; | ||||
| 416 | CASE(CKM_AES_CBC_PAD)case 0x00001085UL: a = "CKM_AES_CBC_PAD"; break; | ||||
| 417 | CASE(CKM_AES_CCM)case 0x00001088UL: a = "CKM_AES_CCM"; break; | ||||
| 418 | CASE(CKM_AES_CTR)case 0x00001086UL: a = "CKM_AES_CTR"; break; | ||||
| 419 | CASE(CKM_AES_CTS)case 0x00001089UL: a = "CKM_AES_CTS"; break; | ||||
| 420 | CASE(CKM_AES_GCM)case 0x00001087UL: a = "CKM_AES_GCM"; break; | ||||
| 421 | CASE(CKM_AES_ECB)case 0x00001081UL: a = "CKM_AES_ECB"; break; | ||||
| 422 | CASE(CKM_AES_ECB_ENCRYPT_DATA)case 0x00001104UL: a = "CKM_AES_ECB_ENCRYPT_DATA"; break; | ||||
| 423 | CASE(CKM_AES_KEY_GEN)case 0x00001080UL: a = "CKM_AES_KEY_GEN"; break; | ||||
| 424 | CASE(CKM_AES_MAC)case 0x00001083UL: a = "CKM_AES_MAC"; break; | ||||
| 425 | CASE(CKM_AES_MAC_GENERAL)case 0x00001084UL: a = "CKM_AES_MAC_GENERAL"; break; | ||||
| 426 | CASE(CKM_AES_CMAC)case 0x0000108AUL: a = "CKM_AES_CMAC"; break; | ||||
| 427 | CASE(CKM_AES_CMAC_GENERAL)case 0x0000108BUL: a = "CKM_AES_CMAC_GENERAL"; break; | ||||
| 428 | CASE(CKM_CAMELLIA_CBC)case 0x00000552UL: a = "CKM_CAMELLIA_CBC"; break; | ||||
| 429 | CASE(CKM_CAMELLIA_CBC_ENCRYPT_DATA)case 0x00000557UL: a = "CKM_CAMELLIA_CBC_ENCRYPT_DATA"; break; | ||||
| 430 | CASE(CKM_CAMELLIA_CBC_PAD)case 0x00000555UL: a = "CKM_CAMELLIA_CBC_PAD"; break; | ||||
| 431 | CASE(CKM_CAMELLIA_ECB)case 0x00000551UL: a = "CKM_CAMELLIA_ECB"; break; | ||||
| 432 | CASE(CKM_CAMELLIA_ECB_ENCRYPT_DATA)case 0x00000556UL: a = "CKM_CAMELLIA_ECB_ENCRYPT_DATA"; break; | ||||
| 433 | CASE(CKM_CAMELLIA_KEY_GEN)case 0x00000550UL: a = "CKM_CAMELLIA_KEY_GEN"; break; | ||||
| 434 | CASE(CKM_CAMELLIA_MAC)case 0x00000553UL: a = "CKM_CAMELLIA_MAC"; break; | ||||
| 435 | CASE(CKM_CAMELLIA_MAC_GENERAL)case 0x00000554UL: a = "CKM_CAMELLIA_MAC_GENERAL"; break; | ||||
| 436 | CASE(CKM_CHACHA20_KEY_GEN)case 0x00001225UL: a = "CKM_CHACHA20_KEY_GEN"; break; | ||||
| 437 | CASE(CKM_CHACHA20)case 0x00001226UL: a = "CKM_CHACHA20"; break; | ||||
| 438 | CASE(CKM_CDMF_CBC)case 0x00000142UL: a = "CKM_CDMF_CBC"; break; | ||||
| 439 | CASE(CKM_CDMF_CBC_PAD)case 0x00000145UL: a = "CKM_CDMF_CBC_PAD"; break; | ||||
| 440 | CASE(CKM_CDMF_ECB)case 0x00000141UL: a = "CKM_CDMF_ECB"; break; | ||||
| 441 | CASE(CKM_CDMF_KEY_GEN)case 0x00000140UL: a = "CKM_CDMF_KEY_GEN"; break; | ||||
| 442 | CASE(CKM_CDMF_MAC)case 0x00000143UL: a = "CKM_CDMF_MAC"; break; | ||||
| 443 | CASE(CKM_CDMF_MAC_GENERAL)case 0x00000144UL: a = "CKM_CDMF_MAC_GENERAL"; break; | ||||
| 444 | CASE(CKM_CMS_SIG)case 0x00000500UL: a = "CKM_CMS_SIG"; break; | ||||
| 445 | CASE(CKM_CONCATENATE_BASE_AND_DATA)case 0x00000362UL: a = "CKM_CONCATENATE_BASE_AND_DATA"; break; | ||||
| 446 | CASE(CKM_CONCATENATE_BASE_AND_KEY)case 0x00000360UL: a = "CKM_CONCATENATE_BASE_AND_KEY"; break; | ||||
| 447 | CASE(CKM_CONCATENATE_DATA_AND_BASE)case 0x00000363UL: a = "CKM_CONCATENATE_DATA_AND_BASE"; break; | ||||
| 448 | CASE(CKM_DES2_KEY_GEN)case 0x00000130UL: a = "CKM_DES2_KEY_GEN"; break; | ||||
| 449 | CASE(CKM_DES3_CBC)case 0x00000133UL: a = "CKM_DES3_CBC"; break; | ||||
| 450 | CASE(CKM_DES3_CBC_ENCRYPT_DATA)case 0x00001103UL: a = "CKM_DES3_CBC_ENCRYPT_DATA"; break; | ||||
| 451 | CASE(CKM_DES3_CBC_PAD)case 0x00000136UL: a = "CKM_DES3_CBC_PAD"; break; | ||||
| 452 | CASE(CKM_DES3_ECB)case 0x00000132UL: a = "CKM_DES3_ECB"; break; | ||||
| 453 | CASE(CKM_DES3_ECB_ENCRYPT_DATA)case 0x00001102UL: a = "CKM_DES3_ECB_ENCRYPT_DATA"; break; | ||||
| 454 | CASE(CKM_DES3_KEY_GEN)case 0x00000131UL: a = "CKM_DES3_KEY_GEN"; break; | ||||
| 455 | CASE(CKM_DES3_MAC)case 0x00000134UL: a = "CKM_DES3_MAC"; break; | ||||
| 456 | CASE(CKM_DES3_MAC_GENERAL)case 0x00000135UL: a = "CKM_DES3_MAC_GENERAL"; break; | ||||
| 457 | CASE(CKM_DES_CBC)case 0x00000122UL: a = "CKM_DES_CBC"; break; | ||||
| 458 | CASE(CKM_DES_CBC_ENCRYPT_DATA)case 0x00001101UL: a = "CKM_DES_CBC_ENCRYPT_DATA"; break; | ||||
| 459 | CASE(CKM_DES_CBC_PAD)case 0x00000125UL: a = "CKM_DES_CBC_PAD"; break; | ||||
| 460 | CASE(CKM_DES_CFB64)case 0x00000152UL: a = "CKM_DES_CFB64"; break; | ||||
| 461 | CASE(CKM_DES_CFB8)case 0x00000153UL: a = "CKM_DES_CFB8"; break; | ||||
| 462 | CASE(CKM_DES_ECB)case 0x00000121UL: a = "CKM_DES_ECB"; break; | ||||
| 463 | CASE(CKM_DES_ECB_ENCRYPT_DATA)case 0x00001100UL: a = "CKM_DES_ECB_ENCRYPT_DATA"; break; | ||||
| 464 | CASE(CKM_DES_KEY_GEN)case 0x00000120UL: a = "CKM_DES_KEY_GEN"; break; | ||||
| 465 | CASE(CKM_DES_MAC)case 0x00000123UL: a = "CKM_DES_MAC"; break; | ||||
| 466 | CASE(CKM_DES_MAC_GENERAL)case 0x00000124UL: a = "CKM_DES_MAC_GENERAL"; break; | ||||
| 467 | CASE(CKM_DES_OFB64)case 0x00000150UL: a = "CKM_DES_OFB64"; break; | ||||
| 468 | CASE(CKM_DES_OFB8)case 0x00000151UL: a = "CKM_DES_OFB8"; break; | ||||
| 469 | CASE(CKM_DH_PKCS_DERIVE)case 0x00000021UL: a = "CKM_DH_PKCS_DERIVE"; break; | ||||
| 470 | CASE(CKM_DH_PKCS_KEY_PAIR_GEN)case 0x00000020UL: a = "CKM_DH_PKCS_KEY_PAIR_GEN"; break; | ||||
| 471 | CASE(CKM_DH_PKCS_PARAMETER_GEN)case 0x00002001UL: a = "CKM_DH_PKCS_PARAMETER_GEN"; break; | ||||
| 472 | CASE(CKM_DSA)case 0x00000011UL: a = "CKM_DSA"; break; | ||||
| 473 | CASE(CKM_DSA_KEY_PAIR_GEN)case 0x00000010UL: a = "CKM_DSA_KEY_PAIR_GEN"; break; | ||||
| 474 | CASE(CKM_DSA_PARAMETER_GEN)case 0x00002000UL: a = "CKM_DSA_PARAMETER_GEN"; break; | ||||
| 475 | CASE(CKM_DSA_SHA1)case 0x00000012UL: a = "CKM_DSA_SHA1"; break; | ||||
| 476 | CASE(CKM_ECDH1_COFACTOR_DERIVE)case 0x00001051UL: a = "CKM_ECDH1_COFACTOR_DERIVE"; break; | ||||
| 477 | CASE(CKM_ECDH1_DERIVE)case 0x00001050UL: a = "CKM_ECDH1_DERIVE"; break; | ||||
| 478 | CASE(CKM_ECDSA)case 0x00001041UL: a = "CKM_ECDSA"; break; | ||||
| 479 | CASE(CKM_ECDSA_SHA1)case 0x00001042UL: a = "CKM_ECDSA_SHA1"; break; | ||||
| 480 | CASE(CKM_ECMQV_DERIVE)case 0x00001052UL: a = "CKM_ECMQV_DERIVE"; break; | ||||
| 481 | CASE(CKM_EC_KEY_PAIR_GEN)case 0x00001040UL: a = "CKM_EC_KEY_PAIR_GEN"; break; /* also CASE(CKM_ECDSA_KEY_PAIR_GEN); */ | ||||
| 482 | CASE(CKM_EXTRACT_KEY_FROM_KEY)case 0x00000365UL: a = "CKM_EXTRACT_KEY_FROM_KEY"; break; | ||||
| 483 | CASE(CKM_ECDSA_SHA224)case 0x00001043UL: a = "CKM_ECDSA_SHA224"; break; | ||||
| 484 | CASE(CKM_ECDSA_SHA256)case 0x00001044UL: a = "CKM_ECDSA_SHA256"; break; | ||||
| 485 | CASE(CKM_ECDSA_SHA384)case 0x00001045UL: a = "CKM_ECDSA_SHA384"; break; | ||||
| 486 | CASE(CKM_ECDSA_SHA512)case 0x00001046UL: a = "CKM_ECDSA_SHA512"; break; | ||||
| 487 | CASE(CKM_EC_KEY_PAIR_GEN_W_EXTRA_BITS)case 0x0000140BUL: a = "CKM_EC_KEY_PAIR_GEN_W_EXTRA_BITS"; break; | ||||
| 488 | CASE(CKM_FASTHASH)case 0x00001070UL: a = "CKM_FASTHASH"; break; | ||||
| 489 | CASE(CKM_FORTEZZA_TIMESTAMP)case 0x00001020UL: a = "CKM_FORTEZZA_TIMESTAMP"; break; | ||||
| 490 | CASE(CKM_GENERIC_SECRET_KEY_GEN)case 0x00000350UL: a = "CKM_GENERIC_SECRET_KEY_GEN"; break; | ||||
| 491 | CASE(CKM_IDEA_CBC)case 0x00000342UL: a = "CKM_IDEA_CBC"; break; | ||||
| 492 | CASE(CKM_IDEA_CBC_PAD)case 0x00000345UL: a = "CKM_IDEA_CBC_PAD"; break; | ||||
| 493 | CASE(CKM_IDEA_ECB)case 0x00000341UL: a = "CKM_IDEA_ECB"; break; | ||||
| 494 | CASE(CKM_IDEA_KEY_GEN)case 0x00000340UL: a = "CKM_IDEA_KEY_GEN"; break; | ||||
| 495 | CASE(CKM_IDEA_MAC)case 0x00000343UL: a = "CKM_IDEA_MAC"; break; | ||||
| 496 | CASE(CKM_IDEA_MAC_GENERAL)case 0x00000344UL: a = "CKM_IDEA_MAC_GENERAL"; break; | ||||
| 497 | CASE(CKM_KEA_KEY_DERIVE)case 0x00001011UL: a = "CKM_KEA_KEY_DERIVE"; break; | ||||
| 498 | CASE(CKM_KEA_KEY_PAIR_GEN)case 0x00001010UL: a = "CKM_KEA_KEY_PAIR_GEN"; break; | ||||
| 499 | CASE(CKM_KEY_WRAP_LYNKS)case 0x00000400UL: a = "CKM_KEY_WRAP_LYNKS"; break; | ||||
| 500 | CASE(CKM_KEY_WRAP_SET_OAEP)case 0x00000401UL: a = "CKM_KEY_WRAP_SET_OAEP"; break; | ||||
| 501 | CASE(CKM_MD2)case 0x00000200UL: a = "CKM_MD2"; break; | ||||
| 502 | CASE(CKM_MD2_HMAC)case 0x00000201UL: a = "CKM_MD2_HMAC"; break; | ||||
| 503 | CASE(CKM_MD2_HMAC_GENERAL)case 0x00000202UL: a = "CKM_MD2_HMAC_GENERAL"; break; | ||||
| 504 | CASE(CKM_MD2_KEY_DERIVATION)case 0x00000391UL: a = "CKM_MD2_KEY_DERIVATION"; break; | ||||
| 505 | CASE(CKM_MD2_RSA_PKCS)case 0x00000004UL: a = "CKM_MD2_RSA_PKCS"; break; | ||||
| 506 | CASE(CKM_MD5)case 0x00000210UL: a = "CKM_MD5"; break; | ||||
| 507 | CASE(CKM_MD5_HMAC)case 0x00000211UL: a = "CKM_MD5_HMAC"; break; | ||||
| 508 | CASE(CKM_MD5_HMAC_GENERAL)case 0x00000212UL: a = "CKM_MD5_HMAC_GENERAL"; break; | ||||
| 509 | CASE(CKM_MD5_KEY_DERIVATION)case 0x00000390UL: a = "CKM_MD5_KEY_DERIVATION"; break; | ||||
| 510 | CASE(CKM_MD5_RSA_PKCS)case 0x00000005UL: a = "CKM_MD5_RSA_PKCS"; break; | ||||
| 511 | CASE(CKM_PBA_SHA1_WITH_SHA1_HMAC)case 0x000003C0UL: a = "CKM_PBA_SHA1_WITH_SHA1_HMAC"; break; | ||||
| 512 | CASE(CKM_PBE_MD2_DES_CBC)case 0x000003A0UL: a = "CKM_PBE_MD2_DES_CBC"; break; | ||||
| 513 | CASE(CKM_PBE_MD5_DES_CBC)case 0x000003A1UL: a = "CKM_PBE_MD5_DES_CBC"; break; | ||||
| 514 | CASE(CKM_PBE_SHA1_DES2_EDE_CBC)case 0x000003A9UL: a = "CKM_PBE_SHA1_DES2_EDE_CBC"; break; | ||||
| 515 | CASE(CKM_PBE_SHA1_DES3_EDE_CBC)case 0x000003A8UL: a = "CKM_PBE_SHA1_DES3_EDE_CBC"; break; | ||||
| 516 | CASE(CKM_PBE_SHA1_RC2_128_CBC)case 0x000003AAUL: a = "CKM_PBE_SHA1_RC2_128_CBC"; break; | ||||
| 517 | CASE(CKM_PBE_SHA1_RC2_40_CBC)case 0x000003ABUL: a = "CKM_PBE_SHA1_RC2_40_CBC"; break; | ||||
| 518 | CASE(CKM_PBE_SHA1_RC4_128)case 0x000003A6UL: a = "CKM_PBE_SHA1_RC4_128"; break; | ||||
| 519 | CASE(CKM_PBE_SHA1_RC4_40)case 0x000003A7UL: a = "CKM_PBE_SHA1_RC4_40"; break; | ||||
| 520 | CASE(CKM_PKCS5_PBKD2)case 0x000003B0UL: a = "CKM_PKCS5_PBKD2"; break; | ||||
| 521 | CASE(CKM_POLY1305_KEY_GEN)case 0x00001227UL: a = "CKM_POLY1305_KEY_GEN"; break; | ||||
| 522 | CASE(CKM_POLY1305)case 0x00001228UL: a = "CKM_POLY1305"; break; | ||||
| 523 | CASE(CKM_RC2_CBC)case 0x00000102UL: a = "CKM_RC2_CBC"; break; | ||||
| 524 | CASE(CKM_RC2_CBC_PAD)case 0x00000105UL: a = "CKM_RC2_CBC_PAD"; break; | ||||
| 525 | CASE(CKM_RC2_ECB)case 0x00000101UL: a = "CKM_RC2_ECB"; break; | ||||
| 526 | CASE(CKM_RC2_KEY_GEN)case 0x00000100UL: a = "CKM_RC2_KEY_GEN"; break; | ||||
| 527 | CASE(CKM_RC2_MAC)case 0x00000103UL: a = "CKM_RC2_MAC"; break; | ||||
| 528 | CASE(CKM_RC2_MAC_GENERAL)case 0x00000104UL: a = "CKM_RC2_MAC_GENERAL"; break; | ||||
| 529 | CASE(CKM_RC4)case 0x00000111UL: a = "CKM_RC4"; break; | ||||
| 530 | CASE(CKM_RC4_KEY_GEN)case 0x00000110UL: a = "CKM_RC4_KEY_GEN"; break; | ||||
| 531 | CASE(CKM_RC5_CBC)case 0x00000332UL: a = "CKM_RC5_CBC"; break; | ||||
| 532 | CASE(CKM_RC5_CBC_PAD)case 0x00000335UL: a = "CKM_RC5_CBC_PAD"; break; | ||||
| 533 | CASE(CKM_RC5_ECB)case 0x00000331UL: a = "CKM_RC5_ECB"; break; | ||||
| 534 | CASE(CKM_RC5_KEY_GEN)case 0x00000330UL: a = "CKM_RC5_KEY_GEN"; break; | ||||
| 535 | CASE(CKM_RC5_MAC)case 0x00000333UL: a = "CKM_RC5_MAC"; break; | ||||
| 536 | CASE(CKM_RC5_MAC_GENERAL)case 0x00000334UL: a = "CKM_RC5_MAC_GENERAL"; break; | ||||
| 537 | CASE(CKM_RIPEMD128)case 0x00000230UL: a = "CKM_RIPEMD128"; break; | ||||
| 538 | CASE(CKM_RIPEMD128_HMAC)case 0x00000231UL: a = "CKM_RIPEMD128_HMAC"; break; | ||||
| 539 | CASE(CKM_RIPEMD128_HMAC_GENERAL)case 0x00000232UL: a = "CKM_RIPEMD128_HMAC_GENERAL"; break; | ||||
| 540 | CASE(CKM_RIPEMD128_RSA_PKCS)case 0x00000007UL: a = "CKM_RIPEMD128_RSA_PKCS"; break; | ||||
| 541 | CASE(CKM_RIPEMD160)case 0x00000240UL: a = "CKM_RIPEMD160"; break; | ||||
| 542 | CASE(CKM_RIPEMD160_HMAC)case 0x00000241UL: a = "CKM_RIPEMD160_HMAC"; break; | ||||
| 543 | CASE(CKM_RIPEMD160_HMAC_GENERAL)case 0x00000242UL: a = "CKM_RIPEMD160_HMAC_GENERAL"; break; | ||||
| 544 | CASE(CKM_RIPEMD160_RSA_PKCS)case 0x00000008UL: a = "CKM_RIPEMD160_RSA_PKCS"; break; | ||||
| 545 | CASE(CKM_RSA_9796)case 0x00000002UL: a = "CKM_RSA_9796"; break; | ||||
| 546 | CASE(CKM_RSA_PKCS)case 0x00000001UL: a = "CKM_RSA_PKCS"; break; | ||||
| 547 | CASE(CKM_RSA_PKCS_KEY_PAIR_GEN)case 0x00000000UL: a = "CKM_RSA_PKCS_KEY_PAIR_GEN"; break; | ||||
| 548 | CASE(CKM_RSA_PKCS_OAEP)case 0x00000009UL: a = "CKM_RSA_PKCS_OAEP"; break; | ||||
| 549 | CASE(CKM_RSA_PKCS_PSS)case 0x0000000DUL: a = "CKM_RSA_PKCS_PSS"; break; | ||||
| 550 | CASE(CKM_RSA_X9_31)case 0x0000000BUL: a = "CKM_RSA_X9_31"; break; | ||||
| 551 | CASE(CKM_RSA_X9_31_KEY_PAIR_GEN)case 0x0000000AUL: a = "CKM_RSA_X9_31_KEY_PAIR_GEN"; break; | ||||
| 552 | CASE(CKM_RSA_X_509)case 0x00000003UL: a = "CKM_RSA_X_509"; break; | ||||
| 553 | CASE(CKM_SHA1_KEY_DERIVATION)case 0x00000392UL: a = "CKM_SHA1_KEY_DERIVATION"; break; | ||||
| 554 | CASE(CKM_SHA1_RSA_PKCS)case 0x00000006UL: a = "CKM_SHA1_RSA_PKCS"; break; | ||||
| 555 | CASE(CKM_SHA1_RSA_PKCS_PSS)case 0x0000000EUL: a = "CKM_SHA1_RSA_PKCS_PSS"; break; | ||||
| 556 | CASE(CKM_SHA1_RSA_X9_31)case 0x0000000CUL: a = "CKM_SHA1_RSA_X9_31"; break; | ||||
| 557 | CASE(CKM_SHA224)case 0x00000255UL: a = "CKM_SHA224"; break; | ||||
| 558 | CASE(CKM_SHA224_HMAC)case 0x00000256UL: a = "CKM_SHA224_HMAC"; break; | ||||
| 559 | CASE(CKM_SHA224_HMAC_GENERAL)case 0x00000257UL: a = "CKM_SHA224_HMAC_GENERAL"; break; | ||||
| 560 | CASE(CKM_SHA224_KEY_DERIVATION)case 0x00000396UL: a = "CKM_SHA224_KEY_DERIVATION"; break; | ||||
| 561 | CASE(CKM_SHA224_RSA_PKCS)case 0x00000046UL: a = "CKM_SHA224_RSA_PKCS"; break; | ||||
| 562 | CASE(CKM_SHA224_RSA_PKCS_PSS)case 0x00000047UL: a = "CKM_SHA224_RSA_PKCS_PSS"; break; | ||||
| 563 | CASE(CKM_SHA256)case 0x00000250UL: a = "CKM_SHA256"; break; | ||||
| 564 | CASE(CKM_SHA256_HMAC)case 0x00000251UL: a = "CKM_SHA256_HMAC"; break; | ||||
| 565 | CASE(CKM_SHA256_HMAC_GENERAL)case 0x00000252UL: a = "CKM_SHA256_HMAC_GENERAL"; break; | ||||
| 566 | CASE(CKM_SHA256_KEY_DERIVATION)case 0x00000393UL: a = "CKM_SHA256_KEY_DERIVATION"; break; | ||||
| 567 | CASE(CKM_SHA256_RSA_PKCS)case 0x00000040UL: a = "CKM_SHA256_RSA_PKCS"; break; | ||||
| 568 | CASE(CKM_SHA256_RSA_PKCS_PSS)case 0x00000043UL: a = "CKM_SHA256_RSA_PKCS_PSS"; break; | ||||
| 569 | CASE(CKM_SHA384)case 0x00000260UL: a = "CKM_SHA384"; break; | ||||
| 570 | CASE(CKM_SHA384_HMAC)case 0x00000261UL: a = "CKM_SHA384_HMAC"; break; | ||||
| 571 | CASE(CKM_SHA384_HMAC_GENERAL)case 0x00000262UL: a = "CKM_SHA384_HMAC_GENERAL"; break; | ||||
| 572 | CASE(CKM_SHA384_KEY_DERIVATION)case 0x00000394UL: a = "CKM_SHA384_KEY_DERIVATION"; break; | ||||
| 573 | CASE(CKM_SHA384_RSA_PKCS)case 0x00000041UL: a = "CKM_SHA384_RSA_PKCS"; break; | ||||
| 574 | CASE(CKM_SHA384_RSA_PKCS_PSS)case 0x00000044UL: a = "CKM_SHA384_RSA_PKCS_PSS"; break; | ||||
| 575 | CASE(CKM_SHA512)case 0x00000270UL: a = "CKM_SHA512"; break; | ||||
| 576 | CASE(CKM_SHA512_HMAC)case 0x00000271UL: a = "CKM_SHA512_HMAC"; break; | ||||
| 577 | CASE(CKM_SHA512_HMAC_GENERAL)case 0x00000272UL: a = "CKM_SHA512_HMAC_GENERAL"; break; | ||||
| 578 | CASE(CKM_SHA512_KEY_DERIVATION)case 0x00000395UL: a = "CKM_SHA512_KEY_DERIVATION"; break; | ||||
| 579 | CASE(CKM_SHA512_RSA_PKCS)case 0x00000042UL: a = "CKM_SHA512_RSA_PKCS"; break; | ||||
| 580 | CASE(CKM_SHA512_RSA_PKCS_PSS)case 0x00000045UL: a = "CKM_SHA512_RSA_PKCS_PSS"; break; | ||||
| 581 | CASE(CKM_SHA_1)case 0x00000220UL: a = "CKM_SHA_1"; break; | ||||
| 582 | CASE(CKM_SHA_1_HMAC)case 0x00000221UL: a = "CKM_SHA_1_HMAC"; break; | ||||
| 583 | CASE(CKM_SHA_1_HMAC_GENERAL)case 0x00000222UL: a = "CKM_SHA_1_HMAC_GENERAL"; break; | ||||
| 584 | CASE(CKM_SKIPJACK_CBC64)case 0x00001002UL: a = "CKM_SKIPJACK_CBC64"; break; | ||||
| 585 | CASE(CKM_SKIPJACK_CFB16)case 0x00001006UL: a = "CKM_SKIPJACK_CFB16"; break; | ||||
| 586 | CASE(CKM_SKIPJACK_CFB32)case 0x00001005UL: a = "CKM_SKIPJACK_CFB32"; break; | ||||
| 587 | CASE(CKM_SKIPJACK_CFB64)case 0x00001004UL: a = "CKM_SKIPJACK_CFB64"; break; | ||||
| 588 | CASE(CKM_SKIPJACK_CFB8)case 0x00001007UL: a = "CKM_SKIPJACK_CFB8"; break; | ||||
| 589 | CASE(CKM_SKIPJACK_ECB64)case 0x00001001UL: a = "CKM_SKIPJACK_ECB64"; break; | ||||
| 590 | CASE(CKM_SKIPJACK_KEY_GEN)case 0x00001000UL: a = "CKM_SKIPJACK_KEY_GEN"; break; | ||||
| 591 | CASE(CKM_SKIPJACK_OFB64)case 0x00001003UL: a = "CKM_SKIPJACK_OFB64"; break; | ||||
| 592 | CASE(CKM_SKIPJACK_PRIVATE_WRAP)case 0x00001009UL: a = "CKM_SKIPJACK_PRIVATE_WRAP"; break; | ||||
| 593 | CASE(CKM_SKIPJACK_RELAYX)case 0x0000100aUL: a = "CKM_SKIPJACK_RELAYX"; break; | ||||
| 594 | CASE(CKM_SKIPJACK_WRAP)case 0x00001008UL: a = "CKM_SKIPJACK_WRAP"; break; | ||||
| 595 | CASE(CKM_SSL3_KEY_AND_MAC_DERIVE)case 0x00000372UL: a = "CKM_SSL3_KEY_AND_MAC_DERIVE"; break; | ||||
| 596 | CASE(CKM_SSL3_MASTER_KEY_DERIVE)case 0x00000371UL: a = "CKM_SSL3_MASTER_KEY_DERIVE"; break; | ||||
| 597 | CASE(CKM_SSL3_MASTER_KEY_DERIVE_DH)case 0x00000373UL: a = "CKM_SSL3_MASTER_KEY_DERIVE_DH"; break; | ||||
| 598 | CASE(CKM_SSL3_MD5_MAC)case 0x00000380UL: a = "CKM_SSL3_MD5_MAC"; break; | ||||
| 599 | CASE(CKM_SSL3_PRE_MASTER_KEY_GEN)case 0x00000370UL: a = "CKM_SSL3_PRE_MASTER_KEY_GEN"; break; | ||||
| 600 | CASE(CKM_SSL3_SHA1_MAC)case 0x00000381UL: a = "CKM_SSL3_SHA1_MAC"; break; | ||||
| 601 | CASE(CKM_TLS_KEY_AND_MAC_DERIVE)case 0x00000376UL: a = "CKM_TLS_KEY_AND_MAC_DERIVE"; break; | ||||
| 602 | CASE(CKM_TLS_MASTER_KEY_DERIVE)case 0x00000375UL: a = "CKM_TLS_MASTER_KEY_DERIVE"; break; | ||||
| 603 | CASE(CKM_TLS_MASTER_KEY_DERIVE_DH)case 0x00000377UL: a = "CKM_TLS_MASTER_KEY_DERIVE_DH"; break; | ||||
| 604 | CASE(CKM_TLS_PRE_MASTER_KEY_GEN)case 0x00000374UL: a = "CKM_TLS_PRE_MASTER_KEY_GEN"; break; | ||||
| 605 | CASE(CKM_TLS_PRF)case 0x00000378UL: a = "CKM_TLS_PRF"; break; | ||||
| 606 | CASE(CKM_TWOFISH_CBC)case 0x00001093UL: a = "CKM_TWOFISH_CBC"; break; | ||||
| 607 | CASE(CKM_TWOFISH_KEY_GEN)case 0x00001092UL: a = "CKM_TWOFISH_KEY_GEN"; break; | ||||
| 608 | CASE(CKM_X9_42_DH_DERIVE)case 0x00000031UL: a = "CKM_X9_42_DH_DERIVE"; break; | ||||
| 609 | CASE(CKM_X9_42_DH_HYBRID_DERIVE)case 0x00000032UL: a = "CKM_X9_42_DH_HYBRID_DERIVE"; break; | ||||
| 610 | CASE(CKM_X9_42_DH_KEY_PAIR_GEN)case 0x00000030UL: a = "CKM_X9_42_DH_KEY_PAIR_GEN"; break; | ||||
| 611 | CASE(CKM_X9_42_DH_PARAMETER_GEN)case 0x00002002UL: a = "CKM_X9_42_DH_PARAMETER_GEN"; break; | ||||
| 612 | CASE(CKM_X9_42_MQV_DERIVE)case 0x00000033UL: a = "CKM_X9_42_MQV_DERIVE"; break; | ||||
| 613 | CASE(CKM_XOR_BASE_AND_DATA)case 0x00000364UL: a = "CKM_XOR_BASE_AND_DATA"; break; | ||||
| 614 | default: | ||||
| 615 | break; | ||||
| 616 | } | ||||
| 617 | if (a) | ||||
| 618 | PR_LOG(modlog, 4, (" mechanism = %s", a))do { if (((modlog)->level >= (4))) { PR_LogPrint (" mechanism = %s" , a); } } while (0); | ||||
| 619 | else | ||||
| 620 | PR_LOG(modlog, 4, (" mechanism = 0x%p", m->mechanism))do { if (((modlog)->level >= (4))) { PR_LogPrint (" mechanism = 0x%p" , m->mechanism); } } while (0); | ||||
| 621 | } | ||||
| 622 | |||||
| 623 | static void | ||||
| 624 | get_key_type(CK_KEY_TYPE keyType, char *str, int len) | ||||
| 625 | { | ||||
| 626 | |||||
| 627 | const char *a = NULL((void*)0); | ||||
| 628 | |||||
| 629 | switch (keyType) { | ||||
| 630 | CASE(CKK_AES)case 0x0000001FUL: a = "CKK_AES"; break; | ||||
| 631 | CASE(CKK_CAMELLIA)case 0x00000025UL: a = "CKK_CAMELLIA"; break; | ||||
| 632 | CASE(CKK_CDMF)case 0x0000001EUL: a = "CKK_CDMF"; break; | ||||
| 633 | CASE(CKK_DES)case 0x00000013UL: a = "CKK_DES"; break; | ||||
| 634 | CASE(CKK_DES2)case 0x00000014UL: a = "CKK_DES2"; break; | ||||
| 635 | CASE(CKK_DES3)case 0x00000015UL: a = "CKK_DES3"; break; | ||||
| 636 | CASE(CKK_DH)case 0x00000002UL: a = "CKK_DH"; break; | ||||
| 637 | CASE(CKK_DSA)case 0x00000001UL: a = "CKK_DSA"; break; | ||||
| 638 | CASE(CKK_EC)case 0x00000003UL: a = "CKK_EC"; break; /* also CASE(CKK_ECDSA); */ | ||||
| 639 | CASE(CKK_GENERIC_SECRET)case 0x00000010UL: a = "CKK_GENERIC_SECRET"; break; | ||||
| 640 | CASE(CKK_IDEA)case 0x0000001AUL: a = "CKK_IDEA"; break; | ||||
| 641 | CASE(CKK_INVALID_KEY_TYPE)case 0xffffffffUL: a = "CKK_INVALID_KEY_TYPE"; break; | ||||
| 642 | CASE(CKK_KEA)case 0x00000005UL: a = "CKK_KEA"; break; | ||||
| 643 | CASE(CKK_RC2)case 0x00000011UL: a = "CKK_RC2"; break; | ||||
| 644 | CASE(CKK_RC4)case 0x00000012UL: a = "CKK_RC4"; break; | ||||
| 645 | CASE(CKK_RC5)case 0x00000019UL: a = "CKK_RC5"; break; | ||||
| 646 | CASE(CKK_RSA)case 0x00000000UL: a = "CKK_RSA"; break; | ||||
| 647 | CASE(CKK_SKIPJACK)case 0x0000001BUL: a = "CKK_SKIPJACK"; break; | ||||
| 648 | CASE(CKK_TWOFISH)case 0x00000021UL: a = "CKK_TWOFISH"; break; | ||||
| 649 | CASE(CKK_X9_42_DH)case 0x00000004UL: a = "CKK_X9_42_DH"; break; | ||||
| 650 | CASE(CKK_MD5_HMAC)case 0x00000027UL: a = "CKK_MD5_HMAC"; break; | ||||
| 651 | CASE(CKK_SHA_1_HMAC)case 0x00000028UL: a = "CKK_SHA_1_HMAC"; break; | ||||
| 652 | CASE(CKK_RIPEMD128_HMAC)case 0x00000029UL: a = "CKK_RIPEMD128_HMAC"; break; | ||||
| 653 | CASE(CKK_RIPEMD160_HMAC)case 0x0000002AUL: a = "CKK_RIPEMD160_HMAC"; break; | ||||
| 654 | CASE(CKK_SHA256_HMAC)case 0x0000002BUL: a = "CKK_SHA256_HMAC"; break; | ||||
| 655 | CASE(CKK_SHA384_HMAC)case 0x0000002CUL: a = "CKK_SHA384_HMAC"; break; | ||||
| 656 | CASE(CKK_SHA512_HMAC)case 0x0000002DUL: a = "CKK_SHA512_HMAC"; break; | ||||
| 657 | CASE(CKK_SHA224_HMAC)case 0x0000002EUL: a = "CKK_SHA224_HMAC"; break; | ||||
| 658 | CASE(CKK_GOSTR3410)case 0x00000030UL: a = "CKK_GOSTR3410"; break; | ||||
| 659 | CASE(CKK_GOSTR3411)case 0x00000031UL: a = "CKK_GOSTR3411"; break; | ||||
| 660 | CASE(CKK_GOST28147)case 0x00000032UL: a = "CKK_GOST28147"; break; | ||||
| 661 | CASE(CKK_CHACHA20)case 0x00000033UL: a = "CKK_CHACHA20"; break; | ||||
| 662 | CASE(CKK_POLY1305)case 0x00000034UL: a = "CKK_POLY1305"; break; | ||||
| 663 | CASE(CKK_AES_XTS)case 0x00000035UL: a = "CKK_AES_XTS"; break; | ||||
| 664 | CASE(CKK_SHA3_224_HMAC)case 0x00000036UL: a = "CKK_SHA3_224_HMAC"; break; | ||||
| 665 | CASE(CKK_SHA3_256_HMAC)case 0x00000037UL: a = "CKK_SHA3_256_HMAC"; break; | ||||
| 666 | CASE(CKK_SHA3_384_HMAC)case 0x00000038UL: a = "CKK_SHA3_384_HMAC"; break; | ||||
| 667 | CASE(CKK_SHA3_512_HMAC)case 0x00000039UL: a = "CKK_SHA3_512_HMAC"; break; | ||||
| 668 | CASE(CKK_BLAKE2B_160_HMAC)case 0x0000003aUL: a = "CKK_BLAKE2B_160_HMAC"; break; | ||||
| 669 | CASE(CKK_BLAKE2B_256_HMAC)case 0x0000003bUL: a = "CKK_BLAKE2B_256_HMAC"; break; | ||||
| 670 | CASE(CKK_BLAKE2B_384_HMAC)case 0x0000003cUL: a = "CKK_BLAKE2B_384_HMAC"; break; | ||||
| 671 | CASE(CKK_BLAKE2B_512_HMAC)case 0x0000003dUL: a = "CKK_BLAKE2B_512_HMAC"; break; | ||||
| 672 | CASE(CKK_SALSA20)case 0x0000003eUL: a = "CKK_SALSA20"; break; | ||||
| 673 | CASE(CKK_X2RATCHET)case 0x0000003fUL: a = "CKK_X2RATCHET"; break; | ||||
| 674 | CASE(CKK_EC_EDWARDS)case 0x00000040UL: a = "CKK_EC_EDWARDS"; break; | ||||
| 675 | CASE(CKK_EC_MONTGOMERY)case 0x00000041UL: a = "CKK_EC_MONTGOMERY"; break; | ||||
| 676 | CASE(CKK_HKDF)case 0x00000042UL: a = "CKK_HKDF"; break; | ||||
| 677 | CASE(CKK_SHA512_224_HMAC)case 0x00000043UL: a = "CKK_SHA512_224_HMAC"; break; | ||||
| 678 | CASE(CKK_SHA512_256_HMAC)case 0x00000044UL: a = "CKK_SHA512_256_HMAC"; break; | ||||
| 679 | CASE(CKK_SHA512_T_HMAC)case 0x00000045UL: a = "CKK_SHA512_T_HMAC"; break; | ||||
| 680 | default: | ||||
| 681 | break; | ||||
| 682 | } | ||||
| 683 | if (a) | ||||
| 684 | PR_snprintf(str, len, "%s", a); | ||||
| 685 | else | ||||
| 686 | PR_snprintf(str, len, "0x%p", keyType); | ||||
| 687 | } | ||||
| 688 | |||||
| 689 | static void | ||||
| 690 | print_attr_value(CK_ATTRIBUTE_PTR attr) | ||||
| 691 | { | ||||
| 692 | char atype[48]; | ||||
| 693 | char valstr[49]; | ||||
| 694 | int len; | ||||
| 695 | |||||
| 696 | get_attr_type_str(attr->type, atype, sizeof atype); | ||||
| 697 | switch (attr->type) { | ||||
| 698 | case CKA_ALWAYS_SENSITIVE0x00000165UL: | ||||
| 699 | case CKA_DECRYPT0x00000105UL: | ||||
| 700 | case CKA_DERIVE0x0000010CUL: | ||||
| 701 | case CKA_ENCRYPT0x00000104UL: | ||||
| 702 | case CKA_EXTRACTABLE0x00000162UL: | ||||
| 703 | case CKA_LOCAL0x00000163UL: | ||||
| 704 | case CKA_MODIFIABLE0x00000170UL: | ||||
| 705 | case CKA_NEVER_EXTRACTABLE0x00000164UL: | ||||
| 706 | case CKA_PRIVATE0x00000002UL: | ||||
| 707 | case CKA_SENSITIVE0x00000103UL: | ||||
| 708 | case CKA_SIGN0x00000108UL: | ||||
| 709 | case CKA_SIGN_RECOVER0x00000109UL: | ||||
| 710 | case CKA_TOKEN0x00000001UL: | ||||
| 711 | case CKA_UNWRAP0x00000107UL: | ||||
| 712 | case CKA_VERIFY0x0000010AUL: | ||||
| 713 | case CKA_VERIFY_RECOVER0x0000010BUL: | ||||
| 714 | case CKA_WRAP0x00000106UL: | ||||
| 715 | if (attr->ulValueLen > 0 && attr->pValue) { | ||||
| 716 | CK_BBOOL tf = *((CK_BBOOL *)attr->pValue); | ||||
| 717 | PR_LOG(modlog, 4, (fmt_s_s_d, atype, tf ? "CK_TRUE" : "CK_FALSE", attr->ulValueLen))do { if (((modlog)->level >= (4))) { PR_LogPrint (fmt_s_s_d , atype, tf ? "CK_TRUE" : "CK_FALSE", attr->ulValueLen); } } while (0); | ||||
| 718 | break; | ||||
| 719 | } | ||||
| 720 | case CKA_CLASS0x00000000UL: | ||||
| 721 | if (attr->ulValueLen > 0 && attr->pValue) { | ||||
| 722 | CK_OBJECT_CLASS objClass = *((CK_OBJECT_CLASS *)attr->pValue); | ||||
| 723 | get_obj_class(objClass, valstr, sizeof valstr); | ||||
| 724 | PR_LOG(modlog, 4, (fmt_s_s_d, atype, valstr, attr->ulValueLen))do { if (((modlog)->level >= (4))) { PR_LogPrint (fmt_s_s_d , atype, valstr, attr->ulValueLen); } } while (0); | ||||
| 725 | break; | ||||
| 726 | } | ||||
| 727 | case CKA_TRUST_CLIENT_AUTH(((0x80000000UL | 0x4E534350) + 0x2000) + 9): | ||||
| 728 | case CKA_TRUST_CODE_SIGNING(((0x80000000UL | 0x4E534350) + 0x2000) + 10): | ||||
| 729 | case CKA_TRUST_EMAIL_PROTECTION(((0x80000000UL | 0x4E534350) + 0x2000) + 11): | ||||
| 730 | case CKA_TRUST_SERVER_AUTH(((0x80000000UL | 0x4E534350) + 0x2000) + 8): | ||||
| 731 | if (attr->ulValueLen > 0 && attr->pValue) { | ||||
| 732 | CK_TRUST trust = *((CK_TRUST *)attr->pValue); | ||||
| 733 | get_trust_val(trust, valstr, sizeof valstr); | ||||
| 734 | PR_LOG(modlog, 4, (fmt_s_s_d, atype, valstr, attr->ulValueLen))do { if (((modlog)->level >= (4))) { PR_LogPrint (fmt_s_s_d , atype, valstr, attr->ulValueLen); } } while (0); | ||||
| 735 | break; | ||||
| 736 | } | ||||
| 737 | case CKA_KEY_TYPE0x00000100UL: | ||||
| 738 | if (attr->ulValueLen > 0 && attr->pValue) { | ||||
| 739 | CK_KEY_TYPE keyType = *((CK_KEY_TYPE *)attr->pValue); | ||||
| 740 | get_key_type(keyType, valstr, sizeof valstr); | ||||
| 741 | PR_LOG(modlog, 4, (fmt_s_s_d, atype, valstr, attr->ulValueLen))do { if (((modlog)->level >= (4))) { PR_LogPrint (fmt_s_s_d , atype, valstr, attr->ulValueLen); } } while (0); | ||||
| 742 | break; | ||||
| 743 | } | ||||
| 744 | case CKA_PIXEL_X0x00000400UL: | ||||
| 745 | case CKA_PIXEL_Y0x00000401UL: | ||||
| 746 | case CKA_RESOLUTION0x00000402UL: | ||||
| 747 | case CKA_CHAR_ROWS0x00000403UL: | ||||
| 748 | case CKA_CHAR_COLUMNS0x00000404UL: | ||||
| 749 | case CKA_BITS_PER_PIXEL0x00000406UL: | ||||
| 750 | case CKA_CERTIFICATE_CATEGORY0x00000087UL: /* should print as enum/string */ | ||||
| 751 | case CKA_JAVA_MIDP_SECURITY_DOMAIN0x00000088UL: /* should print as enum/string */ | ||||
| 752 | case CKA_MODULUS_BITS0x00000121UL: | ||||
| 753 | case CKA_PRIME_BITS0x00000133UL: | ||||
| 754 | case CKA_SUBPRIME_BITS0x00000134UL: | ||||
| 755 | case CKA_VALUE_BITS0x00000160UL: | ||||
| 756 | case CKA_VALUE_LEN0x00000161UL: | ||||
| 757 | if (attr->ulValueLen > 0 && attr->pValue) { | ||||
| 758 | CK_ULONG valueLen = *((CK_ULONG *)attr->pValue); | ||||
| 759 | /* XXX check for the special value CK_UNAVAILABLE_INFORMATION */ | ||||
| 760 | PR_LOG(modlog, 4, (fmt_s_lu, atype, (PRUint32)valueLen))do { if (((modlog)->level >= (4))) { PR_LogPrint (fmt_s_lu , atype, (PRUint32)valueLen); } } while (0); | ||||
| 761 | break; | ||||
| 762 | } | ||||
| 763 | case CKA_LABEL0x00000003UL: | ||||
| 764 | case CKA_NSS_EMAIL((0x80000000UL | 0x4E534350) + 2): | ||||
| 765 | case CKA_NSS_URL((0x80000000UL | 0x4E534350) + 1): | ||||
| 766 | if (attr->ulValueLen > 0 && attr->pValue) { | ||||
| 767 | len = PR_MIN(attr->ulValueLen + 1, sizeof valstr)((attr->ulValueLen + 1)<(sizeof valstr)?(attr->ulValueLen + 1):(sizeof valstr)); | ||||
| 768 | PR_snprintf(valstr, len, "%s", attr->pValue); | ||||
| 769 | PR_LOG(modlog, 4, (fmt_s_qsq_d, atype, valstr, attr->ulValueLen))do { if (((modlog)->level >= (4))) { PR_LogPrint (fmt_s_qsq_d , atype, valstr, attr->ulValueLen); } } while (0); | ||||
| 770 | break; | ||||
| 771 | } | ||||
| 772 | case CKA_PROFILE_ID0x00000601UL: | ||||
| 773 | if (attr->ulValueLen > 0 && attr->pValue) { | ||||
| 774 | CK_PROFILE_ID profile = *((CK_PROFILE_ID *)attr->pValue); | ||||
| 775 | get_profile_val(profile, valstr, sizeof valstr); | ||||
| 776 | PR_LOG(modlog, 4, (fmt_s_s_d, atype, valstr, attr->ulValueLen))do { if (((modlog)->level >= (4))) { PR_LogPrint (fmt_s_s_d , atype, valstr, attr->ulValueLen); } } while (0); | ||||
| 777 | break; | ||||
| 778 | } | ||||
| 779 | case CKA_ISSUER0x00000081UL: | ||||
| 780 | case CKA_SUBJECT0x00000101UL: | ||||
| 781 | if (attr->ulValueLen > 0 && attr->pValue) { | ||||
| 782 | char *asciiName; | ||||
| 783 | SECItem derName; | ||||
| 784 | derName.type = siDERNameBuffer; | ||||
| 785 | derName.data = attr->pValue; | ||||
| 786 | derName.len = attr->ulValueLen; | ||||
| 787 | asciiName = CERT_DerNameToAscii(&derName); | ||||
| 788 | if (asciiName) { | ||||
| 789 | PR_LOG(modlog, 4, (fmt_s_s_d, atype, asciiName, attr->ulValueLen))do { if (((modlog)->level >= (4))) { PR_LogPrint (fmt_s_s_d , atype, asciiName, attr->ulValueLen); } } while (0); | ||||
| 790 | PORT_FreePORT_Free_Util(asciiName); | ||||
| 791 | break; | ||||
| 792 | } | ||||
| 793 | /* else treat like a binary buffer */ | ||||
| 794 | goto binary_buffer; | ||||
| 795 | } | ||||
| 796 | case CKA_ID0x00000102UL: | ||||
| 797 | if (attr->ulValueLen > 0 && attr->pValue) { | ||||
| 798 | unsigned char *pV = attr->pValue; | ||||
| 799 | for (len = (int)attr->ulValueLen; len > 0; --len) { | ||||
| 800 | unsigned int ch = *pV++; | ||||
| 801 | if (ch >= 0x20 && ch < 0x7f) | ||||
| 802 | continue; | ||||
| 803 | if (!ch && len == 1) /* will ignore NUL if last character */ | ||||
| 804 | continue; | ||||
| 805 | break; | ||||
| 806 | } | ||||
| 807 | if (!len) { /* entire string is printable */ | ||||
| 808 | len = PR_MIN(attr->ulValueLen + 1, sizeof valstr)((attr->ulValueLen + 1)<(sizeof valstr)?(attr->ulValueLen + 1):(sizeof valstr)); | ||||
| 809 | PR_snprintf(valstr, len, "%s", attr->pValue); | ||||
| 810 | PR_LOG(modlog, 4, (fmt_s_qsq_d, atype, valstr, attr->ulValueLen))do { if (((modlog)->level >= (4))) { PR_LogPrint (fmt_s_qsq_d , atype, valstr, attr->ulValueLen); } } while (0); | ||||
| 811 | break; | ||||
| 812 | } | ||||
| 813 | /* else fall through and treat like a binary buffer */ | ||||
| 814 | } | ||||
| 815 | binary_buffer: | ||||
| 816 | case CKA_SERIAL_NUMBER0x00000082UL: | ||||
| 817 | default: | ||||
| 818 | if (attr->ulValueLen > 0 && attr->pValue) { | ||||
| 819 | char *hexBuf; | ||||
| 820 | SECItem attrBuf; | ||||
| 821 | attrBuf.type = siDERNameBuffer; | ||||
| 822 | attrBuf.data = attr->pValue; | ||||
| 823 | attrBuf.len = PR_MIN(attr->ulValueLen, (sizeof valstr) / 2)((attr->ulValueLen)<((sizeof valstr) / 2)?(attr->ulValueLen ):((sizeof valstr) / 2)); | ||||
| 824 | |||||
| 825 | hexBuf = CERT_Hexify(&attrBuf, PR_FALSE0); | ||||
| 826 | if (hexBuf) { | ||||
| 827 | PR_LOG(modlog, 4, (fmt_s_s_d, atype, hexBuf, attr->ulValueLen))do { if (((modlog)->level >= (4))) { PR_LogPrint (fmt_s_s_d , atype, hexBuf, attr->ulValueLen); } } while (0); | ||||
| 828 | PORT_FreePORT_Free_Util(hexBuf); | ||||
| 829 | break; | ||||
| 830 | } | ||||
| 831 | /* else fall through and show only the address. :( */ | ||||
| 832 | } | ||||
| 833 | PR_LOG(modlog, 4, (" %s = [0x%p] [%d]", atype, attr->pValue, attr->ulValueLen))do { if (((modlog)->level >= (4))) { PR_LogPrint (" %s = [0x%p] [%d]" , atype, attr->pValue, attr->ulValueLen); } } while (0); | ||||
| 834 | break; | ||||
| 835 | } | ||||
| 836 | } | ||||
| 837 | |||||
| 838 | static void | ||||
| 839 | print_template(CK_ATTRIBUTE_PTR templ, CK_ULONG tlen) | ||||
| 840 | { | ||||
| 841 | CK_ULONG i; | ||||
| 842 | for (i = 0; i < tlen; i++) { | ||||
| 843 | print_attr_value(&templ[i]); | ||||
| 844 | } | ||||
| 845 | } | ||||
| 846 | |||||
| 847 | struct nssdbg_prof_str { | ||||
| 848 | PRUint32 time; | ||||
| 849 | PRUint32 calls; | ||||
| 850 | char *function; | ||||
| 851 | }; | ||||
| 852 | |||||
| 853 | #define NSSDBG_DEFINE(func){ 0, 0, "func" } \ | ||||
| 854 | { \ | ||||
| 855 | 0, 0, #func \ | ||||
| 856 | } | ||||
| 857 | |||||
| 858 | struct nssdbg_prof_str nssdbg_prof_data[] = { | ||||
| 859 | #define FUNC_C_INITIALIZE0 0 | ||||
| 860 | NSSDBG_DEFINE(C_Initialize){ 0, 0, "C_Initialize" }, | ||||
| 861 | #define FUNC_C_FINALIZE1 1 | ||||
| 862 | NSSDBG_DEFINE(C_Finalize){ 0, 0, "C_Finalize" }, | ||||
| 863 | #define FUNC_C_GETINFO2 2 | ||||
| 864 | NSSDBG_DEFINE(C_GetInfo){ 0, 0, "C_GetInfo" }, | ||||
| 865 | #define FUNC_C_GETFUNCITONLIST3 3 | ||||
| 866 | NSSDBG_DEFINE(C_GetFunctionList){ 0, 0, "C_GetFunctionList" }, | ||||
| 867 | #define FUNC_C_GETSLOTLIST4 4 | ||||
| 868 | NSSDBG_DEFINE(C_GetSlotList){ 0, 0, "C_GetSlotList" }, | ||||
| 869 | #define FUNC_C_GETSLOTINFO5 5 | ||||
| 870 | NSSDBG_DEFINE(C_GetSlotInfo){ 0, 0, "C_GetSlotInfo" }, | ||||
| 871 | #define FUNC_C_GETTOKENINFO6 6 | ||||
| 872 | NSSDBG_DEFINE(C_GetTokenInfo){ 0, 0, "C_GetTokenInfo" }, | ||||
| 873 | #define FUNC_C_GETMECHANISMLIST7 7 | ||||
| 874 | NSSDBG_DEFINE(C_GetMechanismList){ 0, 0, "C_GetMechanismList" }, | ||||
| 875 | #define FUNC_C_GETMECHANISMINFO8 8 | ||||
| 876 | NSSDBG_DEFINE(C_GetMechanismInfo){ 0, 0, "C_GetMechanismInfo" }, | ||||
| 877 | #define FUNC_C_INITTOKEN9 9 | ||||
| 878 | NSSDBG_DEFINE(C_InitToken){ 0, 0, "C_InitToken" }, | ||||
| 879 | #define FUNC_C_INITPIN10 10 | ||||
| 880 | NSSDBG_DEFINE(C_InitPIN){ 0, 0, "C_InitPIN" }, | ||||
| 881 | #define FUNC_C_SETPIN11 11 | ||||
| 882 | NSSDBG_DEFINE(C_SetPIN){ 0, 0, "C_SetPIN" }, | ||||
| 883 | #define FUNC_C_OPENSESSION12 12 | ||||
| 884 | NSSDBG_DEFINE(C_OpenSession){ 0, 0, "C_OpenSession" }, | ||||
| 885 | #define FUNC_C_CLOSESESSION13 13 | ||||
| 886 | NSSDBG_DEFINE(C_CloseSession){ 0, 0, "C_CloseSession" }, | ||||
| 887 | #define FUNC_C_CLOSEALLSESSIONS14 14 | ||||
| 888 | NSSDBG_DEFINE(C_CloseAllSessions){ 0, 0, "C_CloseAllSessions" }, | ||||
| 889 | #define FUNC_C_GETSESSIONINFO15 15 | ||||
| 890 | NSSDBG_DEFINE(C_GetSessionInfo){ 0, 0, "C_GetSessionInfo" }, | ||||
| 891 | #define FUNC_C_GETOPERATIONSTATE16 16 | ||||
| 892 | NSSDBG_DEFINE(C_GetOperationState){ 0, 0, "C_GetOperationState" }, | ||||
| 893 | #define FUNC_C_SETOPERATIONSTATE17 17 | ||||
| 894 | NSSDBG_DEFINE(C_SetOperationState){ 0, 0, "C_SetOperationState" }, | ||||
| 895 | #define FUNC_C_LOGIN18 18 | ||||
| 896 | NSSDBG_DEFINE(C_Login){ 0, 0, "C_Login" }, | ||||
| 897 | #define FUNC_C_LOGOUT19 19 | ||||
| 898 | NSSDBG_DEFINE(C_Logout){ 0, 0, "C_Logout" }, | ||||
| 899 | #define FUNC_C_CREATEOBJECT20 20 | ||||
| 900 | NSSDBG_DEFINE(C_CreateObject){ 0, 0, "C_CreateObject" }, | ||||
| 901 | #define FUNC_C_COPYOBJECT21 21 | ||||
| 902 | NSSDBG_DEFINE(C_CopyObject){ 0, 0, "C_CopyObject" }, | ||||
| 903 | #define FUNC_C_DESTROYOBJECT22 22 | ||||
| 904 | NSSDBG_DEFINE(C_DestroyObject){ 0, 0, "C_DestroyObject" }, | ||||
| 905 | #define FUNC_C_GETOBJECTSIZE23 23 | ||||
| 906 | NSSDBG_DEFINE(C_GetObjectSize){ 0, 0, "C_GetObjectSize" }, | ||||
| 907 | #define FUNC_C_GETATTRIBUTEVALUE24 24 | ||||
| 908 | NSSDBG_DEFINE(C_GetAttributeValue){ 0, 0, "C_GetAttributeValue" }, | ||||
| 909 | #define FUNC_C_SETATTRIBUTEVALUE25 25 | ||||
| 910 | NSSDBG_DEFINE(C_SetAttributeValue){ 0, 0, "C_SetAttributeValue" }, | ||||
| 911 | #define FUNC_C_FINDOBJECTSINIT26 26 | ||||
| 912 | NSSDBG_DEFINE(C_FindObjectsInit){ 0, 0, "C_FindObjectsInit" }, | ||||
| 913 | #define FUNC_C_FINDOBJECTS27 27 | ||||
| 914 | NSSDBG_DEFINE(C_FindObjects){ 0, 0, "C_FindObjects" }, | ||||
| 915 | #define FUNC_C_FINDOBJECTSFINAL28 28 | ||||
| 916 | NSSDBG_DEFINE(C_FindObjectsFinal){ 0, 0, "C_FindObjectsFinal" }, | ||||
| 917 | #define FUNC_C_ENCRYPTINIT29 29 | ||||
| 918 | NSSDBG_DEFINE(C_EncryptInit){ 0, 0, "C_EncryptInit" }, | ||||
| 919 | #define FUNC_C_ENCRYPT30 30 | ||||
| 920 | NSSDBG_DEFINE(C_Encrypt){ 0, 0, "C_Encrypt" }, | ||||
| 921 | #define FUNC_C_ENCRYPTUPDATE31 31 | ||||
| 922 | NSSDBG_DEFINE(C_EncryptUpdate){ 0, 0, "C_EncryptUpdate" }, | ||||
| 923 | #define FUNC_C_ENCRYPTFINAL32 32 | ||||
| 924 | NSSDBG_DEFINE(C_EncryptFinal){ 0, 0, "C_EncryptFinal" }, | ||||
| 925 | #define FUNC_C_DECRYPTINIT33 33 | ||||
| 926 | NSSDBG_DEFINE(C_DecryptInit){ 0, 0, "C_DecryptInit" }, | ||||
| 927 | #define FUNC_C_DECRYPT34 34 | ||||
| 928 | NSSDBG_DEFINE(C_Decrypt){ 0, 0, "C_Decrypt" }, | ||||
| 929 | #define FUNC_C_DECRYPTUPDATE35 35 | ||||
| 930 | NSSDBG_DEFINE(C_DecryptUpdate){ 0, 0, "C_DecryptUpdate" }, | ||||
| 931 | #define FUNC_C_DECRYPTFINAL36 36 | ||||
| 932 | NSSDBG_DEFINE(C_DecryptFinal){ 0, 0, "C_DecryptFinal" }, | ||||
| 933 | #define FUNC_C_DIGESTINIT37 37 | ||||
| 934 | NSSDBG_DEFINE(C_DigestInit){ 0, 0, "C_DigestInit" }, | ||||
| 935 | #define FUNC_C_DIGEST38 38 | ||||
| 936 | NSSDBG_DEFINE(C_Digest){ 0, 0, "C_Digest" }, | ||||
| 937 | #define FUNC_C_DIGESTUPDATE39 39 | ||||
| 938 | NSSDBG_DEFINE(C_DigestUpdate){ 0, 0, "C_DigestUpdate" }, | ||||
| 939 | #define FUNC_C_DIGESTKEY40 40 | ||||
| 940 | NSSDBG_DEFINE(C_DigestKey){ 0, 0, "C_DigestKey" }, | ||||
| 941 | #define FUNC_C_DIGESTFINAL41 41 | ||||
| 942 | NSSDBG_DEFINE(C_DigestFinal){ 0, 0, "C_DigestFinal" }, | ||||
| 943 | #define FUNC_C_SIGNINIT42 42 | ||||
| 944 | NSSDBG_DEFINE(C_SignInit){ 0, 0, "C_SignInit" }, | ||||
| 945 | #define FUNC_C_SIGN43 43 | ||||
| 946 | NSSDBG_DEFINE(C_Sign){ 0, 0, "C_Sign" }, | ||||
| 947 | #define FUNC_C_SIGNUPDATE44 44 | ||||
| 948 | NSSDBG_DEFINE(C_SignUpdate){ 0, 0, "C_SignUpdate" }, | ||||
| 949 | #define FUNC_C_SIGNFINAL45 45 | ||||
| 950 | NSSDBG_DEFINE(C_SignFinal){ 0, 0, "C_SignFinal" }, | ||||
| 951 | #define FUNC_C_SIGNRECOVERINIT46 46 | ||||
| 952 | NSSDBG_DEFINE(C_SignRecoverInit){ 0, 0, "C_SignRecoverInit" }, | ||||
| 953 | #define FUNC_C_SIGNRECOVER47 47 | ||||
| 954 | NSSDBG_DEFINE(C_SignRecover){ 0, 0, "C_SignRecover" }, | ||||
| 955 | #define FUNC_C_VERIFYINIT48 48 | ||||
| 956 | NSSDBG_DEFINE(C_VerifyInit){ 0, 0, "C_VerifyInit" }, | ||||
| 957 | #define FUNC_C_VERIFY49 49 | ||||
| 958 | NSSDBG_DEFINE(C_Verify){ 0, 0, "C_Verify" }, | ||||
| 959 | #define FUNC_C_VERIFYUPDATE50 50 | ||||
| 960 | NSSDBG_DEFINE(C_VerifyUpdate){ 0, 0, "C_VerifyUpdate" }, | ||||
| 961 | #define FUNC_C_VERIFYFINAL51 51 | ||||
| 962 | NSSDBG_DEFINE(C_VerifyFinal){ 0, 0, "C_VerifyFinal" }, | ||||
| 963 | #define FUNC_C_VERIFYRECOVERINIT52 52 | ||||
| 964 | NSSDBG_DEFINE(C_VerifyRecoverInit){ 0, 0, "C_VerifyRecoverInit" }, | ||||
| 965 | #define FUNC_C_VERIFYRECOVER53 53 | ||||
| 966 | NSSDBG_DEFINE(C_VerifyRecover){ 0, 0, "C_VerifyRecover" }, | ||||
| 967 | #define FUNC_C_DIGESTENCRYPTUPDATE54 54 | ||||
| 968 | NSSDBG_DEFINE(C_DigestEncryptUpdate){ 0, 0, "C_DigestEncryptUpdate" }, | ||||
| 969 | #define FUNC_C_DECRYPTDIGESTUPDATE55 55 | ||||
| 970 | NSSDBG_DEFINE(C_DecryptDigestUpdate){ 0, 0, "C_DecryptDigestUpdate" }, | ||||
| 971 | #define FUNC_C_SIGNENCRYPTUPDATE56 56 | ||||
| 972 | NSSDBG_DEFINE(C_SignEncryptUpdate){ 0, 0, "C_SignEncryptUpdate" }, | ||||
| 973 | #define FUNC_C_DECRYPTVERIFYUPDATE57 57 | ||||
| 974 | NSSDBG_DEFINE(C_DecryptVerifyUpdate){ 0, 0, "C_DecryptVerifyUpdate" }, | ||||
| 975 | #define FUNC_C_GENERATEKEY58 58 | ||||
| 976 | NSSDBG_DEFINE(C_GenerateKey){ 0, 0, "C_GenerateKey" }, | ||||
| 977 | #define FUNC_C_GENERATEKEYPAIR59 59 | ||||
| 978 | NSSDBG_DEFINE(C_GenerateKeyPair){ 0, 0, "C_GenerateKeyPair" }, | ||||
| 979 | #define FUNC_C_WRAPKEY60 60 | ||||
| 980 | NSSDBG_DEFINE(C_WrapKey){ 0, 0, "C_WrapKey" }, | ||||
| 981 | #define FUNC_C_UNWRAPKEY61 61 | ||||
| 982 | NSSDBG_DEFINE(C_UnWrapKey){ 0, 0, "C_UnWrapKey" }, | ||||
| 983 | #define FUNC_C_DERIVEKEY62 62 | ||||
| 984 | NSSDBG_DEFINE(C_DeriveKey){ 0, 0, "C_DeriveKey" }, | ||||
| 985 | #define FUNC_C_SEEDRANDOM63 63 | ||||
| 986 | NSSDBG_DEFINE(C_SeedRandom){ 0, 0, "C_SeedRandom" }, | ||||
| 987 | #define FUNC_C_GENERATERANDOM64 64 | ||||
| 988 | NSSDBG_DEFINE(C_GenerateRandom){ 0, 0, "C_GenerateRandom" }, | ||||
| 989 | #define FUNC_C_GETFUNCTIONSTATUS65 65 | ||||
| 990 | NSSDBG_DEFINE(C_GetFunctionStatus){ 0, 0, "C_GetFunctionStatus" }, | ||||
| 991 | #define FUNC_C_CANCELFUNCTION66 66 | ||||
| 992 | NSSDBG_DEFINE(C_CancelFunction){ 0, 0, "C_CancelFunction" }, | ||||
| 993 | #define FUNC_C_WAITFORSLOTEVENT67 67 | ||||
| 994 | NSSDBG_DEFINE(C_WaitForSlotEvent){ 0, 0, "C_WaitForSlotEvent" }, | ||||
| 995 | #define FUNC_C_GETINTERFACELIST68 68 | ||||
| 996 | NSSDBG_DEFINE(C_GetInterfaceList){ 0, 0, "C_GetInterfaceList" }, | ||||
| 997 | #define FUNC_C_GETINTERFACE69 69 | ||||
| 998 | NSSDBG_DEFINE(C_GetInterface){ 0, 0, "C_GetInterface" }, | ||||
| 999 | #define FUNC_C_LOGINUSER70 70 | ||||
| 1000 | NSSDBG_DEFINE(C_LoginUser){ 0, 0, "C_LoginUser" }, | ||||
| 1001 | #define FUNC_C_SESSIONCANCEL71 71 | ||||
| 1002 | NSSDBG_DEFINE(C_SessionCancel){ 0, 0, "C_SessionCancel" }, | ||||
| 1003 | #define FUNC_C_MESSAGEENCRYPTINIT72 72 | ||||
| 1004 | NSSDBG_DEFINE(C_MessageEncryptInit){ 0, 0, "C_MessageEncryptInit" }, | ||||
| 1005 | #define FUNC_C_ENCRYPTMESSAGE73 73 | ||||
| 1006 | NSSDBG_DEFINE(C_EncryptMessage){ 0, 0, "C_EncryptMessage" }, | ||||
| 1007 | #define FUNC_C_ENCRYPTMESSAGEBEGIN74 74 | ||||
| 1008 | NSSDBG_DEFINE(C_EncryptMessageBegin){ 0, 0, "C_EncryptMessageBegin" }, | ||||
| 1009 | #define FUNC_C_ENCRYPTMESSAGENEXT75 75 | ||||
| 1010 | NSSDBG_DEFINE(C_EncryptMessageNext){ 0, 0, "C_EncryptMessageNext" }, | ||||
| 1011 | #define FUNC_C_MESSAGEENCRYPTFINAL76 76 | ||||
| 1012 | NSSDBG_DEFINE(C_MessageEncryptFinal){ 0, 0, "C_MessageEncryptFinal" }, | ||||
| 1013 | #define FUNC_C_MESSAGEDECRYPTINIT77 77 | ||||
| 1014 | NSSDBG_DEFINE(C_MessageDecryptInit){ 0, 0, "C_MessageDecryptInit" }, | ||||
| 1015 | #define FUNC_C_DECRYPTMESSAGE78 78 | ||||
| 1016 | NSSDBG_DEFINE(C_DecryptMessage){ 0, 0, "C_DecryptMessage" }, | ||||
| 1017 | #define FUNC_C_DECRYPTMESSAGEBEGIN79 79 | ||||
| 1018 | NSSDBG_DEFINE(C_DecryptMessageBegin){ 0, 0, "C_DecryptMessageBegin" }, | ||||
| 1019 | #define FUNC_C_DECRYPTMESSAGENEXT80 80 | ||||
| 1020 | NSSDBG_DEFINE(C_DecryptMessageNext){ 0, 0, "C_DecryptMessageNext" }, | ||||
| 1021 | #define FUNC_C_MESSAGEDECRYPTFINAL81 81 | ||||
| 1022 | NSSDBG_DEFINE(C_MessageDecryptFinal){ 0, 0, "C_MessageDecryptFinal" }, | ||||
| 1023 | #define FUNC_C_MESSAGESIGNINIT82 82 | ||||
| 1024 | NSSDBG_DEFINE(C_MessageSignInit){ 0, 0, "C_MessageSignInit" }, | ||||
| 1025 | #define FUNC_C_SIGNMESSAGE83 83 | ||||
| 1026 | NSSDBG_DEFINE(C_SignMessage){ 0, 0, "C_SignMessage" }, | ||||
| 1027 | #define FUNC_C_SIGNMESSAGEBEGIN84 84 | ||||
| 1028 | NSSDBG_DEFINE(C_SignMessageBegin){ 0, 0, "C_SignMessageBegin" }, | ||||
| 1029 | #define FUNC_C_SIGNMESSAGENEXT85 85 | ||||
| 1030 | NSSDBG_DEFINE(C_SignMessageNext){ 0, 0, "C_SignMessageNext" }, | ||||
| 1031 | #define FUNC_C_MESSAGESIGNFINAL86 86 | ||||
| 1032 | NSSDBG_DEFINE(C_MessageSignFinal){ 0, 0, "C_MessageSignFinal" }, | ||||
| 1033 | #define FUNC_C_MESSAGEVERIFYINIT87 87 | ||||
| 1034 | NSSDBG_DEFINE(C_MessageVerifyInit){ 0, 0, "C_MessageVerifyInit" }, | ||||
| 1035 | #define FUNC_C_VERIFYMESSAGE88 88 | ||||
| 1036 | NSSDBG_DEFINE(C_VerifyMessage){ 0, 0, "C_VerifyMessage" }, | ||||
| 1037 | #define FUNC_C_VERIFYMESSAGEBEGIN89 89 | ||||
| 1038 | NSSDBG_DEFINE(C_VerifyMessageBegin){ 0, 0, "C_VerifyMessageBegin" }, | ||||
| 1039 | #define FUNC_C_VERIFYMESSAGENEXT90 90 | ||||
| 1040 | NSSDBG_DEFINE(C_VerifyMessageNext){ 0, 0, "C_VerifyMessageNext" }, | ||||
| 1041 | #define FUNC_C_MESSAGEVERIFYFINAL91 91 | ||||
| 1042 | NSSDBG_DEFINE(C_MessageVerifyFinal){ 0, 0, "C_MessageVerifyFinal" } | ||||
| 1043 | }; | ||||
| 1044 | |||||
| 1045 | int nssdbg_prof_size = sizeof(nssdbg_prof_data) / sizeof(nssdbg_prof_data[0]); | ||||
| 1046 | |||||
| 1047 | static void | ||||
| 1048 | nssdbg_finish_time(PRInt32 fun_number, PRIntervalTime start) | ||||
| 1049 | { | ||||
| 1050 | PRIntervalTime ival; | ||||
| 1051 | PRIntervalTime end = PR_IntervalNow(); | ||||
| 1052 | |||||
| 1053 | ival = end - start; | ||||
| 1054 | /* sigh, lie to PRAtomic add and say we are using signed values */ | ||||
| 1055 | PR_ATOMIC_ADD((PRInt32 *)&nssdbg_prof_data[fun_number].time, (PRInt32)ival)__sync_add_and_fetch((PRInt32 *)&nssdbg_prof_data[fun_number ].time, (PRInt32)ival); | ||||
| 1056 | } | ||||
| 1057 | |||||
| 1058 | static void | ||||
| 1059 | nssdbg_start_time(PRInt32 fun_number, PRIntervalTime *start) | ||||
| 1060 | { | ||||
| 1061 | PR_ATOMIC_INCREMENT((PRInt32 *)&nssdbg_prof_data[fun_number].calls)__sync_add_and_fetch((PRInt32 *)&nssdbg_prof_data[fun_number ].calls, 1); | ||||
| 1062 | *start = PR_IntervalNow(); | ||||
| 1063 | } | ||||
| 1064 | |||||
| 1065 | #define COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start \ | ||||
| 1066 | CK_RV rv; \ | ||||
| 1067 | PRIntervalTime start | ||||
| 1068 | |||||
| 1069 | CK_RV | ||||
| 1070 | NSSDBGC_Initialize( | ||||
| 1071 | CK_VOID_PTR pInitArgs) | ||||
| 1072 | { | ||||
| 1073 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 1074 | |||||
| 1075 | PR_LOG(modlog, 1, ("C_Initialize"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_Initialize" ); } } while (0); | ||||
| 1076 | PR_LOG(modlog, 3, (" pInitArgs = 0x%p", pInitArgs))do { if (((modlog)->level >= (3))) { PR_LogPrint (" pInitArgs = 0x%p" , pInitArgs); } } while (0); | ||||
| 1077 | nssdbg_start_time(FUNC_C_INITIALIZE0, &start); | ||||
| 1078 | rv = module_functions->C_Initialize(pInitArgs); | ||||
| 1079 | nssdbg_finish_time(FUNC_C_INITIALIZE0, start); | ||||
| 1080 | log_rv(rv); | ||||
| 1081 | return rv; | ||||
| 1082 | } | ||||
| 1083 | |||||
| 1084 | CK_RV | ||||
| 1085 | NSSDBGC_Finalize( | ||||
| 1086 | CK_VOID_PTR pReserved) | ||||
| 1087 | { | ||||
| 1088 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 1089 | |||||
| 1090 | PR_LOG(modlog, 1, ("C_Finalize"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_Finalize" ); } } while (0); | ||||
| 1091 | PR_LOG(modlog, 3, (" pReserved = 0x%p", pReserved))do { if (((modlog)->level >= (3))) { PR_LogPrint (" pReserved = 0x%p" , pReserved); } } while (0); | ||||
| 1092 | nssdbg_start_time(FUNC_C_FINALIZE1, &start); | ||||
| 1093 | rv = module_functions->C_Finalize(pReserved); | ||||
| 1094 | nssdbg_finish_time(FUNC_C_FINALIZE1, start); | ||||
| 1095 | log_rv(rv); | ||||
| 1096 | return rv; | ||||
| 1097 | } | ||||
| 1098 | |||||
| 1099 | CK_RV | ||||
| 1100 | NSSDBGC_GetInfo( | ||||
| 1101 | CK_INFO_PTR pInfo) | ||||
| 1102 | { | ||||
| 1103 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 1104 | |||||
| 1105 | PR_LOG(modlog, 1, ("C_GetInfo"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_GetInfo" ); } } while (0); | ||||
| 1106 | PR_LOG(modlog, 3, (fmt_pInfo, pInfo))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pInfo , pInfo); } } while (0); | ||||
| 1107 | nssdbg_start_time(FUNC_C_GETINFO2, &start); | ||||
| 1108 | rv = module_functions->C_GetInfo(pInfo); | ||||
| 1109 | nssdbg_finish_time(FUNC_C_GETINFO2, start); | ||||
| 1110 | if (rv == CKR_OK0x00000000UL) { | ||||
| 1111 | PR_LOG(modlog, 4, (" cryptoki version: %d.%d", pInfo->cryptokiVersion.major, pInfo->cryptokiVersion.minor))do { if (((modlog)->level >= (4))) { PR_LogPrint (" cryptoki version: %d.%d" , pInfo->cryptokiVersion.major, pInfo->cryptokiVersion. minor); } } while (0); | ||||
| 1112 | PR_LOG(modlog, 4, (fmt_manufacturerID, pInfo->manufacturerID))do { if (((modlog)->level >= (4))) { PR_LogPrint (fmt_manufacturerID , pInfo->manufacturerID); } } while (0); | ||||
| 1113 | PR_LOG(modlog, 4, (" library description = \"%.32s\"", pInfo->libraryDescription))do { if (((modlog)->level >= (4))) { PR_LogPrint (" library description = \"%.32s\"" , pInfo->libraryDescription); } } while (0); | ||||
| 1114 | PR_LOG(modlog, 4, (" library version: %d.%d", pInfo->libraryVersion.major, pInfo->libraryVersion.minor))do { if (((modlog)->level >= (4))) { PR_LogPrint (" library version: %d.%d" , pInfo->libraryVersion.major, pInfo->libraryVersion.minor ); } } while (0); | ||||
| 1115 | } | ||||
| 1116 | log_rv(rv); | ||||
| 1117 | return rv; | ||||
| 1118 | } | ||||
| 1119 | |||||
| 1120 | CK_RV | ||||
| 1121 | NSSDBGC_GetFunctionList( | ||||
| 1122 | CK_FUNCTION_LIST_PTR_PTR ppFunctionList) | ||||
| 1123 | { | ||||
| 1124 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 1125 | |||||
| 1126 | PR_LOG(modlog, 1, ("C_GetFunctionList"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_GetFunctionList" ); } } while (0); | ||||
| 1127 | PR_LOG(modlog, 3, (" ppFunctionList = 0x%p", ppFunctionList))do { if (((modlog)->level >= (3))) { PR_LogPrint (" ppFunctionList = 0x%p" , ppFunctionList); } } while (0); | ||||
| 1128 | nssdbg_start_time(FUNC_C_GETFUNCITONLIST3, &start); | ||||
| 1129 | rv = module_functions->C_GetFunctionList(ppFunctionList); | ||||
| 1130 | nssdbg_finish_time(FUNC_C_GETFUNCITONLIST3, start); | ||||
| 1131 | log_rv(rv); | ||||
| 1132 | return rv; | ||||
| 1133 | } | ||||
| 1134 | |||||
| 1135 | CK_RV | ||||
| 1136 | NSSDBGC_GetSlotList( | ||||
| 1137 | CK_BBOOL tokenPresent, | ||||
| 1138 | CK_SLOT_ID_PTR pSlotList, | ||||
| 1139 | CK_ULONG_PTR pulCount) | ||||
| 1140 | { | ||||
| 1141 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 1142 | |||||
| 1143 | CK_ULONG i; | ||||
| 1144 | PR_LOG(modlog, 1, ("C_GetSlotList"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_GetSlotList" ); } } while (0); | ||||
| 1145 | PR_LOG(modlog, 3, (" tokenPresent = 0x%x", tokenPresent))do { if (((modlog)->level >= (3))) { PR_LogPrint (" tokenPresent = 0x%x" , tokenPresent); } } while (0); | ||||
| 1146 | PR_LOG(modlog, 3, (" pSlotList = 0x%p", pSlotList))do { if (((modlog)->level >= (3))) { PR_LogPrint (" pSlotList = 0x%p" , pSlotList); } } while (0); | ||||
| 1147 | PR_LOG(modlog, 3, (fmt_pulCount, pulCount))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pulCount , pulCount); } } while (0); | ||||
| 1148 | nssdbg_start_time(FUNC_C_GETSLOTLIST4, &start); | ||||
| 1149 | rv = module_functions->C_GetSlotList(tokenPresent, pSlotList, pulCount); | ||||
| 1150 | nssdbg_finish_time(FUNC_C_GETSLOTLIST4, start); | ||||
| 1151 | PR_LOG(modlog, 4, (fmt_spulCount, *pulCount))do { if (((modlog)->level >= (4))) { PR_LogPrint (fmt_spulCount , *pulCount); } } while (0); | ||||
| 1152 | if (pSlotList) { | ||||
| 1153 | for (i = 0; i < *pulCount; i++) { | ||||
| 1154 | PR_LOG(modlog, 4, (" slotID[%d] = %x", i, pSlotList[i]))do { if (((modlog)->level >= (4))) { PR_LogPrint (" slotID[%d] = %x" , i, pSlotList[i]); } } while (0); | ||||
| 1155 | } | ||||
| 1156 | } | ||||
| 1157 | log_rv(rv); | ||||
| 1158 | return rv; | ||||
| 1159 | } | ||||
| 1160 | |||||
| 1161 | CK_RV | ||||
| 1162 | NSSDBGC_GetSlotInfo( | ||||
| 1163 | CK_SLOT_ID slotID, | ||||
| 1164 | CK_SLOT_INFO_PTR pInfo) | ||||
| 1165 | { | ||||
| 1166 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 1167 | |||||
| 1168 | PR_LOG(modlog, 1, ("C_GetSlotInfo"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_GetSlotInfo" ); } } while (0); | ||||
| 1169 | PR_LOG(modlog, 3, (fmt_slotID, slotID))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_slotID , slotID); } } while (0); | ||||
| 1170 | PR_LOG(modlog, 3, (fmt_pInfo, pInfo))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pInfo , pInfo); } } while (0); | ||||
| 1171 | nssdbg_start_time(FUNC_C_GETSLOTINFO5, &start); | ||||
| 1172 | rv = module_functions->C_GetSlotInfo(slotID, pInfo); | ||||
| 1173 | nssdbg_finish_time(FUNC_C_GETSLOTINFO5, start); | ||||
| 1174 | if (rv == CKR_OK0x00000000UL) { | ||||
| 1175 | PR_LOG(modlog, 4, (" slotDescription = \"%.64s\"", pInfo->slotDescription))do { if (((modlog)->level >= (4))) { PR_LogPrint (" slotDescription = \"%.64s\"" , pInfo->slotDescription); } } while (0); | ||||
| 1176 | PR_LOG(modlog, 4, (fmt_manufacturerID, pInfo->manufacturerID))do { if (((modlog)->level >= (4))) { PR_LogPrint (fmt_manufacturerID , pInfo->manufacturerID); } } while (0); | ||||
| 1177 | PR_LOG(modlog, 4, (" flags = %s %s %s", pInfo->flags & CKF_HW_SLOT ? "CKF_HW_SLOT" : "", pInfo->flags & CKF_REMOVABLE_DEVICE ? "CKF_REMOVABLE_DEVICE" : "", pInfo->flags & CKF_TOKEN_PRESENT ? "CKF_TOKEN_PRESENT" : ""))do { if (((modlog)->level >= (4))) { PR_LogPrint (" flags = %s %s %s" , pInfo->flags & 0x00000004UL ? "CKF_HW_SLOT" : "", pInfo ->flags & 0x00000002UL ? "CKF_REMOVABLE_DEVICE" : "", pInfo ->flags & 0x00000001UL ? "CKF_TOKEN_PRESENT" : ""); } } while (0); | ||||
| 1178 | PR_LOG(modlog, 4, (fmt_hwVersion, pInfo->hardwareVersion.major, pInfo->hardwareVersion.minor))do { if (((modlog)->level >= (4))) { PR_LogPrint (fmt_hwVersion , pInfo->hardwareVersion.major, pInfo->hardwareVersion. minor); } } while (0); | ||||
| 1179 | PR_LOG(modlog, 4, (fmt_fwVersion, pInfo->firmwareVersion.major, pInfo->firmwareVersion.minor))do { if (((modlog)->level >= (4))) { PR_LogPrint (fmt_fwVersion , pInfo->firmwareVersion.major, pInfo->firmwareVersion. minor); } } while (0); | ||||
| 1180 | } | ||||
| 1181 | log_rv(rv); | ||||
| 1182 | return rv; | ||||
| 1183 | } | ||||
| 1184 | |||||
| 1185 | CK_RV | ||||
| 1186 | NSSDBGC_GetTokenInfo( | ||||
| 1187 | CK_SLOT_ID slotID, | ||||
| 1188 | CK_TOKEN_INFO_PTR pInfo) | ||||
| 1189 | { | ||||
| 1190 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 1191 | |||||
| 1192 | PR_LOG(modlog, 1, ("C_GetTokenInfo"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_GetTokenInfo" ); } } while (0); | ||||
| 1193 | PR_LOG(modlog, 3, (fmt_slotID, slotID))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_slotID , slotID); } } while (0); | ||||
| 1194 | PR_LOG(modlog, 3, (fmt_pInfo, pInfo))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pInfo , pInfo); } } while (0); | ||||
| 1195 | nssdbg_start_time(FUNC_C_GETTOKENINFO6, &start); | ||||
| 1196 | rv = module_functions->C_GetTokenInfo(slotID, pInfo); | ||||
| 1197 | nssdbg_finish_time(FUNC_C_GETTOKENINFO6, start); | ||||
| 1198 | if (rv == CKR_OK0x00000000UL) { | ||||
| 1199 | PR_LOG(modlog, 4, (" label = \"%.32s\"", pInfo->label))do { if (((modlog)->level >= (4))) { PR_LogPrint (" label = \"%.32s\"" , pInfo->label); } } while (0); | ||||
| 1200 | PR_LOG(modlog, 4, (fmt_manufacturerID, pInfo->manufacturerID))do { if (((modlog)->level >= (4))) { PR_LogPrint (fmt_manufacturerID , pInfo->manufacturerID); } } while (0); | ||||
| 1201 | PR_LOG(modlog, 4, (" model = \"%.16s\"", pInfo->model))do { if (((modlog)->level >= (4))) { PR_LogPrint (" model = \"%.16s\"" , pInfo->model); } } while (0); | ||||
| 1202 | PR_LOG(modlog, 4, (" serial = \"%.16s\"", pInfo->serialNumber))do { if (((modlog)->level >= (4))) { PR_LogPrint (" serial = \"%.16s\"" , pInfo->serialNumber); } } while (0); | ||||
| 1203 | PR_LOG(modlog, 4, (" flags = %s %s %s %s", pInfo->flags & CKF_RNG ? "CKF_RNG" : "", pInfo->flags & CKF_WRITE_PROTECTED ? "CKF_WRITE_PROTECTED" : "", pInfo->flags & CKF_LOGIN_REQUIRED ? "CKF_LOGIN_REQUIRED" : "", pInfo->flags & CKF_USER_PIN_INITIALIZED ? "CKF_USER_PIN_INIT" : ""))do { if (((modlog)->level >= (4))) { PR_LogPrint (" flags = %s %s %s %s" , pInfo->flags & 0x00000001UL ? "CKF_RNG" : "", pInfo-> flags & 0x00000002UL ? "CKF_WRITE_PROTECTED" : "", pInfo-> flags & 0x00000004UL ? "CKF_LOGIN_REQUIRED" : "", pInfo-> flags & 0x00000008UL ? "CKF_USER_PIN_INIT" : ""); } } while (0); | ||||
| 1204 | PR_LOG(modlog, 4, (" maxSessions = %u, Sessions = %u", pInfo->ulMaxSessionCount, pInfo->ulSessionCount))do { if (((modlog)->level >= (4))) { PR_LogPrint (" maxSessions = %u, Sessions = %u" , pInfo->ulMaxSessionCount, pInfo->ulSessionCount); } } while (0); | ||||
| 1205 | PR_LOG(modlog, 4, (" maxRwSessions = %u, RwSessions = %u", pInfo->ulMaxRwSessionCount, pInfo->ulRwSessionCount))do { if (((modlog)->level >= (4))) { PR_LogPrint (" maxRwSessions = %u, RwSessions = %u" , pInfo->ulMaxRwSessionCount, pInfo->ulRwSessionCount); } } while (0); | ||||
| 1206 | /* ignore Max & Min Pin Len, Public and Private Memory */ | ||||
| 1207 | PR_LOG(modlog, 4, (fmt_hwVersion, pInfo->hardwareVersion.major, pInfo->hardwareVersion.minor))do { if (((modlog)->level >= (4))) { PR_LogPrint (fmt_hwVersion , pInfo->hardwareVersion.major, pInfo->hardwareVersion. minor); } } while (0); | ||||
| 1208 | PR_LOG(modlog, 4, (fmt_fwVersion, pInfo->firmwareVersion.major, pInfo->firmwareVersion.minor))do { if (((modlog)->level >= (4))) { PR_LogPrint (fmt_fwVersion , pInfo->firmwareVersion.major, pInfo->firmwareVersion. minor); } } while (0); | ||||
| 1209 | } | ||||
| 1210 | log_rv(rv); | ||||
| 1211 | return rv; | ||||
| 1212 | } | ||||
| 1213 | |||||
| 1214 | CK_RV | ||||
| 1215 | NSSDBGC_GetMechanismList( | ||||
| 1216 | CK_SLOT_ID slotID, | ||||
| 1217 | CK_MECHANISM_TYPE_PTR pMechanismList, | ||||
| 1218 | CK_ULONG_PTR pulCount) | ||||
| 1219 | { | ||||
| 1220 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 1221 | |||||
| 1222 | PR_LOG(modlog, 1, ("C_GetMechanismList"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_GetMechanismList" ); } } while (0); | ||||
| 1223 | PR_LOG(modlog, 3, (fmt_slotID, slotID))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_slotID , slotID); } } while (0); | ||||
| 1224 | PR_LOG(modlog, 3, (" pMechanismList = 0x%p", pMechanismList))do { if (((modlog)->level >= (3))) { PR_LogPrint (" pMechanismList = 0x%p" , pMechanismList); } } while (0); | ||||
| 1225 | PR_LOG(modlog, 3, (fmt_pulCount, pulCount))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pulCount , pulCount); } } while (0); | ||||
| 1226 | nssdbg_start_time(FUNC_C_GETMECHANISMLIST7, &start); | ||||
| 1227 | rv = module_functions->C_GetMechanismList(slotID, | ||||
| 1228 | pMechanismList, | ||||
| 1229 | pulCount); | ||||
| 1230 | nssdbg_finish_time(FUNC_C_GETMECHANISMLIST7, start); | ||||
| 1231 | PR_LOG(modlog, 4, (fmt_spulCount, *pulCount))do { if (((modlog)->level >= (4))) { PR_LogPrint (fmt_spulCount , *pulCount); } } while (0); | ||||
| 1232 | log_rv(rv); | ||||
| 1233 | return rv; | ||||
| 1234 | } | ||||
| 1235 | |||||
| 1236 | CK_RV | ||||
| 1237 | NSSDBGC_GetMechanismInfo( | ||||
| 1238 | CK_SLOT_ID slotID, | ||||
| 1239 | CK_MECHANISM_TYPE type, | ||||
| 1240 | CK_MECHANISM_INFO_PTR pInfo) | ||||
| 1241 | { | ||||
| 1242 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 1243 | |||||
| 1244 | PR_LOG(modlog, 1, ("C_GetMechanismInfo"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_GetMechanismInfo" ); } } while (0); | ||||
| 1245 | PR_LOG(modlog, 3, (fmt_slotID, slotID))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_slotID , slotID); } } while (0); | ||||
| 1246 | PR_LOG(modlog, 3, (" type = 0x%x", type))do { if (((modlog)->level >= (3))) { PR_LogPrint (" type = 0x%x" , type); } } while (0); | ||||
| 1247 | PR_LOG(modlog, 3, (fmt_pInfo, pInfo))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pInfo , pInfo); } } while (0); | ||||
| 1248 | nssdbg_start_time(FUNC_C_GETMECHANISMINFO8, &start); | ||||
| 1249 | rv = module_functions->C_GetMechanismInfo(slotID, | ||||
| 1250 | type, | ||||
| 1251 | pInfo); | ||||
| 1252 | nssdbg_finish_time(FUNC_C_GETMECHANISMINFO8, start); | ||||
| 1253 | log_rv(rv); | ||||
| 1254 | return rv; | ||||
| 1255 | } | ||||
| 1256 | |||||
| 1257 | CK_RV | ||||
| 1258 | NSSDBGC_InitToken( | ||||
| 1259 | CK_SLOT_ID slotID, | ||||
| 1260 | CK_CHAR_PTR pPin, | ||||
| 1261 | CK_ULONG ulPinLen, | ||||
| 1262 | CK_CHAR_PTR pLabel) | ||||
| 1263 | { | ||||
| 1264 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 1265 | |||||
| 1266 | PR_LOG(modlog, 1, ("C_InitToken"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_InitToken" ); } } while (0); | ||||
| 1267 | PR_LOG(modlog, 3, (fmt_slotID, slotID))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_slotID , slotID); } } while (0); | ||||
| 1268 | PR_LOG(modlog, 3, (fmt_pPin, pPin))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pPin , pPin); } } while (0); | ||||
| 1269 | PR_LOG(modlog, 3, (fmt_ulPinLen, ulPinLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulPinLen , ulPinLen); } } while (0); | ||||
| 1270 | PR_LOG(modlog, 3, (" pLabel = 0x%p", pLabel))do { if (((modlog)->level >= (3))) { PR_LogPrint (" pLabel = 0x%p" , pLabel); } } while (0); | ||||
| 1271 | nssdbg_start_time(FUNC_C_INITTOKEN9, &start); | ||||
| 1272 | rv = module_functions->C_InitToken(slotID, | ||||
| 1273 | pPin, | ||||
| 1274 | ulPinLen, | ||||
| 1275 | pLabel); | ||||
| 1276 | nssdbg_finish_time(FUNC_C_INITTOKEN9, start); | ||||
| 1277 | log_rv(rv); | ||||
| 1278 | return rv; | ||||
| 1279 | } | ||||
| 1280 | |||||
| 1281 | CK_RV | ||||
| 1282 | NSSDBGC_InitPIN( | ||||
| 1283 | CK_SESSION_HANDLE hSession, | ||||
| 1284 | CK_CHAR_PTR pPin, | ||||
| 1285 | CK_ULONG ulPinLen) | ||||
| 1286 | { | ||||
| 1287 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 1288 | |||||
| 1289 | PR_LOG(modlog, 1, ("C_InitPIN"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_InitPIN" ); } } while (0); | ||||
| 1290 | log_handle(3, fmt_hSession, hSession); | ||||
| 1291 | PR_LOG(modlog, 3, (fmt_pPin, pPin))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pPin , pPin); } } while (0); | ||||
| 1292 | PR_LOG(modlog, 3, (fmt_ulPinLen, ulPinLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulPinLen , ulPinLen); } } while (0); | ||||
| 1293 | nssdbg_start_time(FUNC_C_INITPIN10, &start); | ||||
| 1294 | rv = module_functions->C_InitPIN(hSession, | ||||
| 1295 | pPin, | ||||
| 1296 | ulPinLen); | ||||
| 1297 | nssdbg_finish_time(FUNC_C_INITPIN10, start); | ||||
| 1298 | log_rv(rv); | ||||
| 1299 | return rv; | ||||
| 1300 | } | ||||
| 1301 | |||||
| 1302 | CK_RV | ||||
| 1303 | NSSDBGC_SetPIN( | ||||
| 1304 | CK_SESSION_HANDLE hSession, | ||||
| 1305 | CK_CHAR_PTR pOldPin, | ||||
| 1306 | CK_ULONG ulOldLen, | ||||
| 1307 | CK_CHAR_PTR pNewPin, | ||||
| 1308 | CK_ULONG ulNewLen) | ||||
| 1309 | { | ||||
| 1310 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 1311 | |||||
| 1312 | PR_LOG(modlog, 1, ("C_SetPIN"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_SetPIN" ); } } while (0); | ||||
| 1313 | log_handle(3, fmt_hSession, hSession); | ||||
| 1314 | PR_LOG(modlog, 3, (" pOldPin = 0x%p", pOldPin))do { if (((modlog)->level >= (3))) { PR_LogPrint (" pOldPin = 0x%p" , pOldPin); } } while (0); | ||||
| 1315 | PR_LOG(modlog, 3, (" ulOldLen = %d", ulOldLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (" ulOldLen = %d" , ulOldLen); } } while (0); | ||||
| 1316 | PR_LOG(modlog, 3, (" pNewPin = 0x%p", pNewPin))do { if (((modlog)->level >= (3))) { PR_LogPrint (" pNewPin = 0x%p" , pNewPin); } } while (0); | ||||
| 1317 | PR_LOG(modlog, 3, (" ulNewLen = %d", ulNewLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (" ulNewLen = %d" , ulNewLen); } } while (0); | ||||
| 1318 | nssdbg_start_time(FUNC_C_SETPIN11, &start); | ||||
| 1319 | rv = module_functions->C_SetPIN(hSession, | ||||
| 1320 | pOldPin, | ||||
| 1321 | ulOldLen, | ||||
| 1322 | pNewPin, | ||||
| 1323 | ulNewLen); | ||||
| 1324 | nssdbg_finish_time(FUNC_C_SETPIN11, start); | ||||
| 1325 | log_rv(rv); | ||||
| 1326 | return rv; | ||||
| 1327 | } | ||||
| 1328 | |||||
| 1329 | static PRUint32 numOpenSessions = 0; | ||||
| 1330 | static PRUint32 maxOpenSessions = 0; | ||||
| 1331 | |||||
| 1332 | CK_RV | ||||
| 1333 | NSSDBGC_OpenSession( | ||||
| 1334 | CK_SLOT_ID slotID, | ||||
| 1335 | CK_FLAGS flags, | ||||
| 1336 | CK_VOID_PTR pApplication, | ||||
| 1337 | CK_NOTIFY Notify, | ||||
| 1338 | CK_SESSION_HANDLE_PTR phSession) | ||||
| 1339 | { | ||||
| 1340 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 1341 | |||||
| 1342 | PR_ATOMIC_INCREMENT((PRInt32 *)&numOpenSessions)__sync_add_and_fetch((PRInt32 *)&numOpenSessions, 1); | ||||
| 1343 | maxOpenSessions = PR_MAX(numOpenSessions, maxOpenSessions)((numOpenSessions)>(maxOpenSessions)?(numOpenSessions):(maxOpenSessions )); | ||||
| 1344 | PR_LOG(modlog, 1, ("C_OpenSession"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_OpenSession" ); } } while (0); | ||||
| 1345 | PR_LOG(modlog, 3, (fmt_slotID, slotID))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_slotID , slotID); } } while (0); | ||||
| 1346 | PR_LOG(modlog, 3, (fmt_flags, flags))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_flags , flags); } } while (0); | ||||
| 1347 | PR_LOG(modlog, 3, (" pApplication = 0x%p", pApplication))do { if (((modlog)->level >= (3))) { PR_LogPrint (" pApplication = 0x%p" , pApplication); } } while (0); | ||||
| 1348 | PR_LOG(modlog, 3, (" Notify = 0x%x", Notify))do { if (((modlog)->level >= (3))) { PR_LogPrint (" Notify = 0x%x" , Notify); } } while (0); | ||||
| 1349 | PR_LOG(modlog, 3, (" phSession = 0x%p", phSession))do { if (((modlog)->level >= (3))) { PR_LogPrint (" phSession = 0x%p" , phSession); } } while (0); | ||||
| 1350 | nssdbg_start_time(FUNC_C_OPENSESSION12, &start); | ||||
| 1351 | rv = module_functions->C_OpenSession(slotID, | ||||
| 1352 | flags, | ||||
| 1353 | pApplication, | ||||
| 1354 | Notify, | ||||
| 1355 | phSession); | ||||
| 1356 | nssdbg_finish_time(FUNC_C_OPENSESSION12, start); | ||||
| 1357 | log_handle(4, " *phSession = 0x%x", *phSession); | ||||
| 1358 | log_rv(rv); | ||||
| 1359 | return rv; | ||||
| 1360 | } | ||||
| 1361 | |||||
| 1362 | CK_RV | ||||
| 1363 | NSSDBGC_CloseSession( | ||||
| 1364 | CK_SESSION_HANDLE hSession) | ||||
| 1365 | { | ||||
| 1366 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 1367 | |||||
| 1368 | PR_ATOMIC_DECREMENT((PRInt32 *)&numOpenSessions)__sync_sub_and_fetch((PRInt32 *)&numOpenSessions, 1); | ||||
| 1369 | PR_LOG(modlog, 1, ("C_CloseSession"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_CloseSession" ); } } while (0); | ||||
| 1370 | log_handle(3, fmt_hSession, hSession); | ||||
| 1371 | nssdbg_start_time(FUNC_C_CLOSESESSION13, &start); | ||||
| 1372 | rv = module_functions->C_CloseSession(hSession); | ||||
| 1373 | nssdbg_finish_time(FUNC_C_CLOSESESSION13, start); | ||||
| 1374 | log_rv(rv); | ||||
| 1375 | return rv; | ||||
| 1376 | } | ||||
| 1377 | |||||
| 1378 | CK_RV | ||||
| 1379 | NSSDBGC_CloseAllSessions( | ||||
| 1380 | CK_SLOT_ID slotID) | ||||
| 1381 | { | ||||
| 1382 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 1383 | |||||
| 1384 | PR_LOG(modlog, 1, ("C_CloseAllSessions"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_CloseAllSessions" ); } } while (0); | ||||
| 1385 | PR_LOG(modlog, 3, (fmt_slotID, slotID))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_slotID , slotID); } } while (0); | ||||
| 1386 | nssdbg_start_time(FUNC_C_CLOSEALLSESSIONS14, &start); | ||||
| 1387 | rv = module_functions->C_CloseAllSessions(slotID); | ||||
| 1388 | nssdbg_finish_time(FUNC_C_CLOSEALLSESSIONS14, start); | ||||
| 1389 | log_rv(rv); | ||||
| 1390 | return rv; | ||||
| 1391 | } | ||||
| 1392 | |||||
| 1393 | CK_RV | ||||
| 1394 | NSSDBGC_GetSessionInfo( | ||||
| 1395 | CK_SESSION_HANDLE hSession, | ||||
| 1396 | CK_SESSION_INFO_PTR pInfo) | ||||
| 1397 | { | ||||
| 1398 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 1399 | |||||
| 1400 | PR_LOG(modlog, 1, ("C_GetSessionInfo"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_GetSessionInfo" ); } } while (0); | ||||
| 1401 | log_handle(3, fmt_hSession, hSession); | ||||
| 1402 | PR_LOG(modlog, 3, (fmt_pInfo, pInfo))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pInfo , pInfo); } } while (0); | ||||
| 1403 | nssdbg_start_time(FUNC_C_GETSESSIONINFO15, &start); | ||||
| 1404 | rv = module_functions->C_GetSessionInfo(hSession, | ||||
| 1405 | pInfo); | ||||
| 1406 | nssdbg_finish_time(FUNC_C_GETSESSIONINFO15, start); | ||||
| 1407 | if (rv == CKR_OK0x00000000UL) { | ||||
| 1408 | PR_LOG(modlog, 4, (fmt_slotID, pInfo->slotID))do { if (((modlog)->level >= (4))) { PR_LogPrint (fmt_slotID , pInfo->slotID); } } while (0); | ||||
| 1409 | log_state(pInfo->state); | ||||
| 1410 | PR_LOG(modlog, 4, (" flags = %s %s", pInfo->flags & CKF_RW_SESSION ? "CKF_RW_SESSION" : "", pInfo->flags & CKF_SERIAL_SESSION ? "CKF_SERIAL_SESSION" : ""))do { if (((modlog)->level >= (4))) { PR_LogPrint (" flags = %s %s" , pInfo->flags & 0x00000002UL ? "CKF_RW_SESSION" : "", pInfo->flags & 0x00000004UL ? "CKF_SERIAL_SESSION" : "" ); } } while (0); | ||||
| 1411 | PR_LOG(modlog, 4, (" deviceError = 0x%x", pInfo->ulDeviceError))do { if (((modlog)->level >= (4))) { PR_LogPrint (" deviceError = 0x%x" , pInfo->ulDeviceError); } } while (0); | ||||
| 1412 | } | ||||
| 1413 | log_rv(rv); | ||||
| 1414 | return rv; | ||||
| 1415 | } | ||||
| 1416 | |||||
| 1417 | CK_RV | ||||
| 1418 | NSSDBGC_GetOperationState( | ||||
| 1419 | CK_SESSION_HANDLE hSession, | ||||
| 1420 | CK_BYTE_PTR pOperationState, | ||||
| 1421 | CK_ULONG_PTR pulOperationStateLen) | ||||
| 1422 | { | ||||
| 1423 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 1424 | |||||
| 1425 | PR_LOG(modlog, 1, ("C_GetOperationState"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_GetOperationState" ); } } while (0); | ||||
| 1426 | log_handle(3, fmt_hSession, hSession); | ||||
| 1427 | PR_LOG(modlog, 3, (fmt_pOperationState, pOperationState))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pOperationState , pOperationState); } } while (0); | ||||
| 1428 | PR_LOG(modlog, 3, (" pulOperationStateLen = 0x%p", pulOperationStateLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (" pulOperationStateLen = 0x%p" , pulOperationStateLen); } } while (0); | ||||
| 1429 | nssdbg_start_time(FUNC_C_GETOPERATIONSTATE16, &start); | ||||
| 1430 | rv = module_functions->C_GetOperationState(hSession, | ||||
| 1431 | pOperationState, | ||||
| 1432 | pulOperationStateLen); | ||||
| 1433 | nssdbg_finish_time(FUNC_C_GETOPERATIONSTATE16, start); | ||||
| 1434 | PR_LOG(modlog, 4, (" *pulOperationStateLen = 0x%x", *pulOperationStateLen))do { if (((modlog)->level >= (4))) { PR_LogPrint (" *pulOperationStateLen = 0x%x" , *pulOperationStateLen); } } while (0); | ||||
| 1435 | log_rv(rv); | ||||
| 1436 | return rv; | ||||
| 1437 | } | ||||
| 1438 | |||||
| 1439 | CK_RV | ||||
| 1440 | NSSDBGC_SetOperationState( | ||||
| 1441 | CK_SESSION_HANDLE hSession, | ||||
| 1442 | CK_BYTE_PTR pOperationState, | ||||
| 1443 | CK_ULONG ulOperationStateLen, | ||||
| 1444 | CK_OBJECT_HANDLE hEncryptionKey, | ||||
| 1445 | CK_OBJECT_HANDLE hAuthenticationKey) | ||||
| 1446 | { | ||||
| 1447 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 1448 | |||||
| 1449 | PR_LOG(modlog, 1, ("C_SetOperationState"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_SetOperationState" ); } } while (0); | ||||
| 1450 | log_handle(3, fmt_hSession, hSession); | ||||
| 1451 | PR_LOG(modlog, 3, (fmt_pOperationState, pOperationState))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pOperationState , pOperationState); } } while (0); | ||||
| 1452 | PR_LOG(modlog, 3, (" ulOperationStateLen = %d", ulOperationStateLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (" ulOperationStateLen = %d" , ulOperationStateLen); } } while (0); | ||||
| 1453 | log_handle(3, " hEncryptionKey = 0x%x", hEncryptionKey); | ||||
| 1454 | log_handle(3, " hAuthenticationKey = 0x%x", hAuthenticationKey); | ||||
| 1455 | nssdbg_start_time(FUNC_C_SETOPERATIONSTATE17, &start); | ||||
| 1456 | rv = module_functions->C_SetOperationState(hSession, | ||||
| 1457 | pOperationState, | ||||
| 1458 | ulOperationStateLen, | ||||
| 1459 | hEncryptionKey, | ||||
| 1460 | hAuthenticationKey); | ||||
| 1461 | nssdbg_finish_time(FUNC_C_SETOPERATIONSTATE17, start); | ||||
| 1462 | log_rv(rv); | ||||
| 1463 | return rv; | ||||
| 1464 | } | ||||
| 1465 | |||||
| 1466 | CK_RV | ||||
| 1467 | NSSDBGC_Login( | ||||
| 1468 | CK_SESSION_HANDLE hSession, | ||||
| 1469 | CK_USER_TYPE userType, | ||||
| 1470 | CK_CHAR_PTR pPin, | ||||
| 1471 | CK_ULONG ulPinLen) | ||||
| 1472 | { | ||||
| 1473 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 1474 | |||||
| 1475 | PR_LOG(modlog, 1, ("C_Login"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_Login" ); } } while (0); | ||||
| 1476 | log_handle(3, fmt_hSession, hSession); | ||||
| 1477 | PR_LOG(modlog, 3, (" userType = 0x%x", userType))do { if (((modlog)->level >= (3))) { PR_LogPrint (" userType = 0x%x" , userType); } } while (0); | ||||
| 1478 | PR_LOG(modlog, 3, (fmt_pPin, pPin))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pPin , pPin); } } while (0); | ||||
| 1479 | PR_LOG(modlog, 3, (fmt_ulPinLen, ulPinLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulPinLen , ulPinLen); } } while (0); | ||||
| 1480 | nssdbg_start_time(FUNC_C_LOGIN18, &start); | ||||
| 1481 | rv = module_functions->C_Login(hSession, | ||||
| 1482 | userType, | ||||
| 1483 | pPin, | ||||
| 1484 | ulPinLen); | ||||
| 1485 | nssdbg_finish_time(FUNC_C_LOGIN18, start); | ||||
| 1486 | log_rv(rv); | ||||
| 1487 | return rv; | ||||
| 1488 | } | ||||
| 1489 | |||||
| 1490 | CK_RV | ||||
| 1491 | NSSDBGC_Logout( | ||||
| 1492 | CK_SESSION_HANDLE hSession) | ||||
| 1493 | { | ||||
| 1494 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 1495 | |||||
| 1496 | PR_LOG(modlog, 1, ("C_Logout"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_Logout" ); } } while (0); | ||||
| 1497 | log_handle(3, fmt_hSession, hSession); | ||||
| 1498 | nssdbg_start_time(FUNC_C_LOGOUT19, &start); | ||||
| 1499 | rv = module_functions->C_Logout(hSession); | ||||
| 1500 | nssdbg_finish_time(FUNC_C_LOGOUT19, start); | ||||
| 1501 | log_rv(rv); | ||||
| 1502 | return rv; | ||||
| 1503 | } | ||||
| 1504 | |||||
| 1505 | CK_RV | ||||
| 1506 | NSSDBGC_CreateObject( | ||||
| 1507 | CK_SESSION_HANDLE hSession, | ||||
| 1508 | CK_ATTRIBUTE_PTR pTemplate, | ||||
| 1509 | CK_ULONG ulCount, | ||||
| 1510 | CK_OBJECT_HANDLE_PTR phObject) | ||||
| 1511 | { | ||||
| 1512 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 1513 | |||||
| 1514 | PR_LOG(modlog, 1, ("C_CreateObject"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_CreateObject" ); } } while (0); | ||||
| 1515 | log_handle(3, fmt_hSession, hSession); | ||||
| 1516 | PR_LOG(modlog, 3, (fmt_pTemplate, pTemplate))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pTemplate , pTemplate); } } while (0); | ||||
| 1517 | PR_LOG(modlog, 3, (fmt_ulCount, ulCount))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulCount , ulCount); } } while (0); | ||||
| 1518 | PR_LOG(modlog, 3, (fmt_phObject, phObject))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_phObject , phObject); } } while (0); | ||||
| 1519 | print_template(pTemplate, ulCount); | ||||
| 1520 | nssdbg_start_time(FUNC_C_CREATEOBJECT20, &start); | ||||
| 1521 | rv = module_functions->C_CreateObject(hSession, | ||||
| 1522 | pTemplate, | ||||
| 1523 | ulCount, | ||||
| 1524 | phObject); | ||||
| 1525 | nssdbg_finish_time(FUNC_C_CREATEOBJECT20, start); | ||||
| 1526 | log_handle(4, " *phObject = 0x%x", *phObject); | ||||
| 1527 | log_rv(rv); | ||||
| 1528 | return rv; | ||||
| 1529 | } | ||||
| 1530 | |||||
| 1531 | CK_RV | ||||
| 1532 | NSSDBGC_CopyObject( | ||||
| 1533 | CK_SESSION_HANDLE hSession, | ||||
| 1534 | CK_OBJECT_HANDLE hObject, | ||||
| 1535 | CK_ATTRIBUTE_PTR pTemplate, | ||||
| 1536 | CK_ULONG ulCount, | ||||
| 1537 | CK_OBJECT_HANDLE_PTR phNewObject) | ||||
| 1538 | { | ||||
| 1539 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 1540 | |||||
| 1541 | PR_LOG(modlog, 1, ("C_CopyObject"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_CopyObject" ); } } while (0); | ||||
| 1542 | log_handle(3, fmt_hSession, hSession); | ||||
| 1543 | log_handle(3, fmt_hObject, hObject); | ||||
| 1544 | PR_LOG(modlog, 3, (fmt_pTemplate, pTemplate))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pTemplate , pTemplate); } } while (0); | ||||
| 1545 | PR_LOG(modlog, 3, (fmt_ulCount, ulCount))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulCount , ulCount); } } while (0); | ||||
| 1546 | PR_LOG(modlog, 3, (" phNewObject = 0x%p", phNewObject))do { if (((modlog)->level >= (3))) { PR_LogPrint (" phNewObject = 0x%p" , phNewObject); } } while (0); | ||||
| 1547 | print_template(pTemplate, ulCount); | ||||
| 1548 | nssdbg_start_time(FUNC_C_COPYOBJECT21, &start); | ||||
| 1549 | rv = module_functions->C_CopyObject(hSession, | ||||
| 1550 | hObject, | ||||
| 1551 | pTemplate, | ||||
| 1552 | ulCount, | ||||
| 1553 | phNewObject); | ||||
| 1554 | nssdbg_finish_time(FUNC_C_COPYOBJECT21, start); | ||||
| 1555 | log_handle(4, " *phNewObject = 0x%x", *phNewObject); | ||||
| 1556 | log_rv(rv); | ||||
| 1557 | return rv; | ||||
| 1558 | } | ||||
| 1559 | |||||
| 1560 | CK_RV | ||||
| 1561 | NSSDBGC_DestroyObject( | ||||
| 1562 | CK_SESSION_HANDLE hSession, | ||||
| 1563 | CK_OBJECT_HANDLE hObject) | ||||
| 1564 | { | ||||
| 1565 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 1566 | |||||
| 1567 | PR_LOG(modlog, 1, ("C_DestroyObject"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_DestroyObject" ); } } while (0); | ||||
| 1568 | log_handle(3, fmt_hSession, hSession); | ||||
| 1569 | log_handle(3, fmt_hObject, hObject); | ||||
| 1570 | nssdbg_start_time(FUNC_C_DESTROYOBJECT22, &start); | ||||
| 1571 | rv = module_functions->C_DestroyObject(hSession, | ||||
| 1572 | hObject); | ||||
| 1573 | nssdbg_finish_time(FUNC_C_DESTROYOBJECT22, start); | ||||
| 1574 | log_rv(rv); | ||||
| 1575 | return rv; | ||||
| 1576 | } | ||||
| 1577 | |||||
| 1578 | CK_RV | ||||
| 1579 | NSSDBGC_GetObjectSize( | ||||
| 1580 | CK_SESSION_HANDLE hSession, | ||||
| 1581 | CK_OBJECT_HANDLE hObject, | ||||
| 1582 | CK_ULONG_PTR pulSize) | ||||
| 1583 | { | ||||
| 1584 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 1585 | |||||
| 1586 | PR_LOG(modlog, 1, ("C_GetObjectSize"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_GetObjectSize" ); } } while (0); | ||||
| 1587 | log_handle(3, fmt_hSession, hSession); | ||||
| 1588 | log_handle(3, fmt_hObject, hObject); | ||||
| 1589 | PR_LOG(modlog, 3, (" pulSize = 0x%p", pulSize))do { if (((modlog)->level >= (3))) { PR_LogPrint (" pulSize = 0x%p" , pulSize); } } while (0); | ||||
| 1590 | nssdbg_start_time(FUNC_C_GETOBJECTSIZE23, &start); | ||||
| 1591 | rv = module_functions->C_GetObjectSize(hSession, | ||||
| 1592 | hObject, | ||||
| 1593 | pulSize); | ||||
| 1594 | nssdbg_finish_time(FUNC_C_GETOBJECTSIZE23, start); | ||||
| 1595 | PR_LOG(modlog, 4, (" *pulSize = 0x%x", *pulSize))do { if (((modlog)->level >= (4))) { PR_LogPrint (" *pulSize = 0x%x" , *pulSize); } } while (0); | ||||
| 1596 | log_rv(rv); | ||||
| 1597 | return rv; | ||||
| 1598 | } | ||||
| 1599 | |||||
| 1600 | CK_RV | ||||
| 1601 | NSSDBGC_GetAttributeValue( | ||||
| 1602 | CK_SESSION_HANDLE hSession, | ||||
| 1603 | CK_OBJECT_HANDLE hObject, | ||||
| 1604 | CK_ATTRIBUTE_PTR pTemplate, | ||||
| 1605 | CK_ULONG ulCount) | ||||
| 1606 | { | ||||
| 1607 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 1608 | |||||
| 1609 | PR_LOG(modlog, 1, ("C_GetAttributeValue"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_GetAttributeValue" ); } } while (0); | ||||
| 1610 | log_handle(3, fmt_hSession, hSession); | ||||
| 1611 | log_handle(3, fmt_hObject, hObject); | ||||
| 1612 | PR_LOG(modlog, 3, (fmt_pTemplate, pTemplate))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pTemplate , pTemplate); } } while (0); | ||||
| 1613 | PR_LOG(modlog, 3, (fmt_ulCount, ulCount))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulCount , ulCount); } } while (0); | ||||
| 1614 | nssdbg_start_time(FUNC_C_GETATTRIBUTEVALUE24, &start); | ||||
| 1615 | rv = module_functions->C_GetAttributeValue(hSession, | ||||
| 1616 | hObject, | ||||
| 1617 | pTemplate, | ||||
| 1618 | ulCount); | ||||
| 1619 | nssdbg_finish_time(FUNC_C_GETATTRIBUTEVALUE24, start); | ||||
| 1620 | print_template(pTemplate, ulCount); | ||||
| 1621 | log_rv(rv); | ||||
| 1622 | return rv; | ||||
| 1623 | } | ||||
| 1624 | |||||
| 1625 | CK_RV | ||||
| 1626 | NSSDBGC_SetAttributeValue( | ||||
| 1627 | CK_SESSION_HANDLE hSession, | ||||
| 1628 | CK_OBJECT_HANDLE hObject, | ||||
| 1629 | CK_ATTRIBUTE_PTR pTemplate, | ||||
| 1630 | CK_ULONG ulCount) | ||||
| 1631 | { | ||||
| 1632 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 1633 | |||||
| 1634 | PR_LOG(modlog, 1, ("C_SetAttributeValue"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_SetAttributeValue" ); } } while (0); | ||||
| 1635 | log_handle(3, fmt_hSession, hSession); | ||||
| 1636 | log_handle(3, fmt_hObject, hObject); | ||||
| 1637 | PR_LOG(modlog, 3, (fmt_pTemplate, pTemplate))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pTemplate , pTemplate); } } while (0); | ||||
| 1638 | PR_LOG(modlog, 3, (fmt_ulCount, ulCount))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulCount , ulCount); } } while (0); | ||||
| 1639 | print_template(pTemplate, ulCount); | ||||
| 1640 | nssdbg_start_time(FUNC_C_SETATTRIBUTEVALUE25, &start); | ||||
| 1641 | rv = module_functions->C_SetAttributeValue(hSession, | ||||
| 1642 | hObject, | ||||
| 1643 | pTemplate, | ||||
| 1644 | ulCount); | ||||
| 1645 | nssdbg_finish_time(FUNC_C_SETATTRIBUTEVALUE25, start); | ||||
| 1646 | log_rv(rv); | ||||
| 1647 | return rv; | ||||
| 1648 | } | ||||
| 1649 | |||||
| 1650 | CK_RV | ||||
| 1651 | NSSDBGC_FindObjectsInit( | ||||
| 1652 | CK_SESSION_HANDLE hSession, | ||||
| 1653 | CK_ATTRIBUTE_PTR pTemplate, | ||||
| 1654 | CK_ULONG ulCount) | ||||
| 1655 | { | ||||
| 1656 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 1657 | |||||
| 1658 | PR_LOG(modlog, 1, ("C_FindObjectsInit"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_FindObjectsInit" ); } } while (0); | ||||
| 1659 | log_handle(3, fmt_hSession, hSession); | ||||
| 1660 | PR_LOG(modlog, 3, (fmt_pTemplate, pTemplate))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pTemplate , pTemplate); } } while (0); | ||||
| 1661 | PR_LOG(modlog, 3, (fmt_ulCount, ulCount))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulCount , ulCount); } } while (0); | ||||
| 1662 | print_template(pTemplate, ulCount); | ||||
| 1663 | nssdbg_start_time(FUNC_C_FINDOBJECTSINIT26, &start); | ||||
| 1664 | rv = module_functions->C_FindObjectsInit(hSession, | ||||
| 1665 | pTemplate, | ||||
| 1666 | ulCount); | ||||
| 1667 | nssdbg_finish_time(FUNC_C_FINDOBJECTSINIT26, start); | ||||
| 1668 | log_rv(rv); | ||||
| 1669 | return rv; | ||||
| 1670 | } | ||||
| 1671 | |||||
| 1672 | CK_RV | ||||
| 1673 | NSSDBGC_FindObjects( | ||||
| 1674 | CK_SESSION_HANDLE hSession, | ||||
| 1675 | CK_OBJECT_HANDLE_PTR phObject, | ||||
| 1676 | CK_ULONG ulMaxObjectCount, | ||||
| 1677 | CK_ULONG_PTR pulObjectCount) | ||||
| 1678 | { | ||||
| 1679 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 1680 | CK_ULONG i; | ||||
| 1681 | |||||
| 1682 | PR_LOG(modlog, 1, ("C_FindObjects"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_FindObjects" ); } } while (0); | ||||
| 1683 | log_handle(3, fmt_hSession, hSession); | ||||
| 1684 | PR_LOG(modlog, 3, (fmt_phObject, phObject))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_phObject , phObject); } } while (0); | ||||
| 1685 | PR_LOG(modlog, 3, (" ulMaxObjectCount = %d", ulMaxObjectCount))do { if (((modlog)->level >= (3))) { PR_LogPrint (" ulMaxObjectCount = %d" , ulMaxObjectCount); } } while (0); | ||||
| 1686 | PR_LOG(modlog, 3, (" pulObjectCount = 0x%p", pulObjectCount))do { if (((modlog)->level >= (3))) { PR_LogPrint (" pulObjectCount = 0x%p" , pulObjectCount); } } while (0); | ||||
| 1687 | nssdbg_start_time(FUNC_C_FINDOBJECTS27, &start); | ||||
| 1688 | rv = module_functions->C_FindObjects(hSession, | ||||
| 1689 | phObject, | ||||
| 1690 | ulMaxObjectCount, | ||||
| 1691 | pulObjectCount); | ||||
| 1692 | nssdbg_finish_time(FUNC_C_FINDOBJECTS27, start); | ||||
| 1693 | PR_LOG(modlog, 4, (" *pulObjectCount = 0x%x", *pulObjectCount))do { if (((modlog)->level >= (4))) { PR_LogPrint (" *pulObjectCount = 0x%x" , *pulObjectCount); } } while (0); | ||||
| 1694 | for (i = 0; i < *pulObjectCount; i++) { | ||||
| 1695 | PR_LOG(modlog, 4, (" phObject[%d] = 0x%x%s", i, phObject[i], phObject[i] ? "" : fmt_invalid_handle))do { if (((modlog)->level >= (4))) { PR_LogPrint (" phObject[%d] = 0x%x%s" , i, phObject[i], phObject[i] ? "" : fmt_invalid_handle); } } while (0); | ||||
| 1696 | } | ||||
| 1697 | log_rv(rv); | ||||
| 1698 | return rv; | ||||
| 1699 | } | ||||
| 1700 | |||||
| 1701 | CK_RV | ||||
| 1702 | NSSDBGC_FindObjectsFinal( | ||||
| 1703 | CK_SESSION_HANDLE hSession) | ||||
| 1704 | { | ||||
| 1705 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 1706 | |||||
| 1707 | PR_LOG(modlog, 1, ("C_FindObjectsFinal"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_FindObjectsFinal" ); } } while (0); | ||||
| 1708 | log_handle(3, fmt_hSession, hSession); | ||||
| 1709 | nssdbg_start_time(FUNC_C_FINDOBJECTSFINAL28, &start); | ||||
| 1710 | rv = module_functions->C_FindObjectsFinal(hSession); | ||||
| 1711 | nssdbg_finish_time(FUNC_C_FINDOBJECTSFINAL28, start); | ||||
| 1712 | log_rv(rv); | ||||
| 1713 | return rv; | ||||
| 1714 | } | ||||
| 1715 | |||||
| 1716 | CK_RV | ||||
| 1717 | NSSDBGC_EncryptInit( | ||||
| 1718 | CK_SESSION_HANDLE hSession, | ||||
| 1719 | CK_MECHANISM_PTR pMechanism, | ||||
| 1720 | CK_OBJECT_HANDLE hKey) | ||||
| 1721 | { | ||||
| 1722 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 1723 | |||||
| 1724 | PR_LOG(modlog, 1, ("C_EncryptInit"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_EncryptInit" ); } } while (0); | ||||
| 1725 | log_handle(3, fmt_hSession, hSession); | ||||
| 1726 | PR_LOG(modlog, 3, (fmt_pMechanism, pMechanism))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pMechanism , pMechanism); } } while (0); | ||||
| 1727 | log_handle(3, fmt_hKey, hKey); | ||||
| 1728 | print_mechanism(pMechanism); | ||||
| 1729 | nssdbg_start_time(FUNC_C_ENCRYPTINIT29, &start); | ||||
| 1730 | rv = module_functions->C_EncryptInit(hSession, | ||||
| 1731 | pMechanism, | ||||
| 1732 | hKey); | ||||
| 1733 | nssdbg_finish_time(FUNC_C_ENCRYPTINIT29, start); | ||||
| 1734 | log_rv(rv); | ||||
| 1735 | return rv; | ||||
| 1736 | } | ||||
| 1737 | |||||
| 1738 | CK_RV | ||||
| 1739 | NSSDBGC_Encrypt( | ||||
| 1740 | CK_SESSION_HANDLE hSession, | ||||
| 1741 | CK_BYTE_PTR pData, | ||||
| 1742 | CK_ULONG ulDataLen, | ||||
| 1743 | CK_BYTE_PTR pEncryptedData, | ||||
| 1744 | CK_ULONG_PTR pulEncryptedDataLen) | ||||
| 1745 | { | ||||
| 1746 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 1747 | |||||
| 1748 | PR_LOG(modlog, 1, ("C_Encrypt"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_Encrypt" ); } } while (0); | ||||
| 1749 | log_handle(3, fmt_hSession, hSession); | ||||
| 1750 | PR_LOG(modlog, 3, (fmt_pData, pData))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pData , pData); } } while (0); | ||||
| 1751 | PR_LOG(modlog, 3, (fmt_ulDataLen, ulDataLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulDataLen , ulDataLen); } } while (0); | ||||
| 1752 | PR_LOG(modlog, 3, (fmt_pEncryptedData, pEncryptedData))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pEncryptedData , pEncryptedData); } } while (0); | ||||
| 1753 | PR_LOG(modlog, 3, (" pulEncryptedDataLen = 0x%p", pulEncryptedDataLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (" pulEncryptedDataLen = 0x%p" , pulEncryptedDataLen); } } while (0); | ||||
| 1754 | nssdbg_start_time(FUNC_C_ENCRYPT30, &start); | ||||
| 1755 | rv = module_functions->C_Encrypt(hSession, | ||||
| 1756 | pData, | ||||
| 1757 | ulDataLen, | ||||
| 1758 | pEncryptedData, | ||||
| 1759 | pulEncryptedDataLen); | ||||
| 1760 | nssdbg_finish_time(FUNC_C_ENCRYPT30, start); | ||||
| 1761 | PR_LOG(modlog, 4, (" *pulEncryptedDataLen = 0x%x", *pulEncryptedDataLen))do { if (((modlog)->level >= (4))) { PR_LogPrint (" *pulEncryptedDataLen = 0x%x" , *pulEncryptedDataLen); } } while (0); | ||||
| 1762 | log_rv(rv); | ||||
| 1763 | return rv; | ||||
| 1764 | } | ||||
| 1765 | |||||
| 1766 | CK_RV | ||||
| 1767 | NSSDBGC_EncryptUpdate( | ||||
| 1768 | CK_SESSION_HANDLE hSession, | ||||
| 1769 | CK_BYTE_PTR pPart, | ||||
| 1770 | CK_ULONG ulPartLen, | ||||
| 1771 | CK_BYTE_PTR pEncryptedPart, | ||||
| 1772 | CK_ULONG_PTR pulEncryptedPartLen) | ||||
| 1773 | { | ||||
| 1774 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 1775 | |||||
| 1776 | PR_LOG(modlog, 1, ("C_EncryptUpdate"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_EncryptUpdate" ); } } while (0); | ||||
| 1777 | log_handle(3, fmt_hSession, hSession); | ||||
| 1778 | PR_LOG(modlog, 3, (fmt_pPart, pPart))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pPart , pPart); } } while (0); | ||||
| 1779 | PR_LOG(modlog, 3, (fmt_ulPartLen, ulPartLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulPartLen , ulPartLen); } } while (0); | ||||
| 1780 | PR_LOG(modlog, 3, (fmt_pEncryptedPart, pEncryptedPart))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pEncryptedPart , pEncryptedPart); } } while (0); | ||||
| 1781 | PR_LOG(modlog, 3, (fmt_pulEncryptedPartLen, pulEncryptedPartLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pulEncryptedPartLen , pulEncryptedPartLen); } } while (0); | ||||
| 1782 | nssdbg_start_time(FUNC_C_ENCRYPTUPDATE31, &start); | ||||
| 1783 | rv = module_functions->C_EncryptUpdate(hSession, | ||||
| 1784 | pPart, | ||||
| 1785 | ulPartLen, | ||||
| 1786 | pEncryptedPart, | ||||
| 1787 | pulEncryptedPartLen); | ||||
| 1788 | nssdbg_finish_time(FUNC_C_ENCRYPTUPDATE31, start); | ||||
| 1789 | PR_LOG(modlog, 4, (fmt_spulEncryptedPartLen, *pulEncryptedPartLen))do { if (((modlog)->level >= (4))) { PR_LogPrint (fmt_spulEncryptedPartLen , *pulEncryptedPartLen); } } while (0); | ||||
| 1790 | log_rv(rv); | ||||
| 1791 | return rv; | ||||
| 1792 | } | ||||
| 1793 | |||||
| 1794 | CK_RV | ||||
| 1795 | NSSDBGC_EncryptFinal( | ||||
| 1796 | CK_SESSION_HANDLE hSession, | ||||
| 1797 | CK_BYTE_PTR pLastEncryptedPart, | ||||
| 1798 | CK_ULONG_PTR pulLastEncryptedPartLen) | ||||
| 1799 | { | ||||
| 1800 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 1801 | |||||
| 1802 | PR_LOG(modlog, 1, ("C_EncryptFinal"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_EncryptFinal" ); } } while (0); | ||||
| 1803 | log_handle(3, fmt_hSession, hSession); | ||||
| 1804 | PR_LOG(modlog, 3, (" pLastEncryptedPart = 0x%p", pLastEncryptedPart))do { if (((modlog)->level >= (3))) { PR_LogPrint (" pLastEncryptedPart = 0x%p" , pLastEncryptedPart); } } while (0); | ||||
| 1805 | PR_LOG(modlog, 3, (" pulLastEncryptedPartLen = 0x%p", pulLastEncryptedPartLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (" pulLastEncryptedPartLen = 0x%p" , pulLastEncryptedPartLen); } } while (0); | ||||
| 1806 | nssdbg_start_time(FUNC_C_ENCRYPTFINAL32, &start); | ||||
| 1807 | rv = module_functions->C_EncryptFinal(hSession, | ||||
| 1808 | pLastEncryptedPart, | ||||
| 1809 | pulLastEncryptedPartLen); | ||||
| 1810 | nssdbg_finish_time(FUNC_C_ENCRYPTFINAL32, start); | ||||
| 1811 | PR_LOG(modlog, 4, (" *pulLastEncryptedPartLen = 0x%x", *pulLastEncryptedPartLen))do { if (((modlog)->level >= (4))) { PR_LogPrint (" *pulLastEncryptedPartLen = 0x%x" , *pulLastEncryptedPartLen); } } while (0); | ||||
| 1812 | log_rv(rv); | ||||
| 1813 | return rv; | ||||
| 1814 | } | ||||
| 1815 | |||||
| 1816 | CK_RV | ||||
| 1817 | NSSDBGC_DecryptInit( | ||||
| 1818 | CK_SESSION_HANDLE hSession, | ||||
| 1819 | CK_MECHANISM_PTR pMechanism, | ||||
| 1820 | CK_OBJECT_HANDLE hKey) | ||||
| 1821 | { | ||||
| 1822 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 1823 | |||||
| 1824 | PR_LOG(modlog, 1, ("C_DecryptInit"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_DecryptInit" ); } } while (0); | ||||
| 1825 | log_handle(3, fmt_hSession, hSession); | ||||
| 1826 | PR_LOG(modlog, 3, (fmt_pMechanism, pMechanism))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pMechanism , pMechanism); } } while (0); | ||||
| 1827 | log_handle(3, fmt_hKey, hKey); | ||||
| 1828 | print_mechanism(pMechanism); | ||||
| 1829 | nssdbg_start_time(FUNC_C_DECRYPTINIT33, &start); | ||||
| 1830 | rv = module_functions->C_DecryptInit(hSession, | ||||
| 1831 | pMechanism, | ||||
| 1832 | hKey); | ||||
| 1833 | nssdbg_finish_time(FUNC_C_DECRYPTINIT33, start); | ||||
| 1834 | log_rv(rv); | ||||
| 1835 | return rv; | ||||
| 1836 | } | ||||
| 1837 | |||||
| 1838 | CK_RV | ||||
| 1839 | NSSDBGC_Decrypt( | ||||
| 1840 | CK_SESSION_HANDLE hSession, | ||||
| 1841 | CK_BYTE_PTR pEncryptedData, | ||||
| 1842 | CK_ULONG ulEncryptedDataLen, | ||||
| 1843 | CK_BYTE_PTR pData, | ||||
| 1844 | CK_ULONG_PTR pulDataLen) | ||||
| 1845 | { | ||||
| 1846 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 1847 | |||||
| 1848 | PR_LOG(modlog, 1, ("C_Decrypt"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_Decrypt" ); } } while (0); | ||||
| 1849 | log_handle(3, fmt_hSession, hSession); | ||||
| 1850 | PR_LOG(modlog, 3, (fmt_pEncryptedData, pEncryptedData))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pEncryptedData , pEncryptedData); } } while (0); | ||||
| 1851 | PR_LOG(modlog, 3, (" ulEncryptedDataLen = %d", ulEncryptedDataLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (" ulEncryptedDataLen = %d" , ulEncryptedDataLen); } } while (0); | ||||
| 1852 | PR_LOG(modlog, 3, (fmt_pData, pData))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pData , pData); } } while (0); | ||||
| 1853 | PR_LOG(modlog, 3, (fmt_pulDataLen, pulDataLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pulDataLen , pulDataLen); } } while (0); | ||||
| 1854 | nssdbg_start_time(FUNC_C_DECRYPT34, &start); | ||||
| 1855 | rv = module_functions->C_Decrypt(hSession, | ||||
| 1856 | pEncryptedData, | ||||
| 1857 | ulEncryptedDataLen, | ||||
| 1858 | pData, | ||||
| 1859 | pulDataLen); | ||||
| 1860 | nssdbg_finish_time(FUNC_C_DECRYPT34, start); | ||||
| 1861 | PR_LOG(modlog, 4, (fmt_spulDataLen, *pulDataLen))do { if (((modlog)->level >= (4))) { PR_LogPrint (fmt_spulDataLen , *pulDataLen); } } while (0); | ||||
| 1862 | log_rv(rv); | ||||
| 1863 | return rv; | ||||
| 1864 | } | ||||
| 1865 | |||||
| 1866 | CK_RV | ||||
| 1867 | NSSDBGC_DecryptUpdate( | ||||
| 1868 | CK_SESSION_HANDLE hSession, | ||||
| 1869 | CK_BYTE_PTR pEncryptedPart, | ||||
| 1870 | CK_ULONG ulEncryptedPartLen, | ||||
| 1871 | CK_BYTE_PTR pPart, | ||||
| 1872 | CK_ULONG_PTR pulPartLen) | ||||
| 1873 | { | ||||
| 1874 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 1875 | |||||
| 1876 | PR_LOG(modlog, 1, ("C_DecryptUpdate"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_DecryptUpdate" ); } } while (0); | ||||
| 1877 | log_handle(3, fmt_hSession, hSession); | ||||
| 1878 | PR_LOG(modlog, 3, (fmt_pEncryptedPart, pEncryptedPart))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pEncryptedPart , pEncryptedPart); } } while (0); | ||||
| 1879 | PR_LOG(modlog, 3, (fmt_ulEncryptedPartLen, ulEncryptedPartLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulEncryptedPartLen , ulEncryptedPartLen); } } while (0); | ||||
| 1880 | PR_LOG(modlog, 3, (fmt_pPart, pPart))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pPart , pPart); } } while (0); | ||||
| 1881 | PR_LOG(modlog, 3, (fmt_pulPartLen, pulPartLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pulPartLen , pulPartLen); } } while (0); | ||||
| 1882 | nssdbg_start_time(FUNC_C_DECRYPTUPDATE35, &start); | ||||
| 1883 | rv = module_functions->C_DecryptUpdate(hSession, | ||||
| 1884 | pEncryptedPart, | ||||
| 1885 | ulEncryptedPartLen, | ||||
| 1886 | pPart, | ||||
| 1887 | pulPartLen); | ||||
| 1888 | nssdbg_finish_time(FUNC_C_DECRYPTUPDATE35, start); | ||||
| 1889 | PR_LOG(modlog, 4, (fmt_spulPartLen, *pulPartLen))do { if (((modlog)->level >= (4))) { PR_LogPrint (fmt_spulPartLen , *pulPartLen); } } while (0); | ||||
| 1890 | log_rv(rv); | ||||
| 1891 | return rv; | ||||
| 1892 | } | ||||
| 1893 | |||||
| 1894 | CK_RV | ||||
| 1895 | NSSDBGC_DecryptFinal( | ||||
| 1896 | CK_SESSION_HANDLE hSession, | ||||
| 1897 | CK_BYTE_PTR pLastPart, | ||||
| 1898 | CK_ULONG_PTR pulLastPartLen) | ||||
| 1899 | { | ||||
| 1900 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 1901 | |||||
| 1902 | PR_LOG(modlog, 1, ("C_DecryptFinal"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_DecryptFinal" ); } } while (0); | ||||
| 1903 | log_handle(3, fmt_hSession, hSession); | ||||
| 1904 | PR_LOG(modlog, 3, (" pLastPart = 0x%p", pLastPart))do { if (((modlog)->level >= (3))) { PR_LogPrint (" pLastPart = 0x%p" , pLastPart); } } while (0); | ||||
| 1905 | PR_LOG(modlog, 3, (" pulLastPartLen = 0x%p", pulLastPartLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (" pulLastPartLen = 0x%p" , pulLastPartLen); } } while (0); | ||||
| 1906 | nssdbg_start_time(FUNC_C_DECRYPTFINAL36, &start); | ||||
| 1907 | rv = module_functions->C_DecryptFinal(hSession, | ||||
| 1908 | pLastPart, | ||||
| 1909 | pulLastPartLen); | ||||
| 1910 | nssdbg_finish_time(FUNC_C_DECRYPTFINAL36, start); | ||||
| 1911 | PR_LOG(modlog, 4, (" *pulLastPartLen = 0x%x", *pulLastPartLen))do { if (((modlog)->level >= (4))) { PR_LogPrint (" *pulLastPartLen = 0x%x" , *pulLastPartLen); } } while (0); | ||||
| 1912 | log_rv(rv); | ||||
| 1913 | return rv; | ||||
| 1914 | } | ||||
| 1915 | |||||
| 1916 | CK_RV | ||||
| 1917 | NSSDBGC_DigestInit( | ||||
| 1918 | CK_SESSION_HANDLE hSession, | ||||
| 1919 | CK_MECHANISM_PTR pMechanism) | ||||
| 1920 | { | ||||
| 1921 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 1922 | |||||
| 1923 | PR_LOG(modlog, 1, ("C_DigestInit"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_DigestInit" ); } } while (0); | ||||
| 1924 | log_handle(3, fmt_hSession, hSession); | ||||
| 1925 | PR_LOG(modlog, 3, (fmt_pMechanism, pMechanism))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pMechanism , pMechanism); } } while (0); | ||||
| 1926 | print_mechanism(pMechanism); | ||||
| 1927 | nssdbg_start_time(FUNC_C_DIGESTINIT37, &start); | ||||
| 1928 | rv = module_functions->C_DigestInit(hSession, | ||||
| 1929 | pMechanism); | ||||
| 1930 | nssdbg_finish_time(FUNC_C_DIGESTINIT37, start); | ||||
| 1931 | log_rv(rv); | ||||
| 1932 | return rv; | ||||
| 1933 | } | ||||
| 1934 | |||||
| 1935 | CK_RV | ||||
| 1936 | NSSDBGC_Digest( | ||||
| 1937 | CK_SESSION_HANDLE hSession, | ||||
| 1938 | CK_BYTE_PTR pData, | ||||
| 1939 | CK_ULONG ulDataLen, | ||||
| 1940 | CK_BYTE_PTR pDigest, | ||||
| 1941 | CK_ULONG_PTR pulDigestLen) | ||||
| 1942 | { | ||||
| 1943 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 1944 | |||||
| 1945 | PR_LOG(modlog, 1, ("C_Digest"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_Digest" ); } } while (0); | ||||
| 1946 | log_handle(3, fmt_hSession, hSession); | ||||
| 1947 | PR_LOG(modlog, 3, (fmt_pData, pData))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pData , pData); } } while (0); | ||||
| 1948 | PR_LOG(modlog, 3, (fmt_ulDataLen, ulDataLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulDataLen , ulDataLen); } } while (0); | ||||
| 1949 | PR_LOG(modlog, 3, (fmt_pDigest, pDigest))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pDigest , pDigest); } } while (0); | ||||
| 1950 | PR_LOG(modlog, 3, (fmt_pulDigestLen, pulDigestLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pulDigestLen , pulDigestLen); } } while (0); | ||||
| 1951 | nssdbg_start_time(FUNC_C_DIGEST38, &start); | ||||
| 1952 | rv = module_functions->C_Digest(hSession, | ||||
| 1953 | pData, | ||||
| 1954 | ulDataLen, | ||||
| 1955 | pDigest, | ||||
| 1956 | pulDigestLen); | ||||
| 1957 | nssdbg_finish_time(FUNC_C_DIGEST38, start); | ||||
| 1958 | PR_LOG(modlog, 4, (fmt_spulDigestLen, *pulDigestLen))do { if (((modlog)->level >= (4))) { PR_LogPrint (fmt_spulDigestLen , *pulDigestLen); } } while (0); | ||||
| 1959 | log_rv(rv); | ||||
| 1960 | return rv; | ||||
| 1961 | } | ||||
| 1962 | |||||
| 1963 | CK_RV | ||||
| 1964 | NSSDBGC_DigestUpdate( | ||||
| 1965 | CK_SESSION_HANDLE hSession, | ||||
| 1966 | CK_BYTE_PTR pPart, | ||||
| 1967 | CK_ULONG ulPartLen) | ||||
| 1968 | { | ||||
| 1969 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 1970 | |||||
| 1971 | PR_LOG(modlog, 1, ("C_DigestUpdate"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_DigestUpdate" ); } } while (0); | ||||
| 1972 | log_handle(3, fmt_hSession, hSession); | ||||
| 1973 | PR_LOG(modlog, 3, (fmt_pPart, pPart))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pPart , pPart); } } while (0); | ||||
| 1974 | PR_LOG(modlog, 3, (fmt_ulPartLen, ulPartLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulPartLen , ulPartLen); } } while (0); | ||||
| 1975 | nssdbg_start_time(FUNC_C_DIGESTUPDATE39, &start); | ||||
| 1976 | rv = module_functions->C_DigestUpdate(hSession, | ||||
| 1977 | pPart, | ||||
| 1978 | ulPartLen); | ||||
| 1979 | nssdbg_finish_time(FUNC_C_DIGESTUPDATE39, start); | ||||
| 1980 | log_rv(rv); | ||||
| 1981 | return rv; | ||||
| 1982 | } | ||||
| 1983 | |||||
| 1984 | CK_RV | ||||
| 1985 | NSSDBGC_DigestKey( | ||||
| 1986 | CK_SESSION_HANDLE hSession, | ||||
| 1987 | CK_OBJECT_HANDLE hKey) | ||||
| 1988 | { | ||||
| 1989 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 1990 | |||||
| 1991 | PR_LOG(modlog, 1, ("C_DigestKey"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_DigestKey" ); } } while (0); | ||||
| 1992 | log_handle(3, fmt_hSession, hSession); | ||||
| 1993 | nssdbg_start_time(FUNC_C_DIGESTKEY40, &start); | ||||
| 1994 | rv = module_functions->C_DigestKey(hSession, | ||||
| 1995 | hKey); | ||||
| 1996 | nssdbg_finish_time(FUNC_C_DIGESTKEY40, start); | ||||
| 1997 | log_rv(rv); | ||||
| 1998 | return rv; | ||||
| 1999 | } | ||||
| 2000 | |||||
| 2001 | CK_RV | ||||
| 2002 | NSSDBGC_DigestFinal( | ||||
| 2003 | CK_SESSION_HANDLE hSession, | ||||
| 2004 | CK_BYTE_PTR pDigest, | ||||
| 2005 | CK_ULONG_PTR pulDigestLen) | ||||
| 2006 | { | ||||
| 2007 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 2008 | |||||
| 2009 | PR_LOG(modlog, 1, ("C_DigestFinal"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_DigestFinal" ); } } while (0); | ||||
| 2010 | log_handle(3, fmt_hSession, hSession); | ||||
| 2011 | PR_LOG(modlog, 3, (fmt_pDigest, pDigest))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pDigest , pDigest); } } while (0); | ||||
| 2012 | PR_LOG(modlog, 3, (fmt_pulDigestLen, pulDigestLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pulDigestLen , pulDigestLen); } } while (0); | ||||
| 2013 | nssdbg_start_time(FUNC_C_DIGESTFINAL41, &start); | ||||
| 2014 | rv = module_functions->C_DigestFinal(hSession, | ||||
| 2015 | pDigest, | ||||
| 2016 | pulDigestLen); | ||||
| 2017 | nssdbg_finish_time(FUNC_C_DIGESTFINAL41, start); | ||||
| 2018 | PR_LOG(modlog, 4, (fmt_spulDigestLen, *pulDigestLen))do { if (((modlog)->level >= (4))) { PR_LogPrint (fmt_spulDigestLen , *pulDigestLen); } } while (0); | ||||
| 2019 | log_rv(rv); | ||||
| 2020 | return rv; | ||||
| 2021 | } | ||||
| 2022 | |||||
| 2023 | CK_RV | ||||
| 2024 | NSSDBGC_SignInit( | ||||
| 2025 | CK_SESSION_HANDLE hSession, | ||||
| 2026 | CK_MECHANISM_PTR pMechanism, | ||||
| 2027 | CK_OBJECT_HANDLE hKey) | ||||
| 2028 | { | ||||
| 2029 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 2030 | |||||
| 2031 | PR_LOG(modlog, 1, ("C_SignInit"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_SignInit" ); } } while (0); | ||||
| 2032 | log_handle(3, fmt_hSession, hSession); | ||||
| 2033 | PR_LOG(modlog, 3, (fmt_pMechanism, pMechanism))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pMechanism , pMechanism); } } while (0); | ||||
| 2034 | log_handle(3, fmt_hKey, hKey); | ||||
| 2035 | print_mechanism(pMechanism); | ||||
| 2036 | nssdbg_start_time(FUNC_C_SIGNINIT42, &start); | ||||
| 2037 | rv = module_functions->C_SignInit(hSession, | ||||
| 2038 | pMechanism, | ||||
| 2039 | hKey); | ||||
| 2040 | nssdbg_finish_time(FUNC_C_SIGNINIT42, start); | ||||
| 2041 | log_rv(rv); | ||||
| 2042 | return rv; | ||||
| 2043 | } | ||||
| 2044 | |||||
| 2045 | CK_RV | ||||
| 2046 | NSSDBGC_Sign( | ||||
| 2047 | CK_SESSION_HANDLE hSession, | ||||
| 2048 | CK_BYTE_PTR pData, | ||||
| 2049 | CK_ULONG ulDataLen, | ||||
| 2050 | CK_BYTE_PTR pSignature, | ||||
| 2051 | CK_ULONG_PTR pulSignatureLen) | ||||
| 2052 | { | ||||
| 2053 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 2054 | |||||
| 2055 | PR_LOG(modlog, 1, ("C_Sign"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_Sign" ); } } while (0); | ||||
| 2056 | log_handle(3, fmt_hSession, hSession); | ||||
| 2057 | PR_LOG(modlog, 3, (fmt_pData, pData))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pData , pData); } } while (0); | ||||
| 2058 | PR_LOG(modlog, 3, (fmt_ulDataLen, ulDataLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulDataLen , ulDataLen); } } while (0); | ||||
| 2059 | PR_LOG(modlog, 3, (fmt_pSignature, pSignature))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pSignature , pSignature); } } while (0); | ||||
| 2060 | PR_LOG(modlog, 3, (fmt_pulSignatureLen, pulSignatureLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pulSignatureLen , pulSignatureLen); } } while (0); | ||||
| 2061 | nssdbg_start_time(FUNC_C_SIGN43, &start); | ||||
| 2062 | rv = module_functions->C_Sign(hSession, | ||||
| 2063 | pData, | ||||
| 2064 | ulDataLen, | ||||
| 2065 | pSignature, | ||||
| 2066 | pulSignatureLen); | ||||
| 2067 | nssdbg_finish_time(FUNC_C_SIGN43, start); | ||||
| 2068 | PR_LOG(modlog, 4, (fmt_spulSignatureLen, *pulSignatureLen))do { if (((modlog)->level >= (4))) { PR_LogPrint (fmt_spulSignatureLen , *pulSignatureLen); } } while (0); | ||||
| 2069 | log_rv(rv); | ||||
| 2070 | return rv; | ||||
| 2071 | } | ||||
| 2072 | |||||
| 2073 | CK_RV | ||||
| 2074 | NSSDBGC_SignUpdate( | ||||
| 2075 | CK_SESSION_HANDLE hSession, | ||||
| 2076 | CK_BYTE_PTR pPart, | ||||
| 2077 | CK_ULONG ulPartLen) | ||||
| 2078 | { | ||||
| 2079 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 2080 | |||||
| 2081 | PR_LOG(modlog, 1, ("C_SignUpdate"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_SignUpdate" ); } } while (0); | ||||
| 2082 | log_handle(3, fmt_hSession, hSession); | ||||
| 2083 | PR_LOG(modlog, 3, (fmt_pPart, pPart))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pPart , pPart); } } while (0); | ||||
| 2084 | PR_LOG(modlog, 3, (fmt_ulPartLen, ulPartLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulPartLen , ulPartLen); } } while (0); | ||||
| 2085 | nssdbg_start_time(FUNC_C_SIGNUPDATE44, &start); | ||||
| 2086 | rv = module_functions->C_SignUpdate(hSession, | ||||
| 2087 | pPart, | ||||
| 2088 | ulPartLen); | ||||
| 2089 | nssdbg_finish_time(FUNC_C_SIGNUPDATE44, start); | ||||
| 2090 | log_rv(rv); | ||||
| 2091 | return rv; | ||||
| 2092 | } | ||||
| 2093 | |||||
| 2094 | CK_RV | ||||
| 2095 | NSSDBGC_SignFinal( | ||||
| 2096 | CK_SESSION_HANDLE hSession, | ||||
| 2097 | CK_BYTE_PTR pSignature, | ||||
| 2098 | CK_ULONG_PTR pulSignatureLen) | ||||
| 2099 | { | ||||
| 2100 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 2101 | |||||
| 2102 | PR_LOG(modlog, 1, ("C_SignFinal"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_SignFinal" ); } } while (0); | ||||
| 2103 | log_handle(3, fmt_hSession, hSession); | ||||
| 2104 | PR_LOG(modlog, 3, (fmt_pSignature, pSignature))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pSignature , pSignature); } } while (0); | ||||
| 2105 | PR_LOG(modlog, 3, (fmt_pulSignatureLen, pulSignatureLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pulSignatureLen , pulSignatureLen); } } while (0); | ||||
| 2106 | nssdbg_start_time(FUNC_C_SIGNFINAL45, &start); | ||||
| 2107 | rv = module_functions->C_SignFinal(hSession, | ||||
| 2108 | pSignature, | ||||
| 2109 | pulSignatureLen); | ||||
| 2110 | nssdbg_finish_time(FUNC_C_SIGNFINAL45, start); | ||||
| 2111 | PR_LOG(modlog, 4, (fmt_spulSignatureLen, *pulSignatureLen))do { if (((modlog)->level >= (4))) { PR_LogPrint (fmt_spulSignatureLen , *pulSignatureLen); } } while (0); | ||||
| 2112 | log_rv(rv); | ||||
| 2113 | return rv; | ||||
| 2114 | } | ||||
| 2115 | |||||
| 2116 | CK_RV | ||||
| 2117 | NSSDBGC_SignRecoverInit( | ||||
| 2118 | CK_SESSION_HANDLE hSession, | ||||
| 2119 | CK_MECHANISM_PTR pMechanism, | ||||
| 2120 | CK_OBJECT_HANDLE hKey) | ||||
| 2121 | { | ||||
| 2122 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 2123 | |||||
| 2124 | PR_LOG(modlog, 1, ("C_SignRecoverInit"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_SignRecoverInit" ); } } while (0); | ||||
| 2125 | log_handle(3, fmt_hSession, hSession); | ||||
| 2126 | PR_LOG(modlog, 3, (fmt_pMechanism, pMechanism))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pMechanism , pMechanism); } } while (0); | ||||
| 2127 | log_handle(3, fmt_hKey, hKey); | ||||
| 2128 | print_mechanism(pMechanism); | ||||
| 2129 | nssdbg_start_time(FUNC_C_SIGNRECOVERINIT46, &start); | ||||
| 2130 | rv = module_functions->C_SignRecoverInit(hSession, | ||||
| 2131 | pMechanism, | ||||
| 2132 | hKey); | ||||
| 2133 | nssdbg_finish_time(FUNC_C_SIGNRECOVERINIT46, start); | ||||
| 2134 | log_rv(rv); | ||||
| 2135 | return rv; | ||||
| 2136 | } | ||||
| 2137 | |||||
| 2138 | CK_RV | ||||
| 2139 | NSSDBGC_SignRecover( | ||||
| 2140 | CK_SESSION_HANDLE hSession, | ||||
| 2141 | CK_BYTE_PTR pData, | ||||
| 2142 | CK_ULONG ulDataLen, | ||||
| 2143 | CK_BYTE_PTR pSignature, | ||||
| 2144 | CK_ULONG_PTR pulSignatureLen) | ||||
| 2145 | { | ||||
| 2146 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 2147 | |||||
| 2148 | PR_LOG(modlog, 1, ("C_SignRecover"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_SignRecover" ); } } while (0); | ||||
| 2149 | log_handle(3, fmt_hSession, hSession); | ||||
| 2150 | PR_LOG(modlog, 3, (fmt_pData, pData))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pData , pData); } } while (0); | ||||
| 2151 | PR_LOG(modlog, 3, (fmt_ulDataLen, ulDataLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulDataLen , ulDataLen); } } while (0); | ||||
| 2152 | PR_LOG(modlog, 3, (fmt_pSignature, pSignature))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pSignature , pSignature); } } while (0); | ||||
| 2153 | PR_LOG(modlog, 3, (fmt_pulSignatureLen, pulSignatureLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pulSignatureLen , pulSignatureLen); } } while (0); | ||||
| 2154 | nssdbg_start_time(FUNC_C_SIGNRECOVER47, &start); | ||||
| 2155 | rv = module_functions->C_SignRecover(hSession, | ||||
| 2156 | pData, | ||||
| 2157 | ulDataLen, | ||||
| 2158 | pSignature, | ||||
| 2159 | pulSignatureLen); | ||||
| 2160 | nssdbg_finish_time(FUNC_C_SIGNRECOVER47, start); | ||||
| 2161 | PR_LOG(modlog, 4, (fmt_spulSignatureLen, *pulSignatureLen))do { if (((modlog)->level >= (4))) { PR_LogPrint (fmt_spulSignatureLen , *pulSignatureLen); } } while (0); | ||||
| 2162 | log_rv(rv); | ||||
| 2163 | return rv; | ||||
| 2164 | } | ||||
| 2165 | |||||
| 2166 | CK_RV | ||||
| 2167 | NSSDBGC_VerifyInit( | ||||
| 2168 | CK_SESSION_HANDLE hSession, | ||||
| 2169 | CK_MECHANISM_PTR pMechanism, | ||||
| 2170 | CK_OBJECT_HANDLE hKey) | ||||
| 2171 | { | ||||
| 2172 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 2173 | |||||
| 2174 | PR_LOG(modlog, 1, ("C_VerifyInit"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_VerifyInit" ); } } while (0); | ||||
| 2175 | log_handle(3, fmt_hSession, hSession); | ||||
| 2176 | PR_LOG(modlog, 3, (fmt_pMechanism, pMechanism))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pMechanism , pMechanism); } } while (0); | ||||
| 2177 | log_handle(3, fmt_hKey, hKey); | ||||
| 2178 | print_mechanism(pMechanism); | ||||
| 2179 | nssdbg_start_time(FUNC_C_VERIFYINIT48, &start); | ||||
| 2180 | rv = module_functions->C_VerifyInit(hSession, | ||||
| 2181 | pMechanism, | ||||
| 2182 | hKey); | ||||
| 2183 | nssdbg_finish_time(FUNC_C_VERIFYINIT48, start); | ||||
| 2184 | log_rv(rv); | ||||
| 2185 | return rv; | ||||
| 2186 | } | ||||
| 2187 | |||||
| 2188 | CK_RV | ||||
| 2189 | NSSDBGC_Verify( | ||||
| 2190 | CK_SESSION_HANDLE hSession, | ||||
| 2191 | CK_BYTE_PTR pData, | ||||
| 2192 | CK_ULONG ulDataLen, | ||||
| 2193 | CK_BYTE_PTR pSignature, | ||||
| 2194 | CK_ULONG ulSignatureLen) | ||||
| 2195 | { | ||||
| 2196 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 2197 | |||||
| 2198 | PR_LOG(modlog, 1, ("C_Verify"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_Verify" ); } } while (0); | ||||
| 2199 | log_handle(3, fmt_hSession, hSession); | ||||
| 2200 | PR_LOG(modlog, 3, (fmt_pData, pData))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pData , pData); } } while (0); | ||||
| 2201 | PR_LOG(modlog, 3, (fmt_ulDataLen, ulDataLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulDataLen , ulDataLen); } } while (0); | ||||
| 2202 | PR_LOG(modlog, 3, (fmt_pSignature, pSignature))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pSignature , pSignature); } } while (0); | ||||
| 2203 | PR_LOG(modlog, 3, (fmt_ulSignatureLen, ulSignatureLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulSignatureLen , ulSignatureLen); } } while (0); | ||||
| 2204 | nssdbg_start_time(FUNC_C_VERIFY49, &start); | ||||
| 2205 | rv = module_functions->C_Verify(hSession, | ||||
| 2206 | pData, | ||||
| 2207 | ulDataLen, | ||||
| 2208 | pSignature, | ||||
| 2209 | ulSignatureLen); | ||||
| 2210 | nssdbg_finish_time(FUNC_C_VERIFY49, start); | ||||
| 2211 | log_rv(rv); | ||||
| 2212 | return rv; | ||||
| 2213 | } | ||||
| 2214 | |||||
| 2215 | CK_RV | ||||
| 2216 | NSSDBGC_VerifyUpdate( | ||||
| 2217 | CK_SESSION_HANDLE hSession, | ||||
| 2218 | CK_BYTE_PTR pPart, | ||||
| 2219 | CK_ULONG ulPartLen) | ||||
| 2220 | { | ||||
| 2221 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 2222 | |||||
| 2223 | PR_LOG(modlog, 1, ("C_VerifyUpdate"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_VerifyUpdate" ); } } while (0); | ||||
| 2224 | log_handle(3, fmt_hSession, hSession); | ||||
| 2225 | PR_LOG(modlog, 3, (fmt_pPart, pPart))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pPart , pPart); } } while (0); | ||||
| 2226 | PR_LOG(modlog, 3, (fmt_ulPartLen, ulPartLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulPartLen , ulPartLen); } } while (0); | ||||
| 2227 | nssdbg_start_time(FUNC_C_VERIFYUPDATE50, &start); | ||||
| 2228 | rv = module_functions->C_VerifyUpdate(hSession, | ||||
| 2229 | pPart, | ||||
| 2230 | ulPartLen); | ||||
| 2231 | nssdbg_finish_time(FUNC_C_VERIFYUPDATE50, start); | ||||
| 2232 | log_rv(rv); | ||||
| 2233 | return rv; | ||||
| 2234 | } | ||||
| 2235 | |||||
| 2236 | CK_RV | ||||
| 2237 | NSSDBGC_VerifyFinal( | ||||
| 2238 | CK_SESSION_HANDLE hSession, | ||||
| 2239 | CK_BYTE_PTR pSignature, | ||||
| 2240 | CK_ULONG ulSignatureLen) | ||||
| 2241 | { | ||||
| 2242 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 2243 | |||||
| 2244 | PR_LOG(modlog, 1, ("C_VerifyFinal"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_VerifyFinal" ); } } while (0); | ||||
| 2245 | log_handle(3, fmt_hSession, hSession); | ||||
| 2246 | PR_LOG(modlog, 3, (fmt_pSignature, pSignature))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pSignature , pSignature); } } while (0); | ||||
| 2247 | PR_LOG(modlog, 3, (fmt_ulSignatureLen, ulSignatureLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulSignatureLen , ulSignatureLen); } } while (0); | ||||
| 2248 | nssdbg_start_time(FUNC_C_VERIFYFINAL51, &start); | ||||
| 2249 | rv = module_functions->C_VerifyFinal(hSession, | ||||
| 2250 | pSignature, | ||||
| 2251 | ulSignatureLen); | ||||
| 2252 | nssdbg_finish_time(FUNC_C_VERIFYFINAL51, start); | ||||
| 2253 | log_rv(rv); | ||||
| 2254 | return rv; | ||||
| 2255 | } | ||||
| 2256 | |||||
| 2257 | CK_RV | ||||
| 2258 | NSSDBGC_VerifyRecoverInit( | ||||
| 2259 | CK_SESSION_HANDLE hSession, | ||||
| 2260 | CK_MECHANISM_PTR pMechanism, | ||||
| 2261 | CK_OBJECT_HANDLE hKey) | ||||
| 2262 | { | ||||
| 2263 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 2264 | |||||
| 2265 | PR_LOG(modlog, 1, ("C_VerifyRecoverInit"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_VerifyRecoverInit" ); } } while (0); | ||||
| 2266 | log_handle(3, fmt_hSession, hSession); | ||||
| 2267 | PR_LOG(modlog, 3, (fmt_pMechanism, pMechanism))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pMechanism , pMechanism); } } while (0); | ||||
| 2268 | log_handle(3, fmt_hKey, hKey); | ||||
| 2269 | print_mechanism(pMechanism); | ||||
| 2270 | nssdbg_start_time(FUNC_C_VERIFYRECOVERINIT52, &start); | ||||
| 2271 | rv = module_functions->C_VerifyRecoverInit(hSession, | ||||
| 2272 | pMechanism, | ||||
| 2273 | hKey); | ||||
| 2274 | nssdbg_finish_time(FUNC_C_VERIFYRECOVERINIT52, start); | ||||
| 2275 | log_rv(rv); | ||||
| 2276 | return rv; | ||||
| 2277 | } | ||||
| 2278 | |||||
| 2279 | CK_RV | ||||
| 2280 | NSSDBGC_VerifyRecover( | ||||
| 2281 | CK_SESSION_HANDLE hSession, | ||||
| 2282 | CK_BYTE_PTR pSignature, | ||||
| 2283 | CK_ULONG ulSignatureLen, | ||||
| 2284 | CK_BYTE_PTR pData, | ||||
| 2285 | CK_ULONG_PTR pulDataLen) | ||||
| 2286 | { | ||||
| 2287 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 2288 | |||||
| 2289 | PR_LOG(modlog, 1, ("C_VerifyRecover"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_VerifyRecover" ); } } while (0); | ||||
| 2290 | log_handle(3, fmt_hSession, hSession); | ||||
| 2291 | PR_LOG(modlog, 3, (fmt_pSignature, pSignature))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pSignature , pSignature); } } while (0); | ||||
| 2292 | PR_LOG(modlog, 3, (fmt_ulSignatureLen, ulSignatureLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulSignatureLen , ulSignatureLen); } } while (0); | ||||
| 2293 | PR_LOG(modlog, 3, (fmt_pData, pData))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pData , pData); } } while (0); | ||||
| 2294 | PR_LOG(modlog, 3, (fmt_pulDataLen, pulDataLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pulDataLen , pulDataLen); } } while (0); | ||||
| 2295 | nssdbg_start_time(FUNC_C_VERIFYRECOVER53, &start); | ||||
| 2296 | rv = module_functions->C_VerifyRecover(hSession, | ||||
| 2297 | pSignature, | ||||
| 2298 | ulSignatureLen, | ||||
| 2299 | pData, | ||||
| 2300 | pulDataLen); | ||||
| 2301 | nssdbg_finish_time(FUNC_C_VERIFYRECOVER53, start); | ||||
| 2302 | PR_LOG(modlog, 4, (fmt_spulDataLen, *pulDataLen))do { if (((modlog)->level >= (4))) { PR_LogPrint (fmt_spulDataLen , *pulDataLen); } } while (0); | ||||
| 2303 | log_rv(rv); | ||||
| 2304 | return rv; | ||||
| 2305 | } | ||||
| 2306 | |||||
| 2307 | CK_RV | ||||
| 2308 | NSSDBGC_DigestEncryptUpdate( | ||||
| 2309 | CK_SESSION_HANDLE hSession, | ||||
| 2310 | CK_BYTE_PTR pPart, | ||||
| 2311 | CK_ULONG ulPartLen, | ||||
| 2312 | CK_BYTE_PTR pEncryptedPart, | ||||
| 2313 | CK_ULONG_PTR pulEncryptedPartLen) | ||||
| 2314 | { | ||||
| 2315 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 2316 | |||||
| 2317 | PR_LOG(modlog, 1, ("C_DigestEncryptUpdate"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_DigestEncryptUpdate" ); } } while (0); | ||||
| 2318 | log_handle(3, fmt_hSession, hSession); | ||||
| 2319 | PR_LOG(modlog, 3, (fmt_pPart, pPart))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pPart , pPart); } } while (0); | ||||
| 2320 | PR_LOG(modlog, 3, (fmt_ulPartLen, ulPartLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulPartLen , ulPartLen); } } while (0); | ||||
| 2321 | PR_LOG(modlog, 3, (fmt_pEncryptedPart, pEncryptedPart))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pEncryptedPart , pEncryptedPart); } } while (0); | ||||
| 2322 | PR_LOG(modlog, 3, (fmt_pulEncryptedPartLen, pulEncryptedPartLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pulEncryptedPartLen , pulEncryptedPartLen); } } while (0); | ||||
| 2323 | nssdbg_start_time(FUNC_C_DIGESTENCRYPTUPDATE54, &start); | ||||
| 2324 | rv = module_functions->C_DigestEncryptUpdate(hSession, | ||||
| 2325 | pPart, | ||||
| 2326 | ulPartLen, | ||||
| 2327 | pEncryptedPart, | ||||
| 2328 | pulEncryptedPartLen); | ||||
| 2329 | nssdbg_finish_time(FUNC_C_DIGESTENCRYPTUPDATE54, start); | ||||
| 2330 | PR_LOG(modlog, 4, (fmt_spulEncryptedPartLen, *pulEncryptedPartLen))do { if (((modlog)->level >= (4))) { PR_LogPrint (fmt_spulEncryptedPartLen , *pulEncryptedPartLen); } } while (0); | ||||
| 2331 | log_rv(rv); | ||||
| 2332 | return rv; | ||||
| 2333 | } | ||||
| 2334 | |||||
| 2335 | CK_RV | ||||
| 2336 | NSSDBGC_DecryptDigestUpdate( | ||||
| 2337 | CK_SESSION_HANDLE hSession, | ||||
| 2338 | CK_BYTE_PTR pEncryptedPart, | ||||
| 2339 | CK_ULONG ulEncryptedPartLen, | ||||
| 2340 | CK_BYTE_PTR pPart, | ||||
| 2341 | CK_ULONG_PTR pulPartLen) | ||||
| 2342 | { | ||||
| 2343 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 2344 | |||||
| 2345 | PR_LOG(modlog, 1, ("C_DecryptDigestUpdate"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_DecryptDigestUpdate" ); } } while (0); | ||||
| 2346 | log_handle(3, fmt_hSession, hSession); | ||||
| 2347 | PR_LOG(modlog, 3, (fmt_pEncryptedPart, pEncryptedPart))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pEncryptedPart , pEncryptedPart); } } while (0); | ||||
| 2348 | PR_LOG(modlog, 3, (fmt_ulEncryptedPartLen, ulEncryptedPartLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulEncryptedPartLen , ulEncryptedPartLen); } } while (0); | ||||
| 2349 | PR_LOG(modlog, 3, (fmt_pPart, pPart))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pPart , pPart); } } while (0); | ||||
| 2350 | PR_LOG(modlog, 3, (fmt_pulPartLen, pulPartLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pulPartLen , pulPartLen); } } while (0); | ||||
| 2351 | nssdbg_start_time(FUNC_C_DECRYPTDIGESTUPDATE55, &start); | ||||
| 2352 | rv = module_functions->C_DecryptDigestUpdate(hSession, | ||||
| 2353 | pEncryptedPart, | ||||
| 2354 | ulEncryptedPartLen, | ||||
| 2355 | pPart, | ||||
| 2356 | pulPartLen); | ||||
| 2357 | nssdbg_finish_time(FUNC_C_DECRYPTDIGESTUPDATE55, start); | ||||
| 2358 | PR_LOG(modlog, 4, (fmt_spulPartLen, *pulPartLen))do { if (((modlog)->level >= (4))) { PR_LogPrint (fmt_spulPartLen , *pulPartLen); } } while (0); | ||||
| 2359 | log_rv(rv); | ||||
| 2360 | return rv; | ||||
| 2361 | } | ||||
| 2362 | |||||
| 2363 | CK_RV | ||||
| 2364 | NSSDBGC_SignEncryptUpdate( | ||||
| 2365 | CK_SESSION_HANDLE hSession, | ||||
| 2366 | CK_BYTE_PTR pPart, | ||||
| 2367 | CK_ULONG ulPartLen, | ||||
| 2368 | CK_BYTE_PTR pEncryptedPart, | ||||
| 2369 | CK_ULONG_PTR pulEncryptedPartLen) | ||||
| 2370 | { | ||||
| 2371 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 2372 | |||||
| 2373 | PR_LOG(modlog, 1, ("C_SignEncryptUpdate"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_SignEncryptUpdate" ); } } while (0); | ||||
| 2374 | log_handle(3, fmt_hSession, hSession); | ||||
| 2375 | PR_LOG(modlog, 3, (fmt_pPart, pPart))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pPart , pPart); } } while (0); | ||||
| 2376 | PR_LOG(modlog, 3, (fmt_ulPartLen, ulPartLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulPartLen , ulPartLen); } } while (0); | ||||
| 2377 | PR_LOG(modlog, 3, (fmt_pEncryptedPart, pEncryptedPart))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pEncryptedPart , pEncryptedPart); } } while (0); | ||||
| 2378 | PR_LOG(modlog, 3, (fmt_pulEncryptedPartLen, pulEncryptedPartLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pulEncryptedPartLen , pulEncryptedPartLen); } } while (0); | ||||
| 2379 | nssdbg_start_time(FUNC_C_SIGNENCRYPTUPDATE56, &start); | ||||
| 2380 | rv = module_functions->C_SignEncryptUpdate(hSession, | ||||
| 2381 | pPart, | ||||
| 2382 | ulPartLen, | ||||
| 2383 | pEncryptedPart, | ||||
| 2384 | pulEncryptedPartLen); | ||||
| 2385 | nssdbg_finish_time(FUNC_C_SIGNENCRYPTUPDATE56, start); | ||||
| 2386 | PR_LOG(modlog, 4, (fmt_spulEncryptedPartLen, *pulEncryptedPartLen))do { if (((modlog)->level >= (4))) { PR_LogPrint (fmt_spulEncryptedPartLen , *pulEncryptedPartLen); } } while (0); | ||||
| 2387 | log_rv(rv); | ||||
| 2388 | return rv; | ||||
| 2389 | } | ||||
| 2390 | |||||
| 2391 | CK_RV | ||||
| 2392 | NSSDBGC_DecryptVerifyUpdate( | ||||
| 2393 | CK_SESSION_HANDLE hSession, | ||||
| 2394 | CK_BYTE_PTR pEncryptedPart, | ||||
| 2395 | CK_ULONG ulEncryptedPartLen, | ||||
| 2396 | CK_BYTE_PTR pPart, | ||||
| 2397 | CK_ULONG_PTR pulPartLen) | ||||
| 2398 | { | ||||
| 2399 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 2400 | |||||
| 2401 | PR_LOG(modlog, 1, ("C_DecryptVerifyUpdate"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_DecryptVerifyUpdate" ); } } while (0); | ||||
| 2402 | log_handle(3, fmt_hSession, hSession); | ||||
| 2403 | PR_LOG(modlog, 3, (fmt_pEncryptedPart, pEncryptedPart))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pEncryptedPart , pEncryptedPart); } } while (0); | ||||
| 2404 | PR_LOG(modlog, 3, (fmt_ulEncryptedPartLen, ulEncryptedPartLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulEncryptedPartLen , ulEncryptedPartLen); } } while (0); | ||||
| 2405 | PR_LOG(modlog, 3, (fmt_pPart, pPart))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pPart , pPart); } } while (0); | ||||
| 2406 | PR_LOG(modlog, 3, (fmt_pulPartLen, pulPartLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pulPartLen , pulPartLen); } } while (0); | ||||
| 2407 | nssdbg_start_time(FUNC_C_DECRYPTVERIFYUPDATE57, &start); | ||||
| 2408 | rv = module_functions->C_DecryptVerifyUpdate(hSession, | ||||
| 2409 | pEncryptedPart, | ||||
| 2410 | ulEncryptedPartLen, | ||||
| 2411 | pPart, | ||||
| 2412 | pulPartLen); | ||||
| 2413 | nssdbg_finish_time(FUNC_C_DECRYPTVERIFYUPDATE57, start); | ||||
| 2414 | PR_LOG(modlog, 4, (fmt_spulPartLen, *pulPartLen))do { if (((modlog)->level >= (4))) { PR_LogPrint (fmt_spulPartLen , *pulPartLen); } } while (0); | ||||
| 2415 | log_rv(rv); | ||||
| 2416 | return rv; | ||||
| 2417 | } | ||||
| 2418 | |||||
| 2419 | CK_RV | ||||
| 2420 | NSSDBGC_GenerateKey( | ||||
| 2421 | CK_SESSION_HANDLE hSession, | ||||
| 2422 | CK_MECHANISM_PTR pMechanism, | ||||
| 2423 | CK_ATTRIBUTE_PTR pTemplate, | ||||
| 2424 | CK_ULONG ulCount, | ||||
| 2425 | CK_OBJECT_HANDLE_PTR phKey) | ||||
| 2426 | { | ||||
| 2427 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 2428 | |||||
| 2429 | PR_LOG(modlog, 1, ("C_GenerateKey"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_GenerateKey" ); } } while (0); | ||||
| 2430 | log_handle(3, fmt_hSession, hSession); | ||||
| 2431 | PR_LOG(modlog, 3, (fmt_pMechanism, pMechanism))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pMechanism , pMechanism); } } while (0); | ||||
| 2432 | PR_LOG(modlog, 3, (fmt_pTemplate, pTemplate))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pTemplate , pTemplate); } } while (0); | ||||
| 2433 | PR_LOG(modlog, 3, (fmt_ulCount, ulCount))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulCount , ulCount); } } while (0); | ||||
| 2434 | PR_LOG(modlog, 3, (fmt_phKey, phKey))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_phKey , phKey); } } while (0); | ||||
| 2435 | print_template(pTemplate, ulCount); | ||||
| 2436 | print_mechanism(pMechanism); | ||||
| 2437 | nssdbg_start_time(FUNC_C_GENERATEKEY58, &start); | ||||
| 2438 | rv = module_functions->C_GenerateKey(hSession, | ||||
| 2439 | pMechanism, | ||||
| 2440 | pTemplate, | ||||
| 2441 | ulCount, | ||||
| 2442 | phKey); | ||||
| 2443 | nssdbg_finish_time(FUNC_C_GENERATEKEY58, start); | ||||
| 2444 | log_handle(4, fmt_sphKey, *phKey); | ||||
| 2445 | log_rv(rv); | ||||
| 2446 | return rv; | ||||
| 2447 | } | ||||
| 2448 | |||||
| 2449 | CK_RV | ||||
| 2450 | NSSDBGC_GenerateKeyPair( | ||||
| 2451 | CK_SESSION_HANDLE hSession, | ||||
| 2452 | CK_MECHANISM_PTR pMechanism, | ||||
| 2453 | CK_ATTRIBUTE_PTR pPublicKeyTemplate, | ||||
| 2454 | CK_ULONG ulPublicKeyAttributeCount, | ||||
| 2455 | CK_ATTRIBUTE_PTR pPrivateKeyTemplate, | ||||
| 2456 | CK_ULONG ulPrivateKeyAttributeCount, | ||||
| 2457 | CK_OBJECT_HANDLE_PTR phPublicKey, | ||||
| 2458 | CK_OBJECT_HANDLE_PTR phPrivateKey) | ||||
| 2459 | { | ||||
| 2460 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 2461 | |||||
| 2462 | PR_LOG(modlog, 1, ("C_GenerateKeyPair"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_GenerateKeyPair" ); } } while (0); | ||||
| 2463 | log_handle(3, fmt_hSession, hSession); | ||||
| 2464 | PR_LOG(modlog, 3, (fmt_pMechanism, pMechanism))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pMechanism , pMechanism); } } while (0); | ||||
| 2465 | PR_LOG(modlog, 3, (" pPublicKeyTemplate = 0x%p", pPublicKeyTemplate))do { if (((modlog)->level >= (3))) { PR_LogPrint (" pPublicKeyTemplate = 0x%p" , pPublicKeyTemplate); } } while (0); | ||||
| 2466 | PR_LOG(modlog, 3, (" ulPublicKeyAttributeCount = %d", ulPublicKeyAttributeCount))do { if (((modlog)->level >= (3))) { PR_LogPrint (" ulPublicKeyAttributeCount = %d" , ulPublicKeyAttributeCount); } } while (0); | ||||
| 2467 | PR_LOG(modlog, 3, (" pPrivateKeyTemplate = 0x%p", pPrivateKeyTemplate))do { if (((modlog)->level >= (3))) { PR_LogPrint (" pPrivateKeyTemplate = 0x%p" , pPrivateKeyTemplate); } } while (0); | ||||
| 2468 | PR_LOG(modlog, 3, (" ulPrivateKeyAttributeCount = %d", ulPrivateKeyAttributeCount))do { if (((modlog)->level >= (3))) { PR_LogPrint (" ulPrivateKeyAttributeCount = %d" , ulPrivateKeyAttributeCount); } } while (0); | ||||
| 2469 | PR_LOG(modlog, 3, (" phPublicKey = 0x%p", phPublicKey))do { if (((modlog)->level >= (3))) { PR_LogPrint (" phPublicKey = 0x%p" , phPublicKey); } } while (0); | ||||
| 2470 | print_template(pPublicKeyTemplate, ulPublicKeyAttributeCount); | ||||
| 2471 | PR_LOG(modlog, 3, (" phPrivateKey = 0x%p", phPrivateKey))do { if (((modlog)->level >= (3))) { PR_LogPrint (" phPrivateKey = 0x%p" , phPrivateKey); } } while (0); | ||||
| 2472 | print_template(pPrivateKeyTemplate, ulPrivateKeyAttributeCount); | ||||
| 2473 | print_mechanism(pMechanism); | ||||
| 2474 | nssdbg_start_time(FUNC_C_GENERATEKEYPAIR59, &start); | ||||
| 2475 | rv = module_functions->C_GenerateKeyPair(hSession, | ||||
| 2476 | pMechanism, | ||||
| 2477 | pPublicKeyTemplate, | ||||
| 2478 | ulPublicKeyAttributeCount, | ||||
| 2479 | pPrivateKeyTemplate, | ||||
| 2480 | ulPrivateKeyAttributeCount, | ||||
| 2481 | phPublicKey, | ||||
| 2482 | phPrivateKey); | ||||
| 2483 | nssdbg_finish_time(FUNC_C_GENERATEKEYPAIR59, start); | ||||
| 2484 | log_handle(4, " *phPublicKey = 0x%x", *phPublicKey); | ||||
| 2485 | log_handle(4, " *phPrivateKey = 0x%x", *phPrivateKey); | ||||
| 2486 | log_rv(rv); | ||||
| 2487 | return rv; | ||||
| 2488 | } | ||||
| 2489 | |||||
| 2490 | CK_RV | ||||
| 2491 | NSSDBGC_WrapKey( | ||||
| 2492 | CK_SESSION_HANDLE hSession, | ||||
| 2493 | CK_MECHANISM_PTR pMechanism, | ||||
| 2494 | CK_OBJECT_HANDLE hWrappingKey, | ||||
| 2495 | CK_OBJECT_HANDLE hKey, | ||||
| 2496 | CK_BYTE_PTR pWrappedKey, | ||||
| 2497 | CK_ULONG_PTR pulWrappedKeyLen) | ||||
| 2498 | { | ||||
| 2499 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 2500 | |||||
| 2501 | PR_LOG(modlog, 1, ("C_WrapKey"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_WrapKey" ); } } while (0); | ||||
| 2502 | log_handle(3, fmt_hSession, hSession); | ||||
| 2503 | PR_LOG(modlog, 3, (fmt_pMechanism, pMechanism))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pMechanism , pMechanism); } } while (0); | ||||
| 2504 | log_handle(3, " hWrappingKey = 0x%x", hWrappingKey); | ||||
| 2505 | log_handle(3, fmt_hKey, hKey); | ||||
| 2506 | PR_LOG(modlog, 3, (fmt_pWrappedKey, pWrappedKey))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pWrappedKey , pWrappedKey); } } while (0); | ||||
| 2507 | PR_LOG(modlog, 3, (" pulWrappedKeyLen = 0x%p", pulWrappedKeyLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (" pulWrappedKeyLen = 0x%p" , pulWrappedKeyLen); } } while (0); | ||||
| 2508 | print_mechanism(pMechanism); | ||||
| 2509 | nssdbg_start_time(FUNC_C_WRAPKEY60, &start); | ||||
| 2510 | rv = module_functions->C_WrapKey(hSession, | ||||
| 2511 | pMechanism, | ||||
| 2512 | hWrappingKey, | ||||
| 2513 | hKey, | ||||
| 2514 | pWrappedKey, | ||||
| 2515 | pulWrappedKeyLen); | ||||
| 2516 | nssdbg_finish_time(FUNC_C_WRAPKEY60, start); | ||||
| 2517 | PR_LOG(modlog, 4, (" *pulWrappedKeyLen = 0x%x", *pulWrappedKeyLen))do { if (((modlog)->level >= (4))) { PR_LogPrint (" *pulWrappedKeyLen = 0x%x" , *pulWrappedKeyLen); } } while (0); | ||||
| 2518 | log_rv(rv); | ||||
| 2519 | return rv; | ||||
| 2520 | } | ||||
| 2521 | |||||
| 2522 | CK_RV | ||||
| 2523 | NSSDBGC_UnwrapKey( | ||||
| 2524 | CK_SESSION_HANDLE hSession, | ||||
| 2525 | CK_MECHANISM_PTR pMechanism, | ||||
| 2526 | CK_OBJECT_HANDLE hUnwrappingKey, | ||||
| 2527 | CK_BYTE_PTR pWrappedKey, | ||||
| 2528 | CK_ULONG ulWrappedKeyLen, | ||||
| 2529 | CK_ATTRIBUTE_PTR pTemplate, | ||||
| 2530 | CK_ULONG ulAttributeCount, | ||||
| 2531 | CK_OBJECT_HANDLE_PTR phKey) | ||||
| 2532 | { | ||||
| 2533 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 2534 | |||||
| 2535 | PR_LOG(modlog, 1, ("C_UnwrapKey"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_UnwrapKey" ); } } while (0); | ||||
| 2536 | log_handle(3, fmt_hSession, hSession); | ||||
| 2537 | PR_LOG(modlog, 3, (fmt_pMechanism, pMechanism))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pMechanism , pMechanism); } } while (0); | ||||
| 2538 | log_handle(3, " hUnwrappingKey = 0x%x", hUnwrappingKey); | ||||
| 2539 | PR_LOG(modlog, 3, (fmt_pWrappedKey, pWrappedKey))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pWrappedKey , pWrappedKey); } } while (0); | ||||
| 2540 | PR_LOG(modlog, 3, (" ulWrappedKeyLen = %d", ulWrappedKeyLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (" ulWrappedKeyLen = %d" , ulWrappedKeyLen); } } while (0); | ||||
| 2541 | PR_LOG(modlog, 3, (fmt_pTemplate, pTemplate))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pTemplate , pTemplate); } } while (0); | ||||
| 2542 | PR_LOG(modlog, 3, (fmt_ulAttributeCount, ulAttributeCount))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulAttributeCount , ulAttributeCount); } } while (0); | ||||
| 2543 | PR_LOG(modlog, 3, (fmt_phKey, phKey))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_phKey , phKey); } } while (0); | ||||
| 2544 | print_template(pTemplate, ulAttributeCount); | ||||
| 2545 | print_mechanism(pMechanism); | ||||
| 2546 | nssdbg_start_time(FUNC_C_UNWRAPKEY61, &start); | ||||
| 2547 | rv = module_functions->C_UnwrapKey(hSession, | ||||
| 2548 | pMechanism, | ||||
| 2549 | hUnwrappingKey, | ||||
| 2550 | pWrappedKey, | ||||
| 2551 | ulWrappedKeyLen, | ||||
| 2552 | pTemplate, | ||||
| 2553 | ulAttributeCount, | ||||
| 2554 | phKey); | ||||
| 2555 | nssdbg_finish_time(FUNC_C_UNWRAPKEY61, start); | ||||
| 2556 | log_handle(4, fmt_sphKey, *phKey); | ||||
| 2557 | log_rv(rv); | ||||
| 2558 | return rv; | ||||
| 2559 | } | ||||
| 2560 | |||||
| 2561 | CK_RV | ||||
| 2562 | NSSDBGC_DeriveKey( | ||||
| 2563 | CK_SESSION_HANDLE hSession, | ||||
| 2564 | CK_MECHANISM_PTR pMechanism, | ||||
| 2565 | CK_OBJECT_HANDLE hBaseKey, | ||||
| 2566 | CK_ATTRIBUTE_PTR pTemplate, | ||||
| 2567 | CK_ULONG ulAttributeCount, | ||||
| 2568 | CK_OBJECT_HANDLE_PTR phKey) | ||||
| 2569 | { | ||||
| 2570 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 2571 | |||||
| 2572 | PR_LOG(modlog, 1, ("C_DeriveKey"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_DeriveKey" ); } } while (0); | ||||
| 2573 | log_handle(3, fmt_hSession, hSession); | ||||
| 2574 | PR_LOG(modlog, 3, (fmt_pMechanism, pMechanism))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pMechanism , pMechanism); } } while (0); | ||||
| 2575 | log_handle(3, " hBaseKey = 0x%x", hBaseKey); | ||||
| 2576 | PR_LOG(modlog, 3, (fmt_pTemplate, pTemplate))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pTemplate , pTemplate); } } while (0); | ||||
| 2577 | PR_LOG(modlog, 3, (fmt_ulAttributeCount, ulAttributeCount))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulAttributeCount , ulAttributeCount); } } while (0); | ||||
| 2578 | PR_LOG(modlog, 3, (fmt_phKey, phKey))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_phKey , phKey); } } while (0); | ||||
| 2579 | print_template(pTemplate, ulAttributeCount); | ||||
| 2580 | print_mechanism(pMechanism); | ||||
| 2581 | nssdbg_start_time(FUNC_C_DERIVEKEY62, &start); | ||||
| 2582 | rv = module_functions->C_DeriveKey(hSession, | ||||
| 2583 | pMechanism, | ||||
| 2584 | hBaseKey, | ||||
| 2585 | pTemplate, | ||||
| 2586 | ulAttributeCount, | ||||
| 2587 | phKey); | ||||
| 2588 | nssdbg_finish_time(FUNC_C_DERIVEKEY62, start); | ||||
| 2589 | log_handle(4, fmt_sphKey, *phKey); | ||||
| 2590 | log_rv(rv); | ||||
| 2591 | return rv; | ||||
| 2592 | } | ||||
| 2593 | |||||
| 2594 | CK_RV | ||||
| 2595 | NSSDBGC_SeedRandom( | ||||
| 2596 | CK_SESSION_HANDLE hSession, | ||||
| 2597 | CK_BYTE_PTR pSeed, | ||||
| 2598 | CK_ULONG ulSeedLen) | ||||
| 2599 | { | ||||
| 2600 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 2601 | |||||
| 2602 | PR_LOG(modlog, 1, ("C_SeedRandom"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_SeedRandom" ); } } while (0); | ||||
| 2603 | log_handle(3, fmt_hSession, hSession); | ||||
| 2604 | PR_LOG(modlog, 3, (" pSeed = 0x%p", pSeed))do { if (((modlog)->level >= (3))) { PR_LogPrint (" pSeed = 0x%p" , pSeed); } } while (0); | ||||
| 2605 | PR_LOG(modlog, 3, (" ulSeedLen = %d", ulSeedLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (" ulSeedLen = %d" , ulSeedLen); } } while (0); | ||||
| 2606 | nssdbg_start_time(FUNC_C_SEEDRANDOM63, &start); | ||||
| 2607 | rv = module_functions->C_SeedRandom(hSession, | ||||
| 2608 | pSeed, | ||||
| 2609 | ulSeedLen); | ||||
| 2610 | nssdbg_finish_time(FUNC_C_SEEDRANDOM63, start); | ||||
| 2611 | log_rv(rv); | ||||
| 2612 | return rv; | ||||
| 2613 | } | ||||
| 2614 | |||||
| 2615 | CK_RV | ||||
| 2616 | NSSDBGC_GenerateRandom( | ||||
| 2617 | CK_SESSION_HANDLE hSession, | ||||
| 2618 | CK_BYTE_PTR RandomData, | ||||
| 2619 | CK_ULONG ulRandomLen) | ||||
| 2620 | { | ||||
| 2621 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 2622 | |||||
| 2623 | PR_LOG(modlog, 1, ("C_GenerateRandom"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_GenerateRandom" ); } } while (0); | ||||
| 2624 | log_handle(3, fmt_hSession, hSession); | ||||
| 2625 | PR_LOG(modlog, 3, (" RandomData = 0x%p", RandomData))do { if (((modlog)->level >= (3))) { PR_LogPrint (" RandomData = 0x%p" , RandomData); } } while (0); | ||||
| 2626 | PR_LOG(modlog, 3, (" ulRandomLen = %d", ulRandomLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (" ulRandomLen = %d" , ulRandomLen); } } while (0); | ||||
| 2627 | nssdbg_start_time(FUNC_C_GENERATERANDOM64, &start); | ||||
| 2628 | rv = module_functions->C_GenerateRandom(hSession, | ||||
| 2629 | RandomData, | ||||
| 2630 | ulRandomLen); | ||||
| 2631 | nssdbg_finish_time(FUNC_C_GENERATERANDOM64, start); | ||||
| 2632 | log_rv(rv); | ||||
| 2633 | return rv; | ||||
| 2634 | } | ||||
| 2635 | |||||
| 2636 | CK_RV | ||||
| 2637 | NSSDBGC_GetFunctionStatus( | ||||
| 2638 | CK_SESSION_HANDLE hSession) | ||||
| 2639 | { | ||||
| 2640 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 2641 | |||||
| 2642 | PR_LOG(modlog, 1, ("C_GetFunctionStatus"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_GetFunctionStatus" ); } } while (0); | ||||
| 2643 | log_handle(3, fmt_hSession, hSession); | ||||
| 2644 | nssdbg_start_time(FUNC_C_GETFUNCTIONSTATUS65, &start); | ||||
| 2645 | rv = module_functions->C_GetFunctionStatus(hSession); | ||||
| 2646 | nssdbg_finish_time(FUNC_C_GETFUNCTIONSTATUS65, start); | ||||
| 2647 | log_rv(rv); | ||||
| 2648 | return rv; | ||||
| 2649 | } | ||||
| 2650 | |||||
| 2651 | CK_RV | ||||
| 2652 | NSSDBGC_CancelFunction( | ||||
| 2653 | CK_SESSION_HANDLE hSession) | ||||
| 2654 | { | ||||
| 2655 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 2656 | |||||
| 2657 | PR_LOG(modlog, 1, ("C_CancelFunction"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_CancelFunction" ); } } while (0); | ||||
| 2658 | log_handle(3, fmt_hSession, hSession); | ||||
| 2659 | nssdbg_start_time(FUNC_C_CANCELFUNCTION66, &start); | ||||
| 2660 | rv = module_functions->C_CancelFunction(hSession); | ||||
| 2661 | nssdbg_finish_time(FUNC_C_CANCELFUNCTION66, start); | ||||
| 2662 | log_rv(rv); | ||||
| 2663 | return rv; | ||||
| 2664 | } | ||||
| 2665 | |||||
| 2666 | CK_RV | ||||
| 2667 | NSSDBGC_WaitForSlotEvent( | ||||
| 2668 | CK_FLAGS flags, | ||||
| 2669 | CK_SLOT_ID_PTR pSlot, | ||||
| 2670 | CK_VOID_PTR pRserved) | ||||
| 2671 | { | ||||
| 2672 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 2673 | |||||
| 2674 | PR_LOG(modlog, 1, ("C_WaitForSlotEvent"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_WaitForSlotEvent" ); } } while (0); | ||||
| 2675 | PR_LOG(modlog, 3, (fmt_flags, flags))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_flags , flags); } } while (0); | ||||
| 2676 | PR_LOG(modlog, 3, (" pSlot = 0x%p", pSlot))do { if (((modlog)->level >= (3))) { PR_LogPrint (" pSlot = 0x%p" , pSlot); } } while (0); | ||||
| 2677 | PR_LOG(modlog, 3, (" pRserved = 0x%p", pRserved))do { if (((modlog)->level >= (3))) { PR_LogPrint (" pRserved = 0x%p" , pRserved); } } while (0); | ||||
| 2678 | nssdbg_start_time(FUNC_C_WAITFORSLOTEVENT67, &start); | ||||
| 2679 | rv = module_functions->C_WaitForSlotEvent(flags, | ||||
| 2680 | pSlot, | ||||
| 2681 | pRserved); | ||||
| 2682 | nssdbg_finish_time(FUNC_C_WAITFORSLOTEVENT67, start); | ||||
| 2683 | log_rv(rv); | ||||
| 2684 | return rv; | ||||
| 2685 | } | ||||
| 2686 | |||||
| 2687 | CK_RV | ||||
| 2688 | NSSDBGC_GetInterfaceList(CK_INTERFACE_PTR interfaces, | ||||
| 2689 | CK_ULONG_PTR pulCount) | ||||
| 2690 | { | ||||
| 2691 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 2692 | PR_LOG(modlog, 1, ("C_GetInterfaceList"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_GetInterfaceList" ); } } while (0); | ||||
| 2693 | PR_LOG(modlog, 3, (" interfaces = 0x%p", interfaces))do { if (((modlog)->level >= (3))) { PR_LogPrint (" interfaces = 0x%p" , interfaces); } } while (0); | ||||
| 2694 | PR_LOG(modlog, 3, (" pulCount = %d", pulCount))do { if (((modlog)->level >= (3))) { PR_LogPrint (" pulCount = %d" , pulCount); } } while (0); | ||||
| 2695 | nssdbg_start_time(FUNC_C_GETINTERFACELIST68, &start); | ||||
| 2696 | rv = module_functions->C_GetInterfaceList(interfaces, | ||||
| 2697 | pulCount); | ||||
| 2698 | nssdbg_finish_time(FUNC_C_GETINTERFACELIST68, start); | ||||
| 2699 | log_rv(rv); | ||||
| 2700 | return rv; | ||||
| 2701 | } | ||||
| 2702 | |||||
| 2703 | CK_RV | ||||
| 2704 | NSSDBGC_GetInterface(CK_UTF8CHAR_PTR pInterfaceName, | ||||
| 2705 | CK_VERSION_PTR pVersion, | ||||
| 2706 | CK_INTERFACE_PTR_PTR ppInterface, | ||||
| 2707 | CK_FLAGS flags) | ||||
| 2708 | { | ||||
| 2709 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 2710 | PR_LOG(modlog, 1, ("C_GetInterface"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_GetInterface" ); } } while (0); | ||||
| 2711 | PR_LOG(modlog, 3, (" pInterfaceName = 0x%p", pInterfaceName))do { if (((modlog)->level >= (3))) { PR_LogPrint (" pInterfaceName = 0x%p" , pInterfaceName); } } while (0); | ||||
| 2712 | PR_LOG(modlog, 3, (" pVersion = 0x%p", pVersion))do { if (((modlog)->level >= (3))) { PR_LogPrint (" pVersion = 0x%p" , pVersion); } } while (0); | ||||
| 2713 | PR_LOG(modlog, 3, (" ppInterface = 0x%p", ppInterface))do { if (((modlog)->level >= (3))) { PR_LogPrint (" ppInterface = 0x%p" , ppInterface); } } while (0); | ||||
| 2714 | PR_LOG(modlog, 3, (fmt_flags, flags))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_flags , flags); } } while (0); | ||||
| 2715 | nssdbg_start_time(FUNC_C_GETINTERFACE69, &start); | ||||
| 2716 | rv = module_functions->C_GetInterface(pInterfaceName, | ||||
| 2717 | pVersion, | ||||
| 2718 | ppInterface, | ||||
| 2719 | flags); | ||||
| 2720 | nssdbg_finish_time(FUNC_C_GETINTERFACE69, start); | ||||
| 2721 | log_rv(rv); | ||||
| 2722 | return rv; | ||||
| 2723 | } | ||||
| 2724 | |||||
| 2725 | CK_RV | ||||
| 2726 | NSSDBGC_LoginUser(CK_SESSION_HANDLE hSession, | ||||
| 2727 | CK_USER_TYPE userType, | ||||
| 2728 | CK_CHAR_PTR pPin, | ||||
| 2729 | CK_ULONG ulPinLen, | ||||
| 2730 | CK_UTF8CHAR_PTR pUsername, | ||||
| 2731 | CK_ULONG ulUsernameLen) | ||||
| 2732 | { | ||||
| 2733 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 2734 | PR_LOG(modlog, 1, ("C_LoginUser"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_LoginUser" ); } } while (0); | ||||
| 2735 | log_handle(3, fmt_hSession, hSession); | ||||
| 2736 | PR_LOG(modlog, 3, (" userType = 0x%x", userType))do { if (((modlog)->level >= (3))) { PR_LogPrint (" userType = 0x%x" , userType); } } while (0); | ||||
| 2737 | PR_LOG(modlog, 3, (fmt_pPin, pPin))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pPin , pPin); } } while (0); | ||||
| 2738 | PR_LOG(modlog, 3, (fmt_ulPinLen, ulPinLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulPinLen , ulPinLen); } } while (0); | ||||
| 2739 | PR_LOG(modlog, 3, (" pUsername = 0x%p", pUsername))do { if (((modlog)->level >= (3))) { PR_LogPrint (" pUsername = 0x%p" , pUsername); } } while (0); | ||||
| 2740 | PR_LOG(modlog, 3, (" ulUsernameLen = %d", ulUsernameLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (" ulUsernameLen = %d" , ulUsernameLen); } } while (0); | ||||
| 2741 | nssdbg_start_time(FUNC_C_LOGINUSER70, &start); | ||||
| 2742 | rv = module_functions->C_LoginUser(hSession, | ||||
| 2743 | userType, | ||||
| 2744 | pPin, | ||||
| 2745 | ulPinLen, | ||||
| 2746 | pUsername, | ||||
| 2747 | ulUsernameLen); | ||||
| 2748 | nssdbg_finish_time(FUNC_C_LOGINUSER70, start); | ||||
| 2749 | log_rv(rv); | ||||
| 2750 | return rv; | ||||
| 2751 | } | ||||
| 2752 | |||||
| 2753 | CK_RV | ||||
| 2754 | NSSDBGC_SessionCancel(CK_SESSION_HANDLE hSession, | ||||
| 2755 | CK_FLAGS flags) | ||||
| 2756 | { | ||||
| 2757 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 2758 | PR_LOG(modlog, 1, ("C_SessionCancel"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_SessionCancel" ); } } while (0); | ||||
| 2759 | log_handle(3, fmt_hSession, hSession); | ||||
| 2760 | PR_LOG(modlog, 3, (fmt_flags, flags))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_flags , flags); } } while (0); | ||||
| 2761 | nssdbg_start_time(FUNC_C_SESSIONCANCEL71, &start); | ||||
| 2762 | rv = module_functions->C_SessionCancel(hSession, | ||||
| 2763 | flags); | ||||
| 2764 | nssdbg_finish_time(FUNC_C_SESSIONCANCEL71, start); | ||||
| 2765 | log_rv(rv); | ||||
| 2766 | return rv; | ||||
| 2767 | } | ||||
| 2768 | |||||
| 2769 | CK_RV | ||||
| 2770 | NSSDBGC_MessageEncryptInit(CK_SESSION_HANDLE hSession, | ||||
| 2771 | CK_MECHANISM_PTR pMechanism, | ||||
| 2772 | CK_OBJECT_HANDLE hKey) | ||||
| 2773 | { | ||||
| 2774 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 2775 | PR_LOG(modlog, 1, ("C_MessageEncryptInit"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_MessageEncryptInit" ); } } while (0); | ||||
| 2776 | log_handle(3, fmt_hSession, hSession); | ||||
| 2777 | print_mechanism(pMechanism); | ||||
| 2778 | log_handle(3, fmt_hKey, hKey); | ||||
| 2779 | nssdbg_start_time(FUNC_C_MESSAGEENCRYPTINIT72, &start); | ||||
| 2780 | rv = module_functions->C_MessageEncryptInit(hSession, | ||||
| 2781 | pMechanism, | ||||
| 2782 | hKey); | ||||
| 2783 | nssdbg_finish_time(FUNC_C_MESSAGEENCRYPTINIT72, start); | ||||
| 2784 | log_rv(rv); | ||||
| 2785 | return rv; | ||||
| 2786 | } | ||||
| 2787 | |||||
| 2788 | CK_RV | ||||
| 2789 | NSSDBGC_EncryptMessage(CK_SESSION_HANDLE hSession, | ||||
| 2790 | CK_VOID_PTR pParameter, | ||||
| 2791 | CK_ULONG ulParameterLen, | ||||
| 2792 | CK_BYTE_PTR pAssociatedData, | ||||
| 2793 | CK_ULONG ulAssociatedDataLen, | ||||
| 2794 | CK_BYTE_PTR pPlaintext, | ||||
| 2795 | CK_ULONG ulPlaintextLen, | ||||
| 2796 | CK_BYTE_PTR pCiphertext, | ||||
| 2797 | CK_ULONG_PTR pulCiphertextLen) | ||||
| 2798 | { | ||||
| 2799 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 2800 | PR_LOG(modlog, 1, ("C_EncryptMessage"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_EncryptMessage" ); } } while (0); | ||||
| 2801 | log_handle(3, fmt_hSession, hSession); | ||||
| 2802 | PR_LOG(modlog, 3, (fmt_pParameter, pParameter))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pParameter , pParameter); } } while (0); | ||||
| 2803 | PR_LOG(modlog, 3, (fmt_ulParameterLen, ulParameterLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulParameterLen , ulParameterLen); } } while (0); | ||||
| 2804 | PR_LOG(modlog, 3, (fmt_pAssociatedData, pAssociatedData))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pAssociatedData , pAssociatedData); } } while (0); | ||||
| 2805 | PR_LOG(modlog, 3, (fmt_ulAssociatedDataLen, ulAssociatedDataLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulAssociatedDataLen , ulAssociatedDataLen); } } while (0); | ||||
| 2806 | PR_LOG(modlog, 3, (fmt_pPlaintext, pPlaintext))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pPlaintext , pPlaintext); } } while (0); | ||||
| 2807 | PR_LOG(modlog, 3, (fmt_ulPlaintextLen, ulPlaintextLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulPlaintextLen , ulPlaintextLen); } } while (0); | ||||
| 2808 | PR_LOG(modlog, 3, (fmt_pCiphertext, pCiphertext))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pCiphertext , pCiphertext); } } while (0); | ||||
| 2809 | PR_LOG(modlog, 3, (fmt_pulCiphertextLen, pulCiphertextLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pulCiphertextLen , pulCiphertextLen); } } while (0); | ||||
| 2810 | nssdbg_start_time(FUNC_C_ENCRYPTMESSAGE73, &start); | ||||
| 2811 | rv = module_functions->C_EncryptMessage(hSession, | ||||
| 2812 | pParameter, | ||||
| 2813 | ulParameterLen, | ||||
| 2814 | pAssociatedData, | ||||
| 2815 | ulAssociatedDataLen, | ||||
| 2816 | pPlaintext, | ||||
| 2817 | ulPlaintextLen, | ||||
| 2818 | pCiphertext, | ||||
| 2819 | pulCiphertextLen); | ||||
| 2820 | nssdbg_finish_time(FUNC_C_ENCRYPTMESSAGE73, start); | ||||
| 2821 | log_rv(rv); | ||||
| 2822 | return rv; | ||||
| 2823 | } | ||||
| 2824 | |||||
| 2825 | CK_RV | ||||
| 2826 | NSSDBGC_EncryptMessageBegin(CK_SESSION_HANDLE hSession, | ||||
| 2827 | CK_VOID_PTR pParameter, | ||||
| 2828 | CK_ULONG ulParameterLen, | ||||
| 2829 | CK_BYTE_PTR pAssociatedData, | ||||
| 2830 | CK_ULONG ulAssociatedDataLen) | ||||
| 2831 | { | ||||
| 2832 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 2833 | PR_LOG(modlog, 1, ("C_EncryptMessageBegin"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_EncryptMessageBegin" ); } } while (0); | ||||
| 2834 | log_handle(3, fmt_hSession, hSession); | ||||
| 2835 | PR_LOG(modlog, 3, (fmt_pParameter, pParameter))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pParameter , pParameter); } } while (0); | ||||
| 2836 | PR_LOG(modlog, 3, (fmt_ulParameterLen, ulParameterLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulParameterLen , ulParameterLen); } } while (0); | ||||
| 2837 | PR_LOG(modlog, 3, (fmt_pAssociatedData, pAssociatedData))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pAssociatedData , pAssociatedData); } } while (0); | ||||
| 2838 | PR_LOG(modlog, 3, (fmt_ulAssociatedDataLen, ulAssociatedDataLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulAssociatedDataLen , ulAssociatedDataLen); } } while (0); | ||||
| 2839 | nssdbg_start_time(FUNC_C_ENCRYPTMESSAGEBEGIN74, &start); | ||||
| 2840 | rv = module_functions->C_EncryptMessageBegin(hSession, | ||||
| 2841 | pParameter, | ||||
| 2842 | ulParameterLen, | ||||
| 2843 | pAssociatedData, | ||||
| 2844 | ulAssociatedDataLen); | ||||
| 2845 | nssdbg_finish_time(FUNC_C_ENCRYPTMESSAGEBEGIN74, start); | ||||
| 2846 | log_rv(rv); | ||||
| 2847 | return rv; | ||||
| 2848 | } | ||||
| 2849 | |||||
| 2850 | CK_RV | ||||
| 2851 | NSSDBGC_EncryptMessageNext(CK_SESSION_HANDLE hSession, | ||||
| 2852 | CK_VOID_PTR pParameter, | ||||
| 2853 | CK_ULONG ulParameterLen, | ||||
| 2854 | CK_BYTE_PTR pPlaintextPart, | ||||
| 2855 | CK_ULONG ulPlaintextPartLen, | ||||
| 2856 | CK_BYTE_PTR pCiphertextPart, | ||||
| 2857 | CK_ULONG_PTR pulCiphertextPartLen, | ||||
| 2858 | CK_FLAGS flags) | ||||
| 2859 | { | ||||
| 2860 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 2861 | PR_LOG(modlog, 1, ("C_EncryptMessageNext"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_EncryptMessageNext" ); } } while (0); | ||||
| 2862 | log_handle(3, fmt_hSession, hSession); | ||||
| 2863 | PR_LOG(modlog, 3, (fmt_pParameter, pParameter))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pParameter , pParameter); } } while (0); | ||||
| 2864 | PR_LOG(modlog, 3, (fmt_ulParameterLen, ulParameterLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulParameterLen , ulParameterLen); } } while (0); | ||||
| 2865 | PR_LOG(modlog, 3, (fmt_pPlaintextPart, pPlaintextPart))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pPlaintextPart , pPlaintextPart); } } while (0); | ||||
| 2866 | PR_LOG(modlog, 3, (fmt_ulPlaintextPartLen, ulPlaintextPartLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulPlaintextPartLen , ulPlaintextPartLen); } } while (0); | ||||
| 2867 | PR_LOG(modlog, 3, (fmt_pCiphertextPart, pCiphertextPart))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pCiphertextPart , pCiphertextPart); } } while (0); | ||||
| 2868 | PR_LOG(modlog, 3, (fmt_pulCiphertextPartLen, pulCiphertextPartLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pulCiphertextPartLen , pulCiphertextPartLen); } } while (0); | ||||
| 2869 | nssdbg_start_time(FUNC_C_ENCRYPTMESSAGENEXT75, &start); | ||||
| 2870 | rv = module_functions->C_EncryptMessageNext(hSession, | ||||
| 2871 | pParameter, | ||||
| 2872 | ulParameterLen, | ||||
| 2873 | pPlaintextPart, | ||||
| 2874 | ulPlaintextPartLen, | ||||
| 2875 | pCiphertextPart, | ||||
| 2876 | pulCiphertextPartLen, | ||||
| 2877 | flags); | ||||
| 2878 | nssdbg_finish_time(FUNC_C_ENCRYPTMESSAGENEXT75, start); | ||||
| 2879 | log_rv(rv); | ||||
| 2880 | return rv; | ||||
| 2881 | } | ||||
| 2882 | |||||
| 2883 | CK_RV | ||||
| 2884 | NSSDBGC_MessageEncryptFinal(CK_SESSION_HANDLE hSession) | ||||
| 2885 | { | ||||
| 2886 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 2887 | PR_LOG(modlog, 1, ("C_MessageEncryptFinal"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_MessageEncryptFinal" ); } } while (0); | ||||
| 2888 | log_handle(3, fmt_hSession, hSession); | ||||
| 2889 | nssdbg_start_time(FUNC_C_MESSAGEENCRYPTFINAL76, &start); | ||||
| 2890 | rv = module_functions->C_MessageEncryptFinal(hSession); | ||||
| 2891 | nssdbg_finish_time(FUNC_C_MESSAGEENCRYPTFINAL76, start); | ||||
| 2892 | log_rv(rv); | ||||
| 2893 | return rv; | ||||
| 2894 | } | ||||
| 2895 | |||||
| 2896 | CK_RV | ||||
| 2897 | NSSDBGC_MessageDecryptInit(CK_SESSION_HANDLE hSession, | ||||
| 2898 | CK_MECHANISM_PTR pMechanism, | ||||
| 2899 | CK_OBJECT_HANDLE hKey) | ||||
| 2900 | { | ||||
| 2901 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 2902 | PR_LOG(modlog, 1, ("C_MessageDecryptInit"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_MessageDecryptInit" ); } } while (0); | ||||
| 2903 | log_handle(3, fmt_hSession, hSession); | ||||
| 2904 | print_mechanism(pMechanism); | ||||
| 2905 | log_handle(3, fmt_hKey, hKey); | ||||
| 2906 | nssdbg_start_time(FUNC_C_MESSAGEDECRYPTINIT77, &start); | ||||
| 2907 | rv = module_functions->C_MessageDecryptInit(hSession, | ||||
| 2908 | pMechanism, | ||||
| 2909 | hKey); | ||||
| 2910 | nssdbg_finish_time(FUNC_C_MESSAGEDECRYPTINIT77, start); | ||||
| 2911 | log_rv(rv); | ||||
| 2912 | return rv; | ||||
| 2913 | } | ||||
| 2914 | |||||
| 2915 | CK_RV | ||||
| 2916 | NSSDBGC_DecryptMessage(CK_SESSION_HANDLE hSession, | ||||
| 2917 | CK_VOID_PTR pParameter, | ||||
| 2918 | CK_ULONG ulParameterLen, | ||||
| 2919 | CK_BYTE_PTR pAssociatedData, | ||||
| 2920 | CK_ULONG ulAssociatedDataLen, | ||||
| 2921 | CK_BYTE_PTR pCiphertext, | ||||
| 2922 | CK_ULONG ulCiphertextLen, | ||||
| 2923 | CK_BYTE_PTR pPlaintext, | ||||
| 2924 | CK_ULONG_PTR pulPlaintextLen) | ||||
| 2925 | { | ||||
| 2926 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 2927 | PR_LOG(modlog, 1, ("C_DecryptMessage"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_DecryptMessage" ); } } while (0); | ||||
| 2928 | log_handle(3, fmt_hSession, hSession); | ||||
| 2929 | PR_LOG(modlog, 3, (fmt_pParameter, pParameter))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pParameter , pParameter); } } while (0); | ||||
| 2930 | PR_LOG(modlog, 3, (fmt_ulParameterLen, ulParameterLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulParameterLen , ulParameterLen); } } while (0); | ||||
| 2931 | PR_LOG(modlog, 3, (fmt_pAssociatedData, pAssociatedData))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pAssociatedData , pAssociatedData); } } while (0); | ||||
| 2932 | PR_LOG(modlog, 3, (fmt_ulAssociatedDataLen, ulAssociatedDataLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulAssociatedDataLen , ulAssociatedDataLen); } } while (0); | ||||
| 2933 | PR_LOG(modlog, 3, (fmt_pCiphertext, pCiphertext))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pCiphertext , pCiphertext); } } while (0); | ||||
| 2934 | PR_LOG(modlog, 3, (fmt_ulCiphertextLen, ulCiphertextLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulCiphertextLen , ulCiphertextLen); } } while (0); | ||||
| 2935 | PR_LOG(modlog, 3, (fmt_pPlaintext, pPlaintext))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pPlaintext , pPlaintext); } } while (0); | ||||
| 2936 | PR_LOG(modlog, 3, (fmt_pulPlaintextLen, pulPlaintextLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pulPlaintextLen , pulPlaintextLen); } } while (0); | ||||
| 2937 | nssdbg_start_time(FUNC_C_DECRYPTMESSAGE78, &start); | ||||
| 2938 | rv = module_functions->C_DecryptMessage(hSession, | ||||
| 2939 | pParameter, | ||||
| 2940 | ulParameterLen, | ||||
| 2941 | pAssociatedData, | ||||
| 2942 | ulAssociatedDataLen, | ||||
| 2943 | pCiphertext, | ||||
| 2944 | ulCiphertextLen, | ||||
| 2945 | pPlaintext, | ||||
| 2946 | pulPlaintextLen); | ||||
| 2947 | nssdbg_finish_time(FUNC_C_DECRYPTMESSAGE78, start); | ||||
| 2948 | log_rv(rv); | ||||
| 2949 | return rv; | ||||
| 2950 | } | ||||
| 2951 | |||||
| 2952 | CK_RV | ||||
| 2953 | NSSDBGC_DecryptMessageBegin(CK_SESSION_HANDLE hSession, | ||||
| 2954 | CK_VOID_PTR pParameter, | ||||
| 2955 | CK_ULONG ulParameterLen, | ||||
| 2956 | CK_BYTE_PTR pAssociatedData, | ||||
| 2957 | CK_ULONG ulAssociatedDataLen) | ||||
| 2958 | { | ||||
| 2959 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 2960 | PR_LOG(modlog, 1, ("C_DecryptMessageBegin"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_DecryptMessageBegin" ); } } while (0); | ||||
| 2961 | log_handle(3, fmt_hSession, hSession); | ||||
| 2962 | PR_LOG(modlog, 3, (fmt_pParameter, pParameter))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pParameter , pParameter); } } while (0); | ||||
| 2963 | PR_LOG(modlog, 3, (fmt_ulParameterLen, ulParameterLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulParameterLen , ulParameterLen); } } while (0); | ||||
| 2964 | PR_LOG(modlog, 3, (fmt_pAssociatedData, pAssociatedData))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pAssociatedData , pAssociatedData); } } while (0); | ||||
| 2965 | PR_LOG(modlog, 3, (fmt_ulAssociatedDataLen, ulAssociatedDataLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulAssociatedDataLen , ulAssociatedDataLen); } } while (0); | ||||
| 2966 | nssdbg_start_time(FUNC_C_DECRYPTMESSAGEBEGIN79, &start); | ||||
| 2967 | rv = module_functions->C_DecryptMessageBegin(hSession, | ||||
| 2968 | pParameter, | ||||
| 2969 | ulParameterLen, | ||||
| 2970 | pAssociatedData, | ||||
| 2971 | ulAssociatedDataLen); | ||||
| 2972 | nssdbg_finish_time(FUNC_C_DECRYPTMESSAGEBEGIN79, start); | ||||
| 2973 | log_rv(rv); | ||||
| 2974 | return rv; | ||||
| 2975 | } | ||||
| 2976 | |||||
| 2977 | CK_RV | ||||
| 2978 | NSSDBGC_DecryptMessageNext(CK_SESSION_HANDLE hSession, | ||||
| 2979 | CK_VOID_PTR pParameter, | ||||
| 2980 | CK_ULONG ulParameterLen, | ||||
| 2981 | CK_BYTE_PTR pCiphertextPart, | ||||
| 2982 | CK_ULONG ulCiphertextPartLen, | ||||
| 2983 | CK_BYTE_PTR pPlaintextPart, | ||||
| 2984 | CK_ULONG_PTR pulPlaintextPartLen, | ||||
| 2985 | CK_FLAGS flags) | ||||
| 2986 | { | ||||
| 2987 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 2988 | PR_LOG(modlog, 1, ("C_DecryptMessageNext"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_DecryptMessageNext" ); } } while (0); | ||||
| 2989 | log_handle(3, fmt_hSession, hSession); | ||||
| 2990 | PR_LOG(modlog, 3, (fmt_pParameter, pParameter))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pParameter , pParameter); } } while (0); | ||||
| 2991 | PR_LOG(modlog, 3, (fmt_ulParameterLen, ulParameterLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulParameterLen , ulParameterLen); } } while (0); | ||||
| 2992 | PR_LOG(modlog, 3, (fmt_pCiphertextPart, pCiphertextPart))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pCiphertextPart , pCiphertextPart); } } while (0); | ||||
| 2993 | PR_LOG(modlog, 3, (fmt_ulCiphertextPartLen, ulCiphertextPartLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulCiphertextPartLen , ulCiphertextPartLen); } } while (0); | ||||
| 2994 | PR_LOG(modlog, 3, (fmt_pPlaintextPart, pPlaintextPart))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pPlaintextPart , pPlaintextPart); } } while (0); | ||||
| 2995 | PR_LOG(modlog, 3, (fmt_pulPlaintextPartLen, pulPlaintextPartLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pulPlaintextPartLen , pulPlaintextPartLen); } } while (0); | ||||
| 2996 | nssdbg_start_time(FUNC_C_DECRYPTMESSAGENEXT80, &start); | ||||
| 2997 | rv = module_functions->C_DecryptMessageNext(hSession, | ||||
| 2998 | pParameter, | ||||
| 2999 | ulParameterLen, | ||||
| 3000 | pCiphertextPart, | ||||
| 3001 | ulCiphertextPartLen, | ||||
| 3002 | pPlaintextPart, | ||||
| 3003 | pulPlaintextPartLen, | ||||
| 3004 | flags); | ||||
| 3005 | nssdbg_finish_time(FUNC_C_DECRYPTMESSAGENEXT80, start); | ||||
| 3006 | log_rv(rv); | ||||
| 3007 | return rv; | ||||
| 3008 | } | ||||
| 3009 | |||||
| 3010 | CK_RV | ||||
| 3011 | NSSDBGC_MessageDecryptFinal(CK_SESSION_HANDLE hSession) | ||||
| 3012 | { | ||||
| 3013 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 3014 | PR_LOG(modlog, 1, ("C_MessageDecryptFinal"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_MessageDecryptFinal" ); } } while (0); | ||||
| 3015 | log_handle(3, fmt_hSession, hSession); | ||||
| 3016 | nssdbg_start_time(FUNC_C_MESSAGEDECRYPTFINAL81, &start); | ||||
| 3017 | rv = module_functions->C_MessageDecryptFinal(hSession); | ||||
| 3018 | nssdbg_finish_time(FUNC_C_MESSAGEDECRYPTFINAL81, start); | ||||
| 3019 | log_rv(rv); | ||||
| 3020 | return rv; | ||||
| 3021 | } | ||||
| 3022 | |||||
| 3023 | CK_RV | ||||
| 3024 | NSSDBGC_MessageSignInit(CK_SESSION_HANDLE hSession, | ||||
| 3025 | CK_MECHANISM_PTR pMechanism, | ||||
| 3026 | CK_OBJECT_HANDLE hKey) | ||||
| 3027 | { | ||||
| 3028 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 3029 | PR_LOG(modlog, 1, ("C_MessageSignInit"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_MessageSignInit" ); } } while (0); | ||||
| 3030 | log_handle(3, fmt_hSession, hSession); | ||||
| 3031 | print_mechanism(pMechanism); | ||||
| 3032 | log_handle(3, fmt_hKey, hKey); | ||||
| 3033 | nssdbg_start_time(FUNC_C_MESSAGESIGNINIT82, &start); | ||||
| 3034 | rv = module_functions->C_MessageSignInit(hSession, | ||||
| 3035 | pMechanism, | ||||
| 3036 | hKey); | ||||
| 3037 | nssdbg_finish_time(FUNC_C_MESSAGESIGNINIT82, start); | ||||
| 3038 | log_rv(rv); | ||||
| 3039 | return rv; | ||||
| 3040 | } | ||||
| 3041 | |||||
| 3042 | CK_RV | ||||
| 3043 | NSSDBGC_SignMessage(CK_SESSION_HANDLE hSession, | ||||
| 3044 | CK_VOID_PTR pParameter, | ||||
| 3045 | CK_ULONG ulParameterLen, | ||||
| 3046 | CK_BYTE_PTR pData, | ||||
| 3047 | CK_ULONG ulDataLen, | ||||
| 3048 | CK_BYTE_PTR pSignature, | ||||
| 3049 | CK_ULONG_PTR pulSignatureLen) | ||||
| 3050 | { | ||||
| 3051 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 3052 | PR_LOG(modlog, 1, ("C_SignMessage"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_SignMessage" ); } } while (0); | ||||
| 3053 | log_handle(3, fmt_hSession, hSession); | ||||
| 3054 | PR_LOG(modlog, 3, (fmt_pParameter, pParameter))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pParameter , pParameter); } } while (0); | ||||
| 3055 | PR_LOG(modlog, 3, (fmt_ulParameterLen, ulParameterLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulParameterLen , ulParameterLen); } } while (0); | ||||
| 3056 | PR_LOG(modlog, 3, (fmt_pData, pData))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pData , pData); } } while (0); | ||||
| 3057 | PR_LOG(modlog, 3, (fmt_ulDataLen, ulDataLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulDataLen , ulDataLen); } } while (0); | ||||
| 3058 | PR_LOG(modlog, 3, (fmt_pSignature, pSignature))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pSignature , pSignature); } } while (0); | ||||
| 3059 | PR_LOG(modlog, 3, (fmt_pulSignatureLen, pulSignatureLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pulSignatureLen , pulSignatureLen); } } while (0); | ||||
| 3060 | nssdbg_start_time(FUNC_C_SIGNMESSAGE83, &start); | ||||
| 3061 | rv = module_functions->C_SignMessage(hSession, | ||||
| 3062 | pParameter, | ||||
| 3063 | ulParameterLen, | ||||
| 3064 | pData, | ||||
| 3065 | ulDataLen, | ||||
| 3066 | pSignature, | ||||
| 3067 | pulSignatureLen); | ||||
| 3068 | nssdbg_finish_time(FUNC_C_SIGNMESSAGE83, start); | ||||
| 3069 | log_rv(rv); | ||||
| 3070 | return rv; | ||||
| 3071 | } | ||||
| 3072 | |||||
| 3073 | CK_RV | ||||
| 3074 | NSSDBGC_SignMessageBegin(CK_SESSION_HANDLE hSession, | ||||
| 3075 | CK_VOID_PTR pParameter, | ||||
| 3076 | CK_ULONG ulParameterLen) | ||||
| 3077 | { | ||||
| 3078 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 3079 | PR_LOG(modlog, 1, ("C_SignMessageBegin"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_SignMessageBegin" ); } } while (0); | ||||
| 3080 | log_handle(3, fmt_hSession, hSession); | ||||
| 3081 | PR_LOG(modlog, 3, (fmt_pParameter, pParameter))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pParameter , pParameter); } } while (0); | ||||
| 3082 | PR_LOG(modlog, 3, (fmt_ulParameterLen, ulParameterLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulParameterLen , ulParameterLen); } } while (0); | ||||
| 3083 | nssdbg_start_time(FUNC_C_SIGNMESSAGEBEGIN84, &start); | ||||
| 3084 | rv = module_functions->C_SignMessageBegin(hSession, | ||||
| 3085 | pParameter, | ||||
| 3086 | ulParameterLen); | ||||
| 3087 | nssdbg_finish_time(FUNC_C_SIGNMESSAGEBEGIN84, start); | ||||
| 3088 | log_rv(rv); | ||||
| 3089 | return rv; | ||||
| 3090 | } | ||||
| 3091 | |||||
| 3092 | CK_RV | ||||
| 3093 | NSSDBGC_SignMessageNext(CK_SESSION_HANDLE hSession, | ||||
| 3094 | CK_VOID_PTR pParameter, | ||||
| 3095 | CK_ULONG ulParameterLen, | ||||
| 3096 | CK_BYTE_PTR pData, | ||||
| 3097 | CK_ULONG ulDataLen, | ||||
| 3098 | CK_BYTE_PTR pSignature, | ||||
| 3099 | CK_ULONG_PTR pulSignatureLen) | ||||
| 3100 | { | ||||
| 3101 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 3102 | PR_LOG(modlog, 1, ("C_SignMessageNext"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_SignMessageNext" ); } } while (0); | ||||
| 3103 | log_handle(3, fmt_hSession, hSession); | ||||
| 3104 | PR_LOG(modlog, 3, (fmt_pParameter, pParameter))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pParameter , pParameter); } } while (0); | ||||
| 3105 | PR_LOG(modlog, 3, (fmt_ulParameterLen, ulParameterLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulParameterLen , ulParameterLen); } } while (0); | ||||
| 3106 | PR_LOG(modlog, 3, (fmt_pData, pData))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pData , pData); } } while (0); | ||||
| 3107 | PR_LOG(modlog, 3, (fmt_ulDataLen, ulDataLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulDataLen , ulDataLen); } } while (0); | ||||
| 3108 | PR_LOG(modlog, 3, (fmt_pSignature, pSignature))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pSignature , pSignature); } } while (0); | ||||
| 3109 | PR_LOG(modlog, 3, (fmt_pulSignatureLen, pulSignatureLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pulSignatureLen , pulSignatureLen); } } while (0); | ||||
| 3110 | nssdbg_start_time(FUNC_C_SIGNMESSAGENEXT85, &start); | ||||
| 3111 | rv = module_functions->C_SignMessageNext(hSession, | ||||
| 3112 | pParameter, | ||||
| 3113 | ulParameterLen, | ||||
| 3114 | pData, | ||||
| 3115 | ulDataLen, | ||||
| 3116 | pSignature, | ||||
| 3117 | pulSignatureLen); | ||||
| 3118 | nssdbg_finish_time(FUNC_C_SIGNMESSAGENEXT85, start); | ||||
| 3119 | log_rv(rv); | ||||
| 3120 | return rv; | ||||
| 3121 | } | ||||
| 3122 | |||||
| 3123 | CK_RV | ||||
| 3124 | NSSDBGC_MessageSignFinal(CK_SESSION_HANDLE hSession) | ||||
| 3125 | { | ||||
| 3126 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 3127 | PR_LOG(modlog, 1, ("C_MessageSignFinal"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_MessageSignFinal" ); } } while (0); | ||||
| 3128 | log_handle(3, fmt_hSession, hSession); | ||||
| 3129 | nssdbg_start_time(FUNC_C_MESSAGESIGNFINAL86, &start); | ||||
| 3130 | rv = module_functions->C_MessageSignFinal(hSession); | ||||
| 3131 | nssdbg_finish_time(FUNC_C_MESSAGESIGNFINAL86, start); | ||||
| 3132 | log_rv(rv); | ||||
| 3133 | return rv; | ||||
| 3134 | } | ||||
| 3135 | |||||
| 3136 | CK_RV | ||||
| 3137 | NSSDBGC_MessageVerifyInit(CK_SESSION_HANDLE hSession, | ||||
| 3138 | CK_MECHANISM_PTR pMechanism, | ||||
| 3139 | CK_OBJECT_HANDLE hKey) | ||||
| 3140 | { | ||||
| 3141 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 3142 | PR_LOG(modlog, 1, ("C_MessageVerifyInit"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_MessageVerifyInit" ); } } while (0); | ||||
| 3143 | log_handle(3, fmt_hSession, hSession); | ||||
| 3144 | print_mechanism(pMechanism); | ||||
| 3145 | log_handle(3, fmt_hKey, hKey); | ||||
| 3146 | nssdbg_start_time(FUNC_C_MESSAGEVERIFYINIT87, &start); | ||||
| 3147 | rv = module_functions->C_MessageVerifyInit(hSession, | ||||
| 3148 | pMechanism, | ||||
| 3149 | hKey); | ||||
| 3150 | nssdbg_finish_time(FUNC_C_MESSAGEVERIFYINIT87, start); | ||||
| 3151 | log_rv(rv); | ||||
| 3152 | return rv; | ||||
| 3153 | } | ||||
| 3154 | |||||
| 3155 | CK_RV | ||||
| 3156 | NSSDBGC_VerifyMessage(CK_SESSION_HANDLE hSession, | ||||
| 3157 | CK_VOID_PTR pParameter, | ||||
| 3158 | CK_ULONG ulParameterLen, | ||||
| 3159 | CK_BYTE_PTR pData, | ||||
| 3160 | CK_ULONG ulDataLen, | ||||
| 3161 | CK_BYTE_PTR pSignature, | ||||
| 3162 | CK_ULONG ulSignatureLen) | ||||
| 3163 | { | ||||
| 3164 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 3165 | PR_LOG(modlog, 1, ("C_VerifyMessage"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_VerifyMessage" ); } } while (0); | ||||
| 3166 | log_handle(3, fmt_hSession, hSession); | ||||
| 3167 | PR_LOG(modlog, 3, (fmt_pParameter, pParameter))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pParameter , pParameter); } } while (0); | ||||
| 3168 | PR_LOG(modlog, 3, (fmt_ulParameterLen, ulParameterLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulParameterLen , ulParameterLen); } } while (0); | ||||
| 3169 | PR_LOG(modlog, 3, (fmt_pData, pData))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pData , pData); } } while (0); | ||||
| 3170 | PR_LOG(modlog, 3, (fmt_ulDataLen, ulDataLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulDataLen , ulDataLen); } } while (0); | ||||
| 3171 | PR_LOG(modlog, 3, (fmt_pSignature, pSignature))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pSignature , pSignature); } } while (0); | ||||
| 3172 | PR_LOG(modlog, 3, (fmt_ulSignatureLen, ulSignatureLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulSignatureLen , ulSignatureLen); } } while (0); | ||||
| 3173 | nssdbg_start_time(FUNC_C_VERIFYMESSAGE88, &start); | ||||
| 3174 | rv = module_functions->C_VerifyMessage(hSession, | ||||
| 3175 | pParameter, | ||||
| 3176 | ulParameterLen, | ||||
| 3177 | pData, | ||||
| 3178 | ulDataLen, | ||||
| 3179 | pSignature, | ||||
| 3180 | ulSignatureLen); | ||||
| 3181 | nssdbg_finish_time(FUNC_C_VERIFYMESSAGE88, start); | ||||
| 3182 | log_rv(rv); | ||||
| 3183 | return rv; | ||||
| 3184 | } | ||||
| 3185 | |||||
| 3186 | CK_RV | ||||
| 3187 | NSSDBGC_VerifyMessageBegin(CK_SESSION_HANDLE hSession, | ||||
| 3188 | CK_VOID_PTR pParameter, | ||||
| 3189 | CK_ULONG ulParameterLen) | ||||
| 3190 | { | ||||
| 3191 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 3192 | PR_LOG(modlog, 1, ("C_VerifyMessageBegin"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_VerifyMessageBegin" ); } } while (0); | ||||
| 3193 | log_handle(3, fmt_hSession, hSession); | ||||
| 3194 | PR_LOG(modlog, 3, (fmt_pParameter, pParameter))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pParameter , pParameter); } } while (0); | ||||
| 3195 | PR_LOG(modlog, 3, (fmt_ulParameterLen, ulParameterLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulParameterLen , ulParameterLen); } } while (0); | ||||
| 3196 | nssdbg_start_time(FUNC_C_VERIFYMESSAGEBEGIN89, &start); | ||||
| 3197 | rv = module_functions->C_VerifyMessageBegin(hSession, | ||||
| 3198 | pParameter, | ||||
| 3199 | ulParameterLen); | ||||
| 3200 | nssdbg_finish_time(FUNC_C_VERIFYMESSAGEBEGIN89, start); | ||||
| 3201 | log_rv(rv); | ||||
| 3202 | return rv; | ||||
| 3203 | } | ||||
| 3204 | |||||
| 3205 | CK_RV | ||||
| 3206 | NSSDBGC_VerifyMessageNext(CK_SESSION_HANDLE hSession, | ||||
| 3207 | CK_VOID_PTR pParameter, | ||||
| 3208 | CK_ULONG ulParameterLen, | ||||
| 3209 | CK_BYTE_PTR pData, | ||||
| 3210 | CK_ULONG ulDataLen, | ||||
| 3211 | CK_BYTE_PTR pSignature, | ||||
| 3212 | CK_ULONG ulSignatureLen) | ||||
| 3213 | { | ||||
| 3214 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 3215 | PR_LOG(modlog, 1, ("C_VerifyMessageNext"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_VerifyMessageNext" ); } } while (0); | ||||
| 3216 | log_handle(3, fmt_hSession, hSession); | ||||
| 3217 | PR_LOG(modlog, 3, (fmt_pParameter, pParameter))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pParameter , pParameter); } } while (0); | ||||
| 3218 | PR_LOG(modlog, 3, (fmt_ulParameterLen, ulParameterLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulParameterLen , ulParameterLen); } } while (0); | ||||
| 3219 | PR_LOG(modlog, 3, (fmt_pData, pData))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pData , pData); } } while (0); | ||||
| 3220 | PR_LOG(modlog, 3, (fmt_ulDataLen, ulDataLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulDataLen , ulDataLen); } } while (0); | ||||
| 3221 | PR_LOG(modlog, 3, (fmt_pSignature, pSignature))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_pSignature , pSignature); } } while (0); | ||||
| 3222 | PR_LOG(modlog, 3, (fmt_ulSignatureLen, ulSignatureLen))do { if (((modlog)->level >= (3))) { PR_LogPrint (fmt_ulSignatureLen , ulSignatureLen); } } while (0); | ||||
| 3223 | nssdbg_start_time(FUNC_C_VERIFYMESSAGENEXT90, &start); | ||||
| 3224 | rv = module_functions->C_VerifyMessageNext(hSession, | ||||
| 3225 | pParameter, | ||||
| 3226 | ulParameterLen, | ||||
| 3227 | pData, | ||||
| 3228 | ulDataLen, | ||||
| 3229 | pSignature, | ||||
| 3230 | ulSignatureLen); | ||||
| 3231 | nssdbg_finish_time(FUNC_C_VERIFYMESSAGENEXT90, start); | ||||
| 3232 | log_rv(rv); | ||||
| 3233 | return rv; | ||||
| 3234 | } | ||||
| 3235 | |||||
| 3236 | CK_RV | ||||
| 3237 | NSSDBGC_MessageVerifyFinal(CK_SESSION_HANDLE hSession) | ||||
| 3238 | { | ||||
| 3239 | COMMON_DEFINITIONSCK_RV rv; PRIntervalTime start; | ||||
| 3240 | PR_LOG(modlog, 1, ("C_MessageVerifyFinal"))do { if (((modlog)->level >= (1))) { PR_LogPrint ("C_MessageVerifyFinal" ); } } while (0); | ||||
| 3241 | log_handle(3, fmt_hSession, hSession); | ||||
| 3242 | nssdbg_start_time(FUNC_C_MESSAGEVERIFYFINAL91, &start); | ||||
| 3243 | rv = module_functions->C_MessageVerifyFinal(hSession); | ||||
| 3244 | nssdbg_finish_time(FUNC_C_MESSAGEVERIFYFINAL91, start); | ||||
| 3245 | log_rv(rv); | ||||
| 3246 | return rv; | ||||
| 3247 | } | ||||
| 3248 | |||||
| 3249 | CK_FUNCTION_LIST_3_0_PTR | ||||
| 3250 | nss_InsertDeviceLog( | ||||
| 3251 | CK_FUNCTION_LIST_3_0_PTR devEPV) | ||||
| 3252 | { | ||||
| 3253 | module_functions = devEPV; | ||||
| 3254 | debug_functions.version = devEPV->version; | ||||
| 3255 | modlog = PR_NewLogModule("nss_mod_log"); | ||||
| 3256 | debug_functions.C_Initialize = NSSDBGC_Initialize; | ||||
| 3257 | debug_functions.C_Finalize = NSSDBGC_Finalize; | ||||
| 3258 | debug_functions.C_GetInfo = NSSDBGC_GetInfo; | ||||
| 3259 | debug_functions.C_GetFunctionList = NSSDBGC_GetFunctionList; | ||||
| 3260 | debug_functions.C_GetSlotList = NSSDBGC_GetSlotList; | ||||
| 3261 | debug_functions.C_GetSlotInfo = NSSDBGC_GetSlotInfo; | ||||
| 3262 | debug_functions.C_GetTokenInfo = NSSDBGC_GetTokenInfo; | ||||
| 3263 | debug_functions.C_GetMechanismList = NSSDBGC_GetMechanismList; | ||||
| 3264 | debug_functions.C_GetMechanismInfo = NSSDBGC_GetMechanismInfo; | ||||
| 3265 | debug_functions.C_InitToken = NSSDBGC_InitToken; | ||||
| 3266 | debug_functions.C_InitPIN = NSSDBGC_InitPIN; | ||||
| 3267 | debug_functions.C_SetPIN = NSSDBGC_SetPIN; | ||||
| 3268 | debug_functions.C_OpenSession = NSSDBGC_OpenSession; | ||||
| 3269 | debug_functions.C_CloseSession = NSSDBGC_CloseSession; | ||||
| 3270 | debug_functions.C_CloseAllSessions = NSSDBGC_CloseAllSessions; | ||||
| 3271 | debug_functions.C_GetSessionInfo = NSSDBGC_GetSessionInfo; | ||||
| 3272 | debug_functions.C_GetOperationState = NSSDBGC_GetOperationState; | ||||
| 3273 | debug_functions.C_SetOperationState = NSSDBGC_SetOperationState; | ||||
| 3274 | debug_functions.C_Login = NSSDBGC_Login; | ||||
| 3275 | debug_functions.C_Logout = NSSDBGC_Logout; | ||||
| 3276 | debug_functions.C_CreateObject = NSSDBGC_CreateObject; | ||||
| 3277 | debug_functions.C_CopyObject = NSSDBGC_CopyObject; | ||||
| 3278 | debug_functions.C_DestroyObject = NSSDBGC_DestroyObject; | ||||
| 3279 | debug_functions.C_GetObjectSize = NSSDBGC_GetObjectSize; | ||||
| 3280 | debug_functions.C_GetAttributeValue = NSSDBGC_GetAttributeValue; | ||||
| 3281 | debug_functions.C_SetAttributeValue = NSSDBGC_SetAttributeValue; | ||||
| 3282 | debug_functions.C_FindObjectsInit = NSSDBGC_FindObjectsInit; | ||||
| 3283 | debug_functions.C_FindObjects = NSSDBGC_FindObjects; | ||||
| 3284 | debug_functions.C_FindObjectsFinal = NSSDBGC_FindObjectsFinal; | ||||
| 3285 | debug_functions.C_EncryptInit = NSSDBGC_EncryptInit; | ||||
| 3286 | debug_functions.C_Encrypt = NSSDBGC_Encrypt; | ||||
| 3287 | debug_functions.C_EncryptUpdate = NSSDBGC_EncryptUpdate; | ||||
| 3288 | debug_functions.C_EncryptFinal = NSSDBGC_EncryptFinal; | ||||
| 3289 | debug_functions.C_DecryptInit = NSSDBGC_DecryptInit; | ||||
| 3290 | debug_functions.C_Decrypt = NSSDBGC_Decrypt; | ||||
| 3291 | debug_functions.C_DecryptUpdate = NSSDBGC_DecryptUpdate; | ||||
| 3292 | debug_functions.C_DecryptFinal = NSSDBGC_DecryptFinal; | ||||
| 3293 | debug_functions.C_DigestInit = NSSDBGC_DigestInit; | ||||
| 3294 | debug_functions.C_Digest = NSSDBGC_Digest; | ||||
| 3295 | debug_functions.C_DigestUpdate = NSSDBGC_DigestUpdate; | ||||
| 3296 | debug_functions.C_DigestKey = NSSDBGC_DigestKey; | ||||
| 3297 | debug_functions.C_DigestFinal = NSSDBGC_DigestFinal; | ||||
| 3298 | debug_functions.C_SignInit = NSSDBGC_SignInit; | ||||
| 3299 | debug_functions.C_Sign = NSSDBGC_Sign; | ||||
| 3300 | debug_functions.C_SignUpdate = NSSDBGC_SignUpdate; | ||||
| 3301 | debug_functions.C_SignFinal = NSSDBGC_SignFinal; | ||||
| 3302 | debug_functions.C_SignRecoverInit = NSSDBGC_SignRecoverInit; | ||||
| 3303 | debug_functions.C_SignRecover = NSSDBGC_SignRecover; | ||||
| 3304 | debug_functions.C_VerifyInit = NSSDBGC_VerifyInit; | ||||
| 3305 | debug_functions.C_Verify = NSSDBGC_Verify; | ||||
| 3306 | debug_functions.C_VerifyUpdate = NSSDBGC_VerifyUpdate; | ||||
| 3307 | debug_functions.C_VerifyFinal = NSSDBGC_VerifyFinal; | ||||
| 3308 | debug_functions.C_VerifyRecoverInit = NSSDBGC_VerifyRecoverInit; | ||||
| 3309 | debug_functions.C_VerifyRecover = NSSDBGC_VerifyRecover; | ||||
| 3310 | debug_functions.C_DigestEncryptUpdate = NSSDBGC_DigestEncryptUpdate; | ||||
| 3311 | debug_functions.C_DecryptDigestUpdate = NSSDBGC_DecryptDigestUpdate; | ||||
| 3312 | debug_functions.C_SignEncryptUpdate = NSSDBGC_SignEncryptUpdate; | ||||
| 3313 | debug_functions.C_DecryptVerifyUpdate = NSSDBGC_DecryptVerifyUpdate; | ||||
| 3314 | debug_functions.C_GenerateKey = NSSDBGC_GenerateKey; | ||||
| 3315 | debug_functions.C_GenerateKeyPair = NSSDBGC_GenerateKeyPair; | ||||
| 3316 | debug_functions.C_WrapKey = NSSDBGC_WrapKey; | ||||
| 3317 | debug_functions.C_UnwrapKey = NSSDBGC_UnwrapKey; | ||||
| 3318 | debug_functions.C_DeriveKey = NSSDBGC_DeriveKey; | ||||
| 3319 | debug_functions.C_SeedRandom = NSSDBGC_SeedRandom; | ||||
| 3320 | debug_functions.C_GenerateRandom = NSSDBGC_GenerateRandom; | ||||
| 3321 | debug_functions.C_GetFunctionStatus = NSSDBGC_GetFunctionStatus; | ||||
| 3322 | debug_functions.C_CancelFunction = NSSDBGC_CancelFunction; | ||||
| 3323 | debug_functions.C_WaitForSlotEvent = NSSDBGC_WaitForSlotEvent; | ||||
| 3324 | debug_functions.C_GetInterfaceList = NSSDBGC_GetInterfaceList; | ||||
| 3325 | debug_functions.C_GetInterface = NSSDBGC_GetInterface; | ||||
| 3326 | debug_functions.C_LoginUser = NSSDBGC_LoginUser; | ||||
| 3327 | debug_functions.C_SessionCancel = NSSDBGC_SessionCancel; | ||||
| 3328 | debug_functions.C_MessageEncryptInit = NSSDBGC_MessageEncryptInit; | ||||
| 3329 | debug_functions.C_EncryptMessage = NSSDBGC_EncryptMessage; | ||||
| 3330 | debug_functions.C_EncryptMessageBegin = NSSDBGC_EncryptMessageBegin; | ||||
| 3331 | debug_functions.C_EncryptMessageNext = NSSDBGC_EncryptMessageNext; | ||||
| 3332 | debug_functions.C_MessageEncryptFinal = NSSDBGC_MessageEncryptFinal; | ||||
| 3333 | debug_functions.C_MessageDecryptInit = NSSDBGC_MessageDecryptInit; | ||||
| 3334 | debug_functions.C_DecryptMessage = NSSDBGC_DecryptMessage; | ||||
| 3335 | debug_functions.C_DecryptMessageBegin = NSSDBGC_DecryptMessageBegin; | ||||
| 3336 | debug_functions.C_DecryptMessageNext = NSSDBGC_DecryptMessageNext; | ||||
| 3337 | debug_functions.C_MessageDecryptFinal = NSSDBGC_MessageDecryptFinal; | ||||
| 3338 | debug_functions.C_MessageSignInit = NSSDBGC_MessageSignInit; | ||||
| 3339 | debug_functions.C_SignMessage = NSSDBGC_SignMessage; | ||||
| 3340 | debug_functions.C_SignMessageBegin = NSSDBGC_SignMessageBegin; | ||||
| 3341 | debug_functions.C_SignMessageNext = NSSDBGC_SignMessageNext; | ||||
| 3342 | debug_functions.C_MessageSignFinal = NSSDBGC_MessageSignFinal; | ||||
| 3343 | debug_functions.C_MessageVerifyInit = NSSDBGC_MessageVerifyInit; | ||||
| 3344 | debug_functions.C_VerifyMessage = NSSDBGC_VerifyMessage; | ||||
| 3345 | debug_functions.C_VerifyMessageBegin = NSSDBGC_VerifyMessageBegin; | ||||
| 3346 | debug_functions.C_VerifyMessageNext = NSSDBGC_VerifyMessageNext; | ||||
| 3347 | debug_functions.C_MessageVerifyFinal = NSSDBGC_MessageVerifyFinal; | ||||
| 3348 | return &debug_functions; | ||||
| 3349 | } | ||||
| 3350 | |||||
| 3351 | /* | ||||
| 3352 | * scale the time factor up accordingly. | ||||
| 3353 | * This routine tries to keep at least 2 significant figures on output. | ||||
| 3354 | * If the time is 0, then indicate that with a 'z' for units. | ||||
| 3355 | * If the time is greater than 10 minutes, output the time in minutes. | ||||
| 3356 | * If the time is less than 10 minutes but greater than 10 seconds output | ||||
| 3357 | * the time in second. | ||||
| 3358 | * If the time is less than 10 seconds but greater than 10 milliseconds | ||||
| 3359 | * output * the time in millisecond. | ||||
| 3360 | * If the time is less than 10 milliseconds but greater than 0 ticks output | ||||
| 3361 | * the time in microsecond. | ||||
| 3362 | * | ||||
| 3363 | */ | ||||
| 3364 | static PRUint32 | ||||
| 3365 | getPrintTime(PRIntervalTime time, char **type) | ||||
| 3366 | { | ||||
| 3367 | PRUint32 prTime; | ||||
| 3368 | |||||
| 3369 | /* detect a programming error by outputting 'bu' to the output stream | ||||
| 3370 | * rather than crashing */ | ||||
| 3371 | *type = "bug"; | ||||
| 3372 | if (time == 0) { | ||||
| 3373 | *type = "z"; | ||||
| 3374 | return 0; | ||||
| 3375 | } | ||||
| 3376 | |||||
| 3377 | prTime = PR_IntervalToSeconds(time); | ||||
| 3378 | |||||
| 3379 | if (prTime >= 600) { | ||||
| 3380 | *type = "m"; | ||||
| 3381 | return prTime / 60; | ||||
| 3382 | } | ||||
| 3383 | if (prTime >= 10) { | ||||
| 3384 | *type = "s"; | ||||
| 3385 | return prTime; | ||||
| 3386 | } | ||||
| 3387 | prTime = PR_IntervalToMilliseconds(time); | ||||
| 3388 | if (prTime >= 10) { | ||||
| 3389 | *type = "ms"; | ||||
| 3390 | return prTime; | ||||
| 3391 | } | ||||
| 3392 | *type = "us"; | ||||
| 3393 | return PR_IntervalToMicroseconds(time); | ||||
| 3394 | } | ||||
| 3395 | |||||
| 3396 | static void | ||||
| 3397 | print_final_statistics(void) | ||||
| 3398 | { | ||||
| 3399 | int total_calls = 0; | ||||
| 3400 | PRIntervalTime total_time = 0; | ||||
| 3401 | PRUint32 pr_total_time; | ||||
| 3402 | char *type; | ||||
| 3403 | char *fname; | ||||
| 3404 | FILE *outfile = NULL((void*)0); | ||||
| 3405 | int i; | ||||
| 3406 | |||||
| 3407 | fname = PR_GetEnvSecure("NSS_OUTPUT_FILE"); | ||||
| 3408 | if (fname) { | ||||
| 3409 | /* need to add an optional process id to the filename */ | ||||
| 3410 | outfile = fopen(fname, "w+"); | ||||
| 3411 | } | ||||
| 3412 | if (!outfile
| ||||
| 3413 | outfile = stdoutstdout; | ||||
| 3414 | } | ||||
| 3415 | |||||
| 3416 | fprintf(outfile, "%-25s %10s %12s %12s %10s\n", "Function", "# Calls", | ||||
| 3417 | "Time", "Avg.", "% Time"); | ||||
| 3418 | fprintf(outfile, "\n"); | ||||
| 3419 | for (i = 0; i < nssdbg_prof_size; i++) { | ||||
| 3420 | total_calls += nssdbg_prof_data[i].calls; | ||||
| 3421 | total_time += nssdbg_prof_data[i].time; | ||||
| 3422 | } | ||||
| 3423 | for (i = 0; i
| ||||
| 3424 | PRIntervalTime time = nssdbg_prof_data[i].time; | ||||
| 3425 | PRUint32 usTime = PR_IntervalToMicroseconds(time); | ||||
| 3426 | PRUint32 prTime = 0; | ||||
| 3427 | PRUint32 calls = nssdbg_prof_data[i].calls; | ||||
| 3428 | /* don't print out functions that weren't even called */ | ||||
| 3429 | if (calls == 0) { | ||||
| 3430 | continue; | ||||
| 3431 | } | ||||
| 3432 | |||||
| 3433 | prTime = getPrintTime(time, &type); | ||||
| 3434 | |||||
| 3435 | fprintf(outfile, "%-25s %10d %10d%2s ", nssdbg_prof_data[i].function, | ||||
| 3436 | calls, prTime, type); | ||||
| 3437 | /* for now always output the average in microseconds */ | ||||
| 3438 | fprintf(outfile, "%10.2f%2s", (float)usTime / (float)calls, "us"); | ||||
| 3439 | fprintf(outfile, "%10.2f%%", ((float)time / (float)total_time) * 100); | ||||
| 3440 | fprintf(outfile, "\n"); | ||||
| 3441 | } | ||||
| 3442 | fprintf(outfile, "\n"); | ||||
| 3443 | |||||
| 3444 | pr_total_time = getPrintTime(total_time, &type); | ||||
| 3445 | |||||
| 3446 | fprintf(outfile, "%25s %10d %10d%2s\n", "Totals", total_calls, | ||||
| 3447 | pr_total_time, type); | ||||
| 3448 | fprintf(outfile, "\n\nMaximum number of concurrent open sessions: %d\n\n", | ||||
| 3449 | maxOpenSessions); | ||||
| 3450 | fflush(outfile); | ||||
| 3451 | if (outfile != stdoutstdout) { | ||||
| 3452 | fclose(outfile); | ||||
| 3453 | } | ||||
| 3454 | } | ||||
|