Index: ChangeLog =================================================================== RCS file: /cvs/gnutls/libtasn1/ChangeLog,v retrieving revision 1.10 retrieving revision 1.11 diff -u -p -r1.10 -r1.11 --- ChangeLog 31 Aug 2005 13:34:00 -0000 1.10 +++ ChangeLog 9 Feb 2006 14:59:10 -0000 1.11 @@ -1,3 +1,124 @@ +2006-02-09 Simon Josefsson + + * doc/libtasn1.texi, lib/errors_int.h: Fix. + +2006-02-09 Simon Josefsson + + * NEWS, lib/coding.c, lib/decoding.c, lib/element.c, lib/errors.c, + lib/gstr.c, lib/libtasn1.h, lib/parser_aux.c, src/asn1Parser.c: Fix + typos. + +2006-02-09 Simon Josefsson + + * NEWS: Add. + +2006-02-09 Simon Josefsson + + * configure.in: Fix. + +2006-02-09 Simon Josefsson + + * configure.in: Reorder slightly. + +2006-02-09 Simon Josefsson + + * configure.in, gl/Makefile.am, gl/dummy.c, gl/memmove.c, + gl/m4/gnulib-cache.m4, gl/m4/gnulib-comp.m4, gl/m4/gnulib-tool.m4, + gl/m4/gnulib.m4: Update gnulib. + +2006-02-09 Simon Josefsson + + * doc/gdoc, tests/Test_parser.c, tests/Test_tree.c: Fix copyright. + +2006-02-09 Simon Josefsson + + * lib/Makefile.am, lib/defines.h, lib/errors.h, lib/int.h, + lib/structure.c: Fix copying conditions. + +2006-02-09 Simon Josefsson + + * Makefile.am, lib/ASN1.y, lib/defines.h, lib/errors.c, lib/gstr.c, + lib/parser_aux.c, src/CertificateExample.c, src/CrlExample.c, + src/Makefile.am, src/asn1Coding.c, src/asn1Decoding.c, + src/asn1Parser.c: Fix copyright. + +2006-02-09 Simon Josefsson + + * THANKS, NEWS: Add. + +2006-02-09 Simon Josefsson + + * NEWS: Fix. + +2006-02-09 Simon Josefsson + + * lib/decoding.c: Further length fixes. + +2006-02-08 Simon Josefsson + + * lib/coding.c, lib/decoding.c, lib/element.c, lib/structure.c: + Update _asn1_get_length_der fix. + +2006-02-08 Simon Josefsson + + * lib/libtasn1.h: Bump version. + +2006-02-08 Simon Josefsson + + * NEWS: Add. + +2006-02-08 Simon Josefsson + + * lib/coding.c, lib/decoding.c, lib/der.h, lib/element.c, + lib/libtasn1.h, lib/parser_aux.c, lib/structure.c: Add libtasn1 + fixes from Nikos, prompted by report from "Evgeny Legerov" + . + +2006-01-27 Simon Josefsson + + * doc/Makefile.am: Fix. + +2006-01-27 Simon Josefsson + + * tests/Makefile.am, tests/Test_parser.c, tests/Test_tree.c: Fix + make check for objdir != srcdir, reported by Bernard Leak + . + +2006-01-27 Simon Josefsson + + * doc/Makefile.am: Fix objdir != srcdir. + +2006-01-27 Simon Josefsson + + * doc/Makefile.am: Fix objdir != srcdir. + +2006-01-27 Simon Josefsson + + * doc/reference/tmpl/libtasn1-unused.sgml: Add, to workaround + gtk-dock bug. + +2006-01-27 Simon Josefsson + + * NEWS, THANKS: Add. + +2006-01-27 Simon Josefsson + + * lib/coding.c, lib/errors.c: Add const, tiny patch from "ZIGLIO, + Frediano, VF-IT" . + +2006-01-18 Simon Josefsson + + * configure.in: Bump versions. + +2006-01-18 Simon Josefsson + + * THANKS, NEWS: Add. + +2006-01-18 Simon Josefsson + + * src/Makefile.am: Fix -I, reported by Bernard Leak + . + 2005-08-31 Simon Josefsson * NEWS: Version 0.2.17. Index: Makefile.am =================================================================== RCS file: /cvs/gnutls/libtasn1/Makefile.am,v retrieving revision 1.14 retrieving revision 1.15 diff -u -p -r1.14 -r1.15 --- Makefile.am 31 Aug 2005 13:06:53 -0000 1.14 +++ Makefile.am 9 Feb 2006 12:24:38 -0000 1.15 @@ -1,5 +1,5 @@ ## Process this file with automake to produce Makefile.in -# Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation +# Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation # # This file is part of LIBTASN1. # Index: NEWS =================================================================== RCS file: /cvs/gnutls/libtasn1/NEWS,v retrieving revision 1.33 retrieving revision 1.40 diff -u -p -r1.33 -r1.40 --- NEWS 31 Aug 2005 13:17:57 -0000 1.33 +++ NEWS 9 Feb 2006 12:53:24 -0000 1.40 @@ -1,3 +1,12 @@ +Version 0.2.18 +- Fix out-of-bounds access in DER decoding, reported by Evgeny Legerov. +- Add 'const' keyword to some prototypes, thanks to Frediano ZIGLIO. +- Fixed typo in src/Makefile.am to make it build with objdir != srcdir, + thanks to Bernard Leak. +- Update of gnulib files. +- Typo fixes in comments, e.g. finish libasn1 to libtasn1 renaming, + use LGPL boiler plate on some files in lib/. + Version 0.2.17 - Fixed typo to make it build. Index: THANKS =================================================================== RCS file: /cvs/gnutls/libtasn1/THANKS,v retrieving revision 1.4 retrieving revision 1.7 diff -u -p -r1.4 -r1.7 --- THANKS 22 Jan 2005 00:15:13 -0000 1.4 +++ THANKS 9 Feb 2006 12:01:34 -0000 1.7 @@ -4,3 +4,6 @@ Nikos Mavroyanopoulos Simon Josefsson Martijn Koster Albert Chin +Bernard Leak +Frediano ZIGLIO +Evgeny Legerov Index: configure.in =================================================================== RCS file: /cvs/gnutls/libtasn1/configure.in,v retrieving revision 1.45 retrieving revision 1.49 diff -u -p -r1.45 -r1.49 --- configure.in 31 Aug 2005 13:17:37 -0000 1.45 +++ configure.in 9 Feb 2006 12:43:43 -0000 1.49 @@ -1,5 +1,5 @@ dnl Process this file with autoconf to produce a configure script. -# Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation +# Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation # # This file is part of LIBTASN1. # @@ -18,7 +18,7 @@ dnl Process this file with autoconf to p # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. AC_PREREQ(2.59) -AC_INIT(libtasn1, 0.2.17, bug-gnutls@gnu.org) +AC_INIT(libtasn1, 0.2.18, bug-gnutls@gnu.org) AM_INIT_AUTOMAKE([1.9 gnits]) AM_CONFIG_HEADER(config.h) AB_INIT @@ -28,7 +28,7 @@ AB_INIT # Interfaces added: AGE++ # Interfaces removed: AGE=0 AC_SUBST(LT_CURRENT, 2) -AC_SUBST(LT_REVISION, 17) +AC_SUBST(LT_REVISION, 18) AC_SUBST(LT_AGE, 0) AC_PROG_CC @@ -40,6 +40,9 @@ dnl Checks for programs. AC_PROG_INSTALL AM_MISSING_PROG(PERL,perl,$missing_dir) +AC_MSG_NOTICE([Detecting options for shared libraries]) +AM_PROG_LIBTOOL + AC_MSG_NOTICE([Detecting compiler options]) AC_C_CONST @@ -98,21 +101,15 @@ AC_ARG_ENABLE([ld-version-script], [ : ] ) AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes") -gl_SOURCE_BASE(gl) -gl_M4_BASE(gl/m4) -gl_MODULES(memmove) -gl_LGPL +# For gnulib compatibility modules in gl/. gl_INIT -AC_MSG_NOTICE([Detecting options for shared libraries]) -AM_PROG_LIBTOOL - +# For libtasn1-config. LIBTASN1_LIBS="-L${libdir} -ltasn1 $LIBS" LIBTASN1_CFLAGS="-I${includedir}" AC_SUBST(LIBTASN1_LIBS) AC_SUBST(LIBTASN1_CFLAGS) - -AC_CONFIG_COMMANDS([lib/libtasn1.h],[[ +AC_CONFIG_COMMANDS([chmod],[[ chmod +x lib/libtasn1-config ]],[[]]) Index: doc/Makefile.am =================================================================== RCS file: /cvs/gnutls/libtasn1/doc/Makefile.am,v retrieving revision 1.6 retrieving revision 1.9 diff -u -p -r1.6 -r1.9 --- doc/Makefile.am 10 Dec 2004 16:06:36 -0000 1.6 +++ doc/Makefile.am 27 Jan 2006 12:36:34 -0000 1.9 @@ -7,19 +7,23 @@ EXTRA_DIST = gdoc TODO libtasn1.html lib info_TEXINFOS = libtasn1.texi libtasn1_TEXINFOS = fdl.texi $(gdoc_TEXINFOS) +AM_MAKEINFOFLAGS = -I $(top_builddir)/doc AM_MAKEINFOHTMLFLAGS = --no-split dist_man_MANS = $(gdoc_MANS) -gdoc_MANS = man/asn1_parser2tree.3 man/asn1_parser2array.3 man/asn1_der_coding.3 man/asn1_der_decoding.3 man/asn1_der_decoding_element.3 man/asn1_der_decoding_startEnd.3 man/asn1_expand_any_defined_by.3 man/asn1_expand_octet_string.3 man/asn1_write_value.3 man/asn1_read_value.3 man/asn1_read_tag.3 man/libtasn1_perror.3 man/libtasn1_strerror.3 man/asn1_check_version.3 man/asn1_array2tree.3 man/asn1_delete_structure.3 man/asn1_delete_element.3 man/asn1_create_element.3 man/asn1_print_structure.3 man/asn1_number_of_elements.3 man/asn1_find_structure_from_oid.3 -gdoc_TEXINFOS = texi/ASN1.c.texi texi/coding.c.texi texi/decoding.c.texi texi/element.c.texi texi/errors.c.texi texi/gstr.c.texi texi/parser_aux.c.texi texi/structure.c.texi texi/asn1_parser2tree.texi texi/asn1_parser2array.texi texi/asn1_der_coding.texi texi/asn1_der_decoding.texi texi/asn1_der_decoding_element.texi texi/asn1_der_decoding_startEnd.texi texi/asn1_expand_any_defined_by.texi texi/asn1_expand_octet_string.texi texi/asn1_write_value.texi texi/asn1_read_value.texi texi/asn1_read_tag.texi texi/libtasn1_perror.texi texi/libtasn1_strerror.texi texi/asn1_check_version.texi texi/asn1_array2tree.texi texi/asn1_delete_structure.texi texi/asn1_delete_element.texi texi/asn1_create_element.texi texi/asn1_print_structure.texi texi/asn1_number_of_elements.texi texi/asn1_find_structure_from_oid.texi +gdoc_MANS = man/asn1_der_decoding.3 man/asn1_der_decoding_element.3 man/asn1_der_decoding_startEnd.3 man/asn1_expand_any_defined_by.3 man/asn1_expand_octet_string.3 man/libtasn1_perror.3 man/libtasn1_strerror.3 man/asn1_check_version.3 man/asn1_der_coding.3 man/asn1_write_value.3 man/asn1_read_value.3 man/asn1_read_tag.3 man/asn1_array2tree.3 man/asn1_delete_structure.3 man/asn1_delete_element.3 man/asn1_create_element.3 man/asn1_print_structure.3 man/asn1_number_of_elements.3 man/asn1_find_structure_from_oid.3 man/asn1_parser2tree.3 man/asn1_parser2array.3 +gdoc_TEXINFOS = texi/decoding.c.texi texi/errors.c.texi texi/parser_aux.c.texi texi/coding.c.texi texi/element.c.texi texi/gstr.c.texi texi/structure.c.texi texi/ASN1.c.texi texi/asn1_der_decoding.texi texi/asn1_der_decoding_element.texi texi/asn1_der_decoding_startEnd.texi texi/asn1_expand_any_defined_by.texi texi/asn1_expand_octet_string.texi texi/libtasn1_perror.texi texi/libtasn1_strerror.texi texi/asn1_check_version.texi texi/asn1_der_coding.texi texi/asn1_write_value.texi texi/asn1_read_value.texi texi/asn1_read_tag.texi texi/asn1_array2tree.texi texi/asn1_delete_structure.texi texi/asn1_delete_element.texi texi/asn1_create_element.texi texi/asn1_print_structure.texi texi/asn1_number_of_elements.texi texi/asn1_find_structure_from_oid.texi texi/asn1_parser2tree.texi texi/asn1_parser2array.texi $(gdoc_MANS) $(gdoc_TEXINFOS): make update-makefile make Makefile make doit -GDOC_SRC = $(top_srcdir)/lib/*.c +GDOC_SRC = $(top_srcdir)/lib/decoding.c $(top_srcdir)/lib/errors.c \ + $(top_srcdir)/lib/parser_aux.c $(top_srcdir)/lib/coding.c \ + $(top_srcdir)/lib/element.c $(top_srcdir)/lib/gstr.c \ + $(top_srcdir)/lib/structure.c $(top_builddir)/lib/ASN1.c update-makefile: @MANS=""; \ @@ -28,7 +32,7 @@ update-makefile: BASE=`basename $$i`; \ TEXINFOS="$$TEXINFOS texi/$$BASE.texi"; \ done; \ - FUNCS=`./gdoc -listfunc $(GDOC_SRC)`; \ + FUNCS=`$(srcdir)/gdoc -listfunc $(GDOC_SRC)`; \ for i in $$FUNCS; do \ MANS="$$MANS man/$$i.3"; \ TEXINFOS="$$TEXINFOS texi/$$i.texi"; \ @@ -39,23 +43,23 @@ update-makefile: doit: $(mkdir_p) man texi; \ - for i in `./gdoc -listfunc $(GDOC_SRC)`; do \ + for i in `$(srcdir)/gdoc -listfunc $(GDOC_SRC)`; do \ echo -n "Creating documentation for $$i... " && \ - ./gdoc -man \ + $(srcdir)/gdoc -man \ -module $(PACKAGE) -sourceversion $(VERSION) \ -include libtasn1.h \ -seeinfo $(PACKAGE) -verbatimcopying \ -copyright "2001, 2002, 2003 Fabio Fiorina" \ -function $$i \ $(GDOC_SRC) > man/$$i.3 && \ - ./gdoc -texinfo -function $$i \ + $(srcdir)/gdoc -texinfo -function $$i \ $(GDOC_SRC) > texi/$$i.texi && \ echo "ok"; \ done; \ for i in $(GDOC_SRC); do \ BASE=`basename $$i`; \ echo -n "Creating documentation for $$i... " && \ - ./gdoc -texinfo $$i > texi/$$BASE.texi && \ + $(srcdir)/gdoc -texinfo $$i > texi/$$BASE.texi && \ echo "ok"; \ done Index: doc/gdoc =================================================================== RCS file: /cvs/gnutls/libtasn1/doc/gdoc,v retrieving revision 1.1 retrieving revision 1.2 diff -u -p -r1.1 -r1.2 --- doc/gdoc 10 Dec 2004 14:33:56 -0000 1.1 +++ doc/gdoc 9 Feb 2006 12:33:05 -0000 1.2 @@ -1,6 +1,6 @@ #!/usr/bin/perl -## Copyright (c) 2002, 2003, 2004 Simon Josefsson ## +## Copyright (c) 2002, 2003, 2004, 2005, 2006 Simon Josefsson ## ## added -texinfo, -listfunc ## ## man page revamp ## ## various improvements ## Index: doc/libtasn1.texi =================================================================== RCS file: /cvs/gnutls/libtasn1/doc/libtasn1.texi,v retrieving revision 1.1 retrieving revision 1.2 diff -u -p -r1.1 -r1.2 --- doc/libtasn1.texi 10 Dec 2004 14:34:06 -0000 1.1 +++ doc/libtasn1.texi 9 Feb 2006 12:55:59 -0000 1.2 @@ -1,5 +1,5 @@ \input texinfo @c -*-texinfo-*- -@comment $Id: libtasn1-0.2.18-from-0.2.17.patch,v 1.1 2006/02/09 15:34:10 jas Exp $ +@comment $Id: libtasn1-0.2.18-from-0.2.17.patch,v 1.1 2006/02/09 15:34:10 jas Exp $ @comment %**start of header @setfilename libtasn1.info @include version.texi @@ -16,7 +16,7 @@ This manual is for Libtasn1 which is a library for Abstract Syntax Notation One (ASN.1) and Distinguish Encoding Rules (DER) manipulation. -Copyright @copyright{} 2004 Simon Josefsson +Copyright @copyright{} 2004, 2006 Free Software Foundation Copyright @copyright{} 2001, 2002, 2003 Fabio Fiorina @@ -45,7 +45,8 @@ Software Foundation raise funds for GNU @subtitle Abstract Syntax Notation One (ASN.1) library for the GNU system @subtitle part of the GnuTLS project @subtitle for version @value{VERSION}, @value{UPDATED} -@author Fabio Fiorina (@email{bug-gnutls@@gnu.org}) +@author Fabio Fiorina +@author Simon Josefsson (@email{bug-gnutls@@gnu.org}) @page @vskip 0pt plus 1filll @insertcopying @@ -278,7 +279,7 @@ data structures (not a single array like @cindex asn1Parser program @file{asn1Parser} reads one file with ASN1 definitions and generates a -file with an array to use with libasn1 functions. +file with an array to use with libtasn1 functions. @verbatim Usage: asn1Parser [options] file Index: doc/reference/tmpl/.cvsignore =================================================================== RCS file: doc/reference/tmpl/.cvsignore diff -N doc/reference/tmpl/.cvsignore --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ doc/reference/tmpl/.cvsignore 27 Jan 2006 11:45:35 -0000 1.1 @@ -0,0 +1 @@ +libtasn1.sgml Index: doc/reference/tmpl/libtasn1-unused.sgml =================================================================== RCS file: doc/reference/tmpl/libtasn1-unused.sgml diff -N doc/reference/tmpl/libtasn1-unused.sgml Index: gl/Makefile.am =================================================================== RCS file: /cvs/gnutls/libtasn1/gl/Makefile.am,v retrieving revision 1.3 retrieving revision 1.4 diff -u -p -r1.3 -r1.4 --- gl/Makefile.am 12 Aug 2005 13:37:36 -0000 1.3 +++ gl/Makefile.am 9 Feb 2006 12:38:12 -0000 1.4 @@ -8,8 +8,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Invoked as: gnulib-tool --import -# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --aux-dir=. --libtool --lgpl memmove +# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --aux-dir=. --lgpl --libtool --macro-prefix=gl memmove AUTOMAKE_OPTIONS = 1.5 gnits no-dependencies @@ -17,6 +16,7 @@ noinst_LTLIBRARIES = libgnu.la libgnu_la_SOURCES = libgnu_la_LIBADD = @LTLIBOBJS@ +noinst_HEADERS = EXTRA_DIST = BUILT_SOURCES = SUFFIXES = @@ -25,5 +25,11 @@ CLEANFILES = DISTCLEANFILES = MAINTAINERCLEANFILES = +## begin gnulib module dummy + +libgnu_la_SOURCES += dummy.c + +## end gnulib module dummy + # Makefile.am ends here Index: gl/dummy.c =================================================================== RCS file: gl/dummy.c diff -N gl/dummy.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gl/dummy.c 9 Feb 2006 12:38:12 -0000 1.1 @@ -0,0 +1,30 @@ +/* A dummy file, to prevent empty libraries from breaking builds. + Copyright (C) 2004 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + USA. */ + +/* Some systems, reportedly OpenBSD and Mac OS X, refuse to create + libraries without any object files. You might get an error like: + + > ar cru .libs/libgl.a + > ar: no archive members specified + + Compiling this file, and adding its object file to the library, will + prevent the library from being empty. */ + +/* This declaration is solely to ensure that after preprocessing + this file is never empty. */ +typedef int dummy; Index: gl/memmove.c =================================================================== RCS file: /cvs/gnutls/libtasn1/gl/memmove.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -p -r1.1 -r1.2 --- gl/memmove.c 12 Aug 2005 13:02:30 -0000 1.1 +++ gl/memmove.c 9 Feb 2006 12:38:12 -0000 1.2 @@ -3,7 +3,7 @@ In the public domain. By David MacKenzie . */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: gl/m4/gnulib-cache.m4 =================================================================== RCS file: gl/m4/gnulib-cache.m4 diff -N gl/m4/gnulib-cache.m4 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gl/m4/gnulib-cache.m4 9 Feb 2006 12:38:12 -0000 1.1 @@ -0,0 +1,28 @@ +# Copyright (C) 2004 Free Software Foundation, Inc. +# This file is free software, distributed under the terms of the GNU +# General Public License. As a special exception to the GNU General +# Public License, this file may be distributed as part of a program +# that contains a configuration script generated by Autoconf, under +# the same distribution terms as the rest of that program. +# +# Generated by gnulib-tool. +# +# This file represents the specification of how gnulib-tool is used. +# It acts as a cache: It is written and read by gnulib-tool. +# In projects using CVS, this file is meant to be stored in CVS, +# like the configure.ac and various Makefile.am files. + + +# Specification in the form of a command-line invocation: +# gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --aux-dir=. --lgpl --libtool --macro-prefix=gl memmove + +# Specification in the form of a few gnulib-tool.m4 macro invocations: +gl_MODULES([memmove]) +gl_AVOID([]) +gl_SOURCE_BASE([gl]) +gl_M4_BASE([gl/m4]) +gl_TESTS_BASE([tests]) +gl_LIB([libgnu]) +gl_LGPL +gl_LIBTOOL +gl_MACRO_PREFIX([gl]) Index: gl/m4/gnulib-comp.m4 =================================================================== RCS file: gl/m4/gnulib-comp.m4 diff -N gl/m4/gnulib-comp.m4 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gl/m4/gnulib-comp.m4 9 Feb 2006 12:38:12 -0000 1.1 @@ -0,0 +1,39 @@ +# Copyright (C) 2004 Free Software Foundation, Inc. +# This file is free software, distributed under the terms of the GNU +# General Public License. As a special exception to the GNU General +# Public License, this file may be distributed as part of a program +# that contains a configuration script generated by Autoconf, under +# the same distribution terms as the rest of that program. +# +# Generated by gnulib-tool. +# +# This file represents the compiled summary of the specification in +# gnulib-cache.m4. It lists the computed macro invocations that need +# to be invoked from configure.ac. +# In projects using CVS, this file can be treated like other built files. + + +# This macro should be invoked from ./configure.in, in the section +# "Checks for programs", right after AC_PROG_CC, and certainly before +# any checks for libraries, header files, types and library functions. +AC_DEFUN([gl_EARLY], +[ + AC_REQUIRE([AC_PROG_RANLIB]) +]) + +# This macro should be invoked from ./configure.in, in the section +# "Check for header files, types and library functions". +AC_DEFUN([gl_INIT], +[ + AM_CONDITIONAL([GL_COND_LIBTOOL], [true]) + gl_FUNC_MEMMOVE +]) + +# This macro records the list of files which have been installed by +# gnulib-tool and may be removed by future gnulib-tool invocations. +AC_DEFUN([gl_FILE_LIST], [ + lib/dummy.c + lib/memmove.c + m4/memmove.m4 + m4/onceonly_2_57.m4 +]) Index: gl/m4/gnulib-tool.m4 =================================================================== RCS file: gl/m4/gnulib-tool.m4 diff -N gl/m4/gnulib-tool.m4 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gl/m4/gnulib-tool.m4 9 Feb 2006 12:38:12 -0000 1.1 @@ -0,0 +1,33 @@ +# gnulib-tool.m4 serial 1 +dnl Copyright (C) 2004-2005 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl The following macros need not be invoked explicitly. +dnl Invoking them does nothing except to declare default arguments +dnl for "gnulib-tool --import". + +dnl Usage: gl_MODULES([module1 module2 ...]) +AC_DEFUN([gl_MODULES], []) + +dnl Usage: gl_AVOID([module1 module2 ...]) +AC_DEFUN([gl_AVOID], []) + +dnl Usage: gl_SOURCE_BASE([DIR]) +AC_DEFUN([gl_SOURCE_BASE], []) + +dnl Usage: gl_M4_BASE([DIR]) +AC_DEFUN([gl_M4_BASE], []) + +dnl Usage: gl_LIB([LIBNAME]) +AC_DEFUN([gl_LIB], []) + +dnl Usage: gl_LGPL +AC_DEFUN([gl_LGPL], []) + +dnl Usage: gl_LIBTOOL +AC_DEFUN([gl_LIBTOOL], []) + +dnl Usage: gl_MACRO_PREFIX([PREFIX]) +AC_DEFUN([gl_MACRO_PREFIX], []) Index: gl/m4/gnulib.m4 =================================================================== RCS file: gl/m4/gnulib.m4 diff -N gl/m4/gnulib.m4 --- gl/m4/gnulib.m4 12 Aug 2005 13:37:37 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,40 +0,0 @@ -# Copyright (C) 2004 Free Software Foundation, Inc. -# This file is free software, distributed under the terms of the GNU -# General Public License. As a special exception to the GNU General -# Public License, this file may be distributed as part of a program -# that contains a configuration script generated by Autoconf, under -# the same distribution terms as the rest of that program. -# -# Generated by gnulib-tool. -# -# Invoked as: gnulib-tool --import -# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --aux-dir=. --libtool --lgpl memmove - -AC_DEFUN([gl_EARLY], -[ -]) - -AC_DEFUN([gl_INIT], -[ - gl_FUNC_MEMMOVE -]) - -dnl Usage: gl_MODULES(module1 module2 ...) -AC_DEFUN([gl_MODULES], []) - -dnl Usage: gl_AVOID(module1 module2 ...) -AC_DEFUN([gl_AVOID], []) - -dnl Usage: gl_SOURCE_BASE(DIR) -AC_DEFUN([gl_SOURCE_BASE], []) - -dnl Usage: gl_M4_BASE(DIR) -AC_DEFUN([gl_M4_BASE], []) - -dnl Usage: gl_LIB(LIBNAME) -AC_DEFUN([gl_LIB], []) - -dnl Usage: gl_LGPL -AC_DEFUN([gl_LGPL], []) - -# gnulib.m4 ends here Index: lib/ASN1.y =================================================================== RCS file: /cvs/gnutls/libtasn1/lib/ASN1.y,v retrieving revision 1.11 retrieving revision 1.12 diff -u -p -r1.11 -r1.12 --- lib/ASN1.y 16 Jul 2005 11:28:37 -0000 1.11 +++ lib/ASN1.y 9 Feb 2006 12:24:39 -0000 1.12 @@ -1,5 +1,6 @@ -/* Copyright (C) 2001, 2002 Fabio Fiorina - * Copyright (C) 2004, 2005 Simon Josefsson +/* + * Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. + * Copyright (C) 2001, 2002 Fabio Fiorina * * This file is part of LIBTASN1. * Index: lib/Makefile.am =================================================================== RCS file: /cvs/gnutls/libtasn1/lib/Makefile.am,v retrieving revision 1.19 retrieving revision 1.20 diff -u -p -r1.19 -r1.20 --- lib/Makefile.am 31 Aug 2005 13:16:47 -0000 1.19 +++ lib/Makefile.am 9 Feb 2006 12:30:38 -0000 1.20 @@ -1,3 +1,23 @@ +## Process this file with automake to produce Makefile.in +# Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation +# +# This file is part of LIBTASN1. +# +# The LIBTASN1 library is free software; you can redistribute it +# and/or modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA + include_HEADERS = libtasn1.h bin_SCRIPTS = libtasn1-config Index: lib/coding.c =================================================================== RCS file: /cvs/gnutls/libtasn1/lib/coding.c,v retrieving revision 1.16 retrieving revision 1.20 diff -u -p -r1.16 -r1.20 --- lib/coding.c 16 Jul 2005 11:25:32 -0000 1.16 +++ lib/coding.c 9 Feb 2006 12:53:24 -0000 1.20 @@ -1,22 +1,23 @@ /* + * Copyright (C) 2004, 2006 Free Software Foundation * Copyright (C) 2002 Fabio Fiorina - * Copyright (C) 2004 Simon Josefsson * - * This file is part of LIBASN1. + * This file is part of LIBTASN1. * - * The LIBTASN1 library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either + * The LIBTASN1 library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA */ @@ -148,7 +149,7 @@ _asn1_octet_der(const unsigned char *str { int len_len; - if(der==NULL) return; + if(der==NULL || str_len <= 0) return; _asn1_length_der(str_len,der,&len_len); memcpy(der+len_len,str,str_len); *der_len=str_len+len_len; @@ -196,7 +197,8 @@ _asn1_get_utctime_der(unsigned char *der char temp[20]; if(str==NULL) return; - str_len=_asn1_get_length_der(der,&len_len); + str_len=_asn1_get_length_der(der,*der_len,&len_len); + if (str_len<0) return; memcpy(temp,der+len_len,str_len); *der_len=str_len+len_len; switch(str_len){ @@ -298,7 +300,7 @@ _asn1_objectid_der(unsigned char *str,un } -char bit_mask[]={0xFF,0xFE,0xFC,0xF8,0xF0,0xE0,0xC0,0x80}; +const char bit_mask[]={0xFF,0xFE,0xFC,0xF8,0xF0,0xE0,0xC0,0x80}; /******************************************************/ /* Function : _asn1_bit_der */ @@ -534,7 +536,7 @@ _asn1_insert_tag_der(node_asn *node,unsi /* Return: */ /******************************************************/ void -_asn1_ordering_set(unsigned char *der,node_asn *node) +_asn1_ordering_set(unsigned char *der, int der_len, node_asn *node) { struct vet{ int end; @@ -569,12 +571,14 @@ _asn1_ordering_set(unsigned char *der,no last=p_vet; /* tag value calculation */ - tag=_asn1_get_tag_der(der+counter,&class,&len2); + if (_asn1_get_tag_der(der+counter, der_len-counter,&class,&len2, &tag)!=ASN1_SUCCESS) + return; p_vet->value=(class<<24)|tag; counter+=len2; /* extraction and length */ - len2=_asn1_get_length_der(der+counter,&len); + len2=_asn1_get_length_der(der+counter,der_len-counter,&len); + if (len2<0) return; counter+=len+len2; p_vet->end=counter; @@ -626,7 +630,7 @@ _asn1_ordering_set(unsigned char *der,no /* Return: */ /******************************************************/ void -_asn1_ordering_set_of(unsigned char *der,node_asn *node) +_asn1_ordering_set_of(unsigned char *der, int der_len, node_asn *node) { struct vet{ int end; @@ -661,10 +665,16 @@ _asn1_ordering_set_of(unsigned char *der last=p_vet; /* extraction of tag and length */ - _asn1_get_tag_der(der+counter,&class,&len); - counter+=len; - len2=_asn1_get_length_der(der+counter,&len); - counter+=len+len2; + if (der_len-counter > 0) { + + if (_asn1_get_tag_der(der+counter, der_len - counter, &class,&len,NULL)!=ASN1_SUCCESS) + return; + counter+=len; + + len2=_asn1_get_length_der(der+counter,der_len-counter,&len); + if (len2<0) return; + counter+=len+len2; + } p_vet->end=counter; p=p->right; @@ -804,7 +814,8 @@ asn1_der_coding(ASN1_TYPE element,const _asn1_error_description_value_not_found(p,ErrorDescription); return ASN1_VALUE_NOT_FOUND; } - len2=_asn1_get_length_der(p->value,&len3); + len2=_asn1_get_length_der(p->value,p->value_len, &len3); + if (len2<0) return ASN1_DER_ERROR; max_len -= len2+len3; if(max_len>=0) memcpy(der+counter,p->value,len3+len2); @@ -846,7 +857,8 @@ asn1_der_coding(ASN1_TYPE element,const _asn1_error_description_value_not_found(p,ErrorDescription); return ASN1_VALUE_NOT_FOUND; } - len2=_asn1_get_length_der(p->value,&len3); + len2=_asn1_get_length_der(p->value,p->value_len,&len3); + if (len2<0) return ASN1_DER_ERROR; max_len-=len2+len3; if(max_len>=0) memcpy(der+counter,p->value,len3+len2); @@ -858,7 +870,8 @@ asn1_der_coding(ASN1_TYPE element,const _asn1_error_description_value_not_found(p,ErrorDescription); return ASN1_VALUE_NOT_FOUND; } - len2=_asn1_get_length_der(p->value,&len3); + len2=_asn1_get_length_der(p->value,p->value_len,&len3); + if (len2<0) return ASN1_DER_ERROR; max_len-=len2+len3; if(max_len>=0) memcpy(der+counter,p->value,len3+len2); @@ -870,7 +883,8 @@ asn1_der_coding(ASN1_TYPE element,const _asn1_error_description_value_not_found(p,ErrorDescription); return ASN1_VALUE_NOT_FOUND; } - len2=_asn1_get_length_der(p->value,&len3); + len2=_asn1_get_length_der(p->value,p->value_len,&len3); + if (len2<0) return ASN1_DER_ERROR; max_len-=len2+len3; if(max_len>=0) memcpy(der+counter,p->value,len3+len2); @@ -903,7 +917,7 @@ asn1_der_coding(ASN1_TYPE element,const len2=strtol(p->value,NULL,10); _asn1_set_value(p,NULL,0); if((type_field(p->type)==TYPE_SET) && (max_len>=0)) - _asn1_ordering_set(der+len2,p); + _asn1_ordering_set(der+len2, max_len-len2,p); _asn1_length_der(counter-len2,temp,&len3); max_len-=len3; if(max_len>=0){ @@ -934,8 +948,9 @@ asn1_der_coding(ASN1_TYPE element,const if(move==UP){ len2=strtol(p->value,NULL,10); _asn1_set_value(p,NULL,0); - if((type_field(p->type)==TYPE_SET_OF) && (max_len>=0)) - _asn1_ordering_set_of(der+len2,p); + if((type_field(p->type)==TYPE_SET_OF) && (max_len-len2>0)) { + _asn1_ordering_set_of(der+len2, max_len-len2,p); + } _asn1_length_der(counter-len2,temp,&len3); max_len-=len3; if(max_len>=0){ @@ -951,7 +966,8 @@ asn1_der_coding(ASN1_TYPE element,const _asn1_error_description_value_not_found(p,ErrorDescription); return ASN1_VALUE_NOT_FOUND; } - len2=_asn1_get_length_der(p->value,&len3); + len2=_asn1_get_length_der(p->value,p->value_len,&len3); + if (len2<0) return ASN1_DER_ERROR; max_len-=len2; if(max_len>=0) memcpy(der+counter,p->value+len3,len2); Index: lib/decoding.c =================================================================== RCS file: /cvs/gnutls/libtasn1/lib/decoding.c,v retrieving revision 1.26 retrieving revision 1.30 diff -u -p -r1.26 -r1.30 --- lib/decoding.c 16 Jul 2005 11:25:32 -0000 1.26 +++ lib/decoding.c 9 Feb 2006 12:53:24 -0000 1.30 @@ -1,22 +1,23 @@ /* + * Copyright (C) 2004, 2006 Free Software Foundation * Copyright (C) 2002 Fabio Fiorina - * Copyright (C) 2004 Simon Josefsson * - * This file is part of LIBASN1. + * This file is part of LIBTASN1. * - * The LIBTASN1 library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either + * The LIBTASN1 library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA */ @@ -47,11 +48,14 @@ _asn1_error_description_tag_error(node_a signed long -_asn1_get_length_der(const unsigned char *der,int *len) +_asn1_get_length_der(const unsigned char *der, int der_len, int *len) { unsigned long ans; int k,punt; + *len = 0; + if (der_len <= 0) return 0; + if(!(der[0]&128)){ /* short form */ *len=1; @@ -63,7 +67,13 @@ _asn1_get_length_der(const unsigned char punt=1; if(k){ /* definite length method */ ans=0; - while(punt<=k) ans=ans*256+der[punt++]; + while(punt<=k && punt < der_len) { + unsigned long last = ans; + ans=ans*256+der[punt++]; + if (ans < last) + /* we wrapped around, no bignum support... */ + return -2; + } } else{ /* indefinite length method */ ans=-1; @@ -77,12 +87,14 @@ _asn1_get_length_der(const unsigned char -unsigned int -_asn1_get_tag_der(const unsigned char *der,unsigned char *class,int *len) +int +_asn1_get_tag_der(const unsigned char *der, int der_len, + unsigned char *class,int *len, unsigned long *tag) { int punt,ris; - if (der==NULL || len == NULL) return ASN1_DER_ERROR; + if (der==NULL || der_len <= 0 || len == NULL) return ASN1_DER_ERROR; + *class=der[0]&0xE0; if((der[0]&0x1F)!=0x1F){ /* short form */ @@ -93,25 +105,46 @@ _asn1_get_tag_der(const unsigned char *d /* Long form */ punt=1; ris=0; - while(der[punt]&128) ris=ris*128+(der[punt++]&0x7F); - ris=ris*128+(der[punt++]&0x7F); + while(punt <= der_len && der[punt]&128) + { + int last = ris; + ris=ris*128+(der[punt++]&0x7F); + if (ris < last) + /* wrapper around, and no bignums... */ + return ASN1_DER_ERROR; + } + if (punt >= der_len) + return ASN1_DER_ERROR; + { + int last = ris; + ris=ris*128+(der[punt++]&0x7F); + if (ris < last) + /* wrapper around, and no bignums... */ + return ASN1_DER_ERROR; + } *len=punt; } - return ris; + if (tag) *tag = ris; + return ASN1_SUCCESS; } int -_asn1_get_octet_der(const unsigned char *der,int *der_len,unsigned char *str,int str_size, int *str_len) +_asn1_get_octet_der(const unsigned char *der, int der_len, int *ret_len,unsigned char *str,int str_size, int *str_len) { int len_len; + if (der_len <= 0) return ASN1_GENERIC_ERROR; + /* if(str==NULL) return ASN1_SUCCESS; */ - *str_len=_asn1_get_length_der(der,&len_len); + *str_len=_asn1_get_length_der(der, der_len, &len_len); + + if (*str_len < 0) + return ASN1_DER_ERROR; - *der_len=*str_len+len_len; + *ret_len=*str_len+len_len; if ( str_size >= *str_len) memcpy(str,der+len_len,*str_len); else { @@ -126,17 +159,17 @@ _asn1_get_octet_der(const unsigned char /* Returns ASN1_SUCCESS on success or an error code on error. */ int -_asn1_get_time_der(const unsigned char *der,int *der_len,unsigned char *str,int str_size) +_asn1_get_time_der(const unsigned char *der, int der_len, int *ret_len,unsigned char *str,int str_size) { int len_len,str_len; - if(str==NULL) return ASN1_DER_ERROR; - str_len=_asn1_get_length_der(der,&len_len); + if(der_len <=0 || str==NULL) return ASN1_DER_ERROR; + str_len=_asn1_get_length_der(der, der_len, &len_len); if (str_len < 0 || str_size < str_len) return ASN1_DER_ERROR; memcpy(str,der+len_len,str_len); str[str_len]=0; - *der_len=str_len+len_len; + *ret_len=str_len+len_len; return ASN1_SUCCESS; } @@ -144,14 +177,19 @@ _asn1_get_time_der(const unsigned char * void -_asn1_get_objectid_der(const unsigned char *der,int *der_len,unsigned char *str, int str_size) +_asn1_get_objectid_der(const unsigned char *der,int der_len, int *ret_len,unsigned char *str, int str_size) { int len_len,len,k; char temp[20]; unsigned long val,val1; - if(str==NULL) return; - len=_asn1_get_length_der(der,&len_len); + *ret_len = 0; + if (str && str_size > 0) str[0] = 0; /* no oid */ + + if(str==NULL || der_len <= 0) return; + len=_asn1_get_length_der(der,der_len, &len_len); + + if (len < 0 || len > der_len || len_len > der_len) return; val1=der[len_len]/40; val=der[len_len]-val1*40; @@ -170,20 +208,24 @@ _asn1_get_objectid_der(const unsigned ch val=0; } } - *der_len=len+len_len; + *ret_len=len+len_len; } int -_asn1_get_bit_der(const unsigned char *der,int *der_len,unsigned char *str, int str_size, int *bit_len) +_asn1_get_bit_der(const unsigned char *der, int der_len, + int *ret_len,unsigned char *str, int str_size, int *bit_len) { int len_len,len_byte; - len_byte=_asn1_get_length_der(der,&len_len)-1; + if (der_len <=0) return ASN1_GENERIC_ERROR; + len_byte=_asn1_get_length_der(der,der_len,&len_len)-1; + if (len_byte < 0) + return ASN1_DER_ERROR; - *der_len=len_byte+len_len+1; + *ret_len=len_byte+len_len+1; *bit_len=len_byte*8-der[len_len]; if (str_size >= len_byte) @@ -199,14 +241,15 @@ _asn1_get_bit_der(const unsigned char *d int -_asn1_extract_tag_der(node_asn *node,const unsigned char *der,int *der_len) +_asn1_extract_tag_der(node_asn *node,const unsigned char *der, int der_len,int *ret_len) { node_asn *p; int counter,len2,len3,is_tag_implicit; unsigned long tag,tag_implicit=0; unsigned char class,class2,class_implicit=0; - + if (der_len <= 0) return ASN1_GENERIC_ERROR; + counter=is_tag_implicit=0; if(node->type&CONST_TAG){ @@ -219,9 +262,14 @@ _asn1_extract_tag_der(node_asn *node,con else class2=CONTEXT_SPECIFIC; if(p->type&CONST_EXPLICIT){ - tag=_asn1_get_tag_der(der+counter,&class,&len2); + if (_asn1_get_tag_der(der+counter, der_len-counter,&class,&len2, &tag)!=ASN1_SUCCESS) + return ASN1_DER_ERROR; + if (counter+len2 > der_len) + return ASN1_DER_ERROR; counter+=len2; - len3=_asn1_get_length_der(der+counter,&len2); + len3=_asn1_get_length_der(der+counter,der_len-counter, &len2); + if (len3 < 0) + return ASN1_DER_ERROR; counter+=len2; if(!is_tag_implicit){ if((class!=(class2|STRUCTURED)) || (tag!=strtoul(p->value,NULL,10))) @@ -251,7 +299,11 @@ _asn1_extract_tag_der(node_asn *node,con } if(is_tag_implicit){ - tag=_asn1_get_tag_der(der+counter,&class,&len2); + if (_asn1_get_tag_der(der+counter, der_len-counter,&class,&len2, &tag)!=ASN1_SUCCESS) + return ASN1_DER_ERROR; + if (counter+len2 > der_len) + return ASN1_DER_ERROR; + if((class!=class_implicit) || (tag!=tag_implicit)){ if(type_field(node->type)==TYPE_OCTET_STRING){ class_implicit |= STRUCTURED; @@ -265,11 +317,15 @@ _asn1_extract_tag_der(node_asn *node,con else{ if(type_field(node->type)==TYPE_TAG){ counter=0; - *der_len=counter; + *ret_len=counter; return ASN1_SUCCESS; } - tag=_asn1_get_tag_der(der+counter,&class,&len2); + if (_asn1_get_tag_der(der+counter, der_len-counter,&class,&len2,&tag)!=ASN1_SUCCESS) + return ASN1_DER_ERROR; + if (counter+len2 > der_len) + return ASN1_DER_ERROR; + switch(type_field(node->type)){ case TYPE_NULL: if((class!=UNIVERSAL) || (tag!=TAG_NULL)) return ASN1_DER_ERROR; @@ -323,7 +379,7 @@ _asn1_extract_tag_der(node_asn *node,con } counter+=len2; - *der_len=counter; + *ret_len=counter; return ASN1_SUCCESS; } @@ -375,7 +431,7 @@ _asn1_delete_not_used(node_asn *node) asn1_retCode -_asn1_get_octet_string(const unsigned char* der,node_asn *node,int* len) +_asn1_get_octet_string(const unsigned char* der, node_asn *node,int* len) { int len2,len3,counter,counter2,counter_end,tot_len,indefinite; char *temp,*temp2; @@ -384,7 +440,9 @@ _asn1_get_octet_string(const unsigned ch if(*(der-1) & STRUCTURED){ tot_len=0; - indefinite=_asn1_get_length_der(der,&len3); + indefinite=_asn1_get_length_der(der, *len, &len3); + if (indefinite < -1) + return ASN1_DER_ERROR; counter+=len3; if(indefinite>=0) indefinite+=len3; @@ -404,7 +462,7 @@ _asn1_get_octet_string(const unsigned ch counter++; - len2=_asn1_get_length_der(der+counter,&len3); + len2=_asn1_get_length_der(der+counter,*len-counter, &len3); if(len2 <= 0) return ASN1_DER_ERROR; counter+=len3+len2; @@ -422,24 +480,33 @@ _asn1_get_octet_string(const unsigned ch _asn1_length_der(tot_len,temp,&len2); tot_len+=len2; temp2=temp+len2; - len2=_asn1_get_length_der(der,&len3); + len2=_asn1_get_length_der(der,*len,&len3); + if(len2 < -1) return ASN1_DER_ERROR; counter2=len3+1; if(indefinite==-1) counter_end=counter-2; else counter_end=counter; while(counter2 *len) return ASN1_DER_ERROR; if(node) _asn1_set_value(node,der,len3+len2); counter=len3+len2; @@ -452,10 +519,10 @@ _asn1_get_octet_string(const unsigned ch asn1_retCode -_asn1_get_indefinite_length_string(const unsigned char* der,int* len) +_asn1_get_indefinite_length_string(const unsigned char* der, int* len) { int len2,len3,counter,indefinite; - unsigned int tag; + unsigned long tag; unsigned char class; counter=indefinite=0; @@ -470,9 +537,13 @@ _asn1_get_indefinite_length_string(const else continue; } - tag=_asn1_get_tag_der(der+counter,&class,&len2); + if(_asn1_get_tag_der(der+counter, *len-counter,&class,&len2,&tag)!=ASN1_SUCCESS) + return ASN1_DER_ERROR; + if (counter+len2 > *len) + return ASN1_DER_ERROR; counter+=len2; - len2=_asn1_get_length_der(der+counter,&len3); + len2=_asn1_get_length_der(der+counter, *len-counter,&len3); + if(len2 < -1) return ASN1_DER_ERROR; if(len2 == -1){ indefinite++; counter+=1; @@ -520,7 +591,7 @@ asn1_der_decoding(ASN1_TYPE *element,con char temp[128]; int counter,len2,len3,len4,move,ris,tlen; unsigned char class,*temp2; - unsigned int tag; + unsigned long tag; int indefinite, result; const unsigned char* der = ider; @@ -563,11 +634,11 @@ asn1_der_decoding(ASN1_TYPE *element,con while(p2){ if((p2->type&CONST_SET) && (p2->type&CONST_NOT_USED)){ if(type_field(p2->type)!=TYPE_CHOICE) - ris=_asn1_extract_tag_der(p2,der+counter,&len2); + ris=_asn1_extract_tag_der(p2,der+counter,len-counter, &len2); else{ p3=p2->down; while(p3){ - ris=_asn1_extract_tag_der(p3,der+counter,&len2); + ris=_asn1_extract_tag_der(p3,der+counter,len-counter, &len2); if(ris==ASN1_SUCCESS) break; p3=p3->right; } @@ -606,7 +677,7 @@ asn1_der_decoding(ASN1_TYPE *element,con if(type_field(p->type)==TYPE_CHOICE){ while(p->down){ if(counterdown,der+counter,&len2); + ris=_asn1_extract_tag_der(p->down,der+counter,len-counter,&len2); else ris=ASN1_DER_ERROR; if(ris==ASN1_SUCCESS){ @@ -642,7 +713,7 @@ asn1_der_decoding(ASN1_TYPE *element,con if((len2!=-1) && (counter>len2)) ris=ASN1_TAG_ERROR; } - if(ris==ASN1_SUCCESS) ris=_asn1_extract_tag_der(p,der+counter,&len2); + if(ris==ASN1_SUCCESS) ris=_asn1_extract_tag_der(p,der+counter,len-counter,&len2); if(ris!=ASN1_SUCCESS){ if(p->type&CONST_OPTION){ p->type|=CONST_NOT_USED; @@ -683,13 +754,15 @@ asn1_der_decoding(ASN1_TYPE *element,con move=RIGHT; break; case TYPE_INTEGER: case TYPE_ENUMERATED: - len2=_asn1_get_length_der(der+counter,&len3); + len2=_asn1_get_length_der(der+counter,len-counter, &len3); + if(len2 < 0) return ASN1_DER_ERROR; + if (len2+len3 > len-counter) return ASN1_DER_ERROR; _asn1_set_value(p,der+counter,len3+len2); counter+=len3+len2; move=RIGHT; break; case TYPE_OBJECT_ID: - _asn1_get_objectid_der(der+counter,&len2, temp, sizeof(temp)); + _asn1_get_objectid_der(der+counter,len-counter,&len2, temp, sizeof(temp)); tlen = strlen(temp); if( tlen > 0) _asn1_set_value(p,temp,tlen+1); @@ -697,7 +770,7 @@ asn1_der_decoding(ASN1_TYPE *element,con move=RIGHT; break; case TYPE_TIME: - result = _asn1_get_time_der(der+counter,&len2,temp,sizeof(temp)-1); + result = _asn1_get_time_der(der+counter,len-counter,&len2,temp,sizeof(temp)-1); if (result != ASN1_SUCCESS) { asn1_delete_structure(element); return result; @@ -716,14 +789,18 @@ asn1_der_decoding(ASN1_TYPE *element,con move=RIGHT; break; case TYPE_GENERALSTRING: - len2=_asn1_get_length_der(der+counter,&len3); - _asn1_set_value(p,der+counter,len3+len2); + len2=_asn1_get_length_der(der+counter,len-counter,&len3); + if(len2 < 0) return ASN1_DER_ERROR; + if (len3+len2 > len-counter) return ASN1_DER_ERROR; + _asn1_set_value(p,der+counter,len3+len2); counter+=len3+len2; move=RIGHT; break; case TYPE_BIT_STRING: - len2=_asn1_get_length_der(der+counter,&len3); - _asn1_set_value(p,der+counter,len3+len2); + len2=_asn1_get_length_der(der+counter,len-counter,&len3); + if(len2 < 0) return ASN1_DER_ERROR; + if (len3+len2 > len-counter) return ASN1_DER_ERROR; + _asn1_set_value(p,der+counter,len3+len2); counter+=len3+len2; move=RIGHT; break; @@ -732,10 +809,12 @@ asn1_der_decoding(ASN1_TYPE *element,con len2=strtol(p->value,NULL,10); _asn1_set_value(p,NULL,0); if(len2==-1){ /* indefinite length method */ - if((der[counter]) || der[counter+1]){ - asn1_delete_structure(element); - return ASN1_DER_ERROR; - } + if (len-counter+1 > 0) { + if((der[counter]) || der[counter+1]){ + asn1_delete_structure(element); + return ASN1_DER_ERROR; + } + } else return ASN1_DER_ERROR; counter+=2; } else{ /* definite length method */ @@ -747,7 +826,8 @@ asn1_der_decoding(ASN1_TYPE *element,con move=RIGHT; } else{ /* move==DOWN || move==RIGHT */ - len3=_asn1_get_length_der(der+counter,&len2); + len3=_asn1_get_length_der(der+counter,len-counter,&len2); + if(len3 < -1) return ASN1_DER_ERROR; counter+=len2; if(len3>0){ _asn1_ltostr(counter+len3,temp); @@ -806,7 +886,8 @@ asn1_der_decoding(ASN1_TYPE *element,con } } else{ /* move==DOWN || move==RIGHT */ - len3=_asn1_get_length_der(der+counter,&len2); + len3=_asn1_get_length_der(der+counter,len-counter,&len2); + if(len3 < -1) return ASN1_DER_ERROR; counter+=len2; if(len3){ if(len3>0){ /* definite length method */ @@ -828,9 +909,13 @@ asn1_der_decoding(ASN1_TYPE *element,con move=RIGHT; break; case TYPE_ANY: - tag=_asn1_get_tag_der(der+counter,&class,&len2); - len4=_asn1_get_length_der(der+counter+len2,&len3); - + if(_asn1_get_tag_der(der+counter,len-counter,&class,&len2,&tag)!=ASN1_SUCCESS) + return ASN1_DER_ERROR; + if (counter+len2 > len) + return ASN1_DER_ERROR; + len4=_asn1_get_length_der(der+counter+len2,len-counter-len2,&len3); + if(len4 < -1) return ASN1_DER_ERROR; + if(len4 > len-counter+len2+len3) return ASN1_DER_ERROR; if(len4 != -1){ len2+=len4; _asn1_length_der(len2+len3,NULL,&len4); @@ -955,7 +1040,7 @@ asn1_der_decoding_element(ASN1_TYPE *str int nameLen=MAX_NAME_SIZE*10-1,state; int counter,len2,len3,len4,move,ris, tlen; unsigned char class,*temp2; - unsigned int tag; + unsigned long tag; int indefinite, result; const unsigned char* der = ider; @@ -1024,11 +1109,11 @@ asn1_der_decoding_element(ASN1_TYPE *str while(p2){ if((p2->type&CONST_SET) && (p2->type&CONST_NOT_USED)){ if(type_field(p2->type)!=TYPE_CHOICE) - ris=_asn1_extract_tag_der(p2,der+counter,&len2); + ris=_asn1_extract_tag_der(p2,der+counter,len-counter,&len2); else{ p3=p2->down; while(p3){ - ris=_asn1_extract_tag_der(p3,der+counter,&len2); + ris=_asn1_extract_tag_der(p3,der+counter,len-counter,&len2); if(ris==ASN1_SUCCESS) break; p3=p3->right; } @@ -1067,7 +1152,7 @@ asn1_der_decoding_element(ASN1_TYPE *str if(type_field(p->type)==TYPE_CHOICE){ while(p->down){ if(counterdown,der+counter,&len2); + ris=_asn1_extract_tag_der(p->down,der+counter,len-counter,&len2); else ris=ASN1_DER_ERROR; if(ris==ASN1_SUCCESS){ @@ -1103,7 +1188,7 @@ asn1_der_decoding_element(ASN1_TYPE *str if(counter>len2) ris=ASN1_TAG_ERROR; } - if(ris==ASN1_SUCCESS) ris=_asn1_extract_tag_der(p,der+counter,&len2); + if(ris==ASN1_SUCCESS) ris=_asn1_extract_tag_der(p,der+counter,len-counter,&len2); if(ris!=ASN1_SUCCESS){ if(p->type&CONST_OPTION){ p->type|=CONST_NOT_USED; @@ -1156,8 +1241,10 @@ asn1_der_decoding_element(ASN1_TYPE *str move=RIGHT; break; case TYPE_INTEGER: case TYPE_ENUMERATED: - len2=_asn1_get_length_der(der+counter,&len3); + len2=_asn1_get_length_der(der+counter,len-counter,&len3); + if(len2 < 0) return ASN1_DER_ERROR; if(state==FOUND){ + if (len3+len2 > len-counter) return ASN1_DER_ERROR; _asn1_set_value(p,der+counter,len3+len2); if(p==nodeFound) state=EXIT; @@ -1167,7 +1254,7 @@ asn1_der_decoding_element(ASN1_TYPE *str break; case TYPE_OBJECT_ID: if(state==FOUND){ - _asn1_get_objectid_der(der+counter,&len2, temp, sizeof(temp)); + _asn1_get_objectid_der(der+counter,len-counter,&len2, temp, sizeof(temp)); tlen = strlen(temp); if (tlen > 0) @@ -1176,7 +1263,8 @@ asn1_der_decoding_element(ASN1_TYPE *str if(p==nodeFound) state=EXIT; } else{ - len2=_asn1_get_length_der(der+counter,&len3); + len2=_asn1_get_length_der(der+counter,len-counter,&len3); + if(len2 < 0) return ASN1_DER_ERROR; len2+=len3; } @@ -1185,7 +1273,7 @@ asn1_der_decoding_element(ASN1_TYPE *str break; case TYPE_TIME: if(state==FOUND){ - result = _asn1_get_time_der(der+counter,&len2,temp,sizeof(temp)-1); + result = _asn1_get_time_der(der+counter,len-counter,&len2,temp,sizeof(temp)-1); if (result != ASN1_SUCCESS) { asn1_delete_structure(structure); return result; @@ -1198,7 +1286,8 @@ asn1_der_decoding_element(ASN1_TYPE *str if(p==nodeFound) state=EXIT; } else{ - len2=_asn1_get_length_der(der+counter,&len3); + len2=_asn1_get_length_der(der+counter,len-counter,&len3); + if(len2 < 0) return ASN1_DER_ERROR; len2+=len3; } @@ -1219,8 +1308,10 @@ asn1_der_decoding_element(ASN1_TYPE *str move=RIGHT; break; case TYPE_GENERALSTRING: - len2=_asn1_get_length_der(der+counter,&len3); + len2=_asn1_get_length_der(der+counter,len-counter,&len3); + if(len2 < 0) return ASN1_DER_ERROR; if(state==FOUND){ + if (len3+len2 > len-counter) return ASN1_DER_ERROR; _asn1_set_value(p,der+counter,len3+len2); if(p==nodeFound) state=EXIT; @@ -1229,8 +1320,10 @@ asn1_der_decoding_element(ASN1_TYPE *str move=RIGHT; break; case TYPE_BIT_STRING: - len2=_asn1_get_length_der(der+counter,&len3); + len2=_asn1_get_length_der(der+counter,len-counter,&len3); + if(len2 < 0) return ASN1_DER_ERROR; if(state==FOUND){ + if (len3+len2 > len-counter) return ASN1_DER_ERROR; _asn1_set_value(p,der+counter,len3+len2); if(p==nodeFound) state=EXIT; @@ -1260,12 +1353,14 @@ asn1_der_decoding_element(ASN1_TYPE *str } else{ /* move==DOWN || move==RIGHT */ if(state==OTHER_BRANCH){ - len3=_asn1_get_length_der(der+counter,&len2); + len3=_asn1_get_length_der(der+counter,len-counter,&len2); + if(len3 < 0) return ASN1_DER_ERROR; counter+=len2+len3; move=RIGHT; } else { /* state==SAME_BRANCH or state==FOUND */ - len3=_asn1_get_length_der(der+counter,&len2); + len3=_asn1_get_length_der(der+counter,len-counter,&len2); + if(len3 < 0) return ASN1_DER_ERROR; counter+=len2; if(len3>0){ _asn1_ltostr(counter+len3,temp); @@ -1315,12 +1410,14 @@ asn1_der_decoding_element(ASN1_TYPE *str } else{ /* move==DOWN || move==RIGHT */ if(state==OTHER_BRANCH){ - len3=_asn1_get_length_der(der+counter,&len2); + len3=_asn1_get_length_der(der+counter,len-counter,&len2); + if(len3 < 0) return ASN1_DER_ERROR; counter+=len2+len3; move=RIGHT; } else{ /* state==FOUND or state==SAME_BRANCH */ - len3=_asn1_get_length_der(der+counter,&len2); + len3=_asn1_get_length_der(der+counter,len-counter,&len2); + if(len3 < 0) return ASN1_DER_ERROR; counter+=len2; if(len3){ _asn1_ltostr(counter+len3,temp); @@ -1339,9 +1436,14 @@ asn1_der_decoding_element(ASN1_TYPE *str break; case TYPE_ANY: - tag=_asn1_get_tag_der(der+counter,&class,&len2); - len4=_asn1_get_length_der(der+counter+len2,&len3); - + if(_asn1_get_tag_der(der+counter, len-counter,&class,&len2,&tag)!=ASN1_SUCCESS) + return ASN1_DER_ERROR; + if (counter+len2 > len) + return ASN1_DER_ERROR; + + len4=_asn1_get_length_der(der+counter+len2,len-counter-len2,&len3); + if(len4 < -1) return ASN1_DER_ERROR; + if(len4 != -1){ len2+=len4; if(state==FOUND){ @@ -1549,7 +1651,7 @@ asn1_der_decoding_startEnd(ASN1_TYPE ele node_asn *node,*node_to_find,*p,*p2,*p3; int counter,len2,len3,len4,move,ris; unsigned char class; - unsigned int tag; + unsigned long tag; int indefinite; const unsigned char* der = ider; @@ -1597,10 +1699,10 @@ asn1_der_decoding_startEnd(ASN1_TYPE ele while(p2){ if((p2->type&CONST_SET) && (p2->type&CONST_NOT_USED)){ /* CONTROLLARE */ if(type_field(p2->type)!=TYPE_CHOICE) - ris=_asn1_extract_tag_der(p2,der+counter,&len2); + ris=_asn1_extract_tag_der(p2,der+counter,len-counter,&len2); else{ p3=p2->down; - ris=_asn1_extract_tag_der(p3,der+counter,&len2); + ris=_asn1_extract_tag_der(p3,der+counter,len-counter,&len2); } if(ris==ASN1_SUCCESS){ p2->type&=~CONST_NOT_USED; @@ -1617,11 +1719,11 @@ asn1_der_decoding_startEnd(ASN1_TYPE ele if(type_field(p->type)==TYPE_CHOICE){ p=p->down; - ris=_asn1_extract_tag_der(p,der+counter,&len2); + ris=_asn1_extract_tag_der(p,der+counter,len-counter,&len2); if(p==node_to_find) *start=counter; } - if(ris==ASN1_SUCCESS) ris=_asn1_extract_tag_der(p,der+counter,&len2); + if(ris==ASN1_SUCCESS) ris=_asn1_extract_tag_der(p,der+counter,len-counter,&len2); if(ris!=ASN1_SUCCESS){ if(p->type&CONST_OPTION){ p->type|=CONST_NOT_USED; @@ -1650,17 +1752,20 @@ asn1_der_decoding_startEnd(ASN1_TYPE ele move=RIGHT; break; case TYPE_INTEGER: case TYPE_ENUMERATED: - len2=_asn1_get_length_der(der+counter,&len3); + len2=_asn1_get_length_der(der+counter,len-counter,&len3); + if(len2 < 0) return ASN1_DER_ERROR; counter+=len3+len2; move=RIGHT; break; case TYPE_OBJECT_ID: - len2=_asn1_get_length_der(der+counter,&len3); + len2=_asn1_get_length_der(der+counter,len-counter,&len3); + if(len2 < 0) return ASN1_DER_ERROR; counter+=len2+len3; move=RIGHT; break; case TYPE_TIME: - len2=_asn1_get_length_der(der+counter,&len3); + len2=_asn1_get_length_der(der+counter,len-counter,&len3); + if(len2 < 0) return ASN1_DER_ERROR; counter+=len2+len3; move=RIGHT; break; @@ -1672,18 +1777,21 @@ asn1_der_decoding_startEnd(ASN1_TYPE ele move=RIGHT; break; case TYPE_GENERALSTRING: - len2=_asn1_get_length_der(der+counter,&len3); + len2=_asn1_get_length_der(der+counter,len-counter,&len3); + if(len2 < 0) return ASN1_DER_ERROR; counter+=len3+len2; move=RIGHT; break; case TYPE_BIT_STRING: - len2=_asn1_get_length_der(der+counter,&len3); + len2=_asn1_get_length_der(der+counter,len-counter,&len3); + if(len2 < 0) return ASN1_DER_ERROR; counter+=len3+len2; move=RIGHT; break; case TYPE_SEQUENCE: case TYPE_SET: if(move!=UP){ - len3=_asn1_get_length_der(der+counter,&len2); + len3=_asn1_get_length_der(der+counter,len-counter,&len2); + if(len3 < -1) return ASN1_DER_ERROR; counter+=len2; if(len3==0) move=RIGHT; else move=DOWN; @@ -1696,7 +1804,8 @@ asn1_der_decoding_startEnd(ASN1_TYPE ele break; case TYPE_SEQUENCE_OF: case TYPE_SET_OF: if(move!=UP){ - len3=_asn1_get_length_der(der+counter,&len2); + len3=_asn1_get_length_der(der+counter,len-counter,&len2); + if(len3 < -1) return ASN1_DER_ERROR; counter+=len2; if((len3==-1) && !der[counter] && !der[counter+1]) counter+=2; @@ -1714,9 +1823,14 @@ asn1_der_decoding_startEnd(ASN1_TYPE ele move=RIGHT; break; case TYPE_ANY: - tag=_asn1_get_tag_der(der+counter,&class,&len2); - len4=_asn1_get_length_der(der+counter+len2,&len3); - + if (_asn1_get_tag_der(der+counter, len-counter,&class,&len2,&tag)!=ASN1_SUCCESS) + return ASN1_DER_ERROR; + if (counter+len2 > len) + return ASN1_DER_ERROR; + + len4=_asn1_get_length_der(der+counter+len2,len-counter-len2,&len3); + if(len4 < -1) return ASN1_DER_ERROR; + if(len4 != -1){ counter+=len2+len4+len3; } @@ -1887,8 +2001,9 @@ asn1_expand_any_defined_by(ASN1_TYPE def result=asn1_create_element(definitions,name,&aux); if(result == ASN1_SUCCESS){ _asn1_set_name(aux,p->name); - len2=_asn1_get_length_der(p->value,&len3); - + len2=_asn1_get_length_der(p->value,p->value_len,&len3); + if(len2 < 0) return ASN1_DER_ERROR; + result=asn1_der_decoding(&aux,p->value+len3,len2, errorDescription); if(result == ASN1_SUCCESS){ @@ -2051,8 +2166,9 @@ asn1_expand_octet_string(ASN1_TYPE defin result=asn1_create_element(definitions,name,&aux); if(result == ASN1_SUCCESS){ _asn1_set_name(aux,octetNode->name); - len2=_asn1_get_length_der(octetNode->value,&len3); - + len2=_asn1_get_length_der(octetNode->value,octetNode->value_len,&len3); + if(len2 < 0) return ASN1_DER_ERROR; + result=asn1_der_decoding(&aux,octetNode->value+len3,len2, errorDescription); if(result == ASN1_SUCCESS){ Index: lib/defines.h =================================================================== RCS file: /cvs/gnutls/libtasn1/lib/defines.h,v retrieving revision 1.10 retrieving revision 1.12 diff -u -p -r1.10 -r1.12 --- lib/defines.h 12 Aug 2005 13:21:00 -0000 1.10 +++ lib/defines.h 9 Feb 2006 12:30:38 -0000 1.12 @@ -1,21 +1,23 @@ /* + * Copyright (C) 2006 Free Software Foundation, Inc. * Copyright (C) 2000,2001,2002,2005 Nikos Mavroyanopoulos * * This file is part of LIBTASN1. * - * LIBTASN1 is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * The LIBTASN1 library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. * - * LIBTASN1 is distributed in the hope that it will be useful, but + * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. + * Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with LIBTASN1; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA */ #ifndef DEFINES_H Index: lib/der.h =================================================================== RCS file: /cvs/gnutls/libtasn1/lib/der.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -p -r1.6 -r1.7 --- lib/der.h 30 Jul 2003 19:52:56 -0000 1.6 +++ lib/der.h 8 Feb 2006 11:33:07 -0000 1.7 @@ -28,23 +28,23 @@ #define TAG_NULL 0x05 #define TAG_GENERALSTRING 0x1B -unsigned int _asn1_get_tag_der(const unsigned char *der, - unsigned char *class,int *len); +int _asn1_get_tag_der(const unsigned char *der, int der_len, + unsigned char *class,int *len, unsigned long *tag); void _asn1_octet_der(const unsigned char *str,int str_len, unsigned char *der,int *der_len); -asn1_retCode _asn1_get_octet_der(const unsigned char *der, - int *der_len,unsigned char *str,int str_size, int *str_len); +asn1_retCode _asn1_get_octet_der(const unsigned char *der, int der_len, + int *ret_len,unsigned char *str,int str_size, int *str_len); void _asn1_bit_der(const unsigned char *str,int bit_len, unsigned char *der,int *der_len); -asn1_retCode _asn1_get_bit_der(const unsigned char *der, - int *der_len,unsigned char *str, int str_size, +asn1_retCode _asn1_get_bit_der(const unsigned char *der, int der_len, + int *ret_len,unsigned char *str, int str_size, int *bit_len); -signed long _asn1_get_length_der(const unsigned char *der,int *len); +signed long _asn1_get_length_der(const unsigned char *der,int der_len, int *len); void _asn1_length_der(unsigned long len,unsigned char *ans,int *ans_len); Index: lib/element.c =================================================================== RCS file: /cvs/gnutls/libtasn1/lib/element.c,v retrieving revision 1.22 retrieving revision 1.25 diff -u -p -r1.22 -r1.25 --- lib/element.c 16 Jul 2005 11:25:32 -0000 1.22 +++ lib/element.c 9 Feb 2006 12:53:24 -0000 1.25 @@ -1,22 +1,23 @@ /* + * Copyright (C) 2004, 2006 Free Software Foundation * Copyright (C) 2000, 2001, 2002, 2003 Fabio Fiorina - * Copyright (C) 2004 Simon Josefsson * - * This file is part of LIBASN1. + * This file is part of LIBTASN1. * - * The LIBTASN1 library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public + * The LIBTASN1 library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA */ /*****************************************************/ @@ -677,7 +678,7 @@ asn1_read_value(ASN1_TYPE root,const cha } else{ len2=-1; - if (_asn1_get_octet_der(node->value,&len2,value, value_size, len)!=ASN1_SUCCESS) return ASN1_MEM_ERROR; + if (_asn1_get_octet_der(node->value,node->value_len,&len2,value, value_size, len)!=ASN1_SUCCESS) return ASN1_MEM_ERROR; } break; case TYPE_OBJECT_ID: @@ -709,22 +710,23 @@ asn1_read_value(ASN1_TYPE root,const cha break; case TYPE_OCTET_STRING: len2=-1; - if (_asn1_get_octet_der(node->value,&len2,value, value_size, len)!=ASN1_SUCCESS) return ASN1_MEM_ERROR; + if (_asn1_get_octet_der(node->value,node->value_len,&len2,value, value_size, len)!=ASN1_SUCCESS) return ASN1_MEM_ERROR; break; case TYPE_GENERALSTRING: len2=-1; - if (_asn1_get_octet_der(node->value,&len2,value, value_size, len)!=ASN1_SUCCESS) return ASN1_MEM_ERROR; + if (_asn1_get_octet_der(node->value,node->value_len,&len2,value, value_size, len)!=ASN1_SUCCESS) return ASN1_MEM_ERROR; break; case TYPE_BIT_STRING: len2=-1; - if (_asn1_get_bit_der(node->value,&len2,value,value_size,len)!=ASN1_SUCCESS) return ASN1_MEM_ERROR; + if (_asn1_get_bit_der(node->value,node->value_len,&len2,value,value_size,len)!=ASN1_SUCCESS) return ASN1_MEM_ERROR; break; case TYPE_CHOICE: PUT_STR_VALUE( value, value_size, node->down->name); break; case TYPE_ANY: len3=-1; - len2=_asn1_get_length_der(node->value,&len3); + len2=_asn1_get_length_der(node->value,node->value_len,&len3); + if (len2 < 0) return ASN1_DER_ERROR; PUT_VALUE( value, value_size, node->value+len3, len2); break; default: Index: lib/errors.c =================================================================== RCS file: /cvs/gnutls/libtasn1/lib/errors.c,v retrieving revision 1.12 retrieving revision 1.15 diff -u -p -r1.12 -r1.15 --- lib/errors.c 12 Aug 2005 12:57:48 -0000 1.12 +++ lib/errors.c 9 Feb 2006 12:53:24 -0000 1.15 @@ -1,20 +1,23 @@ -/* Copyright (C) 2002, 2005 Fabio Fiorina +/* + * Copyright (C) 2006 Free Software Foundation, Inc. + * Copyright (C) 2002, 2005 Fabio Fiorina * - * This file is part of LIBASN1. + * This file is part of LIBTASN1. * - * The LIBTASN1 library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either + * The LIBTASN1 library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA */ #include @@ -33,7 +36,7 @@ struct libtasn1_error_entry { }; typedef struct libtasn1_error_entry libtasn1_error_entry; -static libtasn1_error_entry error_algorithms[] = { +static const libtasn1_error_entry error_algorithms[] = { LIBTASN1_ERROR_ENTRY( ASN1_SUCCESS ), LIBTASN1_ERROR_ENTRY( ASN1_FILE_NOT_FOUND ), LIBTASN1_ERROR_ENTRY( ASN1_ELEMENT_NOT_FOUND ), @@ -66,10 +69,10 @@ static libtasn1_error_entry error_algori /** * libtasn1_perror - prints a string to stderr with a description of an error - * @error: is an error returned by a libasn1 function. + * @error: is an error returned by a libtasn1 function. * * This function is like perror(). The only difference is that it - * accepts an error returned by a libasn1 function. + * accepts an error returned by a libtasn1 function. **/ void libtasn1_perror(asn1_retCode error) { @@ -89,7 +92,7 @@ void libtasn1_perror(asn1_retCode error) * @error: is an error returned by a libtasn1 function. * * This function is similar to strerror(). The only difference is - * that it accepts an error (number) returned by a libasn1 function. + * that it accepts an error (number) returned by a libtasn1 function. * * Returns: Pointer to static zero-terminated string describing error * code. Index: lib/errors.h =================================================================== RCS file: /cvs/gnutls/libtasn1/lib/errors.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -p -r1.7 -r1.8 --- lib/errors.h 12 Aug 2005 12:57:08 -0000 1.7 +++ lib/errors.h 9 Feb 2006 12:30:38 -0000 1.8 @@ -1,21 +1,23 @@ /* + * Copyright (C) 2004, 2006 Free Software Foundation, Inc. * Copyright (C) 2002 Fabio Fiorina * - * This file is part of LIBASN1. + * This file is part of LIBTASN1. * - * LIBASN1 is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * The LIBTASN1 library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. * - * LIBASN1 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA */ #ifndef ERRORS_H Index: lib/errors_int.h =================================================================== RCS file: /cvs/gnutls/libtasn1/lib/errors_int.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -p -r1.3 -r1.4 --- lib/errors_int.h 29 Oct 2004 21:43:58 -0000 1.3 +++ lib/errors_int.h 9 Feb 2006 12:56:09 -0000 1.4 @@ -1,4 +1,4 @@ -/* libasn1 error codes. The mapping to a TLS alert is also shown in +/* libtasn1 error codes. The mapping to a TLS alert is also shown in * comments. */ Index: lib/gstr.c =================================================================== RCS file: /cvs/gnutls/libtasn1/lib/gstr.c,v retrieving revision 1.6 retrieving revision 1.8 diff -u -p -r1.6 -r1.8 --- lib/gstr.c 16 Jul 2005 11:25:32 -0000 1.6 +++ lib/gstr.c 9 Feb 2006 12:53:24 -0000 1.8 @@ -1,21 +1,23 @@ /* + * Copyright (C) 2006 Free Software Foundation * Copyright (C) 2002 Nikos Mavroyanopoulos * - * This file is part of LIBASN1. + * This file is part of LIBTASN1. * - * The LIBTASN1 library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either + * The LIBTASN1 library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA */ #include Index: lib/int.h =================================================================== RCS file: /cvs/gnutls/libtasn1/lib/int.h,v retrieving revision 1.27 retrieving revision 1.28 diff -u -p -r1.27 -r1.28 --- lib/int.h 16 Jul 2005 11:25:32 -0000 1.27 +++ lib/int.h 9 Feb 2006 12:30:38 -0000 1.28 @@ -1,22 +1,23 @@ /* - * Copyright (C) 2004 Simon Josefsson + * Copyright (C) 2004, 2006 Free Software Foundation, Inc. * Copyright (C) 2002 Fabio Fiorina * - * This file is part of LIBASN1. + * This file is part of LIBTASN1. * - * GNUTLS is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * The LIBTASN1 library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. * - * GNUTLS is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA */ #ifndef INT_H Index: lib/libtasn1.h =================================================================== RCS file: /cvs/gnutls/libtasn1/lib/libtasn1.h,v retrieving revision 1.30 retrieving revision 1.33 diff -u -p -r1.30 -r1.33 --- lib/libtasn1.h 31 Aug 2005 13:17:47 -0000 1.30 +++ lib/libtasn1.h 9 Feb 2006 12:53:24 -0000 1.33 @@ -1,6 +1,6 @@ /* + * Copyright (C) 2004, 2005, 2006 Free Software Foundation * Copyright (C) 2002 Fabio Fiorina - * Copyright (C) 2004, 2005 Simon Josefsson * * This file is part of LIBTASN1. * @@ -21,8 +21,8 @@ * */ -#ifndef LIBASN1_H -# define LIBASN1_H +#ifndef LIBTASN1_H +# define LIBTASN1_H #include /* for FILE* */ @@ -30,7 +30,7 @@ extern "C" { #endif -#define LIBTASN1_VERSION "0.2.17" +#define LIBTASN1_VERSION "0.2.18" #include #include @@ -42,10 +42,10 @@ extern "C" { /* (null character included) */ -typedef int asn1_retCode; /* type returned by libasn1 functions */ +typedef int asn1_retCode; /* type returned by libtasn1 functions */ /*****************************************/ - /* Errors returned by libasn1 functions */ + /* Errors returned by libtasn1 functions */ /*****************************************/ #define ASN1_SUCCESS 0 #define ASN1_FILE_NOT_FOUND 1 @@ -108,6 +108,7 @@ typedef struct node_asn_struct{ char *name; /* Node name */ unsigned int type; /* Node type */ unsigned char *value; /* Node value */ + int value_len; struct node_asn_struct *down; /* Pointer to the son node */ struct node_asn_struct *right; /* Pointer to the brother node */ struct node_asn_struct *left; /* Pointer to the next list element */ @@ -196,4 +197,4 @@ void libtasn1_perror(asn1_retCode error) } #endif -#endif /* LIBASN1_H */ +#endif /* LIBTASN1_H */ Index: lib/parser_aux.c =================================================================== RCS file: /cvs/gnutls/libtasn1/lib/parser_aux.c,v retrieving revision 1.13 retrieving revision 1.16 diff -u -p -r1.13 -r1.16 --- lib/parser_aux.c 16 Jul 2005 11:25:32 -0000 1.13 +++ lib/parser_aux.c 9 Feb 2006 12:53:24 -0000 1.16 @@ -1,22 +1,23 @@ /* + * Copyright (C) 2004, 2006 Free Software Foundation * Copyright (C) 2000,2001 Fabio Fiorina - * Copyright (C) 2004 Simon Josefsson * - * This file is part of LIBASN1. + * This file is part of LIBTASN1. * - * The LIBTASN1 library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either + * The LIBTASN1 library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA */ #include @@ -187,10 +188,12 @@ _asn1_set_value(node_asn *node,const uns if(node->value){ _asn1_free(node->value); node->value=NULL; + node->value_len = 0; } if(!len) return node; node->value=(unsigned char *) _asn1_malloc(len); if (node->value==NULL) return NULL; + node->value_len = len; memcpy(node->value,value,len); return node; Index: lib/structure.c =================================================================== RCS file: /cvs/gnutls/libtasn1/lib/structure.c,v retrieving revision 1.21 retrieving revision 1.24 diff -u -p -r1.21 -r1.24 --- lib/structure.c 16 Jul 2005 11:25:32 -0000 1.21 +++ lib/structure.c 9 Feb 2006 12:30:38 -0000 1.24 @@ -1,22 +1,23 @@ /* + * Copyright (C) 2004, 2006 Free Software Foundation * Copyright (C) 2002 Fabio Fiorina - * Copyright (C) 2004 Simon Josefsson * - * This file is part of LIBASN1. + * This file is part of LIBTASN1. * - * The LIBTASN1 library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public + * The LIBTASN1 library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA */ @@ -362,7 +363,8 @@ _asn1_copy_structure3(node_asn *source_n case TYPE_OCTET_STRING: case TYPE_BIT_STRING: case TYPE_GENERALSTRING: case TYPE_INTEGER: len2=-1; - len=_asn1_get_length_der(p_s->value,&len2); + len=_asn1_get_length_der(p_s->value,p_s->value_len,&len2); + if (len < 0) return NULL; _asn1_set_value(p_d,p_s->value,len+len2); break; default: @@ -726,17 +728,19 @@ asn1_print_structure(FILE *out,ASN1_TYPE case TYPE_INTEGER: if(p->value){ len2=-1; - len=_asn1_get_length_der(p->value,&len2); + len=_asn1_get_length_der(p->value,p->value_len,&len2); fprintf(out," value:0x"); - for(k=0;kvalue)[k+len2]); + if (len > 0) + for(k=0;kvalue)[k+len2]); } break; case TYPE_ENUMERATED: if(p->value){ len2=-1; - len=_asn1_get_length_der(p->value,&len2); + len=_asn1_get_length_der(p->value,p->value_len,&len2); fprintf(out," value:0x"); - for(k=0;kvalue)[k+len2]); + if (len > 0) + for(k=0;kvalue)[k+len2]); } break; case TYPE_TIME: @@ -751,25 +755,30 @@ asn1_print_structure(FILE *out,ASN1_TYPE case TYPE_BIT_STRING: if(p->value){ len2=-1; - len=_asn1_get_length_der(p->value,&len2); - fprintf(out," value(%i):",(len-1)*8-(p->value[len2])); - for(k=1;kvalue)[k+len2]); + len=_asn1_get_length_der(p->value,p->value_len,&len2); + if (len>0) + { + fprintf(out," value(%i):",(len-1)*8-(p->value[len2])); + for(k=1;kvalue)[k+len2]); + } } break; case TYPE_OCTET_STRING: if(p->value){ len2=-1; - len=_asn1_get_length_der(p->value,&len2); + len=_asn1_get_length_der(p->value,p->value_len,&len2); fprintf(out," value:"); - for(k=0;kvalue)[k+len2]); + if (len>0) + for(k=0;kvalue)[k+len2]); } break; case TYPE_GENERALSTRING: if(p->value){ len2=-1; - len=_asn1_get_length_der(p->value,&len2); + len=_asn1_get_length_der(p->value,p->value_len,&len2); fprintf(out," value:"); - for(k=0;kvalue)[k+len2]); + if (len>0) + for(k=0;kvalue)[k+len2]); } break; case TYPE_OBJECT_ID: @@ -778,9 +787,10 @@ asn1_print_structure(FILE *out,ASN1_TYPE case TYPE_ANY: if(p->value){ len3=-1; - len2=_asn1_get_length_der(p->value,&len3); + len2=_asn1_get_length_der(p->value,p->value_len,&len3); fprintf(out," value:"); - for(k=0;kvalue)[k+len3]); + if (len2>0) + for(k=0;kvalue)[k+len3]); } break; case TYPE_SET: Index: src/CertificateExample.c =================================================================== RCS file: /cvs/gnutls/libtasn1/src/CertificateExample.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -p -r1.9 -r1.10 --- src/CertificateExample.c 16 Jul 2005 11:32:10 -0000 1.9 +++ src/CertificateExample.c 9 Feb 2006 12:24:39 -0000 1.10 @@ -1,4 +1,5 @@ /* + * Copyright (C) 2006 Free Software Foundation * Copyright (C) 2000,2001 Fabio Fiorina * * This file is part of LIBTASN1. Index: src/CrlExample.c =================================================================== RCS file: /cvs/gnutls/libtasn1/src/CrlExample.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -p -r1.9 -r1.10 --- src/CrlExample.c 16 Jul 2005 11:32:11 -0000 1.9 +++ src/CrlExample.c 9 Feb 2006 12:24:39 -0000 1.10 @@ -1,4 +1,5 @@ /* + * Copyright (C) 2006 Free Software Foundation * Copyright (C) 2000,2001 Fabio Fiorina * * This file is part of LIBTASN1. Index: src/Makefile.am =================================================================== RCS file: /cvs/gnutls/libtasn1/src/Makefile.am,v retrieving revision 1.4 retrieving revision 1.6 diff -u -p -r1.4 -r1.6 --- src/Makefile.am 26 Feb 2004 16:12:06 -0000 1.4 +++ src/Makefile.am 9 Feb 2006 12:24:39 -0000 1.6 @@ -1,4 +1,23 @@ -INCLUDES = -I../lib +## Process this file with automake to produce Makefile.in +# Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation +# +# This file is part of LIBTASN1. +# +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This file is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +INCLUDES = -I$(top_srcdir)/lib EXTRA_DIST = pkix.asn pkix_asn1_tab.c asn1Coding_test.asn asn1Coding_test.asg Index: src/asn1Coding.c =================================================================== RCS file: /cvs/gnutls/libtasn1/src/asn1Coding.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -p -r1.11 -r1.12 --- src/asn1Coding.c 12 Aug 2005 13:35:03 -0000 1.11 +++ src/asn1Coding.c 9 Feb 2006 12:24:39 -0000 1.12 @@ -1,4 +1,5 @@ /* + * Copyright (C) 2006 Free Software Foundation * Copyright (C) 2002 Fabio Fiorina * * This file is part of LIBTASN1. Index: src/asn1Decoding.c =================================================================== RCS file: /cvs/gnutls/libtasn1/src/asn1Decoding.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -p -r1.9 -r1.10 --- src/asn1Decoding.c 12 Aug 2005 13:35:47 -0000 1.9 +++ src/asn1Decoding.c 9 Feb 2006 12:24:39 -0000 1.10 @@ -1,4 +1,5 @@ /* + * Copyright (C) 2006 Free Software Foundation * Copyright (C) 2002 Fabio Fiorina * * This file is part of LIBTASN1. Index: src/asn1Parser.c =================================================================== RCS file: /cvs/gnutls/libtasn1/src/asn1Parser.c,v retrieving revision 1.9 retrieving revision 1.11 diff -u -p -r1.9 -r1.11 --- src/asn1Parser.c 12 Aug 2005 13:36:14 -0000 1.9 +++ src/asn1Parser.c 9 Feb 2006 12:53:25 -0000 1.11 @@ -1,4 +1,5 @@ /* + * Copyright (C) 2006 Free Software Foundation * Copyright (C) 2002 Fabio Fiorina * * This file is part of LIBTASN1. @@ -40,7 +41,7 @@ #include #endif -char version_man[] = "asn1Parser (GNU libasn1) " VERSION; +char version_man[] = "asn1Parser (GNU libtasn1) " VERSION; char help_man[] = "asn1Parser reads files with ASN1 definitions and\n" "generates a C array to use with libtasn1 functions.\n" @@ -192,7 +193,7 @@ main(int argc,char *argv[]) printf("asn1Parser: %s\n",errorDescription); break; default: - printf("libasn1 ERROR: %s\n",libtasn1_strerror(parse_result)); + printf("libtasn1 ERROR: %s\n",libtasn1_strerror(parse_result)); } Index: tests/Makefile.am =================================================================== RCS file: /cvs/gnutls/libtasn1/tests/Makefile.am,v retrieving revision 1.3 retrieving revision 1.4 diff -u -p -r1.3 -r1.4 --- tests/Makefile.am 8 Sep 2004 19:46:33 -0000 1.3 +++ tests/Makefile.am 27 Jan 2006 12:25:51 -0000 1.4 @@ -9,3 +9,7 @@ Test_parser_LDADD = ../lib/libtasn1.la Test_tree_SOURCES = Test_tree.c Test_tree_LDADD = ../lib/libtasn1.la + +TESTS_ENVIRONMENT = \ + ASN1PARSER=$(srcdir)/Test_parser.asn \ + ASN1TREE=$(srcdir)/Test_tree.asn Index: tests/Test_parser.c =================================================================== RCS file: /cvs/gnutls/libtasn1/tests/Test_parser.c,v retrieving revision 1.9 retrieving revision 1.11 diff -u -p -r1.9 -r1.11 --- tests/Test_parser.c 16 Jul 2005 11:32:11 -0000 1.9 +++ tests/Test_parser.c 9 Feb 2006 12:33:05 -0000 1.11 @@ -1,4 +1,5 @@ /* + * Copyright (C) 2006 Free Software Foundation * Copyright (C) 2002 Fabio Fiorina * * This file is part of LIBTASN1. @@ -38,7 +39,7 @@ typedef struct{ char *errorDescription; } test_type; -char fileCorrectName[]="Test_parser.asn"; +char *fileCorrectName; char fileErroredName[]="Test_parser_ERROR.asn"; #define _FILE_ "Test_parser_ERROR.asn" @@ -149,10 +150,14 @@ main(int argc,char *argv[]) test_type *test; int errorCounter=0,testCounter=0; + fileCorrectName = getenv ("ASN1PARSER"); + if (!fileCorrectName) + fileCorrectName="Test_parser.asn"; + printf("\n\n/****************************************/\n"); printf( "/* Test sequence : Test_parser */\n"); printf( "/****************************************/\n\n"); - + printf("ASN1PARSER: %s\n", fileCorrectName); result=asn1_parser2tree(fileCorrectName,&definitions,errorDescription); Index: tests/Test_tree.c =================================================================== RCS file: /cvs/gnutls/libtasn1/tests/Test_tree.c,v retrieving revision 1.18 retrieving revision 1.20 diff -u -p -r1.18 -r1.20 --- tests/Test_tree.c 16 Jul 2005 11:32:11 -0000 1.18 +++ tests/Test_tree.c 9 Feb 2006 12:33:05 -0000 1.20 @@ -1,4 +1,5 @@ /* + * Copyright (C) 2006 Free Software Foundation * Copyright (C) 2002 Fabio Fiorina * * This file is part of LIBTASN1. @@ -415,17 +416,22 @@ main(int argc,char *argv[]) int k; int start,end; const char *str_p=NULL; + const char *treefile = getenv ("ASN1TREE"); + + if (!treefile) + treefile = "Test_tree.asn"; printf("\n\n/****************************************/\n"); printf( "/* Test sequence : Test_tree */\n"); printf( "/****************************************/\n\n"); + printf("ASN1TREE: %s\n", treefile); /* Check version */ if(asn1_check_version("0.2.11")==NULL) printf("\nLibrary version check ERROR:\n actual version: %s\n\n",asn1_check_version(NULL)); if(1) - result=asn1_parser2tree("Test_tree.asn",&definitions,errorDescription); + result=asn1_parser2tree(treefile,&definitions,errorDescription); else result=asn1_array2tree(Test_tree_asn1_tab,&definitions,errorDescription);