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 /* | 5 /* |
6 * Code for dealing with x.509 v3 crl and crl entries extensions. | 6 * Code for dealing with x.509 v3 crl and crl entries extensions. |
7 */ | 7 */ |
8 | 8 |
9 #include "cert.h" | 9 #include "cert.h" |
10 #include "secitem.h" | 10 #include "secitem.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 crlEntry->extensions = exts; | 52 crlEntry->extensions = exts; |
53 } | 53 } |
54 | 54 |
55 void * | 55 void * |
56 CERT_StartCRLEntryExtensions(CERTCrl *crl, CERTCrlEntry *entry) | 56 CERT_StartCRLEntryExtensions(CERTCrl *crl, CERTCrlEntry *entry) |
57 { | 57 { |
58 return (cert_StartExtensions (entry, crl->arena, SetCrlEntryExts)); | 58 return (cert_StartExtensions (entry, crl->arena, SetCrlEntryExts)); |
59 } | 59 } |
60 | 60 |
61 SECStatus CERT_FindCRLNumberExten (PRArenaPool *arena, CERTCrl *crl, | 61 SECStatus CERT_FindCRLNumberExten (PLArenaPool *arena, CERTCrl *crl, |
62 SECItem *value) | 62 SECItem *value) |
63 { | 63 { |
64 SECItem encodedExtenValue; | 64 SECItem encodedExtenValue; |
65 SECItem *tmpItem = NULL; | 65 SECItem *tmpItem = NULL; |
66 SECStatus rv; | 66 SECStatus rv; |
67 void *mark = NULL; | 67 void *mark = NULL; |
68 | 68 |
69 encodedExtenValue.data = NULL; | 69 encodedExtenValue.data = NULL; |
70 encodedExtenValue.len = 0; | 70 encodedExtenValue.len = 0; |
71 | 71 |
(...skipping 21 matching lines...) Expand all Loading... |
93 } | 93 } |
94 return (rv); | 94 return (rv); |
95 } | 95 } |
96 | 96 |
97 SECStatus CERT_FindCRLEntryReasonExten (CERTCrlEntry *crlEntry, | 97 SECStatus CERT_FindCRLEntryReasonExten (CERTCrlEntry *crlEntry, |
98 CERTCRLEntryReasonCode *value) | 98 CERTCRLEntryReasonCode *value) |
99 { | 99 { |
100 SECItem wrapperItem = {siBuffer,0}; | 100 SECItem wrapperItem = {siBuffer,0}; |
101 SECItem tmpItem = {siBuffer,0}; | 101 SECItem tmpItem = {siBuffer,0}; |
102 SECStatus rv; | 102 SECStatus rv; |
103 PRArenaPool *arena = NULL; | 103 PLArenaPool *arena = NULL; |
104 | 104 |
105 arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); | 105 arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); |
106 if ( ! arena ) { | 106 if ( ! arena ) { |
107 return(SECFailure); | 107 return(SECFailure); |
108 } | 108 } |
109 | 109 |
110 rv = cert_FindExtension(crlEntry->extensions, SEC_OID_X509_REASON_CODE, | 110 rv = cert_FindExtension(crlEntry->extensions, SEC_OID_X509_REASON_CODE, |
111 &wrapperItem); | 111 &wrapperItem); |
112 if ( rv != SECSuccess ) { | 112 if ( rv != SECSuccess ) { |
113 goto loser; | 113 goto loser; |
(...skipping 14 matching lines...) Expand all Loading... |
128 PORT_FreeArena(arena, PR_FALSE); | 128 PORT_FreeArena(arena, PR_FALSE); |
129 } | 129 } |
130 | 130 |
131 if ( wrapperItem.data ) { | 131 if ( wrapperItem.data ) { |
132 PORT_Free(wrapperItem.data); | 132 PORT_Free(wrapperItem.data); |
133 } | 133 } |
134 | 134 |
135 return (rv); | 135 return (rv); |
136 } | 136 } |
137 | 137 |
138 SECStatus CERT_FindInvalidDateExten (CERTCrl *crl, int64 *value) | 138 SECStatus CERT_FindInvalidDateExten (CERTCrl *crl, PRTime *value) |
139 { | 139 { |
140 SECItem encodedExtenValue; | 140 SECItem encodedExtenValue; |
141 SECItem decodedExtenValue = {siBuffer,0}; | 141 SECItem decodedExtenValue = {siBuffer,0}; |
142 SECStatus rv; | 142 SECStatus rv; |
143 | 143 |
144 encodedExtenValue.data = decodedExtenValue.data = NULL; | 144 encodedExtenValue.data = decodedExtenValue.data = NULL; |
145 encodedExtenValue.len = decodedExtenValue.len = 0; | 145 encodedExtenValue.len = decodedExtenValue.len = 0; |
146 | 146 |
147 rv = cert_FindExtension | 147 rv = cert_FindExtension |
148 (crl->extensions, SEC_OID_X509_INVALID_DATE, &encodedExtenValue); | 148 (crl->extensions, SEC_OID_X509_INVALID_DATE, &encodedExtenValue); |
149 if ( rv != SECSuccess ) | 149 if ( rv != SECSuccess ) |
150 return (rv); | 150 return (rv); |
151 | 151 |
152 rv = SEC_ASN1DecodeItem (NULL, &decodedExtenValue, | 152 rv = SEC_ASN1DecodeItem (NULL, &decodedExtenValue, |
153 SEC_ASN1_GET(SEC_GeneralizedTimeTemplate), | 153 SEC_ASN1_GET(SEC_GeneralizedTimeTemplate), |
154 &encodedExtenValue); | 154 &encodedExtenValue); |
155 if (rv == SECSuccess) | 155 if (rv == SECSuccess) |
156 rv = DER_GeneralizedTimeToTime(value, &encodedExtenValue); | 156 rv = DER_GeneralizedTimeToTime(value, &encodedExtenValue); |
157 PORT_Free (decodedExtenValue.data); | 157 PORT_Free (decodedExtenValue.data); |
158 PORT_Free (encodedExtenValue.data); | 158 PORT_Free (encodedExtenValue.data); |
159 return (rv); | 159 return (rv); |
160 } | 160 } |
OLD | NEW |