aboutsummaryrefslogtreecommitdiffstats
path: root/libasn1fix
diff options
context:
space:
mode:
authorLev Walkin <vlm@lionet.info>2017-07-31 20:20:17 -0700
committerLev Walkin <vlm@lionet.info>2017-08-02 13:32:23 -0700
commita28cbb9f66d703a4e9047ee2777bcf67a5b00e67 (patch)
tree550bebf688da1084b2d7cfaab3e7a1a0cf1647ce /libasn1fix
parentfc4f37a5a2defba54de21997004c7c96b2437908 (diff)
add constraint debug
Diffstat (limited to 'libasn1fix')
-rw-r--r--libasn1fix/asn1fix.c3
-rw-r--r--libasn1fix/asn1fix_crange.c24
-rw-r--r--libasn1fix/asn1fix_crange.h9
3 files changed, 22 insertions, 14 deletions
diff --git a/libasn1fix/asn1fix.c b/libasn1fix/asn1fix.c
index e6af2f24..124576f2 100644
--- a/libasn1fix/asn1fix.c
+++ b/libasn1fix/asn1fix.c
@@ -448,7 +448,8 @@ asn1f_check_constraints(arg_t *arg) {
RET2RVAL(ret, rvalue);
for(i = 0; i < sizeof(test_types)/sizeof(test_types[0]); i++) {
- range = asn1constraint_compute_PER_range(
+ range = asn1constraint_compute_constraint_range(
+ arg->expr->Identifier,
etype,
arg->expr->combined_constraints,
test_types[i], 0, 0,
diff --git a/libasn1fix/asn1fix_crange.c b/libasn1fix/asn1fix_crange.c
index 907ffd6b..b38befe9 100644
--- a/libasn1fix/asn1fix_crange.c
+++ b/libasn1fix/asn1fix_crange.c
@@ -699,17 +699,21 @@ _range_canonicalize(asn1cnst_range_t *range) {
}
asn1cnst_range_t *
-asn1constraint_compute_OER_range(asn1p_expr_type_e expr_type, const asn1p_constraint_t *ct, enum asn1p_constraint_type_e type, const asn1cnst_range_t *minmax, int *exmet, enum cpr_flags cpr_flags) {
- return asn1constraint_compute_constraint_range(expr_type, ct, type, minmax, exmet, cpr_flags);
+asn1constraint_compute_OER_range(const char *dbg_name, asn1p_expr_type_e expr_type, const asn1p_constraint_t *ct, enum asn1p_constraint_type_e requested_ct_type
+, const asn1cnst_range_t *minmax, int *exmet, enum cpr_flags cpr_flags) {
+ return asn1constraint_compute_constraint_range(dbg_name, expr_type, ct, requested_ct_type, minmax, exmet, cpr_flags | CPR_strict_OER_visibility);
}
asn1cnst_range_t *
-asn1constraint_compute_PER_range(asn1p_expr_type_e expr_type, const asn1p_constraint_t *ct, enum asn1p_constraint_type_e type, const asn1cnst_range_t *minmax, int *exmet, enum cpr_flags cpr_flags) {
- return asn1constraint_compute_constraint_range(expr_type, ct, type, minmax, exmet, cpr_flags);
+asn1constraint_compute_PER_range(const char *dbg_name, asn1p_expr_type_e expr_type, const asn1p_constraint_t *ct, enum asn1p_constraint_type_e requested_ct_type
+, const asn1cnst_range_t *minmax, int *exmet, enum cpr_flags cpr_flags) {
+ if(0) return asn1constraint_compute_constraint_range(dbg_name, expr_type, ct, requested_ct_type, minmax, exmet, cpr_flags | CPR_strict_PER_visibility);
+ /* Due to pecularities of PER constraint handling, we don't enable strict PER visibility upfront here. */
+ return asn1constraint_compute_constraint_range(dbg_name, expr_type, ct, requested_ct_type, minmax, exmet, cpr_flags);
}
asn1cnst_range_t *
-asn1constraint_compute_constraint_range(asn1p_expr_type_e expr_type, const asn1p_constraint_t *ct, enum asn1p_constraint_type_e type, const asn1cnst_range_t *minmax, int *exmet, enum cpr_flags cpr_flags) {
+asn1constraint_compute_constraint_range(const char *dbg_name, asn1p_expr_type_e expr_type, const asn1p_constraint_t *ct, enum asn1p_constraint_type_e type, const asn1cnst_range_t *minmax, int *exmet, enum cpr_flags cpr_flags) {
asn1cnst_range_t *range;
asn1cnst_range_t *tmp;
asn1p_value_t *vmin;
@@ -824,7 +828,7 @@ asn1constraint_compute_constraint_range(asn1p_expr_type_e expr_type, const asn1p
return range;
}
assert(ct->el_count == 1);
- tmp = asn1constraint_compute_constraint_range(expr_type,
+ tmp = asn1constraint_compute_constraint_range(dbg_name, expr_type,
ct->elements[0], type, minmax, exmet, cpr_flags);
if(tmp) {
_range_free(range);
@@ -843,7 +847,7 @@ asn1constraint_compute_constraint_range(asn1p_expr_type_e expr_type, const asn1p
/* AND constraints, one after another. */
for(i = 0; i < ct->el_count; i++) {
- tmp = asn1constraint_compute_constraint_range(expr_type,
+ tmp = asn1constraint_compute_constraint_range(dbg_name, expr_type,
ct->elements[i], type,
ct->type==ACT_CA_SET?range:minmax, exmet,
cpr_flags);
@@ -913,7 +917,7 @@ asn1constraint_compute_constraint_range(asn1p_expr_type_e expr_type, const asn1p
*/
tmp = 0;
for(i = 0; i < ct->el_count; i++) {
- tmp = asn1constraint_compute_constraint_range(expr_type,
+ tmp = asn1constraint_compute_constraint_range(dbg_name, expr_type,
ct->elements[i], type, minmax, exmet,
cpr_flags);
if(!tmp) {
@@ -946,7 +950,7 @@ asn1constraint_compute_constraint_range(asn1p_expr_type_e expr_type, const asn1p
* Canonicalizator will do the union magic.
*/
for(; i < ct->el_count; i++) {
- tmp = asn1constraint_compute_constraint_range(expr_type,
+ tmp = asn1constraint_compute_constraint_range(dbg_name, expr_type,
ct->elements[i], type, minmax, exmet,
cpr_flags);
if(!tmp) {
@@ -1021,7 +1025,7 @@ asn1constraint_compute_constraint_range(asn1p_expr_type_e expr_type, const asn1p
*/
assert(ct->el_count >= 1);
_range_free(range);
- range = asn1constraint_compute_constraint_range(expr_type,
+ range = asn1constraint_compute_constraint_range(dbg_name, expr_type,
ct->elements[0], type, minmax, exmet, cpr_flags);
return range;
default:
diff --git a/libasn1fix/asn1fix_crange.h b/libasn1fix/asn1fix_crange.h
index 5c2fad0a..a539508e 100644
--- a/libasn1fix/asn1fix_crange.h
+++ b/libasn1fix/asn1fix_crange.h
@@ -45,20 +45,23 @@ enum cpr_flags {
CPR_strict_PER_visibility = 0x02,
CPR_simulate_fbless_SIZE = 0x04,
};
-asn1cnst_range_t *asn1constraint_compute_OER_range(asn1p_expr_type_e expr_type,
+asn1cnst_range_t *asn1constraint_compute_OER_range(const char *dbg_name,
+ asn1p_expr_type_e expr_type,
const asn1p_constraint_t *ct,
enum asn1p_constraint_type_e required_type,
const asn1cnst_range_t *minmax,
int *expectation_met,
enum cpr_flags);
-asn1cnst_range_t *asn1constraint_compute_PER_range(asn1p_expr_type_e expr_type,
+asn1cnst_range_t *asn1constraint_compute_PER_range(const char *dbg_name,
+ asn1p_expr_type_e expr_type,
const asn1p_constraint_t *ct,
enum asn1p_constraint_type_e required_type,
const asn1cnst_range_t *minmax,
int *expectation_met,
enum cpr_flags);
/* Base implementation */
-asn1cnst_range_t *asn1constraint_compute_constraint_range(asn1p_expr_type_e expr_type,
+asn1cnst_range_t *asn1constraint_compute_constraint_range(const char *dbg_name,
+ asn1p_expr_type_e expr_type,
const asn1p_constraint_t *ct,
enum asn1p_constraint_type_e required_type,
const asn1cnst_range_t *minmax,