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

Side by Side Diff: nss/lib/pk11wrap/pk11merge.c

Issue 1504923011: Update NSS to 3.21 RTM and NSPR to 4.11 RTM (Closed) Base URL: http://src.chromium.org/svn/trunk/deps/third_party/nss
Patch Set: Created 5 years 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
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 /* 5 /*
6 * Merge the source token into the target token. 6 * Merge the source token into the target token.
7 */ 7 */
8 8
9 #include "secmod.h" 9 #include "secmod.h"
10 #include "secmodi.h" 10 #include "secmodi.h"
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 CK_OBJECT_HANDLE id, void *targetPwArg, void *sourcePwArg) 743 CK_OBJECT_HANDLE id, void *targetPwArg, void *sourcePwArg)
744 { 744 {
745 CERTCertificate *sourceCert = NULL; 745 CERTCertificate *sourceCert = NULL;
746 CK_OBJECT_HANDLE targetCertID = CK_INVALID_HANDLE; 746 CK_OBJECT_HANDLE targetCertID = CK_INVALID_HANDLE;
747 char *nickname = NULL; 747 char *nickname = NULL;
748 SECStatus rv = SECSuccess; 748 SECStatus rv = SECSuccess;
749 PLArenaPool *arena = NULL; 749 PLArenaPool *arena = NULL;
750 CK_ATTRIBUTE sourceCKAID = {CKA_ID, NULL, 0}; 750 CK_ATTRIBUTE sourceCKAID = {CKA_ID, NULL, 0};
751 CK_ATTRIBUTE targetCKAID = {CKA_ID, NULL, 0}; 751 CK_ATTRIBUTE targetCKAID = {CKA_ID, NULL, 0};
752 SECStatus lrv = SECSuccess; 752 SECStatus lrv = SECSuccess;
753 int error; 753 int error = SEC_ERROR_LIBRARY_FAILURE;
754
755 754
756 sourceCert = PK11_MakeCertFromHandle(sourceSlot, id, NULL); 755 sourceCert = PK11_MakeCertFromHandle(sourceSlot, id, NULL);
757 if (sourceCert == NULL) { 756 if (sourceCert == NULL) {
758 rv = SECFailure; 757 rv = SECFailure;
759 goto done; 758 goto done;
760 } 759 }
761 760
762 nickname = PK11_GetObjectNickname(sourceSlot, id); 761 nickname = PK11_GetObjectNickname(sourceSlot, id);
763 762
764 /* The database code will prevent nickname collisions for certs with 763 /* The database code will prevent nickname collisions for certs with
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
1255 1254
1256 /* 1255 /*
1257 * walk down each entry and merge it. keep track of the errors in the log 1256 * walk down each entry and merge it. keep track of the errors in the log
1258 */ 1257 */
1259 static SECStatus 1258 static SECStatus
1260 pk11_mergeByObjectIDs(PK11SlotInfo *targetSlot, PK11SlotInfo *sourceSlot, 1259 pk11_mergeByObjectIDs(PK11SlotInfo *targetSlot, PK11SlotInfo *sourceSlot,
1261 CK_OBJECT_HANDLE *objectIDs, int count, 1260 CK_OBJECT_HANDLE *objectIDs, int count,
1262 PK11MergeLog *log, void *targetPwArg, void *sourcePwArg) 1261 PK11MergeLog *log, void *targetPwArg, void *sourcePwArg)
1263 { 1262 {
1264 SECStatus rv = SECSuccess; 1263 SECStatus rv = SECSuccess;
1265 int error, i; 1264 int error = SEC_ERROR_LIBRARY_FAILURE;
1265 int i;
1266 1266
1267 for (i=0; i < count; i++) { 1267 for (i=0; i < count; i++) {
1268 /* try to update the entire database. On failure, keep going, 1268 /* try to update the entire database. On failure, keep going,
1269 * but remember the error to report back to the caller */ 1269 * but remember the error to report back to the caller */
1270 SECStatus lrv; 1270 SECStatus lrv;
1271 PK11MergeLogNode *newLog; 1271 PK11MergeLogNode *newLog;
1272 1272
1273 lrv= pk11_mergeObject(targetSlot, sourceSlot, objectIDs[i], 1273 lrv= pk11_mergeObject(targetSlot, sourceSlot, objectIDs[i],
1274 targetPwArg, sourcePwArg); 1274 targetPwArg, sourcePwArg);
1275 if (lrv == SECSuccess) { 1275 if (lrv == SECSuccess) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1319 * 1319 *
1320 * Applications can pass in an optional error log which will record 1320 * Applications can pass in an optional error log which will record
1321 * each failing object and why it failed to import. PK11MergeLog 1321 * each failing object and why it failed to import. PK11MergeLog
1322 * is modelled after the CERTVerifyLog. 1322 * is modelled after the CERTVerifyLog.
1323 */ 1323 */
1324 SECStatus 1324 SECStatus
1325 PK11_MergeTokens(PK11SlotInfo *targetSlot, PK11SlotInfo *sourceSlot, 1325 PK11_MergeTokens(PK11SlotInfo *targetSlot, PK11SlotInfo *sourceSlot,
1326 PK11MergeLog *log, void *targetPwArg, void *sourcePwArg) 1326 PK11MergeLog *log, void *targetPwArg, void *sourcePwArg)
1327 { 1327 {
1328 SECStatus rv = SECSuccess, lrv = SECSuccess; 1328 SECStatus rv = SECSuccess, lrv = SECSuccess;
1329 int error, count = 0; 1329 int error = SEC_ERROR_LIBRARY_FAILURE;
1330 int count = 0;
1330 CK_ATTRIBUTE search[2]; 1331 CK_ATTRIBUTE search[2];
1331 CK_OBJECT_HANDLE *objectIDs = NULL; 1332 CK_OBJECT_HANDLE *objectIDs = NULL;
1332 CK_BBOOL ck_true = CK_TRUE; 1333 CK_BBOOL ck_true = CK_TRUE;
1333 CK_OBJECT_CLASS privKey = CKO_PRIVATE_KEY; 1334 CK_OBJECT_CLASS privKey = CKO_PRIVATE_KEY;
1334 1335
1335 PK11_SETATTRS(&search[0], CKA_TOKEN, &ck_true, sizeof(ck_true)); 1336 PK11_SETATTRS(&search[0], CKA_TOKEN, &ck_true, sizeof(ck_true));
1336 PK11_SETATTRS(&search[1], CKA_CLASS, &privKey, sizeof(privKey)); 1337 PK11_SETATTRS(&search[1], CKA_CLASS, &privKey, sizeof(privKey));
1337 /* 1338 /*
1338 * make sure both tokens are already authenticated if need be. 1339 * make sure both tokens are already authenticated if need be.
1339 */ 1340 */
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1410 return log; 1411 return log;
1411 } 1412 }
1412 1413
1413 void 1414 void
1414 PK11_DestroyMergeLog(PK11MergeLog *log) 1415 PK11_DestroyMergeLog(PK11MergeLog *log)
1415 { 1416 {
1416 if (log && log->arena) { 1417 if (log && log->arena) {
1417 PORT_FreeArena(log->arena, PR_FALSE); 1418 PORT_FreeArena(log->arena, PR_FALSE);
1418 } 1419 }
1419 } 1420 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698