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

Side by Side Diff: nss/lib/certdb/xbsconst.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/xauthkid.c ('k') | nss/lib/certdb/xconst.h » ('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 v3 Basic Constraints Extension 6 * X.509 v3 Basic Constraints Extension
7 */ 7 */
8 8
9 #include "prtypes.h" 9 #include "prtypes.h"
10 #include <limits.h> /* for LONG_MAX */ 10 #include <limits.h> /* for LONG_MAX */
11 #include "seccomon.h" 11 #include "seccomon.h"
12 #include "secdert.h" 12 #include "secdert.h"
13 #include "secoidt.h" 13 #include "secoidt.h"
14 #include "secasn1t.h" 14 #include "secasn1t.h"
15 #include "secasn1.h" 15 #include "secasn1.h"
16 #include "certt.h" 16 #include "certt.h"
17 #include "secder.h" 17 #include "secder.h"
18 #include "prprf.h" 18 #include "prprf.h"
19 #include "secerr.h" 19 #include "secerr.h"
20 20
21 typedef struct EncodedContext{ 21 typedef struct EncodedContext{
22 SECItem isCA; 22 SECItem isCA;
23 SECItem pathLenConstraint; 23 SECItem pathLenConstraint;
24 SECItem encodedValue; 24 SECItem encodedValue;
25 PRArenaPool *arena; 25 PLArenaPool *arena;
26 }EncodedContext; 26 }EncodedContext;
27 27
28 static const SEC_ASN1Template CERTBasicConstraintsTemplate[] = { 28 static const SEC_ASN1Template CERTBasicConstraintsTemplate[] = {
29 { SEC_ASN1_SEQUENCE, 29 { SEC_ASN1_SEQUENCE,
30 0, NULL, sizeof(EncodedContext) }, 30 0, NULL, sizeof(EncodedContext) },
31 { SEC_ASN1_OPTIONAL | SEC_ASN1_BOOLEAN, /* XXX DER_DEFAULT */ 31 { SEC_ASN1_OPTIONAL | SEC_ASN1_BOOLEAN, /* XXX DER_DEFAULT */
32 offsetof(EncodedContext,isCA)}, 32 offsetof(EncodedContext,isCA)},
33 { SEC_ASN1_OPTIONAL | SEC_ASN1_INTEGER, 33 { SEC_ASN1_OPTIONAL | SEC_ASN1_INTEGER,
34 offsetof(EncodedContext,pathLenConstraint) }, 34 offsetof(EncodedContext,pathLenConstraint) },
35 { 0, } 35 { 0, }
36 }; 36 };
37 37
38 static unsigned char hexTrue = 0xff; 38 static unsigned char hexTrue = 0xff;
39 static unsigned char hexFalse = 0x00; 39 static unsigned char hexFalse = 0x00;
40 40
41 #define GEN_BREAK(status) rv = status; break; 41 #define GEN_BREAK(status) rv = status; break;
42 42
43 SECStatus CERT_EncodeBasicConstraintValue 43 SECStatus CERT_EncodeBasicConstraintValue
44 (PRArenaPool *arena, CERTBasicConstraints *value, SECItem *encodedValue) 44 (PLArenaPool *arena, CERTBasicConstraints *value, SECItem *encodedValue)
45 { 45 {
46 EncodedContext encodeContext; 46 EncodedContext encodeContext;
47 PRArenaPool *our_pool = NULL; 47 PLArenaPool *our_pool = NULL;
48 SECStatus rv = SECSuccess; 48 SECStatus rv = SECSuccess;
49 49
50 do { 50 do {
51 PORT_Memset (&encodeContext, 0, sizeof (encodeContext)); 51 PORT_Memset (&encodeContext, 0, sizeof (encodeContext));
52 if (!value->isCA && value->pathLenConstraint >= 0) { 52 if (!value->isCA && value->pathLenConstraint >= 0) {
53 PORT_SetError (SEC_ERROR_EXTENSION_VALUE_INVALID); 53 PORT_SetError (SEC_ERROR_EXTENSION_VALUE_INVALID);
54 GEN_BREAK (SECFailure); 54 GEN_BREAK (SECFailure);
55 } 55 }
56 56
57 encodeContext.arena = arena; 57 encodeContext.arena = arena;
(...skipping 26 matching lines...) Expand all
84 if (our_pool) 84 if (our_pool)
85 PORT_FreeArena (our_pool, PR_FALSE); 85 PORT_FreeArena (our_pool, PR_FALSE);
86 return(rv); 86 return(rv);
87 87
88 } 88 }
89 89
90 SECStatus CERT_DecodeBasicConstraintValue 90 SECStatus CERT_DecodeBasicConstraintValue
91 (CERTBasicConstraints *value, const SECItem *encodedValue) 91 (CERTBasicConstraints *value, const SECItem *encodedValue)
92 { 92 {
93 EncodedContext decodeContext; 93 EncodedContext decodeContext;
94 PRArenaPool *our_pool; 94 PLArenaPool *our_pool;
95 SECStatus rv = SECSuccess; 95 SECStatus rv = SECSuccess;
96 96
97 do { 97 do {
98 PORT_Memset (&decodeContext, 0, sizeof (decodeContext)); 98 PORT_Memset (&decodeContext, 0, sizeof (decodeContext));
99 /* initialize the value just in case we got "0x30 00", or when the 99 /* initialize the value just in case we got "0x30 00", or when the
100 pathLenConstraint is omitted. 100 pathLenConstraint is omitted.
101 */ 101 */
102 decodeContext.isCA.data =&hexFalse; 102 decodeContext.isCA.data =&hexFalse;
103 decodeContext.isCA.len = 1; 103 decodeContext.isCA.len = 1;
104 104
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 PORT_SetError (SEC_ERROR_BAD_DER); 136 PORT_SetError (SEC_ERROR_BAD_DER);
137 GEN_BREAK (SECFailure); 137 GEN_BREAK (SECFailure);
138 break; 138 break;
139 } 139 }
140 140
141 } while (0); 141 } while (0);
142 PORT_FreeArena (our_pool, PR_FALSE); 142 PORT_FreeArena (our_pool, PR_FALSE);
143 return (rv); 143 return (rv);
144 144
145 } 145 }
OLDNEW
« no previous file with comments | « nss/lib/certdb/xauthkid.c ('k') | nss/lib/certdb/xconst.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698