diff options
Diffstat (limited to 'src/daemon/https/x509/extensions.c')
-rw-r--r-- | src/daemon/https/x509/extensions.c | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/src/daemon/https/x509/extensions.c b/src/daemon/https/x509/extensions.c index 1835f2ae..3c2b67ec 100644 --- a/src/daemon/https/x509/extensions.c +++ b/src/daemon/https/x509/extensions.c | |||
@@ -217,59 +217,3 @@ MHD__gnutls_x509_ext_extract_keyUsage (uint16_t * keyUsage, | |||
217 | return 0; | 217 | return 0; |
218 | } | 218 | } |
219 | 219 | ||
220 | /* extract the basicConstraints from the DER encoded extension | ||
221 | */ | ||
222 | int | ||
223 | MHD__gnutls_x509_ext_extract_basicConstraints (int *CA, | ||
224 | int *pathLenConstraint, | ||
225 | opaque * extnValue, | ||
226 | int extnValueLen) | ||
227 | { | ||
228 | ASN1_TYPE ext = ASN1_TYPE_EMPTY; | ||
229 | char str[128]; | ||
230 | int len, result; | ||
231 | |||
232 | if ((result = MHD__asn1_create_element | ||
233 | (MHD__gnutls_get_pkix (), "PKIX1.BasicConstraints", | ||
234 | &ext)) != ASN1_SUCCESS) | ||
235 | { | ||
236 | MHD_gnutls_assert (); | ||
237 | return MHD_gtls_asn2err (result); | ||
238 | } | ||
239 | |||
240 | result = MHD__asn1_der_decoding (&ext, extnValue, extnValueLen, NULL); | ||
241 | if (result != ASN1_SUCCESS) | ||
242 | { | ||
243 | MHD_gnutls_assert (); | ||
244 | MHD__asn1_delete_structure (&ext); | ||
245 | return MHD_gtls_asn2err (result); | ||
246 | } | ||
247 | |||
248 | if (pathLenConstraint) | ||
249 | { | ||
250 | result = MHD__gnutls_x509_read_uint (ext, "pathLenConstraint", | ||
251 | (unsigned int *) | ||
252 | pathLenConstraint); | ||
253 | if (result == GNUTLS_E_ASN1_ELEMENT_NOT_FOUND) | ||
254 | *pathLenConstraint = -1; | ||
255 | else if (result != GNUTLS_E_SUCCESS) | ||
256 | { | ||
257 | MHD_gnutls_assert (); | ||
258 | MHD__asn1_delete_structure (&ext); | ||
259 | return MHD_gtls_asn2err (result); | ||
260 | } | ||
261 | } | ||
262 | |||
263 | /* the default value of cA is false. | ||
264 | */ | ||
265 | len = sizeof (str) - 1; | ||
266 | result = MHD__asn1_read_value (ext, "cA", str, &len); | ||
267 | if (result == ASN1_SUCCESS && strcmp (str, "TRUE") == 0) | ||
268 | *CA = 1; | ||
269 | else | ||
270 | *CA = 0; | ||
271 | |||
272 | MHD__asn1_delete_structure (&ext); | ||
273 | |||
274 | return 0; | ||
275 | } | ||