Skip to content

Update to a development version of Mbed TLS 2.16.0 #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 106 commits into from
Feb 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
b0ef434
Add doxygen.sh script to git hooks
Apr 1, 2018
65e619a
Improve documentation of mbedtls_x509_crt_parse()
Aug 23, 2018
89a9112
Improve wording
Aug 23, 2018
e8658e2
Improve documentation of mbedtls_x509_crt_parse()
Aug 24, 2018
a86de14
Strip trailing whitespace in bn_mul.h
redtangent Sep 30, 2018
df0500d
Add Changelog entry for #482
redtangent Sep 30, 2018
5908dd4
Minor readability improvement
gilles-peskine-arm Oct 2, 2018
e2a10de
Fix a timing-based Bleichenbacher attack on PKCS#1v1.5 decryption
gilles-peskine-arm Oct 2, 2018
ddffa06
Add ChangeLog entry
gilles-peskine-arm Oct 3, 2018
331d80e
Evolve choose_int_from_mask to if_int
gilles-peskine-arm Oct 4, 2018
9265ff4
Bleichenbacher fix: don't leak the plaintext length (step 1)
gilles-peskine-arm Oct 4, 2018
a1af5c8
Bleichenbacher fix: don't leak the plaintext length (step 2)
gilles-peskine-arm Oct 4, 2018
8c9440a
Use branch-free size comparison for the padding size
gilles-peskine-arm Oct 4, 2018
eeedabe
Minor optimization in the PKCS#1v1.5 unpadding step
gilles-peskine-arm Oct 4, 2018
85a7442
mbedtls_rsa_rsaes_pkcs1_v15_decrypt: remove the variable p
gilles-peskine-arm Oct 5, 2018
40b57f4
Remove a remaining sensitive memory access in PKCS#1 v1.5 decryption
gilles-peskine-arm Oct 5, 2018
c5ccd7a
Indicate the memory access variations in the changelog entry
gilles-peskine-arm Oct 5, 2018
ec2a5fd
PKCS#1 v1.5 decoding: fix empty payload case
gilles-peskine-arm Oct 5, 2018
695a346
Add tests for PKCS#1 v1.5 decoding
gilles-peskine-arm Oct 5, 2018
9b43070
Fix likely-harmless undefined behavior surrounding volatile
gilles-peskine-arm Oct 12, 2018
4899247
Fix undefined behavior in unsigned-to-signed conversion
gilles-peskine-arm Oct 12, 2018
cb9debd
Guard PK-parse module by ASN.1-parse module in check_config.h
Oct 12, 2018
8a89f9f
Make PBE-related parts of PKCS12 depend on MBEDTLS_ASN1_PARSE_C
Oct 12, 2018
1ea604d
Guard mbedtls_pkcs5_pbes2() by MBEDTLS_ASN1_PARSE_C
Oct 12, 2018
44da18a
Duplicate mbedtls_asn1_find_named_data in asn1write.c to avoid dep.
Oct 12, 2018
b14c331
Add dependency of key_app_writer example program on PK parse module
Oct 16, 2018
19d858e
Add dependency of pkwrite test suite on pkparse module
Oct 16, 2018
0fbbc64
Add dependency of mbedtls_asn1_write_len() test on ASN.1 parsing
Oct 16, 2018
2751697
Entropy: Fall through to /dev/random if getrandom() syscall unknown
Oct 18, 2018
5e0924c
Adapt ChangeLog
Oct 18, 2018
f343de1
typo fix
bmurray7 Oct 22, 2018
9543373
Use brackets around shift operations
Oct 24, 2018
137015c
Fix unsafe bounds checks in ssl_load_session()
Oct 24, 2018
6934e9b
Indentation fix
Oct 24, 2018
a7d2fa7
Adapt ChangeLog
Oct 24, 2018
c388a8c
Fix typo in a test condition code
Oct 31, 2018
79e4f4e
test: Print verbosely on failures in verbose mode
Patater Oct 5, 2018
f4b521d
test: Use GetOpt::Long for argument parsing
Patater Oct 5, 2018
8396a71
test: Enable multiple levels of verbosity
Patater Oct 5, 2018
c242eea
Change data file suffix for ott
Nov 5, 2018
e2dae7e
Add explicit integer to enumeration casts to programs/pkey/gen_key.c
Nov 5, 2018
9772da8
Add missing bracket
Nov 5, 2018
fe936c3
Adapt ChangeLog
Nov 5, 2018
f6d6e30
Fix incomplete assertion in ssl_write_handshake_msg()
Nov 7, 2018
7a97788
Change buf size to a valid size
Nov 19, 2018
11cdb05
mbedtls_mpi_write_binary: don't leak the exact size of the number
gilles-peskine-arm Nov 20, 2018
3459c74
Create a block list for Travis CI, and fix the Coverity email
simonbutcher Nov 22, 2018
80a23a5
check-files: Don't check same-named files
Patater Nov 23, 2018
0439805
Factor record_issue into its own method
gilles-peskine-arm Nov 23, 2018
c117d59
check-files: detect merge artifacts
gilles-peskine-arm Nov 23, 2018
d9aa84d
CTR_DRBG: clean stack buffers
gilles-peskine-arm Sep 11, 2018
afa8037
HMAC_DRBG: clean stack buffers
gilles-peskine-arm Sep 11, 2018
1b09f40
Add ChangeLog entry for wiping sensitive buffers
gilles-peskine-arm Sep 11, 2018
d919993
CTR_DRBG: deprecate mbedtls_ctr_drbg_update because it ignores errors
gilles-peskine-arm Sep 11, 2018
e0e9c57
HMAC_DRBG: deprecate mbedtls_hmac_drbg_update because it ignores errors
gilles-peskine-arm Sep 11, 2018
b7f71c8
HMAC_DRBG: report all errors from HMAC functions
gilles-peskine-arm Sep 11, 2018
8220466
Streamline mbedtls_xxx_drbg_update_seed_file
gilles-peskine-arm Sep 11, 2018
5da0505
Add ChangeLog entry for deprecation of mbedtls_xxx_drbg_update
gilles-peskine-arm Sep 11, 2018
c4a8017
mbedtls_ctr_drbg_update_ret: correct doc for input length limit
gilles-peskine-arm Sep 12, 2018
056f19c
Tweak RSA vulnerability changelog entry
gilles-peskine-arm Nov 29, 2018
50da016
Add changelog entry for mbedtls_mpi_write_binary fix
gilles-peskine-arm Nov 29, 2018
658618b
Merge remote-tracking branch 'restricted/pr/516' into development
simonbutcher Nov 29, 2018
b9eb786
Merge remote-tracking branch 'restricted/pr/535' into development
simonbutcher Nov 29, 2018
51b8a2f
Merge remote-tracking branch 'restricted/pr/512' into development
simonbutcher Nov 29, 2018
89ac8c9
ECP: Add mbedtls_ecp_tls_read_group_id()
yanesca Oct 30, 2018
f61e486
ECDH: Add mbedtls_ecdh_setup()
yanesca Oct 30, 2018
fc03e8d
ECDH: Adapt tests for mbedtls_ecdh_setup()
yanesca Oct 4, 2018
c9c32f3
ECDH: Add flexible context and legacy flag
yanesca Aug 13, 2018
52735ef
ECDH: Prevent direct access in non-legacy mode
yanesca Aug 15, 2018
fabc600
Clarify attribution for the Bleichenbacher's Cat fix
simonbutcher Dec 1, 2018
5a3e1bf
ECDH: Make the implementation use the new context
yanesca Aug 13, 2018
948f4be
Debug: Add functions for ECDH contexts
yanesca Aug 22, 2018
3fbdada
SSL: Make use of the new ECDH interface
yanesca Aug 15, 2018
36c5f7f
ECDH: Hide context from tests
yanesca Oct 30, 2018
b8f2706
Add Changelog entry for the new ECDH context
yanesca Aug 16, 2018
c3b680b
Clarify requirements on handling ECP group IDs
yanesca Dec 5, 2018
643e002
Merge remote-tracking branch 'upstream-public/pr/1548' into development
Patater Dec 6, 2018
41722ec
Merge remote-tracking branch 'upstream-public/pr/1958' into development
Patater Dec 6, 2018
833c053
Merge remote-tracking branch 'upstream-public/pr/1982' into development
Patater Dec 6, 2018
083681c
Merge remote-tracking branch 'upstream-public/pr/2039' into development
Patater Dec 6, 2018
c27e342
Merge remote-tracking branch 'upstream-public/pr/2117' into development
Patater Dec 6, 2018
a04617e
Merge remote-tracking branch 'upstream-public/pr/2125' into development
Patater Dec 6, 2018
bc1cf5c
Merge remote-tracking branch 'upstream-public/pr/2131' into development
Patater Dec 6, 2018
5b46fe7
Merge remote-tracking branch 'upstream-public/pr/2157' into development
Patater Dec 6, 2018
3c0941e
Merge remote-tracking branch 'upstream-public/pr/2172' into development
Patater Dec 6, 2018
9055a7d
Merge remote-tracking branch 'upstream-public/pr/2175' into development
Patater Dec 6, 2018
e1b1a2c
Merge remote-tracking branch 'upstream-public/pr/2181' into development
Patater Dec 6, 2018
28efba0
Merge remote-tracking branch 'upstream-public/pr/2218' into development
Patater Dec 6, 2018
8ef1f48
Merge remote-tracking branch 'upstream-public/pr/2219' into development
Patater Dec 6, 2018
af6f269
Fix ECC hardware double initialization
yanesca Dec 7, 2018
855def1
Add changelog entry for ECC hardware bugfix
yanesca Dec 7, 2018
d2af46f
Fix typo in ECP alternative documentation
yanesca Dec 7, 2018
60ca6e5
test: Make basic-build-test.sh see summary statuses
Patater Dec 7, 2018
683c582
Clarify alternative ECP calling conventions
yanesca Dec 7, 2018
172ba63
Add guard for MBEDTLS_ECP_INTERNAL_ALT
yanesca Dec 7, 2018
d07ef47
Merge remote-tracking branch 'upstream-public/pr/2061' into development
Patater Dec 7, 2018
52ed0b9
Merge remote-tracking branch 'upstream-public/pr/2101' into development
Patater Dec 7, 2018
fedb407
Merge remote-tracking branch 'upstream-public/pr/2208' into development
Patater Dec 7, 2018
faafcd8
Merge remote-tracking branch 'upstream-public/pr/2223' into development
Patater Dec 7, 2018
01b34fb
Merge remote-tracking branch 'upstream-public/pr/2267' into development
Patater Dec 7, 2018
6893364
Merge commit '01b34fb316a5' into development
Patater Feb 5, 2019
4728469
rsa: Re-enable use of zero-length null output
Patater Feb 6, 2019
412654a
psa: Expect output-buffer-sized RSA-decryption
Patater Feb 6, 2019
f8daab7
psa: Enable testing RSA decryption with output sizes
Patater Feb 6, 2019
c979f6a
psa: Test empty PKCS#1 v1.5 decryption
Patater Feb 6, 2019
7f04214
psa: Rename PSA_HASH_FINAL_SIZE to PSA_HASH_SIZE
Patater Feb 7, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ compiler:
- gcc
sudo: false
cache: ccache

# blocklist
branches:
except:
- development-psa
- coverity_scan

script:
- tests/scripts/recursion.pl library/*.c
- tests/scripts/check-generated-files.sh
Expand Down Expand Up @@ -34,7 +41,7 @@ addons:
coverity_scan:
project:
name: "ARMmbed/mbedtls"
notification_email: [email protected]
notification_email: [email protected]
build_command_prepend:
build_command: make
branch_pattern: coverity_scan
52 changes: 52 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,58 @@ Changes
* Add unit tests for AES-GCM when called through mbedtls_cipher_auth_xxx()
from the cipher abstraction layer. Fixes #2198.

= mbed TLS 2.14.0+01b34fb316a5 branch released xxxx-xx-xx

Security
* Fix timing variations and memory access variations in RSA PKCS#1 v1.5
decryption that could lead to a Bleichenbacher-style padding oracle
attack. In TLS, this affects servers that accept ciphersuites based on
RSA decryption (i.e. ciphersuites whose name contains RSA but not
(EC)DH(E)). Discovered by Eyal Ronen (Weizmann Institute), Robert Gillham
(University of Adelaide), Daniel Genkin (University of Michigan),
Adi Shamir (Weizmann Institute), David Wong (NCC Group), and Yuval Yarom
(University of Adelaide, Data61). The attack is described in more detail
in the paper available here: http://cat.eyalro.net/cat.pdf CVE-2018-19608
* In mbedtls_mpi_write_binary(), don't leak the exact size of the number
via branching and memory access patterns. An attacker who could submit
a plaintext for RSA PKCS#1 v1.5 decryption but only observe the timing
of the decryption and not its result could nonetheless decrypt RSA
plaintexts and forge RSA signatures. Other asymmetric algorithms may
have been similarly vulnerable. Reported by Eyal Ronen, Robert Gillham,
Daniel Genkin, Adi Shamir, David Wong and Yuval Yarom.
* Wipe sensitive buffers on the stack in the CTR_DRBG and HMAC_DRBG
modules.

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.

New deprecations
* Deprecate mbedtls_ctr_drbg_update and mbedtls_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
in #1212. 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.
* Fix double initialization of ECC hardware that made some accelerators
hang.

= mbed TLS 2.14.0 branch released 2018-11-19

Security
Expand Down
22 changes: 11 additions & 11 deletions include/mbedtls/bn_mul.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,19 +170,19 @@

#define MULADDC_INIT \
asm( \
"xorq %%r8, %%r8 \n\t"
"xorq %%r8, %%r8\n"

#define MULADDC_CORE \
"movq (%%rsi), %%rax \n\t" \
"mulq %%rbx \n\t" \
"addq $8, %%rsi \n\t" \
"addq %%rcx, %%rax \n\t" \
"movq %%r8, %%rcx \n\t" \
"adcq $0, %%rdx \n\t" \
"nop \n\t" \
"addq %%rax, (%%rdi) \n\t" \
"adcq %%rdx, %%rcx \n\t" \
"addq $8, %%rdi \n\t"
"movq (%%rsi), %%rax\n" \
"mulq %%rbx\n" \
"addq $8, %%rsi\n" \
"addq %%rcx, %%rax\n" \
"movq %%r8, %%rcx\n" \
"adcq $0, %%rdx\n" \
"nop \n" \
"addq %%rax, (%%rdi)\n" \
"adcq %%rdx, %%rcx\n" \
"addq $8, %%rdi\n"

#define MULADDC_STOP \
: "+c" (c), "+D" (d), "+S" (s) \
Expand Down
5 changes: 5 additions & 0 deletions include/mbedtls/check_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
defined(MBEDTLS_ECDSA_SIGN_ALT) || \
defined(MBEDTLS_ECDSA_VERIFY_ALT) || \
defined(MBEDTLS_ECDSA_GENKEY_ALT) || \
defined(MBEDTLS_ECP_INTERNAL_ALT) || \
defined(MBEDTLS_ECP_ALT) )
#error "MBEDTLS_ECP_RESTARTABLE defined, but it cannot coexist with an alternative ECP implementation"
#endif
Expand All @@ -137,6 +138,10 @@
#error "MBEDTLS_ECP_C defined, but not all prerequisites"
#endif

#if defined(MBEDTLS_PK_PARSE_C) && !defined(MBEDTLS_ASN1_PARSE_C)
#error "MBEDTLS_PK_PARSE_C defined, but not all prerequesites"
#endif

#if defined(MBEDTLS_ENTROPY_C) && (!defined(MBEDTLS_SHA512_C) && \
!defined(MBEDTLS_SHA256_C))
#error "MBEDTLS_ENTROPY_C defined, but not all prerequisites"
Expand Down
4 changes: 2 additions & 2 deletions include/mbedtls/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -414,11 +414,11 @@
* unsigned char mbedtls_internal_ecp_grp_capable(
* const mbedtls_ecp_group *grp )
* int mbedtls_internal_ecp_init( const mbedtls_ecp_group *grp )
* void mbedtls_internal_ecp_deinit( const mbedtls_ecp_group *grp )
* void mbedtls_internal_ecp_free( const mbedtls_ecp_group *grp )
* The mbedtls_internal_ecp_grp_capable function should return 1 if the
* replacement functions implement arithmetic for the given group and 0
* otherwise.
* The functions mbedtls_internal_ecp_init and mbedtls_internal_ecp_deinit are
* The functions mbedtls_internal_ecp_init and mbedtls_internal_ecp_free are
* called before and after each point operation and provide an opportunity to
* implement optimized set up and tear down instructions.
*
Expand Down
49 changes: 40 additions & 9 deletions include/mbedtls/ctr_drbg.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,18 +239,20 @@ int mbedtls_ctr_drbg_reseed( mbedtls_ctr_drbg_context *ctx,
/**
* \brief This function updates the state of the CTR_DRBG context.
*
* \note If \p add_len is greater than
* #MBEDTLS_CTR_DRBG_MAX_SEED_INPUT, only the first
* #MBEDTLS_CTR_DRBG_MAX_SEED_INPUT Bytes are used.
* The remaining Bytes are silently discarded.
*
* \param ctx The CTR_DRBG context.
* \param additional The data to update the state with.
* \param add_len Length of \p additional data.
*
* \param add_len Length of \p additional in bytes. This must be at
* most #MBEDTLS_CTR_DRBG_MAX_SEED_INPUT.
*
* \return \c 0 on success.
* \return #MBEDTLS_ERR_CTR_DRBG_INPUT_TOO_BIG if
* \p add_len is more than
* #MBEDTLS_CTR_DRBG_MAX_SEED_INPUT.
* \return An error from the underlying AES cipher on failure.
*/
void mbedtls_ctr_drbg_update( mbedtls_ctr_drbg_context *ctx,
const unsigned char *additional, size_t add_len );
int mbedtls_ctr_drbg_update_ret( mbedtls_ctr_drbg_context *ctx,
const unsigned char *additional,
size_t add_len );

/**
* \brief This function updates a CTR_DRBG instance with additional
Expand Down Expand Up @@ -290,6 +292,35 @@ int mbedtls_ctr_drbg_random_with_add( void *p_rng,
int mbedtls_ctr_drbg_random( void *p_rng,
unsigned char *output, size_t output_len );


#if ! defined(MBEDTLS_DEPRECATED_REMOVED)
#if defined(MBEDTLS_DEPRECATED_WARNING)
#define MBEDTLS_DEPRECATED __attribute__((deprecated))
#else
#define MBEDTLS_DEPRECATED
#endif
/**
* \brief This function updates the state of the CTR_DRBG context.
*
* \deprecated Superseded by mbedtls_ctr_drbg_update_ret()
* in 2.16.0.
*
* \note If \p add_len is greater than
* #MBEDTLS_CTR_DRBG_MAX_SEED_INPUT, only the first
* #MBEDTLS_CTR_DRBG_MAX_SEED_INPUT Bytes are used.
* The remaining Bytes are silently discarded.
*
* \param ctx The CTR_DRBG context.
* \param additional The data to update the state with.
* \param add_len Length of \p additional data.
*/
MBEDTLS_DEPRECATED void mbedtls_ctr_drbg_update(
mbedtls_ctr_drbg_context *ctx,
const unsigned char *additional,
size_t add_len );
#undef MBEDTLS_DEPRECATED
#endif /* !MBEDTLS_DEPRECATED_REMOVED */

#if defined(MBEDTLS_FS_IO)
/**
* \brief This function writes a seed file.
Expand Down
36 changes: 36 additions & 0 deletions include/mbedtls/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@
mbedtls_debug_print_crt( ssl, level, __FILE__, __LINE__, text, crt )
#endif

#if defined(MBEDTLS_ECDH_C)
#define MBEDTLS_SSL_DEBUG_ECDH( level, ecdh, attr ) \
mbedtls_debug_printf_ecdh( ssl, level, __FILE__, __LINE__, ecdh, attr )
#endif

#else /* MBEDTLS_DEBUG_C */

#define MBEDTLS_SSL_DEBUG_MSG( level, args ) do { } while( 0 )
Expand All @@ -73,6 +78,7 @@
#define MBEDTLS_SSL_DEBUG_MPI( level, text, X ) do { } while( 0 )
#define MBEDTLS_SSL_DEBUG_ECP( level, text, X ) do { } while( 0 )
#define MBEDTLS_SSL_DEBUG_CRT( level, text, crt ) do { } while( 0 )
#define MBEDTLS_SSL_DEBUG_ECDH( level, ecdh, attr ) do { } while( 0 )

#endif /* MBEDTLS_DEBUG_C */

Expand Down Expand Up @@ -221,6 +227,36 @@ void mbedtls_debug_print_crt( const mbedtls_ssl_context *ssl, int level,
const char *text, const mbedtls_x509_crt *crt );
#endif

#if defined(MBEDTLS_ECDH_C)
typedef enum
{
MBEDTLS_DEBUG_ECDH_Q,
MBEDTLS_DEBUG_ECDH_QP,
MBEDTLS_DEBUG_ECDH_Z,
} mbedtls_debug_ecdh_attr;

/**
* \brief Print a field of the ECDH structure in the SSL context to the debug
* output. This function is always used through the
* MBEDTLS_SSL_DEBUG_ECDH() macro, which supplies the ssl context, file
* and line number parameters.
*
* \param ssl SSL context
* \param level error level of the debug message
* \param file file the error has occurred in
* \param line line number the error has occurred in
* \param ecdh the ECDH context
* \param attr the identifier of the attribute being output
*
* \attention This function is intended for INTERNAL usage within the
* library only.
*/
void mbedtls_debug_printf_ecdh( const mbedtls_ssl_context *ssl, int level,
const char *file, int line,
const mbedtls_ecdh_context *ecdh,
mbedtls_debug_ecdh_attr attr );
#endif

#ifdef __cplusplus
}
#endif
Expand Down
Loading