[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] GNU libtasn1 branch, master, updated. libtasn1_2_10-8-g263124f
From: |
Simon Josefsson |
Subject: |
[SCM] GNU libtasn1 branch, master, updated. libtasn1_2_10-8-g263124f |
Date: |
Mon, 14 Nov 2011 14:23:05 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU libtasn1".
http://git.savannah.gnu.org/cgit/libtasn1.git/commit/?id=263124f61a84d5b626c1169c2ee2cc66ff30b282
The branch, master has been updated
via 263124f61a84d5b626c1169c2ee2cc66ff30b282 (commit)
via 7aaa756e4163585b52e80c97cc80c7f2bf6e9aa4 (commit)
via 4d9a445404ad7225a6a07db9d886c32bcfad6392 (commit)
via 71f92d91519277be2051212b9aa002323276ae9d (commit)
via d76a9b4dbf9712b33e60da01f97acf7f7614f5b6 (commit)
from 52d189b435eb7511eda816787e76709a317f6927 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 263124f61a84d5b626c1169c2ee2cc66ff30b282
Author: Simon Josefsson <address@hidden>
Date: Mon Nov 14 15:13:22 2011 +0100
Cleanup and add some more test vectors.
commit 7aaa756e4163585b52e80c97cc80c7f2bf6e9aa4
Author: Simon Josefsson <address@hidden>
Date: Mon Nov 14 15:04:26 2011 +0100
Add.
commit 4d9a445404ad7225a6a07db9d886c32bcfad6392
Author: Simon Josefsson <address@hidden>
Date: Mon Nov 14 15:03:47 2011 +0100
Mark bit string bitmask variable with static and unsigned keywords.
commit 71f92d91519277be2051212b9aa002323276ae9d
Author: Simon Josefsson <address@hidden>
Date: Mon Nov 14 14:36:04 2011 +0100
tests: Added self-test of bit string functions.
commit d76a9b4dbf9712b33e60da01f97acf7f7614f5b6
Author: Simon Josefsson <address@hidden>
Date: Mon Nov 14 13:55:40 2011 +0100
Update gnulib files.
-----------------------------------------------------------------------
Summary of changes:
.gitignore | 2 +
GNUmakefile | 8 ++-
NEWS | 1 +
doc/fdl-1.3.texi | 2 +-
gl/Makefile.am | 3 +
gl/errno.in.h | 118 +++++++++++++++++++++--------
gl/m4/stdlib_h.m4 | 9 ++-
gl/stdlib.in.h | 28 +++++++-
lib/coding.c | 3 +-
maint.mk | 42 +++++++---
tests/Makefile.am | 4 +-
tests/Test_simple.c | 209 +++++++++++++++++++++++++++++++++++++++++++++++++++
12 files changed, 376 insertions(+), 53 deletions(-)
create mode 100644 tests/Test_simple.c
diff --git a/.gitignore b/.gitignore
index 1df9477..ab95174 100644
--- a/.gitignore
+++ b/.gitignore
@@ -178,5 +178,7 @@ tests/Test_indefinite.o
tests/Test_parser
tests/Test_parser.o
tests/Test_parser_ERROR.asn
+tests/Test_simple
+tests/Test_simple.o
tests/Test_tree
tests/Test_tree.o
diff --git a/GNUmakefile b/GNUmakefile
index 6e00ec8..86bc60f 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -45,12 +45,13 @@ include Makefile
# Some projects override e.g., _autoreconf here.
-include $(srcdir)/cfg.mk
-include $(srcdir)/maint.mk
# Allow cfg.mk to override these.
_build-aux ?= build-aux
_autoreconf ?= autoreconf -v
+include $(srcdir)/maint.mk
+
# Ensure that $(VERSION) is up to date for dist-related targets, but not
# for others: rerunning autoreconf and recompiling everything isn't cheap.
_have-git-version-gen := \
@@ -100,6 +101,11 @@ srcdir = .
# The package can override .DEFAULT_GOAL to run actions like autoreconf.
-include ./cfg.mk
+
+# Allow cfg.mk to override these.
+_build-aux ?= build-aux
+_autoreconf ?= autoreconf -v
+
include ./maint.mk
ifeq ($(.DEFAULT_GOAL),abort-due-to-no-makefile)
diff --git a/NEWS b/NEWS
index 1be6353..97d5f7b 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,7 @@
GNU Libtasn1 NEWS -*- outline -*-
* Noteworthy changes in release 2.11 (????-??-??) [stable]
+- tests: Added self-test of bit string functions.
- build: Added windows/libtasn14win.mk rules to produce Windows binaries.
* Noteworthy changes in release 2.10 (2011-10-25) [stable]
diff --git a/doc/fdl-1.3.texi b/doc/fdl-1.3.texi
index fc19ddd..3b83db4 100644
--- a/doc/fdl-1.3.texi
+++ b/doc/fdl-1.3.texi
@@ -481,7 +481,7 @@ license notices just after the title page:
@end smallexample
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
-replace the address@hidden'' line with this:
+replace the address@hidden''@: line with this:
@smallexample
@group
diff --git a/gl/Makefile.am b/gl/Makefile.am
index 20891be..ae6049b 100644
--- a/gl/Makefile.am
+++ b/gl/Makefile.am
@@ -584,6 +584,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status
$(CXXDEFS_H) \
-e 's/@''GNULIB_MKSTEMPS''@/$(GNULIB_MKSTEMPS)/g' \
-e 's/@''GNULIB_POSIX_OPENPT''@/$(GNULIB_POSIX_OPENPT)/g' \
-e 's/@''GNULIB_PTSNAME''@/$(GNULIB_PTSNAME)/g' \
+ -e 's/@''GNULIB_PTSNAME_R''@/$(GNULIB_PTSNAME_R)/g' \
-e 's/@''GNULIB_PUTENV''@/$(GNULIB_PUTENV)/g' \
-e 's/@''GNULIB_RANDOM_R''@/$(GNULIB_RANDOM_R)/g' \
-e 's/@''GNULIB_REALLOC_POSIX''@/$(GNULIB_REALLOC_POSIX)/g' \
@@ -611,6 +612,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status
$(CXXDEFS_H) \
-e 's|@''HAVE_MKSTEMPS''@|$(HAVE_MKSTEMPS)|g' \
-e 's|@''HAVE_POSIX_OPENPT''@|$(HAVE_POSIX_OPENPT)|g' \
-e 's|@''HAVE_PTSNAME''@|$(HAVE_PTSNAME)|g' \
+ -e 's|@''HAVE_PTSNAME_R''@|$(HAVE_PTSNAME_R)|g' \
-e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \
-e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \
-e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \
@@ -628,6 +630,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status
$(CXXDEFS_H) \
-e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \
-e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \
-e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
+ -e 's|@''REPLACE_PTSNAME_R''@|$(REPLACE_PTSNAME_R)|g' \
-e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
-e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \
-e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \
diff --git a/gl/errno.in.h b/gl/errno.in.h
index 5a7533a..b6014b4 100644
--- a/gl/errno.in.h
+++ b/gl/errno.in.h
@@ -33,50 +33,106 @@
/* On native Windows platforms, many macros are not defined. */
# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-/* POSIX says that EAGAIN and EWOULDBLOCK may have the same value. */
-# define EWOULDBLOCK EAGAIN
-
-/* Values >= 100 seem safe to use. */
-# define ETXTBSY 100
-# define GNULIB_defined_ETXTBSY 1
+/* These are the same values as defined by MSVC 10, for interoperability. */
+
+# ifndef ENOMSG
+# define ENOMSG 122
+# define GNULIB_defined_ENOMSG 1
+# endif
+
+# ifndef EIDRM
+# define EIDRM 111
+# define GNULIB_defined_EIDRM 1
+# endif
+
+# ifndef ENOLINK
+# define ENOLINK 121
+# define GNULIB_defined_ENOLINK 1
+# endif
+
+# ifndef EPROTO
+# define EPROTO 134
+# define GNULIB_defined_EPROTO 1
+# endif
+
+# ifndef EBADMSG
+# define EBADMSG 104
+# define GNULIB_defined_EBADMSG 1
+# endif
+
+# ifndef EOVERFLOW
+# define EOVERFLOW 132
+# define GNULIB_defined_EOVERFLOW 1
+# endif
+
+# ifndef ENOTSUP
+# define ENOTSUP 129
+# define GNULIB_defined_ENOTSUP 1
+# endif
+
+# ifndef ENETRESET
+# define ENETRESET 117
+# define GNULIB_defined_ENETRESET 1
+# endif
+
+# ifndef ECONNABORTED
+# define ECONNABORTED 106
+# define GNULIB_defined_ECONNABORTED 1
+# endif
+
+# ifndef ECANCELED
+# define ECANCELED 105
+# define GNULIB_defined_ECANCELED 1
+# endif
+
+# ifndef EINPROGRESS
+# define EINPROGRESS 112
+# define EALREADY 103
+# define ENOTSOCK 128
+# define EDESTADDRREQ 109
+# define EMSGSIZE 115
+# define EPROTOTYPE 136
+# define ENOPROTOOPT 123
+# define EPROTONOSUPPORT 135
+# define EOPNOTSUPP 130
+# define EAFNOSUPPORT 102
+# define EADDRINUSE 100
+# define EADDRNOTAVAIL 101
+# define ENETDOWN 116
+# define ENETUNREACH 118
+# define ECONNRESET 108
+# define ENOBUFS 119
+# define EISCONN 113
+# define ENOTCONN 126
+# define ETIMEDOUT 138
+# define ECONNREFUSED 107
+# define ELOOP 114
+# define EHOSTUNREACH 110
+# define EWOULDBLOCK 140
+# define ETXTBSY 139
+# define ENODATA 120 /* not required by POSIX */
+# define ENOSR 124 /* not required by POSIX */
+# define ENOSTR 125 /* not required by POSIX */
+# define ENOTRECOVERABLE 127 /* not required by POSIX */
+# define EOWNERDEAD 133 /* not required by POSIX */
+# define ETIME 137 /* not required by POSIX */
+# define EOTHER 131 /* not required by POSIX */
+# define GNULIB_defined_ESOCK 1
+# endif
/* These are intentionally the same values as the WSA* error numbers, defined
in <winsock2.h>. */
-# define EINPROGRESS 10036
-# define EALREADY 10037
-# define ENOTSOCK 10038
-# define EDESTADDRREQ 10039
-# define EMSGSIZE 10040
-# define EPROTOTYPE 10041
-# define ENOPROTOOPT 10042
-# define EPROTONOSUPPORT 10043
# define ESOCKTNOSUPPORT 10044 /* not required by POSIX */
-# define EOPNOTSUPP 10045
# define EPFNOSUPPORT 10046 /* not required by POSIX */
-# define EAFNOSUPPORT 10047
-# define EADDRINUSE 10048
-# define EADDRNOTAVAIL 10049
-# define ENETDOWN 10050
-# define ENETUNREACH 10051
-# define ENETRESET 10052
-# define ECONNABORTED 10053
-# define ECONNRESET 10054
-# define ENOBUFS 10055
-# define EISCONN 10056
-# define ENOTCONN 10057
# define ESHUTDOWN 10058 /* not required by POSIX */
# define ETOOMANYREFS 10059 /* not required by POSIX */
-# define ETIMEDOUT 10060
-# define ECONNREFUSED 10061
-# define ELOOP 10062
# define EHOSTDOWN 10064 /* not required by POSIX */
-# define EHOSTUNREACH 10065
# define EPROCLIM 10067 /* not required by POSIX */
# define EUSERS 10068 /* not required by POSIX */
# define EDQUOT 10069
# define ESTALE 10070
# define EREMOTE 10071 /* not required by POSIX */
-# define GNULIB_defined_ESOCK 1
+# define GNULIB_defined_EWINSOCK 1
# endif
diff --git a/gl/m4/stdlib_h.m4 b/gl/m4/stdlib_h.m4
index fbdba98..0a8a9e5 100644
--- a/gl/m4/stdlib_h.m4
+++ b/gl/m4/stdlib_h.m4
@@ -1,4 +1,4 @@
-# stdlib_h.m4 serial 37
+# stdlib_h.m4 serial 39
dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -21,8 +21,8 @@ AC_DEFUN([gl_STDLIB_H],
#endif
]], [_Exit atoll canonicalize_file_name getloadavg getsubopt grantpt
initstate_r mkdtemp mkostemp mkostemps mkstemp mkstemps posix_openpt
- ptsname random_r realpath rpmatch setenv setstate_r srandom_r strtod
- strtoll strtoull unlockpt unsetenv])
+ ptsname ptsname_r random_r realpath rpmatch setenv setstate_r srandom_r
+ strtod strtoll strtoull unlockpt unsetenv])
])
AC_DEFUN([gl_STDLIB_MODULE_INDICATOR],
@@ -52,6 +52,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
GNULIB_MKSTEMPS=0; AC_SUBST([GNULIB_MKSTEMPS])
GNULIB_POSIX_OPENPT=0; AC_SUBST([GNULIB_POSIX_OPENPT])
GNULIB_PTSNAME=0; AC_SUBST([GNULIB_PTSNAME])
+ GNULIB_PTSNAME_R=0; AC_SUBST([GNULIB_PTSNAME_R])
GNULIB_PUTENV=0; AC_SUBST([GNULIB_PUTENV])
GNULIB_RANDOM_R=0; AC_SUBST([GNULIB_RANDOM_R])
GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX])
@@ -79,6 +80,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
HAVE_MKSTEMPS=1; AC_SUBST([HAVE_MKSTEMPS])
HAVE_POSIX_OPENPT=1; AC_SUBST([HAVE_POSIX_OPENPT])
HAVE_PTSNAME=1; AC_SUBST([HAVE_PTSNAME])
+ HAVE_PTSNAME_R=1; AC_SUBST([HAVE_PTSNAME_R])
HAVE_RANDOM_H=1; AC_SUBST([HAVE_RANDOM_H])
HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R])
HAVE_REALPATH=1; AC_SUBST([HAVE_REALPATH])
@@ -97,6 +99,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
REPLACE_MALLOC=0; AC_SUBST([REPLACE_MALLOC])
REPLACE_MBTOWC=0; AC_SUBST([REPLACE_MBTOWC])
REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP])
+ REPLACE_PTSNAME_R=0; AC_SUBST([REPLACE_PTSNAME_R])
REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV])
REPLACE_REALLOC=0; AC_SUBST([REPLACE_REALLOC])
REPLACE_REALPATH=0; AC_SUBST([REPLACE_REALPATH])
diff --git a/gl/stdlib.in.h b/gl/stdlib.in.h
index 19d0d67..a59cb08 100644
--- a/gl/stdlib.in.h
+++ b/gl/stdlib.in.h
@@ -247,7 +247,7 @@ _GL_CXXALIASWARN (grantpt);
#elif defined GNULIB_POSIXCHECK
# undef grantpt
# if HAVE_RAW_DECL_GRANTPT
-_GL_WARN_ON_USE (ptsname, "grantpt is not portable - "
+_GL_WARN_ON_USE (grantpt, "grantpt is not portable - "
"use gnulib module grantpt for portability");
# endif
#endif
@@ -455,6 +455,32 @@ _GL_WARN_ON_USE (ptsname, "ptsname is not portable - "
# endif
#endif
+#if @GNULIB_PTSNAME_R@
+/* Set the pathname of the pseudo-terminal slave associated with
+ the master FD is open on and return 0, or set errno and return
+ non-zero on errors. */
+# if @REPLACE_PTSNAME_R@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef ptsname_r
+# define ptsname_r rpl_ptsname_r
+# endif
+_GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
+_GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
+# else
+# if address@hidden@
+_GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
+# endif
+_GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
+# endif
+_GL_CXXALIASWARN (ptsname_r);
+#elif defined GNULIB_POSIXCHECK
+# undef ptsname_r
+# if HAVE_RAW_DECL_PTSNAME_R
+_GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - "
+ "use gnulib module ptsname_r for portability");
+# endif
+#endif
+
#if @GNULIB_PUTENV@
# if @REPLACE_PUTENV@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
diff --git a/lib/coding.c b/lib/coding.c
index 3cc0ef8..5cdab62 100644
--- a/lib/coding.c
+++ b/lib/coding.c
@@ -322,7 +322,8 @@ _asn1_objectid_der (unsigned char *str, unsigned char *der,
int *der_len)
}
-const char bit_mask[] = { 0xFF, 0xFE, 0xFC, 0xF8, 0xF0, 0xE0, 0xC0, 0x80 };
+static const unsigned char bit_mask[] =
+ { 0xFF, 0xFE, 0xFC, 0xF8, 0xF0, 0xE0, 0xC0, 0x80 };
/**
* asn1_bit_der:
diff --git a/maint.mk b/maint.mk
index 51f617b..d2f5830 100644
--- a/maint.mk
+++ b/maint.mk
@@ -21,8 +21,12 @@
# ME := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
ME := maint.mk
-# Override this in cfg.mk if you use a non-standard build-aux directory.
-build_aux ?= $(srcdir)/build-aux
+# Diagnostic for continued use of deprecated variable.
+# Remove in 2013
+ifneq ($(build_aux),)
+ $(error "$(ME): \
+set $$(_build-aux) relative to $$(srcdir) instead of $$(build_aux)")
+endif
# Do not save the original name or timestamp in the .tar.gz file.
# Use --rsyncable if available.
@@ -34,7 +38,7 @@ GZIP_ENV = '--no-name --best $(gzip_rsyncable)'
GIT = git
VC = $(GIT)
-VC_LIST = $(build_aux)/vc-list-files -C $(srcdir)
+VC_LIST = $(srcdir)/$(_build-aux)/vc-list-files -C $(srcdir)
# You can override this variable in cfg.mk to set your own regexp
# matching files to ignore.
@@ -274,7 +278,7 @@ define _sc_search_regexp
endef
sc_avoid_if_before_free:
- @$(build_aux)/useless-if-before-free \
+ @$(srcdir)/$(_build-aux)/useless-if-before-free \
$(useless_free_options) \
$$($(VC_LIST_EXCEPT) | grep -v useless-if-before-free) && \
{ echo '$(ME): found useless "if" before "free" above' 1>&2; \
@@ -618,7 +622,17 @@ _stddef_syms_re = NULL|offsetof|ptrdiff_t|size_t|wchar_t
# Prohibit the inclusion of stddef.h without an actual use.
sc_prohibit_stddef_without_use:
@h='stddef.h' \
- re='\<($(_stddef_syms_re)) *\(' \
+ re='\<($(_stddef_syms_re))\>' \
+ $(_sc_header_without_use)
+
+_de1 = dirfd|(close|(fd)?open|read|rewind|seek|tell)dir(64)?(_r)?
+_de2 = (versionsort|struct dirent|getdirentries|alphasort|scandir(at)?)(64)?
+_de3 = MAXNAMLEN|DIR|ino_t|d_ino|d_fileno|d_namlen
+_dirent_syms_re = $(_de1)|$(_de2)|$(_de3)
+# Prohibit the inclusion of dirent.h without an actual use.
+sc_prohibit_dirent_without_use:
+ @h='dirent.h' \
+ re='\<($(_dirent_syms_re))\>' \
$(_sc_header_without_use)
# Prohibit the inclusion of verify.h without an actual use.
@@ -749,10 +763,12 @@ gl_other_headers_ ?= \
# Perl -lne code to extract "significant" cpp-defined symbols from a
# gnulib header file, eliminating a few common false-positives.
+# The exempted names below are defined only conditionally in gnulib,
+# and hence sometimes must/may be defined in application code.
gl_extract_significant_defines_ = \
/^\# *define ([^_ (][^ (]*)(\s*\(|\s+\w+)/\
&& $$2 !~ /(?:rpl_|_used_without_)/\
- && $$1 !~ /^(?:NSIG)$$/\
+ && $$1 !~ /^(?:NSIG|ENODATA)$$/\
&& $$1 !~ /^(?:SA_RESETHAND|SA_RESTART)$$/\
and print $$1
@@ -1187,9 +1203,9 @@ bootstrap-tools ?= autoconf,automake,gnulib
# If it's not already specified, derive the GPG key ID from
# the signed tag we've just applied to mark this release.
gpg_key_ID ?= \
- $$(git cat-file tag v$(VERSION) > .ann-sig \
- && gpgv .ann-sig - < /dev/null 2>&1 \
- | sed -n '/.*key ID \([0-9A-F]*\)/s//\1/p'; rm -f .ann-sig)
+ $$(git cat-file tag v$(VERSION) \
+ | gpgv --status-fd 1 --keyring /dev/null - - 2>/dev/null \
+ | sed -n '/^\[GNUPG:\] ERRSIG /{s///;s/ .*//p;q}')
translation_project_ ?= address@hidden
@@ -1208,7 +1224,7 @@ else
endif
announcement: NEWS ChangeLog $(rel-files)
- @$(build_aux)/announce-gen \
+ @$(srcdir)/$(_build-aux)/announce-gen \
--mail-headers='$(announcement_mail_headers_)' \
--release-type=$(RELEASE_TYPE) \
--package=$(PACKAGE) \
@@ -1232,7 +1248,7 @@ upload_dest_dir_ ?= $(PACKAGE)
emit_upload_commands:
@echo =====================================
@echo =====================================
- @echo "$(build_aux)/gnupload $(GNUPLOADFLAGS) \\"
+ @echo "$(srcdir)/$(_build-aux)/gnupload $(GNUPLOADFLAGS) \\"
@echo " --to $(gnu_rel_host):$(upload_dest_dir_) \\"
@echo " $(rel-files)"
@echo '# send the ~/announce-$(my_distdir) e-mail'
@@ -1327,7 +1343,7 @@ web-manual:
@test -z "$(manual_title)" \
&& { echo define manual_title in cfg.mk 1>&2; exit 1; } || :
@cd '$(srcdir)/doc'; \
- $(SHELL) ../build-aux/gendocs.sh $(gendocs_options_) \
+ $(SHELL) ../$(_build-aux)/gendocs.sh $(gendocs_options_) \
-o '$(abs_builddir)/doc/manual' \
--email $(PACKAGE_BUGREPORT) $(PACKAGE) \
"$(PACKAGE_NAME) - $(manual_title)"
@@ -1392,7 +1408,7 @@ update-copyright-env ?=
update-copyright:
grep -l -w Copyright \
$$(export VC_LIST_EXCEPT_DEFAULT=COPYING && $(VC_LIST_EXCEPT)) \
- | $(update-copyright-env) xargs $(build_aux)/$@
+ | $(update-copyright-env) xargs $(srcdir)/$(_build-aux)/$@
# This tight_scope test is skipped with a warning if $(_gl_TS_headers) is not
# overridden and $(_gl_TS_dir)/Makefile.am does not mention noinst_HEADERS.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index ed76bf4..bc03513 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -34,10 +34,10 @@ dist_check_SCRIPTS += threadsafety
MOSTLYCLEANFILES = Test_parser_ERROR.asn
check_PROGRAMS = Test_parser Test_tree Test_encoding Test_indefinite \
- Test_errors
+ Test_errors Test_simple
TESTS = Test_parser Test_tree Test_encoding Test_indefinite \
- Test_errors crlf threadsafety
+ Test_errors Test_simple crlf threadsafety
TESTS_ENVIRONMENT = \
ASN1PARSER=$(srcdir)/Test_parser.asn \
diff --git a/tests/Test_simple.c b/tests/Test_simple.c
new file mode 100644
index 0000000..c2a4fc2
--- /dev/null
+++ b/tests/Test_simple.c
@@ -0,0 +1,209 @@
+/*
+ * Copyright (C) 2011 Free Software Foundation, Inc.
+ *
+ * This file is part of LIBTASN1.
+ *
+ * This program 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 3 of the License, 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Written by Simon Josefsson
+ *
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "libtasn1.h"
+
+struct tv
+{
+ size_t bitlen;
+ const char *bitstr;
+ size_t derlen;
+ const char *der;
+};
+
+static const struct tv tv[] = {
+ { 0, "", 2, "\x01\x00" },
+ { 1, "\x00", 3, "\x02\x07\x00" },
+ { 2, "\x00", 3, "\x02\x06\x00" },
+ { 3, "\x00", 3, "\x02\x05\x00" },
+ { 4, "\x00", 3, "\x02\x04\x00" },
+ { 5, "\x00", 3, "\x02\x03\x00" },
+ { 6, "\x00", 3, "\x02\x02\x00" },
+ { 7, "\x00", 3, "\x02\x01\x00" },
+ { 8, "\x00\x00", 3, "\x02\x00\x00" },
+ { 9, "\x00\x00", 4, "\x03\x07\x00\x00" },
+ { 10, "\x00\x00", 4, "\x03\x06\x00\x00" },
+ { 11, "\x00\x00", 4, "\x03\x05\x00\x00" },
+ { 12, "\x00\x00", 4, "\x03\x04\x00\x00" },
+ { 13, "\x00\x00", 4, "\x03\x03\x00\x00" },
+ { 14, "\x00\x00", 4, "\x03\x02\x00\x00" },
+ { 15, "\x00\x00", 4, "\x03\x01\x00\x00" },
+ { 16, "\x00\x00", 4, "\x03\x00\x00\x00" },
+ { 17, "\x00\x00\x00", 5, "\x04\x07\x00\x00\x00" },
+ { 18, "\x00\x00\x00", 5, "\x04\x06\x00\x00\x00" },
+ { 19, "\x00\x00\x00", 5, "\x04\x05\x00\x00\x00" },
+ { 1, "\xFF", 3, "\x02\x07\x80" },
+ { 2, "\xFF", 3, "\x02\x06\xc0" },
+ { 3, "\xFF", 3, "\x02\x05\xe0" },
+ { 4, "\xFF", 3, "\x02\x04\xf0" },
+ { 5, "\xFF", 3, "\x02\x03\xf8" },
+ { 6, "\xFF", 3, "\x02\x02\xfc" },
+ { 7, "\xFF", 3, "\x02\x01\xfe" },
+ { 8, "\xFF\xFF", 3, "\x02\x00\xff" },
+ { 9, "\xFF\xFF", 4, "\x03\x07\xff\x80" },
+ { 10, "\xFF\xFF", 4, "\x03\x06\xff\xc0" },
+ { 11, "\xFF\xFF", 4, "\x03\x05\xff\xe0" },
+ { 12, "\xFF\xFF", 4, "\x03\x04\xff\xf0" },
+ { 13, "\xFF\xFF", 4, "\x03\x03\xff\xf8" },
+ { 14, "\xFF\xFF", 4, "\x03\x02\xff\xfc" },
+ { 15, "\xFF\xFF", 4, "\x03\x01\xff\xfe" },
+ { 16, "\xFF\xFF", 4, "\x03\x00\xff\xff" },
+ { 17, "\xFF\xFF\xFF", 5, "\x04\x07\xff\xff\x80" },
+ { 18, "\xFF\xFF\xFF", 5, "\x04\x06\xff\xff\xc0" },
+ { 19, "\xFF\xFF\xFF", 5, "\x04\x05\xff\xff\xe0" },
+};
+
+int
+main (int argc, char *argv[])
+{
+ asn1_retCode result;
+ unsigned char der[100];
+ unsigned char str[100];
+ int der_len = sizeof (der);
+ int str_size = sizeof (str);
+ int ret_len, bit_len;
+ size_t i;
+
+ /* Dummy test */
+
+ asn1_bit_der (NULL, 0, der, &der_len);
+ result = asn1_get_bit_der (der, 0, &ret_len, str, str_size, &bit_len);
+ if (result != ASN1_GENERIC_ERROR)
+ {
+ fprintf (stderr, "asn1_get_bit_der zero\n");
+ return 1;
+ }
+
+ /* Encode short strings with increasing bit lengths */
+
+ for (i = 0; i < sizeof (tv) / sizeof (tv[0]); i++)
+ {
+ /* Encode */
+
+ asn1_bit_der (tv[i].bitstr, tv[i].bitlen, der, &der_len);
+
+#if 0
+ {
+ size_t j;
+ for (j = 0; j < der_len; j++)
+ printf ("\\x%02x", der[j]);
+ printf ("\n");
+ }
+#endif
+
+ if (der_len != tv[i].derlen
+ || memcmp (der, tv[i].der, der_len) != 0)
+ {
+ fprintf (stderr, "asn1_bit_der iter %d\n", i);
+ return 1;
+ }
+
+ /* Decode it */
+
+ result = asn1_get_bit_der (der, der_len, &ret_len, str,
+ str_size, &bit_len);
+ if (result != ASN1_SUCCESS || ret_len != tv[i].derlen
+ || bit_len != tv[i].bitlen)
+ {
+ fprintf (stderr, "asn1_get_bit_der iter %d\n", i);
+ return 1;
+ }
+ }
+
+
+ /* Decode sample from "A Layman's Guide to a Subset of ASN.1, BER,
+ and DER" section 5.4 "BIT STRING": "The BER encoding of the BIT
+ STRING value "011011100101110111" can be any of the following,
+ among others, depending on the choice of padding bits, the form
+ of length octets [...]".
+ */
+
+ /* 03 04 06 6e 5d c0 DER encoding */
+
+ memcpy (der, "\x04\x06\x6e\x5d\xc0", 5);
+ der_len = 5;
+
+ result = asn1_get_bit_der (der, der_len, &ret_len, str, str_size, &bit_len);
+ if (result != ASN1_SUCCESS || ret_len != 5
+ || bit_len != 18 || memcmp (str, "\x6e\x5d\xc0", 3) != 0)
+ {
+ fprintf (stderr, "asn1_get_bit_der example\n");
+ return 1;
+ }
+
+ der_len = sizeof (der);
+ asn1_bit_der (str, bit_len, der, &der_len);
+ if (der_len != 5 || memcmp (der, "\x04\x06\x6e\x5d\xc0", 5) != 0)
+ {
+ fprintf (stderr, "asn1_bit_der example roundtrip\n");
+ return 1;
+ }
+
+ /* 03 04 06 6e 5d e0 padded with "100000" */
+
+ memcpy (der, "\x04\x06\x6e\x5d\xe0", 5);
+ der_len = 5;
+
+ result = asn1_get_bit_der (der, der_len, &ret_len, str, str_size, &bit_len);
+ if (result != ASN1_SUCCESS || ret_len != 5
+ || bit_len != 18 || memcmp (str, "\x6e\x5d\xe0", 3) != 0)
+ {
+ fprintf (stderr, "asn1_get_bit_der example padded\n");
+ return 1;
+ }
+
+ der_len = sizeof (der);
+ asn1_bit_der (str, bit_len, der, &der_len);
+ if (der_len != 5 || memcmp (der, "\x04\x06\x6e\x5d\xc0", 5) != 0)
+ {
+ fprintf (stderr, "asn1_bit_der example roundtrip\n");
+ return 1;
+ }
+
+ /* 03 81 04 06 6e 5d c0 long form of length octets */
+
+ memcpy (der, "\x81\x04\x06\x6e\x5d\xc0", 6);
+ der_len = 6;
+
+ result = asn1_get_bit_der (der, der_len, &ret_len, str, str_size, &bit_len);
+
+ if (result != ASN1_SUCCESS || ret_len != 6
+ || bit_len != 18 || memcmp (str, "\x6e\x5d\xc0", 3) != 0)
+ {
+ fprintf (stderr, "asn1_get_bit_der example long form\n");
+ return 1;
+ }
+
+ der_len = sizeof (der);
+ asn1_bit_der (str, bit_len, der, &der_len);
+ if (der_len != 5 || memcmp (der, "\x04\x06\x6e\x5d\xc0", 5) != 0)
+ {
+ fprintf (stderr, "asn1_bit_der example roundtrip\n");
+ return 1;
+ }
+
+ return 0;
+}
hooks/post-receive
--
GNU libtasn1
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] GNU libtasn1 branch, master, updated. libtasn1_2_10-8-g263124f,
Simon Josefsson <=