]> git.ipfire.org Git - thirdparty/gnutls.git/log
thirdparty/gnutls.git
9 years agoPKCS8/PKCS12: enforce a maximum number of iterations
Nikos Mavrogiannopoulos [Thu, 9 Mar 2017 11:57:41 +0000 (12:57 +0100)] 
PKCS8/PKCS12: enforce a maximum number of iterations

This prevents denial of service through very large iteration
counts. Issue found via oss-fuzz:
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=434

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agoDo not attempt to parse a 32-bit integer if a packet is not 4 bytes.
Alex Gaynor [Wed, 8 Mar 2017 19:52:38 +0000 (14:52 -0500)] 
Do not attempt to parse a 32-bit integer if a packet is not 4 bytes.

    This addresses:
      https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=737

Signed-off-by: Alex Gaynor <alex.gaynor@gmail.com>
9 years agoRevert ".gitlab-ci.yml: include coverage statistics of FIPS140-2 code"
Nikos Mavrogiannopoulos [Thu, 9 Mar 2017 10:25:54 +0000 (11:25 +0100)] 
Revert ".gitlab-ci.yml: include coverage statistics of FIPS140-2 code"

This reverts commit 603772688c4e37dae437b4cede12e25b9dd9f678.
The commit introduced a long wait for the coverage build without
and significant benefit (the extend of the FIPS140 code is limited
to have any impact on the overall coverage).

9 years agosysrng-linux: define _rnd_get_system_entropy unconditionally
Nikos Mavrogiannopoulos [Thu, 9 Mar 2017 09:52:59 +0000 (10:52 +0100)] 
sysrng-linux: define _rnd_get_system_entropy unconditionally

This fixes compilation in systems without getrandom().

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agotests: dtls-stress: use X.509 certificates instead of openpgp
Nikos Mavrogiannopoulos [Wed, 8 Mar 2017 15:00:02 +0000 (16:00 +0100)] 
tests: dtls-stress: use X.509 certificates instead of openpgp

This will allow the test tool to operate even after openpgp certificates
are deprecated.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years ago.gitlab-ci.yml: added build without openpgp support
Nikos Mavrogiannopoulos [Tue, 7 Mar 2017 21:52:31 +0000 (22:52 +0100)] 
.gitlab-ci.yml: added build without openpgp support

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agodoc update
Nikos Mavrogiannopoulos [Wed, 8 Mar 2017 10:32:31 +0000 (11:32 +0100)] 
doc update

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agoAdded openpgp stub file
Nikos Mavrogiannopoulos [Tue, 7 Mar 2017 21:36:16 +0000 (22:36 +0100)] 
Added openpgp stub file

That allows disabling openpgp authentication and at the same time
retaining ABI compatibility with versions including openpgp.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agodoc update
Nikos Mavrogiannopoulos [Wed, 8 Mar 2017 14:00:06 +0000 (15:00 +0100)] 
doc update

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agotests: split PKCS#12 encoding from decoding tests
Nikos Mavrogiannopoulos [Wed, 8 Mar 2017 13:58:14 +0000 (14:58 +0100)] 
tests: split PKCS#12 encoding from decoding tests

Enhanced PKCS#12 encoding tests, with the encoding of a file
which contains a cert, a key and a CRL.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agotests: added PKCS#12 file decoding containing a CRL
Nikos Mavrogiannopoulos [Wed, 8 Mar 2017 13:47:20 +0000 (14:47 +0100)] 
tests: added PKCS#12 file decoding containing a CRL

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agocerttool: enhance to allow writing CRLs in PKCS#12 files
Nikos Mavrogiannopoulos [Wed, 8 Mar 2017 13:40:15 +0000 (14:40 +0100)] 
certtool: enhance to allow writing CRLs in PKCS#12 files

In addition fallback to DER when --load-crl fails importing a PEM
encoded CRL due to PEM issues.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agotests: added CRL decoding unit tests using certtool
Nikos Mavrogiannopoulos [Wed, 8 Mar 2017 13:21:30 +0000 (14:21 +0100)] 
tests: added CRL decoding unit tests using certtool

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agotests: enhanced basic tests in CRL parsing
Nikos Mavrogiannopoulos [Wed, 8 Mar 2017 13:04:32 +0000 (14:04 +0100)] 
tests: enhanced basic tests in CRL parsing

That tests gnutls_x509_crl_get_crt_serial().

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agoRewritten gnutls_x509_rdn_get() and gnutls_x509_rdn_get2()
Nikos Mavrogiannopoulos [Wed, 8 Mar 2017 12:50:55 +0000 (13:50 +0100)] 
Rewritten gnutls_x509_rdn_get() and gnutls_x509_rdn_get2()

The new code re-uses the gnutls_x509_dn APIs instead of re-implementing.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agotests: added checks for the old DN decoding functions
Nikos Mavrogiannopoulos [Wed, 8 Mar 2017 12:43:36 +0000 (13:43 +0100)] 
tests: added checks for the old DN decoding functions

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agotests: do not run tests which require openpgp when it is disabled
Nikos Mavrogiannopoulos [Tue, 7 Mar 2017 21:39:20 +0000 (22:39 +0100)] 
tests: do not run tests which require openpgp when it is disabled

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years ago.gitlab-ci.yml: include coverage html output as artifact
Nikos Mavrogiannopoulos [Tue, 7 Mar 2017 21:47:55 +0000 (22:47 +0100)] 
.gitlab-ci.yml: include coverage html output as artifact

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agotests: x509-verify: print the keys on failure
Nikos Mavrogiannopoulos [Wed, 8 Mar 2017 12:22:59 +0000 (13:22 +0100)] 
tests: x509-verify: print the keys on failure

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agognutls_privkey_export_x509: doc update
Nikos Mavrogiannopoulos [Wed, 8 Mar 2017 12:17:15 +0000 (13:17 +0100)] 
gnutls_privkey_export_x509: doc update

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agotests: split sign-verify test to RSA and ECDSA parts
Nikos Mavrogiannopoulos [Wed, 8 Mar 2017 12:07:08 +0000 (13:07 +0100)] 
tests: split sign-verify test to RSA and ECDSA parts

This allows parallelist and also helps identifying easier the
culprit on an error.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agotests: adjusted for the removal of HMAC-MD5
Nikos Mavrogiannopoulos [Wed, 8 Mar 2017 10:52:25 +0000 (11:52 +0100)] 
tests: adjusted for the removal of HMAC-MD5

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agopriority: do not enable HMAC-MD5 by default
Nikos Mavrogiannopoulos [Wed, 8 Mar 2017 10:48:28 +0000 (11:48 +0100)] 
priority: do not enable HMAC-MD5 by default

While HMAC-MD5 is not yet broken, it is not used by any non-broken
or non-NULL ciphersuites (is only used with NULL and RC4), and as there
is not plan to introduce new ciphersuites with that MAC algorithm, there
is no point to include it in the default set of allowed algorithms.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agotests: converted FIPS140-2 mode checks in Makefiles to run-time in scripts
Nikos Mavrogiannopoulos [Tue, 7 Mar 2017 22:10:43 +0000 (23:10 +0100)] 
tests: converted FIPS140-2 mode checks in Makefiles to run-time in scripts

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agognutls.h: introduced GNUTLS_E_TLS_PACKET_DECODING_ERROR [ci skip]
Nikos Mavrogiannopoulos [Wed, 8 Mar 2017 09:48:40 +0000 (10:48 +0100)] 
gnutls.h: introduced GNUTLS_E_TLS_PACKET_DECODING_ERROR [ci skip]

This is an alias to GNUTLS_E_UNEXPECTED_PACKET_LENGTH. That
allows distinguishing the alert from GNUTLS_E_RECORD_OVERFLOW.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agotests: crq: ignore lines for Security Level
Nikos Mavrogiannopoulos [Tue, 7 Mar 2017 20:53:51 +0000 (21:53 +0100)] 
tests: crq: ignore lines for Security Level

This allows running the test under FIPS140-2 mode.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agoax_code_coverage.m4: updated
Nikos Mavrogiannopoulos [Tue, 7 Mar 2017 20:39:12 +0000 (21:39 +0100)] 
ax_code_coverage.m4: updated

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years ago.gitlab-ci.yml: initialize submodules where needed (for tlsfuzzer run)
Nikos Mavrogiannopoulos [Mon, 6 Mar 2017 22:21:33 +0000 (23:21 +0100)] 
.gitlab-ci.yml: initialize submodules where needed (for tlsfuzzer run)

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years ago.gitlab-ci.yml: include subdirs of suite/ in artifacts
Nikos Mavrogiannopoulos [Mon, 6 Mar 2017 14:28:01 +0000 (15:28 +0100)] 
.gitlab-ci.yml: include subdirs of suite/ in artifacts

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agoext/signature: error on invalid extension format
Nikos Mavrogiannopoulos [Mon, 6 Mar 2017 22:11:39 +0000 (23:11 +0100)] 
ext/signature: error on invalid extension format

That is, if an extension containing no signature algorithms is
encountered, treat that as an error. This is an RFC5246 requirement,
since the minimum "supported_signature_algorithms" length is 2.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years ago_gnutls_proc_x509_server_crt: return GNUTLS_E_CERTIFICATE_ERROR on parsing error
Nikos Mavrogiannopoulos [Mon, 6 Mar 2017 13:30:19 +0000 (14:30 +0100)] 
_gnutls_proc_x509_server_crt: return GNUTLS_E_CERTIFICATE_ERROR on parsing error

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agoalert: GNUTLS_E_NO_CERTIFICATE_FOUND maps to GNUTLS_A_DECODE_ERROR
Nikos Mavrogiannopoulos [Mon, 6 Mar 2017 13:21:45 +0000 (14:21 +0100)] 
alert: GNUTLS_E_NO_CERTIFICATE_FOUND maps to GNUTLS_A_DECODE_ERROR

This is the closest to use alert when no certificate is found; at least
it is closer according to tlsfuzzer and rfc5246 text on insuficient_security
alert.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agoread_client_hello: use integer for extensions size
Nikos Mavrogiannopoulos [Mon, 6 Mar 2017 12:51:33 +0000 (13:51 +0100)] 
read_client_hello: use integer for extensions size

As we do not read the value directly, but rather assign to it
the remaining data, we ensure that there are no overflows if
we have additional data past the extensions field. The integer
can hold more than 2^24 which is the maximum handshake packet
size.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agoext/signature: reject an extension with padded data
Nikos Mavrogiannopoulos [Fri, 3 Mar 2017 15:33:57 +0000 (16:33 +0100)] 
ext/signature: reject an extension with padded data

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agoext/signature: reject an extension size of zero
Nikos Mavrogiannopoulos [Fri, 3 Mar 2017 15:18:44 +0000 (16:18 +0100)] 
ext/signature: reject an extension size of zero

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agognutls_record_recv: do not accept a client hello while handshake is in progress
Nikos Mavrogiannopoulos [Fri, 3 Mar 2017 14:58:19 +0000 (15:58 +0100)] 
gnutls_record_recv: do not accept a client hello while handshake is in progress

That is, do not return GNUTLS_E_REHANDSHAKE, while we are within
a handshake process.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agoread_client_hello: fail early on illegally formatted message
Nikos Mavrogiannopoulos [Fri, 3 Mar 2017 14:16:59 +0000 (15:16 +0100)] 
read_client_hello: fail early on illegally formatted message

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years ago_gnutls_parse_extensions: do not fail on empty extensions field
Nikos Mavrogiannopoulos [Thu, 2 Mar 2017 16:57:57 +0000 (17:57 +0100)] 
_gnutls_parse_extensions: do not fail on empty extensions field

On the other hand, fail if an empty extensions field is seen, but
the client hello contains data nevertheless, or if the extensions
field is padded with additional unaccounted data.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agoalert: GNUTLS_E_PK_INVALID_PUBKEY maps to GNUTLS_A_ILLEGAL_PARAMETER
Nikos Mavrogiannopoulos [Thu, 2 Mar 2017 16:53:55 +0000 (17:53 +0100)] 
alert: GNUTLS_E_PK_INVALID_PUBKEY maps to GNUTLS_A_ILLEGAL_PARAMETER

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agoalerts: separated record overflow from decode error alerts
Nikos Mavrogiannopoulos [Thu, 2 Mar 2017 16:48:31 +0000 (17:48 +0100)] 
alerts: separated record overflow from decode error alerts

Introduced GNUTLS_E_RECORD_OVERFLOW.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agoauth: failures of _gnutls_mpi_init_scan_nz map to GNUTLS_E_RECEIVED_ILLEGAL_PARAMETER
Nikos Mavrogiannopoulos [Thu, 2 Mar 2017 16:42:51 +0000 (17:42 +0100)] 
auth: failures of _gnutls_mpi_init_scan_nz map to GNUTLS_E_RECEIVED_ILLEGAL_PARAMETER

That ensures that the right alert is send when illegal
parameters are received (e.g., zero length).

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agodoc: updated tlsproxy to latest version
Nikos Mavrogiannopoulos [Tue, 7 Mar 2017 10:49:45 +0000 (11:49 +0100)] 
doc: updated tlsproxy to latest version

9 years agotestsuite: added tlsfuzzer
Nikos Mavrogiannopoulos [Mon, 18 Apr 2016 12:17:18 +0000 (14:17 +0200)] 
testsuite: added tlsfuzzer

This enhances the testsuite by running all the tlsfuzzer
fuzzer tests which require no certificates from server.

https://github.com/tomato42/tlsfuzzer

9 years agotests: converted compile-time checks for FIPS140 mode to run-time
Nikos Mavrogiannopoulos [Tue, 7 Mar 2017 06:55:10 +0000 (07:55 +0100)] 
tests: converted compile-time checks for FIPS140 mode to run-time

This allows running the complete test suite even when the library
is compiled in FIPS140-2 mode, as long as the run-time is not at
this mode.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years ago.gitlab-ci.yml: include coverage statistics of FIPS140-2 code
Nikos Mavrogiannopoulos [Tue, 7 Mar 2017 06:39:20 +0000 (07:39 +0100)] 
.gitlab-ci.yml: include coverage statistics of FIPS140-2 code

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years ago.gitlab-ci.yml: include FIPS140-2 code into static analyzer runs
Nikos Mavrogiannopoulos [Tue, 7 Mar 2017 06:32:46 +0000 (07:32 +0100)] 
.gitlab-ci.yml: include FIPS140-2 code into static analyzer runs

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agodoc update
Nikos Mavrogiannopoulos [Mon, 6 Mar 2017 21:35:41 +0000 (22:35 +0100)] 
doc update

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agonettle/rnd-fips: combined the FIPS-compliant generators to two
Nikos Mavrogiannopoulos [Wed, 1 Mar 2017 09:22:04 +0000 (10:22 +0100)] 
nettle/rnd-fips: combined the FIPS-compliant generators to two

This brings the FIPS generators in par with the non-FIPS chacha-based ones.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agonettle/rnd: use two random generators instead of 3
Nikos Mavrogiannopoulos [Wed, 1 Mar 2017 09:18:14 +0000 (10:18 +0100)] 
nettle/rnd: use two random generators instead of 3

That combines the levels GNUTLS_RND_RANDOM and GNUTLS_RND_KEY, while
at the same time makes sure that backtracking is impossible on the
GNUTLS_RND_KEY level, by reinitializing the RNG after a call requesting
data for the GNUTLS_RND_KEY level.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agodoc: updated the PRNG documentation to utilize two PRNG instances
Nikos Mavrogiannopoulos [Wed, 1 Mar 2017 09:04:18 +0000 (10:04 +0100)] 
doc: updated the PRNG documentation to utilize two PRNG instances

Also move the random generator discussion to internals section.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agodoc: document the state of PRNG in GnuTLS 3.6.0
Nikos Mavrogiannopoulos [Mon, 27 Feb 2017 10:37:39 +0000 (11:37 +0100)] 
doc: document the state of PRNG in GnuTLS 3.6.0

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agonettle/pk: corrected call to gnutls_rnd() for rnd_nonce_func
Nikos Mavrogiannopoulos [Mon, 27 Feb 2017 10:51:18 +0000 (11:51 +0100)] 
nettle/pk: corrected call to gnutls_rnd() for rnd_nonce_func

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agotests: decoupled the random generator operational tests from the forking ones
Nikos Mavrogiannopoulos [Sun, 26 Feb 2017 19:07:41 +0000 (20:07 +0100)] 
tests: decoupled the random generator operational tests from the forking ones

That also corrects the fact that not all tests were run for all generators,
and allows to run the tests in parallel.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agonettle/rnd: specify different limits for rekey in PRNGs
Nikos Mavrogiannopoulos [Sun, 26 Feb 2017 18:56:09 +0000 (19:56 +0100)] 
nettle/rnd: specify different limits for rekey in PRNGs

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agonettle/pk: use the GNUTLS_RND_RANDOM level for DH/DSA params
Nikos Mavrogiannopoulos [Sun, 26 Feb 2017 18:20:16 +0000 (19:20 +0100)] 
nettle/pk: use the GNUTLS_RND_RANDOM level for DH/DSA params

This are not long term keys and do not require the key level.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agotests: added check to verify that including crypto.h is sufficient
Nikos Mavrogiannopoulos [Sun, 26 Feb 2017 18:16:32 +0000 (19:16 +0100)] 
tests: added check to verify that including crypto.h is sufficient

That is, sufficient to use its functionality, and including additional
headers isn't necessary.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agocrypto.h: include gnutls.h to obtain required types
Nikos Mavrogiannopoulos [Sun, 26 Feb 2017 18:11:51 +0000 (19:11 +0100)] 
crypto.h: include gnutls.h to obtain required types

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agornd: reduce calls to _rnd_get_system_entropy
Nikos Mavrogiannopoulos [Thu, 23 Feb 2017 09:44:43 +0000 (10:44 +0100)] 
rnd: reduce calls to _rnd_get_system_entropy

That is, no longer obtain the initial nonces for the RNG
via _rnd_get_system_entropy() but instead use time-based ones
which are typically faster kernel calls. This reduces the number
of expensive system calls done during thread and
process initialization.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agornd: when reseeding the generators use the next best generator
Nikos Mavrogiannopoulos [Tue, 21 Feb 2017 10:48:08 +0000 (11:48 +0100)] 
rnd: when reseeding the generators use the next best generator

That is, use the RANDOM level to obtain keys to reseed the
NONCE level, and the KEY level to reseed the RANDOM. The KEY
level is reseeded using the system random generator.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agotests: verify whether crypto operations fail
Nikos Mavrogiannopoulos [Tue, 21 Feb 2017 10:11:31 +0000 (11:11 +0100)] 
tests: verify whether crypto operations fail

That is verify whether a signature operation will fail if
the library is in error state.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agoAdded _gnutls_lib_force_operational
Nikos Mavrogiannopoulos [Tue, 21 Feb 2017 10:05:48 +0000 (11:05 +0100)] 
Added _gnutls_lib_force_operational

This allows recovering from _gnutls_lib_simulate_error() which in
turn allows more advanced tests. Not documented, and intended to
be an internal symbol only.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agopk: always use _gnutls_switch_lib_state
Nikos Mavrogiannopoulos [Tue, 21 Feb 2017 09:56:44 +0000 (10:56 +0100)] 
pk: always use _gnutls_switch_lib_state

This avoids relying on abort() for RNG errors in PK wrappers.
We use instead the library state originally added for FIPS140-2
support, and if the state indicates failure the operation will
fail.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agornd: switched to 3 chacha-based PRNGs for all security levels
Nikos Mavrogiannopoulos [Tue, 21 Feb 2017 09:43:56 +0000 (10:43 +0100)] 
rnd: switched to 3 chacha-based PRNGs for all security levels

Chacha was selected because it is already present in TLS protocol
as algorithm, meaning that re-using would improve CPU caching,
and it is a comparable in performance algorithm to the existing
PRNG used for nonces (salsa20). The yarrow generator was removed
because we are primarily seeding from system devices which are
sufficiently trustworthy to offload us from coping with the
handling of multiple sources of input. As such it allows
us to switch to a simpler PRNG such as a stream cipher like Chacha.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agornd: aligned type of data counter with input data type (size_t)
Nikos Mavrogiannopoulos [Sun, 19 Feb 2017 09:40:44 +0000 (10:40 +0100)] 
rnd: aligned type of data counter with input data type (size_t)

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agorandom: keep global list of initialized contexts
Nikos Mavrogiannopoulos [Sun, 19 Feb 2017 08:57:39 +0000 (09:57 +0100)] 
random: keep global list of initialized contexts

This allows to properly deinitialize all random generator
contexts on library deinitialization.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agornd: removed call of _rnd_system_entropy_deinit on deinit
Nikos Mavrogiannopoulos [Sat, 18 Feb 2017 20:47:33 +0000 (21:47 +0100)] 
rnd: removed call of _rnd_system_entropy_deinit on deinit

This was already being done in _gnutls_rnd_deinit().

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agoRemoved locks from internal rng
Nikos Mavrogiannopoulos [Fri, 27 Jan 2017 12:52:23 +0000 (13:52 +0100)] 
Removed locks from internal rng

Also made the rng back-end to be thread-safe.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agoUse a thread local random generator.
Nikos Mavrogiannopoulos [Fri, 27 Jan 2017 09:21:56 +0000 (10:21 +0100)] 
Use a thread local random generator.

This allows accessing the per-thread random generator in
a lock-free way, at the cost of additional memory per thread.
The default random generator imposes around 640 bytes per thread
on 64-bit architectures.

Resolves: #141

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agoMakefile.am: added missing file
Nikos Mavrogiannopoulos [Mon, 6 Mar 2017 06:38:20 +0000 (07:38 +0100)] 
Makefile.am: added missing file

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years ago.gitlab-ci.yml: execute initialization stage unconditionally [ci skip]
Nikos Mavrogiannopoulos [Mon, 6 Mar 2017 05:58:29 +0000 (06:58 +0100)] 
.gitlab-ci.yml: execute initialization stage unconditionally [ci skip]

This step is required both in tags and commit runs.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agodatum.h: documented behavior of datum functions
Nikos Mavrogiannopoulos [Sun, 5 Mar 2017 17:22:04 +0000 (18:22 +0100)] 
datum.h: documented behavior of datum functions

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years ago_gnutls_set_strdatum: always return an allocated string on success
Nikos Mavrogiannopoulos [Sun, 5 Mar 2017 17:17:36 +0000 (18:17 +0100)] 
_gnutls_set_strdatum: always return an allocated string on success

That prevents returning NULL to functions which require a string.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agoEnforce the max packet length for OpenPGP subpackets as well
Alex Gaynor [Sun, 5 Mar 2017 02:21:30 +0000 (02:21 +0000)] 
Enforce the max packet length for OpenPGP subpackets as well

This addresses:
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=392

Signed-off-by: Alex Gaynor <alex.gaynor@gmail.com>
9 years agodoc: corrected typo [ci skip]
Nikos Mavrogiannopoulos [Sun, 5 Mar 2017 07:08:10 +0000 (08:08 +0100)] 
doc: corrected typo [ci skip]

It was pointed out by morozov@eags.ru.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agodoc update
Nikos Mavrogiannopoulos [Fri, 3 Mar 2017 08:31:37 +0000 (09:31 +0100)] 
doc update

9 years agotests: do not generate certificates with serial being zero
Nikos Mavrogiannopoulos [Fri, 3 Mar 2017 08:29:12 +0000 (09:29 +0100)] 
tests: do not generate certificates with serial being zero

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agotests: check whether a certificate with illegal version is rejected
Nikos Mavrogiannopoulos [Fri, 3 Mar 2017 07:48:41 +0000 (08:48 +0100)] 
tests: check whether a certificate with illegal version is rejected

That is, whether a certificate with version zero fails to import.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agognutls_x509_crt_set_version: do not allow writing illegal versions
Nikos Mavrogiannopoulos [Fri, 3 Mar 2017 07:38:01 +0000 (08:38 +0100)] 
gnutls_x509_crt_set_version: do not allow writing illegal versions

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agox509: reject illegal certificate versions
Nikos Mavrogiannopoulos [Fri, 3 Mar 2017 07:28:47 +0000 (08:28 +0100)] 
x509: reject illegal certificate versions

Resolves #182

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agognutls_x509_crt_set_serial: refuse to write all-zero serial number
Nikos Mavrogiannopoulos [Fri, 3 Mar 2017 07:44:41 +0000 (08:44 +0100)] 
gnutls_x509_crt_set_serial: refuse to write all-zero serial number

This is prohibited by RFC5280.

Relates #181

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agognutls_x509_crt_set_serial: document the 20-byte limit for serial sizes
Nikos Mavrogiannopoulos [Fri, 3 Mar 2017 07:27:23 +0000 (08:27 +0100)] 
gnutls_x509_crt_set_serial: document the 20-byte limit for serial sizes

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agodoc update
Nikos Mavrogiannopoulos [Wed, 1 Mar 2017 11:51:47 +0000 (12:51 +0100)] 
doc update

9 years agotests: chainverify: incorporated the tests for unknown critical extensions
Nikos Mavrogiannopoulos [Wed, 1 Mar 2017 10:59:50 +0000 (11:59 +0100)] 
tests: chainverify: incorporated the tests for unknown critical extensions

These check whether unknown critical extensions are detected during verification,
and whether the flag GNUTLS_VERIFY_IGNORE_UNKNOWN_CRIT_EXTENSIONS, is honored
during verification.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agox509.h: introduced flag GNUTLS_VERIFY_IGNORE_UNKNOWN_CRIT_EXTENSIONS
Nikos Mavrogiannopoulos [Wed, 1 Mar 2017 10:47:17 +0000 (11:47 +0100)] 
x509.h: introduced flag GNUTLS_VERIFY_IGNORE_UNKNOWN_CRIT_EXTENSIONS

That flag signals the verification process, not to fail on unknown critical
extensions. This can be used when the critical extension checking in a chain
is handled externally.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agotests: verify that critical extensions can be stored
Nikos Mavrogiannopoulos [Mon, 27 Feb 2017 15:54:33 +0000 (16:54 +0100)] 
tests: verify that critical extensions can be stored

That is, ensure that we don't repeat the regression of
certtool not processing free-form critical extensions when no
other free-form extensions are present.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agotests: added verification for unknown critical extensions
Nikos Mavrogiannopoulos [Mon, 27 Feb 2017 14:50:44 +0000 (15:50 +0100)] 
tests: added verification for unknown critical extensions

This tests whether unknown critical extensions will cause a verification
failure.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agox509/verify: refuse to verify certificates with unknown critical extensions
Nikos Mavrogiannopoulos [Mon, 27 Feb 2017 13:48:37 +0000 (14:48 +0100)] 
x509/verify: refuse to verify certificates with unknown critical extensions

That is, introduced flag GNUTLS_CERT_UNKNOWN_CRIT_EXTENSIONS, which is
set when the chain under verification contains unsupported extensions marked
as critical.

Resolves: #177

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years ago.gitlab-ci.yml: run tests under a FIPS140 mode simulation
Nikos Mavrogiannopoulos [Wed, 1 Mar 2017 09:17:41 +0000 (10:17 +0100)] 
.gitlab-ci.yml: run tests under a FIPS140 mode simulation

That is, in FIPS140-2/Fedora/x86_64 build, run tests under a normal
run (when library is compiled with FIPS140-2 support but not enabled
on run time), and also run tests under a run-time that simulates
FIPS140-2 support.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agocrypto-self-tests: modified exported functions to work under fips140-2 mode
Nikos Mavrogiannopoulos [Wed, 1 Mar 2017 16:13:37 +0000 (17:13 +0100)] 
crypto-self-tests: modified exported functions to work under fips140-2 mode

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agotests: skip tests which cannot be run in FIPS140-2 mode
Nikos Mavrogiannopoulos [Wed, 1 Mar 2017 14:52:13 +0000 (15:52 +0100)] 
tests: skip tests which cannot be run in FIPS140-2 mode

This allows the test suite to be run in FIPS140-2 mode.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years ago_gnutls_pk_params_copy: copy the provable algorithm used
Nikos Mavrogiannopoulos [Wed, 1 Mar 2017 14:42:25 +0000 (15:42 +0100)] 
_gnutls_pk_params_copy: copy the provable algorithm used

This is affected utilization of generated RSA keys under FIPS140-2 mode
which utilizes provable generation.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agognutls_session_ticket_key_generate: fixed operation under FIPS140-2 mode
Nikos Mavrogiannopoulos [Wed, 1 Mar 2017 13:31:30 +0000 (14:31 +0100)] 
gnutls_session_ticket_key_generate: fixed operation under FIPS140-2 mode

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agotests: priorities: enhanced for test to work under FIPS140-2 mode
Nikos Mavrogiannopoulos [Wed, 1 Mar 2017 13:05:31 +0000 (14:05 +0100)] 
tests: priorities: enhanced for test to work under FIPS140-2 mode

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agognutls-cli: print the ciphers, MACs and KXs when priority string is given
Nikos Mavrogiannopoulos [Wed, 1 Mar 2017 12:46:43 +0000 (13:46 +0100)] 
gnutls-cli: print the ciphers, MACs and KXs when priority string is given

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agognutls_priority_get_cipher_suite_index: do not return values for non-existent ciphers
Nikos Mavrogiannopoulos [Wed, 1 Mar 2017 12:39:39 +0000 (13:39 +0100)] 
gnutls_priority_get_cipher_suite_index: do not return values for non-existent ciphers

That is, do return only the enabled algorithms in states like FIPS140-2,
rather than returning the set that would have been enabled if these
restrictions wouldn't be in place.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agoREADME.md: removed info that gnutls is a gnu project [ci skip]
Nikos Mavrogiannopoulos [Tue, 28 Feb 2017 14:46:07 +0000 (15:46 +0100)] 
README.md: removed info that gnutls is a gnu project [ci skip]

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agotests: doc update [ci skip]
Nikos Mavrogiannopoulos [Tue, 28 Feb 2017 14:33:45 +0000 (15:33 +0100)] 
tests: doc update [ci skip]

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
9 years agotests: added test cases with invalid openpgp certs
Nikos Mavrogiannopoulos [Wed, 1 Mar 2017 06:58:04 +0000 (07:58 +0100)] 
tests: added test cases with invalid openpgp certs

These certificates contain invalid secret key sub-packets.
These trigger invalid memory accesses:
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=360
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=354

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agoopencdk: do not parse any secret keys in packet when reading a certificate
Nikos Mavrogiannopoulos [Wed, 1 Mar 2017 06:54:04 +0000 (07:54 +0100)] 
opencdk: do not parse any secret keys in packet when reading a certificate

This reduces the attack surface on the parsers, and prevents any bugs
in the secret key parser to be exploitable by inserting secret key
sub-packets into an openpgp certificate.

This addresses:
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=354
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=360

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
9 years agotests: crt_apis: added tests for writing/reading unique IDs
Nikos Mavrogiannopoulos [Tue, 28 Feb 2017 09:32:38 +0000 (10:32 +0100)] 
tests: crt_apis: added tests for writing/reading unique IDs

That is check the functionality of:
 - gnutls_x509_crt_get_subject_unique_id
 - gnutls_x509_crt_get_issuer_unique_id
 - gnutls_x509_crt_set_issuer_unique_id
 - gnutls_x509_crt_set_subject_unique_id

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>