Merge mbed-crypto into mbedtls: the merge commit
Merge `unremove-non-crypto` into `mbedtls/development`. The branch `unremove-non-crypto` was obtained by starting from `mbed-crypto/development`, then reverting many commits that removed X.509 and TLS functionality when Mbed Crypto forked from Mbed TLS (the “unremoval”), then make a few tweaks to facilitate the merge. The unremoval step restored old versions of some tls files. If a file doesn't exist in mbed-crypto, check out the mbedtls version, regardless of what happened during the unremoval of tls files in the crypto tree. Also unconditionally take the mbedtls version of a few files where the modifications are completely project-specific and are not relevant in mbed-crypto: * `.github/issue_template.md`: completely different. We may want to reconcile them independently as a follow-up. * `.travis.yml`: would only be reverted to an earlier tls version. * `README.md`: completely different. We may want to reconcile them independently as a follow-up. * `doxygen/input/doc_mainpage.h`: the changes in crypto were minimal and not relevant except as a stopgap as mbed-crypto did not have its own product versioning in the Doxygen documentation. * `tests/.jenkins/Jenkinsfile`: completely different. * `tests/data_files/Makefile`: there were no changes in mbed-crypto, but the unremoval step restored an old version. Shell script for everything to do after the merge apart from the conflict resolution: ``` tls_files=($(comm -23 <(git ls-tree -r --name-only HEAD) <(git ls-tree -r --name-only $(git merge-base upstream-crypto/development MERGE_HEAD)))) tls_files+=($tls_files .github/issue_template.md .travis.yml README.md doxygen/input/doc_mainpage.h tests/.jenkins/Jenkinsfile tests/data_files/Makefile) git checkout --theirs HEAD -- $tls_files git add -- $tls_files ``` Resolve the remaining conflicts: * `library/CMakeLists.txt`: * Keep the TLS definition of `src_crypto` * `USE_SHARED_MBEDTLS_LIBRARY`: keep all three libraries, with both `include` and `crypto/include` in `target_include_directories`, all with version `2.21.0`. * `programs/Makefile`: * Reconcile the APPS lists (add/add from a differently-formatted common ancestor): insert the `psa/*` from crypto into the tls list. * Keep the `fuzz` target defined only in tls version. * Keep the recipe (only in tls version) cleaning `ssl_pthread_server` stuff for the `clean` target. * `scripts/config.py`: * `include_in_full`: add/add conflict. Keep both. * `tests/scripts/all.sh`: * `component_test_no_use_psa_crypto_full_cmake_asan`: partially old version in crypto. Take the tls version. * `component_test_malloc_0_null` and more: take `component_test_malloc_0_null` from crypto (with `config.py` rather than `config.pl`, and with `$ASAN_FLAGS` rather than an explicit list), but add the call to `ssl-opt.sh` from tls. Take the other components from crypto. With this commit, building and running the unit tests with both `make ` and `cmake` work in the default configuration on Linux. Other platforms, build systems and configurations are likely not to work, and there is some regression in test coverage. There is some loss of functionality because the unremoval step restored older versions of tls content. This commit contains the latest tls version of tls-only files, but some changes from the tls side in files that existed on both sides have regressed. Most problematic changes are hunks that remove some tls-specific feature and contain either a C preprocessor symbol identifying a tls-specific module or option, or the name of a tls-specific file. Hunks that remove a tls-specific preprocessor symbol can be identified with the regular expression `^-.*MBEDTLS_(ERR_)?(PKCS11|X509|NET|SSL)_`. Subsequent commits will revert a few parts of the patch from this merge commit in order to restore the tls functionality that it removes, ensure that the test coverage includes what was covered in either branch, and fix test failures.
This commit is contained in:
commit
b99bd39b4e
397 changed files with 168444 additions and 995 deletions
|
@ -441,6 +441,16 @@
|
|||
* dependencies on them, and considering stronger message digests
|
||||
* and ciphers instead.
|
||||
*
|
||||
* \warning If both MBEDTLS_ECDSA_SIGN_ALT and MBEDTLS_ECDSA_DETERMINISTIC are
|
||||
* enabled, then the deterministic ECDH signature functions pass the
|
||||
* the static HMAC-DRBG as RNG to mbedtls_ecdsa_sign(). Therefore
|
||||
* alternative implementations should use the RNG only for generating
|
||||
* the ephemeral key and nothing else. If this is not possible, then
|
||||
* MBEDTLS_ECDSA_DETERMINISTIC should be disabled and an alternative
|
||||
* implementation should be provided for mbedtls_ecdsa_sign_det_ext()
|
||||
* (and for mbedtls_ecdsa_sign_det() too if backward compatibility is
|
||||
* desirable).
|
||||
*
|
||||
*/
|
||||
//#define MBEDTLS_MD2_PROCESS_ALT
|
||||
//#define MBEDTLS_MD4_PROCESS_ALT
|
||||
|
@ -680,6 +690,13 @@
|
|||
#define MBEDTLS_CIPHER_PADDING_ZEROS_AND_LEN
|
||||
#define MBEDTLS_CIPHER_PADDING_ZEROS
|
||||
|
||||
/** \def MBEDTLS_CTR_DRBG_USE_128_BIT_KEY
|
||||
*
|
||||
* Uncomment this macro to use a 128-bit key in the CTR_DRBG module.
|
||||
* By default, CTR_DRBG uses a 256-bit key.
|
||||
*/
|
||||
//#define MBEDTLS_CTR_DRBG_USE_128_BIT_KEY
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_ENABLE_WEAK_CIPHERSUITES
|
||||
*
|
||||
|
@ -1219,6 +1236,21 @@
|
|||
*/
|
||||
//#define MBEDTLS_ENTROPY_NV_SEED
|
||||
|
||||
/* MBEDTLS_PSA_CRYPTO_KEY_FILE_ID_ENCODES_OWNER
|
||||
*
|
||||
* In PSA key storage, encode the owner of the key.
|
||||
*
|
||||
* This is only meaningful when building the library as part of a
|
||||
* multi-client service. When you activate this option, you must provide
|
||||
* an implementation of the type psa_key_owner_id_t and a translation
|
||||
* from psa_key_file_id_t to file name in all the storage backends that
|
||||
* you wish to support.
|
||||
*
|
||||
* Note that this option is meant for internal use only and may be removed
|
||||
* without notice.
|
||||
*/
|
||||
//#define MBEDTLS_PSA_CRYPTO_KEY_FILE_ID_ENCODES_OWNER
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_MEMORY_DEBUG
|
||||
*
|
||||
|
@ -1336,6 +1368,28 @@
|
|||
*/
|
||||
//#define MBEDTLS_SHA256_SMALLER
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_SHA512_SMALLER
|
||||
*
|
||||
* Enable an implementation of SHA-512 that has lower ROM footprint but also
|
||||
* lower performance.
|
||||
*
|
||||
* Uncomment to enable the smaller implementation of SHA512.
|
||||
*/
|
||||
//#define MBEDTLS_SHA512_SMALLER
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_SHA512_NO_SHA384
|
||||
*
|
||||
* Disable the SHA-384 option of the SHA-512 module. Use this to save some
|
||||
* code size on devices that don't use SHA-384.
|
||||
*
|
||||
* Requires: MBEDTLS_SHA512_C
|
||||
*
|
||||
* Uncomment to disable SHA-384
|
||||
*/
|
||||
//#define MBEDTLS_SHA512_NO_SHA384
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_SSL_ALL_ALERT_MESSAGES
|
||||
*
|
||||
|
@ -1350,48 +1404,6 @@
|
|||
*/
|
||||
#define MBEDTLS_SSL_ALL_ALERT_MESSAGES
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_SSL_RECORD_CHECKING
|
||||
*
|
||||
* Enable the function mbedtls_ssl_check_record() which can be used to check
|
||||
* the validity and authenticity of an incoming record, to verify that it has
|
||||
* not been seen before. These checks are performed without modifying the
|
||||
* externally visible state of the SSL context.
|
||||
*
|
||||
* See mbedtls_ssl_check_record() for more information.
|
||||
*
|
||||
* Uncomment to enable support for record checking.
|
||||
*/
|
||||
#define MBEDTLS_SSL_RECORD_CHECKING
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_SSL_DTLS_CONNECTION_ID
|
||||
*
|
||||
* Enable support for the DTLS Connection ID extension
|
||||
* (version draft-ietf-tls-dtls-connection-id-05,
|
||||
* https://tools.ietf.org/html/draft-ietf-tls-dtls-connection-id-05)
|
||||
* which allows to identify DTLS connections across changes
|
||||
* in the underlying transport.
|
||||
*
|
||||
* Setting this option enables the SSL APIs `mbedtls_ssl_set_cid()`,
|
||||
* `mbedtls_ssl_get_peer_cid()` and `mbedtls_ssl_conf_cid()`.
|
||||
* See the corresponding documentation for more information.
|
||||
*
|
||||
* \warning The Connection ID extension is still in draft state.
|
||||
* We make no stability promises for the availability
|
||||
* or the shape of the API controlled by this option.
|
||||
*
|
||||
* The maximum lengths of outgoing and incoming CIDs can be configured
|
||||
* through the options
|
||||
* - MBEDTLS_SSL_CID_OUT_LEN_MAX
|
||||
* - MBEDTLS_SSL_CID_IN_LEN_MAX.
|
||||
*
|
||||
* Requires: MBEDTLS_SSL_PROTO_DTLS
|
||||
*
|
||||
* Uncomment to enable the Connection ID extension.
|
||||
*/
|
||||
//#define MBEDTLS_SSL_DTLS_CONNECTION_ID
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_SSL_ASYNC_PRIVATE
|
||||
*
|
||||
|
@ -1403,33 +1415,6 @@
|
|||
*/
|
||||
//#define MBEDTLS_SSL_ASYNC_PRIVATE
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_SSL_CONTEXT_SERIALIZATION
|
||||
*
|
||||
* Enable serialization of the TLS context structures, through use of the
|
||||
* functions mbedtls_ssl_context_save() and mbedtls_ssl_context_load().
|
||||
*
|
||||
* This pair of functions allows one side of a connection to serialize the
|
||||
* context associated with the connection, then free or re-use that context
|
||||
* while the serialized state is persisted elsewhere, and finally deserialize
|
||||
* that state to a live context for resuming read/write operations on the
|
||||
* connection. From a protocol perspective, the state of the connection is
|
||||
* unaffected, in particular this is entirely transparent to the peer.
|
||||
*
|
||||
* Note: this is distinct from TLS session resumption, which is part of the
|
||||
* protocol and fully visible by the peer. TLS session resumption enables
|
||||
* establishing new connections associated to a saved session with shorter,
|
||||
* lighter handshakes, while context serialization is a local optimization in
|
||||
* handling a single, potentially long-lived connection.
|
||||
*
|
||||
* Enabling these APIs makes some SSL structures larger, as 64 extra bytes are
|
||||
* saved after the handshake to allow for more efficient serialization, so if
|
||||
* you don't need this feature you'll save RAM by disabling it.
|
||||
*
|
||||
* Comment to disable the context serialization APIs.
|
||||
*/
|
||||
#define MBEDTLS_SSL_CONTEXT_SERIALIZATION
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_SSL_DEBUG_ALL
|
||||
*
|
||||
|
@ -1831,14 +1816,14 @@
|
|||
* Make the X.509 and TLS library use PSA for cryptographic operations, and
|
||||
* enable new APIs for using keys handled by PSA Crypto.
|
||||
*
|
||||
* \note Development of this option is currently in progress, and parts
|
||||
* of the X.509 and TLS modules are not ported to PSA yet. However, these parts
|
||||
* \note Development of this option is currently in progress, and parts of Mbed
|
||||
* TLS's X.509 and TLS modules are not ported to PSA yet. However, these parts
|
||||
* will still continue to work as usual, so enabling this option should not
|
||||
* break backwards compatibility.
|
||||
*
|
||||
* \warning The PSA Crypto API is in beta stage. While you're welcome to
|
||||
* experiment using it, incompatible API changes are still possible, and some
|
||||
* parts may not have reached the same quality as the rest of Mbed TLS yet.
|
||||
* \warning Support for PSA is still an experimental feature.
|
||||
* Any public API that depends on this option may change
|
||||
* at any time until this warning is removed.
|
||||
*
|
||||
* \warning This option enables new Mbed TLS APIs that are dependent on the
|
||||
* PSA Crypto API, so can't come with the same stability guarantees as the
|
||||
|
@ -2335,14 +2320,18 @@
|
|||
* Requires: MBEDTLS_AES_C or MBEDTLS_DES_C
|
||||
*
|
||||
*/
|
||||
//#define MBEDTLS_CMAC_C
|
||||
#define MBEDTLS_CMAC_C
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_CTR_DRBG_C
|
||||
*
|
||||
* Enable the CTR_DRBG AES-based random generator.
|
||||
* The CTR_DRBG generator uses AES-256 by default.
|
||||
* To use AES-128 instead, enable MBEDTLS_CTR_DRBG_USE_128_BIT_KEY below.
|
||||
* To use AES-128 instead, enable \c MBEDTLS_CTR_DRBG_USE_128_BIT_KEY above.
|
||||
*
|
||||
* \note To achieve a 256-bit security strength with CTR_DRBG,
|
||||
* you must use AES-256 *and* use sufficient entropy.
|
||||
* See ctr_drbg.h for more details.
|
||||
*
|
||||
* Module: library/ctr_drbg.c
|
||||
* Caller:
|
||||
|
@ -2510,11 +2499,11 @@
|
|||
/**
|
||||
* \def MBEDTLS_GCM_C
|
||||
*
|
||||
* Enable the Galois/Counter Mode (GCM) for AES.
|
||||
* Enable the Galois/Counter Mode (GCM).
|
||||
*
|
||||
* Module: library/gcm.c
|
||||
*
|
||||
* Requires: MBEDTLS_AES_C or MBEDTLS_CAMELLIA_C
|
||||
* Requires: MBEDTLS_AES_C or MBEDTLS_CAMELLIA_C or MBEDTLS_ARIA_C
|
||||
*
|
||||
* This module enables the AES-GCM and CAMELLIA-GCM ciphersuites, if other
|
||||
* requisites are enabled as well.
|
||||
|
@ -2891,25 +2880,41 @@
|
|||
* experiment using it, incompatible API changes are still possible, and some
|
||||
* parts may not have reached the same quality as the rest of Mbed TLS yet.
|
||||
*
|
||||
* Module: crypto/library/psa_crypto.c
|
||||
* Module: library/psa_crypto.c
|
||||
*
|
||||
* Requires: MBEDTLS_CTR_DRBG_C, MBEDTLS_ENTROPY_C
|
||||
*
|
||||
*/
|
||||
#define MBEDTLS_PSA_CRYPTO_C
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_PSA_CRYPTO_SE_C
|
||||
*
|
||||
* Enable secure element support in the Platform Security Architecture
|
||||
* cryptography API.
|
||||
*
|
||||
* \warning This feature is not yet suitable for production. It is provided
|
||||
* for API evaluation and testing purposes only.
|
||||
*
|
||||
* Module: library/psa_crypto_se.c
|
||||
*
|
||||
* Requires: MBEDTLS_PSA_CRYPTO_C, MBEDTLS_PSA_CRYPTO_STORAGE_C
|
||||
*
|
||||
*/
|
||||
//#define MBEDTLS_PSA_CRYPTO_SE_C
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_PSA_CRYPTO_STORAGE_C
|
||||
*
|
||||
* Enable the Platform Security Architecture persistent key storage.
|
||||
*
|
||||
* Module: crypto/library/psa_crypto_storage.c
|
||||
* Module: library/psa_crypto_storage.c
|
||||
*
|
||||
* Requires: MBEDTLS_PSA_CRYPTO_C,
|
||||
* either MBEDTLS_PSA_ITS_FILE_C or a native implementation of
|
||||
* the PSA ITS interface
|
||||
*/
|
||||
//#define MBEDTLS_PSA_CRYPTO_STORAGE_C
|
||||
#define MBEDTLS_PSA_CRYPTO_STORAGE_C
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_PSA_ITS_FILE_C
|
||||
|
@ -2917,12 +2922,11 @@
|
|||
* Enable the emulation of the Platform Security Architecture
|
||||
* Internal Trusted Storage (PSA ITS) over files.
|
||||
*
|
||||
* Module: crypto/library/psa_its_file.c
|
||||
* Module: library/psa_its_file.c
|
||||
*
|
||||
* Requires: MBEDTLS_FS_IO
|
||||
*
|
||||
*/
|
||||
//#define MBEDTLS_PSA_ITS_FILE_C
|
||||
#define MBEDTLS_PSA_ITS_FILE_C
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_RIPEMD160_C
|
||||
|
@ -3279,7 +3283,6 @@
|
|||
//#define MBEDTLS_CTR_DRBG_MAX_INPUT 256 /**< Maximum number of additional input bytes */
|
||||
//#define MBEDTLS_CTR_DRBG_MAX_REQUEST 1024 /**< Maximum number of requested bytes per call */
|
||||
//#define MBEDTLS_CTR_DRBG_MAX_SEED_INPUT 384 /**< Maximum size of (re)seed buffer */
|
||||
//#define MBEDTLS_CTR_DRBG_USE_128_BIT_KEY /**< Use 128-bit key for CTR_DRBG - may reduce security (see ctr_drbg.h) */
|
||||
|
||||
/* HMAC_DRBG options */
|
||||
//#define MBEDTLS_HMAC_DRBG_RESEED_INTERVAL 10000 /**< Interval before reseed is performed by default */
|
||||
|
@ -3424,37 +3427,6 @@
|
|||
*/
|
||||
//#define MBEDTLS_SSL_IN_CONTENT_LEN 16384
|
||||
|
||||
/** \def MBEDTLS_SSL_CID_IN_LEN_MAX
|
||||
*
|
||||
* The maximum length of CIDs used for incoming DTLS messages.
|
||||
*
|
||||
*/
|
||||
//#define MBEDTLS_SSL_CID_IN_LEN_MAX 32
|
||||
|
||||
/** \def MBEDTLS_SSL_CID_OUT_LEN_MAX
|
||||
*
|
||||
* The maximum length of CIDs used for outgoing DTLS messages.
|
||||
*
|
||||
*/
|
||||
//#define MBEDTLS_SSL_CID_OUT_LEN_MAX 32
|
||||
|
||||
/** \def MBEDTLS_SSL_CID_PADDING_GRANULARITY
|
||||
*
|
||||
* This option controls the use of record plaintext padding
|
||||
* when using the Connection ID extension in DTLS 1.2.
|
||||
*
|
||||
* The padding will always be chosen so that the length of the
|
||||
* padded plaintext is a multiple of the value of this option.
|
||||
*
|
||||
* Note: A value of \c 1 means that no padding will be used
|
||||
* for outgoing records.
|
||||
*
|
||||
* Note: On systems lacking division instructions,
|
||||
* a power of two should be preferred.
|
||||
*
|
||||
*/
|
||||
//#define MBEDTLS_SSL_CID_PADDING_GRANULARITY 16
|
||||
|
||||
/** \def MBEDTLS_SSL_OUT_CONTENT_LEN
|
||||
*
|
||||
* Maximum length (in bytes) of outgoing plaintext fragments.
|
||||
|
@ -3530,7 +3502,7 @@
|
|||
* on it, and considering stronger message digests instead.
|
||||
*
|
||||
*/
|
||||
//#define MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES
|
||||
// #define MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES
|
||||
|
||||
/**
|
||||
* Allow SHA-1 in the default TLS configuration for TLS 1.2 handshake
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue