Commit graph

5128 commits

Author SHA1 Message Date
Simon Butcher 01df8cc384 Merge branch 'mbedtls-2.4' 2017-03-10 17:14:59 +00:00
Simon Butcher 59ae96f167 Updated version number to 2.4.2 for release 2017-03-08 15:33:04 +00:00
Simon Butcher 63bf86d617 Added missing credit to ChangeLog for #555 2017-03-08 11:15:01 +00:00
Simon Butcher 889d344a0f Corrected attibution in Changelog 2017-03-07 12:40:32 +00:00
Andres AG e76aeb7dc3 Fix buffer overflow in mbedtls_mpi_write_string()
Fix a buffer overflow when writting a string representation of an MPI
number to a buffer in hexadecimal. The problem occurs because hex
digits are written in pairs and this is not accounted for in the
calculation of the required buffer size when the number of digits is
odd.
2017-03-02 22:47:44 +00:00
Andres AG 9b3b6dc511 Fix failing pkparse test case
The first three test cases from test_suites_pkparse.data failed because
the key file they read requires DES to be read. However, MBEDTLS_DES_C
was missing from the dependency list.
2017-03-02 17:20:28 +00:00
Ron Eldor f882d9ac0c Fix resource leak when using mutex and ssl_cookie
When using ssl_cookie with MBEDTLS_THREADING_C, fix a resource leak caused by
initiating a mutex in mbedtls_ssl_cookie_free instead of freeing it.
Raised and fix suggested by lan Gillingham in the mbed TLS forum
Tracked in #771
2017-03-02 17:19:59 +00:00
Andres AG b3fe1adcfb Fix failing pkparse test case
The first three test cases from test_suites_pkparse.data failed because
the key file they read requires DES to be read. However, MBEDTLS_DES_C
was missing from the dependency list.
2017-03-02 15:31:48 +00:00
Simon Butcher 46c8073d7b Fix mistake in ChangeLog from file merge 2017-03-02 12:06:53 +00:00
Ron Eldor 8c6a2a37bb Fix resource leak when using mutex and ssl_cookie
When using ssl_cookie with MBEDTLS_THREADING_C, fix a resource leak caused by
initiating a mutex in mbedtls_ssl_cookie_free instead of freeing it.
Raised and fix suggested by lan Gillingham in the mbed TLS forum
Tracked in #771
2017-03-02 12:04:08 +00:00
Simon Butcher e32b523655 Add fix and credit for #742 to the ChangeLog 2017-03-02 09:25:55 +00:00
Simon Butcher 0fa5e66b25 Add fix and credit for #742 to the ChangeLog 2017-03-02 09:23:24 +00:00
Andres AG 39906a9207 Remove use of inttypes.h in MSVC from ssl_server2
The sample application programs/ssl/ssl_server2.c was previously
modifies to use inttypes.h to parse a string to a 64-bit integer.
However, MSVC does not support C99, so compilation fails. This
patch modifies the sample app to use the MSVC specific parsing
functions instead of inttypes.h.
2017-03-02 08:12:34 +00:00
Simon Butcher 068097cc3c Update of the Visual Studio files
Contains additional project file, ecdh_curve25519.vcxproj, as well as fix
for intermediate files causing the warning MSB8028 with Visual Studio 2015.
2017-03-02 08:12:34 +00:00
Simon Butcher 964b58fe3f Fix Visual Studio template files
Adds interim directories to the Visual Studio project files to avoid warning
MSB8028 in Visual Studio 2015, where shared directories of intermediate files
between project files generate the warning.
2017-03-02 08:12:34 +00:00
Andres AG c22d2975b6 Remove use of inttypes.h in MSVC from ssl_server2
The sample application programs/ssl/ssl_server2.c was previously
modifies to use inttypes.h to parse a string to a 64-bit integer.
However, MSVC does not support C99, so compilation fails. This
patch modifies the sample app to use the MSVC specific parsing
functions instead of inttypes.h.
2017-03-01 23:29:29 +00:00
Simon Butcher 6ceb8fc5de Update of the Visual Studio files
Contains additional project file, ecdh_curve25519.vcxproj, as well as fix
for intermediate files causing the warning MSB8028 with Visual Studio 2015.
2017-03-01 23:17:16 +00:00
Simon Butcher 35f4503a32 Fix Visual Studio template files
Adds interim directories to the Visual Studio project files to avoid warning
MSB8028 in Visual Studio 2015, where shared directories of intermediate files
between project files generate the warning.
2017-03-01 22:54:39 +00:00
Ron Eldor ba5b11c3ee fix for issue 1101: missing rsa context initialization
added mbedtls_rsa_init in rsa_decrypt sample application
2017-03-01 15:58:33 +00:00
Ron Eldor 8d2d246025 fix for issue 1101: missing rsa context initialization
added mbedtls_rsa_init in rsa_decrypt sample application
2017-03-01 15:17:25 +00:00
Paul Bakker 6b7fc313c5 Fix default hostname for verification used in ssl_client1 2017-02-28 23:26:17 +00:00
Paul Bakker 3c8ab80fca Fix default hostname for verification used in ssl_client1 2017-02-28 23:23:01 +00:00
Simon Butcher eb26b7c519 Clarify ChangeLog for #569 2017-02-28 20:18:38 +00:00
Janos Follath b6998f7f51 ECP: Prevent freeing a buffer on stack
The function ecp_mod_koblitz computed the space for the result of a
multiplication optimally for that specific case, but unfortunately
the function mbedtls_mpi_mul_mpi performs a generic, suboptimal
calculation and needs one more limb for the result. Since the result's
buffer is on the stack, the best case scenario is that the program
stops.

This only happened on 64 bit platforms.

Fixes #569
2017-02-28 18:54:24 +00:00
Janos Follath a6993c1d1d Add invalid key tests for curve SECP224K1
This curve has special arithmetic on 64 bit platforms and an untested
path lead to trying to free a buffer on the stack.

For the sake of completeness, a test case for a point with non-affine
coordinates has been added as well.
2017-02-28 18:54:24 +00:00
Simon Butcher 3f0d348e8b Fix credit in ChangeLog for #722 2017-02-28 16:46:06 +00:00
Andres AG 98ef8a2ecd Fix memory leak in mbedtls_x509_crl_parse()
The memory leak call was caused by missing calls to mbedtls_pem_free()
when a MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT error was
encountered.
2017-02-28 14:57:11 +00:00
Janos Follath f81ceddc8e Fix buffer overread in mbedtls_x509_get_time()
A heap overread might happen when parsing malformed certificates.
Reported by Peng Li and Yueh-Hsun Lin.

Refactoring the parsing fixes the problem. This commit applies the
relevant part of the OpenVPN contribution applied to mbed TLS 1.3
in commit 17da9dd829.
2017-02-28 12:05:44 +00:00
Janos Follath 6251836753 Add unit tests for X509 certificate date parsing 2017-02-28 12:05:44 +00:00
Jaakko Korhonen 8b57aa20d8 Fixed typo in ssl.h 2017-02-28 11:58:00 +00:00
Simon Butcher 2580b1f5a9 Merge remote-tracking branch 'restricted/porting-readme'
Modifies the main mbed TLS README.md to include some porting information.
The new information simply refers the users to existing knowledge base articles
that contain relevant information
2017-02-27 23:15:43 +00:00
Simon Butcher 97871b2486 Merge branch 'iotssl-1071-ca-flags'
Fixes a regression introduced by an earlier commit that modified
x509_crt_verify_top() to ensure that valid certificates that are after past or
future valid in the chain are processed. However the change introduced a change
in behaviour that caused the verification flags MBEDTLS_X509_BADCERT_EXPIRED and
MBEDTLS_BADCERT_FUTURE to always be set whenever there is a failure in the
verification regardless of the cause.

The fix maintains both behaviours:

 * Ensure that valid certificates after future and past are verified
 * Ensure that the correct verification flags are set.
2017-02-27 19:32:03 +00:00
Simon Butcher dce1016624 Merge branch 'iotssl-1077-dos-crl'
Modifies the function mbedtls_x509_crl_parse() to ensure that a CRL in PEM
format with trailing characters after the footer does not result in the
execution of an infinite loop.
2017-02-26 01:32:43 +00:00
Simon Butcher 229f56ca8a Fix formatting in ChangeLog 2017-02-25 16:58:38 +00:00
Simon Butcher 012f24dee7 Merge fix for PEM test data return codes 2017-02-25 16:36:07 +00:00
Simon Butcher d979759e64 Merge fix for PEM test suite error codes 2017-02-25 16:14:00 +00:00
Simon Butcher 53695beeda Merge branch 'iotssl-1155-hashlen-type'
Introduces additional checks in the PK module for 64-bit systems only. The
problem is that the API functions in the PK abstraction accept a size_t value
for the hashlen, while the RSA module accepts an unsigned int for the hashlen.
Instead of silently casting size_t to unsigned int, this change checks whether
the hashlen overflows an unsigned int and returns an error.
2017-02-25 15:59:18 +00:00
Simon Butcher 9cfdf2caa7 Merge branch 'development-restricted' 2017-02-15 23:55:22 +02:00
Simon Butcher 0621b1fbb0 Add detail to ChangeLog for SLOTH fix 2017-02-15 23:31:07 +02:00
Simon Butcher a29c5e9e66 Add comment to integer overflow fix in base64.c
Adds clarifying comment to the integer overflow fix in base64.c
2017-02-15 23:31:07 +02:00
Andres AG 4623d83c6f Fix integer overflow mbedtls_base64_decode()
Fix potential integer overflows in the function mbedtls_base64_decode().
This overflow would mainly be exploitable in 32-bit systems and could
cause buffer bound checks to be bypassed.
2017-02-15 23:31:07 +02:00
Andres Amaya Garcia 6a54336897 Fix integer overflows in buffer bound checks
Fix potential integer overflows in the following functions:
  * mbedtls_md2_update() to be bypassed and cause
  * mbedtls_cipher_update()
  * mbedtls_ctr_drbg_reseed()
This overflows would mainly be exploitable in 32-bit systems and could
cause buffer bound checks to be bypassed.
2017-02-15 23:31:07 +02:00
Andres AG 49d29337fa Add tests for overreads in pem_read_buffer() 2017-02-15 23:31:07 +02:00
Janos Follath 182013faf4 Prevent SLOTH attacks 2017-02-15 23:29:32 +02:00
Andres AG 0eced5aae5 Fix examples that failed to compile without PEM 2017-02-15 23:28:48 +02:00
Simon Butcher 2537f37faf Add clarification to the TLS renegotiation period
Expanded details on use of mbedtls_ssl_conf_renegotiation_period()
2017-02-15 23:28:48 +02:00
Simon Butcher a333b3c194 Add credit to Changelog for #562 2017-02-15 23:28:48 +02:00
Simon Butcher d57c8f0048 Clarify fix for #673 in Changelog
Clarified fix, and added credit.
2017-02-15 23:27:58 +02:00
Andres AG 13fb6e7271 Add DTLS test to check 6 byte record ctr is cmp
Add a test to ssl-opt.sh to ensure that in DTLS a 6 byte record counter
is compared in ssl_check_ctr_renegotiate() instead of a 8 byte one as in
the TLS case. Because currently there are no testing facilities to check
that renegotiation routines are triggered after X number of input/output
messages, the test consists on setting a renegotiation period that
cannot be represented in 6 bytes, but whose least-significant byte is 2.
If the library behaves correctly, the renegotiation routines will be
executed after two exchanged.
2017-02-15 23:26:35 +02:00
Andres AG 2196c7f81c Fix renegotiation at incorrect times in DTLS
Fix an incorrect condition in ssl_check_ctr_renegotiate() that compared
64 bits of record counter instead of 48 bits as described in RFC 6347
Section 4.3.1. This would cause the function's return value to be
occasionally incorrect and the renegotiation routines to be triggered
at unexpected times.
2017-02-15 23:26:35 +02:00