Clarify dependencies in mbedtls_config.h

- One module was missing the warning on psa_crypto_init().
- For modules that are affected by USE_PSA_CRYPTO, it makes more sense
to mention that in the warning.
- Attempt to improve the description of the TLS 1.3 situation.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
This commit is contained in:
Manuel Pégourié-Gonnard 2022-09-15 12:23:58 +02:00
parent f17f85ef0c
commit 72687b76ca

View File

@ -1492,13 +1492,14 @@
* *
* Enable support for TLS 1.2 (and DTLS 1.2 if DTLS is enabled). * Enable support for TLS 1.2 (and DTLS 1.2 if DTLS is enabled).
* *
* Requires: MBEDTLS_SHA1_C or MBEDTLS_SHA256_C or MBEDTLS_SHA512_C * Requires: Without MBEDTLS_USE_PSA_CRYPTO: MBEDTLS_MD_C and
* (Depends on ciphersuites) when MBEDTLS_USE_PSA_CRYPTO * (MBEDTLS_SHA1_C or MBEDTLS_SHA256_C or MBEDTLS_SHA512_C)
* is not defined, PSA_WANT_ALG_SHA_1 or PSA_WANT_ALG_SHA_256 or * With MBEDTLS_USE_PSA_CRYPTO:
* PSA_WANT_ALG_SHA_512 when MBEDTLS_USE_PSA_CRYPTO is defined. * PSA_WANT_ALG_SHA_1 or PSA_WANT_ALG_SHA_256 or
* PSA_WANT_ALG_SHA_512
* *
* \warning If building without MBEDTLS_MD_C, you must call psa_crypto_init() * \warning If building with MBEDTLS_USE_PSA_CRYPTO, you must call
* before doing any TLS operation. * psa_crypto_init() before doing any TLS operations.
* *
* Comment this macro to disable support for TLS 1.2 / DTLS 1.2 * Comment this macro to disable support for TLS 1.2 / DTLS 1.2
*/ */
@ -1517,11 +1518,11 @@
* Requires: MBEDTLS_SSL_KEEP_PEER_CERTIFICATE * Requires: MBEDTLS_SSL_KEEP_PEER_CERTIFICATE
* Requires: MBEDTLS_PSA_CRYPTO_C * Requires: MBEDTLS_PSA_CRYPTO_C
* *
* Note: even though TLS 1.3 depends on PSA Crypto, if you want it to only use * Note: even though TLS 1.3 depends on PSA Crypto, and uses it unconditonally
* PSA for all crypto operations, you need to also enable * for most operations, if you want it to only use PSA for all crypto
* MBEDTLS_USE_PSA_CRYPTO; otherwise X.509 operations, and functions that are * operations, you need to also enable MBEDTLS_USE_PSA_CRYPTO; otherwise X.509
* common with TLS 1.2 (record protection, running handshake hash) will still * operations, and functions that are common with TLS 1.2 (record protection,
* use non-PSA crypto. * running handshake hash) will still use non-PSA crypto.
* *
* Uncomment this macro to enable the support for TLS 1.3. * Uncomment this macro to enable the support for TLS 1.3.
*/ */
@ -2337,7 +2338,7 @@
* This module is used by the following key exchanges: * This module is used by the following key exchanges:
* ECJPAKE * ECJPAKE
* *
* Requires: MBEDTLS_ECP_C, MBEDTLS_MD_C * Requires: MBEDTLS_ECP_C and either MBEDTLS_MD_C or MBEDTLS_PSA_CRYPTO_C
* *
* \warning If building without MBEDTLS_MD_C, you must call psa_crypto_init() * \warning If building without MBEDTLS_MD_C, you must call psa_crypto_init()
* before doing any EC J-PAKE operations. * before doing any EC J-PAKE operations.
@ -2654,7 +2655,10 @@
* *
* Module: library/pkcs5.c * Module: library/pkcs5.c
* *
* Requires: MBEDTLS_CIPHER_C, MBEDTLS_MD_C * Requires: MBEDTLS_CIPHER_C and either MBEDTLS_MD_C or MBEDTLS_PSA_CRYPTO_C.
*
* \warning If building without MBEDTLS_MD_C, you must call psa_crypto_init()
* before doing any PKCS5 operation.
* *
* This module adds support for the PKCS#5 functions. * This module adds support for the PKCS#5 functions.
*/ */
@ -3136,8 +3140,8 @@
* Requires: MBEDTLS_ASN1_PARSE_C, MBEDTLS_BIGNUM_C, MBEDTLS_OID_C, MBEDTLS_PK_PARSE_C, * Requires: MBEDTLS_ASN1_PARSE_C, MBEDTLS_BIGNUM_C, MBEDTLS_OID_C, MBEDTLS_PK_PARSE_C,
* (MBEDTLS_MD_C or MBEDTLS_USE_PSA_CRYPTO) * (MBEDTLS_MD_C or MBEDTLS_USE_PSA_CRYPTO)
* *
* \warning If building without MBEDTLS_MD_C, you must call psa_crypto_init() * \warning If building with MBEDTLS_USE_PSA_CRYPTO, you must call
* before doing any X.509 operation. * psa_crypto_init() before doing any X.509 operation.
* *
* This module is required for the X.509 parsing modules. * This module is required for the X.509 parsing modules.
*/ */
@ -3197,8 +3201,8 @@
* Requires: MBEDTLS_BIGNUM_C, MBEDTLS_OID_C, MBEDTLS_PK_PARSE_C, * Requires: MBEDTLS_BIGNUM_C, MBEDTLS_OID_C, MBEDTLS_PK_PARSE_C,
* (MBEDTLS_MD_C or MBEDTLS_USE_PSA_CRYPTO) * (MBEDTLS_MD_C or MBEDTLS_USE_PSA_CRYPTO)
* *
* \warning If building without MBEDTLS_MD_C, you must call psa_crypto_init() * \warning If building with MBEDTLS_USE_PSA_CRYPTO, you must call
* before doing any X.509 create operation. * psa_crypto_init() before doing any X.509 create operation.
* *
* This module is the basis for creating X.509 certificates and CSRs. * This module is the basis for creating X.509 certificates and CSRs.
*/ */