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

Side by Side Diff: nss/lib/certdb/xconst.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/certdb/xconst.h ('k') | nss/lib/certhigh/certhigh.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 * X.509 Extension Encoding 6 * X.509 Extension Encoding
7 */ 7 */
8 8
9 #include "prtypes.h" 9 #include "prtypes.h"
10 #include "seccomon.h" 10 #include "seccomon.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 offsetof(CERTAuthInfoAccess, derLocation) }, 59 offsetof(CERTAuthInfoAccess, derLocation) },
60 { 0, } 60 { 0, }
61 }; 61 };
62 62
63 const SEC_ASN1Template CERTAuthInfoAccessTemplate[] = { 63 const SEC_ASN1Template CERTAuthInfoAccessTemplate[] = {
64 { SEC_ASN1_SEQUENCE_OF, 0, CERTAuthInfoAccessItemTemplate } 64 { SEC_ASN1_SEQUENCE_OF, 0, CERTAuthInfoAccessItemTemplate }
65 }; 65 };
66 66
67 67
68 SECStatus 68 SECStatus
69 CERT_EncodeSubjectKeyID(PRArenaPool *arena, const SECItem* srcString, 69 CERT_EncodeSubjectKeyID(PLArenaPool *arena, const SECItem* srcString,
70 SECItem *encodedValue) 70 SECItem *encodedValue)
71 { 71 {
72 SECStatus rv = SECSuccess; 72 SECStatus rv = SECSuccess;
73 73
74 if (!srcString) { 74 if (!srcString) {
75 PORT_SetError(SEC_ERROR_INVALID_ARGS); 75 PORT_SetError(SEC_ERROR_INVALID_ARGS);
76 return SECFailure; 76 return SECFailure;
77 } 77 }
78 if (SEC_ASN1EncodeItem (arena, encodedValue, srcString, 78 if (SEC_ASN1EncodeItem (arena, encodedValue, srcString,
79 CERTSubjectKeyIDTemplate) == NULL) { 79 CERTSubjectKeyIDTemplate) == NULL) {
80 rv = SECFailure; 80 rv = SECFailure;
81 } 81 }
82 82
83 return(rv); 83 return(rv);
84 } 84 }
85 85
86 86
87 SECStatus 87 SECStatus
88 CERT_EncodePrivateKeyUsagePeriod(PRArenaPool *arena, 88 CERT_EncodePrivateKeyUsagePeriod(PLArenaPool *arena,
89 CERTPrivKeyUsagePeriod *pkup, 89 CERTPrivKeyUsagePeriod *pkup,
90 SECItem *encodedValue) 90 SECItem *encodedValue)
91 { 91 {
92 SECStatus rv = SECSuccess; 92 SECStatus rv = SECSuccess;
93 93
94 if (SEC_ASN1EncodeItem (arena, encodedValue, pkup, 94 if (SEC_ASN1EncodeItem (arena, encodedValue, pkup,
95 CERTPrivateKeyUsagePeriodTemplate) == NULL) { 95 CERTPrivateKeyUsagePeriodTemplate) == NULL) {
96 rv = SECFailure; 96 rv = SECFailure;
97 } 97 }
98 return(rv); 98 return(rv);
(...skipping 28 matching lines...) Expand all
127 goto loser; 127 goto loser;
128 } 128 }
129 return pPeriod; 129 return pPeriod;
130 130
131 loser: 131 loser:
132 return NULL; 132 return NULL;
133 } 133 }
134 134
135 135
136 SECStatus 136 SECStatus
137 CERT_EncodeIA5TypeExtension(PRArenaPool *arena, char *value, SECItem *encodedVal ue) 137 CERT_EncodeIA5TypeExtension(PLArenaPool *arena, char *value, SECItem *encodedVal ue)
138 { 138 {
139 SECItem encodeContext; 139 SECItem encodeContext;
140 SECStatus rv = SECSuccess; 140 SECStatus rv = SECSuccess;
141 141
142 142
143 PORT_Memset (&encodeContext, 0, sizeof (encodeContext)); 143 PORT_Memset (&encodeContext, 0, sizeof (encodeContext));
144 144
145 if (value != NULL) { 145 if (value != NULL) {
146 encodeContext.data = (unsigned char *)value; 146 encodeContext.data = (unsigned char *)value;
147 encodeContext.len = strlen(value); 147 encodeContext.len = strlen(value);
148 } 148 }
149 if (SEC_ASN1EncodeItem (arena, encodedValue, &encodeContext, 149 if (SEC_ASN1EncodeItem (arena, encodedValue, &encodeContext,
150 CERTIA5TypeTemplate) == NULL) { 150 CERTIA5TypeTemplate) == NULL) {
151 rv = SECFailure; 151 rv = SECFailure;
152 } 152 }
153 153
154 return(rv); 154 return(rv);
155 } 155 }
156 156
157 SECStatus 157 SECStatus
158 CERT_EncodeAltNameExtension(PRArenaPool *arena, CERTGeneralName *value, SECIte m *encodedValue) 158 CERT_EncodeAltNameExtension(PLArenaPool *arena, CERTGeneralName *value, SECIte m *encodedValue)
159 { 159 {
160 SECItem **encodedGenName; 160 SECItem **encodedGenName;
161 SECStatus rv = SECSuccess; 161 SECStatus rv = SECSuccess;
162 162
163 encodedGenName = cert_EncodeGeneralNames(arena, value); 163 encodedGenName = cert_EncodeGeneralNames(arena, value);
164 if (SEC_ASN1EncodeItem (arena, encodedValue, &encodedGenName, 164 if (SEC_ASN1EncodeItem (arena, encodedValue, &encodedGenName,
165 CERT_GeneralNamesTemplate) == NULL) { 165 CERT_GeneralNamesTemplate) == NULL) {
166 rv = SECFailure; 166 rv = SECFailure;
167 } 167 }
168 168
169 return rv; 169 return rv;
170 } 170 }
171 171
172 CERTGeneralName * 172 CERTGeneralName *
173 CERT_DecodeAltNameExtension(PRArenaPool *reqArena, SECItem *EncodedAltName) 173 CERT_DecodeAltNameExtension(PLArenaPool *reqArena, SECItem *EncodedAltName)
174 { 174 {
175 SECStatus rv = SECSuccess; 175 SECStatus rv = SECSuccess;
176 CERTAltNameEncodedContext encodedContext; 176 CERTAltNameEncodedContext encodedContext;
177 SECItem* newEncodedAltName; 177 SECItem* newEncodedAltName;
178 178
179 if (!reqArena) { 179 if (!reqArena) {
180 PORT_SetError(SEC_ERROR_INVALID_ARGS); 180 PORT_SetError(SEC_ERROR_INVALID_ARGS);
181 return NULL; 181 return NULL;
182 } 182 }
183 183
(...skipping 14 matching lines...) Expand all
198 encodedContext.encodedGenName); 198 encodedContext.encodedGenName);
199 /* Extension contained an empty GeneralNames sequence */ 199 /* Extension contained an empty GeneralNames sequence */
200 /* Treat as extension not found */ 200 /* Treat as extension not found */
201 PORT_SetError(SEC_ERROR_EXTENSION_NOT_FOUND); 201 PORT_SetError(SEC_ERROR_EXTENSION_NOT_FOUND);
202 loser: 202 loser:
203 return NULL; 203 return NULL;
204 } 204 }
205 205
206 206
207 SECStatus 207 SECStatus
208 CERT_EncodeNameConstraintsExtension(PRArenaPool *arena, 208 CERT_EncodeNameConstraintsExtension(PLArenaPool *arena,
209 CERTNameConstraints *value, 209 CERTNameConstraints *value,
210 SECItem *encodedValue) 210 SECItem *encodedValue)
211 { 211 {
212 SECStatus rv = SECSuccess; 212 SECStatus rv = SECSuccess;
213 213
214 rv = cert_EncodeNameConstraints(value, arena, encodedValue); 214 rv = cert_EncodeNameConstraints(value, arena, encodedValue);
215 return rv; 215 return rv;
216 } 216 }
217 217
218 218
219 CERTNameConstraints * 219 CERTNameConstraints *
220 CERT_DecodeNameConstraintsExtension(PRArenaPool *arena, 220 CERT_DecodeNameConstraintsExtension(PLArenaPool *arena,
221 const SECItem *encodedConstraints) 221 const SECItem *encodedConstraints)
222 { 222 {
223 return cert_DecodeNameConstraints(arena, encodedConstraints); 223 return cert_DecodeNameConstraints(arena, encodedConstraints);
224 } 224 }
225 225
226 226
227 CERTAuthInfoAccess ** 227 CERTAuthInfoAccess **
228 CERT_DecodeAuthInfoAccessExtension(PRArenaPool *reqArena, 228 CERT_DecodeAuthInfoAccessExtension(PLArenaPool *reqArena,
229 SECItem *encodedExtension) 229 SECItem *encodedExtension)
230 { 230 {
231 CERTAuthInfoAccess **info = NULL; 231 CERTAuthInfoAccess **info = NULL;
232 SECStatus rv; 232 SECStatus rv;
233 int i; 233 int i;
234 SECItem* newEncodedExtension; 234 SECItem* newEncodedExtension;
235 235
236 if (!reqArena) { 236 if (!reqArena) {
237 PORT_SetError(SEC_ERROR_INVALID_ARGS); 237 PORT_SetError(SEC_ERROR_INVALID_ARGS);
238 return NULL; 238 return NULL;
(...skipping 12 matching lines...) Expand all
251 251
252 for (i = 0; info[i] != NULL; i++) { 252 for (i = 0; info[i] != NULL; i++) {
253 info[i]->location = CERT_DecodeGeneralName(reqArena, 253 info[i]->location = CERT_DecodeGeneralName(reqArena,
254 &(info[i]->derLocation), 254 &(info[i]->derLocation),
255 NULL); 255 NULL);
256 } 256 }
257 return info; 257 return info;
258 } 258 }
259 259
260 SECStatus 260 SECStatus
261 CERT_EncodeInfoAccessExtension(PRArenaPool *arena, 261 CERT_EncodeInfoAccessExtension(PLArenaPool *arena,
262 CERTAuthInfoAccess **info, 262 CERTAuthInfoAccess **info,
263 SECItem *dest) 263 SECItem *dest)
264 { 264 {
265 SECItem *dummy; 265 SECItem *dummy;
266 int i; 266 int i;
267 267
268 PORT_Assert(info != NULL); 268 PORT_Assert(info != NULL);
269 PORT_Assert(dest != NULL); 269 PORT_Assert(dest != NULL);
270 if (info == NULL || dest == NULL) { 270 if (info == NULL || dest == NULL) {
271 return SECFailure; 271 return SECFailure;
272 } 272 }
273 273
274 for (i = 0; info[i] != NULL; i++) { 274 for (i = 0; info[i] != NULL; i++) {
275 if (CERT_EncodeGeneralName(info[i]->location, &(info[i]->derLocation), 275 if (CERT_EncodeGeneralName(info[i]->location, &(info[i]->derLocation),
276 arena) == NULL) 276 arena) == NULL)
277 /* Note that this may leave some of the locations filled in. */ 277 /* Note that this may leave some of the locations filled in. */
278 return SECFailure; 278 return SECFailure;
279 } 279 }
280 dummy = SEC_ASN1EncodeItem(arena, dest, &info, 280 dummy = SEC_ASN1EncodeItem(arena, dest, &info,
281 CERTAuthInfoAccessTemplate); 281 CERTAuthInfoAccessTemplate);
282 if (dummy == NULL) { 282 if (dummy == NULL) {
283 return SECFailure; 283 return SECFailure;
284 } 284 }
285 return SECSuccess; 285 return SECSuccess;
286 } 286 }
OLDNEW
« no previous file with comments | « nss/lib/certdb/xconst.h ('k') | nss/lib/certhigh/certhigh.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698