diff options
Diffstat (limited to 'src/lib/libcrypto/x509/x509_ia5.c')
-rw-r--r-- | src/lib/libcrypto/x509/x509_ia5.c | 290 |
1 files changed, 160 insertions, 130 deletions
diff --git a/src/lib/libcrypto/x509/x509_ia5.c b/src/lib/libcrypto/x509/x509_ia5.c index 4113c3d3b3..4f62a9134c 100644 --- a/src/lib/libcrypto/x509/x509_ia5.c +++ b/src/lib/libcrypto/x509/x509_ia5.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: x509_ia5.c,v 1.1 2020/06/04 15:19:31 jsing Exp $ */ | 1 | /* $OpenBSD: x509_ia5.c,v 1.2 2024/07/13 15:08:58 tb Exp $ */ |
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 1999. | 3 | * project 1999. |
4 | */ | 4 | */ |
@@ -68,137 +68,167 @@ static char *i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method, ASN1_IA5STRING *ia5); | |||
68 | static ASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method, | 68 | static ASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method, |
69 | X509V3_CTX *ctx, char *str); | 69 | X509V3_CTX *ctx, char *str); |
70 | 70 | ||
71 | const X509V3_EXT_METHOD v3_ns_ia5_list[] = { | 71 | static const X509V3_EXT_METHOD x509v3_ext_netscape_base_url = { |
72 | { | 72 | .ext_nid = NID_netscape_base_url, |
73 | .ext_nid = NID_netscape_base_url, | 73 | .ext_flags = 0, |
74 | .ext_flags = 0, | 74 | .it = &ASN1_IA5STRING_it, |
75 | .it = &ASN1_IA5STRING_it, | 75 | .ext_new = NULL, |
76 | .ext_new = NULL, | 76 | .ext_free = NULL, |
77 | .ext_free = NULL, | 77 | .d2i = NULL, |
78 | .d2i = NULL, | 78 | .i2d = NULL, |
79 | .i2d = NULL, | 79 | .i2s = (X509V3_EXT_I2S)i2s_ASN1_IA5STRING, |
80 | .i2s = (X509V3_EXT_I2S)i2s_ASN1_IA5STRING, | 80 | .s2i = (X509V3_EXT_S2I)s2i_ASN1_IA5STRING, |
81 | .s2i = (X509V3_EXT_S2I)s2i_ASN1_IA5STRING, | 81 | .i2v = NULL, |
82 | .i2v = NULL, | 82 | .v2i = NULL, |
83 | .v2i = NULL, | 83 | .i2r = NULL, |
84 | .i2r = NULL, | 84 | .r2i = NULL, |
85 | .r2i = NULL, | 85 | .usr_data = NULL, |
86 | .usr_data = NULL, | ||
87 | }, | ||
88 | { | ||
89 | .ext_nid = NID_netscape_revocation_url, | ||
90 | .ext_flags = 0, | ||
91 | .it = &ASN1_IA5STRING_it, | ||
92 | .ext_new = NULL, | ||
93 | .ext_free = NULL, | ||
94 | .d2i = NULL, | ||
95 | .i2d = NULL, | ||
96 | .i2s = (X509V3_EXT_I2S)i2s_ASN1_IA5STRING, | ||
97 | .s2i = (X509V3_EXT_S2I)s2i_ASN1_IA5STRING, | ||
98 | .i2v = NULL, | ||
99 | .v2i = NULL, | ||
100 | .i2r = NULL, | ||
101 | .r2i = NULL, | ||
102 | .usr_data = NULL, | ||
103 | }, | ||
104 | { | ||
105 | .ext_nid = NID_netscape_ca_revocation_url, | ||
106 | .ext_flags = 0, | ||
107 | .it = &ASN1_IA5STRING_it, | ||
108 | .ext_new = NULL, | ||
109 | .ext_free = NULL, | ||
110 | .d2i = NULL, | ||
111 | .i2d = NULL, | ||
112 | .i2s = (X509V3_EXT_I2S)i2s_ASN1_IA5STRING, | ||
113 | .s2i = (X509V3_EXT_S2I)s2i_ASN1_IA5STRING, | ||
114 | .i2v = NULL, | ||
115 | .v2i = NULL, | ||
116 | .i2r = NULL, | ||
117 | .r2i = NULL, | ||
118 | .usr_data = NULL, | ||
119 | }, | ||
120 | { | ||
121 | .ext_nid = NID_netscape_renewal_url, | ||
122 | .ext_flags = 0, | ||
123 | .it = &ASN1_IA5STRING_it, | ||
124 | .ext_new = NULL, | ||
125 | .ext_free = NULL, | ||
126 | .d2i = NULL, | ||
127 | .i2d = NULL, | ||
128 | .i2s = (X509V3_EXT_I2S)i2s_ASN1_IA5STRING, | ||
129 | .s2i = (X509V3_EXT_S2I)s2i_ASN1_IA5STRING, | ||
130 | .i2v = NULL, | ||
131 | .v2i = NULL, | ||
132 | .i2r = NULL, | ||
133 | .r2i = NULL, | ||
134 | .usr_data = NULL, | ||
135 | }, | ||
136 | { | ||
137 | .ext_nid = NID_netscape_ca_policy_url, | ||
138 | .ext_flags = 0, | ||
139 | .it = &ASN1_IA5STRING_it, | ||
140 | .ext_new = NULL, | ||
141 | .ext_free = NULL, | ||
142 | .d2i = NULL, | ||
143 | .i2d = NULL, | ||
144 | .i2s = (X509V3_EXT_I2S)i2s_ASN1_IA5STRING, | ||
145 | .s2i = (X509V3_EXT_S2I)s2i_ASN1_IA5STRING, | ||
146 | .i2v = NULL, | ||
147 | .v2i = NULL, | ||
148 | .i2r = NULL, | ||
149 | .r2i = NULL, | ||
150 | .usr_data = NULL, | ||
151 | }, | ||
152 | { | ||
153 | .ext_nid = NID_netscape_ssl_server_name, | ||
154 | .ext_flags = 0, | ||
155 | .it = &ASN1_IA5STRING_it, | ||
156 | .ext_new = NULL, | ||
157 | .ext_free = NULL, | ||
158 | .d2i = NULL, | ||
159 | .i2d = NULL, | ||
160 | .i2s = (X509V3_EXT_I2S)i2s_ASN1_IA5STRING, | ||
161 | .s2i = (X509V3_EXT_S2I)s2i_ASN1_IA5STRING, | ||
162 | .i2v = NULL, | ||
163 | .v2i = NULL, | ||
164 | .i2r = NULL, | ||
165 | .r2i = NULL, | ||
166 | .usr_data = NULL, | ||
167 | }, | ||
168 | { | ||
169 | .ext_nid = NID_netscape_comment, | ||
170 | .ext_flags = 0, | ||
171 | .it = &ASN1_IA5STRING_it, | ||
172 | .ext_new = NULL, | ||
173 | .ext_free = NULL, | ||
174 | .d2i = NULL, | ||
175 | .i2d = NULL, | ||
176 | .i2s = (X509V3_EXT_I2S)i2s_ASN1_IA5STRING, | ||
177 | .s2i = (X509V3_EXT_S2I)s2i_ASN1_IA5STRING, | ||
178 | .i2v = NULL, | ||
179 | .v2i = NULL, | ||
180 | .i2r = NULL, | ||
181 | .r2i = NULL, | ||
182 | .usr_data = NULL, | ||
183 | }, | ||
184 | { | ||
185 | .ext_nid = -1, | ||
186 | .ext_flags = 0, | ||
187 | .it = NULL, | ||
188 | .ext_new = NULL, | ||
189 | .ext_free = NULL, | ||
190 | .d2i = NULL, | ||
191 | .i2d = NULL, | ||
192 | .i2s = NULL, | ||
193 | .s2i = NULL, | ||
194 | .i2v = NULL, | ||
195 | .v2i = NULL, | ||
196 | .i2r = NULL, | ||
197 | .r2i = NULL, | ||
198 | .usr_data = NULL, | ||
199 | }, | ||
200 | }; | 86 | }; |
201 | 87 | ||
88 | const X509V3_EXT_METHOD * | ||
89 | x509v3_ext_method_netscape_base_url(void) | ||
90 | { | ||
91 | return &x509v3_ext_netscape_base_url; | ||
92 | } | ||
93 | |||
94 | static const X509V3_EXT_METHOD x509v3_ext_netscape_revocation_url = { | ||
95 | .ext_nid = NID_netscape_revocation_url, | ||
96 | .ext_flags = 0, | ||
97 | .it = &ASN1_IA5STRING_it, | ||
98 | .ext_new = NULL, | ||
99 | .ext_free = NULL, | ||
100 | .d2i = NULL, | ||
101 | .i2d = NULL, | ||
102 | .i2s = (X509V3_EXT_I2S)i2s_ASN1_IA5STRING, | ||
103 | .s2i = (X509V3_EXT_S2I)s2i_ASN1_IA5STRING, | ||
104 | .i2v = NULL, | ||
105 | .v2i = NULL, | ||
106 | .i2r = NULL, | ||
107 | .r2i = NULL, | ||
108 | .usr_data = NULL, | ||
109 | }; | ||
110 | |||
111 | const X509V3_EXT_METHOD * | ||
112 | x509v3_ext_method_netscape_revocation_url(void) | ||
113 | { | ||
114 | return &x509v3_ext_netscape_revocation_url; | ||
115 | } | ||
116 | |||
117 | static const X509V3_EXT_METHOD x509v3_ext_netscape_ca_revocation_url = { | ||
118 | .ext_nid = NID_netscape_ca_revocation_url, | ||
119 | .ext_flags = 0, | ||
120 | .it = &ASN1_IA5STRING_it, | ||
121 | .ext_new = NULL, | ||
122 | .ext_free = NULL, | ||
123 | .d2i = NULL, | ||
124 | .i2d = NULL, | ||
125 | .i2s = (X509V3_EXT_I2S)i2s_ASN1_IA5STRING, | ||
126 | .s2i = (X509V3_EXT_S2I)s2i_ASN1_IA5STRING, | ||
127 | .i2v = NULL, | ||
128 | .v2i = NULL, | ||
129 | .i2r = NULL, | ||
130 | .r2i = NULL, | ||
131 | .usr_data = NULL, | ||
132 | }; | ||
133 | |||
134 | const X509V3_EXT_METHOD * | ||
135 | x509v3_ext_method_netscape_ca_revocation_url(void) | ||
136 | { | ||
137 | return &x509v3_ext_netscape_ca_revocation_url; | ||
138 | } | ||
139 | |||
140 | static const X509V3_EXT_METHOD x509v3_ext_netscape_renewal_url = { | ||
141 | .ext_nid = NID_netscape_renewal_url, | ||
142 | .ext_flags = 0, | ||
143 | .it = &ASN1_IA5STRING_it, | ||
144 | .ext_new = NULL, | ||
145 | .ext_free = NULL, | ||
146 | .d2i = NULL, | ||
147 | .i2d = NULL, | ||
148 | .i2s = (X509V3_EXT_I2S)i2s_ASN1_IA5STRING, | ||
149 | .s2i = (X509V3_EXT_S2I)s2i_ASN1_IA5STRING, | ||
150 | .i2v = NULL, | ||
151 | .v2i = NULL, | ||
152 | .i2r = NULL, | ||
153 | .r2i = NULL, | ||
154 | .usr_data = NULL, | ||
155 | }; | ||
156 | |||
157 | const X509V3_EXT_METHOD * | ||
158 | x509v3_ext_method_netscape_renewal_url(void) | ||
159 | { | ||
160 | return &x509v3_ext_netscape_renewal_url; | ||
161 | } | ||
162 | |||
163 | static const X509V3_EXT_METHOD x509v3_ext_netscape_ca_policy_url = { | ||
164 | .ext_nid = NID_netscape_ca_policy_url, | ||
165 | .ext_flags = 0, | ||
166 | .it = &ASN1_IA5STRING_it, | ||
167 | .ext_new = NULL, | ||
168 | .ext_free = NULL, | ||
169 | .d2i = NULL, | ||
170 | .i2d = NULL, | ||
171 | .i2s = (X509V3_EXT_I2S)i2s_ASN1_IA5STRING, | ||
172 | .s2i = (X509V3_EXT_S2I)s2i_ASN1_IA5STRING, | ||
173 | .i2v = NULL, | ||
174 | .v2i = NULL, | ||
175 | .i2r = NULL, | ||
176 | .r2i = NULL, | ||
177 | .usr_data = NULL, | ||
178 | }; | ||
179 | |||
180 | const X509V3_EXT_METHOD * | ||
181 | x509v3_ext_method_netscape_ca_policy_url(void) | ||
182 | { | ||
183 | return &x509v3_ext_netscape_ca_policy_url; | ||
184 | } | ||
185 | |||
186 | static const X509V3_EXT_METHOD x509v3_ext_netscape_ssl_server_name = { | ||
187 | .ext_nid = NID_netscape_ssl_server_name, | ||
188 | .ext_flags = 0, | ||
189 | .it = &ASN1_IA5STRING_it, | ||
190 | .ext_new = NULL, | ||
191 | .ext_free = NULL, | ||
192 | .d2i = NULL, | ||
193 | .i2d = NULL, | ||
194 | .i2s = (X509V3_EXT_I2S)i2s_ASN1_IA5STRING, | ||
195 | .s2i = (X509V3_EXT_S2I)s2i_ASN1_IA5STRING, | ||
196 | .i2v = NULL, | ||
197 | .v2i = NULL, | ||
198 | .i2r = NULL, | ||
199 | .r2i = NULL, | ||
200 | .usr_data = NULL, | ||
201 | }; | ||
202 | |||
203 | const X509V3_EXT_METHOD * | ||
204 | x509v3_ext_method_netscape_ssl_server_name(void) | ||
205 | { | ||
206 | return &x509v3_ext_netscape_ssl_server_name; | ||
207 | } | ||
208 | |||
209 | static const X509V3_EXT_METHOD x509v3_ext_netscape_comment = { | ||
210 | .ext_nid = NID_netscape_comment, | ||
211 | .ext_flags = 0, | ||
212 | .it = &ASN1_IA5STRING_it, | ||
213 | .ext_new = NULL, | ||
214 | .ext_free = NULL, | ||
215 | .d2i = NULL, | ||
216 | .i2d = NULL, | ||
217 | .i2s = (X509V3_EXT_I2S)i2s_ASN1_IA5STRING, | ||
218 | .s2i = (X509V3_EXT_S2I)s2i_ASN1_IA5STRING, | ||
219 | .i2v = NULL, | ||
220 | .v2i = NULL, | ||
221 | .i2r = NULL, | ||
222 | .r2i = NULL, | ||
223 | .usr_data = NULL, | ||
224 | }; | ||
225 | |||
226 | const X509V3_EXT_METHOD * | ||
227 | x509v3_ext_method_netscape_comment(void) | ||
228 | { | ||
229 | return &x509v3_ext_netscape_comment; | ||
230 | } | ||
231 | |||
202 | static char * | 232 | static char * |
203 | i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method, ASN1_IA5STRING *ia5) | 233 | i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method, ASN1_IA5STRING *ia5) |
204 | { | 234 | { |