OLD | NEW |
1 /* v3_pcons.c */ | 1 /* v3_pcons.c */ |
2 /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 * project. | 3 * project. |
4 */ | 4 */ |
5 /* ==================================================================== | 5 /* ==================================================================== |
6 * Copyright (c) 2003 The OpenSSL Project. All rights reserved. | 6 * Copyright (c) 2003 The OpenSSL Project. All rights reserved. |
7 * | 7 * |
8 * Redistribution and use in source and binary forms, with or without | 8 * Redistribution and use in source and binary forms, with or without |
9 * modification, are permitted provided that the following conditions | 9 * modification, are permitted provided that the following conditions |
10 * are met: | 10 * are met: |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 */ | 57 */ |
58 | 58 |
59 | 59 |
60 #include <stdio.h> | 60 #include <stdio.h> |
61 #include "cryptlib.h" | 61 #include "cryptlib.h" |
62 #include <openssl/asn1.h> | 62 #include <openssl/asn1.h> |
63 #include <openssl/asn1t.h> | 63 #include <openssl/asn1t.h> |
64 #include <openssl/conf.h> | 64 #include <openssl/conf.h> |
65 #include <openssl/x509v3.h> | 65 #include <openssl/x509v3.h> |
66 | 66 |
67 static STACK_OF(CONF_VALUE) *i2v_POLICY_CONSTRAINTS(X509V3_EXT_METHOD *method, | 67 static STACK_OF(CONF_VALUE) * |
68 » » » » void *bcons, STACK_OF(CONF_VALUE) *extlist); | 68 i2v_POLICY_CONSTRAINTS(const X509V3_EXT_METHOD *method, void *bcons, |
69 static void *v2i_POLICY_CONSTRAINTS(X509V3_EXT_METHOD *method, | 69 » » STACK_OF(CONF_VALUE) *extlist); |
70 » » » » X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *values); | 70 static void *v2i_POLICY_CONSTRAINTS(const X509V3_EXT_METHOD *method, |
| 71 » » » » X509V3_CTX *ctx, |
| 72 » » » » STACK_OF(CONF_VALUE) *values); |
71 | 73 |
72 const X509V3_EXT_METHOD v3_policy_constraints = { | 74 const X509V3_EXT_METHOD v3_policy_constraints = { |
73 NID_policy_constraints, 0, | 75 NID_policy_constraints, 0, |
74 ASN1_ITEM_ref(POLICY_CONSTRAINTS), | 76 ASN1_ITEM_ref(POLICY_CONSTRAINTS), |
75 0,0,0,0, | 77 0,0,0,0, |
76 0,0, | 78 0,0, |
77 i2v_POLICY_CONSTRAINTS, | 79 i2v_POLICY_CONSTRAINTS, |
78 v2i_POLICY_CONSTRAINTS, | 80 v2i_POLICY_CONSTRAINTS, |
79 NULL,NULL, | 81 NULL,NULL, |
80 NULL | 82 NULL |
81 }; | 83 }; |
82 | 84 |
83 ASN1_SEQUENCE(POLICY_CONSTRAINTS) = { | 85 ASN1_SEQUENCE(POLICY_CONSTRAINTS) = { |
84 ASN1_IMP_OPT(POLICY_CONSTRAINTS, requireExplicitPolicy, ASN1_INTEGER,0), | 86 ASN1_IMP_OPT(POLICY_CONSTRAINTS, requireExplicitPolicy, ASN1_INTEGER,0), |
85 ASN1_IMP_OPT(POLICY_CONSTRAINTS, inhibitPolicyMapping, ASN1_INTEGER,1) | 87 ASN1_IMP_OPT(POLICY_CONSTRAINTS, inhibitPolicyMapping, ASN1_INTEGER,1) |
86 } ASN1_SEQUENCE_END(POLICY_CONSTRAINTS) | 88 } ASN1_SEQUENCE_END(POLICY_CONSTRAINTS) |
87 | 89 |
88 IMPLEMENT_ASN1_ALLOC_FUNCTIONS(POLICY_CONSTRAINTS) | 90 IMPLEMENT_ASN1_ALLOC_FUNCTIONS(POLICY_CONSTRAINTS) |
89 | 91 |
90 | 92 |
91 static STACK_OF(CONF_VALUE) *i2v_POLICY_CONSTRAINTS(X509V3_EXT_METHOD *method, | 93 static STACK_OF(CONF_VALUE) * |
92 » void *a, STACK_OF(CONF_VALUE) *extlist) | 94 i2v_POLICY_CONSTRAINTS(const X509V3_EXT_METHOD *method, void *a, |
| 95 » » STACK_OF(CONF_VALUE) *extlist) |
93 { | 96 { |
94 POLICY_CONSTRAINTS *pcons = a; | 97 POLICY_CONSTRAINTS *pcons = a; |
95 X509V3_add_value_int("Require Explicit Policy", | 98 X509V3_add_value_int("Require Explicit Policy", |
96 pcons->requireExplicitPolicy, &extlist); | 99 pcons->requireExplicitPolicy, &extlist); |
97 X509V3_add_value_int("Inhibit Policy Mapping", | 100 X509V3_add_value_int("Inhibit Policy Mapping", |
98 pcons->inhibitPolicyMapping, &extlist); | 101 pcons->inhibitPolicyMapping, &extlist); |
99 return extlist; | 102 return extlist; |
100 } | 103 } |
101 | 104 |
102 static void *v2i_POLICY_CONSTRAINTS(X509V3_EXT_METHOD *method, | 105 static void *v2i_POLICY_CONSTRAINTS(const X509V3_EXT_METHOD *method, |
103 » X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *values) | 106 » » » » X509V3_CTX *ctx, |
| 107 » » » » STACK_OF(CONF_VALUE) *values) |
104 { | 108 { |
105 POLICY_CONSTRAINTS *pcons=NULL; | 109 POLICY_CONSTRAINTS *pcons=NULL; |
106 CONF_VALUE *val; | 110 CONF_VALUE *val; |
107 int i; | 111 int i; |
108 if(!(pcons = POLICY_CONSTRAINTS_new())) { | 112 if(!(pcons = POLICY_CONSTRAINTS_new())) { |
109 X509V3err(X509V3_F_V2I_POLICY_CONSTRAINTS, ERR_R_MALLOC_FAILURE)
; | 113 X509V3err(X509V3_F_V2I_POLICY_CONSTRAINTS, ERR_R_MALLOC_FAILURE)
; |
110 return NULL; | 114 return NULL; |
111 } | 115 } |
112 for(i = 0; i < sk_CONF_VALUE_num(values); i++) { | 116 for(i = 0; i < sk_CONF_VALUE_num(values); i++) { |
113 val = sk_CONF_VALUE_value(values, i); | 117 val = sk_CONF_VALUE_value(values, i); |
(...skipping 13 matching lines...) Expand all Loading... |
127 X509V3err(X509V3_F_V2I_POLICY_CONSTRAINTS, X509V3_R_ILLEGAL_EMPT
Y_EXTENSION); | 131 X509V3err(X509V3_F_V2I_POLICY_CONSTRAINTS, X509V3_R_ILLEGAL_EMPT
Y_EXTENSION); |
128 goto err; | 132 goto err; |
129 } | 133 } |
130 | 134 |
131 return pcons; | 135 return pcons; |
132 err: | 136 err: |
133 POLICY_CONSTRAINTS_free(pcons); | 137 POLICY_CONSTRAINTS_free(pcons); |
134 return NULL; | 138 return NULL; |
135 } | 139 } |
136 | 140 |
OLD | NEW |