aboutsummaryrefslogtreecommitdiffstats
path: root/libasn1fix
diff options
context:
space:
mode:
authorLev Walkin <vlm@lionet.info>2004-09-15 11:48:34 +0000
committerLev Walkin <vlm@lionet.info>2004-09-15 11:48:34 +0000
commitd43915b70cc0fc06992623288f91cf65b47863fa (patch)
tree62530748fbd278486b6c45a821aebaaa4af48f03 /libasn1fix
parentd24c62dec6c8dcf62068d994abfc5f66ac46bd89 (diff)
condition on non-tagged root and tagged extensions is only valid when automatic tags is in effect; also go into CHOICE or type only when it is untagged
Diffstat (limited to 'libasn1fix')
-rw-r--r--libasn1fix/asn1fix_constr.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/libasn1fix/asn1fix_constr.c b/libasn1fix/asn1fix_constr.c
index 7a45cd97..66e7450e 100644
--- a/libasn1fix/asn1fix_constr.c
+++ b/libasn1fix/asn1fix_constr.c
@@ -229,16 +229,19 @@ asn1f_fix_constr_tag(arg_t *arg, int fix_top_level) {
}
- if(ext_tagged && !root_tagged) {
- FATAL("In %s at line %d: "
- "extensions are tagged "
- "but root components are not",
- expr->Identifier, expr->_lineno);
- r_value = -1;
- } else if(!root_tagged && !ext_tagged
- && (arg->mod->module_flags & MSF_AUTOMATIC_TAGS)) {
- /* Make a decision on automatic tagging */
- expr->auto_tags_OK = 1;
+ if((arg->mod->module_flags & MSF_AUTOMATIC_TAGS)
+ && !root_tagged) {
+ if(ext_tagged) {
+ /* X.690: 28.4 */
+ FATAL("In %s at line %d: "
+ "extensions are tagged "
+ "but root components are not",
+ expr->Identifier, expr->_lineno);
+ r_value = -1;
+ } else {
+ /* Make a decision on automatic tagging */
+ expr->auto_tags_OK = 1;
+ }
}
return r_value;
@@ -349,13 +352,13 @@ asn1f_check_constr_tags_distinct(arg_t *arg) {
* For SET and CHOICE treat everything as a big set of
* non-mandatory components.
*/
- if(expr->expr_type != ASN_CONSTR_SEQUENCE || v->marker) {
+ if(expr->expr_type != ASN_CONSTR_SEQUENCE || v->marker.flags) {
asn1p_expr_t *nv;
for(nv = v; (nv = TQ_NEXT(nv, next));) {
if(_asn1f_compare_tags(arg, v, nv))
r_value = -1;
if(expr->expr_type == ASN_CONSTR_SEQUENCE
- && !nv->marker) break;
+ && !nv->marker.flags) break;
}
}
}
@@ -421,8 +424,10 @@ _asn1f_compare_tags(arg_t *arg, asn1p_expr_t *a, asn1p_expr_t *b) {
) {
char *p = (a->expr_type == A1TC_EXTENSIBLE)
?"potentially ":"";
- FATAL("Component \"%s\" at line %d %shas the same tag "
+ FATAL("Processing %s at line %d: component \"%s\" at line %d %shas the same tag "
"with component \"%s\" at line %d",
+ arg->expr->Identifier,
+ arg->expr->_lineno,
a->Identifier,
a->_lineno,
p,
@@ -454,7 +459,7 @@ _asn1f_compare_tags(arg_t *arg, asn1p_expr_t *a, asn1p_expr_t *b) {
a->Identifier, a->expr_type,
b->Identifier, b->expr_type);
- if(a->meta_type == AMT_TYPEREF) {
+ if(ra && a->meta_type == AMT_TYPEREF) {
DEBUG(" %s is a type reference", a->Identifier);
@@ -464,7 +469,7 @@ _asn1f_compare_tags(arg_t *arg, asn1p_expr_t *a, asn1p_expr_t *b) {
return ret;
}
- if(a->expr_type == ASN_CONSTR_CHOICE) {
+ if(ra && a->expr_type == ASN_CONSTR_CHOICE) {
asn1p_expr_t *v;
DEBUG(" %s is a choice type (%d)", a->Identifier, a->_mark);
@@ -482,7 +487,7 @@ _asn1f_compare_tags(arg_t *arg, asn1p_expr_t *a, asn1p_expr_t *b) {
return 0;
}
- if(b->expr_type == ASN_CONSTR_CHOICE) {
+ if(rb && b->expr_type == ASN_CONSTR_CHOICE) {
return _asn1f_compare_tags(arg, b, a);
}