From 435b15341e5aed9fe0f936d87a88bca31678458d Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Sat, 24 Nov 2012 09:07:41 +0100 Subject: [PATCH] updates in ETYPE_OK --- lib/coding.c | 1 - lib/int.h | 4 +++- lib/libtasn1.h | 1 + 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 -- 2.7.4