Commit Graph

4939 Commits

Author SHA1 Message Date
Jaeden Amero
2b72742e3f Merge branch 'mbedtls-2.1' into mbedtls-2.1-restricted 2018-01-29 12:52:10 +00:00
Jaeden Amero
9442121200 Merge remote-tracking branch 'upstream-public/pr/1288' into mbedtls-2.1 2018-01-29 12:52:01 +00:00
Manuel Pégourié-Gonnard
3e6222dacb Fix alarm(0) failure on mingw32
A new test for mbedtls_timing_alarm(0) was introduced in PR 1136, which also
fixed it on Unix. Apparently test results on MinGW were not checked at that
point, so we missed that this new test was also failing on this platform.
2018-01-29 13:23:40 +01:00
Jaeden Amero
bfafd12789 Merge remote-tracking branch 'upstream-restricted/pr/414' into mbedtls-2.1-restricted 2018-01-26 18:09:14 +00:00
Jaeden Amero
3b8d82a1aa Merge branch 'mbedtls-2.1' into mbedtls-2.1-restricted 2018-01-26 15:07:16 +00:00
Jaeden Amero
200966824d Merge remote-tracking branch 'upstream-public/pr/1054' into mbedtls-2.1 2018-01-26 15:07:11 +00:00
Jaeden Amero
4af592178e Merge branch 'mbedtls-2.1' into mbedtls-2.1-restricted 2018-01-26 15:06:48 +00:00
Jaeden Amero
f216a3c20b Merge remote-tracking branch 'upstream-public/pr/1310' into mbedtls-2.1 2018-01-26 15:01:30 +00:00
Ron Eldor
35836bfd37 Support verbose output of the test suites
generate add ctest test-suites, with the --verbose argument to be given
to the test suites.
The verbose output will be shown **only** if ctest is run with `-v` parameter
The verbose argument is to the test-suites, only when run through `ctest`
2018-01-25 18:25:44 +00:00
Manuel Pégourié-Gonnard
e56c77eeb2 Fix race condition in error printing in ssl_server2.c
The race goes this way:
1. ssl_recv() succeeds (ie no signal received yet)
2. processing the message leads to aborting handshake with ret != 0
3. reset ret if we were signaled
4. print error if ret is still non-zero
5. go back to net_accept() which can be interrupted by a signal
We print the error message only if the signal is received between steps 3 and
5, not when it arrives between steps 1 and 3.

This can cause failures in ssl-opt.sh where we check for the presence of "Last
error was..." in the server's output: if we perform step 2, the client will be
notified and exit, then ssl-opt.sh will send SIGTERM to the server, but if it
didn't get a chance to run and pass step 3 in the meantime, we're in trouble.

The purpose of step 3 was to avoid spurious "Last error" messages in the
output so that ssl-opt.sh can check for a successful run by the absence of
that message. However, it is enough to suppress that message when the last
error we get is the one we expect from being interrupted by a signal - doing
more could hide real errors.

Also, improve the messages printed when interrupted to make it easier to
distinguish the two cases - this could be used in a testing script wanted to
check that the server doesn't see the client as disconnecting unexpectedly.
2018-01-25 11:43:36 +01:00
Jaeden Amero
e5b443e2d6 Merge branch 'mbedtls-2.1' into mbedtls-2.1-restricted 2018-01-24 15:24:42 +00:00
Jaeden Amero
0295634b21 Merge remote-tracking branch 'upstream-public/pr/1278' into mbedtls-2.1 2018-01-24 10:55:56 +00:00
Andres Amaya Garcia
133ab2c8ee Ensure that mbedtls_pk_parse_key() does not allocate 0 bytes 2018-01-23 21:21:49 +00:00
Andres Amaya Garcia
af77213b72 Change formatting of allocation check in x509_crl 2018-01-23 21:21:00 +00:00
Andres Amaya Garcia
fb023c18da Ensure memcpy is not called with NULL and 0 args in x509 module 2018-01-23 21:21:00 +00:00
Simon Butcher
60411a8b7f Fix typos and add copyright statement to generate_code.pl 2018-01-23 21:21:00 +00:00
SimonB
8bcd549a3a Refactored test suite template code
Restructed test suite helper and main code to support tests suite helper
functions, changed C++ comments to C-style, and made the generated
source code more navigable.
2018-01-23 21:21:00 +00:00
SimonB
0284f58234 Added support for per test suite helper functions
Added to generate_code.pl:
    - support for per test suite helper functions
    - description of the structure of the files the script uses to construct
      the test suite file
    - delimiters through the source code to make the machine generated code
      easier to understand
2018-01-23 21:17:27 +00:00
SimonB
e39088a62b Clarified purpose and usage of generate_code.pl
Added comments to explain purpose and usage of generate_code.pl
2018-01-23 21:07:10 +00:00
Andres AG
9b9ae0d897 Test corner case uses of memory_buffer_alloc.c 2018-01-23 21:03:49 +00:00
Simon Butcher
e9cfe146b5 Widens test bounds on memory alloc tests 2018-01-23 21:03:49 +00:00
SimonB
aff799231e Additional tests to test stack buffer allocator
Adds additional tests to the test suite for
memory_buffer_alloc.c
2018-01-23 21:03:49 +00:00
Andres Amaya Garcia
5dc2fe7467 Style fixes in pem, x509_crl and buf_alloc 2018-01-23 21:03:49 +00:00
Andres AG
8ad5acd6da Fix corner case uses of memory_buffer_alloc.c
The corner cases fixed include:
    * Allocating a buffer of size 0. With this change, the allocator now
      returns a NULL pointer in this case. Note that changes in pem.c and
      x509_crl.c were required to fix tests that did not work under this
      assumption.
    * Initialising the allocator with less memory than required for headers.
    * Fix header chain checks for uninitialised allocator.
2018-01-23 21:03:49 +00:00
Gilles Peskine
a2ef78d50c Merge remote-tracking branch 'upstream-restricted/pr/442' into mbedtls-2.1-restricted 2018-01-23 00:47:43 +01:00
Gilles Peskine
b9088ee537 Merge branch 'mbedtls-2.1' into mbedtls-2.1-restricted 2018-01-23 00:47:32 +01:00
Gilles Peskine
6598af0bef Merge remote-tracking branch 'upstream-public/pr/1151' into mbedtls-2.1 2018-01-23 00:47:15 +01:00
Andres Amaya Garcia
b61b9ccf80 Fix typo and bracketing in macro args 2018-01-22 22:32:19 +01:00
Ron Eldor
1ac9aa7085 Set correct minimal versions in default conf
Set `MBEDTLS_SSL_MIN_MAJOR_VERSION` and `MBEDTLS_SSL_MIN_MINOR_VERSION`
instead of `MBEDTLS_SSL_MAJOR_VERSION_3` and `MBEDTLS_SSL_MINOR_VERSION_1`
2018-01-22 22:03:12 +01:00
Ron Eldor
998a4de3fa Fix Changelog notation
Remove backticks, since ChangeLog is not in MarkDown
2018-01-22 19:14:11 +02:00
Ron Eldor
a1413e05e9 Fix compilation error with Mingw32
Fix compilation error on Mingw32 when `_TRUNCATE` is defined. Use
`_TRUNCATE` only if `__MINGW32__` not defined. Fix suggested by
Thomas Glanzmann and Nick Wilson on issue #355
2018-01-22 19:06:57 +02:00
Gilles Peskine
f700ef38fa Add ChangeLog entry 2018-01-22 14:38:53 +01:00
Gilles Peskine
784f41c90d wait_server_start: warn if lsof is not available
If lsof is not available, wait_server_start uses a fixed timeout,
which can trigger a race condition if the timeout turns out to be too
short. Emit a warning so that we know this is going on from the test
logs.
2018-01-22 11:24:01 +01:00
Manuel Pégourié-Gonnard
3f69e54f3b Increase waiting times compat.sh and ssl-opt.sh
- Some of the CI machines don't have lsof installed yet, so rely on an sleeping
an arbitrary number of seconds while the server starts. We're seeing
occasional failures with the current delay because the CI machines are highly
loaded, which seems to indicate the current delay is not quite enough, but
hopefully not to far either, so double it.

- While at it, also double the watchdog delay: while I don't remember seeing
  much failures due to client timeout, this change doesn't impact normal
running time of the script, so better err on the safe side.

These changes don't affect the test and should only affect the false positive
rate coming from the test framework in those scripts.
2018-01-22 11:23:58 +01:00
Hanno Becker
31b37f6edd Use free + init to reset accumulator in entropy module
The SHA-256 / SHA-512 context used for entropy mixing in entropy.c
was previously reset by zeroization. The commit replaces this by
a pair of calls to `mbedtls_shaxxx_init` and `mbedtls_shaxxx_free`
which is safe also for alternative implementations of SHA-256 or
SHA-512 for which zeroization might not be a proper reset.
2018-01-17 23:12:53 +00:00
Micha Kraus
1741db9d7e fix bug in get_one_and_zeros_padding()
add test case (“0000000082”) which fails with the old implementation.
2018-01-17 23:58:14 +01:00
Hanno Becker
4ecd34f86c Adapt ChangeLog 2018-01-17 17:47:58 +00:00
Hanno Becker
1cc67a0d0e Add missing calls to sha{256/512}_{init/free} in entropy module
The entropy context contains a SHA-256 or SHA-512 context for entropy
mixing, but doesn't initialize / free this context properly in the
initialization and freeing functions `mbedtls_entropy_init` and
`mbedtls_entropy_free` through a call to `mbedtls_sha{256/512}_init`
resp. `mbedtls_sha{256/512}_free`. Instead, only a zeroization of the
entire entropy structure is performed. This doesn't lead to problems
for the current software implementations of SHA-256 and SHA-512 because
zeroization is proper initialization for them, but it may (and does)
cause problems for alternative implementations of SHA-256 and SHA-512
that use context structures that cannot be properly initialized through
zeroization. This commit fixes this. Found and fix suggested by ccli8.
2018-01-17 17:47:58 +00:00
Jaeden Amero
1010760d91 Merge branch 'mbedtls-2.1' into mbedtls-2.1-restricted 2018-01-10 13:16:26 +00:00
Jaeden Amero
5273182a20 Merge remote-tracking branch 'upstream-public/pr/1266' into mbedtls-2.1 2018-01-10 13:08:07 +00:00
Manuel Pégourié-Gonnard
022954f4bd Fix heap-buffer overread in ALPN ext parsing 2018-01-10 12:04:07 +01:00
Hanno Becker
f34f4e53c9 Adapt ChangeLog 2018-01-10 10:48:53 +00:00
Hanno Becker
b70ba9fec7 Address issues found by coverity
1) The MPI test for prime generation missed a return value
   check for a call to `mbedtls_mpi_shift_r`. This is neither
   critical nor new but should be fixed.

2) The RSA keygeneration example program contained code
   initializing an RSA context after a potentially failing
   call to CTR DRBG initialization, leaving the corresponding
   RSA context free call in the cleanup section orphaned.
   The commit fixes this by moving the initializtion of the
   RSA context prior to the first potentially failing call.
2018-01-10 10:46:18 +00:00
Gilles Peskine
92deeaa47f all.sh --keep-going: work if TERM is unset 2018-01-02 21:59:21 +01:00
Manuel Pégourié-Gonnard
47331a72e2 Merge branch 'mbedtls-2.1' into mbedtls-2.1-restricted
* mbedtls-2.1:
  all.sh: add some documentation
  all.sh: new option --no-armcc
  all.sh: --keep-going mode
  all.sh: cleaned up usage output
  all.sh: indent
2017-12-26 10:59:02 +01:00
Manuel Pégourié-Gonnard
33df5b34f6 Merge remote-tracking branch 'public/pr/1221' into mbedtls-2.1
* public/pr/1221:
  all.sh: add some documentation
  all.sh: new option --no-armcc
  all.sh: --keep-going mode
  all.sh: cleaned up usage output
  all.sh: indent
2017-12-26 10:58:44 +01:00
Manuel Pégourié-Gonnard
c313e7e679 Merge branch 'mbedtls-2.1' into mbedtls-2.1-restricted
* mbedtls-2.1:
  selftest: fix build error in some configurations
  Timing self test: shorten redundant tests
  Timing self test: increased duration
  Timing self test: increased tolerance
  selftest: allow excluding a subset of the tests
  selftest: allow running a subset of the tests
  selftest: fixed an erroneous return code
  selftest: refactor to separate the list of tests from the logic
  Timing self test: print some diagnosis information
  mbedtls_timing_get_timer: don't use uninitialized memory
  timing interface documentation: minor clarifications
  Timing: fix mbedtls_set_alarm(0) on Unix/POSIX
2017-12-26 10:43:51 +01:00
Manuel Pégourié-Gonnard
016b60b1ad Merge remote-tracking branch 'public/pr/1223' into mbedtls-2.1
* public/pr/1223:
  selftest: fix build error in some configurations
  Timing self test: shorten redundant tests
  Timing self test: increased duration
  Timing self test: increased tolerance
  selftest: allow excluding a subset of the tests
  selftest: allow running a subset of the tests
  selftest: fixed an erroneous return code
  selftest: refactor to separate the list of tests from the logic
  Timing self test: print some diagnosis information
  mbedtls_timing_get_timer: don't use uninitialized memory
  timing interface documentation: minor clarifications
  Timing: fix mbedtls_set_alarm(0) on Unix/POSIX
2017-12-26 10:43:17 +01:00
Gilles Peskine
855863093d Merge branch 'mbedtls-2.1' into mbedtls-2.1-restricted 2017-12-22 11:20:55 +01:00
Gilles Peskine
892c1752f7 Merge remote-tracking branch 'upstream-public/pr/1233' into mbedtls-2.1 2017-12-22 11:20:23 +01:00