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 X509.V3 extensions. | 6 * Code for dealing with X509.V3 extensions. |
7 * | 7 * |
8 * $Id$ | 8 * $Id$ |
9 */ | 9 */ |
10 | 10 |
11 #include "cert.h" | 11 #include "cert.h" |
12 #include "secitem.h" | 12 #include "secitem.h" |
13 #include "secoid.h" | 13 #include "secoid.h" |
14 #include "secder.h" | 14 #include "secder.h" |
15 #include "secasn1.h" | 15 #include "secasn1.h" |
16 #include "certxutl.h" | 16 #include "certxutl.h" |
17 #include "secerr.h" | 17 #include "secerr.h" |
18 | 18 |
19 SECStatus | 19 SECStatus |
20 CERT_FindCertExtensionByOID(CERTCertificate *cert, SECItem *oid, | 20 CERT_FindCertExtensionByOID(CERTCertificate *cert, SECItem *oid, |
21 SECItem *value) | 21 SECItem *value) |
22 { | 22 { |
23 return (cert_FindExtensionByOID (cert->extensions, oid, value)); | 23 return (cert_FindExtensionByOID (cert->extensions, oid, value)); |
24 } | 24 } |
25 | 25 |
26 | 26 |
27 SECStatus | 27 SECStatus |
28 CERT_FindCertExtension(CERTCertificate *cert, int tag, SECItem *value) | 28 CERT_FindCertExtension(const CERTCertificate *cert, int tag, SECItem *value) |
29 { | 29 { |
30 return (cert_FindExtension (cert->extensions, tag, value)); | 30 return (cert_FindExtension (cert->extensions, tag, value)); |
31 } | 31 } |
32 | 32 |
33 static void | 33 static void |
34 SetExts(void *object, CERTCertExtension **exts) | 34 SetExts(void *object, CERTCertExtension **exts) |
35 { | 35 { |
36 CERTCertificate *cert = (CERTCertificate *)object; | 36 CERTCertificate *cert = (CERTCertificate *)object; |
37 | 37 |
38 cert->extensions = exts; | 38 cert->extensions = exts; |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 if (rv == SECFailure) { | 358 if (rv == SECFailure) { |
359 rv = (PORT_GetError () == SEC_ERROR_EXTENSION_NOT_FOUND) ? | 359 rv = (PORT_GetError () == SEC_ERROR_EXTENSION_NOT_FOUND) ? |
360 SECSuccess : SECFailure; | 360 SECSuccess : SECFailure; |
361 } else if (!(keyUsage.data[0] & usage)) { | 361 } else if (!(keyUsage.data[0] & usage)) { |
362 PORT_SetError (SEC_ERROR_CERT_USAGES_INVALID); | 362 PORT_SetError (SEC_ERROR_CERT_USAGES_INVALID); |
363 rv = SECFailure; | 363 rv = SECFailure; |
364 } | 364 } |
365 PORT_Free (keyUsage.data); | 365 PORT_Free (keyUsage.data); |
366 return (rv); | 366 return (rv); |
367 } | 367 } |
OLD | NEW |