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

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

Issue 1843333003: Update NSPR to 4.12 and NSS to 3.23 on iOS (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/nss.git@master
Patch Set: Created 4 years, 8 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
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 * The following code handles the storage of PKCS 11 modules used by the 5 * The following code handles the storage of PKCS 11 modules used by the
6 * NSS. For the rest of NSS, only one kind of database handle exists: 6 * NSS. For the rest of NSS, only one kind of database handle exists:
7 * 7 *
8 * SFTKDBHandle 8 * SFTKDBHandle
9 * 9 *
10 * There is one SFTKDBHandle for the each key database and one for each cert 10 * There is one SFTKDBHandle for the each key database and one for each cert
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 sftkCipherValue cipherValue; 270 sftkCipherValue cipherValue;
271 SECItem *cipher = NULL; 271 SECItem *cipher = NULL;
272 NSSPKCS5PBEParameter *param = NULL; 272 NSSPKCS5PBEParameter *param = NULL;
273 unsigned char saltData[HASH_LENGTH_MAX]; 273 unsigned char saltData[HASH_LENGTH_MAX];
274 274
275 cipherValue.alg = SEC_OID_PKCS12_PBE_WITH_SHA1_AND_TRIPLE_DES_CBC; 275 cipherValue.alg = SEC_OID_PKCS12_PBE_WITH_SHA1_AND_TRIPLE_DES_CBC;
276 cipherValue.salt.len = SHA1_LENGTH; 276 cipherValue.salt.len = SHA1_LENGTH;
277 cipherValue.salt.data = saltData; 277 cipherValue.salt.data = saltData;
278 RNG_GenerateGlobalRandomBytes(saltData,cipherValue.salt.len); 278 RNG_GenerateGlobalRandomBytes(saltData,cipherValue.salt.len);
279 279
280 param = nsspkcs5_NewParam(cipherValue.alg, &cipherValue.salt, 1); 280 param = nsspkcs5_NewParam(cipherValue.alg, HASH_AlgSHA1, &cipherValue.salt,
281 1);
281 if (param == NULL) { 282 if (param == NULL) {
282 rv = SECFailure; 283 rv = SECFailure;
283 goto loser; 284 goto loser;
284 } 285 }
285 cipher = nsspkcs5_CipherData(param, passKey, plainText, PR_TRUE, NULL); 286 cipher = nsspkcs5_CipherData(param, passKey, plainText, PR_TRUE, NULL);
286 if (cipher == NULL) { 287 if (cipher == NULL) {
287 rv = SECFailure; 288 rv = SECFailure;
288 goto loser; 289 goto loser;
289 } 290 }
290 cipherValue.value = *cipher; 291 cipherValue.value = *cipher;
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 443
443 /* initialize our CipherValue structure */ 444 /* initialize our CipherValue structure */
444 signValue.alg = SEC_OID_PKCS5_PBMAC1; 445 signValue.alg = SEC_OID_PKCS5_PBMAC1;
445 signValue.salt.len = prfLength; 446 signValue.salt.len = prfLength;
446 signValue.salt.data = saltData; 447 signValue.salt.data = saltData;
447 signValue.value.data = signData; 448 signValue.value.data = signData;
448 signValue.value.len = hmacLength; 449 signValue.value.len = hmacLength;
449 RNG_GenerateGlobalRandomBytes(saltData,prfLength); 450 RNG_GenerateGlobalRandomBytes(saltData,prfLength);
450 451
451 /* initialize our pkcs5 parameter */ 452 /* initialize our pkcs5 parameter */
452 param = nsspkcs5_NewParam(signValue.alg, &signValue.salt, 1); 453 param = nsspkcs5_NewParam(signValue.alg, HASH_AlgSHA1, &signValue.salt, 1);
453 if (param == NULL) { 454 if (param == NULL) {
454 rv = SECFailure; 455 rv = SECFailure;
455 goto loser; 456 goto loser;
456 } 457 }
457 param->keyID = pbeBitGenIntegrityKey; 458 param->keyID = pbeBitGenIntegrityKey;
458 /* set the PKCS 5 v2 parameters, not extractable from the 459 /* set the PKCS 5 v2 parameters, not extractable from the
459 * data passed into nsspkcs5_NewParam */ 460 * data passed into nsspkcs5_NewParam */
460 param->encAlg = hmacAlg; 461 param->encAlg = hmacAlg;
461 param->hashType = prfType; 462 param->hashType = prfType;
462 param->keyLen = hmacLength; 463 param->keyLen = hmacLength;
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
1263 oldKey.data = NULL; 1264 oldKey.data = NULL;
1264 oldKey.len = 0; 1265 oldKey.len = 0;
1265 sftkdb_switchKeys(keydb, &oldKey); 1266 sftkdb_switchKeys(keydb, &oldKey);
1266 if (oldKey.data) { 1267 if (oldKey.data) {
1267 PORT_ZFree(oldKey.data, oldKey.len); 1268 PORT_ZFree(oldKey.data, oldKey.len);
1268 } 1269 }
1269 return SECSuccess; 1270 return SECSuccess;
1270 } 1271 }
1271 1272
1272 1273
OLDNEW
« no previous file with comments | « nss/lib/softoken/sftkpars.c ('k') | nss/lib/softoken/softkver.h » ('j') | nss/lib/util/secoid.c » ('J')

Powered by Google App Engine
This is Rietveld 408576698