summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2012-11-24 09:07:41 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2012-11-24 09:07:41 +0100
commit435b15341e5aed9fe0f936d87a88bca31678458d (patch)
tree8cd6f62d5682b1ad4a7d273bce0a6475fd2f1e13 /lib
parent57e61a0d130b4bae6331c2412f87c45fcd540af2 (diff)
downloadlibtasn1-435b15341e5aed9fe0f936d87a88bca31678458d.tar.gz
libtasn1-435b15341e5aed9fe0f936d87a88bca31678458d.tar.bz2
libtasn1-435b15341e5aed9fe0f936d87a88bca31678458d.zip
updates in ETYPE_OK
Diffstat (limited to 'lib')
-rw-r--r--lib/coding.c1
-rw-r--r--lib/int.h4
-rw-r--r--lib/libtasn1.h1
3 files changed, 4 insertions, 2 deletions
diff --git a/lib/coding.c b/lib/coding.c
index aa777f3..5c1a58b 100644
--- a/lib/coding.c
+++ b/lib/coding.c
@@ -215,7 +215,6 @@ asn1_encode_simple_der (unsigned int etype, const unsigned char *str, unsigned i
if (ETYPE_OK(etype) == 0)
return ASN1_VALUE_NOT_VALID;
-
_asn1_tag_der (ETYPE_CLASS(etype), ETYPE_TAG(etype),
der_tag, &tag_len);
diff --git a/lib/int.h b/lib/int.h
index 9400cb8..072e0c6 100644
--- a/lib/int.h
+++ b/lib/int.h
@@ -89,7 +89,9 @@ typedef struct tag_and_class_st {
#define ETYPE_TAG(etype) (_asn1_tags[etype].tag)
#define ETYPE_CLASS(etype) (_asn1_tags[etype].class)
-#define ETYPE_OK(etype) ((etype <= _asn1_tags_size)?1:0)
+#define ETYPE_OK(etype) ((etype != ASN1_ETYPE_INVALID && \
+ etype <= _asn1_tags_size && \
+ _asn1_tags[etype].desc != NULL)?1:0)
extern unsigned int _asn1_tags_size;
extern const tag_and_class_st _asn1_tags[];
diff --git a/lib/libtasn1.h b/lib/libtasn1.h
index 59c3093..403ee80 100644
--- a/lib/libtasn1.h
+++ b/lib/libtasn1.h
@@ -135,6 +135,7 @@ extern "C"
typedef struct asn1_static_node_st asn1_static_node;
/* List of constants for field type of node_asn */
+#define ASN1_ETYPE_INVALID 0
#define ASN1_ETYPE_CONSTANT 1
#define ASN1_ETYPE_IDENTIFIER 2
#define ASN1_ETYPE_INTEGER 3