Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Side by Side Diff: nss/lib/softoken/pkcs11c.c

Issue 16132005: Allow NSS to be built with NO_NSPR_10_SUPPORT. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/nss/
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « nss/lib/softoken/padbuf.c ('k') | nss/lib/softoken/sftkdb.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #undef CK_NEED_ARG_LIST 46 #undef CK_NEED_ARG_LIST
47 47
48 #define CK_EXTERN extern 48 #define CK_EXTERN extern
49 #define CK_PKCS11_FUNCTION_INFO(func) \ 49 #define CK_PKCS11_FUNCTION_INFO(func) \
50 CK_RV __PASTE(NS,func) 50 CK_RV __PASTE(NS,func)
51 #define CK_NEED_ARG_LIST 1 51 #define CK_NEED_ARG_LIST 1
52 52
53 #include "pkcs11f.h" 53 #include "pkcs11f.h"
54 54
55 typedef struct { 55 typedef struct {
56 uint8 client_version[2]; 56 PRUint8 client_version[2];
57 uint8 random[46]; 57 PRUint8 random[46];
58 } SSL3RSAPreMasterSecret; 58 } SSL3RSAPreMasterSecret;
59 59
60 static void sftk_Null(void *data, PRBool freeit) 60 static void sftk_Null(void *data, PRBool freeit)
61 { 61 {
62 return; 62 return;
63 } 63 }
64 64
65 #ifdef NSS_ENABLE_ECC 65 #ifdef NSS_ENABLE_ECC
66 #ifdef EC_DEBUG 66 #ifdef EC_DEBUG
67 #define SEC_PRINT(str1, str2, num, sitem) \ 67 #define SEC_PRINT(str1, str2, num, sitem) \
(...skipping 3212 matching lines...) Expand 10 before | Expand all | Expand 10 after
3280 3280
3281 return crv; 3281 return crv;
3282 } 3282 }
3283 3283
3284 CK_RV 3284 CK_RV
3285 nsc_SetupHMACKeyGen(CK_MECHANISM_PTR pMechanism, NSSPKCS5PBEParameter **pbe) 3285 nsc_SetupHMACKeyGen(CK_MECHANISM_PTR pMechanism, NSSPKCS5PBEParameter **pbe)
3286 { 3286 {
3287 SECItem salt; 3287 SECItem salt;
3288 CK_PBE_PARAMS *pbe_params = NULL; 3288 CK_PBE_PARAMS *pbe_params = NULL;
3289 NSSPKCS5PBEParameter *params; 3289 NSSPKCS5PBEParameter *params;
3290 PRArenaPool *arena = NULL; 3290 PLArenaPool *arena = NULL;
3291 SECStatus rv; 3291 SECStatus rv;
3292 3292
3293 *pbe = NULL; 3293 *pbe = NULL;
3294 3294
3295 arena = PORT_NewArena(SEC_ASN1_DEFAULT_ARENA_SIZE); 3295 arena = PORT_NewArena(SEC_ASN1_DEFAULT_ARENA_SIZE);
3296 if (arena == NULL) { 3296 if (arena == NULL) {
3297 return CKR_HOST_MEMORY; 3297 return CKR_HOST_MEMORY;
3298 } 3298 }
3299 3299
3300 params = (NSSPKCS5PBEParameter *) PORT_ArenaZAlloc(arena, 3300 params = (NSSPKCS5PBEParameter *) PORT_ArenaZAlloc(arena,
(...skipping 2029 matching lines...) Expand 10 before | Expand all | Expand 10 after
5330 * SharedSecret: a shared secret that is the output of a key agreement primitiv e. 5330 * SharedSecret: a shared secret that is the output of a key agreement primitiv e.
5331 * SharedInfo: (Optional) some data shared by the entities computing the secret key. 5331 * SharedInfo: (Optional) some data shared by the entities computing the secret key.
5332 * SharedInfoLen: the length in octets of SharedInfo 5332 * SharedInfoLen: the length in octets of SharedInfo
5333 * Hash: The hash function to be used in the KDF 5333 * Hash: The hash function to be used in the KDF
5334 * HashLen: the length in octets of the output of Hash 5334 * HashLen: the length in octets of the output of Hash
5335 * Output: 5335 * Output:
5336 * key: Pointer to a buffer containing derived key, if return value is SECSucce ss. 5336 * key: Pointer to a buffer containing derived key, if return value is SECSucce ss.
5337 */ 5337 */
5338 static CK_RV sftk_compute_ANSI_X9_63_kdf(CK_BYTE **key, CK_ULONG key_len, SECIte m *SharedSecret, 5338 static CK_RV sftk_compute_ANSI_X9_63_kdf(CK_BYTE **key, CK_ULONG key_len, SECIte m *SharedSecret,
5339 CK_BYTE_PTR SharedInfo, CK_ULONG SharedInfoLen, 5339 CK_BYTE_PTR SharedInfo, CK_ULONG SharedInfoLen,
5340 » » SECStatus Hash(unsigned char *, const unsigned char *, uint32), 5340 » » SECStatus Hash(unsigned char *, const unsigned char *, PRUint32) ,
5341 CK_ULONG HashLen) 5341 CK_ULONG HashLen)
5342 { 5342 {
5343 unsigned char *buffer = NULL, *output_buffer = NULL; 5343 unsigned char *buffer = NULL, *output_buffer = NULL;
5344 uint32 buffer_len, max_counter, i; 5344 PRUint32 buffer_len, max_counter, i;
5345 SECStatus rv; 5345 SECStatus rv;
5346 5346
5347 /* Check that key_len isn't too long. The maximum key length could be 5347 /* Check that key_len isn't too long. The maximum key length could be
5348 * greatly increased if the code below did not limit the 4-byte counter 5348 * greatly increased if the code below did not limit the 4-byte counter
5349 * to a maximum value of 255. */ 5349 * to a maximum value of 255. */
5350 if (key_len > 254 * HashLen) 5350 if (key_len > 254 * HashLen)
5351 return SEC_ERROR_INVALID_ARGS; 5351 return SEC_ERROR_INVALID_ARGS;
5352 5352
5353 if (SharedInfo == NULL) 5353 if (SharedInfo == NULL)
5354 SharedInfoLen = 0; 5354 SharedInfoLen = 0;
(...skipping 1592 matching lines...) Expand 10 before | Expand all | Expand 10 after
6947 att = sftk_FindAttribute(key,CKA_VALUE); 6947 att = sftk_FindAttribute(key,CKA_VALUE);
6948 sftk_FreeObject(key); 6948 sftk_FreeObject(key);
6949 if (!att) { 6949 if (!att) {
6950 return CKR_KEY_HANDLE_INVALID; 6950 return CKR_KEY_HANDLE_INVALID;
6951 } 6951 }
6952 crv = NSC_DigestUpdate(hSession,(CK_BYTE_PTR)att->attrib.pValue, 6952 crv = NSC_DigestUpdate(hSession,(CK_BYTE_PTR)att->attrib.pValue,
6953 att->attrib.ulValueLen); 6953 att->attrib.ulValueLen);
6954 sftk_FreeAttribute(att); 6954 sftk_FreeAttribute(att);
6955 return crv; 6955 return crv;
6956 } 6956 }
OLDNEW
« no previous file with comments | « nss/lib/softoken/padbuf.c ('k') | nss/lib/softoken/sftkdb.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698