Mbed TLS 2.16.0
Description
Mbed TLS 2.16.0 introduces a new feature of optional parameter validation. This feature verifies and validates all parameters passed into the library, to confirm they meet the preconditions of each library function. Normally, the library does not check for invalid parameters which are no risk to the security of the library and will cause an obvious error during execution, as it's assumed this kind of issue will be picked up during development, and are unlikely to occur in normal operation. This new feature can speed up development by identifying and indicating any obvious failure in use of the library if the parameter is invalid, and by allowing users to log such errors, in test, development or usage, rather than have to work through stack traces.
Announcing Mbed TLS 2.16 Long Term Support
We are pleased to announce that Mbed TLS 2.16.0 will be the basis of our next Long Term Support branch, and will be maintained for at least 3 years up until the end of 2021.
During that time, no new features will be added to the branch, the API and ABI will be maintained, and only bug fixes will be made to maintenance releases of 2.16.0.
This is further discussed in our blog posting 'Announcing Long Term Support Branch Mbed TLS 2.16'.
Features
- Add a new config.h option of
MBEDTLS_CHECK_PARAMS
that enables validation of parameters in the API. This allows detection of obvious misuses of the API, such as passing NULL pointers. The API of existing functions hasn't changed, but requirements on parameters have been made more explicit in the documentation. See the corresponding API documentation for each function to see for which parameter values it is defined. This feature is disabled by default. See its API documentation inconfig.h
for additional steps you have to take when enabling it.
API Changes
- The following functions in the random generator modules have been deprecated and replaced as shown below. The new functions change the return type from void to int to allow returning error codes when using
MBEDTLS_<MODULE>_ALT
for the underlying AES or message digest primitive. Fixes #1798.
mbedtls_ctr_drbg_update()
->mbedtls_ctr_drbg_update_ret()
mbedtls_hmac_drbg_update()
->mbedtls_hmac_drbg_update_ret()
- Extend ECDH interface to enable alternative implementations.
- Deprecate error codes of the form
MBEDTLS_ERR_xxx_INVALID_KEY_LENGTH
for ARIA, CAMELLIA and Blowfish. These error codes will be replaced by the more generic per-module error codesMBEDTLS_ERR_xxx_BAD_INPUT_DATA
. - Additional parameter validation checks have been added for the following modules - AES, ARIA, Blowfish, CAMELLIA, CCM, GCM, DHM, ECP, ECDSA, ECDH, ECJPAKE, SHA, Chacha20 and Poly1305, cipher, pk, RSA, and MPI. Where modules have had parameter validation added, existing parameter checks may have changed. Some modules, such as Chacha20 had existing parameter validation whereas other modules had little. This has now been changed so that the same level of validation is present in all modules, and that it is now optional with the
MBEDTLS_CHECK_PARAMS
flag which by default is off. That means that checks which were previously present by default will no longer be.
New deprecations
- Deprecate
mbedtls_ctr_drbg_update()
andmbedtls_hmac_drbg_update()
in favor of functions that can return an error code.
Bugfix
- Fix for Clang, which was reporting a warning for the bignum.c inline assembly for AMD64 targets creating string literals greater than those permitted by the ISO C99 standard. Found by Aaron Jones. Fixes #482.
- Fix runtime error in
mbedtls_platform_entropy_poll()
when run through qemu user emulation. Reported and fix suggested by randombit. Fixes #1212. - Fix an unsafe bounds check when restoring an SSL session from a ticket. This could lead to a buffer overflow, but only in case ticket authentication was broken. Reported and fix suggested by Guido Vranken in #659.
- Add explicit integer to enumeration type casts to example program
programs/pkey/gen_key
which previously led to compilation failure on some toolchains. Reported by phoenixmcallister. Fixes #2170. - Clarify documentation of
mbedtls_ssl_set_own_cert()
regarding the absence of check for certificate/key matching. Reported by Attila Molnar, #507. - Fix double initialization of ECC hardware that made some accelerators hang.
Who should update
We recommend all affected users should update to take advantage of the bug fixes contained in this release at an appropriate point in their development lifecycle.