OLD | NEW |
1 /* This Source Code Form is subject to the terms of the Mozilla Public | 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 | 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/. */ | 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
4 /* | 4 /* |
5 * This file implements PKCS 11 on top of our existing security modules | 5 * This file implements PKCS 11 on top of our existing security modules |
6 * | 6 * |
7 * For more information about PKCS 11 See PKCS 11 Token Inteface Standard. | 7 * For more information about PKCS 11 See PKCS 11 Token Inteface Standard. |
8 * This implementation has two slots: | 8 * This implementation has two slots: |
9 * slot 1 is our generic crypto support. It does not require login | 9 * slot 1 is our generic crypto support. It does not require login |
10 * (unless you've enabled FIPS). It supports Public Key ops, and all they | 10 * (unless you've enabled FIPS). It supports Public Key ops, and all they |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "prprf.h" | 26 #include "prprf.h" |
27 | 27 |
28 #include <ctype.h> | 28 #include <ctype.h> |
29 | 29 |
30 #ifdef XP_UNIX | 30 #ifdef XP_UNIX |
31 #define NSS_AUDIT_WITH_SYSLOG 1 | 31 #define NSS_AUDIT_WITH_SYSLOG 1 |
32 #include <syslog.h> | 32 #include <syslog.h> |
33 #include <unistd.h> | 33 #include <unistd.h> |
34 #endif | 34 #endif |
35 | 35 |
36 #ifdef SOLARIS | |
37 #include <bsm/libbsm.h> | |
38 #define AUE_FIPS_AUDIT 34444 | |
39 #endif | |
40 | |
41 #ifdef LINUX | 36 #ifdef LINUX |
42 #include <pthread.h> | 37 #include <pthread.h> |
43 #include <dlfcn.h> | 38 #include <dlfcn.h> |
44 #define LIBAUDIT_NAME "libaudit.so.0" | 39 #define LIBAUDIT_NAME "libaudit.so.0" |
45 #ifndef AUDIT_CRYPTO_TEST_USER | 40 #ifndef AUDIT_CRYPTO_TEST_USER |
46 #define AUDIT_CRYPTO_TEST_USER 2400 /* Crypto test results */ | 41 #define AUDIT_CRYPTO_TEST_USER 2400 /* Crypto test results */ |
47 #define AUDIT_CRYPTO_PARAM_CHANGE_USER 2401 /* Crypto attribute change */ | 42 #define AUDIT_CRYPTO_PARAM_CHANGE_USER 2401 /* Crypto attribute change */ |
48 #define AUDIT_CRYPTO_LOGIN 2402 /* Logged in as crypto officer */ | 43 #define AUDIT_CRYPTO_LOGIN 2402 /* Logged in as crypto officer */ |
49 #define AUDIT_CRYPTO_LOGOUT 2403 /* Logged out from crypto */ | 44 #define AUDIT_CRYPTO_LOGOUT 2403 /* Logged out from crypto */ |
50 #define AUDIT_CRYPTO_KEY_USER 2404 /* Create,delete,negotiate */ | 45 #define AUDIT_CRYPTO_KEY_USER 2404 /* Create,delete,negotiate */ |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 if (audit_log_user_message_func) { | 395 if (audit_log_user_message_func) { |
401 audit_log_user_message_func(audit_fd, linuxAuditType, message, | 396 audit_log_user_message_func(audit_fd, linuxAuditType, message, |
402 NULL, NULL, NULL, result); | 397 NULL, NULL, NULL, result); |
403 } else { | 398 } else { |
404 audit_send_user_message_func(audit_fd, linuxAuditType, message); | 399 audit_send_user_message_func(audit_fd, linuxAuditType, message); |
405 } | 400 } |
406 audit_close_func(audit_fd); | 401 audit_close_func(audit_fd); |
407 PR_smprintf_free(message); | 402 PR_smprintf_free(message); |
408 } | 403 } |
409 #endif /* LINUX */ | 404 #endif /* LINUX */ |
410 #ifdef SOLARIS | |
411 { | |
412 int rd; | |
413 char *message = PR_smprintf("NSS " SOFTOKEN_LIB_NAME ": %s", msg); | |
414 | |
415 if (!message) { | |
416 return; | |
417 } | |
418 | |
419 /* open the record descriptor */ | |
420 if ((rd = au_open()) == -1) { | |
421 PR_smprintf_free(message); | |
422 return; | |
423 } | |
424 | |
425 /* write the audit tokens to the audit record */ | |
426 if (au_write(rd, au_to_text(message))) { | |
427 (void)au_close(rd, AU_TO_NO_WRITE, AUE_FIPS_AUDIT); | |
428 PR_smprintf_free(message); | |
429 return; | |
430 } | |
431 | |
432 /* close the record and send it to the audit trail */ | |
433 (void)au_close(rd, AU_TO_WRITE, AUE_FIPS_AUDIT); | |
434 | |
435 PR_smprintf_free(message); | |
436 } | |
437 #endif /* SOLARIS */ | |
438 #else | 405 #else |
439 /* do nothing */ | 406 /* do nothing */ |
440 #endif | 407 #endif |
441 } | 408 } |
442 | 409 |
443 | 410 |
444 /********************************************************************** | 411 /********************************************************************** |
445 * | 412 * |
446 * Start of PKCS 11 functions | 413 * Start of PKCS 11 functions |
447 * | 414 * |
(...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1566 } | 1533 } |
1567 | 1534 |
1568 | 1535 |
1569 CK_RV FC_WaitForSlotEvent(CK_FLAGS flags, CK_SLOT_ID_PTR pSlot, | 1536 CK_RV FC_WaitForSlotEvent(CK_FLAGS flags, CK_SLOT_ID_PTR pSlot, |
1570 CK_VOID_PTR pReserved) | 1537 CK_VOID_PTR pReserved) |
1571 { | 1538 { |
1572 CHECK_FORK(); | 1539 CHECK_FORK(); |
1573 | 1540 |
1574 return NSC_WaitForSlotEvent(flags, pSlot, pReserved); | 1541 return NSC_WaitForSlotEvent(flags, pSlot, pReserved); |
1575 } | 1542 } |
OLD | NEW |