int gnutls_x509_crt_get_ca_status(gnutls_x509_crt_t cert,
				  unsigned int *critical)
{
    int result;
    gnutls_datum_t basicConstraints;
    int ca;

    if (cert == NULL) {
	gnutls_assert();
	return GNUTLS_E_INVALID_REQUEST;
    }

    if ((result =
	 _gnutls_x509_crt_get_extension(cert, "2.5.29.19", 0,
					&basicConstraints,
					critical)) < 0) {
	gnutls_assert();
	return result;
    }

    if (basicConstraints.size == 0 || basicConstraints.data == NULL) {
	gnutls_assert();
	return GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE;
    }

    result =
	_gnutls_x509_ext_extract_basicConstraints(&ca,
						  basicConstraints.data,
						  basicConstraints.size);
    _gnutls_free_datum(&basicConstraints);

    if (result < 0) {
	gnutls_assert();
	return result;
    }

    return ca;
}
int gnutls_x509_crt_get_ca_status(gnutls_x509_crt_t cert,
				  unsigned int *critical)
{
    int result;
    gnutls_datum_t basicConstraints;
    int ca;

    if (cert == NULL) {
	gnutls_assert();
	return GNUTLS_E_INVALID_REQUEST;
    }

    if ((result =
	 _gnutls_x509_crt_get_extension(cert, "2.5.29.19", 0,
					&basicConstraints,
					critical)) < 0) {
	gnutls_assert();
	return result;
    }

    if (basicConstraints.size == 0 || basicConstraints.data == NULL) {
	gnutls_assert();
	return GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE;
    }

    result =
	_gnutls_x509_ext_extract_basicConstraints(&ca,
						  basicConstraints.data,
						  basicConstraints.size);
    _gnutls_free_datum(&basicConstraints);

    if (result < 0) {
	gnutls_assert();
	return result;
    }

    return ca;
}