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

Side by Side Diff: nss/lib/pk11wrap/pk11merge.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/pk11wrap/pk11mech.c ('k') | nss/lib/pk11wrap/pk11nobj.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 /* 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 } 49 }
50 return SECSuccess; 50 return SECSuccess;
51 } 51 }
52 52
53 53
54 /* 54 /*
55 * copy a template of attributes from a source object to a target object. 55 * copy a template of attributes from a source object to a target object.
56 * if target object is not given, create it. 56 * if target object is not given, create it.
57 */ 57 */
58 static SECStatus 58 static SECStatus
59 pk11_copyAttributes(PRArenaPool *arena, 59 pk11_copyAttributes(PLArenaPool *arena,
60 PK11SlotInfo *targetSlot, CK_OBJECT_HANDLE targetID, 60 PK11SlotInfo *targetSlot, CK_OBJECT_HANDLE targetID,
61 PK11SlotInfo *sourceSlot, CK_OBJECT_HANDLE sourceID, 61 PK11SlotInfo *sourceSlot, CK_OBJECT_HANDLE sourceID,
62 CK_ATTRIBUTE *copyTemplate, CK_ULONG copyTemplateCount) 62 CK_ATTRIBUTE *copyTemplate, CK_ULONG copyTemplateCount)
63 { 63 {
64 SECStatus rv = PK11_GetAttributes(arena, sourceSlot, sourceID, 64 SECStatus rv = PK11_GetAttributes(arena, sourceSlot, sourceID,
65 copyTemplate, copyTemplateCount); 65 copyTemplate, copyTemplateCount);
66 if (rv != SECSuccess) { 66 if (rv != SECSuccess) {
67 return rv; 67 return rv;
68 } 68 }
69 if (targetID == CK_INVALID_HANDLE) { 69 if (targetID == CK_INVALID_HANDLE) {
70 /* we need to create the object */ 70 /* we need to create the object */
71 rv = PK11_CreateNewObject(targetSlot, CK_INVALID_SESSION, 71 rv = PK11_CreateNewObject(targetSlot, CK_INVALID_SESSION,
72 copyTemplate, copyTemplateCount, PR_TRUE, &targetID); 72 copyTemplate, copyTemplateCount, PR_TRUE, &targetID);
73 } else { 73 } else {
74 /* update the existing object with the new attributes */ 74 /* update the existing object with the new attributes */
75 rv = pk11_setAttributes(targetSlot, targetID, 75 rv = pk11_setAttributes(targetSlot, targetID,
76 copyTemplate, copyTemplateCount); 76 copyTemplate, copyTemplateCount);
77 } 77 }
78 return rv; 78 return rv;
79 } 79 }
80 80
81 /* 81 /*
82 * look for a matching object across tokens. 82 * look for a matching object across tokens.
83 */ 83 */
84 static SECStatus 84 static SECStatus
85 pk11_matchAcrossTokens(PRArenaPool *arena, PK11SlotInfo *targetSlot, 85 pk11_matchAcrossTokens(PLArenaPool *arena, PK11SlotInfo *targetSlot,
86 PK11SlotInfo *sourceSlot, 86 PK11SlotInfo *sourceSlot,
87 CK_ATTRIBUTE *template, CK_ULONG tsize, 87 CK_ATTRIBUTE *template, CK_ULONG tsize,
88 CK_OBJECT_HANDLE id, CK_OBJECT_HANDLE *peer) 88 CK_OBJECT_HANDLE id, CK_OBJECT_HANDLE *peer)
89 { 89 {
90 90
91 CK_RV crv; 91 CK_RV crv;
92 *peer = CK_INVALID_HANDLE; 92 *peer = CK_INVALID_HANDLE;
93 93
94 crv = PK11_GetAttributes(arena, sourceSlot, id, template, tsize); 94 crv = PK11_GetAttributes(arena, sourceSlot, id, template, tsize);
95 if (crv != CKR_OK) { 95 if (crv != CKR_OK) {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 pk11_mergePrivateKey(PK11SlotInfo *targetSlot, PK11SlotInfo *sourceSlot, 195 pk11_mergePrivateKey(PK11SlotInfo *targetSlot, PK11SlotInfo *sourceSlot,
196 CK_OBJECT_HANDLE id, void *targetPwArg, void *sourcePwArg) 196 CK_OBJECT_HANDLE id, void *targetPwArg, void *sourcePwArg)
197 { 197 {
198 SECKEYPrivateKey *sourceKey = NULL; 198 SECKEYPrivateKey *sourceKey = NULL;
199 CK_OBJECT_HANDLE targetKeyID; 199 CK_OBJECT_HANDLE targetKeyID;
200 SECKEYEncryptedPrivateKeyInfo *epki = NULL; 200 SECKEYEncryptedPrivateKeyInfo *epki = NULL;
201 char *nickname = NULL; 201 char *nickname = NULL;
202 SECItem nickItem; 202 SECItem nickItem;
203 SECItem pwitem; 203 SECItem pwitem;
204 SECItem publicValue; 204 SECItem publicValue;
205 PRArenaPool *arena = NULL; 205 PLArenaPool *arena = NULL;
206 SECStatus rv = SECSuccess; 206 SECStatus rv = SECSuccess;
207 unsigned int keyUsage; 207 unsigned int keyUsage;
208 unsigned char randomData[SHA1_LENGTH]; 208 unsigned char randomData[SHA1_LENGTH];
209 SECOidTag algTag = SEC_OID_PKCS12_V2_PBE_WITH_SHA1_AND_3KEY_TRIPLE_DES_CBC; 209 SECOidTag algTag = SEC_OID_PKCS12_V2_PBE_WITH_SHA1_AND_3KEY_TRIPLE_DES_CBC;
210 CK_ATTRIBUTE privTemplate[] = { 210 CK_ATTRIBUTE privTemplate[] = {
211 { CKA_ID, NULL, 0 }, 211 { CKA_ID, NULL, 0 },
212 { CKA_CLASS, NULL, 0 } 212 { CKA_CLASS, NULL, 0 }
213 }; 213 };
214 CK_ULONG privTemplateCount = sizeof(privTemplate)/sizeof(privTemplate[0]); 214 CK_ULONG privTemplateCount = sizeof(privTemplate)/sizeof(privTemplate[0]);
215 CK_ATTRIBUTE privCopyTemplate[] = { 215 CK_ATTRIBUTE privCopyTemplate[] = {
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 * This code also handles the following corner cases: 324 * This code also handles the following corner cases:
325 * 1) the single byte overflows. On overflow we increment the next byte up 325 * 1) the single byte overflows. On overflow we increment the next byte up
326 * and so forth until we have overflowed the entire CKA_ID. 326 * and so forth until we have overflowed the entire CKA_ID.
327 * 2) If we overflow the entire CKA_ID we expand it by one byte. 327 * 2) If we overflow the entire CKA_ID we expand it by one byte.
328 * 3) the CKA_ID is non-existent, we create a new one with one byte. 328 * 3) the CKA_ID is non-existent, we create a new one with one byte.
329 * This means no matter what CKA_ID is passed, the result of this function 329 * This means no matter what CKA_ID is passed, the result of this function
330 * is always a new CKA_ID, and this function will never return the same 330 * is always a new CKA_ID, and this function will never return the same
331 * CKA_ID the it has returned in the passed. 331 * CKA_ID the it has returned in the passed.
332 */ 332 */
333 static SECStatus 333 static SECStatus
334 pk11_incrementID(PRArenaPool *arena, CK_ATTRIBUTE *ptemplate) 334 pk11_incrementID(PLArenaPool *arena, CK_ATTRIBUTE *ptemplate)
335 { 335 {
336 unsigned char *buf = ptemplate->pValue; 336 unsigned char *buf = ptemplate->pValue;
337 CK_ULONG len = ptemplate->ulValueLen; 337 CK_ULONG len = ptemplate->ulValueLen;
338 338
339 if (buf == NULL || len == (CK_ULONG)-1) { 339 if (buf == NULL || len == (CK_ULONG)-1) {
340 /* we have no valid CKAID, we'll create a basic one byte CKA_ID below */ 340 /* we have no valid CKAID, we'll create a basic one byte CKA_ID below */
341 len = 0; 341 len = 0;
342 } else { 342 } else {
343 CK_ULONG i; 343 CK_ULONG i;
344 344
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 { 426 {
427 PK11SymKey *sourceKey = NULL; 427 PK11SymKey *sourceKey = NULL;
428 PK11SymKey *targetKey = NULL; 428 PK11SymKey *targetKey = NULL;
429 SECItem *sourceOutput = NULL; 429 SECItem *sourceOutput = NULL;
430 SECItem *targetOutput = NULL; 430 SECItem *targetOutput = NULL;
431 SECItem *param = NULL; 431 SECItem *param = NULL;
432 int blockSize; 432 int blockSize;
433 SECItem input; 433 SECItem input;
434 CK_OBJECT_HANDLE targetKeyID; 434 CK_OBJECT_HANDLE targetKeyID;
435 CK_FLAGS flags; 435 CK_FLAGS flags;
436 PRArenaPool *arena = NULL; 436 PLArenaPool *arena = NULL;
437 SECStatus rv = SECSuccess; 437 SECStatus rv = SECSuccess;
438 CK_MECHANISM_TYPE keyMechType, cryptoMechType; 438 CK_MECHANISM_TYPE keyMechType, cryptoMechType;
439 CK_KEY_TYPE sourceKeyType, targetKeyType; 439 CK_KEY_TYPE sourceKeyType, targetKeyType;
440 CK_ATTRIBUTE symTemplate[] = { 440 CK_ATTRIBUTE symTemplate[] = {
441 { CKA_ID, NULL, 0 }, 441 { CKA_ID, NULL, 0 },
442 { CKA_CLASS, NULL, 0 } 442 { CKA_CLASS, NULL, 0 }
443 }; 443 };
444 CK_ULONG symTemplateCount = sizeof(symTemplate)/sizeof(symTemplate[0]); 444 CK_ULONG symTemplateCount = sizeof(symTemplate)/sizeof(symTemplate[0]);
445 CK_ATTRIBUTE symCopyTemplate[] = { 445 CK_ATTRIBUTE symCopyTemplate[] = {
446 { CKA_LABEL, NULL, 0 } 446 { CKA_LABEL, NULL, 0 }
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 * 600 *
601 * Use the high level NSS calls to extract the public key and import it 601 * Use the high level NSS calls to extract the public key and import it
602 * into the token. Extra attributes are then copied to the new token. 602 * into the token. Extra attributes are then copied to the new token.
603 */ 603 */
604 static SECStatus 604 static SECStatus
605 pk11_mergePublicKey(PK11SlotInfo *targetSlot, PK11SlotInfo *sourceSlot, 605 pk11_mergePublicKey(PK11SlotInfo *targetSlot, PK11SlotInfo *sourceSlot,
606 CK_OBJECT_HANDLE id, void *targetPwArg, void *sourcePwArg) 606 CK_OBJECT_HANDLE id, void *targetPwArg, void *sourcePwArg)
607 { 607 {
608 SECKEYPublicKey *sourceKey = NULL; 608 SECKEYPublicKey *sourceKey = NULL;
609 CK_OBJECT_HANDLE targetKeyID; 609 CK_OBJECT_HANDLE targetKeyID;
610 PRArenaPool *arena = NULL; 610 PLArenaPool *arena = NULL;
611 SECStatus rv = SECSuccess; 611 SECStatus rv = SECSuccess;
612 CK_ATTRIBUTE pubTemplate[] = { 612 CK_ATTRIBUTE pubTemplate[] = {
613 { CKA_ID, NULL, 0 }, 613 { CKA_ID, NULL, 0 },
614 { CKA_CLASS, NULL, 0 } 614 { CKA_CLASS, NULL, 0 }
615 }; 615 };
616 CK_ULONG pubTemplateCount = sizeof(pubTemplate)/sizeof(pubTemplate[0]); 616 CK_ULONG pubTemplateCount = sizeof(pubTemplate)/sizeof(pubTemplate[0]);
617 CK_ATTRIBUTE pubCopyTemplate[] = { 617 CK_ATTRIBUTE pubCopyTemplate[] = {
618 { CKA_ID, NULL, 0 }, 618 { CKA_ID, NULL, 0 },
619 { CKA_LABEL, NULL, 0 }, 619 { CKA_LABEL, NULL, 0 },
620 { CKA_SUBJECT, NULL, 0 } 620 { CKA_SUBJECT, NULL, 0 }
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 * Use the high level NSS calls to extract and import the certificate. 739 * Use the high level NSS calls to extract and import the certificate.
740 */ 740 */
741 static SECStatus 741 static SECStatus
742 pk11_mergeCert(PK11SlotInfo *targetSlot, PK11SlotInfo *sourceSlot, 742 pk11_mergeCert(PK11SlotInfo *targetSlot, PK11SlotInfo *sourceSlot,
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 PRArenaPool *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;
754 754
755 755
756 sourceCert = PK11_MakeCertFromHandle(sourceSlot, id, NULL); 756 sourceCert = PK11_MakeCertFromHandle(sourceSlot, id, NULL);
757 if (sourceCert == NULL) { 757 if (sourceCert == NULL) {
758 rv = SECFailure; 758 rv = SECFailure;
759 goto done; 759 goto done;
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 /* 875 /*
876 * Use the raw PKCS #11 interface to merge the CRLs. 876 * Use the raw PKCS #11 interface to merge the CRLs.
877 * 877 *
878 * In the case where of collision, choose the newest CRL that is valid. 878 * In the case where of collision, choose the newest CRL that is valid.
879 */ 879 */
880 static SECStatus 880 static SECStatus
881 pk11_mergeCrl(PK11SlotInfo *targetSlot, PK11SlotInfo *sourceSlot, 881 pk11_mergeCrl(PK11SlotInfo *targetSlot, PK11SlotInfo *sourceSlot,
882 CK_OBJECT_HANDLE id, void *targetPwArg, void *sourcePwArg) 882 CK_OBJECT_HANDLE id, void *targetPwArg, void *sourcePwArg)
883 { 883 {
884 CK_OBJECT_HANDLE targetCrlID; 884 CK_OBJECT_HANDLE targetCrlID;
885 PRArenaPool *arena = NULL; 885 PLArenaPool *arena = NULL;
886 SECStatus rv = SECSuccess; 886 SECStatus rv = SECSuccess;
887 CK_ATTRIBUTE crlTemplate[] = { 887 CK_ATTRIBUTE crlTemplate[] = {
888 { CKA_SUBJECT, NULL, 0 }, 888 { CKA_SUBJECT, NULL, 0 },
889 { CKA_CLASS, NULL, 0 }, 889 { CKA_CLASS, NULL, 0 },
890 { CKA_NSS_KRL, NULL, 0 } 890 { CKA_NSS_KRL, NULL, 0 }
891 }; 891 };
892 CK_ULONG crlTemplateCount = sizeof(crlTemplate)/sizeof(crlTemplate[0]); 892 CK_ULONG crlTemplateCount = sizeof(crlTemplate)/sizeof(crlTemplate[0]);
893 CK_ATTRIBUTE crlCopyTemplate[] = { 893 CK_ATTRIBUTE crlCopyTemplate[] = {
894 { CKA_CLASS, NULL, 0 }, 894 { CKA_CLASS, NULL, 0 },
895 { CKA_TOKEN, NULL, 0 }, 895 { CKA_TOKEN, NULL, 0 },
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 *************************************************************************/ 937 *************************************************************************/
938 938
939 /* 939 /*
940 * use the raw PKCS #11 interface to merge the S/MIME records 940 * use the raw PKCS #11 interface to merge the S/MIME records
941 */ 941 */
942 static SECStatus 942 static SECStatus
943 pk11_mergeSmime(PK11SlotInfo *targetSlot, PK11SlotInfo *sourceSlot, 943 pk11_mergeSmime(PK11SlotInfo *targetSlot, PK11SlotInfo *sourceSlot,
944 CK_OBJECT_HANDLE id, void *targetPwArg, void *sourcePwArg) 944 CK_OBJECT_HANDLE id, void *targetPwArg, void *sourcePwArg)
945 { 945 {
946 CK_OBJECT_HANDLE targetSmimeID; 946 CK_OBJECT_HANDLE targetSmimeID;
947 PRArenaPool *arena = NULL; 947 PLArenaPool *arena = NULL;
948 SECStatus rv = SECSuccess; 948 SECStatus rv = SECSuccess;
949 CK_ATTRIBUTE smimeTemplate[] = { 949 CK_ATTRIBUTE smimeTemplate[] = {
950 { CKA_SUBJECT, NULL, 0 }, 950 { CKA_SUBJECT, NULL, 0 },
951 { CKA_NSS_EMAIL, NULL, 0 }, 951 { CKA_NSS_EMAIL, NULL, 0 },
952 { CKA_CLASS, NULL, 0 }, 952 { CKA_CLASS, NULL, 0 },
953 }; 953 };
954 CK_ULONG smimeTemplateCount = 954 CK_ULONG smimeTemplateCount =
955 sizeof(smimeTemplate)/sizeof(smimeTemplate[0]); 955 sizeof(smimeTemplate)/sizeof(smimeTemplate[0]);
956 CK_ATTRIBUTE smimeCopyTemplate[] = { 956 CK_ATTRIBUTE smimeCopyTemplate[] = {
957 { CKA_CLASS, NULL, 0 }, 957 { CKA_CLASS, NULL, 0 },
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 return USE_TARGET; 1057 return USE_TARGET;
1058 } 1058 }
1059 /* 1059 /*
1060 * use the raw PKCS #11 interface to merge the S/MIME records 1060 * use the raw PKCS #11 interface to merge the S/MIME records
1061 */ 1061 */
1062 static SECStatus 1062 static SECStatus
1063 pk11_mergeTrust(PK11SlotInfo *targetSlot, PK11SlotInfo *sourceSlot, 1063 pk11_mergeTrust(PK11SlotInfo *targetSlot, PK11SlotInfo *sourceSlot,
1064 CK_OBJECT_HANDLE id, void *targetPwArg, void *sourcePwArg) 1064 CK_OBJECT_HANDLE id, void *targetPwArg, void *sourcePwArg)
1065 { 1065 {
1066 CK_OBJECT_HANDLE targetTrustID; 1066 CK_OBJECT_HANDLE targetTrustID;
1067 PRArenaPool *arena = NULL; 1067 PLArenaPool *arena = NULL;
1068 SECStatus rv = SECSuccess; 1068 SECStatus rv = SECSuccess;
1069 int error = 0; 1069 int error = 0;
1070 CK_ATTRIBUTE trustTemplate[] = { 1070 CK_ATTRIBUTE trustTemplate[] = {
1071 { CKA_ISSUER, NULL, 0 }, 1071 { CKA_ISSUER, NULL, 0 },
1072 { CKA_SERIAL_NUMBER, NULL, 0 }, 1072 { CKA_SERIAL_NUMBER, NULL, 0 },
1073 { CKA_CLASS, NULL, 0 }, 1073 { CKA_CLASS, NULL, 0 },
1074 }; 1074 };
1075 CK_ULONG trustTemplateCount = 1075 CK_ULONG trustTemplateCount =
1076 sizeof(trustTemplate)/sizeof(trustTemplate[0]); 1076 sizeof(trustTemplate)/sizeof(trustTemplate[0]);
1077 CK_ATTRIBUTE trustCopyTemplate[] = { 1077 CK_ATTRIBUTE trustCopyTemplate[] = {
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1221 targetPwArg, sourcePwArg); 1221 targetPwArg, sourcePwArg);
1222 default: 1222 default:
1223 break; 1223 break;
1224 } 1224 }
1225 1225
1226 PORT_SetError( SEC_ERROR_UNKNOWN_OBJECT_TYPE ); 1226 PORT_SetError( SEC_ERROR_UNKNOWN_OBJECT_TYPE );
1227 return SECFailure; 1227 return SECFailure;
1228 } 1228 }
1229 1229
1230 PK11MergeLogNode * 1230 PK11MergeLogNode *
1231 pk11_newMergeLogNode(PRArenaPool *arena, 1231 pk11_newMergeLogNode(PLArenaPool *arena,
1232 PK11SlotInfo *slot, CK_OBJECT_HANDLE id, int error) 1232 PK11SlotInfo *slot, CK_OBJECT_HANDLE id, int error)
1233 { 1233 {
1234 PK11MergeLogNode *newLog; 1234 PK11MergeLogNode *newLog;
1235 PK11GenericObject *obj; 1235 PK11GenericObject *obj;
1236 1236
1237 newLog = PORT_ArenaZNew(arena, PK11MergeLogNode); 1237 newLog = PORT_ArenaZNew(arena, PK11MergeLogNode);
1238 if (newLog == NULL) { 1238 if (newLog == NULL) {
1239 return NULL; 1239 return NULL;
1240 } 1240 }
1241 1241
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1385 loser: 1385 loser:
1386 if (objectIDs) { 1386 if (objectIDs) {
1387 PORT_Free(objectIDs); 1387 PORT_Free(objectIDs);
1388 } 1388 }
1389 return rv; 1389 return rv;
1390 } 1390 }
1391 1391
1392 PK11MergeLog * 1392 PK11MergeLog *
1393 PK11_CreateMergeLog(void) 1393 PK11_CreateMergeLog(void)
1394 { 1394 {
1395 PRArenaPool *arena; 1395 PLArenaPool *arena;
1396 PK11MergeLog *log; 1396 PK11MergeLog *log;
1397 1397
1398 arena = PORT_NewArena( DER_DEFAULT_CHUNKSIZE); 1398 arena = PORT_NewArena( DER_DEFAULT_CHUNKSIZE);
1399 if (arena == NULL) { 1399 if (arena == NULL) {
1400 return NULL; 1400 return NULL;
1401 } 1401 }
1402 1402
1403 log = PORT_ArenaZNew(arena, PK11MergeLog); 1403 log = PORT_ArenaZNew(arena, PK11MergeLog);
1404 if (log == NULL) { 1404 if (log == NULL) {
1405 PORT_FreeArena(arena,PR_FALSE); 1405 PORT_FreeArena(arena,PR_FALSE);
1406 return NULL; 1406 return NULL;
1407 } 1407 }
1408 log->arena = arena; 1408 log->arena = arena;
1409 log->version = 1; 1409 log->version = 1;
1410 return log; 1410 return log;
1411 } 1411 }
1412 1412
1413 void 1413 void
1414 PK11_DestroyMergeLog(PK11MergeLog *log) 1414 PK11_DestroyMergeLog(PK11MergeLog *log)
1415 { 1415 {
1416 if (log && log->arena) { 1416 if (log && log->arena) {
1417 PORT_FreeArena(log->arena, PR_FALSE); 1417 PORT_FreeArena(log->arena, PR_FALSE);
1418 } 1418 }
1419 } 1419 }
OLDNEW
« no previous file with comments | « nss/lib/pk11wrap/pk11mech.c ('k') | nss/lib/pk11wrap/pk11nobj.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698