]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
libtasn1: updated to allow large OIDs to be used even on 32-bit systems
authorNikos Mavrogiannopoulos <nmav@redhat.com>
Tue, 12 Jul 2016 12:48:14 +0000 (14:48 +0200)
committerNikos Mavrogiannopoulos <nmav@redhat.com>
Tue, 12 Jul 2016 12:48:14 +0000 (14:48 +0200)
lib/minitasn1/coding.c
lib/minitasn1/decoding.c
lib/minitasn1/int.h
lib/minitasn1/parser_aux.c
lib/minitasn1/parser_aux.h

index 66531b0fa68c3546c0730bbaff40180c3511fc03..7141df7b4ecbac273178a749740b05773a400731 100644 (file)
@@ -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)
index cfe23229103e10d0e65cdd291c971220cf5360b2..2cd9ac359a3cff94605e19d20a2f48e4a95090c3 100644 (file)
@@ -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)
index f1f13024e4b5bc3a4893c79a05028d8db2180f78..7d2eea379c90f809714e5606a5ddab3e62457564 100644 (file)
@@ -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. */
index 52700c6d0ae18b07080eaee67216f02777b8964e..2285b20f58c4ee7d675b31f09b70b618003521b4 100644 (file)
@@ -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;
 
index 10b864b0f5eca73dfd3800757ba09040d266a6d8..9f9183312e1de0f75fd85f16f56c89ac4ad044dd 100644 (file)
@@ -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);