From 16835b66d44ba35cf1b1f671de133e39d716a848 Mon Sep 17 00:00:00 2001
From: Lev Walkin <vlm@lionet.info>
Date: Sun, 22 Aug 2004 13:47:59 +0000
Subject: [PATCH] better constraint failure reporting

---
 ChangeLog                          |  1 +
 libasn1compiler/asn1c_constraint.c |  9 ++-
 skeletons/BIT_STRING.c             | 10 +--
 skeletons/GeneralizedTime.c        |  4 +-
 skeletons/IA5String.c              |  9 +--
 skeletons/NumericString.c          | 11 ++--
 skeletons/OBJECT_IDENTIFIER.c      |  8 ++-
 skeletons/PrintableString.c        | 10 +--
 skeletons/UTCTime.c                |  4 +-
 skeletons/UTF8String.c             | 14 +++--
 skeletons/VisibleString.c          | 11 ++--
 skeletons/constr_CHOICE.c          |  6 +-
 skeletons/constr_SEQUENCE.c        |  3 +-
 skeletons/constr_SET.c             |  8 ++-
 skeletons/constr_SET_OF.c          |  3 +-
 tests/19-param-OK.asn1.-P          |  6 +-
 tests/42-real-life-OK.asn1.-PR     | 15 +++--
 tests/50-constraint-OK.asn1.-P     | 99 ++++++++++++++++++++----------
 18 files changed, 146 insertions(+), 85 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6c7e05a3..0292a999 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,7 @@
 	* -t option added to asn1c to ease manual BER/CER/DER decoding.
 	* Added support COMPONENTS OF construct.
 	* Numerous parser fixes and enhancements.
+	* Better constraint failure reporting.
 
 0.8.19:	2004-Aug-18
 
diff --git a/libasn1compiler/asn1c_constraint.c b/libasn1compiler/asn1c_constraint.c
index dcbd50b3..36b27758 100644
--- a/libasn1compiler/asn1c_constraint.c
+++ b/libasn1compiler/asn1c_constraint.c
@@ -109,7 +109,8 @@ asn1c_emit_constraint_checking_code(arg_t *arg) {
 	OUT("if(!sptr) {\n");
 		INDENT(+1);
 		OUT("_ASN_ERRLOG(app_errlog, app_key,\n");
-		OUT("\t\"%%s: value not given\", td->name);\n");
+		OUT("\t\"%%s: value not given (%%s:%%d)\",\n");
+		OUT("\ttd->name, __FILE__, __LINE__);\n");
 		OUT("return -1;\n");
 		INDENT(-1);
 	OUT("}\n");
@@ -173,7 +174,8 @@ asn1c_emit_constraint_checking_code(arg_t *arg) {
 	OUT("} else {\n");
 		INDENT(+1);
 			OUT("_ASN_ERRLOG(app_errlog, app_key,\n");
-			OUT("\t\"%%s: constraint failed\", td->name);\n");
+			OUT("\t\"%%s: constraint failed (%%s:%%d)\",\n");
+			OUT("\ttd->name, __FILE__, __LINE__);\n");
 			OUT("return -1;\n");
 		INDENT(-1);
 	OUT("}\n");
@@ -542,7 +544,8 @@ emit_value_determination_code(arg_t *arg, asn1p_expr_type_e etype) {
 			OUT("if(asn1_INTEGER2long(st, &value)) {\n");
 				INDENT(+1);
 				OUT("_ASN_ERRLOG(app_errlog, app_key,\n");
-				OUT("\t\"%%s: value too large\", td->name);\n");
+				OUT("\t\"%%s: value too large (%%s:%%d)\",\n");
+				OUT("\ttd->name, __FILE__, __LINE__);\n");
 				OUT("return -1;\n");
 				INDENT(-1);
 			OUT("}\n");
diff --git a/skeletons/BIT_STRING.c b/skeletons/BIT_STRING.c
index df11c19c..bca34732 100644
--- a/skeletons/BIT_STRING.c
+++ b/skeletons/BIT_STRING.c
@@ -39,18 +39,20 @@ BIT_STRING_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 		if(st->size) {
 			if(st->size == 1 && st->buf[0] != 0) {
 				_ASN_ERRLOG(app_errlog, app_key,
-					"%s: invalid padding byte",
-					td->name);
+					"%s: invalid padding byte (%s:%d)",
+					td->name, __FILE__, __LINE__);
 				return -1;
 			}
 		} else {
 			_ASN_ERRLOG(app_errlog, app_key,
-				"%s: no padding byte", td->name);
+				"%s: no padding byte (%s:%d)",
+				td->name, __FILE__, __LINE__);
 			return -1;
 		}
 	} else {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: value not given", td->name);
+			"%s: value not given (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 
diff --git a/skeletons/GeneralizedTime.c b/skeletons/GeneralizedTime.c
index 25f2bb6e..1da113b0 100644
--- a/skeletons/GeneralizedTime.c
+++ b/skeletons/GeneralizedTime.c
@@ -107,8 +107,8 @@ GeneralizedTime_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 	tloc = asn_GT2time(st, 0, 0);
 	if(tloc == -1 && errno != EPERM) {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: Invalid time format: %s",
-			td->name, strerror(errno));
+			"%s: Invalid time format: %s (%s:%d)",
+			td->name, strerror(errno), __FILE__, __LINE__);
 		return -1;
 	}
 
diff --git a/skeletons/IA5String.c b/skeletons/IA5String.c
index a44a9d0f..e3ae82fe 100644
--- a/skeletons/IA5String.c
+++ b/skeletons/IA5String.c
@@ -43,17 +43,18 @@ IA5String_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 			if(*buf > 0x7F) {
 				_ASN_ERRLOG(app_errlog, app_key,
 					"%s: value byte %d out of range: "
-					"%d > 127",
+					"%d > 127 (%s:%d)",
 					td->name,
 					(buf - st->buf) + 1,
-					*buf
-				);
+					*buf,
+					__FILE__, __LINE__);
 				return -1;
 			}
 		}
 	} else {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: value not given", td->name);
+			"%s: value not given (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 
diff --git a/skeletons/NumericString.c b/skeletons/NumericString.c
index 6c8729ff..aba1c72b 100644
--- a/skeletons/NumericString.c
+++ b/skeletons/NumericString.c
@@ -48,17 +48,18 @@ NumericString_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 				continue;
 			}
 			_ASN_ERRLOG(app_errlog, app_key,
-				"%s: value byte %d "
-				"not in NumericString alphabet (%d)",
+				"%s: value byte %d (%d) "
+				"not in NumericString alphabet (%s:%d)",
 				td->name,
 				(buf - st->buf) + 1,
-				*buf
-			);
+				*buf,
+				__FILE__, __LINE__);
 			return -1;
 		}
 	} else {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: value not given", td->name);
+			"%s: value not given (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 
diff --git a/skeletons/OBJECT_IDENTIFIER.c b/skeletons/OBJECT_IDENTIFIER.c
index 063ae978..46191bc6 100644
--- a/skeletons/OBJECT_IDENTIFIER.c
+++ b/skeletons/OBJECT_IDENTIFIER.c
@@ -81,13 +81,15 @@ OBJECT_IDENTIFIER_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 	if(st && st->buf) {
 		if(st->size < 1) {
 			_ASN_ERRLOG(app_errlog, app_key,
-				"%s: at least one numerical value expected",
-				td->name);
+				"%s: at least one numerical value "
+				"expected (%s:%d)",
+				td->name, __FILE__, __LINE__);
 			return -1;
 		}
 	} else {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: value not given", td->name);
+			"%s: value not given (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 
diff --git a/skeletons/PrintableString.c b/skeletons/PrintableString.c
index 8f67eddf..17be2aed 100644
--- a/skeletons/PrintableString.c
+++ b/skeletons/PrintableString.c
@@ -66,18 +66,20 @@ PrintableString_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 		for(; buf < end; buf++) {
 			if(!_PrintableString_alphabet[*buf]) {
 				_ASN_ERRLOG(app_errlog, app_key,
-					"%s: value byte %d "
-					"not in PrintableString alphabet (%d)",
+					"%s: value byte %d (%d) "
+					"not in PrintableString alphabet "
+					"(%s:%d)",
 					td->name,
 					(buf - st->buf) + 1,
 					*buf
-				);
+					__FILE__, __LINE__);
 				return -1;
 			}
 		}
 	} else {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: value not given", td->name);
+			"%s: value not given (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 
diff --git a/skeletons/UTCTime.c b/skeletons/UTCTime.c
index 8b7972c0..b2ca1a66 100644
--- a/skeletons/UTCTime.c
+++ b/skeletons/UTCTime.c
@@ -48,8 +48,8 @@ UTCTime_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 	tloc = asn_UT2time(st, 0, 0);
 	if(tloc == -1 && errno != EPERM) {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: Invalid time format: %s",
-			td->name, strerror(errno));
+			"%s: Invalid time format: %s (%s:%d)",
+			td->name, strerror(errno), __FILE__, __LINE__);
 		return -1;
 	}
 
diff --git a/skeletons/UTF8String.c b/skeletons/UTF8String.c
index aab4a2e9..c96c71a4 100644
--- a/skeletons/UTF8String.c
+++ b/skeletons/UTF8String.c
@@ -63,9 +63,10 @@ UTF8String_length(const UTF8String_t *st, const char *opt_type_name,
 				if(w) {
 					_ASN_ERRLOG(app_errlog, app_key,
 						"%s: UTF-8 expectation "
-						"failed at byte %d",
+						"failed at byte %d (%s:%d)",
 						opt_type_name,
-						(buf - st->buf) + 1);
+						(buf - st->buf) + 1,
+						__FILE__, __LINE__);
 					return -1;
 				}
 				want--;
@@ -79,9 +80,10 @@ UTF8String_length(const UTF8String_t *st, const char *opt_type_name,
 				case 0:
 					_ASN_ERRLOG(app_errlog, app_key,
 						"%s: UTF-8 expectation"
-						"failed at byte %d",
+						"failed at byte %d (%s:%d)",
 						opt_type_name,
-						(buf - st->buf) + 1);
+						(buf - st->buf) + 1,
+						__FILE__, __LINE__);
 					return -1;
 				}
 				want = w - 1;	/* Expect this much */
@@ -92,8 +94,8 @@ UTF8String_length(const UTF8String_t *st, const char *opt_type_name,
 		/* If still want something, then something is wrong */
 		if(want) {
 			_ASN_ERRLOG(app_errlog, app_key,
-				"%s: truncated UTF-8 sequence",
-				opt_type_name);
+				"%s: truncated UTF-8 sequence (%s:%d)",
+				opt_type_name, __FILE__, __LINE__);
 			return -1;
 		}
 
diff --git a/skeletons/VisibleString.c b/skeletons/VisibleString.c
index aa9c99b1..d1a11dbe 100644
--- a/skeletons/VisibleString.c
+++ b/skeletons/VisibleString.c
@@ -66,18 +66,19 @@ VisibleString_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 		for(; buf < end; buf++) {
 			if(!_VisibleString_alphabet[*buf]) {
 				_ASN_ERRLOG(app_errlog, app_key,
-					"%s: value byte %d "
-					"not in VisibleString alphabet (%d)",
+					"%s: value byte %d (%d) "
+					"not in VisibleString alphabet (%s:%d)",
 					td->name,
 					(buf - st->buf) + 1,
-					*buf
-				);
+					*buf,
+					__FILE__, __LINE__);
 				return -1;
 			}
 		}
 	} else {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: value not given", td->name);
+			"%s: value not given (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 
diff --git a/skeletons/constr_CHOICE.c b/skeletons/constr_CHOICE.c
index 1f863feb..4ac71a64 100644
--- a/skeletons/constr_CHOICE.c
+++ b/skeletons/constr_CHOICE.c
@@ -481,7 +481,8 @@ CHOICE_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 
 	if(!sptr) {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: value not given", td->name);
+			"%s: value not given (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 
@@ -515,7 +516,8 @@ CHOICE_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 		}
 	} else {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: no CHOICE element given", td->name);
+			"%s: no CHOICE element given",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 }
diff --git a/skeletons/constr_SEQUENCE.c b/skeletons/constr_SEQUENCE.c
index 06ef4e83..87d5ab66 100644
--- a/skeletons/constr_SEQUENCE.c
+++ b/skeletons/constr_SEQUENCE.c
@@ -644,7 +644,8 @@ SEQUENCE_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 
 	if(!sptr) {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: value not given", td->name);
+			"%s: value not given (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 
diff --git a/skeletons/constr_SET.c b/skeletons/constr_SET.c
index d1a81beb..ba42a4ff 100644
--- a/skeletons/constr_SET.c
+++ b/skeletons/constr_SET.c
@@ -659,7 +659,8 @@ SET_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 
 	if(!sptr) {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: value not given", td->name);
+			"%s: value not given (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 
@@ -677,8 +678,9 @@ SET_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 					&(specs->_mandatory_elements), edx)) {
 					_ASN_ERRLOG(app_errlog, app_key,
 						"%s: mandatory element "
-						"%s absent",
-						td->name, elm->name);
+						"%s absent (%s:%d)",
+						td->name, elm->name,
+						__FILE__, __LINE__);
 					return -1;
 				}
 				continue;
diff --git a/skeletons/constr_SET_OF.c b/skeletons/constr_SET_OF.c
index ecf16f02..e0c898da 100644
--- a/skeletons/constr_SET_OF.c
+++ b/skeletons/constr_SET_OF.c
@@ -518,7 +518,8 @@ SET_OF_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 
 	if(!sptr) {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: value not given", td->name);
+			"%s: value not given (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 
diff --git a/tests/19-param-OK.asn1.-P b/tests/19-param-OK.asn1.-P
index b98d1ed9..c40c439c 100644
--- a/tests/19-param-OK.asn1.-P
+++ b/tests/19-param-OK.asn1.-P
@@ -261,7 +261,8 @@ memb_IA5String_1_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 	
 	if(!sptr) {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: value not given", td->name);
+			"%s: value not given (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 	
@@ -271,7 +272,8 @@ memb_IA5String_1_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 		return 0;
 	} else {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: constraint failed", td->name);
+			"%s: constraint failed (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 }
diff --git a/tests/42-real-life-OK.asn1.-PR b/tests/42-real-life-OK.asn1.-PR
index a934fff1..ad954aa0 100644
--- a/tests/42-real-life-OK.asn1.-PR
+++ b/tests/42-real-life-OK.asn1.-PR
@@ -40,7 +40,8 @@ memb_varsets_1_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 	
 	if(!sptr) {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: value not given", td->name);
+			"%s: value not given (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 	
@@ -55,7 +56,8 @@ memb_varsets_1_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 		return 0;
 	} else {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: constraint failed", td->name);
+			"%s: constraint failed (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 }
@@ -187,7 +189,8 @@ memb_vparts_2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 	
 	if(!sptr) {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: value not given", td->name);
+			"%s: value not given (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 	
@@ -347,7 +350,8 @@ memb_vset_3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 	
 	if(!sptr) {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: value not given", td->name);
+			"%s: value not given (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 	
@@ -362,7 +366,8 @@ memb_vset_3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 		return 0;
 	} else {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: constraint failed", td->name);
+			"%s: constraint failed (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 }
diff --git a/tests/50-constraint-OK.asn1.-P b/tests/50-constraint-OK.asn1.-P
index 757b1d66..059f64e3 100644
--- a/tests/50-constraint-OK.asn1.-P
+++ b/tests/50-constraint-OK.asn1.-P
@@ -128,13 +128,15 @@ Int2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 	
 	if(!sptr) {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: value not given", td->name);
+			"%s: value not given (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 	
 	if(asn1_INTEGER2long(st, &value)) {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: value too large", td->name);
+			"%s: value too large (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 	
@@ -143,7 +145,8 @@ Int2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 		return 0;
 	} else {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: constraint failed", td->name);
+			"%s: constraint failed (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 }
@@ -247,13 +250,15 @@ Int3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 	
 	if(!sptr) {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: value not given", td->name);
+			"%s: value not given (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 	
 	if(asn1_INTEGER2long(st, &value)) {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: value too large", td->name);
+			"%s: value too large (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 	
@@ -262,7 +267,8 @@ Int3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 		return 0;
 	} else {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: constraint failed", td->name);
+			"%s: constraint failed (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 }
@@ -365,7 +371,8 @@ Int4_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 	
 	if(!sptr) {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: value not given", td->name);
+			"%s: value not given (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 	
@@ -479,13 +486,15 @@ Int5_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 	
 	if(!sptr) {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: value not given", td->name);
+			"%s: value not given (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 	
 	if(asn1_INTEGER2long(st, &value)) {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: value too large", td->name);
+			"%s: value too large (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 	
@@ -494,7 +503,8 @@ Int5_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 		return 0;
 	} else {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: constraint failed", td->name);
+			"%s: constraint failed (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 }
@@ -597,7 +607,8 @@ ExtensibleExtensions_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 	
 	if(!sptr) {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: value not given", td->name);
+			"%s: value not given (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 	
@@ -827,7 +838,8 @@ Str2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 	
 	if(!sptr) {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: value not given", td->name);
+			"%s: value not given (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 	
@@ -839,7 +851,8 @@ Str2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 		return 0;
 	} else {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: constraint failed", td->name);
+			"%s: constraint failed (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 }
@@ -970,7 +983,8 @@ Str3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 	
 	if(!sptr) {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: value not given", td->name);
+			"%s: value not given (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 	
@@ -982,7 +996,8 @@ Str3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 		return 0;
 	} else {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: constraint failed", td->name);
+			"%s: constraint failed (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 }
@@ -1101,7 +1116,8 @@ PER_Visible_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 	
 	if(!sptr) {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: value not given", td->name);
+			"%s: value not given (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 	
@@ -1111,7 +1127,8 @@ PER_Visible_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 		return 0;
 	} else {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: constraint failed", td->name);
+			"%s: constraint failed (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 }
@@ -1230,7 +1247,8 @@ PER_Visible_2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 	
 	if(!sptr) {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: value not given", td->name);
+			"%s: value not given (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 	
@@ -1240,7 +1258,8 @@ PER_Visible_2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 		return 0;
 	} else {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: constraint failed", td->name);
+			"%s: constraint failed (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 }
@@ -1359,7 +1378,8 @@ Not_PER_Visible_1_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 	
 	if(!sptr) {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: value not given", td->name);
+			"%s: value not given (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 	
@@ -1369,7 +1389,8 @@ Not_PER_Visible_1_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 		return 0;
 	} else {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: constraint failed", td->name);
+			"%s: constraint failed (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 }
@@ -1472,7 +1493,8 @@ Not_PER_Visible_2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 	
 	if(!sptr) {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: value not given", td->name);
+			"%s: value not given (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 	
@@ -1585,7 +1607,8 @@ Not_PER_Visible_3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 	
 	if(!sptr) {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: value not given", td->name);
+			"%s: value not given (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 	
@@ -1715,7 +1738,8 @@ SIZE_but_not_FROM_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 	
 	if(!sptr) {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: value not given", td->name);
+			"%s: value not given (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 	
@@ -1727,7 +1751,8 @@ SIZE_but_not_FROM_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 		return 0;
 	} else {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: constraint failed", td->name);
+			"%s: constraint failed (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 }
@@ -1847,7 +1872,8 @@ SIZE_and_FROM_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 	
 	if(!sptr) {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: value not given", td->name);
+			"%s: value not given (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 	
@@ -1859,7 +1885,8 @@ SIZE_and_FROM_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 		return 0;
 	} else {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: constraint failed", td->name);
+			"%s: constraint failed (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 }
@@ -1978,7 +2005,8 @@ Neither_SIZE_nor_FROM_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 	
 	if(!sptr) {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: value not given", td->name);
+			"%s: value not given (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 	
@@ -1988,7 +2016,8 @@ Neither_SIZE_nor_FROM_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 		return 0;
 	} else {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: constraint failed", td->name);
+			"%s: constraint failed (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 }
@@ -2121,7 +2150,8 @@ Utf8_3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 	
 	if(!sptr) {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: value not given", td->name);
+			"%s: value not given (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 	
@@ -2134,7 +2164,8 @@ Utf8_3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 		return 0;
 	} else {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: constraint failed", td->name);
+			"%s: constraint failed (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 }
@@ -2238,7 +2269,8 @@ Utf8_2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 	
 	if(!sptr) {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: value not given", td->name);
+			"%s: value not given (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 	
@@ -2250,7 +2282,8 @@ Utf8_2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
 		return 0;
 	} else {
 		_ASN_ERRLOG(app_errlog, app_key,
-			"%s: constraint failed", td->name);
+			"%s: constraint failed (%s:%d)",
+			td->name, __FILE__, __LINE__);
 		return -1;
 	}
 }
-- 
GitLab