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 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 } | 713 } |
714 return rv; | 714 return rv; |
715 } | 715 } |
716 | 716 |
717 | 717 |
718 /* FC_CreateObject creates a new object. */ | 718 /* FC_CreateObject creates a new object. */ |
719 CK_RV FC_CreateObject(CK_SESSION_HANDLE hSession, | 719 CK_RV FC_CreateObject(CK_SESSION_HANDLE hSession, |
720 CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount, | 720 CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount, |
721 CK_OBJECT_HANDLE_PTR phObject) { | 721 CK_OBJECT_HANDLE_PTR phObject) { |
722 CK_OBJECT_CLASS * classptr; | 722 CK_OBJECT_CLASS * classptr; |
| 723 CK_RV rv = CKR_OK; |
723 | 724 |
724 SFTK_FIPSCHECK(); | |
725 CHECK_FORK(); | 725 CHECK_FORK(); |
726 | 726 |
727 classptr = (CK_OBJECT_CLASS *)fc_getAttribute(pTemplate,ulCount,CKA_CLASS); | 727 classptr = (CK_OBJECT_CLASS *)fc_getAttribute(pTemplate,ulCount,CKA_CLASS); |
728 if (classptr == NULL) return CKR_TEMPLATE_INCOMPLETE; | 728 if (classptr == NULL) return CKR_TEMPLATE_INCOMPLETE; |
729 | 729 |
| 730 if (*classptr == CKO_NETSCAPE_NEWSLOT || *classptr == CKO_NETSCAPE_DELSLOT)
{ |
| 731 if (sftk_fatalError) |
| 732 return CKR_DEVICE_ERROR; |
| 733 } else { |
| 734 rv = sftk_fipsCheck(); |
| 735 if (rv != CKR_OK) |
| 736 return rv; |
| 737 } |
| 738 |
730 /* FIPS can't create keys from raw key material */ | 739 /* FIPS can't create keys from raw key material */ |
731 if (SFTK_IS_NONPUBLIC_KEY_OBJECT(*classptr)) { | 740 if (SFTK_IS_NONPUBLIC_KEY_OBJECT(*classptr)) { |
732 rv = CKR_ATTRIBUTE_VALUE_INVALID; | 741 rv = CKR_ATTRIBUTE_VALUE_INVALID; |
733 } else { | 742 } else { |
734 rv = NSC_CreateObject(hSession,pTemplate,ulCount,phObject); | 743 rv = NSC_CreateObject(hSession,pTemplate,ulCount,phObject); |
735 } | 744 } |
736 if (sftk_audit_enabled && SFTK_IS_KEY_OBJECT(*classptr)) { | 745 if (sftk_audit_enabled && SFTK_IS_KEY_OBJECT(*classptr)) { |
737 sftk_AuditCreateObject(hSession,pTemplate,ulCount,phObject,rv); | 746 sftk_AuditCreateObject(hSession,pTemplate,ulCount,phObject,rv); |
738 } | 747 } |
739 return rv; | 748 return rv; |
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1533 } | 1542 } |
1534 | 1543 |
1535 | 1544 |
1536 CK_RV FC_WaitForSlotEvent(CK_FLAGS flags, CK_SLOT_ID_PTR pSlot, | 1545 CK_RV FC_WaitForSlotEvent(CK_FLAGS flags, CK_SLOT_ID_PTR pSlot, |
1537 CK_VOID_PTR pReserved) | 1546 CK_VOID_PTR pReserved) |
1538 { | 1547 { |
1539 CHECK_FORK(); | 1548 CHECK_FORK(); |
1540 | 1549 |
1541 return NSC_WaitForSlotEvent(flags, pSlot, pReserved); | 1550 return NSC_WaitForSlotEvent(flags, pSlot, pReserved); |
1542 } | 1551 } |
OLD | NEW |