OLD | NEW |
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 #include "cert.h" | 5 #include "cert.h" |
6 #include "base64.h" | 6 #include "base64.h" |
7 #include "secitem.h" | 7 #include "secitem.h" |
8 #include "secder.h" | 8 #include "secder.h" |
9 #include "secasn1.h" | 9 #include "secasn1.h" |
10 #include "secoid.h" | 10 #include "secoid.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 return theTemplate; | 116 return theTemplate; |
117 } | 117 } |
118 | 118 |
119 static SECStatus | 119 static SECStatus |
120 SEC_ReadPKCS7Certs(SECItem *pkcs7Item, CERTImportCertificateFunc f, void *arg) | 120 SEC_ReadPKCS7Certs(SECItem *pkcs7Item, CERTImportCertificateFunc f, void *arg) |
121 { | 121 { |
122 ContentInfo contentInfo; | 122 ContentInfo contentInfo; |
123 SECStatus rv; | 123 SECStatus rv; |
124 SECItem **certs; | 124 SECItem **certs; |
125 int count; | 125 int count; |
126 PRArenaPool *arena; | 126 PLArenaPool *arena; |
127 | 127 |
128 arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); | 128 arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); |
129 if ( arena == NULL ) { | 129 if ( arena == NULL ) { |
130 return SECFailure; | 130 return SECFailure; |
131 } | 131 } |
132 | 132 |
133 PORT_Memset(&contentInfo, 0, sizeof(contentInfo)); | 133 PORT_Memset(&contentInfo, 0, sizeof(contentInfo)); |
134 rv = SEC_ASN1DecodeItem(arena, &contentInfo, ContentInfoTemplate, | 134 rv = SEC_ASN1DecodeItem(arena, &contentInfo, ContentInfoTemplate, |
135 pkcs7Item); | 135 pkcs7Item); |
136 if ( rv != SECSuccess ) { | 136 if ( rv != SECSuccess ) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 { SEC_ASN1_SEQUENCE_OF | SEC_ASN1_XTRN, 0, SEC_ASN1_SUB(SEC_AnyTemplate) } | 170 { SEC_ASN1_SEQUENCE_OF | SEC_ASN1_XTRN, 0, SEC_ASN1_SUB(SEC_AnyTemplate) } |
171 }; | 171 }; |
172 | 172 |
173 static SECStatus | 173 static SECStatus |
174 SEC_ReadCertSequence(SECItem *certsItem, CERTImportCertificateFunc f, void *arg) | 174 SEC_ReadCertSequence(SECItem *certsItem, CERTImportCertificateFunc f, void *arg) |
175 { | 175 { |
176 SECStatus rv; | 176 SECStatus rv; |
177 SECItem **certs; | 177 SECItem **certs; |
178 int count; | 178 int count; |
179 SECItem **rawCerts = NULL; | 179 SECItem **rawCerts = NULL; |
180 PRArenaPool *arena; | 180 PLArenaPool *arena; |
181 ContentInfo contentInfo; | 181 ContentInfo contentInfo; |
182 | 182 |
183 arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); | 183 arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); |
184 if ( arena == NULL ) { | 184 if ( arena == NULL ) { |
185 return SECFailure; | 185 return SECFailure; |
186 } | 186 } |
187 | 187 |
188 PORT_Memset(&contentInfo, 0, sizeof(contentInfo)); | 188 PORT_Memset(&contentInfo, 0, sizeof(contentInfo)); |
189 rv = SEC_ASN1DecodeItem(arena, &contentInfo, ContentInfoTemplate, | 189 rv = SEC_ASN1DecodeItem(arena, &contentInfo, ContentInfoTemplate, |
190 certsItem); | 190 certsItem); |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 } | 492 } |
493 | 493 |
494 if ( ascCert ) { | 494 if ( ascCert ) { |
495 PORT_Free(ascCert); | 495 PORT_Free(ascCert); |
496 } | 496 } |
497 | 497 |
498 return(rv); | 498 return(rv); |
499 } | 499 } |
500 | 500 |
501 typedef struct { | 501 typedef struct { |
502 PRArenaPool *arena; | 502 PLArenaPool *arena; |
503 SECItem cert; | 503 SECItem cert; |
504 } collect_args; | 504 } collect_args; |
505 | 505 |
506 static SECStatus | 506 static SECStatus |
507 collect_certs(void *arg, SECItem **certs, int numcerts) | 507 collect_certs(void *arg, SECItem **certs, int numcerts) |
508 { | 508 { |
509 SECStatus rv; | 509 SECStatus rv; |
510 collect_args *collectArgs; | 510 collect_args *collectArgs; |
511 | 511 |
512 collectArgs = (collect_args *)arg; | 512 collectArgs = (collect_args *)arg; |
(...skipping 21 matching lines...) Expand all Loading... |
534 if ( rv == SECSuccess ) { | 534 if ( rv == SECSuccess ) { |
535 cert = CERT_NewTempCertificate(CERT_GetDefaultCertDB(), | 535 cert = CERT_NewTempCertificate(CERT_GetDefaultCertDB(), |
536 &collectArgs.cert, NULL, | 536 &collectArgs.cert, NULL, |
537 PR_FALSE, PR_TRUE); | 537 PR_FALSE, PR_TRUE); |
538 } | 538 } |
539 | 539 |
540 PORT_FreeArena(collectArgs.arena, PR_FALSE); | 540 PORT_FreeArena(collectArgs.arena, PR_FALSE); |
541 | 541 |
542 return(cert); | 542 return(cert); |
543 } | 543 } |
OLD | NEW |