Skip to content

Commit

Permalink
crypto: mbedtls: Update mbedTLS to 2.7.0
Browse files Browse the repository at this point in the history
Due to a security advisory released on February 1st 2018[1], it's
advisable to update mbedTLS to 2.7.0.

The vulnerability, identified as CVE-2018-0488 and CVE-2018-0487, risk
remote code execution when truncated HMAC is enabled or when verifying
RSASSA-PSS signatures.

[1] https://tls.mbed.org/tech-updates/security-advisories/mbedtls-security-advisory-2018-01

Fixes: zephyrproject-rtos#6025

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
  • Loading branch information
galak committed Feb 7, 2018
1 parent 30824c9 commit 7888ad5
Show file tree
Hide file tree
Showing 115 changed files with 9,034 additions and 3,403 deletions.
1 change: 1 addition & 0 deletions ext/lib/crypto/mbedtls/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ if(CONFIG_MBEDTLS_BUILTIN)
zephyr_library_sources(library/platform.c)
zephyr_library_sources(library/ripemd160.c)
zephyr_library_sources(library/rsa.c)
zephyr_library_sources(library/rsa_internal.c)
zephyr_library_sources(library/sha1.c)
zephyr_library_sources(library/sha256.c)
zephyr_library_sources(library/sha512.c)
Expand Down
4 changes: 2 additions & 2 deletions ext/lib/crypto/mbedtls/README
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
The mbed TLS library in Zephyr is a downstream of an externally maintained
open source project. The original upstream code can be found at:

https://tls.mbed.org/download/start/mbedtls-2.6.0-apache.tgz
https://tls.mbed.org/download/start/mbedtls-2.7.0-apache.tgz

At version 2.6.0
At version 2.7.0

The following is the license information for this code:

Expand Down
366 changes: 220 additions & 146 deletions ext/lib/crypto/mbedtls/include/mbedtls/aes.h

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion ext/lib/crypto/mbedtls/include/mbedtls/aesni.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
* \file aesni.h
*
* \brief AES-NI for hardware AES acceleration on some Intel processors
*
*/
/*
* Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
Expand Down
38 changes: 37 additions & 1 deletion ext/lib/crypto/mbedtls/include/mbedtls/arc4.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
*
* \brief The ARCFOUR stream cipher
*
* \warning ARC4 is considered a weak cipher and its use constitutes a
* security risk. We recommend considering stronger ciphers instead.
*/
/*
* Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
Expand All @@ -19,6 +23,7 @@
* limitations under the License.
*
* This file is part of mbed TLS (https://tls.mbed.org)
*
*/
#ifndef MBEDTLS_ARC4_H
#define MBEDTLS_ARC4_H
Expand All @@ -31,6 +36,8 @@

#include <stddef.h>

#define MBEDTLS_ERR_ARC4_HW_ACCEL_FAILED -0x0019 /**< ARC4 hardware accelerator failed. */

#if !defined(MBEDTLS_ARC4_ALT)
// Regular implementation
//
Expand All @@ -40,7 +47,11 @@ extern "C" {
#endif

/**
* \brief ARC4 context structure
* \brief ARC4 context structure
*
* \warning ARC4 is considered a weak cipher and its use constitutes a
* security risk. We recommend considering stronger ciphers instead.
*
*/
typedef struct
{
Expand All @@ -54,13 +65,23 @@ mbedtls_arc4_context;
* \brief Initialize ARC4 context
*
* \param ctx ARC4 context to be initialized
*
* \warning ARC4 is considered a weak cipher and its use constitutes a
* security risk. We recommend considering stronger ciphers
* instead.
*
*/
void mbedtls_arc4_init( mbedtls_arc4_context *ctx );

/**
* \brief Clear ARC4 context
*
* \param ctx ARC4 context to be cleared
*
* \warning ARC4 is considered a weak cipher and its use constitutes a
* security risk. We recommend considering stronger ciphers
* instead.
*
*/
void mbedtls_arc4_free( mbedtls_arc4_context *ctx );

Expand All @@ -70,6 +91,11 @@ void mbedtls_arc4_free( mbedtls_arc4_context *ctx );
* \param ctx ARC4 context to be setup
* \param key the secret key
* \param keylen length of the key, in bytes
*
* \warning ARC4 is considered a weak cipher and its use constitutes a
* security risk. We recommend considering stronger ciphers
* instead.
*
*/
void mbedtls_arc4_setup( mbedtls_arc4_context *ctx, const unsigned char *key,
unsigned int keylen );
Expand All @@ -83,6 +109,11 @@ void mbedtls_arc4_setup( mbedtls_arc4_context *ctx, const unsigned char *key,
* \param output buffer for the output data
*
* \return 0 if successful
*
* \warning ARC4 is considered a weak cipher and its use constitutes a
* security risk. We recommend considering stronger ciphers
* instead.
*
*/
int mbedtls_arc4_crypt( mbedtls_arc4_context *ctx, size_t length, const unsigned char *input,
unsigned char *output );
Expand All @@ -103,6 +134,11 @@ extern "C" {
* \brief Checkup routine
*
* \return 0 if successful, or 1 if the test failed
*
* \warning ARC4 is considered a weak cipher and its use constitutes a
* security risk. We recommend considering stronger ciphers
* instead.
*
*/
int mbedtls_arc4_self_test( int verbose );

Expand Down
5 changes: 3 additions & 2 deletions ext/lib/crypto/mbedtls/include/mbedtls/asn1.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
* \file asn1.h
*
* \brief Generic ASN.1 parsing
*
*/
/*
* Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
Expand Down Expand Up @@ -59,7 +60,7 @@

/**
* \name DER constants
* These constants comply with DER encoded the ANS1 type tags.
* These constants comply with the DER encoded ASN.1 type tags.
* DER encoding uses hexadecimal representation.
* An example DER sequence is:\n
* - 0x02 -- tag indicating INTEGER
Expand Down
3 changes: 2 additions & 1 deletion ext/lib/crypto/mbedtls/include/mbedtls/asn1write.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
* \file asn1write.h
*
* \brief ASN.1 buffer writing functionality
*
*/
/*
* Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
Expand Down
3 changes: 2 additions & 1 deletion ext/lib/crypto/mbedtls/include/mbedtls/base64.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
* \file base64.h
*
* \brief RFC 1521 base64 encoding/decoding
*
*/
/*
* Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
Expand Down
11 changes: 8 additions & 3 deletions ext/lib/crypto/mbedtls/include/mbedtls/bignum.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/**
* \file bignum.h
*
* \brief Multi-precision integer library
*
* \brief Multi-precision integer library
*/
/*
* Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
Expand Down Expand Up @@ -70,7 +71,7 @@
* Maximum size of MPIs allowed in bits and bytes for user-MPIs.
* ( Default: 512 bytes => 4096 bits, Maximum tested: 2048 bytes => 16384 bits )
*
* Note: Calculations can results temporarily in larger MPIs. So the number
* Note: Calculations can temporarily result in larger MPIs. So the number
* of limbs required (MBEDTLS_MPI_MAX_LIMBS) is higher.
*/
#define MBEDTLS_MPI_MAX_SIZE 1024 /**< Maximum number of bytes for usable MPIs. */
Expand Down Expand Up @@ -683,6 +684,10 @@ int mbedtls_mpi_exp_mod( mbedtls_mpi *X, const mbedtls_mpi *A, const mbedtls_mpi
*
* \return 0 if successful,
* MBEDTLS_ERR_MPI_ALLOC_FAILED if memory allocation failed
*
* \note The bytes obtained from the PRNG are interpreted
* as a big-endian representation of an MPI; this can
* be relevant in applications like deterministic ECDSA.
*/
int mbedtls_mpi_fill_random( mbedtls_mpi *X, size_t size,
int (*f_rng)(void *, unsigned char *, size_t),
Expand Down
4 changes: 3 additions & 1 deletion ext/lib/crypto/mbedtls/include/mbedtls/blowfish.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
* \file blowfish.h
*
* \brief Blowfish block cipher
*
*/
/*
* Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
Expand Down Expand Up @@ -40,6 +41,7 @@
#define MBEDTLS_BLOWFISH_BLOCKSIZE 8 /* Blowfish uses 64 bit blocks */

#define MBEDTLS_ERR_BLOWFISH_INVALID_KEY_LENGTH -0x0016 /**< Invalid key length. */
#define MBEDTLS_ERR_BLOWFISH_HW_ACCEL_FAILED -0x0017 /**< Blowfish hardware accelerator failed. */
#define MBEDTLS_ERR_BLOWFISH_INVALID_INPUT_LENGTH -0x0018 /**< Invalid data input length. */

#if !defined(MBEDTLS_BLOWFISH_ALT)
Expand Down
5 changes: 3 additions & 2 deletions ext/lib/crypto/mbedtls/include/mbedtls/bn_mul.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/**
* \file bn_mul.h
*
* \brief Multi-precision integer library
*
* \brief Multi-precision integer library
*/
/*
* Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
Expand Down
4 changes: 3 additions & 1 deletion ext/lib/crypto/mbedtls/include/mbedtls/camellia.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
* \file camellia.h
*
* \brief Camellia block cipher
*
*/
/*
* Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
Expand Down Expand Up @@ -37,6 +38,7 @@

#define MBEDTLS_ERR_CAMELLIA_INVALID_KEY_LENGTH -0x0024 /**< Invalid key length. */
#define MBEDTLS_ERR_CAMELLIA_INVALID_INPUT_LENGTH -0x0026 /**< Invalid data input length. */
#define MBEDTLS_ERR_CAMELLIA_HW_ACCEL_FAILED -0x0027 /**< Camellia hardware accelerator failed. */

#if !defined(MBEDTLS_CAMELLIA_ALT)
// Regular implementation
Expand Down
Loading

0 comments on commit 7888ad5

Please sign in to comment.