diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2016-07-12 14:48:14 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2016-07-12 14:48:14 +0200 |
commit | bde4ceb7cafe92fa83086b2fa84ee4516f151664 (patch) | |
tree | 1241bae54b6b818eb8e2a9ac7b95539441ba897a | |
parent | 4bfc3d836166ad1ccfa864d18b1a467065f43dc0 (diff) | |
download | gnutls-bde4ceb7cafe92fa83086b2fa84ee4516f151664.tar.gz |
libtasn1: updated to allow large OIDs to be used even on 32-bit systems
-rw-r--r-- | lib/minitasn1/coding.c | 4 | ||||
-rw-r--r-- | lib/minitasn1/decoding.c | 5 | ||||
-rw-r--r-- | lib/minitasn1/int.h | 6 | ||||
-rw-r--r-- | lib/minitasn1/parser_aux.c | 4 | ||||
-rw-r--r-- | lib/minitasn1/parser_aux.h | 2 |
5 files changed, 14 insertions, 7 deletions
diff --git a/lib/minitasn1/coding.c b/lib/minitasn1/coding.c index 66531b0fa6..7141df7b4e 100644 --- a/lib/minitasn1/coding.c +++ b/lib/minitasn1/coding.c @@ -337,7 +337,7 @@ _asn1_objectid_der (unsigned char *str, unsigned char *der, int *der_len) int len_len, counter, k, first, max_len; char *temp, *n_end, *n_start; unsigned char bit7; - unsigned long val, val1 = 0; + uint64_t val, val1 = 0; int str_len = _asn1_strlen (str); max_len = *der_len; @@ -355,7 +355,7 @@ _asn1_objectid_der (unsigned char *str, unsigned char *der, int *der_len) while ((n_end = strchr (n_start, '.'))) { *n_end = 0; - val = strtoul (n_start, NULL, 10); + val = _asn1_strtou64 (n_start, NULL, 10); counter++; if (counter == 1) diff --git a/lib/minitasn1/decoding.c b/lib/minitasn1/decoding.c index cfe2322910..2cd9ac359a 100644 --- a/lib/minitasn1/decoding.c +++ b/lib/minitasn1/decoding.c @@ -384,7 +384,8 @@ _asn1_get_time_der (unsigned type, const unsigned char *der, int der_len, int *r * @str: Pre-allocated output buffer to put the textual object id in. * @str_size: Length of pre-allocated output buffer. * - * Converts a DER encoded object identifier to its textual form. + * Converts a DER encoded object identifier to its textual form. This + * function expects the DER object identifier without the tag. * * Returns: %ASN1_SUCCESS on success, or an error. **/ @@ -395,7 +396,7 @@ asn1_get_object_id_der (const unsigned char *der, int der_len, int *ret_len, int len_len, len, k; int leading; char temp[LTOSTR_MAX_SIZE]; - unsigned long val, val1; + uint64_t val, val1; *ret_len = 0; if (str && str_size > 0) diff --git a/lib/minitasn1/int.h b/lib/minitasn1/int.h index f1f13024e4..7d2eea379c 100644 --- a/lib/minitasn1/int.h +++ b/lib/minitasn1/int.h @@ -118,6 +118,12 @@ extern const tag_and_class_st _asn1_tags[]; #define _asn1_strcpy(a,b) strcpy((char *)a, (const char *)b) #define _asn1_strcat(a,b) strcat((char *)a, (const char *)b) +#if SIZEOF_UNSIGNED_LONG_INT == 8 +# define _asn1_strtou64(n,e,b) strtoul((const char *) n, e, b) +#else +# define _asn1_strtou64(n,e,b) strtoull((const char *) n, e, b) +#endif + #define MAX_LOG_SIZE 1024 /* maximum number of characters of a log message */ /* Define used for visiting trees. */ diff --git a/lib/minitasn1/parser_aux.c b/lib/minitasn1/parser_aux.c index 52700c6d0a..2285b20f58 100644 --- a/lib/minitasn1/parser_aux.c +++ b/lib/minitasn1/parser_aux.c @@ -549,9 +549,9 @@ _asn1_delete_list_and_nodes (void) char * -_asn1_ltostr (long v, char str[LTOSTR_MAX_SIZE]) +_asn1_ltostr (int64_t v, char str[LTOSTR_MAX_SIZE]) { - long d, r; + int64_t d, r; char temp[LTOSTR_MAX_SIZE]; int count, k, start; diff --git a/lib/minitasn1/parser_aux.h b/lib/minitasn1/parser_aux.h index 10b864b0f5..9f9183312e 100644 --- a/lib/minitasn1/parser_aux.h +++ b/lib/minitasn1/parser_aux.h @@ -54,7 +54,7 @@ void _asn1_delete_list_and_nodes (void); /* Max 64-bit integer length is 20 chars + 1 for sign + 1 for null termination */ #define LTOSTR_MAX_SIZE 22 -char *_asn1_ltostr (long v, char str[LTOSTR_MAX_SIZE]); +char *_asn1_ltostr (int64_t v, char str[LTOSTR_MAX_SIZE]); asn1_node _asn1_find_up (asn1_node node); |