feat: updated engine version to 4.4-rc1
This commit is contained in:
parent
ee00efde1f
commit
21ba8e33af
5459 changed files with 1128836 additions and 198305 deletions
188
engine/thirdparty/mbedtls/include/psa/crypto.h
vendored
188
engine/thirdparty/mbedtls/include/psa/crypto.h
vendored
|
|
@ -121,8 +121,8 @@ static psa_key_attributes_t psa_key_attributes_init(void);
|
|||
* value in the structure.
|
||||
* The persistent key will be written to storage when the attribute
|
||||
* structure is passed to a key creation function such as
|
||||
* psa_import_key(), psa_generate_key(), psa_generate_key_ext(),
|
||||
* psa_key_derivation_output_key(), psa_key_derivation_output_key_ext()
|
||||
* psa_import_key(), psa_generate_key(), psa_generate_key_custom(),
|
||||
* psa_key_derivation_output_key(), psa_key_derivation_output_key_custom()
|
||||
* or psa_copy_key().
|
||||
*
|
||||
* This function may be declared as `static` (i.e. without external
|
||||
|
|
@ -131,6 +131,9 @@ static psa_key_attributes_t psa_key_attributes_init(void);
|
|||
*
|
||||
* \param[out] attributes The attribute structure to write to.
|
||||
* \param key The persistent identifier for the key.
|
||||
* This can be any value in the range from
|
||||
* #PSA_KEY_ID_USER_MIN to #PSA_KEY_ID_USER_MAX
|
||||
* inclusive.
|
||||
*/
|
||||
static void psa_set_key_id(psa_key_attributes_t *attributes,
|
||||
mbedtls_svc_key_id_t key);
|
||||
|
|
@ -166,8 +169,8 @@ static void mbedtls_set_key_owner_id(psa_key_attributes_t *attributes,
|
|||
* value in the structure.
|
||||
* The persistent key will be written to storage when the attribute
|
||||
* structure is passed to a key creation function such as
|
||||
* psa_import_key(), psa_generate_key(), psa_generate_key_ext(),
|
||||
* psa_key_derivation_output_key(), psa_key_derivation_output_key_ext()
|
||||
* psa_import_key(), psa_generate_key(), psa_generate_key_custom(),
|
||||
* psa_key_derivation_output_key(), psa_key_derivation_output_key_custom()
|
||||
* or psa_copy_key().
|
||||
*
|
||||
* This function may be declared as `static` (i.e. without external
|
||||
|
|
@ -875,7 +878,7 @@ psa_status_t psa_hash_compute(psa_algorithm_t alg,
|
|||
* such that #PSA_ALG_IS_HASH(\p alg) is true).
|
||||
* \param[in] input Buffer containing the message to hash.
|
||||
* \param input_length Size of the \p input buffer in bytes.
|
||||
* \param[out] hash Buffer containing the expected hash value.
|
||||
* \param[in] hash Buffer containing the expected hash value.
|
||||
* \param hash_length Size of the \p hash buffer in bytes.
|
||||
*
|
||||
* \retval #PSA_SUCCESS
|
||||
|
|
@ -1230,7 +1233,7 @@ psa_status_t psa_mac_compute(mbedtls_svc_key_id_t key,
|
|||
* such that #PSA_ALG_IS_MAC(\p alg) is true).
|
||||
* \param[in] input Buffer containing the input message.
|
||||
* \param input_length Size of the \p input buffer in bytes.
|
||||
* \param[out] mac Buffer containing the expected MAC value.
|
||||
* \param[in] mac Buffer containing the expected MAC value.
|
||||
* \param mac_length Size of the \p mac buffer in bytes.
|
||||
*
|
||||
* \retval #PSA_SUCCESS
|
||||
|
|
@ -2922,7 +2925,7 @@ psa_status_t psa_sign_message(mbedtls_svc_key_id_t key,
|
|||
* \p key.
|
||||
* \param[in] input The message whose signature is to be verified.
|
||||
* \param[in] input_length Size of the \p input buffer in bytes.
|
||||
* \param[out] signature Buffer containing the signature to verify.
|
||||
* \param[in] signature Buffer containing the signature to verify.
|
||||
* \param[in] signature_length Size of the \p signature buffer in bytes.
|
||||
*
|
||||
* \retval #PSA_SUCCESS \emptydescription
|
||||
|
|
@ -3248,7 +3251,7 @@ static psa_key_derivation_operation_t psa_key_derivation_operation_init(void);
|
|||
* of or after providing inputs. For some algorithms, this step is mandatory
|
||||
* because the output depends on the maximum capacity.
|
||||
* -# To derive a key, call psa_key_derivation_output_key() or
|
||||
* psa_key_derivation_output_key_ext().
|
||||
* psa_key_derivation_output_key_custom().
|
||||
* To derive a byte string for a different purpose, call
|
||||
* psa_key_derivation_output_bytes().
|
||||
* Successive calls to these functions use successive output bytes
|
||||
|
|
@ -3471,7 +3474,7 @@ psa_status_t psa_key_derivation_input_integer(
|
|||
* \note Once all inputs steps are completed, the operations will allow:
|
||||
* - psa_key_derivation_output_bytes() if each input was either a direct input
|
||||
* or a key with #PSA_KEY_USAGE_DERIVE set;
|
||||
* - psa_key_derivation_output_key() or psa_key_derivation_output_key_ext()
|
||||
* - psa_key_derivation_output_key() or psa_key_derivation_output_key_custom()
|
||||
* if the input for step
|
||||
* #PSA_KEY_DERIVATION_INPUT_SECRET or #PSA_KEY_DERIVATION_INPUT_PASSWORD
|
||||
* was from a key slot with #PSA_KEY_USAGE_DERIVE and each other input was
|
||||
|
|
@ -3721,9 +3724,9 @@ psa_status_t psa_key_derivation_output_bytes(
|
|||
* on the derived key based on the attributes and strength of the secret key.
|
||||
*
|
||||
* \note This function is equivalent to calling
|
||||
* psa_key_derivation_output_key_ext()
|
||||
* with the production parameters #PSA_KEY_PRODUCTION_PARAMETERS_INIT
|
||||
* and `params_data_length == 0` (i.e. `params->data` is empty).
|
||||
* psa_key_derivation_output_key_custom()
|
||||
* with the custom production parameters #PSA_CUSTOM_KEY_PARAMETERS_INIT
|
||||
* and `custom_data_length == 0` (i.e. `custom_data` is empty).
|
||||
*
|
||||
* \param[in] attributes The attributes for the new key.
|
||||
* If the key type to be created is
|
||||
|
|
@ -3795,6 +3798,85 @@ psa_status_t psa_key_derivation_output_key(
|
|||
* the policy must be the same as in the current
|
||||
* operation.
|
||||
* \param[in,out] operation The key derivation operation object to read from.
|
||||
* \param[in] custom Customization parameters for the key generation.
|
||||
* When this is #PSA_CUSTOM_KEY_PARAMETERS_INIT
|
||||
* with \p custom_data_length = 0,
|
||||
* this function is equivalent to
|
||||
* psa_key_derivation_output_key().
|
||||
* \param[in] custom_data Variable-length data associated with \c custom.
|
||||
* \param custom_data_length
|
||||
* Length of `custom_data` in bytes.
|
||||
* \param[out] key On success, an identifier for the newly created
|
||||
* key. For persistent keys, this is the key
|
||||
* identifier defined in \p attributes.
|
||||
* \c 0 on failure.
|
||||
*
|
||||
* \retval #PSA_SUCCESS
|
||||
* Success.
|
||||
* If the key is persistent, the key material and the key's metadata
|
||||
* have been saved to persistent storage.
|
||||
* \retval #PSA_ERROR_ALREADY_EXISTS
|
||||
* This is an attempt to create a persistent key, and there is
|
||||
* already a persistent key with the given identifier.
|
||||
* \retval #PSA_ERROR_INSUFFICIENT_DATA
|
||||
* There was not enough data to create the desired key.
|
||||
* Note that in this case, no output is written to the output buffer.
|
||||
* The operation's capacity is set to 0, thus subsequent calls to
|
||||
* this function will not succeed, even with a smaller output buffer.
|
||||
* \retval #PSA_ERROR_NOT_SUPPORTED
|
||||
* The key type or key size is not supported, either by the
|
||||
* implementation in general or in this particular location.
|
||||
* \retval #PSA_ERROR_INVALID_ARGUMENT
|
||||
* The provided key attributes are not valid for the operation.
|
||||
* \retval #PSA_ERROR_NOT_PERMITTED
|
||||
* The #PSA_KEY_DERIVATION_INPUT_SECRET or
|
||||
* #PSA_KEY_DERIVATION_INPUT_PASSWORD input was not provided through a
|
||||
* key; or one of the inputs was a key whose policy didn't allow
|
||||
* #PSA_KEY_USAGE_DERIVE.
|
||||
* \retval #PSA_ERROR_INSUFFICIENT_MEMORY \emptydescription
|
||||
* \retval #PSA_ERROR_INSUFFICIENT_STORAGE \emptydescription
|
||||
* \retval #PSA_ERROR_COMMUNICATION_FAILURE \emptydescription
|
||||
* \retval #PSA_ERROR_HARDWARE_FAILURE \emptydescription
|
||||
* \retval #PSA_ERROR_CORRUPTION_DETECTED \emptydescription
|
||||
* \retval #PSA_ERROR_DATA_INVALID \emptydescription
|
||||
* \retval #PSA_ERROR_DATA_CORRUPT \emptydescription
|
||||
* \retval #PSA_ERROR_STORAGE_FAILURE \emptydescription
|
||||
* \retval #PSA_ERROR_BAD_STATE
|
||||
* The operation state is not valid (it must be active and completed
|
||||
* all required input steps), or the library has not been previously
|
||||
* initialized by psa_crypto_init().
|
||||
* It is implementation-dependent whether a failure to initialize
|
||||
* results in this error code.
|
||||
*/
|
||||
psa_status_t psa_key_derivation_output_key_custom(
|
||||
const psa_key_attributes_t *attributes,
|
||||
psa_key_derivation_operation_t *operation,
|
||||
const psa_custom_key_parameters_t *custom,
|
||||
const uint8_t *custom_data,
|
||||
size_t custom_data_length,
|
||||
mbedtls_svc_key_id_t *key);
|
||||
|
||||
#ifndef __cplusplus
|
||||
/* Omitted when compiling in C++, because one of the parameters is a
|
||||
* pointer to a struct with a flexible array member, and that is not
|
||||
* standard C++.
|
||||
* https://github.com/Mbed-TLS/mbedtls/issues/9020
|
||||
*/
|
||||
/** Derive a key from an ongoing key derivation operation with custom
|
||||
* production parameters.
|
||||
*
|
||||
* \note
|
||||
* This is a deprecated variant of psa_key_derivation_output_key_custom().
|
||||
* It is equivalent except that the associated variable-length data
|
||||
* is passed in `params->data` instead of a separate parameter.
|
||||
* This function will be removed in a future version of Mbed TLS.
|
||||
*
|
||||
* \param[in] attributes The attributes for the new key.
|
||||
* If the key type to be created is
|
||||
* #PSA_KEY_TYPE_PASSWORD_HASH then the algorithm in
|
||||
* the policy must be the same as in the current
|
||||
* operation.
|
||||
* \param[in,out] operation The key derivation operation object to read from.
|
||||
* \param[in] params Customization parameters for the key derivation.
|
||||
* When this is #PSA_KEY_PRODUCTION_PARAMETERS_INIT
|
||||
* with \p params_data_length = 0,
|
||||
|
|
@ -3848,14 +3930,13 @@ psa_status_t psa_key_derivation_output_key(
|
|||
* It is implementation-dependent whether a failure to initialize
|
||||
* results in this error code.
|
||||
*/
|
||||
#ifndef __cplusplus
|
||||
psa_status_t psa_key_derivation_output_key_ext(
|
||||
const psa_key_attributes_t *attributes,
|
||||
psa_key_derivation_operation_t *operation,
|
||||
const psa_key_production_parameters_t *params,
|
||||
size_t params_data_length,
|
||||
mbedtls_svc_key_id_t *key);
|
||||
#endif
|
||||
#endif /* !__cplusplus */
|
||||
|
||||
/** Compare output data from a key derivation operation to an expected value.
|
||||
*
|
||||
|
|
@ -3881,8 +3962,8 @@ psa_status_t psa_key_derivation_output_key_ext(
|
|||
* psa_key_derivation_abort().
|
||||
*
|
||||
* \param[in,out] operation The key derivation operation object to read from.
|
||||
* \param[in] expected_output Buffer containing the expected derivation output.
|
||||
* \param output_length Length of the expected output; this is also the
|
||||
* \param[in] expected Buffer containing the expected derivation output.
|
||||
* \param expected_length Length of the expected output; this is also the
|
||||
* number of bytes that will be read.
|
||||
*
|
||||
* \retval #PSA_SUCCESS \emptydescription
|
||||
|
|
@ -3912,8 +3993,8 @@ psa_status_t psa_key_derivation_output_key_ext(
|
|||
*/
|
||||
psa_status_t psa_key_derivation_verify_bytes(
|
||||
psa_key_derivation_operation_t *operation,
|
||||
const uint8_t *expected_output,
|
||||
size_t output_length);
|
||||
const uint8_t *expected,
|
||||
size_t expected_length);
|
||||
|
||||
/** Compare output data from a key derivation operation to an expected value
|
||||
* stored in a key object.
|
||||
|
|
@ -3943,7 +4024,7 @@ psa_status_t psa_key_derivation_verify_bytes(
|
|||
* operation. The value of this key was likely
|
||||
* computed by a previous call to
|
||||
* psa_key_derivation_output_key() or
|
||||
* psa_key_derivation_output_key_ext().
|
||||
* psa_key_derivation_output_key_custom().
|
||||
*
|
||||
* \retval #PSA_SUCCESS \emptydescription
|
||||
* \retval #PSA_ERROR_INVALID_SIGNATURE
|
||||
|
|
@ -4111,9 +4192,9 @@ psa_status_t psa_generate_random(uint8_t *output,
|
|||
* between 2^{n-1} and 2^n where n is the bit size specified in the
|
||||
* attributes.
|
||||
*
|
||||
* \note This function is equivalent to calling psa_generate_key_ext()
|
||||
* with the production parameters #PSA_KEY_PRODUCTION_PARAMETERS_INIT
|
||||
* and `params_data_length == 0` (i.e. `params->data` is empty).
|
||||
* \note This function is equivalent to calling psa_generate_key_custom()
|
||||
* with the custom production parameters #PSA_CUSTOM_KEY_PARAMETERS_INIT
|
||||
* and `custom_data_length == 0` (i.e. `custom_data` is empty).
|
||||
*
|
||||
* \param[in] attributes The attributes for the new key.
|
||||
* \param[out] key On success, an identifier for the newly created
|
||||
|
|
@ -4153,7 +4234,7 @@ psa_status_t psa_generate_key(const psa_key_attributes_t *attributes,
|
|||
* See the description of psa_generate_key() for the operation of this
|
||||
* function with the default production parameters. In addition, this function
|
||||
* supports the following production customizations, described in more detail
|
||||
* in the documentation of ::psa_key_production_parameters_t:
|
||||
* in the documentation of ::psa_custom_key_parameters_t:
|
||||
*
|
||||
* - RSA keys: generation with a custom public exponent.
|
||||
*
|
||||
|
|
@ -4161,6 +4242,64 @@ psa_status_t psa_generate_key(const psa_key_attributes_t *attributes,
|
|||
* versions of Mbed TLS.
|
||||
*
|
||||
* \param[in] attributes The attributes for the new key.
|
||||
* \param[in] custom Customization parameters for the key generation.
|
||||
* When this is #PSA_CUSTOM_KEY_PARAMETERS_INIT
|
||||
* with \p custom_data_length = 0,
|
||||
* this function is equivalent to
|
||||
* psa_generate_key().
|
||||
* \param[in] custom_data Variable-length data associated with \c custom.
|
||||
* \param custom_data_length
|
||||
* Length of `custom_data` in bytes.
|
||||
* \param[out] key On success, an identifier for the newly created
|
||||
* key. For persistent keys, this is the key
|
||||
* identifier defined in \p attributes.
|
||||
* \c 0 on failure.
|
||||
*
|
||||
* \retval #PSA_SUCCESS
|
||||
* Success.
|
||||
* If the key is persistent, the key material and the key's metadata
|
||||
* have been saved to persistent storage.
|
||||
* \retval #PSA_ERROR_ALREADY_EXISTS
|
||||
* This is an attempt to create a persistent key, and there is
|
||||
* already a persistent key with the given identifier.
|
||||
* \retval #PSA_ERROR_NOT_SUPPORTED \emptydescription
|
||||
* \retval #PSA_ERROR_INVALID_ARGUMENT \emptydescription
|
||||
* \retval #PSA_ERROR_INSUFFICIENT_MEMORY \emptydescription
|
||||
* \retval #PSA_ERROR_INSUFFICIENT_ENTROPY \emptydescription
|
||||
* \retval #PSA_ERROR_COMMUNICATION_FAILURE \emptydescription
|
||||
* \retval #PSA_ERROR_HARDWARE_FAILURE \emptydescription
|
||||
* \retval #PSA_ERROR_CORRUPTION_DETECTED \emptydescription
|
||||
* \retval #PSA_ERROR_INSUFFICIENT_STORAGE \emptydescription
|
||||
* \retval #PSA_ERROR_DATA_INVALID \emptydescription
|
||||
* \retval #PSA_ERROR_DATA_CORRUPT \emptydescription
|
||||
* \retval #PSA_ERROR_STORAGE_FAILURE \emptydescription
|
||||
* \retval #PSA_ERROR_BAD_STATE
|
||||
* The library has not been previously initialized by psa_crypto_init().
|
||||
* It is implementation-dependent whether a failure to initialize
|
||||
* results in this error code.
|
||||
*/
|
||||
psa_status_t psa_generate_key_custom(const psa_key_attributes_t *attributes,
|
||||
const psa_custom_key_parameters_t *custom,
|
||||
const uint8_t *custom_data,
|
||||
size_t custom_data_length,
|
||||
mbedtls_svc_key_id_t *key);
|
||||
|
||||
#ifndef __cplusplus
|
||||
/* Omitted when compiling in C++, because one of the parameters is a
|
||||
* pointer to a struct with a flexible array member, and that is not
|
||||
* standard C++.
|
||||
* https://github.com/Mbed-TLS/mbedtls/issues/9020
|
||||
*/
|
||||
/**
|
||||
* \brief Generate a key or key pair using custom production parameters.
|
||||
*
|
||||
* \note
|
||||
* This is a deprecated variant of psa_key_derivation_output_key_custom().
|
||||
* It is equivalent except that the associated variable-length data
|
||||
* is passed in `params->data` instead of a separate parameter.
|
||||
* This function will be removed in a future version of Mbed TLS.
|
||||
*
|
||||
* \param[in] attributes The attributes for the new key.
|
||||
* \param[in] params Customization parameters for the key generation.
|
||||
* When this is #PSA_KEY_PRODUCTION_PARAMETERS_INIT
|
||||
* with \p params_data_length = 0,
|
||||
|
|
@ -4196,12 +4335,11 @@ psa_status_t psa_generate_key(const psa_key_attributes_t *attributes,
|
|||
* It is implementation-dependent whether a failure to initialize
|
||||
* results in this error code.
|
||||
*/
|
||||
#ifndef __cplusplus
|
||||
psa_status_t psa_generate_key_ext(const psa_key_attributes_t *attributes,
|
||||
const psa_key_production_parameters_t *params,
|
||||
size_t params_data_length,
|
||||
mbedtls_svc_key_id_t *key);
|
||||
#endif
|
||||
#endif /* !__cplusplus */
|
||||
|
||||
/**@}*/
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
* \file psa/crypto_adjust_auto_enabled.h
|
||||
* \brief Adjust PSA configuration: enable always-on features
|
||||
*
|
||||
* This is an internal header. Do not include it directly.
|
||||
*
|
||||
* Always enable certain features which require a negligible amount of code
|
||||
* to implement, to avoid some edge cases in the configuration combinatorics.
|
||||
*/
|
||||
|
|
@ -13,6 +15,14 @@
|
|||
#ifndef PSA_CRYPTO_ADJUST_AUTO_ENABLED_H
|
||||
#define PSA_CRYPTO_ADJUST_AUTO_ENABLED_H
|
||||
|
||||
#if !defined(MBEDTLS_CONFIG_FILES_READ)
|
||||
#error "Do not include psa/crypto_adjust_*.h manually! This can lead to problems, " \
|
||||
"up to and including runtime errors such as buffer overflows. " \
|
||||
"If you're trying to fix a complaint from check_config.h, just remove " \
|
||||
"it from your configuration file: since Mbed TLS 3.0, it is included " \
|
||||
"automatically at the right point."
|
||||
#endif /* */
|
||||
|
||||
#define PSA_WANT_KEY_TYPE_DERIVE 1
|
||||
#define PSA_WANT_KEY_TYPE_PASSWORD 1
|
||||
#define PSA_WANT_KEY_TYPE_PASSWORD_HASH 1
|
||||
|
|
|
|||
51
engine/thirdparty/mbedtls/include/psa/crypto_adjust_config_dependencies.h
vendored
Normal file
51
engine/thirdparty/mbedtls/include/psa/crypto_adjust_config_dependencies.h
vendored
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
/**
|
||||
* \file psa/crypto_adjust_config_dependencies.h
|
||||
* \brief Adjust PSA configuration by resolving some dependencies.
|
||||
*
|
||||
* This is an internal header. Do not include it directly.
|
||||
*
|
||||
* See docs/proposed/psa-conditional-inclusion-c.md.
|
||||
* If the Mbed TLS implementation of a cryptographic mechanism A depends on a
|
||||
* cryptographic mechanism B then if the cryptographic mechanism A is enabled
|
||||
* and not accelerated enable B. Note that if A is enabled and accelerated, it
|
||||
* is not necessary to enable B for A support.
|
||||
*/
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef PSA_CRYPTO_ADJUST_CONFIG_DEPENDENCIES_H
|
||||
#define PSA_CRYPTO_ADJUST_CONFIG_DEPENDENCIES_H
|
||||
|
||||
#if !defined(MBEDTLS_CONFIG_FILES_READ)
|
||||
#error "Do not include psa/crypto_adjust_*.h manually! This can lead to problems, " \
|
||||
"up to and including runtime errors such as buffer overflows. " \
|
||||
"If you're trying to fix a complaint from check_config.h, just remove " \
|
||||
"it from your configuration file: since Mbed TLS 3.0, it is included " \
|
||||
"automatically at the right point."
|
||||
#endif /* */
|
||||
|
||||
#if (defined(PSA_WANT_ALG_TLS12_PRF) && \
|
||||
!defined(MBEDTLS_PSA_ACCEL_ALG_TLS12_PRF)) || \
|
||||
(defined(PSA_WANT_ALG_TLS12_PSK_TO_MS) && \
|
||||
!defined(MBEDTLS_PSA_ACCEL_ALG_TLS12_PSK_TO_MS)) || \
|
||||
(defined(PSA_WANT_ALG_HKDF) && \
|
||||
!defined(MBEDTLS_PSA_ACCEL_ALG_HKDF)) || \
|
||||
(defined(PSA_WANT_ALG_HKDF_EXTRACT) && \
|
||||
!defined(MBEDTLS_PSA_ACCEL_ALG_HKDF_EXTRACT)) || \
|
||||
(defined(PSA_WANT_ALG_HKDF_EXPAND) && \
|
||||
!defined(MBEDTLS_PSA_ACCEL_ALG_HKDF_EXPAND)) || \
|
||||
(defined(PSA_WANT_ALG_PBKDF2_HMAC) && \
|
||||
!defined(MBEDTLS_PSA_ACCEL_ALG_PBKDF2_HMAC))
|
||||
#define PSA_WANT_ALG_HMAC 1
|
||||
#define PSA_WANT_KEY_TYPE_HMAC 1
|
||||
#endif
|
||||
|
||||
#if (defined(PSA_WANT_ALG_PBKDF2_AES_CMAC_PRF_128) && \
|
||||
!defined(MBEDTLS_PSA_ACCEL_ALG_PBKDF2_AES_CMAC_PRF_128))
|
||||
#define PSA_WANT_KEY_TYPE_AES 1
|
||||
#define PSA_WANT_ALG_CMAC 1
|
||||
#endif
|
||||
|
||||
#endif /* PSA_CRYPTO_ADJUST_CONFIG_DEPENDENCIES_H */
|
||||
|
|
@ -2,6 +2,8 @@
|
|||
* \file psa/crypto_adjust_config_key_pair_types.h
|
||||
* \brief Adjust PSA configuration for key pair types.
|
||||
*
|
||||
* This is an internal header. Do not include it directly.
|
||||
*
|
||||
* See docs/proposed/psa-conditional-inclusion-c.md.
|
||||
* - Support non-basic operations in a keypair type implicitly enables basic
|
||||
* support for that keypair type.
|
||||
|
|
@ -19,6 +21,14 @@
|
|||
#ifndef PSA_CRYPTO_ADJUST_KEYPAIR_TYPES_H
|
||||
#define PSA_CRYPTO_ADJUST_KEYPAIR_TYPES_H
|
||||
|
||||
#if !defined(MBEDTLS_CONFIG_FILES_READ)
|
||||
#error "Do not include psa/crypto_adjust_*.h manually! This can lead to problems, " \
|
||||
"up to and including runtime errors such as buffer overflows. " \
|
||||
"If you're trying to fix a complaint from check_config.h, just remove " \
|
||||
"it from your configuration file: since Mbed TLS 3.0, it is included " \
|
||||
"automatically at the right point."
|
||||
#endif /* */
|
||||
|
||||
/*****************************************************************
|
||||
* ANYTHING -> BASIC
|
||||
****************************************************************/
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
* \file psa/crypto_adjust_config_synonyms.h
|
||||
* \brief Adjust PSA configuration: enable quasi-synonyms
|
||||
*
|
||||
* This is an internal header. Do not include it directly.
|
||||
*
|
||||
* When two features require almost the same code, we automatically enable
|
||||
* both when either one is requested, to reduce the combinatorics of
|
||||
* possible configurations.
|
||||
|
|
@ -14,6 +16,14 @@
|
|||
#ifndef PSA_CRYPTO_ADJUST_CONFIG_SYNONYMS_H
|
||||
#define PSA_CRYPTO_ADJUST_CONFIG_SYNONYMS_H
|
||||
|
||||
#if !defined(MBEDTLS_CONFIG_FILES_READ)
|
||||
#error "Do not include psa/crypto_adjust_*.h manually! This can lead to problems, " \
|
||||
"up to and including runtime errors such as buffer overflows. " \
|
||||
"If you're trying to fix a complaint from check_config.h, just remove " \
|
||||
"it from your configuration file: since Mbed TLS 3.0, it is included " \
|
||||
"automatically at the right point."
|
||||
#endif /* */
|
||||
|
||||
/****************************************************************/
|
||||
/* De facto synonyms */
|
||||
/****************************************************************/
|
||||
|
|
|
|||
|
|
@ -154,6 +154,14 @@ static inline void psa_clear_key_slot_number(
|
|||
* specified in \p attributes.
|
||||
*
|
||||
* \param[in] attributes The attributes of the existing key.
|
||||
* - The lifetime must be a persistent lifetime
|
||||
* in a secure element. Volatile lifetimes are
|
||||
* not currently supported.
|
||||
* - The key identifier must be in the valid
|
||||
* range for persistent keys.
|
||||
* - The key type and size must be specified and
|
||||
* must be consistent with the key material
|
||||
* in the secure element.
|
||||
*
|
||||
* \retval #PSA_SUCCESS
|
||||
* The key was successfully registered.
|
||||
|
|
@ -479,7 +487,7 @@ psa_status_t mbedtls_psa_external_get_random(
|
|||
* #PSA_KEY_ID_VENDOR_MIN and #PSA_KEY_ID_VENDOR_MAX and must not intersect
|
||||
* with any other set of implementation-chosen key identifiers.
|
||||
*
|
||||
* This value is part of the library's ABI since changing it would invalidate
|
||||
* This value is part of the library's API since changing it would invalidate
|
||||
* the values of built-in key identifiers in applications.
|
||||
*/
|
||||
#define MBEDTLS_PSA_KEY_ID_BUILTIN_MIN ((psa_key_id_t) 0x7fff0000)
|
||||
|
|
|
|||
|
|
@ -223,13 +223,36 @@ static inline struct psa_key_derivation_s psa_key_derivation_operation_init(
|
|||
return v;
|
||||
}
|
||||
|
||||
#ifndef __cplusplus
|
||||
struct psa_key_production_parameters_s {
|
||||
struct psa_custom_key_parameters_s {
|
||||
/* Future versions may add other fields in this structure. */
|
||||
uint32_t flags;
|
||||
};
|
||||
|
||||
/** The default production parameters for key generation or key derivation.
|
||||
*
|
||||
* Calling psa_generate_key_custom() or psa_key_derivation_output_key_custom()
|
||||
* with `custom=PSA_CUSTOM_KEY_PARAMETERS_INIT` and `custom_data_length=0` is
|
||||
* equivalent to calling psa_generate_key() or psa_key_derivation_output_key()
|
||||
* respectively.
|
||||
*/
|
||||
#define PSA_CUSTOM_KEY_PARAMETERS_INIT { 0 }
|
||||
|
||||
#ifndef __cplusplus
|
||||
/* Omitted when compiling in C++, because one of the parameters is a
|
||||
* pointer to a struct with a flexible array member, and that is not
|
||||
* standard C++.
|
||||
* https://github.com/Mbed-TLS/mbedtls/issues/9020
|
||||
*/
|
||||
/* This is a deprecated variant of `struct psa_custom_key_parameters_s`.
|
||||
* It has exactly the same layout, plus an extra field which is a flexible
|
||||
* array member. Thus a `const struct psa_key_production_parameters_s *`
|
||||
* can be passed to any function that reads a
|
||||
* `const struct psa_custom_key_parameters_s *`.
|
||||
*/
|
||||
struct psa_key_production_parameters_s {
|
||||
uint32_t flags;
|
||||
uint8_t data[];
|
||||
};
|
||||
#endif
|
||||
|
||||
/** The default production parameters for key generation or key derivation.
|
||||
*
|
||||
|
|
@ -240,6 +263,7 @@ struct psa_key_production_parameters_s {
|
|||
* respectively.
|
||||
*/
|
||||
#define PSA_KEY_PRODUCTION_PARAMETERS_INIT { 0 }
|
||||
#endif /* !__cplusplus */
|
||||
|
||||
struct psa_key_policy_s {
|
||||
psa_key_usage_t MBEDTLS_PRIVATE(usage);
|
||||
|
|
|
|||
|
|
@ -455,6 +455,30 @@ typedef uint64_t psa_key_slot_number_t;
|
|||
*/
|
||||
typedef uint16_t psa_key_derivation_step_t;
|
||||
|
||||
/** \brief Custom parameters for key generation or key derivation.
|
||||
*
|
||||
* This is a structure type with at least the following field:
|
||||
*
|
||||
* - \c flags: an unsigned integer type. 0 for the default production parameters.
|
||||
*
|
||||
* Functions that take such a structure as input also take an associated
|
||||
* input buffer \c custom_data of length \c custom_data_length.
|
||||
*
|
||||
* The interpretation of this structure and the associated \c custom_data
|
||||
* parameter depend on the type of the created key.
|
||||
*
|
||||
* - #PSA_KEY_TYPE_RSA_KEY_PAIR:
|
||||
* - \c flags: must be 0.
|
||||
* - \c custom_data: the public exponent, in little-endian order.
|
||||
* This must be an odd integer and must not be 1.
|
||||
* Implementations must support 65537, should support 3 and may
|
||||
* support other values.
|
||||
* When not using a driver, Mbed TLS supports values up to \c INT_MAX.
|
||||
* If this is empty, the default value 65537 is used.
|
||||
* - Other key types: reserved for future use. \c flags must be 0.
|
||||
*/
|
||||
typedef struct psa_custom_key_parameters_s psa_custom_key_parameters_t;
|
||||
|
||||
/** \brief Custom parameters for key generation or key derivation.
|
||||
*
|
||||
* This is a structure type with at least the following fields:
|
||||
|
|
@ -477,9 +501,7 @@ typedef uint16_t psa_key_derivation_step_t;
|
|||
* - Other key types: reserved for future use. \c flags must be 0.
|
||||
*
|
||||
*/
|
||||
#ifndef __cplusplus
|
||||
typedef struct psa_key_production_parameters_s psa_key_production_parameters_t;
|
||||
#endif
|
||||
|
||||
/**@}*/
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue