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