Fix some issues in comments

Ranging from typos to outdated comment contradicting the code.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
This commit is contained in:
Manuel Pégourié-Gonnard 2023-09-18 09:55:24 +02:00
parent ba63e0ce34
commit f7298cd397
3 changed files with 17 additions and 18 deletions

View File

@ -92,7 +92,7 @@ int p256_ecdsa_verify(const uint8_t sig[64], const uint8_t pub[64],
/* /*
* Public key validation * Public key validation
* *
* Note: you never need to call this function, as all other function always * Note: you never need to call this function, as all other functions always
* validate their input; however it's availabe if you want to validate the key * validate their input; however it's availabe if you want to validate the key
* without performing an operation. * without performing an operation.
* *
@ -106,7 +106,7 @@ int p256_validate_pubkey(const uint8_t pub[64]);
/* /*
* Private key validation * Private key validation
* *
* Note: you never need to call this function, as all other function always * Note: you never need to call this function, as all other functions always
* validate their input; however it's availabe if you want to validate the key * validate their input; however it's availabe if you want to validate the key
* without performing an operation. * without performing an operation.
* *

View File

@ -173,11 +173,11 @@ typedef struct mbedtls_pk_rsassa_pss_options {
/* Internal helper to define which fields in the pk_context structure below /* Internal helper to define which fields in the pk_context structure below
* should be used for EC keys: legacy ecp_keypair or the raw (PSA friendly) * should be used for EC keys: legacy ecp_keypair or the raw (PSA friendly)
* format. It should be noticed that this only affects how data is stored, not * format. It should be noted that this only affects how data is stored, not
* which functions are used for various operations. The overall picture looks * which functions are used for various operations. The overall picture looks
* like this: * like this:
* - if USE_PSA is not defined and ECP_C is then use ecp_keypair data structure * - if USE_PSA is not defined and ECP_C is defined then use ecp_keypair data
* and legacy functions * structure and legacy functions
* - if USE_PSA is defined and * - if USE_PSA is defined and
* - if ECP_C then use ecp_keypair structure, convert data to a PSA friendly * - if ECP_C then use ecp_keypair structure, convert data to a PSA friendly
* format and use PSA functions * format and use PSA functions
@ -185,13 +185,13 @@ typedef struct mbedtls_pk_rsassa_pss_options {
* *
* The main reason for the "intermediate" (USE_PSA + ECP_C) above is that as long * The main reason for the "intermediate" (USE_PSA + ECP_C) above is that as long
* as ECP_C is defined mbedtls_pk_ec() gives the user a read/write access to the * as ECP_C is defined mbedtls_pk_ec() gives the user a read/write access to the
* ecp_keypair structure inside the pk_context so he/she can modify it using * ecp_keypair structure inside the pk_context so they can modify it using
* ECP functions which are not under PK module's control. * ECP functions which are not under PK module's control.
*/ */
#if defined(MBEDTLS_USE_PSA_CRYPTO) && defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY) && \ #if defined(MBEDTLS_USE_PSA_CRYPTO) && defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY) && \
!defined(MBEDTLS_ECP_C) !defined(MBEDTLS_ECP_C)
#define MBEDTLS_PK_USE_PSA_EC_DATA #define MBEDTLS_PK_USE_PSA_EC_DATA
#endif /* MBEDTLS_USE_PSA_CRYPTO && !MBEDTLS_ECP_C */ #endif
/* Helper symbol to state that the PK module has support for EC keys. This /* Helper symbol to state that the PK module has support for EC keys. This
* can either be provided through the legacy ECP solution or through the * can either be provided through the legacy ECP solution or through the
@ -202,11 +202,11 @@ typedef struct mbedtls_pk_rsassa_pss_options {
/* Internal helper to define which fields in the pk_context structure below /* Internal helper to define which fields in the pk_context structure below
* should be used for EC keys: legacy ecp_keypair or the raw (PSA friendly) * should be used for EC keys: legacy ecp_keypair or the raw (PSA friendly)
* format. It should be noted that this only affect how data is stored, not * format. It should be noted that this only affects how data is stored, not
* which functions are used for various operations. The overall picture looks * which functions are used for various operations. The overall picture looks
* like this: * like this:
* - if USE_PSA is not defined and ECP_C is then use ecp_keypair data structure * - if USE_PSA is not defined and ECP_C is defined then use ecp_keypair data
* and legacy functions * structure and legacy functions
* - if USE_PSA is defined and * - if USE_PSA is defined and
* - if ECP_C then use ecp_keypair structure, convert data to a PSA friendly * - if ECP_C then use ecp_keypair structure, convert data to a PSA friendly
* format and use PSA functions * format and use PSA functions
@ -220,11 +220,11 @@ typedef struct mbedtls_pk_rsassa_pss_options {
#if defined(MBEDTLS_USE_PSA_CRYPTO) && defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY) && \ #if defined(MBEDTLS_USE_PSA_CRYPTO) && defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY) && \
!defined(MBEDTLS_ECP_C) !defined(MBEDTLS_ECP_C)
#define MBEDTLS_PK_USE_PSA_EC_DATA #define MBEDTLS_PK_USE_PSA_EC_DATA
#endif /* MBEDTLS_USE_PSA_CRYPTO && !MBEDTLS_ECP_C */ #endif
/* Internal helper to define which fields in the pk_context structure below /* Internal helper to define which fields in the pk_context structure below
* should be used for EC keys: legacy ecp_keypair or the raw (PSA friendly) * should be used for EC keys: legacy ecp_keypair or the raw (PSA friendly)
* format. It should be noticed that this only affect how data is stored, not * format. It should be noted that this only affects how data is stored, not
* which functions are used for various operations. The overall picture looks * which functions are used for various operations. The overall picture looks
* like this: * like this:
* - if USE_PSA is not defined and ECP_C is then use ecp_keypair data structure * - if USE_PSA is not defined and ECP_C is then use ecp_keypair data structure
@ -236,13 +236,13 @@ typedef struct mbedtls_pk_rsassa_pss_options {
* *
* The main reason for the "intermediate" (USE_PSA + ECP_C) above is that as long * The main reason for the "intermediate" (USE_PSA + ECP_C) above is that as long
* as ECP_C is defined mbedtls_pk_ec() gives the user a read/write access to the * as ECP_C is defined mbedtls_pk_ec() gives the user a read/write access to the
* ecp_keypair structure inside the pk_context so he/she can modify it using * ecp_keypair structure inside the pk_context so they can modify it using
* ECP functions which are not under PK module's control. * ECP functions which are not under PK module's control.
*/ */
#if defined(MBEDTLS_USE_PSA_CRYPTO) && defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY) && \ #if defined(MBEDTLS_USE_PSA_CRYPTO) && defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY) && \
!defined(MBEDTLS_ECP_C) !defined(MBEDTLS_ECP_C)
#define MBEDTLS_PK_USE_PSA_EC_DATA #define MBEDTLS_PK_USE_PSA_EC_DATA
#endif /* MBEDTLS_USE_PSA_CRYPTO && !MBEDTLS_ECP_C */ #endif
/** /**
* \brief Types for interfacing with the debug module * \brief Types for interfacing with the debug module

View File

@ -2812,7 +2812,7 @@ common_tfm_config () {
# - MD_C for HKDF_C # - MD_C for HKDF_C
echo "#define MBEDTLS_MD_C" >> "$CONFIG_H" echo "#define MBEDTLS_MD_C" >> "$CONFIG_H"
# Config adjustements for better test coverage in our environment. # Config adjustments for better test coverage in our environment.
# These are not needed just to build and pass tests. # These are not needed just to build and pass tests.
# #
# Enable filesystem I/O for the benefit of PK parse/write tests. # Enable filesystem I/O for the benefit of PK parse/write tests.
@ -2820,7 +2820,7 @@ common_tfm_config () {
# Disable this for maximal ASan efficiency # Disable this for maximal ASan efficiency
scripts/config.py unset MBEDTLS_MEMORY_BUFFER_ALLOC_C scripts/config.py unset MBEDTLS_MEMORY_BUFFER_ALLOC_C
# Config adjustements for features that are not supported # Config adjustments for features that are not supported
# when using only drivers / by p256-m # when using only drivers / by p256-m
# #
# Disable all the features that auto-enable ECP_LIGHT (see build_info.h) # Disable all the features that auto-enable ECP_LIGHT (see build_info.h)
@ -2838,8 +2838,7 @@ component_test_tfm_config_p256m_driver_accel_ec () {
common_tfm_config common_tfm_config
# Set the list of accelerated components in order to remove them from # Set the list of accelerated components in order to remove them from
# builtin support. We don't set IMPORT and EXPORT because P256M does not # builtin support.
# support these operations.
loc_accel_list="ALG_ECDSA \ loc_accel_list="ALG_ECDSA \
ALG_ECDH \ ALG_ECDH \
KEY_TYPE_ECC_KEY_PAIR_BASIC \ KEY_TYPE_ECC_KEY_PAIR_BASIC \