diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2017-05-01 12:38:37 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2017-05-01 12:38:41 +0200 |
commit | 32b9e3a235c75fe2afd27c58fb8f204e5d9ccc41 (patch) | |
tree | cb791453b3b3081abd47fe6bf36e71be14d42c84 | |
parent | 4c76b0138d674864461c3c2463192149e6d66eab (diff) | |
download | libtasn1-32b9e3a235c75fe2afd27c58fb8f204e5d9ccc41.tar.gz |
Introduced error code ASN1_TIME_ENCODING_ERROR
This error code indicates an invalid encoding in the TIME
field.
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
-rw-r--r-- | lib/decoding.c | 6 | ||||
-rw-r--r-- | lib/errors.c | 1 | ||||
-rw-r--r-- | lib/libtasn1.h | 1 |
3 files changed, 5 insertions, 3 deletions
diff --git a/lib/decoding.c b/lib/decoding.c index 2abff57..fcf3aff 100644 --- a/lib/decoding.c +++ b/lib/decoding.c @@ -329,7 +329,7 @@ _asn1_get_time_der (unsigned type, const unsigned char *der, int der_len, int *r if (str_len < 8) { warn(); - return ASN1_DER_ERROR; + return ASN1_TIME_ENCODING_ERROR; } if (flags & ASN1_DECODE_FLAG_STRICT_DER) @@ -359,14 +359,14 @@ _asn1_get_time_der (unsigned type, const unsigned char *der, int der_len, int *r } warn(); - return ASN1_DER_ERROR; + return ASN1_TIME_ENCODING_ERROR; } } if (sign_count == 0 && p[str_len-1] != 'Z') { warn(); - return ASN1_DER_ERROR; + return ASN1_TIME_ENCODING_ERROR; } } memcpy (str, der + len_len, str_len); diff --git a/lib/errors.c b/lib/errors.c index e9fa302..fef45ae 100644 --- a/lib/errors.c +++ b/lib/errors.c @@ -52,6 +52,7 @@ static const libtasn1_error_entry error_algorithms[] = { LIBTASN1_ERROR_ENTRY (ASN1_NAME_TOO_LONG), LIBTASN1_ERROR_ENTRY (ASN1_ARRAY_ERROR), LIBTASN1_ERROR_ENTRY (ASN1_ELEMENT_NOT_EMPTY), + LIBTASN1_ERROR_ENTRY (ASN1_TIME_ENCODING_ERROR), {0, 0} }; diff --git a/lib/libtasn1.h b/lib/libtasn1.h index 4ad01e7..0d6203d 100644 --- a/lib/libtasn1.h +++ b/lib/libtasn1.h @@ -78,6 +78,7 @@ extern "C" #define ASN1_NAME_TOO_LONG 15 #define ASN1_ARRAY_ERROR 16 #define ASN1_ELEMENT_NOT_EMPTY 17 +#define ASN1_TIME_ENCODING_ERROR 18 /*************************************/ /* Constants used in asn1_visit_tree */ |