diff options
author | Lev Walkin <vlm@lionet.info> | 2017-07-25 06:18:33 -0700 |
---|---|---|
committer | Lev Walkin <vlm@lionet.info> | 2017-08-02 13:32:21 -0700 |
commit | 8b6a8005e08eeca1eac541e7cd4ec8384fa4b648 (patch) | |
tree | e870c007e700d6cc7e9603b67be2170ef7d15210 /libasn1fix | |
parent | 963fd865367279ddb4560c47f547832b5e31dc73 (diff) |
account for a wider structure
Diffstat (limited to 'libasn1fix')
-rw-r--r-- | libasn1fix/asn1fix_constraint_compat.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/libasn1fix/asn1fix_constraint_compat.c b/libasn1fix/asn1fix_constraint_compat.c index 24dc24db..c2c95956 100644 --- a/libasn1fix/asn1fix_constraint_compat.c +++ b/libasn1fix/asn1fix_constraint_compat.c @@ -113,19 +113,17 @@ asn1constraint_compatible(asn1p_expr_type_e expr_type, } -#define DECL_RANGE(foo, val1, val2, pv) \ - static asn1cnst_range_t range_ ## foo = { \ - { ARE_VALUE, 0, val1 }, \ - { ARE_VALUE, 0, val2 }, \ - 0, 0, 0, 0, 0, 0, pv } +#define DECL_RANGE(foo, lb, ub, ov, pv) \ + static asn1cnst_range_t range_##foo = { \ + {ARE_VALUE, 0, lb}, {ARE_VALUE, 0, ub}, 0, 0, 0, 0, 0, 0, ov, pv} -#define DECL(foo, val1, val2) DECL_RANGE(foo, val1, val2, 0) -#define DECL_notPV(foo, val1, val2) DECL_RANGE(foo, val1, val2, 1) +#define DECL(name, lb, ub) DECL_RANGE(name, lb, ub, 0, 0) +#define DECL_notOPV(name, lb, ub) DECL_RANGE(name, lb, ub, 1, 1) asn1cnst_range_t * asn1constraint_default_alphabet(asn1p_expr_type_e expr_type) { - DECL_notPV(octstr, 0x00, 0xff); /* Not PER-visible */ - DECL_notPV(utf8, 0x00, 0x7fffffff); /* Not PER-visible */ + DECL_notOPV(octstr, 0x00, 0xff); /* Not OER- and PER-visible */ + DECL_notOPV(utf8, 0x00, 0x7fffffff); /* Not OER- and PER-visible */ DECL(bmp, 0x00, 65533); /* 64K-2 cells */ DECL(uint7, 0x00, 0x7f); DECL(uint32, 0x00, 0xffffffff); @@ -160,39 +158,39 @@ asn1constraint_default_alphabet(asn1p_expr_type_e expr_type) { static asn1cnst_range_t range_notPERVisible = { { ARE_MIN, 0, 0 }, { ARE_MAX, 0, 0 }, - 0, 0, 0, 0, 0, 0, 1 }; + 0, 0, 0, 0, 0, 0, 0, 1 }; static asn1cnst_range_t range_NumericString = { { ARE_VALUE, 0, 0x20 }, { ARE_VALUE, 0, 0x39 }, range_NumericString_array, sizeof(range_NumericString_array) /sizeof(range_NumericString_array[0]), - 0, 0, 0, 0, 0 }; + 0, 0, 0, 0, 0, 0 }; static asn1cnst_range_t range_PrintableString = { { ARE_VALUE, 0, 0x20 }, { ARE_VALUE, 0, 0x7a }, range_PrintableString_array, sizeof(range_PrintableString_array) /sizeof(range_PrintableString_array[0]), - 0, 0, 0, 0, 0 }; + 0, 0, 0, 0, 0, 0 }; static asn1cnst_range_t range_VisibleString = { { ARE_VALUE, 0, 0x20 }, { ARE_VALUE, 0, 0x7e }, - 0, 0, 0, 0, 0, 0, 0 }; + 0, 0, 0, 0, 0, 0, 0, 0 }; static asn1cnst_range_t range_UTCTime = { { ARE_VALUE, 0, 0x2b }, { ARE_VALUE, 0, 0x5a }, range_UTCTime_array, sizeof(range_UTCTime_array) /sizeof(range_UTCTime_array[0]), - 0, 0, 0, 0, 1 }; + 0, 0, 0, 0, 0, 1 }; static asn1cnst_range_t range_GeneralizedTime = { { ARE_VALUE, 0, 0x2b }, { ARE_VALUE, 0, 0x5a }, range_GeneralizedTime_array, sizeof(range_GeneralizedTime_array) /sizeof(range_GeneralizedTime_array[0]), - 0, 0, 0, 0, 1 }; + 0, 0, 0, 0, 0, 1 }; switch(expr_type) { case ASN_STRING_NumericString: @@ -210,6 +208,7 @@ asn1constraint_default_alphabet(asn1p_expr_type_e expr_type) { * X.691, #9.3.6 * Not a known-multipler character string type. */ + assert(range_utf8.not_OER_visible); assert(range_utf8.not_PER_visible); return &range_utf8; case ASN_STRING_UniversalString: |