1
/* ***** BEGIN LICENSE BLOCK *****
2
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
4
* The contents of this file are subject to the Mozilla Public License Version
5
* 1.1 (the "License"); you may not use this file except in compliance with
6
* the License. You may obtain a copy of the License at
7
* http://www.mozilla.org/MPL/
9
* Software distributed under the License is distributed on an "AS IS" basis,
10
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11
* for the specific language governing rights and limitations under the
14
* The Original Code is the Netscape security libraries.
16
* The Initial Developer of the Original Code is
17
* Netscape Communications Corporation.
18
* Portions created by the Initial Developer are Copyright (C) 1994-2000
19
* the Initial Developer. All Rights Reserved.
23
* Alternatively, the contents of this file may be used under the terms of
24
* either the GNU General Public License Version 2 or later (the "GPL"), or
25
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
26
* in which case the provisions of the GPL or the LGPL are applicable instead
27
* of those above. If you wish to allow use of your version of this file only
28
* under the terms of either the GPL or the LGPL, and not to allow others to
29
* use your version of this file under the terms of the MPL, indicate your
30
* decision by deleting the provisions above and replace them with the notice
31
* and other provisions required by the GPL or the LGPL. If you do not delete
32
* the provisions above, a recipient may use your version of this file under
33
* the terms of any one of the MPL, the GPL or the LGPL.
35
* ***** END LICENSE BLOCK ***** */
39
static PRLogModuleInfo *modlog = NULL;
41
static CK_FUNCTION_LIST_PTR module_functions;
43
static CK_FUNCTION_LIST debug_functions;
45
static void print_final_statistics(void);
47
/* The AIX 64-bit compiler chokes on large switch statements (see
48
* bug #63815). I tried the trick recommended there, using -O2 in
49
* debug builds, and it didn't work. Instead, I'll suppress some of
50
* the verbose output and just dump values.
53
static void get_attr_type_str(CK_ATTRIBUTE_TYPE atype, char *str, int len)
56
PR_snprintf(str, len, "%s", attr); break;
59
case CKA_CLASS: SETA("CKA_CLASS");
60
case CKA_TOKEN: SETA("CKA_TOKEN");
61
case CKA_PRIVATE: SETA("CKA_PRIVATE");
62
case CKA_LABEL: SETA("CKA_LABEL");
63
case CKA_APPLICATION: SETA("CKA_APPLICATION");
64
case CKA_VALUE: SETA("CKA_VALUE");
65
case CKA_OBJECT_ID: SETA("CKA_OBJECT_ID");
66
case CKA_CERTIFICATE_TYPE: SETA("CKA_CERTIFICATE_TYPE");
67
case CKA_ISSUER: SETA("CKA_ISSUER");
68
case CKA_SERIAL_NUMBER: SETA("CKA_SERIAL_NUMBER");
69
case CKA_AC_ISSUER: SETA("CKA_AC_ISSUER");
70
case CKA_OWNER: SETA("CKA_OWNER");
71
case CKA_ATTR_TYPES: SETA("CKA_ATTR_TYPES");
72
case CKA_TRUSTED: SETA("CKA_TRUSTED");
73
case CKA_KEY_TYPE: SETA("CKA_KEY_TYPE");
74
case CKA_SUBJECT: SETA("CKA_SUBJECT");
75
case CKA_ID: SETA("CKA_ID");
76
case CKA_SENSITIVE: SETA("CKA_SENSITIVE");
77
case CKA_ENCRYPT: SETA("CKA_ENCRYPT");
78
case CKA_DECRYPT: SETA("CKA_DECRYPT");
79
case CKA_WRAP: SETA("CKA_WRAP");
80
case CKA_UNWRAP: SETA("CKA_UNWRAP");
81
case CKA_SIGN: SETA("CKA_SIGN");
82
case CKA_SIGN_RECOVER: SETA("CKA_SIGN_RECOVER");
83
case CKA_VERIFY: SETA("CKA_VERIFY");
84
case CKA_VERIFY_RECOVER: SETA("CKA_VERIFY_RECOVER");
85
case CKA_DERIVE: SETA("CKA_DERIVE");
86
case CKA_START_DATE: SETA("CKA_START_DATE");
87
case CKA_END_DATE: SETA("CKA_END_DATE");
88
case CKA_MODULUS: SETA("CKA_MODULUS");
89
case CKA_MODULUS_BITS: SETA("CKA_MODULUS_BITS");
90
case CKA_PUBLIC_EXPONENT: SETA("CKA_PUBLIC_EXPONENT");
91
case CKA_PRIVATE_EXPONENT: SETA("CKA_PRIVATE_EXPONENT");
92
case CKA_PRIME_1: SETA("CKA_PRIME_1");
93
case CKA_PRIME_2: SETA("CKA_PRIME_2");
94
case CKA_EXPONENT_1: SETA("CKA_EXPONENT_1");
95
case CKA_EXPONENT_2: SETA("CKA_EXPONENT_2");
96
case CKA_COEFFICIENT: SETA("CKA_COEFFICIENT");
97
case CKA_PRIME: SETA("CKA_PRIME");
98
case CKA_SUBPRIME: SETA("CKA_SUBPRIME");
99
case CKA_BASE: SETA("CKA_BASE");
100
case CKA_PRIME_BITS: SETA("CKA_PRIME_BITS");
101
case CKA_SUB_PRIME_BITS: SETA("CKA_SUB_PRIME_BITS");
102
case CKA_VALUE_BITS: SETA("CKA_VALUE_BITS");
103
case CKA_VALUE_LEN: SETA("CKA_VALUE_LEN");
104
case CKA_EXTRACTABLE: SETA("CKA_EXTRACTABLE");
105
case CKA_LOCAL: SETA("CKA_LOCAL");
106
case CKA_NEVER_EXTRACTABLE: SETA("CKA_NEVER_EXTRACTABLE");
107
case CKA_ALWAYS_SENSITIVE: SETA("CKA_ALWAYS_SENSITIVE");
108
case CKA_KEY_GEN_MECHANISM: SETA("CKA_KEY_GEN_MECHANISM");
109
case CKA_MODIFIABLE: SETA("CKA_MODIFIABLE");
110
case CKA_ECDSA_PARAMS: SETA("CKA_ECDSA_PARAMS");
111
case CKA_EC_POINT: SETA("CKA_EC_POINT");
112
case CKA_SECONDARY_AUTH: SETA("CKA_SECONDARY_AUTH");
113
case CKA_AUTH_PIN_FLAGS: SETA("CKA_AUTH_PIN_FLAGS");
114
case CKA_HW_FEATURE_TYPE: SETA("CKA_HW_FEATURE_TYPE");
115
case CKA_RESET_ON_INIT: SETA("CKA_RESET_ON_INIT");
116
case CKA_HAS_RESET: SETA("CKA_HAS_RESET");
117
case CKA_VENDOR_DEFINED: SETA("CKA_VENDOR_DEFINED");
118
case CKA_NETSCAPE_URL: SETA("CKA_NETSCAPE_URL");
119
case CKA_NETSCAPE_EMAIL: SETA("CKA_NETSCAPE_EMAIL");
120
case CKA_NETSCAPE_SMIME_INFO: SETA("CKA_NETSCAPE_SMIME_INFO");
121
case CKA_NETSCAPE_SMIME_TIMESTAMP: SETA("CKA_NETSCAPE_SMIME_TIMESTAMP");
122
case CKA_NETSCAPE_PKCS8_SALT: SETA("CKA_NETSCAPE_PKCS8_SALT");
123
case CKA_NETSCAPE_PASSWORD_CHECK: SETA("CKA_NETSCAPE_PASSWORD_CHECK");
124
case CKA_NETSCAPE_EXPIRES: SETA("CKA_NETSCAPE_EXPIRES");
125
case CKA_NETSCAPE_KRL: SETA("CKA_NETSCAPE_KRL");
126
case CKA_NETSCAPE_PQG_COUNTER: SETA("CKA_NETSCAPE_PQG_COUNTER");
127
case CKA_NETSCAPE_PQG_SEED: SETA("CKA_NETSCAPE_PQG_SEED");
128
case CKA_NETSCAPE_PQG_H: SETA("CKA_NETSCAPE_PQG_H");
129
case CKA_NETSCAPE_PQG_SEED_BITS: SETA("CKA_NETSCAPE_PQG_SEED_BITS");
130
case CKA_TRUST: SETA("CKA_TRUST");
131
case CKA_TRUST_DIGITAL_SIGNATURE: SETA("CKA_TRUST_DIGITAL_SIGNATURE");
132
case CKA_TRUST_NON_REPUDIATION: SETA("CKA_TRUST_NON_REPUDIATION");
133
case CKA_TRUST_KEY_ENCIPHERMENT: SETA("CKA_TRUST_KEY_ENCIPHERMENT");
134
case CKA_TRUST_DATA_ENCIPHERMENT: SETA("CKA_TRUST_DATA_ENCIPHERMENT");
135
case CKA_TRUST_KEY_AGREEMENT: SETA("CKA_TRUST_KEY_AGREEMENT");
136
case CKA_TRUST_KEY_CERT_SIGN: SETA("CKA_TRUST_KEY_CERT_SIGN");
137
case CKA_TRUST_CRL_SIGN: SETA("CKA_TRUST_CRL_SIGN");
138
case CKA_TRUST_SERVER_AUTH: SETA("CKA_TRUST_SERVER_AUTH");
139
case CKA_TRUST_CLIENT_AUTH: SETA("CKA_TRUST_CLIENT_AUTH");
140
case CKA_TRUST_CODE_SIGNING: SETA("CKA_TRUST_CODE_SIGNING");
141
case CKA_TRUST_EMAIL_PROTECTION: SETA("CKA_TRUST_EMAIL_PROTECTION");
142
case CKA_TRUST_IPSEC_END_SYSTEM: SETA("CKA_TRUST_IPSEC_END_SYSTEM");
143
case CKA_TRUST_IPSEC_TUNNEL: SETA("CKA_TRUST_IPSEC_TUNNEL");
144
case CKA_TRUST_IPSEC_USER: SETA("CKA_TRUST_IPSEC_USER");
145
case CKA_TRUST_TIME_STAMPING: SETA("CKA_TRUST_TIME_STAMPING");
146
case CKA_CERT_SHA1_HASH: SETA("CKA_CERT_SHA1_HASH");
147
case CKA_CERT_MD5_HASH: SETA("CKA_CERT_MD5_HASH");
148
case CKA_NETSCAPE_DB: SETA("CKA_NETSCAPE_DB");
149
case CKA_NETSCAPE_TRUST: SETA("CKA_NETSCAPE_TRUST");
151
default: PR_snprintf(str, len, "0x%p", atype); break;
155
static void get_obj_class(CK_OBJECT_CLASS objClass, char *str, int len)
158
PR_snprintf(str, len, "%s", objc); break;
161
case CKO_DATA: SETO("CKO_DATA");
162
case CKO_CERTIFICATE: SETO("CKO_CERTIFICATE");
163
case CKO_PUBLIC_KEY: SETO("CKO_PUBLIC_KEY");
164
case CKO_PRIVATE_KEY: SETO("CKO_PRIVATE_KEY");
165
case CKO_SECRET_KEY: SETO("CKO_SECRET_KEY");
166
case CKO_HW_FEATURE: SETO("CKO_HW_FEATURE");
167
case CKO_DOMAIN_PARAMETERS: SETO("CKO_DOMAIN_PARAMETERS");
168
case CKO_NETSCAPE_CRL: SETO("CKO_NETSCAPE_CRL");
169
case CKO_NETSCAPE_SMIME: SETO("CKO_NETSCAPE_SMIME");
170
case CKO_NETSCAPE_TRUST: SETO("CKO_NETSCAPE_TRUST");
171
case CKO_NETSCAPE_BUILTIN_ROOT_LIST: SETO("CKO_NETSCAPE_BUILTIN_ROOT_LIST");
173
default: PR_snprintf(str, len, "0x%p", objClass); break;
177
static void get_trust_val(CK_TRUST trust, char *str, int len)
180
PR_snprintf(str, len, "%s", objc); break;
183
case CKT_NETSCAPE_TRUSTED: SETT("CKT_NETSCAPE_TRUSTED");
184
case CKT_NETSCAPE_TRUSTED_DELEGATOR: SETT("CKT_NETSCAPE_TRUSTED_DELEGATOR");
185
case CKT_NETSCAPE_UNTRUSTED: SETT("CKT_NETSCAPE_UNTRUSTED");
186
case CKT_NETSCAPE_MUST_VERIFY: SETT("CKT_NETSCAPE_MUST_VERIFY");
187
case CKT_NETSCAPE_TRUST_UNKNOWN: SETT("CKT_NETSCAPE_TRUST_UNKNOWN");
188
case CKT_NETSCAPE_VALID: SETT("CKT_NETSCAPE_VALID");
189
case CKT_NETSCAPE_VALID_DELEGATOR: SETT("CKT_NETSCAPE_VALID_DELEGATOR");
191
default: PR_snprintf(str, len, "0x%p", trust); break;
195
static void print_attr_value(CK_ATTRIBUTE_PTR attr)
200
get_attr_type_str(attr->type, atype, sizeof atype);
201
switch (attr->type) {
210
case CKA_SIGN_RECOVER:
212
case CKA_VERIFY_RECOVER:
214
case CKA_EXTRACTABLE:
216
case CKA_NEVER_EXTRACTABLE:
217
case CKA_ALWAYS_SENSITIVE:
219
if (attr->ulValueLen > 0 && attr->pValue) {
220
CK_BBOOL tf = *((CK_BBOOL *)attr->pValue);
221
len = sizeof(valstr);
222
PR_snprintf(valstr, len, "%s", tf ? "CK_TRUE" : "CK_FALSE");
223
PR_LOG(modlog, 4, (" %s = %s [%d]",
224
atype, valstr, attr->ulValueLen));
228
if (attr->ulValueLen > 0 && attr->pValue) {
229
CK_OBJECT_CLASS objClass = *((CK_OBJECT_CLASS *)attr->pValue);
230
get_obj_class(objClass, valstr, sizeof valstr);
231
PR_LOG(modlog, 4, (" %s = %s [%d]",
232
atype, valstr, attr->ulValueLen));
235
case CKA_TRUST_SERVER_AUTH:
236
case CKA_TRUST_CLIENT_AUTH:
237
case CKA_TRUST_CODE_SIGNING:
238
case CKA_TRUST_EMAIL_PROTECTION:
239
if (attr->ulValueLen > 0 && attr->pValue) {
240
CK_TRUST trust = *((CK_TRUST *)attr->pValue);
241
get_trust_val(trust, valstr, sizeof valstr);
242
PR_LOG(modlog, 4, (" %s = %s [%d]",
243
atype, valstr, attr->ulValueLen));
247
case CKA_NETSCAPE_EMAIL:
248
case CKA_NETSCAPE_URL:
249
if (attr->ulValueLen > 0 && attr->pValue) {
250
len = PR_MIN(attr->ulValueLen + 1, sizeof valstr);
251
PR_snprintf(valstr, len, "%s", attr->pValue);
252
PR_LOG(modlog, 4, (" %s = %s [%d]",
253
atype, valstr, attr->ulValueLen));
257
PR_LOG(modlog, 4, (" %s = 0x%p [%d]",
258
atype, attr->pValue, attr->ulValueLen));
263
static void print_template(CK_ATTRIBUTE_PTR templ, CK_ULONG tlen)
266
for (i=0; i<tlen; i++) {
267
print_attr_value(&templ[i]);
271
static void print_mechanism(CK_MECHANISM_PTR m)
273
PR_LOG(modlog, 4, (" mechanism = 0x%p", m->mechanism));
276
struct nssdbg_prof_str {
282
#define NSSDBG_DEFINE(func) { 0, 0, #func }
284
struct nssdbg_prof_str nssdbg_prof_data[] = {
285
#define FUNC_C_INITIALIZE 0
286
NSSDBG_DEFINE(C_Initialize),
287
#define FUNC_C_FINALIZE 1
288
NSSDBG_DEFINE(C_Finalize),
289
#define FUNC_C_GETINFO 2
290
NSSDBG_DEFINE(C_GetInfo),
291
#define FUNC_C_GETFUNCITONLIST 3
292
NSSDBG_DEFINE(C_GetFunctionList),
293
#define FUNC_C_GETSLOTLIST 4
294
NSSDBG_DEFINE(C_GetSlotList),
295
#define FUNC_C_GETSLOTINFO 5
296
NSSDBG_DEFINE(C_GetSlotInfo),
297
#define FUNC_C_GETTOKENINFO 6
298
NSSDBG_DEFINE(C_GetTokenInfo),
299
#define FUNC_C_GETMECHANISMLIST 7
300
NSSDBG_DEFINE(C_GetMechanismList),
301
#define FUNC_C_GETMECHANISMINFO 8
302
NSSDBG_DEFINE(C_GetMechanismInfo),
303
#define FUNC_C_INITTOKEN 9
304
NSSDBG_DEFINE(C_InitToken),
305
#define FUNC_C_INITPIN 10
306
NSSDBG_DEFINE(C_InitPIN),
307
#define FUNC_C_SETPIN 11
308
NSSDBG_DEFINE(C_SetPIN),
309
#define FUNC_C_OPENSESSION 12
310
NSSDBG_DEFINE(C_OpenSession),
311
#define FUNC_C_CLOSESESSION 13
312
NSSDBG_DEFINE(C_CloseSession),
313
#define FUNC_C_CLOSEALLSESSIONS 14
314
NSSDBG_DEFINE(C_CloseAllSessions),
315
#define FUNC_C_GETSESSIONINFO 15
316
NSSDBG_DEFINE(C_GetSessionInfo),
317
#define FUNC_C_GETOPERATIONSTATE 16
318
NSSDBG_DEFINE(C_GetOperationState),
319
#define FUNC_C_SETOPERATIONSTATE 17
320
NSSDBG_DEFINE(C_SetOperationState),
321
#define FUNC_C_LOGIN 18
322
NSSDBG_DEFINE(C_Login),
323
#define FUNC_C_LOGOUT 19
324
NSSDBG_DEFINE(C_Logout),
325
#define FUNC_C_CREATEOBJECT 20
326
NSSDBG_DEFINE(C_CreateObject),
327
#define FUNC_C_COPYOBJECT 21
328
NSSDBG_DEFINE(C_CopyObject),
329
#define FUNC_C_DESTROYOBJECT 22
330
NSSDBG_DEFINE(C_DestroyObject),
331
#define FUNC_C_GETOBJECTSIZE 23
332
NSSDBG_DEFINE(C_GetObjectSize),
333
#define FUNC_C_GETATTRIBUTEVALUE 24
334
NSSDBG_DEFINE(C_GetAttributeValue),
335
#define FUNC_C_SETATTRIBUTEVALUE 25
336
NSSDBG_DEFINE(C_SetAttributeValue),
337
#define FUNC_C_FINDOBJECTSINIT 26
338
NSSDBG_DEFINE(C_FindObjectsInit),
339
#define FUNC_C_FINDOBJECTS 27
340
NSSDBG_DEFINE(C_FindObjects),
341
#define FUNC_C_FINDOBJECTSFINAL 28
342
NSSDBG_DEFINE(C_FindObjectsFinal),
343
#define FUNC_C_ENCRYPTINIT 29
344
NSSDBG_DEFINE(C_EncryptInit),
345
#define FUNC_C_ENCRYPT 30
346
NSSDBG_DEFINE(C_Encrypt),
347
#define FUNC_C_ENCRYPTUPDATE 31
348
NSSDBG_DEFINE(C_EncryptUpdate),
349
#define FUNC_C_ENCRYPTFINAL 32
350
NSSDBG_DEFINE(C_EncryptFinal),
351
#define FUNC_C_DECRYPTINIT 33
352
NSSDBG_DEFINE(C_DecryptInit),
353
#define FUNC_C_DECRYPT 34
354
NSSDBG_DEFINE(C_Decrypt),
355
#define FUNC_C_DECRYPTUPDATE 35
356
NSSDBG_DEFINE(C_DecryptUpdate),
357
#define FUNC_C_DECRYPTFINAL 36
358
NSSDBG_DEFINE(C_DecryptFinal),
359
#define FUNC_C_DIGESTINIT 37
360
NSSDBG_DEFINE(C_DigestInit),
361
#define FUNC_C_DIGEST 38
362
NSSDBG_DEFINE(C_Digest),
363
#define FUNC_C_DIGESTUPDATE 39
364
NSSDBG_DEFINE(C_DigestUpdate),
365
#define FUNC_C_DIGESTKEY 40
366
NSSDBG_DEFINE(C_DigestKey),
367
#define FUNC_C_DIGESTFINAL 41
368
NSSDBG_DEFINE(C_DigestFinal),
369
#define FUNC_C_SIGNINIT 42
370
NSSDBG_DEFINE(C_SignInit),
371
#define FUNC_C_SIGN 43
372
NSSDBG_DEFINE(C_Sign),
373
#define FUNC_C_SIGNUPDATE 44
374
NSSDBG_DEFINE(C_SignUpdate),
375
#define FUNC_C_SIGNFINAL 45
376
NSSDBG_DEFINE(C_SignFinal),
377
#define FUNC_C_SIGNRECOVERINIT 46
378
NSSDBG_DEFINE(C_SignRecoverInit),
379
#define FUNC_C_SIGNRECOVER 47
380
NSSDBG_DEFINE(C_SignRecover),
381
#define FUNC_C_VERIFYINIT 48
382
NSSDBG_DEFINE(C_VerifyInit),
383
#define FUNC_C_VERIFY 49
384
NSSDBG_DEFINE(C_Verify),
385
#define FUNC_C_VERIFYUPDATE 50
386
NSSDBG_DEFINE(C_VerifyUpdate),
387
#define FUNC_C_VERIFYFINAL 51
388
NSSDBG_DEFINE(C_VerifyFinal),
389
#define FUNC_C_VERIFYRECOVERINIT 52
390
NSSDBG_DEFINE(C_VerifyRecoverInit),
391
#define FUNC_C_VERIFYRECOVER 53
392
NSSDBG_DEFINE(C_VerifyRecover),
393
#define FUNC_C_DIGESTENCRYPTUPDATE 54
394
NSSDBG_DEFINE(C_DigestEncryptUpdate),
395
#define FUNC_C_DECRYPTDIGESTUPDATE 55
396
NSSDBG_DEFINE(C_DecryptDigestUpdate),
397
#define FUNC_C_SIGNENCRYPTUPDATE 56
398
NSSDBG_DEFINE(C_SignEncryptUpdate),
399
#define FUNC_C_DECRYPTVERIFYUPDATE 57
400
NSSDBG_DEFINE(C_DecryptVerifyUpdate),
401
#define FUNC_C_GENERATEKEY 58
402
NSSDBG_DEFINE(C_GenerateKey),
403
#define FUNC_C_GENERATEKEYPAIR 59
404
NSSDBG_DEFINE(C_GenerateKeyPair),
405
#define FUNC_C_WRAPKEY 60
406
NSSDBG_DEFINE(C_WrapKey),
407
#define FUNC_C_UNWRAPKEY 61
408
NSSDBG_DEFINE(C_UnWrapKey),
409
#define FUNC_C_DERIVEKEY 62
410
NSSDBG_DEFINE(C_DeriveKey),
411
#define FUNC_C_SEEDRANDOM 63
412
NSSDBG_DEFINE(C_SeedRandom),
413
#define FUNC_C_GENERATERANDOM 64
414
NSSDBG_DEFINE(C_GenerateRandom),
415
#define FUNC_C_GETFUNCTIONSTATUS 65
416
NSSDBG_DEFINE(C_GetFunctionStatus),
417
#define FUNC_C_CANCELFUNCTION 66
418
NSSDBG_DEFINE(C_CancelFunction),
419
#define FUNC_C_WAITFORSLOTEVENT 67
420
NSSDBG_DEFINE(C_WaitForSlotEvent)
423
int nssdbg_prof_size = sizeof(nssdbg_prof_data)/sizeof(nssdbg_prof_data[0]);
426
static void nssdbg_finish_time(PRInt32 fun_number, PRIntervalTime start)
429
PRIntervalTime end = PR_IntervalNow();
432
/* sigh, lie to PRAtomic add and say we are using signed values */
433
PR_AtomicAdd((PRInt32 *)&nssdbg_prof_data[fun_number].time, (PRInt32)ival);
436
static void nssdbg_start_time(PRInt32 fun_number, PRIntervalTime *start)
438
PR_AtomicIncrement((PRInt32 *)&nssdbg_prof_data[fun_number].calls);
439
*start = PR_IntervalNow();
442
CK_RV NSSDBGC_Initialize(
443
CK_VOID_PTR pInitArgs
447
PRIntervalTime start;
448
PR_LOG(modlog, 1, ("C_Initialize"));
449
PR_LOG(modlog, 3, (" pInitArgs = 0x%p", pInitArgs));
450
nssdbg_start_time(FUNC_C_INITIALIZE,&start);
451
rv = module_functions->C_Initialize(pInitArgs);
452
nssdbg_finish_time(FUNC_C_INITIALIZE,start);
453
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
457
CK_RV NSSDBGC_Finalize(
458
CK_VOID_PTR pReserved
462
PRIntervalTime start;
463
PR_LOG(modlog, 1, ("C_Finalize"));
464
PR_LOG(modlog, 3, (" pReserved = 0x%p", pReserved));
465
nssdbg_start_time(FUNC_C_FINALIZE,&start);
466
rv = module_functions->C_Finalize(pReserved);
467
nssdbg_finish_time(FUNC_C_FINALIZE,start);
468
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
472
CK_RV NSSDBGC_GetInfo(
477
PRIntervalTime start;
478
PR_LOG(modlog, 1, ("C_GetInfo"));
479
PR_LOG(modlog, 3, (" pInfo = 0x%p", pInfo));
480
nssdbg_start_time(FUNC_C_GETINFO,&start);
481
rv = module_functions->C_GetInfo(pInfo);
482
nssdbg_finish_time(FUNC_C_GETINFO,start);
483
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
487
CK_RV NSSDBGC_GetFunctionList(
488
CK_FUNCTION_LIST_PTR_PTR ppFunctionList
492
PRIntervalTime start;
493
PR_LOG(modlog, 1, ("C_GetFunctionList"));
494
PR_LOG(modlog, 3, (" ppFunctionList = 0x%p", ppFunctionList));
495
nssdbg_start_time(FUNC_C_GETFUNCITONLIST,&start);
496
rv = module_functions->C_GetFunctionList(ppFunctionList);
497
nssdbg_finish_time(FUNC_C_GETFUNCITONLIST,start);
498
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
502
CK_RV NSSDBGC_GetSlotList(
503
CK_BBOOL tokenPresent,
504
CK_SLOT_ID_PTR pSlotList,
505
CK_ULONG_PTR pulCount
509
PRIntervalTime start;
511
PR_LOG(modlog, 1, ("C_GetSlotList"));
512
PR_LOG(modlog, 3, (" tokenPresent = 0x%x", tokenPresent));
513
PR_LOG(modlog, 3, (" pSlotList = 0x%p", pSlotList));
514
PR_LOG(modlog, 3, (" pulCount = 0x%p", pulCount));
515
nssdbg_start_time(FUNC_C_GETSLOTLIST,&start);
516
rv = module_functions->C_GetSlotList(tokenPresent,
519
nssdbg_finish_time(FUNC_C_GETSLOTLIST,start);
520
PR_LOG(modlog, 4, (" *pulCount = 0x%x", *pulCount));
522
for (i=0; i<*pulCount; i++) {
523
PR_LOG(modlog, 4, (" slotID[%d] = %x", i, pSlotList[i]));
526
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
530
CK_RV NSSDBGC_GetSlotInfo(
532
CK_SLOT_INFO_PTR pInfo
536
PRIntervalTime start;
537
PR_LOG(modlog, 1, ("C_GetSlotInfo"));
538
PR_LOG(modlog, 3, (" slotID = 0x%x", slotID));
539
PR_LOG(modlog, 3, (" pInfo = 0x%p", pInfo));
540
nssdbg_start_time(FUNC_C_GETSLOTINFO,&start);
541
rv = module_functions->C_GetSlotInfo(slotID,
543
nssdbg_finish_time(FUNC_C_GETSLOTINFO,start);
544
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
548
CK_RV NSSDBGC_GetTokenInfo(
550
CK_TOKEN_INFO_PTR pInfo
554
PRIntervalTime start;
555
PR_LOG(modlog, 1, ("C_GetTokenInfo"));
556
PR_LOG(modlog, 3, (" slotID = 0x%x", slotID));
557
PR_LOG(modlog, 3, (" pInfo = 0x%p", pInfo));
558
nssdbg_start_time(FUNC_C_GETTOKENINFO,&start);
559
rv = module_functions->C_GetTokenInfo(slotID,
561
nssdbg_finish_time(FUNC_C_GETTOKENINFO,start);
562
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
566
CK_RV NSSDBGC_GetMechanismList(
568
CK_MECHANISM_TYPE_PTR pMechanismList,
569
CK_ULONG_PTR pulCount
573
PRIntervalTime start;
574
PR_LOG(modlog, 1, ("C_GetMechanismList"));
575
PR_LOG(modlog, 3, (" slotID = 0x%x", slotID));
576
PR_LOG(modlog, 3, (" pMechanismList = 0x%p", pMechanismList));
577
PR_LOG(modlog, 3, (" pulCount = 0x%p", pulCount));
578
nssdbg_start_time(FUNC_C_GETMECHANISMLIST,&start);
579
rv = module_functions->C_GetMechanismList(slotID,
582
nssdbg_finish_time(FUNC_C_GETMECHANISMLIST,start);
583
PR_LOG(modlog, 4, (" *pulCount = 0x%x", *pulCount));
584
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
588
CK_RV NSSDBGC_GetMechanismInfo(
590
CK_MECHANISM_TYPE type,
591
CK_MECHANISM_INFO_PTR pInfo
595
PRIntervalTime start;
596
PR_LOG(modlog, 1, ("C_GetMechanismInfo"));
597
PR_LOG(modlog, 3, (" slotID = 0x%x", slotID));
598
PR_LOG(modlog, 3, (" type = 0x%x", type));
599
PR_LOG(modlog, 3, (" pInfo = 0x%p", pInfo));
600
nssdbg_start_time(FUNC_C_GETMECHANISMINFO,&start);
601
rv = module_functions->C_GetMechanismInfo(slotID,
604
nssdbg_finish_time(FUNC_C_GETMECHANISMINFO,start);
605
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
609
CK_RV NSSDBGC_InitToken(
617
PRIntervalTime start;
618
PR_LOG(modlog, 1, ("C_InitToken"));
619
PR_LOG(modlog, 3, (" slotID = 0x%x", slotID));
620
PR_LOG(modlog, 3, (" pPin = 0x%p", pPin));
621
PR_LOG(modlog, 3, (" ulPinLen = %d", ulPinLen));
622
PR_LOG(modlog, 3, (" pLabel = 0x%p", pLabel));
623
nssdbg_start_time(FUNC_C_INITTOKEN,&start);
624
rv = module_functions->C_InitToken(slotID,
628
nssdbg_finish_time(FUNC_C_INITTOKEN,start);
629
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
633
CK_RV NSSDBGC_InitPIN(
634
CK_SESSION_HANDLE hSession,
640
PRIntervalTime start;
641
PR_LOG(modlog, 1, ("C_InitPIN"));
642
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
643
PR_LOG(modlog, 3, (" pPin = 0x%p", pPin));
644
PR_LOG(modlog, 3, (" ulPinLen = %d", ulPinLen));
645
nssdbg_start_time(FUNC_C_INITPIN,&start);
646
rv = module_functions->C_InitPIN(hSession,
649
nssdbg_finish_time(FUNC_C_INITPIN,start);
650
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
654
CK_RV NSSDBGC_SetPIN(
655
CK_SESSION_HANDLE hSession,
663
PRIntervalTime start;
664
PR_LOG(modlog, 1, ("C_SetPIN"));
665
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
666
PR_LOG(modlog, 3, (" pOldPin = 0x%p", pOldPin));
667
PR_LOG(modlog, 3, (" ulOldLen = %d", ulOldLen));
668
PR_LOG(modlog, 3, (" pNewPin = 0x%p", pNewPin));
669
PR_LOG(modlog, 3, (" ulNewLen = %d", ulNewLen));
670
nssdbg_start_time(FUNC_C_SETPIN,&start);
671
rv = module_functions->C_SetPIN(hSession,
676
nssdbg_finish_time(FUNC_C_SETPIN,start);
677
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
681
static PRUint32 numOpenSessions = 0;
682
static PRUint32 maxOpenSessions = 0;
683
CK_RV NSSDBGC_OpenSession(
686
CK_VOID_PTR pApplication,
688
CK_SESSION_HANDLE_PTR phSession
692
PRIntervalTime start;
693
PR_AtomicIncrement((PRInt32 *)&numOpenSessions);
694
maxOpenSessions = PR_MAX(numOpenSessions, maxOpenSessions);
695
PR_LOG(modlog, 1, ("C_OpenSession"));
696
PR_LOG(modlog, 3, (" slotID = 0x%x", slotID));
697
PR_LOG(modlog, 3, (" flags = 0x%x", flags));
698
PR_LOG(modlog, 3, (" pApplication = 0x%p", pApplication));
699
PR_LOG(modlog, 3, (" Notify = 0x%x", Notify));
700
PR_LOG(modlog, 3, (" phSession = 0x%p", phSession));
701
nssdbg_start_time(FUNC_C_OPENSESSION,&start);
702
rv = module_functions->C_OpenSession(slotID,
707
nssdbg_finish_time(FUNC_C_OPENSESSION,start);
708
PR_LOG(modlog, 4, (" *phSession = 0x%x", *phSession));
709
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
713
CK_RV NSSDBGC_CloseSession(
714
CK_SESSION_HANDLE hSession
718
PRIntervalTime start;
719
PR_AtomicDecrement((PRInt32 *)&numOpenSessions);
720
PR_LOG(modlog, 1, ("C_CloseSession"));
721
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
722
nssdbg_start_time(FUNC_C_CLOSESESSION,&start);
723
rv = module_functions->C_CloseSession(hSession);
724
nssdbg_finish_time(FUNC_C_CLOSESESSION,start);
725
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
729
CK_RV NSSDBGC_CloseAllSessions(
734
PRIntervalTime start;
735
PR_LOG(modlog, 1, ("C_CloseAllSessions"));
736
PR_LOG(modlog, 3, (" slotID = 0x%x", slotID));
737
nssdbg_start_time(FUNC_C_CLOSEALLSESSIONS,&start);
738
rv = module_functions->C_CloseAllSessions(slotID);
739
nssdbg_finish_time(FUNC_C_CLOSEALLSESSIONS,start);
740
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
744
CK_RV NSSDBGC_GetSessionInfo(
745
CK_SESSION_HANDLE hSession,
746
CK_SESSION_INFO_PTR pInfo
750
PRIntervalTime start;
751
PR_LOG(modlog, 1, ("C_GetSessionInfo"));
752
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
753
PR_LOG(modlog, 3, (" pInfo = 0x%p", pInfo));
754
nssdbg_start_time(FUNC_C_GETSESSIONINFO,&start);
755
rv = module_functions->C_GetSessionInfo(hSession,
757
nssdbg_finish_time(FUNC_C_GETSESSIONINFO,start);
758
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
762
CK_RV NSSDBGC_GetOperationState(
763
CK_SESSION_HANDLE hSession,
764
CK_BYTE_PTR pOperationState,
765
CK_ULONG_PTR pulOperationStateLen
769
PRIntervalTime start;
770
PR_LOG(modlog, 1, ("C_GetOperationState"));
771
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
772
PR_LOG(modlog, 3, (" pOperationState = 0x%p", pOperationState));
773
PR_LOG(modlog, 3, (" pulOperationStateLen = 0x%p", pulOperationStateLen));
774
nssdbg_start_time(FUNC_C_GETOPERATIONSTATE,&start);
775
rv = module_functions->C_GetOperationState(hSession,
777
pulOperationStateLen);
778
nssdbg_finish_time(FUNC_C_GETOPERATIONSTATE,start);
779
PR_LOG(modlog, 4, (" *pulOperationStateLen = 0x%x", *pulOperationStateLen));
780
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
784
CK_RV NSSDBGC_SetOperationState(
785
CK_SESSION_HANDLE hSession,
786
CK_BYTE_PTR pOperationState,
787
CK_ULONG ulOperationStateLen,
788
CK_OBJECT_HANDLE hEncryptionKey,
789
CK_OBJECT_HANDLE hAuthenticationKey
793
PRIntervalTime start;
794
PR_LOG(modlog, 1, ("C_SetOperationState"));
795
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
796
PR_LOG(modlog, 3, (" pOperationState = 0x%p", pOperationState));
797
PR_LOG(modlog, 3, (" ulOperationStateLen = %d", ulOperationStateLen));
798
PR_LOG(modlog, 3, (" hEncryptionKey = 0x%x", hEncryptionKey));
799
PR_LOG(modlog, 3, (" hAuthenticationKey = 0x%x", hAuthenticationKey));
800
nssdbg_start_time(FUNC_C_SETOPERATIONSTATE,&start);
801
rv = module_functions->C_SetOperationState(hSession,
806
nssdbg_finish_time(FUNC_C_SETOPERATIONSTATE,start);
807
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
812
CK_SESSION_HANDLE hSession,
813
CK_USER_TYPE userType,
819
PRIntervalTime start;
820
PR_LOG(modlog, 1, ("C_Login"));
821
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
822
PR_LOG(modlog, 3, (" userType = 0x%x", userType));
823
PR_LOG(modlog, 3, (" pPin = 0x%p", pPin));
824
PR_LOG(modlog, 3, (" ulPinLen = %d", ulPinLen));
825
nssdbg_start_time(FUNC_C_LOGIN,&start);
826
rv = module_functions->C_Login(hSession,
830
nssdbg_finish_time(FUNC_C_LOGIN,start);
831
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
835
CK_RV NSSDBGC_Logout(
836
CK_SESSION_HANDLE hSession
840
PRIntervalTime start;
841
PR_LOG(modlog, 1, ("C_Logout"));
842
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
843
nssdbg_start_time(FUNC_C_LOGOUT,&start);
844
rv = module_functions->C_Logout(hSession);
845
nssdbg_finish_time(FUNC_C_LOGOUT,start);
846
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
850
CK_RV NSSDBGC_CreateObject(
851
CK_SESSION_HANDLE hSession,
852
CK_ATTRIBUTE_PTR pTemplate,
854
CK_OBJECT_HANDLE_PTR phObject
858
PRIntervalTime start;
859
PR_LOG(modlog, 1, ("C_CreateObject"));
860
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
861
PR_LOG(modlog, 3, (" pTemplate = 0x%p", pTemplate));
862
PR_LOG(modlog, 3, (" ulCount = %d", ulCount));
863
PR_LOG(modlog, 3, (" phObject = 0x%p", phObject));
864
print_template(pTemplate, ulCount);
865
nssdbg_start_time(FUNC_C_CREATEOBJECT,&start);
866
rv = module_functions->C_CreateObject(hSession,
870
nssdbg_finish_time(FUNC_C_CREATEOBJECT,start);
871
PR_LOG(modlog, 4, (" *phObject = 0x%x", *phObject));
872
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
876
CK_RV NSSDBGC_CopyObject(
877
CK_SESSION_HANDLE hSession,
878
CK_OBJECT_HANDLE hObject,
879
CK_ATTRIBUTE_PTR pTemplate,
881
CK_OBJECT_HANDLE_PTR phNewObject
885
PRIntervalTime start;
886
PR_LOG(modlog, 1, ("C_CopyObject"));
887
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
888
PR_LOG(modlog, 3, (" hObject = 0x%x", hObject));
889
PR_LOG(modlog, 3, (" pTemplate = 0x%p", pTemplate));
890
PR_LOG(modlog, 3, (" ulCount = %d", ulCount));
891
PR_LOG(modlog, 3, (" phNewObject = 0x%p", phNewObject));
892
print_template(pTemplate, ulCount);
893
nssdbg_start_time(FUNC_C_COPYOBJECT,&start);
894
rv = module_functions->C_CopyObject(hSession,
899
nssdbg_finish_time(FUNC_C_COPYOBJECT,start);
900
PR_LOG(modlog, 4, (" *phNewObject = 0x%x", *phNewObject));
901
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
905
CK_RV NSSDBGC_DestroyObject(
906
CK_SESSION_HANDLE hSession,
907
CK_OBJECT_HANDLE hObject
911
PRIntervalTime start;
912
PR_LOG(modlog, 1, ("C_DestroyObject"));
913
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
914
PR_LOG(modlog, 3, (" hObject = 0x%x", hObject));
915
nssdbg_start_time(FUNC_C_DESTROYOBJECT,&start);
916
rv = module_functions->C_DestroyObject(hSession,
918
nssdbg_finish_time(FUNC_C_DESTROYOBJECT,start);
919
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
923
CK_RV NSSDBGC_GetObjectSize(
924
CK_SESSION_HANDLE hSession,
925
CK_OBJECT_HANDLE hObject,
930
PRIntervalTime start;
931
PR_LOG(modlog, 1, ("C_GetObjectSize"));
932
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
933
PR_LOG(modlog, 3, (" hObject = 0x%x", hObject));
934
PR_LOG(modlog, 3, (" pulSize = 0x%p", pulSize));
935
nssdbg_start_time(FUNC_C_GETOBJECTSIZE,&start);
936
rv = module_functions->C_GetObjectSize(hSession,
939
nssdbg_finish_time(FUNC_C_GETOBJECTSIZE,start);
940
PR_LOG(modlog, 4, (" *pulSize = 0x%x", *pulSize));
941
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
945
CK_RV NSSDBGC_GetAttributeValue(
946
CK_SESSION_HANDLE hSession,
947
CK_OBJECT_HANDLE hObject,
948
CK_ATTRIBUTE_PTR pTemplate,
953
PRIntervalTime start;
954
PR_LOG(modlog, 1, ("C_GetAttributeValue"));
955
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
956
PR_LOG(modlog, 3, (" hObject = 0x%x", hObject));
957
PR_LOG(modlog, 3, (" pTemplate = 0x%p", pTemplate));
958
PR_LOG(modlog, 3, (" ulCount = %d", ulCount));
959
nssdbg_start_time(FUNC_C_GETATTRIBUTEVALUE,&start);
960
rv = module_functions->C_GetAttributeValue(hSession,
964
nssdbg_finish_time(FUNC_C_GETATTRIBUTEVALUE,start);
965
print_template(pTemplate, ulCount);
966
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
970
CK_RV NSSDBGC_SetAttributeValue(
971
CK_SESSION_HANDLE hSession,
972
CK_OBJECT_HANDLE hObject,
973
CK_ATTRIBUTE_PTR pTemplate,
978
PRIntervalTime start;
979
PR_LOG(modlog, 1, ("C_SetAttributeValue"));
980
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
981
PR_LOG(modlog, 3, (" hObject = 0x%x", hObject));
982
PR_LOG(modlog, 3, (" pTemplate = 0x%p", pTemplate));
983
PR_LOG(modlog, 3, (" ulCount = %d", ulCount));
984
print_template(pTemplate, ulCount);
985
nssdbg_start_time(FUNC_C_SETATTRIBUTEVALUE,&start);
986
rv = module_functions->C_SetAttributeValue(hSession,
990
nssdbg_finish_time(FUNC_C_SETATTRIBUTEVALUE,start);
991
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
995
CK_RV NSSDBGC_FindObjectsInit(
996
CK_SESSION_HANDLE hSession,
997
CK_ATTRIBUTE_PTR pTemplate,
1002
PRIntervalTime start;
1003
PR_LOG(modlog, 1, ("C_FindObjectsInit"));
1004
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
1005
PR_LOG(modlog, 3, (" pTemplate = 0x%p", pTemplate));
1006
PR_LOG(modlog, 3, (" ulCount = %d", ulCount));
1007
print_template(pTemplate, ulCount);
1008
nssdbg_start_time(FUNC_C_FINDOBJECTSINIT,&start);
1009
rv = module_functions->C_FindObjectsInit(hSession,
1012
nssdbg_finish_time(FUNC_C_FINDOBJECTSINIT,start);
1013
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
1017
CK_RV NSSDBGC_FindObjects(
1018
CK_SESSION_HANDLE hSession,
1019
CK_OBJECT_HANDLE_PTR phObject,
1020
CK_ULONG ulMaxObjectCount,
1021
CK_ULONG_PTR pulObjectCount
1026
PRIntervalTime start;
1027
PR_LOG(modlog, 1, ("C_FindObjects"));
1028
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
1029
PR_LOG(modlog, 3, (" phObject = 0x%p", phObject));
1030
PR_LOG(modlog, 3, (" ulMaxObjectCount = %d", ulMaxObjectCount));
1031
PR_LOG(modlog, 3, (" pulObjectCount = 0x%p", pulObjectCount));
1032
nssdbg_start_time(FUNC_C_FINDOBJECTS,&start);
1033
rv = module_functions->C_FindObjects(hSession,
1037
nssdbg_finish_time(FUNC_C_FINDOBJECTS,start);
1038
PR_LOG(modlog, 4, (" *pulObjectCount = 0x%x", *pulObjectCount));
1039
for (i=0; i<*pulObjectCount; i++) {
1040
PR_LOG(modlog, 4, (" phObject[%d] = 0x%x", i, phObject[i]));
1042
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
1046
CK_RV NSSDBGC_FindObjectsFinal(
1047
CK_SESSION_HANDLE hSession
1051
PRIntervalTime start;
1052
PR_LOG(modlog, 1, ("C_FindObjectsFinal"));
1053
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
1054
nssdbg_start_time(FUNC_C_FINDOBJECTSFINAL,&start);
1055
rv = module_functions->C_FindObjectsFinal(hSession);
1056
nssdbg_finish_time(FUNC_C_FINDOBJECTSFINAL,start);
1057
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
1061
CK_RV NSSDBGC_EncryptInit(
1062
CK_SESSION_HANDLE hSession,
1063
CK_MECHANISM_PTR pMechanism,
1064
CK_OBJECT_HANDLE hKey
1068
PRIntervalTime start;
1069
PR_LOG(modlog, 1, ("C_EncryptInit"));
1070
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
1071
PR_LOG(modlog, 3, (" pMechanism = 0x%p", pMechanism));
1072
PR_LOG(modlog, 3, (" hKey = 0x%x", hKey));
1073
print_mechanism(pMechanism);
1074
nssdbg_start_time(FUNC_C_ENCRYPTINIT,&start);
1075
rv = module_functions->C_EncryptInit(hSession,
1078
nssdbg_finish_time(FUNC_C_ENCRYPTINIT,start);
1079
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
1083
CK_RV NSSDBGC_Encrypt(
1084
CK_SESSION_HANDLE hSession,
1087
CK_BYTE_PTR pEncryptedData,
1088
CK_ULONG_PTR pulEncryptedDataLen
1092
PRIntervalTime start;
1093
PR_LOG(modlog, 1, ("C_Encrypt"));
1094
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
1095
PR_LOG(modlog, 3, (" pData = 0x%p", pData));
1096
PR_LOG(modlog, 3, (" ulDataLen = %d", ulDataLen));
1097
PR_LOG(modlog, 3, (" pEncryptedData = 0x%p", pEncryptedData));
1098
PR_LOG(modlog, 3, (" pulEncryptedDataLen = 0x%p", pulEncryptedDataLen));
1099
nssdbg_start_time(FUNC_C_ENCRYPT,&start);
1100
rv = module_functions->C_Encrypt(hSession,
1104
pulEncryptedDataLen);
1105
nssdbg_finish_time(FUNC_C_ENCRYPT,start);
1106
PR_LOG(modlog, 4, (" *pulEncryptedDataLen = 0x%x", *pulEncryptedDataLen));
1107
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
1111
CK_RV NSSDBGC_EncryptUpdate(
1112
CK_SESSION_HANDLE hSession,
1115
CK_BYTE_PTR pEncryptedPart,
1116
CK_ULONG_PTR pulEncryptedPartLen
1120
PRIntervalTime start;
1121
PR_LOG(modlog, 1, ("C_EncryptUpdate"));
1122
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
1123
PR_LOG(modlog, 3, (" pPart = 0x%p", pPart));
1124
PR_LOG(modlog, 3, (" ulPartLen = %d", ulPartLen));
1125
PR_LOG(modlog, 3, (" pEncryptedPart = 0x%p", pEncryptedPart));
1126
PR_LOG(modlog, 3, (" pulEncryptedPartLen = 0x%p", pulEncryptedPartLen));
1127
nssdbg_start_time(FUNC_C_ENCRYPTUPDATE,&start);
1128
rv = module_functions->C_EncryptUpdate(hSession,
1132
pulEncryptedPartLen);
1133
nssdbg_finish_time(FUNC_C_ENCRYPTUPDATE,start);
1134
PR_LOG(modlog, 4, (" *pulEncryptedPartLen = 0x%x", *pulEncryptedPartLen));
1135
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
1139
CK_RV NSSDBGC_EncryptFinal(
1140
CK_SESSION_HANDLE hSession,
1141
CK_BYTE_PTR pLastEncryptedPart,
1142
CK_ULONG_PTR pulLastEncryptedPartLen
1146
PRIntervalTime start;
1147
PR_LOG(modlog, 1, ("C_EncryptFinal"));
1148
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
1149
PR_LOG(modlog, 3, (" pLastEncryptedPart = 0x%p", pLastEncryptedPart));
1150
PR_LOG(modlog, 3, (" pulLastEncryptedPartLen = 0x%p", pulLastEncryptedPartLen));
1151
nssdbg_start_time(FUNC_C_ENCRYPTFINAL,&start);
1152
rv = module_functions->C_EncryptFinal(hSession,
1154
pulLastEncryptedPartLen);
1155
nssdbg_finish_time(FUNC_C_ENCRYPTFINAL,start);
1156
PR_LOG(modlog, 4, (" *pulLastEncryptedPartLen = 0x%x", *pulLastEncryptedPartLen));
1157
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
1161
CK_RV NSSDBGC_DecryptInit(
1162
CK_SESSION_HANDLE hSession,
1163
CK_MECHANISM_PTR pMechanism,
1164
CK_OBJECT_HANDLE hKey
1168
PRIntervalTime start;
1169
PR_LOG(modlog, 1, ("C_DecryptInit"));
1170
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
1171
PR_LOG(modlog, 3, (" pMechanism = 0x%p", pMechanism));
1172
PR_LOG(modlog, 3, (" hKey = 0x%x", hKey));
1173
print_mechanism(pMechanism);
1174
nssdbg_start_time(FUNC_C_DECRYPTINIT,&start);
1175
rv = module_functions->C_DecryptInit(hSession,
1178
nssdbg_finish_time(FUNC_C_DECRYPTINIT,start);
1179
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
1183
CK_RV NSSDBGC_Decrypt(
1184
CK_SESSION_HANDLE hSession,
1185
CK_BYTE_PTR pEncryptedData,
1186
CK_ULONG ulEncryptedDataLen,
1188
CK_ULONG_PTR pulDataLen
1192
PRIntervalTime start;
1193
PR_LOG(modlog, 1, ("C_Decrypt"));
1194
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
1195
PR_LOG(modlog, 3, (" pEncryptedData = 0x%p", pEncryptedData));
1196
PR_LOG(modlog, 3, (" ulEncryptedDataLen = %d", ulEncryptedDataLen));
1197
PR_LOG(modlog, 3, (" pData = 0x%p", pData));
1198
PR_LOG(modlog, 3, (" pulDataLen = 0x%p", pulDataLen));
1199
nssdbg_start_time(FUNC_C_DECRYPT,&start);
1200
rv = module_functions->C_Decrypt(hSession,
1205
nssdbg_finish_time(FUNC_C_DECRYPT,start);
1206
PR_LOG(modlog, 4, (" *pulDataLen = 0x%x", *pulDataLen));
1207
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
1211
CK_RV NSSDBGC_DecryptUpdate(
1212
CK_SESSION_HANDLE hSession,
1213
CK_BYTE_PTR pEncryptedPart,
1214
CK_ULONG ulEncryptedPartLen,
1216
CK_ULONG_PTR pulPartLen
1220
PRIntervalTime start;
1221
PR_LOG(modlog, 1, ("C_DecryptUpdate"));
1222
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
1223
PR_LOG(modlog, 3, (" pEncryptedPart = 0x%p", pEncryptedPart));
1224
PR_LOG(modlog, 3, (" ulEncryptedPartLen = %d", ulEncryptedPartLen));
1225
PR_LOG(modlog, 3, (" pPart = 0x%p", pPart));
1226
PR_LOG(modlog, 3, (" pulPartLen = 0x%p", pulPartLen));
1227
nssdbg_start_time(FUNC_C_DECRYPTUPDATE,&start);
1228
rv = module_functions->C_DecryptUpdate(hSession,
1233
nssdbg_finish_time(FUNC_C_DECRYPTUPDATE,start);
1234
PR_LOG(modlog, 4, (" *pulPartLen = 0x%x", *pulPartLen));
1235
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
1239
CK_RV NSSDBGC_DecryptFinal(
1240
CK_SESSION_HANDLE hSession,
1241
CK_BYTE_PTR pLastPart,
1242
CK_ULONG_PTR pulLastPartLen
1246
PRIntervalTime start;
1247
PR_LOG(modlog, 1, ("C_DecryptFinal"));
1248
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
1249
PR_LOG(modlog, 3, (" pLastPart = 0x%p", pLastPart));
1250
PR_LOG(modlog, 3, (" pulLastPartLen = 0x%p", pulLastPartLen));
1251
nssdbg_start_time(FUNC_C_DECRYPTFINAL,&start);
1252
rv = module_functions->C_DecryptFinal(hSession,
1255
nssdbg_finish_time(FUNC_C_DECRYPTFINAL,start);
1256
PR_LOG(modlog, 4, (" *pulLastPartLen = 0x%x", *pulLastPartLen));
1257
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
1261
CK_RV NSSDBGC_DigestInit(
1262
CK_SESSION_HANDLE hSession,
1263
CK_MECHANISM_PTR pMechanism
1267
PRIntervalTime start;
1268
PR_LOG(modlog, 1, ("C_DigestInit"));
1269
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
1270
PR_LOG(modlog, 3, (" pMechanism = 0x%p", pMechanism));
1271
print_mechanism(pMechanism);
1272
nssdbg_start_time(FUNC_C_DIGESTINIT,&start);
1273
rv = module_functions->C_DigestInit(hSession,
1275
nssdbg_finish_time(FUNC_C_DIGESTINIT,start);
1276
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
1280
CK_RV NSSDBGC_Digest(
1281
CK_SESSION_HANDLE hSession,
1284
CK_BYTE_PTR pDigest,
1285
CK_ULONG_PTR pulDigestLen
1289
PRIntervalTime start;
1290
PR_LOG(modlog, 1, ("C_Digest"));
1291
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
1292
PR_LOG(modlog, 3, (" pData = 0x%p", pData));
1293
PR_LOG(modlog, 3, (" ulDataLen = %d", ulDataLen));
1294
PR_LOG(modlog, 3, (" pDigest = 0x%p", pDigest));
1295
PR_LOG(modlog, 3, (" pulDigestLen = 0x%p", pulDigestLen));
1296
nssdbg_start_time(FUNC_C_DIGEST,&start);
1297
rv = module_functions->C_Digest(hSession,
1302
nssdbg_finish_time(FUNC_C_DIGEST,start);
1303
PR_LOG(modlog, 4, (" *pulDigestLen = 0x%x", *pulDigestLen));
1304
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
1308
CK_RV NSSDBGC_DigestUpdate(
1309
CK_SESSION_HANDLE hSession,
1315
PRIntervalTime start;
1316
PR_LOG(modlog, 1, ("C_DigestUpdate"));
1317
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
1318
PR_LOG(modlog, 3, (" pPart = 0x%p", pPart));
1319
PR_LOG(modlog, 3, (" ulPartLen = %d", ulPartLen));
1320
nssdbg_start_time(FUNC_C_DIGESTUPDATE,&start);
1321
rv = module_functions->C_DigestUpdate(hSession,
1324
nssdbg_finish_time(FUNC_C_DIGESTUPDATE,start);
1325
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
1329
CK_RV NSSDBGC_DigestKey(
1330
CK_SESSION_HANDLE hSession,
1331
CK_OBJECT_HANDLE hKey
1335
PRIntervalTime start;
1336
PR_LOG(modlog, 1, ("C_DigestKey"));
1337
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
1338
nssdbg_start_time(FUNC_C_DIGESTKEY,&start);
1339
rv = module_functions->C_DigestKey(hSession,
1341
nssdbg_finish_time(FUNC_C_DIGESTKEY,start);
1342
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
1346
CK_RV NSSDBGC_DigestFinal(
1347
CK_SESSION_HANDLE hSession,
1348
CK_BYTE_PTR pDigest,
1349
CK_ULONG_PTR pulDigestLen
1353
PRIntervalTime start;
1354
PR_LOG(modlog, 1, ("C_DigestFinal"));
1355
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
1356
PR_LOG(modlog, 3, (" pDigest = 0x%p", pDigest));
1357
PR_LOG(modlog, 3, (" pulDigestLen = 0x%p", pulDigestLen));
1358
nssdbg_start_time(FUNC_C_DIGESTFINAL,&start);
1359
rv = module_functions->C_DigestFinal(hSession,
1362
nssdbg_finish_time(FUNC_C_DIGESTFINAL,start);
1363
PR_LOG(modlog, 4, (" *pulDigestLen = 0x%x", *pulDigestLen));
1364
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
1368
CK_RV NSSDBGC_SignInit(
1369
CK_SESSION_HANDLE hSession,
1370
CK_MECHANISM_PTR pMechanism,
1371
CK_OBJECT_HANDLE hKey
1375
PRIntervalTime start;
1376
PR_LOG(modlog, 1, ("C_SignInit"));
1377
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
1378
PR_LOG(modlog, 3, (" pMechanism = 0x%p", pMechanism));
1379
PR_LOG(modlog, 3, (" hKey = 0x%x", hKey));
1380
print_mechanism(pMechanism);
1381
nssdbg_start_time(FUNC_C_SIGNINIT,&start);
1382
rv = module_functions->C_SignInit(hSession,
1385
nssdbg_finish_time(FUNC_C_SIGNINIT,start);
1386
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
1391
CK_SESSION_HANDLE hSession,
1394
CK_BYTE_PTR pSignature,
1395
CK_ULONG_PTR pulSignatureLen
1399
PRIntervalTime start;
1400
PR_LOG(modlog, 1, ("C_Sign"));
1401
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
1402
PR_LOG(modlog, 3, (" pData = 0x%p", pData));
1403
PR_LOG(modlog, 3, (" ulDataLen = %d", ulDataLen));
1404
PR_LOG(modlog, 3, (" pSignature = 0x%p", pSignature));
1405
PR_LOG(modlog, 3, (" pulSignatureLen = 0x%p", pulSignatureLen));
1406
nssdbg_start_time(FUNC_C_SIGN,&start);
1407
rv = module_functions->C_Sign(hSession,
1412
nssdbg_finish_time(FUNC_C_SIGN,start);
1413
PR_LOG(modlog, 4, (" *pulSignatureLen = 0x%x", *pulSignatureLen));
1414
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
1418
CK_RV NSSDBGC_SignUpdate(
1419
CK_SESSION_HANDLE hSession,
1425
PRIntervalTime start;
1426
PR_LOG(modlog, 1, ("C_SignUpdate"));
1427
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
1428
PR_LOG(modlog, 3, (" pPart = 0x%p", pPart));
1429
PR_LOG(modlog, 3, (" ulPartLen = %d", ulPartLen));
1430
nssdbg_start_time(FUNC_C_SIGNUPDATE,&start);
1431
rv = module_functions->C_SignUpdate(hSession,
1434
nssdbg_finish_time(FUNC_C_SIGNUPDATE,start);
1435
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
1439
CK_RV NSSDBGC_SignFinal(
1440
CK_SESSION_HANDLE hSession,
1441
CK_BYTE_PTR pSignature,
1442
CK_ULONG_PTR pulSignatureLen
1446
PRIntervalTime start;
1447
PR_LOG(modlog, 1, ("C_SignFinal"));
1448
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
1449
PR_LOG(modlog, 3, (" pSignature = 0x%p", pSignature));
1450
PR_LOG(modlog, 3, (" pulSignatureLen = 0x%p", pulSignatureLen));
1451
nssdbg_start_time(FUNC_C_SIGNFINAL,&start);
1452
rv = module_functions->C_SignFinal(hSession,
1455
nssdbg_finish_time(FUNC_C_SIGNFINAL,start);
1456
PR_LOG(modlog, 4, (" *pulSignatureLen = 0x%x", *pulSignatureLen));
1457
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
1461
CK_RV NSSDBGC_SignRecoverInit(
1462
CK_SESSION_HANDLE hSession,
1463
CK_MECHANISM_PTR pMechanism,
1464
CK_OBJECT_HANDLE hKey
1468
PRIntervalTime start;
1469
PR_LOG(modlog, 1, ("C_SignRecoverInit"));
1470
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
1471
PR_LOG(modlog, 3, (" pMechanism = 0x%p", pMechanism));
1472
PR_LOG(modlog, 3, (" hKey = 0x%x", hKey));
1473
print_mechanism(pMechanism);
1474
nssdbg_start_time(FUNC_C_SIGNRECOVERINIT,&start);
1475
rv = module_functions->C_SignRecoverInit(hSession,
1478
nssdbg_finish_time(FUNC_C_SIGNRECOVERINIT,start);
1479
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
1483
CK_RV NSSDBGC_SignRecover(
1484
CK_SESSION_HANDLE hSession,
1487
CK_BYTE_PTR pSignature,
1488
CK_ULONG_PTR pulSignatureLen
1492
PRIntervalTime start;
1493
PR_LOG(modlog, 1, ("C_SignRecover"));
1494
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
1495
PR_LOG(modlog, 3, (" pData = 0x%p", pData));
1496
PR_LOG(modlog, 3, (" ulDataLen = %d", ulDataLen));
1497
PR_LOG(modlog, 3, (" pSignature = 0x%p", pSignature));
1498
PR_LOG(modlog, 3, (" pulSignatureLen = 0x%p", pulSignatureLen));
1499
nssdbg_start_time(FUNC_C_SIGNRECOVER,&start);
1500
rv = module_functions->C_SignRecover(hSession,
1505
nssdbg_finish_time(FUNC_C_SIGNRECOVER,start);
1506
PR_LOG(modlog, 4, (" *pulSignatureLen = 0x%x", *pulSignatureLen));
1507
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
1511
CK_RV NSSDBGC_VerifyInit(
1512
CK_SESSION_HANDLE hSession,
1513
CK_MECHANISM_PTR pMechanism,
1514
CK_OBJECT_HANDLE hKey
1518
PRIntervalTime start;
1519
PR_LOG(modlog, 1, ("C_VerifyInit"));
1520
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
1521
PR_LOG(modlog, 3, (" pMechanism = 0x%p", pMechanism));
1522
PR_LOG(modlog, 3, (" hKey = 0x%x", hKey));
1523
print_mechanism(pMechanism);
1524
nssdbg_start_time(FUNC_C_VERIFYINIT,&start);
1525
rv = module_functions->C_VerifyInit(hSession,
1528
nssdbg_finish_time(FUNC_C_VERIFYINIT,start);
1529
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
1533
CK_RV NSSDBGC_Verify(
1534
CK_SESSION_HANDLE hSession,
1537
CK_BYTE_PTR pSignature,
1538
CK_ULONG ulSignatureLen
1542
PRIntervalTime start;
1543
PR_LOG(modlog, 1, ("C_Verify"));
1544
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
1545
PR_LOG(modlog, 3, (" pData = 0x%p", pData));
1546
PR_LOG(modlog, 3, (" ulDataLen = %d", ulDataLen));
1547
PR_LOG(modlog, 3, (" pSignature = 0x%p", pSignature));
1548
PR_LOG(modlog, 3, (" ulSignatureLen = %d", ulSignatureLen));
1549
nssdbg_start_time(FUNC_C_VERIFY,&start);
1550
rv = module_functions->C_Verify(hSession,
1555
nssdbg_finish_time(FUNC_C_VERIFY,start);
1556
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
1560
CK_RV NSSDBGC_VerifyUpdate(
1561
CK_SESSION_HANDLE hSession,
1567
PRIntervalTime start;
1568
PR_LOG(modlog, 1, ("C_VerifyUpdate"));
1569
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
1570
PR_LOG(modlog, 3, (" pPart = 0x%p", pPart));
1571
PR_LOG(modlog, 3, (" ulPartLen = %d", ulPartLen));
1572
nssdbg_start_time(FUNC_C_VERIFYUPDATE,&start);
1573
rv = module_functions->C_VerifyUpdate(hSession,
1576
nssdbg_finish_time(FUNC_C_VERIFYUPDATE,start);
1577
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
1581
CK_RV NSSDBGC_VerifyFinal(
1582
CK_SESSION_HANDLE hSession,
1583
CK_BYTE_PTR pSignature,
1584
CK_ULONG ulSignatureLen
1588
PRIntervalTime start;
1589
PR_LOG(modlog, 1, ("C_VerifyFinal"));
1590
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
1591
PR_LOG(modlog, 3, (" pSignature = 0x%p", pSignature));
1592
PR_LOG(modlog, 3, (" ulSignatureLen = %d", ulSignatureLen));
1593
nssdbg_start_time(FUNC_C_VERIFYFINAL,&start);
1594
rv = module_functions->C_VerifyFinal(hSession,
1597
nssdbg_finish_time(FUNC_C_VERIFYFINAL,start);
1598
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
1602
CK_RV NSSDBGC_VerifyRecoverInit(
1603
CK_SESSION_HANDLE hSession,
1604
CK_MECHANISM_PTR pMechanism,
1605
CK_OBJECT_HANDLE hKey
1609
PRIntervalTime start;
1610
PR_LOG(modlog, 1, ("C_VerifyRecoverInit"));
1611
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
1612
PR_LOG(modlog, 3, (" pMechanism = 0x%p", pMechanism));
1613
PR_LOG(modlog, 3, (" hKey = 0x%x", hKey));
1614
print_mechanism(pMechanism);
1615
nssdbg_start_time(FUNC_C_VERIFYRECOVERINIT,&start);
1616
rv = module_functions->C_VerifyRecoverInit(hSession,
1619
nssdbg_finish_time(FUNC_C_VERIFYRECOVERINIT,start);
1620
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
1624
CK_RV NSSDBGC_VerifyRecover(
1625
CK_SESSION_HANDLE hSession,
1626
CK_BYTE_PTR pSignature,
1627
CK_ULONG ulSignatureLen,
1629
CK_ULONG_PTR pulDataLen
1633
PRIntervalTime start;
1634
PR_LOG(modlog, 1, ("C_VerifyRecover"));
1635
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
1636
PR_LOG(modlog, 3, (" pSignature = 0x%p", pSignature));
1637
PR_LOG(modlog, 3, (" ulSignatureLen = %d", ulSignatureLen));
1638
PR_LOG(modlog, 3, (" pData = 0x%p", pData));
1639
PR_LOG(modlog, 3, (" pulDataLen = 0x%p", pulDataLen));
1640
nssdbg_start_time(FUNC_C_VERIFYRECOVER,&start);
1641
rv = module_functions->C_VerifyRecover(hSession,
1646
nssdbg_finish_time(FUNC_C_VERIFYRECOVER,start);
1647
PR_LOG(modlog, 4, (" *pulDataLen = 0x%x", *pulDataLen));
1648
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
1652
CK_RV NSSDBGC_DigestEncryptUpdate(
1653
CK_SESSION_HANDLE hSession,
1656
CK_BYTE_PTR pEncryptedPart,
1657
CK_ULONG_PTR pulEncryptedPartLen
1661
PRIntervalTime start;
1662
PR_LOG(modlog, 1, ("C_DigestEncryptUpdate"));
1663
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
1664
PR_LOG(modlog, 3, (" pPart = 0x%p", pPart));
1665
PR_LOG(modlog, 3, (" ulPartLen = %d", ulPartLen));
1666
PR_LOG(modlog, 3, (" pEncryptedPart = 0x%p", pEncryptedPart));
1667
PR_LOG(modlog, 3, (" pulEncryptedPartLen = 0x%p", pulEncryptedPartLen));
1668
nssdbg_start_time(FUNC_C_DIGESTENCRYPTUPDATE,&start);
1669
rv = module_functions->C_DigestEncryptUpdate(hSession,
1673
pulEncryptedPartLen);
1674
nssdbg_finish_time(FUNC_C_DIGESTENCRYPTUPDATE,start);
1675
PR_LOG(modlog, 4, (" *pulEncryptedPartLen = 0x%x", *pulEncryptedPartLen));
1676
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
1680
CK_RV NSSDBGC_DecryptDigestUpdate(
1681
CK_SESSION_HANDLE hSession,
1682
CK_BYTE_PTR pEncryptedPart,
1683
CK_ULONG ulEncryptedPartLen,
1685
CK_ULONG_PTR pulPartLen
1689
PRIntervalTime start;
1690
PR_LOG(modlog, 1, ("C_DecryptDigestUpdate"));
1691
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
1692
PR_LOG(modlog, 3, (" pEncryptedPart = 0x%p", pEncryptedPart));
1693
PR_LOG(modlog, 3, (" ulEncryptedPartLen = %d", ulEncryptedPartLen));
1694
PR_LOG(modlog, 3, (" pPart = 0x%p", pPart));
1695
PR_LOG(modlog, 3, (" pulPartLen = 0x%p", pulPartLen));
1696
nssdbg_start_time(FUNC_C_DECRYPTDIGESTUPDATE,&start);
1697
rv = module_functions->C_DecryptDigestUpdate(hSession,
1702
nssdbg_finish_time(FUNC_C_DECRYPTDIGESTUPDATE,start);
1703
PR_LOG(modlog, 4, (" *pulPartLen = 0x%x", *pulPartLen));
1704
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
1708
CK_RV NSSDBGC_SignEncryptUpdate(
1709
CK_SESSION_HANDLE hSession,
1712
CK_BYTE_PTR pEncryptedPart,
1713
CK_ULONG_PTR pulEncryptedPartLen
1717
PRIntervalTime start;
1718
PR_LOG(modlog, 1, ("C_SignEncryptUpdate"));
1719
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
1720
PR_LOG(modlog, 3, (" pPart = 0x%p", pPart));
1721
PR_LOG(modlog, 3, (" ulPartLen = %d", ulPartLen));
1722
PR_LOG(modlog, 3, (" pEncryptedPart = 0x%p", pEncryptedPart));
1723
PR_LOG(modlog, 3, (" pulEncryptedPartLen = 0x%p", pulEncryptedPartLen));
1724
nssdbg_start_time(FUNC_C_SIGNENCRYPTUPDATE,&start);
1725
rv = module_functions->C_SignEncryptUpdate(hSession,
1729
pulEncryptedPartLen);
1730
nssdbg_finish_time(FUNC_C_SIGNENCRYPTUPDATE,start);
1731
PR_LOG(modlog, 4, (" *pulEncryptedPartLen = 0x%x", *pulEncryptedPartLen));
1732
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
1736
CK_RV NSSDBGC_DecryptVerifyUpdate(
1737
CK_SESSION_HANDLE hSession,
1738
CK_BYTE_PTR pEncryptedPart,
1739
CK_ULONG ulEncryptedPartLen,
1741
CK_ULONG_PTR pulPartLen
1745
PRIntervalTime start;
1746
PR_LOG(modlog, 1, ("C_DecryptVerifyUpdate"));
1747
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
1748
PR_LOG(modlog, 3, (" pEncryptedPart = 0x%p", pEncryptedPart));
1749
PR_LOG(modlog, 3, (" ulEncryptedPartLen = %d", ulEncryptedPartLen));
1750
PR_LOG(modlog, 3, (" pPart = 0x%p", pPart));
1751
PR_LOG(modlog, 3, (" pulPartLen = 0x%p", pulPartLen));
1752
nssdbg_start_time(FUNC_C_DECRYPTVERIFYUPDATE,&start);
1753
rv = module_functions->C_DecryptVerifyUpdate(hSession,
1758
nssdbg_finish_time(FUNC_C_DECRYPTVERIFYUPDATE,start);
1759
PR_LOG(modlog, 4, (" *pulPartLen = 0x%x", *pulPartLen));
1760
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
1764
CK_RV NSSDBGC_GenerateKey(
1765
CK_SESSION_HANDLE hSession,
1766
CK_MECHANISM_PTR pMechanism,
1767
CK_ATTRIBUTE_PTR pTemplate,
1769
CK_OBJECT_HANDLE_PTR phKey
1773
PRIntervalTime start;
1774
PR_LOG(modlog, 1, ("C_GenerateKey"));
1775
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
1776
PR_LOG(modlog, 3, (" pMechanism = 0x%p", pMechanism));
1777
PR_LOG(modlog, 3, (" pTemplate = 0x%p", pTemplate));
1778
PR_LOG(modlog, 3, (" ulCount = %d", ulCount));
1779
PR_LOG(modlog, 3, (" phKey = 0x%p", phKey));
1780
print_template(pTemplate, ulCount);
1781
print_mechanism(pMechanism);
1782
nssdbg_start_time(FUNC_C_GENERATEKEY,&start);
1783
rv = module_functions->C_GenerateKey(hSession,
1788
nssdbg_finish_time(FUNC_C_GENERATEKEY,start);
1789
PR_LOG(modlog, 4, (" *phKey = 0x%x", *phKey));
1790
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
1794
CK_RV NSSDBGC_GenerateKeyPair(
1795
CK_SESSION_HANDLE hSession,
1796
CK_MECHANISM_PTR pMechanism,
1797
CK_ATTRIBUTE_PTR pPublicKeyTemplate,
1798
CK_ULONG ulPublicKeyAttributeCount,
1799
CK_ATTRIBUTE_PTR pPrivateKeyTemplate,
1800
CK_ULONG ulPrivateKeyAttributeCount,
1801
CK_OBJECT_HANDLE_PTR phPublicKey,
1802
CK_OBJECT_HANDLE_PTR phPrivateKey
1806
PRIntervalTime start;
1807
PR_LOG(modlog, 1, ("C_GenerateKeyPair"));
1808
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
1809
PR_LOG(modlog, 3, (" pMechanism = 0x%p", pMechanism));
1810
PR_LOG(modlog, 3, (" pPublicKeyTemplate = 0x%p", pPublicKeyTemplate));
1811
PR_LOG(modlog, 3, (" ulPublicKeyAttributeCount = %d", ulPublicKeyAttributeCount));
1812
PR_LOG(modlog, 3, (" pPrivateKeyTemplate = 0x%p", pPrivateKeyTemplate));
1813
PR_LOG(modlog, 3, (" ulPrivateKeyAttributeCount = %d", ulPrivateKeyAttributeCount));
1814
PR_LOG(modlog, 3, (" phPublicKey = 0x%p", phPublicKey));
1815
PR_LOG(modlog, 3, (" phPrivateKey = 0x%p", phPrivateKey));
1816
print_template(pPublicKeyTemplate, ulPublicKeyAttributeCount);
1817
print_template(pPrivateKeyTemplate, ulPrivateKeyAttributeCount);
1818
print_mechanism(pMechanism);
1819
nssdbg_start_time(FUNC_C_GENERATEKEYPAIR,&start);
1820
rv = module_functions->C_GenerateKeyPair(hSession,
1823
ulPublicKeyAttributeCount,
1824
pPrivateKeyTemplate,
1825
ulPrivateKeyAttributeCount,
1828
nssdbg_finish_time(FUNC_C_GENERATEKEYPAIR,start);
1829
PR_LOG(modlog, 4, (" *phPublicKey = 0x%x", *phPublicKey));
1830
PR_LOG(modlog, 4, (" *phPrivateKey = 0x%x", *phPrivateKey));
1831
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
1835
CK_RV NSSDBGC_WrapKey(
1836
CK_SESSION_HANDLE hSession,
1837
CK_MECHANISM_PTR pMechanism,
1838
CK_OBJECT_HANDLE hWrappingKey,
1839
CK_OBJECT_HANDLE hKey,
1840
CK_BYTE_PTR pWrappedKey,
1841
CK_ULONG_PTR pulWrappedKeyLen
1845
PRIntervalTime start;
1846
PR_LOG(modlog, 1, ("C_WrapKey"));
1847
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
1848
PR_LOG(modlog, 3, (" pMechanism = 0x%p", pMechanism));
1849
PR_LOG(modlog, 3, (" hWrappingKey = 0x%x", hWrappingKey));
1850
PR_LOG(modlog, 3, (" hKey = 0x%x", hKey));
1851
PR_LOG(modlog, 3, (" pWrappedKey = 0x%p", pWrappedKey));
1852
PR_LOG(modlog, 3, (" pulWrappedKeyLen = 0x%p", pulWrappedKeyLen));
1853
print_mechanism(pMechanism);
1854
nssdbg_start_time(FUNC_C_WRAPKEY,&start);
1855
rv = module_functions->C_WrapKey(hSession,
1861
nssdbg_finish_time(FUNC_C_WRAPKEY,start);
1862
PR_LOG(modlog, 4, (" *pulWrappedKeyLen = 0x%x", *pulWrappedKeyLen));
1863
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
1867
CK_RV NSSDBGC_UnwrapKey(
1868
CK_SESSION_HANDLE hSession,
1869
CK_MECHANISM_PTR pMechanism,
1870
CK_OBJECT_HANDLE hUnwrappingKey,
1871
CK_BYTE_PTR pWrappedKey,
1872
CK_ULONG ulWrappedKeyLen,
1873
CK_ATTRIBUTE_PTR pTemplate,
1874
CK_ULONG ulAttributeCount,
1875
CK_OBJECT_HANDLE_PTR phKey
1879
PRIntervalTime start;
1880
PR_LOG(modlog, 1, ("C_UnwrapKey"));
1881
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
1882
PR_LOG(modlog, 3, (" pMechanism = 0x%p", pMechanism));
1883
PR_LOG(modlog, 3, (" hUnwrappingKey = 0x%x", hUnwrappingKey));
1884
PR_LOG(modlog, 3, (" pWrappedKey = 0x%p", pWrappedKey));
1885
PR_LOG(modlog, 3, (" ulWrappedKeyLen = %d", ulWrappedKeyLen));
1886
PR_LOG(modlog, 3, (" pTemplate = 0x%p", pTemplate));
1887
PR_LOG(modlog, 3, (" ulAttributeCount = %d", ulAttributeCount));
1888
PR_LOG(modlog, 3, (" phKey = 0x%p", phKey));
1889
print_template(pTemplate, ulAttributeCount);
1890
print_mechanism(pMechanism);
1891
nssdbg_start_time(FUNC_C_UNWRAPKEY,&start);
1892
rv = module_functions->C_UnwrapKey(hSession,
1900
nssdbg_finish_time(FUNC_C_UNWRAPKEY,start);
1901
PR_LOG(modlog, 4, (" *phKey = 0x%x", *phKey));
1902
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
1906
CK_RV NSSDBGC_DeriveKey(
1907
CK_SESSION_HANDLE hSession,
1908
CK_MECHANISM_PTR pMechanism,
1909
CK_OBJECT_HANDLE hBaseKey,
1910
CK_ATTRIBUTE_PTR pTemplate,
1911
CK_ULONG ulAttributeCount,
1912
CK_OBJECT_HANDLE_PTR phKey
1916
PRIntervalTime start;
1917
PR_LOG(modlog, 1, ("C_DeriveKey"));
1918
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
1919
PR_LOG(modlog, 3, (" pMechanism = 0x%p", pMechanism));
1920
PR_LOG(modlog, 3, (" hBaseKey = 0x%x", hBaseKey));
1921
PR_LOG(modlog, 3, (" pTemplate = 0x%p", pTemplate));
1922
PR_LOG(modlog, 3, (" ulAttributeCount = %d", ulAttributeCount));
1923
PR_LOG(modlog, 3, (" phKey = 0x%p", phKey));
1924
print_template(pTemplate, ulAttributeCount);
1925
print_mechanism(pMechanism);
1926
nssdbg_start_time(FUNC_C_DERIVEKEY,&start);
1927
rv = module_functions->C_DeriveKey(hSession,
1933
nssdbg_finish_time(FUNC_C_DERIVEKEY,start);
1934
PR_LOG(modlog, 4, (" *phKey = 0x%x", *phKey));
1935
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
1939
CK_RV NSSDBGC_SeedRandom(
1940
CK_SESSION_HANDLE hSession,
1946
PRIntervalTime start;
1947
PR_LOG(modlog, 1, ("C_SeedRandom"));
1948
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
1949
PR_LOG(modlog, 3, (" pSeed = 0x%p", pSeed));
1950
PR_LOG(modlog, 3, (" ulSeedLen = %d", ulSeedLen));
1951
nssdbg_start_time(FUNC_C_SEEDRANDOM,&start);
1952
rv = module_functions->C_SeedRandom(hSession,
1955
nssdbg_finish_time(FUNC_C_SEEDRANDOM,start);
1956
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
1960
CK_RV NSSDBGC_GenerateRandom(
1961
CK_SESSION_HANDLE hSession,
1962
CK_BYTE_PTR RandomData,
1963
CK_ULONG ulRandomLen
1967
PRIntervalTime start;
1968
PR_LOG(modlog, 1, ("C_GenerateRandom"));
1969
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
1970
PR_LOG(modlog, 3, (" RandomData = 0x%p", RandomData));
1971
PR_LOG(modlog, 3, (" ulRandomLen = %d", ulRandomLen));
1972
nssdbg_start_time(FUNC_C_GENERATERANDOM,&start);
1973
rv = module_functions->C_GenerateRandom(hSession,
1976
nssdbg_finish_time(FUNC_C_GENERATERANDOM,start);
1977
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
1981
CK_RV NSSDBGC_GetFunctionStatus(
1982
CK_SESSION_HANDLE hSession
1986
PRIntervalTime start;
1987
PR_LOG(modlog, 1, ("C_GetFunctionStatus"));
1988
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
1989
nssdbg_start_time(FUNC_C_GETFUNCTIONSTATUS,&start);
1990
rv = module_functions->C_GetFunctionStatus(hSession);
1991
nssdbg_finish_time(FUNC_C_GETFUNCTIONSTATUS,start);
1992
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
1996
CK_RV NSSDBGC_CancelFunction(
1997
CK_SESSION_HANDLE hSession
2001
PRIntervalTime start;
2002
PR_LOG(modlog, 1, ("C_CancelFunction"));
2003
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
2004
nssdbg_start_time(FUNC_C_CANCELFUNCTION,&start);
2005
rv = module_functions->C_CancelFunction(hSession);
2006
nssdbg_finish_time(FUNC_C_CANCELFUNCTION,start);
2007
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
2011
CK_RV NSSDBGC_WaitForSlotEvent(
2013
CK_SLOT_ID_PTR pSlot,
2014
CK_VOID_PTR pRserved
2018
PRIntervalTime start;
2019
PR_LOG(modlog, 1, ("C_WaitForSlotEvent"));
2020
PR_LOG(modlog, 3, (" flags = 0x%x", flags));
2021
PR_LOG(modlog, 3, (" pSlot = 0x%p", pSlot));
2022
PR_LOG(modlog, 3, (" pRserved = 0x%p", pRserved));
2023
nssdbg_start_time(FUNC_C_WAITFORSLOTEVENT,&start);
2024
rv = module_functions->C_WaitForSlotEvent(flags,
2027
nssdbg_finish_time(FUNC_C_WAITFORSLOTEVENT,start);
2028
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
2032
CK_FUNCTION_LIST_PTR nss_InsertDeviceLog(
2033
CK_FUNCTION_LIST_PTR devEPV
2036
module_functions = devEPV;
2037
modlog = PR_NewLogModule("nss_mod_log");
2038
debug_functions.C_Initialize = NSSDBGC_Initialize;
2039
debug_functions.C_Finalize = NSSDBGC_Finalize;
2040
debug_functions.C_GetInfo = NSSDBGC_GetInfo;
2041
debug_functions.C_GetFunctionList = NSSDBGC_GetFunctionList;
2042
debug_functions.C_GetSlotList = NSSDBGC_GetSlotList;
2043
debug_functions.C_GetSlotInfo = NSSDBGC_GetSlotInfo;
2044
debug_functions.C_GetTokenInfo = NSSDBGC_GetTokenInfo;
2045
debug_functions.C_GetMechanismList = NSSDBGC_GetMechanismList;
2046
debug_functions.C_GetMechanismInfo = NSSDBGC_GetMechanismInfo;
2047
debug_functions.C_InitToken = NSSDBGC_InitToken;
2048
debug_functions.C_InitPIN = NSSDBGC_InitPIN;
2049
debug_functions.C_SetPIN = NSSDBGC_SetPIN;
2050
debug_functions.C_OpenSession = NSSDBGC_OpenSession;
2051
debug_functions.C_CloseSession = NSSDBGC_CloseSession;
2052
debug_functions.C_CloseAllSessions = NSSDBGC_CloseAllSessions;
2053
debug_functions.C_GetSessionInfo = NSSDBGC_GetSessionInfo;
2054
debug_functions.C_GetOperationState = NSSDBGC_GetOperationState;
2055
debug_functions.C_SetOperationState = NSSDBGC_SetOperationState;
2056
debug_functions.C_Login = NSSDBGC_Login;
2057
debug_functions.C_Logout = NSSDBGC_Logout;
2058
debug_functions.C_CreateObject = NSSDBGC_CreateObject;
2059
debug_functions.C_CopyObject = NSSDBGC_CopyObject;
2060
debug_functions.C_DestroyObject = NSSDBGC_DestroyObject;
2061
debug_functions.C_GetObjectSize = NSSDBGC_GetObjectSize;
2062
debug_functions.C_GetAttributeValue = NSSDBGC_GetAttributeValue;
2063
debug_functions.C_SetAttributeValue = NSSDBGC_SetAttributeValue;
2064
debug_functions.C_FindObjectsInit = NSSDBGC_FindObjectsInit;
2065
debug_functions.C_FindObjects = NSSDBGC_FindObjects;
2066
debug_functions.C_FindObjectsFinal = NSSDBGC_FindObjectsFinal;
2067
debug_functions.C_EncryptInit = NSSDBGC_EncryptInit;
2068
debug_functions.C_Encrypt = NSSDBGC_Encrypt;
2069
debug_functions.C_EncryptUpdate = NSSDBGC_EncryptUpdate;
2070
debug_functions.C_EncryptFinal = NSSDBGC_EncryptFinal;
2071
debug_functions.C_DecryptInit = NSSDBGC_DecryptInit;
2072
debug_functions.C_Decrypt = NSSDBGC_Decrypt;
2073
debug_functions.C_DecryptUpdate = NSSDBGC_DecryptUpdate;
2074
debug_functions.C_DecryptFinal = NSSDBGC_DecryptFinal;
2075
debug_functions.C_DigestInit = NSSDBGC_DigestInit;
2076
debug_functions.C_Digest = NSSDBGC_Digest;
2077
debug_functions.C_DigestUpdate = NSSDBGC_DigestUpdate;
2078
debug_functions.C_DigestKey = NSSDBGC_DigestKey;
2079
debug_functions.C_DigestFinal = NSSDBGC_DigestFinal;
2080
debug_functions.C_SignInit = NSSDBGC_SignInit;
2081
debug_functions.C_Sign = NSSDBGC_Sign;
2082
debug_functions.C_SignUpdate = NSSDBGC_SignUpdate;
2083
debug_functions.C_SignFinal = NSSDBGC_SignFinal;
2084
debug_functions.C_SignRecoverInit = NSSDBGC_SignRecoverInit;
2085
debug_functions.C_SignRecover = NSSDBGC_SignRecover;
2086
debug_functions.C_VerifyInit = NSSDBGC_VerifyInit;
2087
debug_functions.C_Verify = NSSDBGC_Verify;
2088
debug_functions.C_VerifyUpdate = NSSDBGC_VerifyUpdate;
2089
debug_functions.C_VerifyFinal = NSSDBGC_VerifyFinal;
2090
debug_functions.C_VerifyRecoverInit = NSSDBGC_VerifyRecoverInit;
2091
debug_functions.C_VerifyRecover = NSSDBGC_VerifyRecover;
2092
debug_functions.C_DigestEncryptUpdate = NSSDBGC_DigestEncryptUpdate;
2093
debug_functions.C_DecryptDigestUpdate = NSSDBGC_DecryptDigestUpdate;
2094
debug_functions.C_SignEncryptUpdate = NSSDBGC_SignEncryptUpdate;
2095
debug_functions.C_DecryptVerifyUpdate = NSSDBGC_DecryptVerifyUpdate;
2096
debug_functions.C_GenerateKey = NSSDBGC_GenerateKey;
2097
debug_functions.C_GenerateKeyPair = NSSDBGC_GenerateKeyPair;
2098
debug_functions.C_WrapKey = NSSDBGC_WrapKey;
2099
debug_functions.C_UnwrapKey = NSSDBGC_UnwrapKey;
2100
debug_functions.C_DeriveKey = NSSDBGC_DeriveKey;
2101
debug_functions.C_SeedRandom = NSSDBGC_SeedRandom;
2102
debug_functions.C_GenerateRandom = NSSDBGC_GenerateRandom;
2103
debug_functions.C_GetFunctionStatus = NSSDBGC_GetFunctionStatus;
2104
debug_functions.C_CancelFunction = NSSDBGC_CancelFunction;
2105
debug_functions.C_WaitForSlotEvent = NSSDBGC_WaitForSlotEvent;
2106
return &debug_functions;
2110
* scale the time factor up accordingly.
2111
* This routine tries to keep at least 2 significant figures on output.
2112
* If the time is 0, then indicate that with a 'z' for units.
2113
* If the time is greater than 10 minutes, output the time in minutes.
2114
* If the time is less than 10 minutes but greater than 10 seconds output
2115
* the time in second.
2116
* If the time is less than 10 seconds but greater than 10 milliseconds
2117
* output * the time in millisecond.
2118
* If the time is less than 10 milliseconds but greater than 0 ticks output
2119
* the time in microsecond.
2122
static PRUint32 getPrintTime(PRIntervalTime time ,char **type)
2126
/* detect a programming error by outputting 'bu' to the output stream
2127
* rather than crashing */
2134
prTime = PR_IntervalToSeconds(time);
2136
if (prTime >= 600) {
2144
prTime = PR_IntervalToMilliseconds(time);
2150
return PR_IntervalToMicroseconds(time);
2153
static void print_final_statistics(void)
2155
int total_calls = 0;
2156
PRIntervalTime total_time = 0;
2157
PRUint32 pr_total_time;
2160
FILE *outfile = NULL;
2163
fname = PR_GetEnv("NSS_OUTPUT_FILE");
2165
/* need to add an optional process id to the filename */
2166
outfile = fopen(fname,"w+");
2173
fprintf(outfile,"%-25s %10s %12s %12s %10s\n", "Function", "# Calls",
2174
"Time", "Avg.", "% Time");
2175
fprintf(outfile,"\n");
2176
for (i=0; i < nssdbg_prof_size; i++) {
2177
total_calls += nssdbg_prof_data[i].calls;
2178
total_time += nssdbg_prof_data[i].time;
2180
for (i=0; i < nssdbg_prof_size; i++) {
2181
PRIntervalTime time = nssdbg_prof_data[i].time;
2182
PRUint32 usTime = PR_IntervalToMicroseconds(time);
2183
PRUint32 prTime = 0;
2184
PRUint32 calls = nssdbg_prof_data[i].calls;
2185
/* don't print out functions that weren't even called */
2190
prTime = getPrintTime(time,&type);
2192
fprintf(outfile,"%-25s %10d %10d%2s ", nssdbg_prof_data[i].function,
2193
calls, prTime, type);
2194
/* for now always output the average in microseconds */
2195
fprintf(outfile,"%10.2f%2s", (float)usTime / (float)calls, "us" );
2196
fprintf(outfile,"%10.2f%%", ((float)time / (float)total_time) * 100);
2197
fprintf(outfile,"\n");
2199
fprintf(outfile,"\n");
2201
pr_total_time = getPrintTime(total_time,&type);
2203
fprintf(outfile,"%25s %10d %10d%2s\n", "Totals", total_calls,
2204
pr_total_time, type);
2205
fprintf(outfile,"\n\nMaximum number of concurrent open sessions: %d\n\n",
2208
if (outfile != stdout) {