Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DNM [nrf fromtree] mbedtls: align crypto_sizes.h to the Mbed TLS one #184

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions interface/include/psa/crypto_sizes.h
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +1100,10 @@
PSA_KEY_EXPORT_SRP_PUBLIC_KEY_MAX_SIZE(PSA_VENDOR_FFDH_MAX_KEY_BITS)
#endif

#define PSA_EXPORT_KEY_PAIR_OR_PUBLIC_MAX_SIZE \
((PSA_EXPORT_KEY_PAIR_MAX_SIZE > PSA_EXPORT_PUBLIC_KEY_MAX_SIZE) ? \
PSA_EXPORT_KEY_PAIR_MAX_SIZE : PSA_EXPORT_PUBLIC_KEY_MAX_SIZE)

/** Sufficient output buffer size for psa_raw_key_agreement().
*
* This macro returns a compile-time constant if its arguments are
Expand Down Expand Up @@ -1147,6 +1151,27 @@
#define PSA_RAW_KEY_AGREEMENT_OUTPUT_MAX_SIZE PSA_BITS_TO_BYTES(PSA_VENDOR_FFDH_MAX_KEY_BITS)
#endif

/** Maximum key length for ciphers.
*
* Since there is no additional PSA_WANT_xxx symbol to specifiy the size of
* the key once a cipher is enabled (as it happens for asymmetric keys for
* example), the maximum key length is taken into account for each cipher.
* The resulting value will be the maximum cipher's key length given depending
* on which ciphers are enabled.
*
* Note: max value for AES used below would be doubled if XTS were enabled, but
* this mode is currently not supported in Mbed TLS implementation of PSA
* APIs.
*/
#if (defined(PSA_WANT_KEY_TYPE_AES) || defined(PSA_WANT_KEY_TYPE_ARIA) || \
defined(PSA_WANT_KEY_TYPE_CAMELLIA) || defined(PSA_WANT_KEY_TYPE_CHACHA20))
#define PSA_CIPHER_MAX_KEY_LENGTH 32u
#elif defined(PSA_WANT_KEY_TYPE_DES)
#define PSA_CIPHER_MAX_KEY_LENGTH 24u
#else
#define PSA_CIPHER_MAX_KEY_LENGTH 0u
#endif

/** The default IV size for a cipher algorithm, in bytes.
*
* The IV that is generated as part of a call to #psa_cipher_encrypt() is always
Expand Down