Version 1.4 (unreleased)
- Update gnulib files.
+- Replace uses of alloca with malloc.
Version 1.3 (released 2008-02-01)
- Handle 'INTEGER { ... } (a..b)' regression.
fi
fi
-
-AC_MSG_NOTICE([Detecting C library capabilities])
-
-AC_FUNC_ALLOCA
-
AC_MSG_NOTICE([Detecting system's parameters])
# Run self-tests under valgrind?
AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
# For gnulib compatibility modules in gl/.
+AC_MSG_NOTICE([Running gnulib checks])
gl_INIT
# For libtasn1-config.
&value);
len = sizeof(str) - 1;
asn1_read_value(cert,name3,str,&len);
- asn1_der_decoding(&value,str,len,errorDescription);
+ asn1_der_decoding(&value,str,len,errorDescription);
len = sizeof(str) - 1;
asn1_read_value(value,"",str,&len); /* CHOICE */
strcpy(name3,str);
&value);
len = sizeof(str)-1;
asn1_read_value(cert,name3,str,&len);
- result=asn1_der_decoding(&value,str,len,errorDescription);
+ result=asn1_der_decoding(&value,str,len,errorDescription);
len = sizeof(str)-1;
- asn1_read_value(value,"",str,&len); /* CHOICE */
+ asn1_read_value(value,"",str,&len); /* CHOICE */
strcpy(name3,str);
/*
- * Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
+ * Copyright (C) 2004, 2005, 2006, 2008 Free Software Foundation, Inc.
* Copyright (C) 2001, 2002 Fabio Fiorina
*
* This file is part of LIBTASN1.
generalstring_def: GeneralString {$$=_asn1_add_node(TYPE_GENERALSTRING);}
| GeneralString size_def {$$=_asn1_add_node(TYPE_GENERALSTRING|CONST_SIZE);
- _asn1_set_down($$,$2);}
+ _asn1_set_down($$,$2);}
;
octet_string_def : OCTET STRING {$$=_asn1_add_node(TYPE_OCTET_STRING);}
lib_LTLIBRARIES = libtasn1.la
-libtasn1_la_SOURCES = libtasn1.h mem.h gstr.h errors.h \
- int.h parser_aux.h structure.h element.h ASN1.y \
- decoding.c gstr.c errors.c parser_aux.c structure.c element.c \
- coding.c libtasn1.vers
+libtasn1_la_SOURCES = libtasn1.h gstr.h errors.h int.h parser_aux.h \
+ structure.h element.h ASN1.y decoding.c gstr.c errors.c \
+ parser_aux.c structure.c element.c coding.c libtasn1.vers
libtasn1_la_LDFLAGS = -no-undefined \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
/*
- * Copyright (C) 2004, 2006 Free Software Foundation
+ * Copyright (C) 2004, 2006, 2008 Free Software Foundation
* Copyright (C) 2002 Fabio Fiorina
*
* This file is part of LIBTASN1.
max_len = *der_len;
- temp = (char *) _asn1_alloca (strlen (str) + 2);
+ temp = (char *) _asn1_malloc (strlen (str) + 2);
if (temp == NULL)
return ASN1_MEM_ALLOC_ERROR;
}
*der_len += len_len;
- _asn1_afree (temp);
+ _asn1_free (temp);
if (max_len < (*der_len))
return ASN1_MEM_ERROR;
first = last = NULL;
while (p)
{
- p_vet = (struct vet *) _asn1_alloca (sizeof (struct vet));
+ p_vet = (struct vet *) _asn1_malloc (sizeof (struct vet));
if (p_vet == NULL)
return;
if (p_vet->value > p2_vet->value)
{
/* change position */
- temp = (unsigned char *) _asn1_alloca (p_vet->end - counter);
+ temp = (unsigned char *) _asn1_malloc (p_vet->end - counter);
if (temp == NULL)
return;
p2_vet->end - p_vet->end);
memcpy (der + counter + p2_vet->end - p_vet->end, temp,
p_vet->end - counter);
- _asn1_afree (temp);
+ _asn1_free (temp);
tag = p_vet->value;
p_vet->value = p2_vet->value;
p_vet->prev->next = NULL;
else
first = NULL;
- _asn1_afree (p_vet);
+ _asn1_free (p_vet);
p_vet = first;
}
}
first = last = NULL;
while (p)
{
- p_vet = (struct vet *) _asn1_alloca (sizeof (struct vet));
+ p_vet = (struct vet *) _asn1_malloc (sizeof (struct vet));
if (p_vet == NULL)
return;
if (change == 1)
{
/* change position */
- temp = (unsigned char *) _asn1_alloca (p_vet->end - counter);
+ temp = (unsigned char *) _asn1_malloc (p_vet->end - counter);
if (temp == NULL)
return;
(p2_vet->end) - (p_vet->end));
memcpy (der + counter + (p2_vet->end) - (p_vet->end), temp,
(p_vet->end) - counter);
- _asn1_afree (temp);
+ _asn1_free (temp);
p_vet->end = counter + (p2_vet->end - p_vet->end);
}
p_vet->prev->next = NULL;
else
first = NULL;
- _asn1_afree (p_vet);
+ _asn1_free (p_vet);
p_vet = first;
}
}
/*
- * Copyright (C) 2004, 2006 Free Software Foundation
+ * Copyright (C) 2004, 2006, 2008 Free Software Foundation
* Copyright (C) 2002 Fabio Fiorina
*
* This file is part of LIBTASN1.
if (node)
{
asn1_length_der (tot_len, NULL, &len2);
- temp = _asn1_alloca (len2 + tot_len);
+ temp = _asn1_malloc (len2 + tot_len);
if (temp == NULL)
{
return ASN1_MEM_ALLOC_ERROR;
}
_asn1_set_value (node, temp, tot_len);
- _asn1_afree (temp);
+ _asn1_free (temp);
}
}
else
{
len2 += len4;
asn1_length_der (len2 + len3, NULL, &len4);
- temp2 = (unsigned char *) _asn1_alloca (len2 + len3 + len4);
+ temp2 = (unsigned char *) _asn1_malloc (len2 + len3 + len4);
if (temp2 == NULL)
{
asn1_delete_structure (element);
asn1_octet_der (der + counter, len2 + len3, temp2, &len4);
_asn1_set_value (p, temp2, len4);
- _asn1_afree (temp2);
+ _asn1_free (temp2);
counter += len2 + len3;
}
else
return ris;
}
asn1_length_der (len2, NULL, &len4);
- temp2 = (unsigned char *) _asn1_alloca (len2 + len4);
+ temp2 = (unsigned char *) _asn1_malloc (len2 + len4);
if (temp2 == NULL)
{
asn1_delete_structure (element);
asn1_octet_der (der + counter, len2, temp2, &len4);
_asn1_set_value (p, temp2, len4);
- _asn1_afree (temp2);
+ _asn1_free (temp2);
counter += len2;
/* Check if a couple of 0x00 are present due to an EXPLICIT TAG with
{
asn1_length_der (len2 + len3, NULL, &len4);
temp2 =
- (unsigned char *) _asn1_alloca (len2 + len3 + len4);
+ (unsigned char *) _asn1_malloc (len2 + len3 + len4);
if (temp2 == NULL)
{
asn1_delete_structure (structure);
asn1_octet_der (der + counter, len2 + len3, temp2,
&len4);
_asn1_set_value (p, temp2, len4);
- _asn1_afree (temp2);
+ _asn1_free (temp2);
if (p == nodeFound)
state = EXIT;
if (state == FOUND)
{
asn1_length_der (len2, NULL, &len4);
- temp2 = (unsigned char *) _asn1_alloca (len2 + len4);
+ temp2 = (unsigned char *) _asn1_malloc (len2 + len4);
if (temp2 == NULL)
{
asn1_delete_structure (structure);
asn1_octet_der (der + counter, len2, temp2, &len4);
_asn1_set_value (p, temp2, len4);
- _asn1_afree (temp2);
+ _asn1_free (temp2);
if (p == nodeFound)
state = EXIT;
/*
- * Copyright (C) 2004, 2006 Free Software Foundation
+ * Copyright (C) 2004, 2006, 2008 Free Software Foundation
* Copyright (C) 2000, 2001, 2002, 2003 Fabio Fiorina
*
* This file is part of LIBTASN1.
if ((isdigit (value[0])) || (value[0] == '-'))
{
value_temp =
- (unsigned char *) _asn1_alloca (SIZEOF_UNSIGNED_LONG_INT);
+ (unsigned char *) _asn1_malloc (SIZEOF_UNSIGNED_LONG_INT);
if (value_temp == NULL)
return ASN1_MEM_ALLOC_ERROR;
{
value_temp =
(unsigned char *)
- _asn1_alloca (SIZEOF_UNSIGNED_LONG_INT);
+ _asn1_malloc (SIZEOF_UNSIGNED_LONG_INT);
if (value_temp == NULL)
return ASN1_MEM_ALLOC_ERROR;
}
else
{ /* len != 0 */
- value_temp = (unsigned char *) _asn1_alloca (len);
+ value_temp = (unsigned char *) _asn1_malloc (len);
if (value_temp == NULL)
return ASN1_MEM_ALLOC_ERROR;
memcpy (value_temp, value, len);
if (negative && (type_field (node->type) == TYPE_ENUMERATED))
{
- _asn1_afree (value_temp);
+ _asn1_free (value_temp);
return ASN1_VALUE_NOT_VALID;
}
k--;
asn1_length_der (len - k, NULL, &len2);
- temp = (unsigned char *) _asn1_alloca (len - k + len2);
+ temp = (unsigned char *) _asn1_malloc (len - k + len2);
if (temp == NULL)
return ASN1_MEM_ALLOC_ERROR;
asn1_octet_der (value_temp + k, len - k, temp, &len2);
_asn1_set_value (node, temp, len2);
- _asn1_afree (temp);
+ _asn1_free (temp);
if (node->type & CONST_DEFAULT)
if ((isdigit (p->value[0])) || (p->value[0] == '-'))
{
default_temp =
- (unsigned char *) _asn1_alloca (SIZEOF_UNSIGNED_LONG_INT);
+ (unsigned char *) _asn1_malloc (SIZEOF_UNSIGNED_LONG_INT);
if (default_temp == NULL)
return ASN1_MEM_ALLOC_ERROR;
{
default_temp =
(unsigned char *)
- _asn1_alloca (SIZEOF_UNSIGNED_LONG_INT);
+ _asn1_malloc (SIZEOF_UNSIGNED_LONG_INT);
if (default_temp == NULL)
return ASN1_MEM_ALLOC_ERROR;
if (k2 == len2)
_asn1_set_value (node, NULL, 0);
}
- _asn1_afree (default_temp);
+ _asn1_free (default_temp);
}
- _asn1_afree (value_temp);
+ _asn1_free (value_temp);
break;
case TYPE_OBJECT_ID:
for (k = 0; k < strlen (value); k++)
if (len == 0)
len = strlen (value);
asn1_length_der (len, NULL, &len2);
- temp = (unsigned char *) _asn1_alloca (len + len2);
+ temp = (unsigned char *) _asn1_malloc (len + len2);
if (temp == NULL)
return ASN1_MEM_ALLOC_ERROR;
asn1_octet_der (value, len, temp, &len2);
_asn1_set_value (node, temp, len2);
- _asn1_afree (temp);
+ _asn1_free (temp);
break;
case TYPE_GENERALSTRING:
if (len == 0)
len = strlen (value);
asn1_length_der (len, NULL, &len2);
- temp = (unsigned char *) _asn1_alloca (len + len2);
+ temp = (unsigned char *) _asn1_malloc (len + len2);
if (temp == NULL)
return ASN1_MEM_ALLOC_ERROR;
asn1_octet_der (value, len, temp, &len2);
_asn1_set_value (node, temp, len2);
- _asn1_afree (temp);
+ _asn1_free (temp);
break;
case TYPE_BIT_STRING:
if (len == 0)
len = strlen (value);
asn1_length_der ((len >> 3) + 2, NULL, &len2);
- temp = (unsigned char *) _asn1_alloca ((len >> 3) + 2 + len2);
+ temp = (unsigned char *) _asn1_malloc ((len >> 3) + 2 + len2);
if (temp == NULL)
return ASN1_MEM_ALLOC_ERROR;
asn1_bit_der (value, len, temp, &len2);
_asn1_set_value (node, temp, len2);
- _asn1_afree (temp);
+ _asn1_free (temp);
break;
case TYPE_CHOICE:
p = node->down;
break;
case TYPE_ANY:
asn1_length_der (len, NULL, &len2);
- temp = (unsigned char *) _asn1_alloca (len + len2);
+ temp = (unsigned char *) _asn1_malloc (len + len2);
if (temp == NULL)
return ASN1_MEM_ALLOC_ERROR;
asn1_octet_der (value, len, temp, &len2);
_asn1_set_value (node, temp, len2);
- _asn1_afree (temp);
+ _asn1_free (temp);
break;
case TYPE_SEQUENCE_OF:
case TYPE_SET_OF:
#define LIBTASN1_DEBUG_INTEGER
*/
-#include <mem.h>
+#define _asn1_malloc malloc
+#define _asn1_free free
+#define _asn1_calloc calloc
+#define _asn1_realloc realloc
+#define _asn1_strdup strdup
#define MAX_LOG_SIZE 1024 /* maximum number of characters of a log message */
+++ /dev/null
-#ifndef MEM_H
-# define MEM_H
-
-/* Use _asn1_afree() when calling alloca, or
- * memory leaks may occur in systems which do not
- * support alloca.
- */
-#ifdef HAVE_ALLOCA
-# ifdef HAVE_ALLOCA_H
-# include <alloca.h>
-# endif
-# define _asn1_alloca alloca
-# define _asn1_afree(x)
-#else
-# define _asn1_alloca _asn1_malloc
-# define _asn1_afree _asn1_free
-#endif /* HAVE_ALLOCA */
-
-#define _asn1_malloc malloc
-#define _asn1_free free
-#define _asn1_calloc calloc
-#define _asn1_realloc realloc
-#define _asn1_strdup strdup
-
-#endif /* MEM_H */
-
-