libksba.git
5 months agoFix make distcheck. master
Marcus Brinkmann [Tue, 22 Aug 2017 13:08:24 +0000 (15:08 +0200)]
Fix make distcheck.

* configure.ac: Revert last change and define HAVE_GCOV if not
in maintainer mode.
* tests/detached-sig.csm: New file.
* tests/Makefile.am (EXTRA_DIST): Add detached-sig.csm.
* tests/t-cms-parser.c (main): Use detached-sig.csm as test file.

Signed-off-by: Marcus Brinkmann <mb@g10code.com>
5 months agoFix non-maintainer build.
Marcus Brinkmann [Fri, 18 Aug 2017 18:05:41 +0000 (20:05 +0200)]
Fix non-maintainer build.

* configure.ac: Always check for gcov program to make sure
the automake variable is defined.

Signed-off-by: Marcus Brinkmann <mb@g10code.com>
5 months agoFix all compiler warnings.
Marcus Brinkmann [Fri, 18 Aug 2017 18:02:04 +0000 (20:02 +0200)]
Fix all compiler warnings.

* src/asn1-parse.y (import_defs, identifier_list): Comment out unused part
of the grammar that causes a shift-reduce conflict.
* src/cms-parser.c (_ksba_cms_parse_enveloped_data_part_1): Initialize
some variables to help suppress uninitialized use warning.
* src/crl.c (oidstr_issuingDistributionPoint): Comment out unused OID.
* src/gen-help.h (ksba_asn_parse_file, ksba_asn_tree_dump): Add declarations.

Signed-off-by: Marcus Brinkmann <mb@g10code.com>
5 months agoFix memory leaks in ksba_cms_identify and tests.
Kai Michaelis [Tue, 15 Aug 2017 14:30:04 +0000 (16:30 +0200)]
Fix memory leaks in ksba_cms_identify and tests.

* tests/t-reader.c: free prepend_srcdir() result.
* tests/t-cms-parser: ditto & release writer instance.
* src/cms.c: fix mem leak in ksba_cms_identify().

5 months agoEnable CMS parser test.
Kai Michaelis [Thu, 10 Aug 2017 15:17:30 +0000 (17:17 +0200)]
Enable CMS parser test.

* tests/Makefile.am: add t-cms-parser to the list of tests.
* tests/t-cms-parser.c: change default test file to something that
  exists.

5 months agoGenerate coverage information.
Kai Michaelis [Wed, 9 Aug 2017 16:02:06 +0000 (18:02 +0200)]
Generate coverage information.

* autogen.sh: add options --coverage and --report to help w/ coverage
info collection and reporting.
* m4/gcov.m4: new file. Boilerplate for locating gcov et.al.
* Makefile.am: add coverage-report target

GnuPG-Bud-Id: 3050
--
To measure test coverage gcov and lcov needs to be installed and
./configure called w/ --enable-gcov. The coverage-html make target will
then create a HTML report.

5 months agoAdd missing include.
Kai Michaelis [Wed, 9 Aug 2017 13:52:36 +0000 (15:52 +0200)]
Add missing include.

* src/reader.c: include unistd.h

5 months agoDon't use decls in for-loop headers.
Kai Michaelis [Wed, 9 Aug 2017 13:40:53 +0000 (15:40 +0200)]
Don't use decls in for-loop headers.

libksba compiles w/ C90

5 months agoAdd missing fd support to ksba_reader_t.
Kai Michaelis [Wed, 9 Aug 2017 13:29:11 +0000 (15:29 +0200)]
Add missing fd support to ksba_reader_t.

* src/reader.c: add branches for READER_TYPE_FD
* tests/t-reader.c: tests for above

GnuPG-bug-id: 3072

7 months agoconfigure: Add flag to disable documentation build.
Marcus Brinkmann [Mon, 19 Jun 2017 12:16:39 +0000 (14:16 +0200)]
configure: Add flag to disable documentation build.

* configure.ac: Add new option --disable-doc.
(BUILD_DOC): New automake conditional.
* Makefile.am (SUBDIRS): Make doc optional based on BUILD_DOC.
(DISTCHECK_CONFIGURE_FLAGS): New variable.

Signed-Off-By: Marcus Brinkmann <mb@g10code.com>
9 months agotests: Open testfile in binary mode
Andre Heinecke [Thu, 20 Apr 2017 11:47:33 +0000 (13:47 +0200)]
tests: Open testfile in binary mode

* tests/t-crl-parser.c (one_file): Read file in binary mode.

--
The tests are currently not even compiled for windows but
this fixes t-crl-parser at least if run manually on windows.

10 months agobuild: Use macOS' compatibility macros to enable all features.
Justus Winter [Wed, 8 Mar 2017 11:59:09 +0000 (12:59 +0100)]
build: Use macOS' compatibility macros to enable all features.

* configure.ac: On macOS, use the compatibility macros to expose every
feature of the libc.  This is the equivalent of _GNU_SOURCE on GNU
libc.
--
Not defining this leads to compilation errors or superfluous warnings
on macOS.

GnuPG-bug-id: 2910
Signed-off-by: Justus Winter <justus@g10code.com>
15 months agoLet configure print a note if Yacc is not Bison.
Werner Koch [Fri, 14 Oct 2016 13:40:37 +0000 (15:40 +0200)]
Let configure print a note if Yacc is not Bison.

* m4/ax_prog_bison.m4: New.
* m4/Makefile.am (EXTRA_DIST): Add it.
* configure.ac: Test for Bison and print a note.
--

GnuPG-bug-id: 2753
Signed-off-by: Werner Koch <wk@gnupg.org>
17 months agoPost release updates
Werner Koch [Mon, 22 Aug 2016 09:59:47 +0000 (11:59 +0200)]
Post release updates

--

17 months agoRelease 1.3.5 libksba-1.3.5
Werner Koch [Mon, 22 Aug 2016 09:54:04 +0000 (11:54 +0200)]
Release 1.3.5

* configure.ac: Set LT version to C19/A/11/R6.

17 months agoUse size_t for the result of fread.
Werner Koch [Mon, 22 Aug 2016 09:47:28 +0000 (11:47 +0200)]
Use size_t for the result of fread.

* src/reader.c (ksba_reader_read): Make 'n' and size_t.
--

GnuPG-bug-id: 2415
Signed-off-by: Werner Koch <wk@gnupg.org>
17 months agoLimit allocation in the BER decoder to 16 MiB.
Werner Koch [Mon, 22 Aug 2016 08:47:59 +0000 (10:47 +0200)]
Limit allocation in the BER decoder to 16 MiB.

* src/ber-decoder.c (MAX_IMAGE_LENGTH): New.
(decoder_next): Limit allcoation to MAX_IMAGE_LENGTH.
(_ksba_ber_decoder_dump, _ksba_ber_decoder_decode): Ditto.
--

We allocate the image used to allocate BER encoded data from the
provided length in the object.  However, this length may be given
arbitrary and we would thus try to allocate huge amounts of
memory (and zero them out since commit 2a9fc56) unless the user has
set an appropriate ulimit.  This is not desirable and thus we better
bail out early if a strange (ie. very large object is seen).

That whole table driven parser is a mess.

Reported-by: Pascal Cuoq <cuoq 'at' trust-in-soft com>
Signed-off-by: Werner Koch <wk@gnupg.org>
18 months agoEncode OCSP nonce value as an octet string (RFC 6960)
Tomáš Trnka [Sun, 3 Jul 2016 19:27:31 +0000 (21:27 +0200)]
Encode OCSP nonce value as an octet string (RFC 6960)

* src/ocsp.c (ksba_ocsp_set_nonce): Stop removing the sign bit.
 (write_request_extensions): Encode nonce as octet string.
 (parse_response_extensions): Decode nonce as octet string.
--

The type of nonce value was not specified back in RFC 2560, but RFC
6960 has clarified the situation by requiring an octet string. This
is also what OpenSSL does since 0.9.7d. Doing the same improves
interoperability with some responders (and Wireshark packet dissectors).

Signed-off-by: Tomáš Trnka <tomastrnka@gmx.com>
18 months agobuild: Update config.{guess,sub} to {2016-05-15,2016-06-20}.
Werner Koch [Wed, 13 Jul 2016 17:02:58 +0000 (19:02 +0200)]
build: Update config.{guess,sub} to {2016-05-15,2016-06-20}.

* build-aux/config.guess: Update.
* build-aux/config.sub: Update.

Signed-off-by: Werner Koch <wk@gnupg.org>
18 months agotests: Fix a memory leak.
Werner Koch [Mon, 27 Jun 2016 14:12:09 +0000 (16:12 +0200)]
tests: Fix a memory leak.

* tests/t-oid.c (test_oid_to_str): Free STR.

Signed-off-by: Werner Koch <wk@gnupg.org>
18 months agoUse modern error macros and fix a missing assignment.
Werner Koch [Mon, 27 Jun 2016 14:04:44 +0000 (16:04 +0200)]
Use modern error macros and fix a missing assignment.

* src/ocsp.c: Remove errno.h.  Replace gpg_error_from_errno(errno) by
gpg_error_from_syserror ().
(parse_response): Ditto.  Return direct becuase static analyzer may
not grasp that  gpg_error_from_syserror will never return false.
(ksba_ocsp_get_responder_id): Actually return an error for NO_DATA.

Signed-off-by: Werner Koch <wk@gnupg.org>
18 months agoDetect invalid RDN names and avoid a read from uninitialized variable.
Werner Koch [Mon, 27 Jun 2016 13:54:20 +0000 (15:54 +0200)]
Detect invalid RDN names and avoid a read from uninitialized variable.

* src/dn.c (parse_rdn): Bail out for an invalid name.

Signed-off-by: Werner Koch <wk@gnupg.org>
20 months agoFix OOB read in parse_distribution_point.
Werner Koch [Wed, 25 May 2016 06:17:13 +0000 (08:17 +0200)]
Fix OOB read in parse_distribution_point.

* src/cert.c (parse_distribution_point): Check TI.length.
--

GnuPG-bug-id: 2350
Co-authored-by: Pascal Cuoq <cuoq@trust-in-soft.com>
Signed-off-by: Werner Koch <wk@gnupg.org>
20 months agoMake sure that ASN.1 data is stored in an all-initialized buffer.
Werner Koch [Wed, 11 May 2016 10:40:12 +0000 (12:40 +0200)]
Make sure that ASN.1 data is stored in an all-initialized buffer.

* src/ber-decoder.c (decoder_next): Clear the image buffer.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
20 months agoPost release updates
Werner Koch [Tue, 3 May 2016 16:31:37 +0000 (18:31 +0200)]
Post release updates

--

20 months agoRelease 1.3.4. libksba-1.3.4
Werner Koch [Tue, 3 May 2016 16:19:48 +0000 (18:19 +0200)]
Release 1.3.4.

* configure.ac: Set LT version to C19/A11/R5.

Signed-off-by: Werner Koch <wk@gnupg.org>
20 months agoUpdate config.{guess,sub} to 2016-04-02 and 2016-03-30.
Werner Koch [Tue, 3 May 2016 16:22:19 +0000 (18:22 +0200)]
Update config.{guess,sub} to 2016-04-02 and 2016-03-30.

* build-aux/config.guess: Update.
* build-aux/config.sub: Update.

Signed-off-by: Werner Koch <wk@gnupg.org>
20 months agoCreate an SWDB file during "make distcheck"
Werner Koch [Tue, 3 May 2016 16:10:34 +0000 (18:10 +0200)]
Create an SWDB file during "make distcheck"

* Makefile.am (distcheck-hook): New.
--

The SWDB file is used to update the swdb.mac file from the
gnupg-doc repo which is the source for
https://gnupg.org/swdb.lst
https://gnupg.org/swdb.lst.sig

Signed-off-by: Werner Koch <wk@gnupg.org>
20 months agoFix an undefined return value in ksba_cert_get_digest_algo.
Werner Koch [Tue, 3 May 2016 14:06:52 +0000 (16:06 +0200)]
Fix an undefined return value in ksba_cert_get_digest_algo.

* src/cert.c (ksba_cert_get_digest_algo): Set ALGO in the error case.
* tests/cert-basic.c (one_file): Take care of printf which does not
handle NULL for %s
--

GnuPG-bug-id: 2343
Reported-by: Pascal Cuoq
20 months agoFix an OOB read access in _ksba_dn_to_str.
Werner Koch [Tue, 3 May 2016 14:01:09 +0000 (16:01 +0200)]
Fix an OOB read access in _ksba_dn_to_str.

* src/dn.c (append_utf8_value): Use a straightforward check to fix an
off-by-one.
--

The old fix for the problem from April 2015 had an off-by-one in the
bad encoding handing.

Fixes-commit: 243d12fdec66a4360fbb3e307a046b39b5b4ffc3
GnuPG-bug-id: 2344
Reported-by: Pascal Cuoq
Signed-off-by: Werner Koch <wk@gnupg.org>
20 months agoFix possible read access beyond the buffer.
Werner Koch [Tue, 3 May 2016 12:10:04 +0000 (14:10 +0200)]
Fix possible read access beyond the buffer.

* src/ber-help.c (_ksba_ber_parse_tl): Add extra sanity check.
* src/cert.c (ksba_cert_get_cert_policies): Check TLV given length
against buffer length.
(ksba_cert_get_ext_key_usages): Ditto.
* src/ocsp.c (parse_asntime_into_isotime): Ditto.
--

The returned length of the object from _ksba_ber_parse_tl (ti.length)
was not always checked against the actual buffer length, thus leading
to a read access after the end of the buffer and thus a segv.

GnuPG-bug-id: 2344
Reported-by: Pascal Cuoq
Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoAdd more curves to the name->OID table.
Werner Koch [Wed, 28 Oct 2015 10:41:25 +0000 (11:41 +0100)]
Add more curves to the name->OID table.

* src/keyinfo.c (curve_names): Add more curves.
--

This aligns the table with the one used in libgcrypt master.  Note
that the GOST2001-CryptoPro-{A,C} curves have two different OIDs; we
can only support one.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoFix lookup of ECC OIDs by name.
Werner Koch [Wed, 28 Oct 2015 10:18:59 +0000 (11:18 +0100)]
Fix lookup of ECC OIDs by name.

* src/keyinfo.c (get_ecc_curve_oid): Fix obviously never tested table
lookup.
--

This led to a crash see
 https://lists.gnupg.org/pipermail/gnupg-devel/2015-October/030445.html

The fix is obvious but I do not have test data for this.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoAdd configure option --enable-build-timestamp.
Werner Koch [Tue, 25 Aug 2015 19:16:38 +0000 (21:16 +0200)]
Add configure option --enable-build-timestamp.

* configure.ac (BUILD_TIMESTAMP): Set to "<none>" by default.  Add
ac_define_unquoted.
--

This is based on
libgpg-error commit d620005fd1a655d591fccb44639e22ea445e4554
but changed to be disabled by default.  Check there for some
background.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoPost release updates.
Werner Koch [Fri, 10 Apr 2015 15:49:04 +0000 (17:49 +0200)]
Post release updates.

--

2 years agoRelease 1.3.3. libksba-1.3.3
Werner Koch [Fri, 10 Apr 2015 15:42:25 +0000 (17:42 +0200)]
Release 1.3.3.

2 years agoDo not abort on decoder stack overflow.
Werner Koch [Thu, 9 Apr 2015 09:50:03 +0000 (11:50 +0200)]
Do not abort on decoder stack overflow.

* src/ber-decoder.c (push_decoder_state, pop_decoder_state): Return an
error code.
(set_error): Prefix error message with "ksba:". Act on new return code.
(decoder_next): Act on new return code.
--

This changes the behaviour from

  gpgsm: unknown hash algorithm '1.8.48.48.48.48.48.48.48.48'
  gpgsm: detached signature w/o data - assuming certs-only
  ERROR: decoder stack overflow!
  Aborted

to

  gpgsm: detached signature w/o data - assuming certs-only
  ksba: ber-decoder: stack overflow!
  gpgsm: ksba_cms_parse failed: Limit reached

Use "gpgsm --verify FILE" to exhibit the problem.  FILE is
-----BEGIN PGP ARMORED FILE-----

MDAGCSqGSIb3DQEHAqCAMDACAQExDzANBgkwMDAwMDAwMDAwADCABgkwMDAwMDAw
MDAAMDEwoIGTMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw
MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw
MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw
MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw
MDAwMDAwMDAwMDAwMDAjMDA=
=PQdP
-----END PGP ARMORED FILE-----

Reported-by: Hanno Böck
Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoFix integer overflow in the BER decoder.
Werner Koch [Thu, 9 Apr 2015 09:17:28 +0000 (11:17 +0200)]
Fix integer overflow in the BER decoder.

* src/ber-decoder.c (ber_decoder_s): Change val.length from int to
size_t.
(sum_a1_a2_gt_b, sum_a1_a2_ge_b): New.
(decoder_next): Check for integer overflow.  Use new sum function for
size check.
(_ksba_ber_decoder_dump): Use size_t for n to match change of
val.length.  Adjust printf fomrat.  Check for integer overflow and use
gpg_error_from_syserror instead of GPG_ERR_ENOMEM.
(_ksba_ber_decoder_decode): Use new sum function for size check.
Check for integer overflow.  Use size_t for n to match change of
val.length.
--

The actual bug described below is due to assigning an int
(val.length) to a size_t (ti.length).  The int was too large and thus
negative so that the condition to check for too large objects didn't
worked.  Changing the type would have been enough but other conditions
are possible.  Thus the introduction of sum_a1_a2_ge_b for overflow
checking and checks when adding 100 extra bytes to malloc calls are
added.

Use "gpgsm --verify FILE" to exhibit the problem.  FILE is
-----BEGIN PGP ARMORED FILE-----

MDAGCSqGSIb3DQEHAqCAMIACAQExDzANBgkwMDAwMDAwMDAwADAwBhcwMDAwMDAw
MDAwMDAwMDAwMDAwMDAwMAAwMTAGCTAwMDAwMDAwMDAwBgkwMDAwMDAwMDAwMAYJ
MDAwMDAwMDAwMDAXLDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw
MDAwMDAwMDAwCoYwMP////UwMDAwMDAwMDAwMDAwMDAwMA==
=tvju
-----END PGP ARMORED FILE-----

Without the patch this error occured:

  gpgsm: unknown hash algorithm '1.8.48.48.48.48.48.48.48.48'
  gpgsm: detached signature w/o data - assuming certs-only
  =================================================================
  ==14322==ERROR: AddressSanitizer: heap-buffer-overflow on address
   0x60b00000aded at pc 0x462ca8 bp 0x7fffd5928d90 sp 0x7fffd5928d80
  WRITE of size 1 at 0x60b00000aded thread T0
      #0 0x462ca7 in base64_reader_cb [...]-2.1.2/sm/base64.c:363
      #1 0x7f35e70b6365 (/usr/lib64/libksba.so.8+0x7365)
      #2 0x7f35e70bee11 (/usr/lib64/libksba.so.8+0xfe11)
      #3 0x7f35e70c75ed (/usr/lib64/libksba.so.8+0x185ed)
      #4 0x7f35e70c7a9d (/usr/lib64/libksba.so.8+0x18a9d)
      #5 0x7f35e70c356f (/usr/lib64/libksba.so.8+0x1456f)
      #6 0x7f35e70c58bf (/usr/lib64/libksba.so.8+0x168bf)
      #7 0x48cbee in gpgsm_verify [...]/gnupg-2.1.2/sm/verify.c:171
      #8 0x412901 in main /data/gnupg/gnupg-2.1.2/sm/gpgsm.c:1795
      #9 0x7f35e68d5f9f in __libc_start_main ([...]
      #10 0x415a91 (/data/gnupg/gnupg-2.1.2/sm/gpgsm+0x415a91)

  0x60b00000aded is located 0 bytes to the right of 109-byte region
   [0x60b00000ad80,0x60b00000aded)
  allocated by thread T0 here:
      #0 0x7f35e782e6f7 in malloc [...]
      #1 0x7f35e75040b0 (/usr/lib64/libgcrypt.so.20+0xc0b0)

  SUMMARY: AddressSanitizer: heap-buffer-overflow [...]
  Shadow bytes around the buggy address:
    0x0c167fff9560: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
    0x0c167fff9570: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
    0x0c167fff9580: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
    0x0c167fff9590: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
    0x0c167fff95a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  =>0x0c167fff95b0: 00 00 00 00 00 00 00 00 00 00 00 00 00[05]fa fa
    0x0c167fff95c0: fa fa fa fa fa fa 00 00 00 00 00 00 00 00 00 00
    0x0c167fff95d0: 00 00 00 fa fa fa fa fa fa fa fa fa 00 00 00 00

Reported-by: Hanno Böck
Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoFix encoding of invalid utf-8 strings in dn.c
Werner Koch [Wed, 8 Apr 2015 16:51:21 +0000 (18:51 +0200)]
Fix encoding of invalid utf-8 strings in dn.c

* src/dn.c (append_quoted, append_atv): Use snprintf.
(append_utf8_value): Fix invalid encoding handling.
--

An invalid utf-8 encoding will make the loop in append_utf8_value run
once more with N > length which is not found by the termination
condition and only the former assert terminates the process if the byte
following the bad encoding has the high bit cleared.  This will lead
to a read access out of bounds.

The patch removes the assert and fixes the handling of bad encoding.
Due to the new quoting the output of a badly encoded utf-8 string will
be different than in previous versions.

Replacing sprintf is only for cosmetic reasons.

Use "gpgsm --verify FILE" to exhibit the problem.  FILE is
-----BEGIN PGP ARMORED FILE-----

MDAGCSqGSIb3DQEHAqCAMDACAQExDzANBgkwMDAwMDAwMDAwADCABgkwMDAwMDAw
MDAAMDEwAgEwMDAwMDEwMDAGA1UEAwwB/4AwMDAwMDAwMDAwMDAwMDAwMDAwMDAw
MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw
=NJTr
-----END PGP ARMORED FILE-----

Reported-by: Hanno Böck
Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agow32: Use -static-libgcc to avoid linking to libgcc_s_sjlj-1.dll.
Werner Koch [Fri, 30 Jan 2015 16:09:12 +0000 (17:09 +0100)]
w32: Use -static-libgcc to avoid linking to libgcc_s_sjlj-1.dll.

* src/Makefile.am (extra_ltoptions): New.
(libksba_la_LDFLAGS): Use it.
--

Since gcc 4.8 there is a regression in that plain C programs may link
to libgcc_s.a which has a dependency on libgcc_s_sjlj.dll.  This is
for example triggered by using long long arithmetic on a 32 bit
Windows (e.g symbol __udivdi3).

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoUpdate ASN.1 grammar for newer Bison versions.
Werner Koch [Fri, 30 Jan 2015 09:18:47 +0000 (10:18 +0100)]
Update ASN.1 grammar for newer Bison versions.

* src/asn1-parse.y (YYERROR_VERBOSE): Replace by ...
(%define parse.error.verbose): this.
(YYPARSE_PARM, YYLEX_PARM): Replace by ...
(%parm): this.
(%pure_parser): Replace by ...
(%define api.pure full): this.
(yyerror): Add arg parm.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoRequire automake 1.14 and update build-aux files.
Werner Koch [Wed, 28 Jan 2015 14:39:22 +0000 (15:39 +0100)]
Require automake 1.14 and update build-aux files.

* Makefile.am (AUTOMAKE_OPTIONS): Move to ...
* configure.ac (AM_INIT_AUTOMAKE: here.  Add serial-tests.

3 years agoAdd CVE id to NEWS.
Werner Koch [Thu, 4 Dec 2014 10:01:03 +0000 (11:01 +0100)]
Add CVE id to NEWS.

--

3 years agoPost release updates
Werner Koch [Tue, 25 Nov 2014 11:43:43 +0000 (12:43 +0100)]
Post release updates

--

3 years agoRelease 1.3.2. libksba-1.3.2
Werner Koch [Tue, 25 Nov 2014 11:31:40 +0000 (12:31 +0100)]
Release 1.3.2.

* configure.ac: Set LT version to C19/A11/R3.

3 years agobuild: Update version number magic.
Werner Koch [Tue, 25 Nov 2014 11:24:47 +0000 (12:24 +0100)]
build: Update version number magic.

* autogen.sh: Update from gnupg master.
* configure.ac: Change for new init style.  Create VERSION.
* Makefile.am (dist-hook): Do no create VERSION

3 years agobuild: Update gpg-error.m4 and libgcrypt.m4
Werner Koch [Tue, 25 Nov 2014 11:23:18 +0000 (12:23 +0100)]
build: Update gpg-error.m4 and libgcrypt.m4

--

3 years agoFix buffer overflow in ksba_oid_to_str.
Werner Koch [Tue, 25 Nov 2014 10:47:28 +0000 (11:47 +0100)]
Fix buffer overflow in ksba_oid_to_str.

* src/oid.c (ksba_oid_to_str): Fix unsigned underflow.

* tests/Makefile.am (noinst_PROGRAMS): Move t-oid to ..
(TESTS): here.
* tests/t-oid.c (test_oid_to_str): New.
(main): Run the new tests by default.  The former functionality
requires the use of one of the new options.
--

The code has an obvious error by not considering invalid encoding for
arc-2.  A first byte of 0x80 can be used to make a value of less then
80 and we then subtract 80 from that value as required by the OID
encoding rules.  Due to the unsigned integer this results in a pretty
long value which won't fit anymore into the allocated buffer.

The fix is obvious.  Also added a few simple test cases.  Note that we
keep on using sprintf instead of snprintf because managing the
remaining length of the buffer would probably be more error prone than
assuring that the buffer is large enough.  Getting rid of sprintf
altogether by using direct conversion along with membuf_t like code
might be possible.

Reported-by: Hanno Böck
Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoStrip CRs while building the oid translation table.
Werner Koch [Thu, 25 Sep 2014 06:50:53 +0000 (08:50 +0200)]
Strip CRs while building the oid translation table.

* tests/Makefile.am (oidtranstbl.h): Strip CRs

3 years agoPost release updates.
Werner Koch [Thu, 18 Sep 2014 07:39:41 +0000 (09:39 +0200)]
Post release updates.

--

3 years agoRelease 1.3.1. libksba-1.3.1
Werner Koch [Thu, 18 Sep 2014 07:31:41 +0000 (09:31 +0200)]
Release 1.3.1.

* configure.ac: Set LT version to C19/A11/R2.

3 years agoUpdate gpl.texi from GnuPG to fix syntax errors.
Werner Koch [Tue, 22 Jul 2014 12:05:52 +0000 (14:05 +0200)]
Update gpl.texi from GnuPG to fix syntax errors.

--

3 years agoFix two memory leaks in cert-basic test
Dmitry Eremin-Solenikov [Sat, 12 Jul 2014 11:11:19 +0000 (15:11 +0400)]
Fix two memory leaks in cert-basic test

* tests/cert-basic.c (one_file): always free public key and der2.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
3 years agoEnable optional valgrind for testsuite
Dmitry Eremin-Solenikov [Sat, 12 Jul 2014 11:11:18 +0000 (15:11 +0400)]
Enable optional valgrind for testsuite

* configure.ac: Enable gnulib valgrind module.
* gl/m4/gnulib.m4: Enable valgrind module.
* tests/Makefile.am: Enable valgrind as LOG_COMPILER.
* gl/m4/valgrind-tests.m4: New

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
3 years agoFix memory leak in crl parsing code.
Dmitry Eremin-Solenikov [Sat, 12 Jul 2014 11:11:17 +0000 (15:11 +0400)]
Fix memory leak in crl parsing code.

* src/crl.c (store_one_entry_extension): Free memory at oid variable -
  otherwise libksba leaks memory on crl parsing.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
3 years agoAdapt mkoidtbl script to newer dumpasn1 database format
Dmitry Eremin-Solenikov [Sat, 12 Jul 2014 11:11:16 +0000 (15:11 +0400)]
Adapt mkoidtbl script to newer dumpasn1 database format

* tests/mkoidtbl.awk: optionally parse oid at OID line.

--

Debian jessie currently has dumpasn1 version 20130608-1. It uses
dumpasn1.cfg with slightly different format:

OID = 0 2 262 1 10
Comment = Deutsche Telekom
Description = Telesec

Adapted mkoidtbl to work on both types of files.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
3 years agoReuse common test functions in cert-basic test
Dmitry Eremin-Solenikov [Sat, 12 Jul 2014 11:11:15 +0000 (15:11 +0400)]
Reuse common test functions in cert-basic test

* tests/cert-basic.c (xmalloc, print_hex, print_sexp, print_time,
  print_dn): Drop.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
3 years agotests: fix print_sexp and print_sexp_hex functions
Dmitry Eremin-Solenikov [Sat, 12 Jul 2014 11:11:14 +0000 (15:11 +0400)]
tests: fix print_sexp and print_sexp_hex functions

* tests/t-common.h (print_sexp, print_sexp_hex): advance pointer on
  closing brace.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
3 years agotests: Pass -no-install to libtool
Dmitry Eremin-Solenikov [Sat, 12 Jul 2014 11:11:13 +0000 (15:11 +0400)]
tests: Pass -no-install to libtool

* tests/Makefile.am: add AM_LDFLAGS = -no-install

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
3 years agotests: Fix warning about unused var.
Werner Koch [Tue, 15 Apr 2014 14:40:48 +0000 (16:40 +0200)]
tests: Fix warning about unused var.

* tests/t-dnparser.c (main): Drop unneeded var INPUTLEN.

3 years agoFix possible segv if NULL is passed as cert.
Werner Koch [Tue, 15 Apr 2014 14:40:48 +0000 (16:40 +0200)]
Fix possible segv if NULL is passed as cert.

* src/cert.c (ksba_cert_get_digest_algo): Fix !cert case.
--

Found by Hans-Christoph Steiner with cppcheck.

4 years agoRemove cruft.
Werner Koch [Thu, 9 Jan 2014 18:14:09 +0000 (19:14 +0100)]
Remove cruft.

* autogen.rc: Remove cruft.

4 years agoUse the generic autogen.sh script.
Werner Koch [Thu, 9 Jan 2014 18:14:09 +0000 (19:14 +0100)]
Use the generic autogen.sh script.

* Makefile.am (EXTRA_DIST): Add autogen.rc.
* autogen.rc: New.
* autogen.sh: Update from current GnuPG.
* ltmain.sh: Move to build-aux/.
* compile: Ditto.
* config.guess: Ditto.
* config.sub: Ditto.
* depcomp: Ditto.
* doc/mdate-sh: Ditto.
* doc/texinfo.tex: Ditto.
* install-sh: Ditto.
* missing: Ditto.
* ylwrap: Ditto.
* configure.ac (AC_CONFIG_AUX_DIR): New.

4 years agoAdd --enable-silent-rules stuff.
Werner Koch [Wed, 8 Jan 2014 15:47:46 +0000 (16:47 +0100)]
Add --enable-silent-rules stuff.

* configure.ac: Add AM_SILENT_RULES.

4 years agoFix libtool 2.4.2 to correctly detect .def files.
Werner Koch [Thu, 18 Apr 2013 12:40:43 +0000 (14:40 +0200)]
Fix libtool 2.4.2 to correctly detect .def files.

* ltmain.sh (sed_uncomment_deffile): New.
(orig_export_symbols): Uncomment def file before testing for EXPORTS.
* m4/libtool.m4: Do the same for the generated code.
--

The old code was not correct in that it only looked at the first line
and puts an EXPORTS keyword in front if missing.  Binutils 2.22
accepted a duplicated EXPORTS keyword but at least 2.23.2 is more
stringent and bails out without this fix.

There is no need to send this upstream.  Upstream's git master has a
lot of changes including a similar fix for this problems.  There are
no signs that a libtool 2.4.3 will be released to fix this problem and
thus we need to stick to our copy of 2.4.2 along with this patch.

Signed-off-by: Werner Koch <wk@gnupg.org>
4 years agoUpdate libtool to support Android.
David 'Digit' Turner [Tue, 22 Oct 2013 12:26:53 +0000 (14:26 +0200)]
Update libtool to support Android.

* m4/libtool.m4: Add "linux*android*" case.  Taken from the libtool
repository.
--

The patch, which cleanly applies, is

  commit 8eeeb00daef8c4f720c9b79a0cdb89225d9909b6
  Author: David 'Digit' Turner <digit@google.com>
  Date:   Tue Oct 8 14:37:32 2013 -0700

  This patch adds proper Android support to libtool. The main
  issues are the following:

      - Versioned libraries are not supported by the platform and
        its build/packaging tools.

      - The dynamic linker is not GNU ld, there is no support for
        DT_RUNPATH.

      - Similarly, there is no ldconfig.

Signed-off-by: Werner Koch <wk@gnupg.org>
4 years agoAdd build support for ppc64le.
Werner Koch [Tue, 22 Oct 2013 12:26:53 +0000 (14:26 +0200)]
Add build support for ppc64le.

* config.guess, config.sub: Update to latest version (2013-11-29).
* m4/libtool.m4: Add patches for ppc64le.
--

We don't want to update libtool, thus we use patches supplied by IBM.

Signed-off-by: Werner Koch <wk@gnupg.org>
4 years agoFix duplicate definition of TRUE and FALSE in grammar file.
Werner Koch [Tue, 22 Oct 2013 12:26:53 +0000 (14:26 +0200)]
Fix duplicate definition of TRUE and FALSE in grammar file.

* src/asn1-parse.y (YYPRINT): Define.
(%token-table): Define.
(TRUE,FALSE,BOOLEAN): Prefix these tokens with "ksba_" to avoid name
conflicts.
(key_word, key_word_token): Remove arrays.
(%token): Add literal strings to almost all tokens.
(yylex): Use yytname array for keyword lookup.
--

On AIX header file <sys/types.h> defines TRUE and FALSE when
_ALL_SOURCE is defined, leading to a macro redefinition error.

The fix for this problem is straightforward.  To make future changes
easier I also remove the duplicate definition of the keywords.   It is
much easier to use the list of keywords already known to Bison.

GnuPG-bug-id: 1574

5 years agoImprove parsing of the GIT revision number.
Werner Koch [Fri, 16 Nov 2012 12:36:50 +0000 (13:36 +0100)]
Improve parsing of the GIT revision number.

* configure.ac (mmm4_revision): Use git rev-parse.

5 years agoFix non-portable use of chmod in autogen.sh.
Werner Koch [Fri, 16 Nov 2012 12:36:37 +0000 (13:36 +0100)]
Fix non-portable use of chmod in autogen.sh.

* autogen.sh: Remove option -c from chmod.

5 years agoPost release updates
Werner Koch [Thu, 27 Sep 2012 14:45:02 +0000 (16:45 +0200)]
Post release updates

--

5 years agoRelease 1.3.0 libksba-1.3.0
Werner Koch [Thu, 27 Sep 2012 14:20:54 +0000 (16:20 +0200)]
Release 1.3.0

* configure.ac: Set LT version to C19/A11/R1.

5 years agoUpdate build helper scripts
Werner Koch [Wed, 26 Sep 2012 15:58:16 +0000 (17:58 +0200)]
Update build helper scripts

* config.guess, config.sub: Update to version 2012-07-31.
* ltmain.sh: Update to version 2.4.2.
* install-sh, m4/libtool.m4, m4/ltoptions.m4, m4/ltversion.m4
* m4/lt~obsolete.m4: Update to autoconf 2.69 versions.

5 years agoAdjust for stricter autoconf requirements.
Werner Koch [Wed, 26 Sep 2012 15:51:32 +0000 (17:51 +0200)]
Adjust for stricter autoconf requirements.

* configure.ac: Fix usage of AC_LANG_PROGRAM.

5 years agoDo not distribute a copy of gitlog-to-changelog.
Werner Koch [Wed, 26 Sep 2012 15:49:46 +0000 (17:49 +0200)]
Do not distribute a copy of gitlog-to-changelog.

* Makefile.am (AUTOMAKE_OPTIONS): Do not create a tar.gz.
(gen-ChangeLog): Require an installed gitlog-to-changelog.
* build-aux/gitlog-to-changelog: Remove.

5 years agoAllow building with w64-mingw32
Werner Koch [Wed, 26 Sep 2012 15:17:21 +0000 (17:17 +0200)]
Allow building with w64-mingw32

* autogen.sh <--build-w32>: Support the w64-mingw32 toolchain.  Also
prepare for 64 bit building.

5 years agoSwitch to the new automagic beta numbering scheme.
Werner Koch [Wed, 26 Sep 2012 15:09:33 +0000 (17:09 +0200)]
Switch to the new automagic beta numbering scheme.

* configure.ac: Add all the required m4 magic.

5 years agoChange library license to LGPLv3+/GPLv2+.
Werner Koch [Wed, 26 Sep 2012 12:30:58 +0000 (14:30 +0200)]
Change library license to LGPLv3+/GPLv2+.

* COPYING.GPLv2, COPYING.GPLv3, COPYING.LGPLv3: New.
* COPYING: Replace text by a reference to the new files.
* AUTHORS: Update copyright, license, and maintainer information.
* Makefile.am (EXTRA_DIST): Distribute the new files.
--

Our files asn1-parse.y, ans1-func.c, and asn-func.h are based on FSF
copyrighted code from GNUTLS.  GNUTLS factored its ASN.1 code out into
the separate LIBTASN1 project and changed the license on 2002-06-14
from GPLv2 to LGPLv2.1.  On 2007-07-04 we changed our KSBA license
from GPLv2 to GPLv3.  Now we revert that license change, apply the
LIBTASN license change to LGPLv2.1, and finally switch to LPGLv3/GPLv2.

5 years agoRemove unused or useless files.
Werner Koch [Wed, 26 Sep 2012 11:57:37 +0000 (13:57 +0200)]
Remove unused or useless files.

* src/asn1-parse.h: Remove empty file.
* src/asn1-parse.y: Do not include asn1-parse.h.

6 years agoAllow to set subject and issuer.
Werner Koch [Tue, 6 Dec 2011 20:33:43 +0000 (21:33 +0100)]
Allow to set subject and issuer.

* src/certreq.c (ksba_certreq_set_issuer): Do not check the subject.

6 years agoPost release updates.
Werner Koch [Thu, 1 Dec 2011 22:36:49 +0000 (23:36 +0100)]
Post release updates.

6 years agoGenerate the ChangeLog from commit logs.
Werner Koch [Thu, 1 Dec 2011 22:30:50 +0000 (23:30 +0100)]
Generate the ChangeLog from commit logs.

* build-aux/gitlog-to-changelog: New script.  Taken from gnulib.
* build-aux/git-log-fix: New file.
* build-aux/git-log-footer: New file.
* doc/HACKING: New file.
* ChangeLog: New file.
* Makefile.am (EXTRA_DIST): Add new files.
(gen-ChangeLog): New.
(dist-hook): Run gen-ChangeLog.
* autogen.sh: Install commit-msg hook for git.

Rename all ChangeLog files to ChangeLog-2011.

6 years agoaccept --with-libgpg-error-prefix as well as --with-gpg-error-prefix
Jim Meyering [Mon, 28 Nov 2011 12:45:36 +0000 (13:45 +0100)]
accept --with-libgpg-error-prefix as well as --with-gpg-error-prefix

* m4/gpg-error.m4: Update from git master.

6 years agoPrepare 1.2 release libksba-1.2.0
Werner Koch [Tue, 1 Mar 2011 11:41:00 +0000 (12:41 +0100)]
Prepare 1.2 release

6 years agoFix setting of not-before date
Werner Koch [Tue, 1 Mar 2011 11:36:19 +0000 (12:36 +0100)]
Fix setting of not-before date

6 years agoComplete X.509 creation stuff
Werner Koch [Mon, 28 Feb 2011 14:45:04 +0000 (15:45 +0100)]
Complete X.509 creation stuff

6 years agoSupport the creation of X.509 certificates.
Werner Koch [Fri, 25 Feb 2011 09:05:40 +0000 (10:05 +0100)]
Support the creation of X.509 certificates.

This is actually a little hack to turn the pkcs#10 generation code
into a full X.509 certificate generator.  Both are very similar and
with the help of 3 new functions and a few lines of code this could be
achieved.

Gpgsm (GnuPG) will be changed to allow the creation of self-signed
certificates; use that code as an example on how to create
certificates.

6 years agoAdd cross-building consistency checks
Werner Koch [Fri, 25 Feb 2011 08:55:51 +0000 (09:55 +0100)]
Add cross-building consistency checks

6 years agoBuild t-oid and add a feature to translate an oid to hex.
Werner Koch [Fri, 25 Feb 2011 08:51:46 +0000 (09:51 +0100)]
Build t-oid and add a feature to translate an oid to hex.

6 years agoDon't compare the patchlevel
Werner Koch [Fri, 25 Feb 2011 08:50:12 +0000 (09:50 +0100)]
Don't compare the patchlevel

The patchlevel is not well defined and in particular with git commit
ids the comparison is plainly wrong.

6 years agoNuked all trailing white space
Werner Koch [Thu, 24 Feb 2011 10:49:29 +0000 (11:49 +0100)]
Nuked all trailing white space

7 years agoShorten commit identifier
Werner Koch [Mon, 3 Jan 2011 11:10:32 +0000 (12:10 +0100)]
Shorten commit identifier

7 years agoAdd git commit identifier to the version
Werner Koch [Wed, 22 Dec 2010 17:47:38 +0000 (18:47 +0100)]
Add git commit identifier to the version

7 years agoPost release updates
Werner Koch [Tue, 26 Oct 2010 12:54:54 +0000 (12:54 +0000)]
Post release updates

7 years agoUpdate config.gues et al. debian/libksba-1.1.0
Werner Koch [Tue, 26 Oct 2010 12:46:55 +0000 (12:46 +0000)]
Update config.gues et al.

7 years agoNo all systems have /dev/null - adjust for that.
Werner Koch [Mon, 13 Sep 2010 11:02:44 +0000 (11:02 +0000)]
No all systems have /dev/null - adjust for that.

7 years agoPrepare for gpg-error change
Werner Koch [Thu, 19 Aug 2010 13:12:59 +0000 (13:12 +0000)]
Prepare for gpg-error change

7 years agoFix static buffer overflow.
Werner Koch [Thu, 19 Aug 2010 12:17:27 +0000 (12:17 +0000)]
Fix static buffer overflow.

7 years agoMinor change
Werner Koch [Wed, 4 Aug 2010 08:31:38 +0000 (08:31 +0000)]
Minor change

7 years agoAdd 2 new functions. Bumped version number.
Werner Koch [Mon, 2 Aug 2010 13:36:25 +0000 (13:36 +0000)]
Add 2 new functions. Bumped version number.