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 * It supports Public Key ops, and all they bulk ciphers and hashes. | 10 * It supports Public Key ops, and all they bulk ciphers and hashes. |
(...skipping 4013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4024 key_gen_type = nsc_jpake; | 4024 key_gen_type = nsc_jpake; |
4025 key_type = CKK_NSS_JPAKE_ROUND1; | 4025 key_type = CKK_NSS_JPAKE_ROUND1; |
4026 objclass = CKO_PRIVATE_KEY; | 4026 objclass = CKO_PRIVATE_KEY; |
4027 if (pMechanism->pParameter == NULL || | 4027 if (pMechanism->pParameter == NULL || |
4028 pMechanism->ulParameterLen != sizeof(CK_NSS_JPAKERound1Params)) { | 4028 pMechanism->ulParameterLen != sizeof(CK_NSS_JPAKERound1Params)) { |
4029 crv = CKR_MECHANISM_PARAM_INVALID; | 4029 crv = CKR_MECHANISM_PARAM_INVALID; |
4030 break; | 4030 break; |
4031 } | 4031 } |
4032 if (sftk_isTrue(key, CKA_TOKEN)) { | 4032 if (sftk_isTrue(key, CKA_TOKEN)) { |
4033 crv = CKR_TEMPLATE_INCONSISTENT; | 4033 crv = CKR_TEMPLATE_INCONSISTENT; |
| 4034 break; |
4034 } | 4035 } |
4035 crv = CKR_OK; | 4036 crv = CKR_OK; |
4036 break; | 4037 break; |
4037 default: | 4038 default: |
4038 crv = CKR_MECHANISM_INVALID; | 4039 crv = CKR_MECHANISM_INVALID; |
4039 break; | 4040 break; |
4040 } | 4041 } |
4041 | 4042 |
4042 /* make sure we aren't going to overflow the buffer */ | 4043 /* make sure we aren't going to overflow the buffer */ |
4043 if (sizeof(buf) < key_length) { | 4044 if (sizeof(buf) < key_length) { |
(...skipping 3359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7403 att = sftk_FindAttribute(key,CKA_VALUE); | 7404 att = sftk_FindAttribute(key,CKA_VALUE); |
7404 sftk_FreeObject(key); | 7405 sftk_FreeObject(key); |
7405 if (!att) { | 7406 if (!att) { |
7406 return CKR_KEY_HANDLE_INVALID; | 7407 return CKR_KEY_HANDLE_INVALID; |
7407 } | 7408 } |
7408 crv = NSC_DigestUpdate(hSession,(CK_BYTE_PTR)att->attrib.pValue, | 7409 crv = NSC_DigestUpdate(hSession,(CK_BYTE_PTR)att->attrib.pValue, |
7409 att->attrib.ulValueLen); | 7410 att->attrib.ulValueLen); |
7410 sftk_FreeAttribute(att); | 7411 sftk_FreeAttribute(att); |
7411 return crv; | 7412 return crv; |
7412 } | 7413 } |
OLD | NEW |