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

Side by Side Diff: nss/lib/pkcs7/p7create.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/pkcs7/p7common.c ('k') | nss/lib/pkcs7/p7decode.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 * PKCS7 creation. 6 * PKCS7 creation.
7 */ 7 */
8 8
9 #include "p7local.h" 9 #include "p7local.h"
10 10
11 #include "cert.h" 11 #include "cert.h"
12 #include "secasn1.h" 12 #include "secasn1.h"
13 #include "secitem.h" 13 #include "secitem.h"
14 #include "secoid.h" 14 #include "secoid.h"
15 #include "pk11func.h" 15 #include "pk11func.h"
16 #include "prtime.h" 16 #include "prtime.h"
17 #include "secerr.h" 17 #include "secerr.h"
18 #include "secder.h" 18 #include "secder.h"
19 #include "secpkcs5.h" 19 #include "secpkcs5.h"
20 20
21 const int NSS_PBE_DEFAULT_ITERATION_COUNT = 2000; /* used in p12e.c too */ 21 const int NSS_PBE_DEFAULT_ITERATION_COUNT = 2000; /* used in p12e.c too */
22 22
23 static SECStatus 23 static SECStatus
24 sec_pkcs7_init_content_info (SEC_PKCS7ContentInfo *cinfo, PRArenaPool *poolp, 24 sec_pkcs7_init_content_info (SEC_PKCS7ContentInfo *cinfo, PLArenaPool *poolp,
25 SECOidTag kind, PRBool detached) 25 SECOidTag kind, PRBool detached)
26 { 26 {
27 void *thing; 27 void *thing;
28 int version; 28 int version;
29 SECItem *versionp; 29 SECItem *versionp;
30 SECStatus rv; 30 SECStatus rv;
31 31
32 PORT_Assert (cinfo != NULL && poolp != NULL); 32 PORT_Assert (cinfo != NULL && poolp != NULL);
33 if (cinfo == NULL || poolp == NULL) 33 if (cinfo == NULL || poolp == NULL)
34 return SECFailure; 34 return SECFailure;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 return SECSuccess; 104 return SECSuccess;
105 } 105 }
106 106
107 107
108 static SEC_PKCS7ContentInfo * 108 static SEC_PKCS7ContentInfo *
109 sec_pkcs7_create_content_info (SECOidTag kind, PRBool detached, 109 sec_pkcs7_create_content_info (SECOidTag kind, PRBool detached,
110 SECKEYGetPasswordKey pwfn, void *pwfn_arg) 110 SECKEYGetPasswordKey pwfn, void *pwfn_arg)
111 { 111 {
112 SEC_PKCS7ContentInfo *cinfo; 112 SEC_PKCS7ContentInfo *cinfo;
113 PRArenaPool *poolp; 113 PLArenaPool *poolp;
114 SECStatus rv; 114 SECStatus rv;
115 115
116 poolp = PORT_NewArena (1024); /* XXX what is right value? */ 116 poolp = PORT_NewArena (1024); /* XXX what is right value? */
117 if (poolp == NULL) 117 if (poolp == NULL)
118 return NULL; 118 return NULL;
119 119
120 cinfo = (SEC_PKCS7ContentInfo*)PORT_ArenaZAlloc (poolp, sizeof(*cinfo)); 120 cinfo = (SEC_PKCS7ContentInfo*)PORT_ArenaZAlloc (poolp, sizeof(*cinfo));
121 if (cinfo == NULL) { 121 if (cinfo == NULL) {
122 PORT_FreeArena (poolp, PR_FALSE); 122 PORT_FreeArena (poolp, PR_FALSE);
123 return NULL; 123 return NULL;
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 if (rv != SECSuccess) { 397 if (rv != SECSuccess) {
398 SEC_PKCS7DestroyContentInfo (cinfo); 398 SEC_PKCS7DestroyContentInfo (cinfo);
399 return NULL; 399 return NULL;
400 } 400 }
401 401
402 return cinfo; 402 return cinfo;
403 } 403 }
404 404
405 405
406 static SEC_PKCS7Attribute * 406 static SEC_PKCS7Attribute *
407 sec_pkcs7_create_attribute (PRArenaPool *poolp, SECOidTag oidtag, 407 sec_pkcs7_create_attribute (PLArenaPool *poolp, SECOidTag oidtag,
408 SECItem *value, PRBool encoded) 408 SECItem *value, PRBool encoded)
409 { 409 {
410 SEC_PKCS7Attribute *attr; 410 SEC_PKCS7Attribute *attr;
411 SECItem **values; 411 SECItem **values;
412 void *mark; 412 void *mark;
413 413
414 PORT_Assert (poolp != NULL); 414 PORT_Assert (poolp != NULL);
415 mark = PORT_ArenaMark (poolp); 415 mark = PORT_ArenaMark (poolp);
416 416
417 attr = (SEC_PKCS7Attribute*)PORT_ArenaAlloc (poolp, 417 attr = (SEC_PKCS7Attribute*)PORT_ArenaAlloc (poolp,
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 if (kind != SEC_OID_PKCS7_SIGNED_DATA 948 if (kind != SEC_OID_PKCS7_SIGNED_DATA
949 && kind != SEC_OID_PKCS7_SIGNED_ENVELOPED_DATA) 949 && kind != SEC_OID_PKCS7_SIGNED_ENVELOPED_DATA)
950 return SECFailure; /* XXX set an error? */ 950 return SECFailure; /* XXX set an error? */
951 951
952 return sec_pkcs7_add_certificate (cinfo, cert); 952 return sec_pkcs7_add_certificate (cinfo, cert);
953 } 953 }
954 954
955 955
956 static SECStatus 956 static SECStatus
957 sec_pkcs7_init_encrypted_content_info (SEC_PKCS7EncryptedContentInfo *enccinfo, 957 sec_pkcs7_init_encrypted_content_info (SEC_PKCS7EncryptedContentInfo *enccinfo,
958 » » » » PRArenaPool *poolp, 958 » » » » PLArenaPool *poolp,
959 SECOidTag kind, PRBool detached, 959 SECOidTag kind, PRBool detached,
960 SECOidTag encalg, int keysize) 960 SECOidTag encalg, int keysize)
961 { 961 {
962 SECStatus rv; 962 SECStatus rv;
963 963
964 PORT_Assert (enccinfo != NULL && poolp != NULL); 964 PORT_Assert (enccinfo != NULL && poolp != NULL);
965 if (enccinfo == NULL || poolp == NULL) 965 if (enccinfo == NULL || poolp == NULL)
966 return SECFailure; 966 return SECFailure;
967 967
968 /* 968 /*
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
1282 SEC_OID_PKCS7_DATA, PR_FALSE, 1282 SEC_OID_PKCS7_DATA, PR_FALSE,
1283 algorithm, keysize); 1283 algorithm, keysize);
1284 if (rv != SECSuccess) { 1284 if (rv != SECSuccess) {
1285 SEC_PKCS7DestroyContentInfo (cinfo); 1285 SEC_PKCS7DestroyContentInfo (cinfo);
1286 return NULL; 1286 return NULL;
1287 } 1287 }
1288 1288
1289 return cinfo; 1289 return cinfo;
1290 } 1290 }
1291 1291
OLDNEW
« no previous file with comments | « nss/lib/pkcs7/p7common.c ('k') | nss/lib/pkcs7/p7decode.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698