|
Mbed TLS v4.0.0
|
PSA cryptography module: Mbed TLS buffer size macros. More...
#include "tf-psa-crypto/build_info.h"

Go to the source code of this file.
PSA cryptography module: Mbed TLS buffer size macros.
This file contains the definitions of macros that are useful to compute buffer sizes. The signatures and semantics of these macros are standardized, but the definitions are not, because they depend on the available algorithms and, in some cases, on permitted tolerances on buffer sizes.
In implementations with isolation between the application and the cryptography module, implementers should take care to ensure that the definitions that are exposed to applications match what the module implements.
Macros that compute sizes whose values do not depend on the implementation are in crypto.h.
Definition in file crypto_sizes.h.
| #define PSA_AEAD_DECRYPT_OUTPUT_MAX_SIZE | ( | ciphertext_length | ) | (ciphertext_length) |
A sufficient output buffer size for psa_aead_decrypt(), for any of the supported key types and AEAD algorithms.
If the size of the plaintext buffer is at least this large, it is guaranteed that psa_aead_decrypt() will not fail due to an insufficient buffer size.
See also PSA_AEAD_DECRYPT_OUTPUT_SIZE(key_type, alg, ciphertext_length).
| ciphertext_length | Size of the ciphertext in bytes. |
Definition at line 426 of file crypto_sizes.h.
| #define PSA_AEAD_DECRYPT_OUTPUT_SIZE | ( | key_type, | |
| alg, | |||
| ciphertext_length | |||
| ) |
The maximum size of the output of psa_aead_decrypt(), in bytes.
If the size of the plaintext buffer is at least this large, it is guaranteed that psa_aead_decrypt() will not fail due to an insufficient buffer size. Depending on the algorithm, the actual size of the plaintext may be smaller.
See also PSA_AEAD_DECRYPT_OUTPUT_MAX_SIZE(ciphertext_length).
| key_type | A symmetric key type that is compatible with algorithm alg. |
| alg | An AEAD algorithm (PSA_ALG_XXX value such that PSA_ALG_IS_AEAD(alg) is true). |
| ciphertext_length | Size of the plaintext in bytes. |
Definition at line 402 of file crypto_sizes.h.
| #define PSA_AEAD_ENCRYPT_OUTPUT_MAX_SIZE | ( | plaintext_length | ) | ((plaintext_length) + PSA_AEAD_TAG_MAX_SIZE) |
A sufficient output buffer size for psa_aead_encrypt(), for any of the supported key types and AEAD algorithms.
If the size of the ciphertext buffer is at least this large, it is guaranteed that psa_aead_encrypt() will not fail due to an insufficient buffer size.
See also PSA_AEAD_ENCRYPT_OUTPUT_SIZE(key_type, alg, plaintext_length).
| plaintext_length | Size of the plaintext in bytes. |
Definition at line 372 of file crypto_sizes.h.
| #define PSA_AEAD_ENCRYPT_OUTPUT_SIZE | ( | key_type, | |
| alg, | |||
| plaintext_length | |||
| ) |
The maximum size of the output of psa_aead_encrypt(), in bytes.
If the size of the ciphertext buffer is at least this large, it is guaranteed that psa_aead_encrypt() will not fail due to an insufficient buffer size. Depending on the algorithm, the actual size of the ciphertext may be smaller.
See also PSA_AEAD_ENCRYPT_OUTPUT_MAX_SIZE(plaintext_length).
| key_type | A symmetric key type that is compatible with algorithm alg. |
| alg | An AEAD algorithm (PSA_ALG_XXX value such that PSA_ALG_IS_AEAD(alg) is true). |
| plaintext_length | Size of the plaintext in bytes. |
Definition at line 349 of file crypto_sizes.h.
| #define PSA_AEAD_FINISH_OUTPUT_MAX_SIZE (PSA_BLOCK_CIPHER_BLOCK_MAX_SIZE) |
A sufficient ciphertext buffer size for psa_aead_finish(), for any of the supported key types and AEAD algorithms.
See also PSA_AEAD_FINISH_OUTPUT_SIZE(key_type, alg).
Definition at line 558 of file crypto_sizes.h.
| #define PSA_AEAD_FINISH_OUTPUT_SIZE | ( | key_type, | |
| alg | |||
| ) |
A sufficient ciphertext buffer size for psa_aead_finish().
If the size of the ciphertext buffer is at least this large, it is guaranteed that psa_aead_finish() will not fail due to an insufficient ciphertext buffer size. The actual size of the output may be smaller in any given call.
See also PSA_AEAD_FINISH_OUTPUT_MAX_SIZE.
| key_type | A symmetric key type that is compatible with algorithm alg. |
| alg | An AEAD algorithm (PSA_ALG_XXX value such that PSA_ALG_IS_AEAD(alg) is true). |
Definition at line 547 of file crypto_sizes.h.
| #define PSA_AEAD_NONCE_LENGTH | ( | key_type, | |
| alg | |||
| ) |
The default nonce size for an AEAD algorithm, in bytes.
This macro can be used to allocate a buffer of sufficient size to store the nonce output from psa_aead_generate_nonce().
See also PSA_AEAD_NONCE_MAX_SIZE.
| key_type | A symmetric key type that is compatible with algorithm alg. |
| alg | An AEAD algorithm (PSA_ALG_XXX value such that PSA_ALG_IS_AEAD(alg) is true). |
Definition at line 454 of file crypto_sizes.h.
| #define PSA_AEAD_NONCE_MAX_SIZE 13u |
The maximum default nonce size among all supported pairs of key types and AEAD algorithms, in bytes.
This is equal to or greater than any value that PSA_AEAD_NONCE_LENGTH() may return.
Definition at line 474 of file crypto_sizes.h.
| #define PSA_AEAD_TAG_LENGTH | ( | key_type, | |
| key_bits, | |||
| alg | |||
| ) |
The length of a tag for an AEAD algorithm, in bytes.
This macro can be used to allocate a buffer of sufficient size to store the tag output from psa_aead_finish().
See also PSA_AEAD_TAG_MAX_SIZE.
| key_type | The type of the AEAD key. |
| key_bits | The size of the AEAD key in bits. |
| alg | An AEAD algorithm (PSA_ALG_XXX value such that PSA_ALG_IS_AEAD(alg) is true). |
Definition at line 181 of file crypto_sizes.h.
| #define PSA_AEAD_TAG_MAX_SIZE 16u |
The maximum tag size for all supported AEAD algorithms, in bytes.
See also PSA_AEAD_TAG_LENGTH(key_type, key_bits, alg).
Definition at line 190 of file crypto_sizes.h.
| #define PSA_AEAD_UPDATE_OUTPUT_MAX_SIZE | ( | input_length | ) | (PSA_ROUND_UP_TO_MULTIPLE(PSA_BLOCK_CIPHER_BLOCK_MAX_SIZE, (input_length))) |
A sufficient output buffer size for psa_aead_update(), for any of the supported key types and AEAD algorithms.
If the size of the output buffer is at least this large, it is guaranteed that psa_aead_update() will not fail due to an insufficient buffer size.
See also PSA_AEAD_UPDATE_OUTPUT_SIZE(key_type, alg, input_length).
| input_length | Size of the input in bytes. |
Definition at line 523 of file crypto_sizes.h.
| #define PSA_AEAD_UPDATE_OUTPUT_SIZE | ( | key_type, | |
| alg, | |||
| input_length | |||
| ) |
A sufficient output buffer size for psa_aead_update().
If the size of the output buffer is at least this large, it is guaranteed that psa_aead_update() will not fail due to an insufficient buffer size. The actual size of the output may be smaller in any given call.
See also PSA_AEAD_UPDATE_OUTPUT_MAX_SIZE(input_length).
| key_type | A symmetric key type that is compatible with algorithm alg. |
| alg | An AEAD algorithm (PSA_ALG_XXX value such that PSA_ALG_IS_AEAD(alg) is true). |
| input_length | Size of the input in bytes. |
Definition at line 506 of file crypto_sizes.h.
| #define PSA_AEAD_VERIFY_OUTPUT_MAX_SIZE (PSA_BLOCK_CIPHER_BLOCK_MAX_SIZE) |
A sufficient plaintext buffer size for psa_aead_verify(), for any of the supported key types and AEAD algorithms.
See also PSA_AEAD_VERIFY_OUTPUT_SIZE(key_type, alg).
Definition at line 592 of file crypto_sizes.h.
| #define PSA_AEAD_VERIFY_OUTPUT_SIZE | ( | key_type, | |
| alg | |||
| ) |
A sufficient plaintext buffer size for psa_aead_verify().
If the size of the plaintext buffer is at least this large, it is guaranteed that psa_aead_verify() will not fail due to an insufficient plaintext buffer size. The actual size of the output may be smaller in any given call.
See also PSA_AEAD_VERIFY_OUTPUT_MAX_SIZE.
| key_type | A symmetric key type that is compatible with algorithm alg. |
| alg | An AEAD algorithm (PSA_ALG_XXX value such that PSA_ALG_IS_AEAD(alg) is true). |
Definition at line 581 of file crypto_sizes.h.
| #define PSA_ASYMMETRIC_DECRYPT_OUTPUT_MAX_SIZE (PSA_BITS_TO_BYTES(PSA_VENDOR_RSA_MAX_KEY_BITS)) |
A sufficient output buffer size for psa_asymmetric_decrypt(), for any supported asymmetric decryption.
This macro assumes that RSA is the only supported asymmetric encryption.
See also PSA_ASYMMETRIC_DECRYPT_OUTPUT_SIZE(key_type, key_bits, alg).
Definition at line 739 of file crypto_sizes.h.
| #define PSA_ASYMMETRIC_DECRYPT_OUTPUT_SIZE | ( | key_type, | |
| key_bits, | |||
| alg | |||
| ) |
Sufficient output buffer size for psa_asymmetric_decrypt().
This macro returns a sufficient buffer size for a plaintext produced using a key of the specified type and size, with the specified algorithm. Note that the actual size of the plaintext may be smaller, depending on the algorithm.
| key_type | An asymmetric key type (this may indifferently be a key pair type or a public key type). |
| key_bits | The size of the key in bits. |
| alg | The asymmetric encryption algorithm. |
Definition at line 727 of file crypto_sizes.h.
| #define PSA_ASYMMETRIC_ENCRYPT_OUTPUT_MAX_SIZE (PSA_BITS_TO_BYTES(PSA_VENDOR_RSA_MAX_KEY_BITS)) |
A sufficient output buffer size for psa_asymmetric_encrypt(), for any supported asymmetric encryption.
See also PSA_ASYMMETRIC_ENCRYPT_OUTPUT_SIZE(key_type, key_bits, alg).
Definition at line 699 of file crypto_sizes.h.
| #define PSA_ASYMMETRIC_ENCRYPT_OUTPUT_SIZE | ( | key_type, | |
| key_bits, | |||
| alg | |||
| ) |
Sufficient output buffer size for psa_asymmetric_encrypt().
This macro returns a sufficient buffer size for a ciphertext produced using a key of the specified type and size, with the specified algorithm. Note that the actual size of the ciphertext may be smaller, depending on the algorithm.
| key_type | An asymmetric key type (this may indifferently be a key pair type or a public key type). |
| key_bits | The size of the key in bits. |
| alg | The asymmetric encryption algorithm. |
Definition at line 688 of file crypto_sizes.h.
| #define PSA_BITS_TO_BYTES | ( | bits | ) | (((bits) + 7u) / 8u) |
Definition at line 33 of file crypto_sizes.h.
| #define PSA_BLOCK_CIPHER_BLOCK_MAX_SIZE 16u |
The maximum size of a block cipher.
Definition at line 294 of file crypto_sizes.h.
| #define PSA_BYTES_TO_BITS | ( | bytes | ) | ((bytes) * 8u) |
Definition at line 34 of file crypto_sizes.h.
| #define PSA_CIPHER_DECRYPT_OUTPUT_MAX_SIZE | ( | input_length | ) | (input_length) |
A sufficient output buffer size for psa_cipher_decrypt(), for any of the supported key types and cipher algorithms.
If the size of the output buffer is at least this large, it is guaranteed that psa_cipher_decrypt() will not fail due to an insufficient buffer size.
See also PSA_CIPHER_DECRYPT_OUTPUT_SIZE(key_type, alg, input_length).
| input_length | Size of the input in bytes. |
Definition at line 1227 of file crypto_sizes.h.
| #define PSA_CIPHER_DECRYPT_OUTPUT_SIZE | ( | key_type, | |
| alg, | |||
| input_length | |||
| ) |
The maximum size of the output of psa_cipher_decrypt(), in bytes.
If the size of the output buffer is at least this large, it is guaranteed that psa_cipher_decrypt() will not fail due to an insufficient buffer size. Depending on the algorithm, the actual size of the output might be smaller.
See also PSA_CIPHER_DECRYPT_OUTPUT_MAX_SIZE(input_length).
| key_type | A symmetric key type that is compatible with algorithm alg. |
| alg | A cipher algorithm (PSA_ALG_XXX value such that PSA_ALG_IS_CIPHER(alg) is true). |
| input_length | Size of the input in bytes. |
Definition at line 1211 of file crypto_sizes.h.
| #define PSA_CIPHER_ENCRYPT_OUTPUT_MAX_SIZE | ( | input_length | ) |
A sufficient output buffer size for psa_cipher_encrypt(), for any of the supported key types and cipher algorithms.
If the size of the output buffer is at least this large, it is guaranteed that psa_cipher_encrypt() will not fail due to an insufficient buffer size.
See also PSA_CIPHER_ENCRYPT_OUTPUT_SIZE(key_type, alg, input_length).
| input_length | Size of the input in bytes. |
Definition at line 1187 of file crypto_sizes.h.
| #define PSA_CIPHER_ENCRYPT_OUTPUT_SIZE | ( | key_type, | |
| alg, | |||
| input_length | |||
| ) |
The maximum size of the output of psa_cipher_encrypt(), in bytes.
If the size of the output buffer is at least this large, it is guaranteed that psa_cipher_encrypt() will not fail due to an insufficient buffer size. Depending on the algorithm, the actual size of the output might be smaller.
See also PSA_CIPHER_ENCRYPT_OUTPUT_MAX_SIZE(input_length).
| key_type | A symmetric key type that is compatible with algorithm alg. |
| alg | A cipher algorithm (PSA_ALG_XXX value such that PSA_ALG_IS_CIPHER(alg) is true). |
| input_length | Size of the input in bytes. |
Definition at line 1166 of file crypto_sizes.h.
| #define PSA_CIPHER_FINISH_OUTPUT_MAX_SIZE (PSA_BLOCK_CIPHER_BLOCK_MAX_SIZE) |
A sufficient ciphertext buffer size for psa_cipher_finish(), for any of the supported key types and cipher algorithms.
See also PSA_CIPHER_FINISH_OUTPUT_SIZE(key_type, alg).
Definition at line 1301 of file crypto_sizes.h.
| #define PSA_CIPHER_FINISH_OUTPUT_SIZE | ( | key_type, | |
| alg | |||
| ) |
A sufficient ciphertext buffer size for psa_cipher_finish().
If the size of the ciphertext buffer is at least this large, it is guaranteed that psa_cipher_finish() will not fail due to an insufficient ciphertext buffer size. The actual size of the output might be smaller in any given call.
See also PSA_CIPHER_FINISH_OUTPUT_MAX_SIZE().
| key_type | A symmetric key type that is compatible with algorithm alg. |
| alg | A cipher algorithm (PSA_ALG_XXX value such that PSA_ALG_IS_CIPHER(alg) is true). |
Definition at line 1289 of file crypto_sizes.h.
| #define PSA_CIPHER_IV_LENGTH | ( | key_type, | |
| alg | |||
| ) |
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 the default IV length for the algorithm.
This macro can be used to allocate a buffer of sufficient size to store the IV output from psa_cipher_generate_iv() when using a multi-part cipher operation.
See also PSA_CIPHER_IV_MAX_SIZE.
| key_type | A symmetric key type that is compatible with algorithm alg. |
| alg | A cipher algorithm (PSA_ALG_XXX value such that PSA_ALG_IS_CIPHER(alg) is true). |
Definition at line 1124 of file crypto_sizes.h.
| #define PSA_CIPHER_IV_MAX_SIZE 16u |
The maximum IV size for all supported cipher algorithms, in bytes.
See also PSA_CIPHER_IV_LENGTH().
Definition at line 1141 of file crypto_sizes.h.
| #define PSA_CIPHER_MAX_KEY_LENGTH 32u |
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.
Definition at line 1095 of file crypto_sizes.h.
| #define PSA_CIPHER_UPDATE_OUTPUT_MAX_SIZE | ( | input_length | ) | (PSA_ROUND_UP_TO_MULTIPLE(PSA_BLOCK_CIPHER_BLOCK_MAX_SIZE, input_length)) |
A sufficient output buffer size for psa_cipher_update(), for any of the supported key types and cipher algorithms.
If the size of the output buffer is at least this large, it is guaranteed that psa_cipher_update() will not fail due to an insufficient buffer size.
See also PSA_CIPHER_UPDATE_OUTPUT_SIZE(key_type, alg, input_length).
| input_length | Size of the input in bytes. |
Definition at line 1269 of file crypto_sizes.h.
| #define PSA_CIPHER_UPDATE_OUTPUT_SIZE | ( | key_type, | |
| alg, | |||
| input_length | |||
| ) |
A sufficient output buffer size for psa_cipher_update().
If the size of the output buffer is at least this large, it is guaranteed that psa_cipher_update() will not fail due to an insufficient buffer size. The actual size of the output might be smaller in any given call.
See also PSA_CIPHER_UPDATE_OUTPUT_MAX_SIZE(input_length).
| key_type | A symmetric key type that is compatible with algorithm alg. |
| alg | A cipher algorithm (PSA_ALG_XXX value such that PSA_ALG_IS_CIPHER(alg) is true). |
| input_length | Size of the input in bytes. |
Definition at line 1248 of file crypto_sizes.h.
| #define PSA_ECDSA_SIGNATURE_SIZE | ( | curve_bits | ) | (PSA_BITS_TO_BYTES(curve_bits) * 2u) |
ECDSA signature size for a given curve bit size.
| curve_bits | Curve size in bits. |
Definition at line 607 of file crypto_sizes.h.
| #define PSA_EXPORT_KEY_OUTPUT_SIZE | ( | key_type, | |
| key_bits | |||
| ) |
Sufficient output buffer size for psa_export_key() or psa_export_public_key().
This macro returns a compile-time constant if its arguments are compile-time constants.
The following code illustrates how to allocate enough memory to export a key by querying the key type and size at runtime.
| key_type | A supported key type. |
| key_bits | The size of the key in bits. |
Definition at line 903 of file crypto_sizes.h.
| #define PSA_EXPORT_KEY_PAIR_MAX_SIZE 1 |
Sufficient buffer size for exporting any asymmetric key pair.
This macro expands to a compile-time constant integer. This value is a sufficient buffer size when calling psa_export_key() to export any asymmetric key pair, regardless of the exact key type and key size.
See also PSA_EXPORT_KEY_OUTPUT_SIZE(key_type, key_bits).
Definition at line 986 of file crypto_sizes.h.
| #define PSA_EXPORT_KEY_PAIR_MAX_SIZE PSA_KEY_EXPORT_ECC_KEY_PAIR_MAX_SIZE(PSA_VENDOR_ECC_MAX_CURVE_BITS) |
Sufficient buffer size for exporting any asymmetric key pair.
This macro expands to a compile-time constant integer. This value is a sufficient buffer size when calling psa_export_key() to export any asymmetric key pair, regardless of the exact key type and key size.
See also PSA_EXPORT_KEY_OUTPUT_SIZE(key_type, key_bits).
Definition at line 986 of file crypto_sizes.h.
| #define PSA_EXPORT_KEY_PAIR_MAX_SIZE PSA_KEY_EXPORT_RSA_KEY_PAIR_MAX_SIZE(PSA_VENDOR_RSA_MAX_KEY_BITS) |
Sufficient buffer size for exporting any asymmetric key pair.
This macro expands to a compile-time constant integer. This value is a sufficient buffer size when calling psa_export_key() to export any asymmetric key pair, regardless of the exact key type and key size.
See also PSA_EXPORT_KEY_OUTPUT_SIZE(key_type, key_bits).
Definition at line 986 of file crypto_sizes.h.
| #define PSA_EXPORT_KEY_PAIR_OR_PUBLIC_MAX_SIZE |
Definition at line 1030 of file crypto_sizes.h.
| #define PSA_EXPORT_PUBLIC_KEY_MAX_SIZE 1 |
Sufficient buffer size for exporting any asymmetric public key.
This macro expands to a compile-time constant integer. This value is a sufficient buffer size when calling psa_export_key() or psa_export_public_key() to export any asymmetric public key, regardless of the exact key type and key size.
See also PSA_EXPORT_PUBLIC_KEY_OUTPUT_SIZE(key_type, key_bits).
Definition at line 1026 of file crypto_sizes.h.
| #define PSA_EXPORT_PUBLIC_KEY_MAX_SIZE PSA_KEY_EXPORT_ECC_PUBLIC_KEY_MAX_SIZE(PSA_VENDOR_ECC_MAX_CURVE_BITS) |
Sufficient buffer size for exporting any asymmetric public key.
This macro expands to a compile-time constant integer. This value is a sufficient buffer size when calling psa_export_key() or psa_export_public_key() to export any asymmetric public key, regardless of the exact key type and key size.
See also PSA_EXPORT_PUBLIC_KEY_OUTPUT_SIZE(key_type, key_bits).
Definition at line 1026 of file crypto_sizes.h.
| #define PSA_EXPORT_PUBLIC_KEY_MAX_SIZE PSA_KEY_EXPORT_RSA_PUBLIC_KEY_MAX_SIZE(PSA_VENDOR_RSA_MAX_KEY_BITS) |
Sufficient buffer size for exporting any asymmetric public key.
This macro expands to a compile-time constant integer. This value is a sufficient buffer size when calling psa_export_key() or psa_export_public_key() to export any asymmetric public key, regardless of the exact key type and key size.
See also PSA_EXPORT_PUBLIC_KEY_OUTPUT_SIZE(key_type, key_bits).
Definition at line 1026 of file crypto_sizes.h.
| #define PSA_EXPORT_PUBLIC_KEY_MAX_SIZE PSA_KEY_EXPORT_FFDH_PUBLIC_KEY_MAX_SIZE(PSA_VENDOR_FFDH_MAX_KEY_BITS) |
Sufficient buffer size for exporting any asymmetric public key.
This macro expands to a compile-time constant integer. This value is a sufficient buffer size when calling psa_export_key() or psa_export_public_key() to export any asymmetric public key, regardless of the exact key type and key size.
See also PSA_EXPORT_PUBLIC_KEY_OUTPUT_SIZE(key_type, key_bits).
Definition at line 1026 of file crypto_sizes.h.
| #define PSA_EXPORT_PUBLIC_KEY_OUTPUT_SIZE | ( | key_type, | |
| key_bits | |||
| ) |
Sufficient output buffer size for psa_export_public_key().
This macro returns a compile-time constant if its arguments are compile-time constants.
The following code illustrates how to allocate enough memory to export a public key by querying the key type and size at runtime.
| key_type | A public key or key pair key type. |
| key_bits | The size of the key in bits. |
If the parameters are valid and supported, return the same result as PSA_EXPORT_KEY_OUTPUT_SIZE( PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(key_type), key_bits).
Definition at line 959 of file crypto_sizes.h.
| #define PSA_HASH_BLOCK_LENGTH | ( | alg | ) |
The input block size of a hash algorithm, in bytes.
Hash algorithms process their input data in blocks. Hash operations will retain any partial blocks until they have enough input to fill the block or until the operation is finished. This affects the output from psa_hash_suspend().
| alg | A hash algorithm (PSA_ALG_XXX value such that PSA_ALG_IS_HASH(alg) is true). |
Definition at line 85 of file crypto_sizes.h.
| #define PSA_HASH_LENGTH | ( | alg | ) |
The size of the output of psa_hash_finish(), in bytes.
This is also the hash size that psa_hash_verify() expects.
| alg | A hash algorithm (PSA_ALG_XXX value such that PSA_ALG_IS_HASH(alg) is true), or an HMAC algorithm (PSA_ALG_HMAC(hash_alg) where hash_alg is a hash algorithm). |
Definition at line 53 of file crypto_sizes.h.
| #define PSA_HASH_MAX_SIZE 64u |
Maximum size of a hash.
This macro expands to a compile-time constant integer. This value is the maximum size of a hash in bytes.
Definition at line 135 of file crypto_sizes.h.
| #define PSA_HMAC_MAX_HASH_BLOCK_SIZE 144u |
Definition at line 115 of file crypto_sizes.h.
| #define PSA_KEY_EXPORT_ASN1_INTEGER_MAX_SIZE | ( | bits | ) | ((bits) / 8u + 5u) |
Definition at line 752 of file crypto_sizes.h.
| #define PSA_KEY_EXPORT_DSA_KEY_PAIR_MAX_SIZE | ( | key_bits | ) | (PSA_KEY_EXPORT_ASN1_INTEGER_MAX_SIZE(key_bits) * 3u + 75u) |
Definition at line 829 of file crypto_sizes.h.
| #define PSA_KEY_EXPORT_DSA_PUBLIC_KEY_MAX_SIZE | ( | key_bits | ) | (PSA_KEY_EXPORT_ASN1_INTEGER_MAX_SIZE(key_bits) * 3u + 59u) |
Definition at line 810 of file crypto_sizes.h.
| #define PSA_KEY_EXPORT_ECC_KEY_PAIR_MAX_SIZE | ( | key_bits | ) | (PSA_BITS_TO_BYTES(key_bits)) |
Definition at line 849 of file crypto_sizes.h.
| #define PSA_KEY_EXPORT_ECC_PUBLIC_KEY_MAX_SIZE | ( | key_bits | ) | (2u * PSA_BITS_TO_BYTES(key_bits) + 1u) |
Definition at line 842 of file crypto_sizes.h.
| #define PSA_KEY_EXPORT_FFDH_KEY_PAIR_MAX_SIZE | ( | key_bits | ) | (PSA_BITS_TO_BYTES(key_bits)) |
Definition at line 856 of file crypto_sizes.h.
| #define PSA_KEY_EXPORT_FFDH_PUBLIC_KEY_MAX_SIZE | ( | key_bits | ) | (PSA_BITS_TO_BYTES(key_bits)) |
Definition at line 861 of file crypto_sizes.h.
| #define PSA_KEY_EXPORT_RSA_KEY_PAIR_MAX_SIZE | ( | key_bits | ) | (9u * PSA_KEY_EXPORT_ASN1_INTEGER_MAX_SIZE((key_bits) / 2u + 1u) + 14u) |
Definition at line 791 of file crypto_sizes.h.
| #define PSA_KEY_EXPORT_RSA_PUBLIC_KEY_MAX_SIZE | ( | key_bits | ) | (PSA_KEY_EXPORT_ASN1_INTEGER_MAX_SIZE(key_bits) + 11u) |
Definition at line 766 of file crypto_sizes.h.
| #define PSA_MAC_LENGTH | ( | key_type, | |
| key_bits, | |||
| alg | |||
| ) |
The size of the output of psa_mac_sign_finish(), in bytes.
This is also the MAC size that psa_mac_verify_finish() expects.
| key_type | The type of the MAC key. |
| key_bits | The size of the MAC key in bits. |
| alg | A MAC algorithm (PSA_ALG_XXX value such that PSA_ALG_IS_MAC(alg) is true). |
Definition at line 317 of file crypto_sizes.h.
| #define PSA_MAC_MAX_SIZE PSA_HASH_MAX_SIZE |
Maximum size of a MAC.
This macro expands to a compile-time constant integer. This value is the maximum size of a MAC in bytes.
Definition at line 158 of file crypto_sizes.h.
| #define PSA_MAX_OF_THREE | ( | a, | |
| b, | |||
| c | |||
| ) |
Definition at line 35 of file crypto_sizes.h.
| #define PSA_RAW_KEY_AGREEMENT_OUTPUT_MAX_SIZE 1 |
Maximum size of the output from psa_raw_key_agreement().
This macro expands to a compile-time constant integer. This value is the maximum size of the output any raw key agreement algorithm, in bytes.
See also PSA_RAW_KEY_AGREEMENT_OUTPUT_SIZE(key_type, key_bits).
Definition at line 1078 of file crypto_sizes.h.
| #define PSA_RAW_KEY_AGREEMENT_OUTPUT_MAX_SIZE PSA_BITS_TO_BYTES(PSA_VENDOR_ECC_MAX_CURVE_BITS) |
Maximum size of the output from psa_raw_key_agreement().
This macro expands to a compile-time constant integer. This value is the maximum size of the output any raw key agreement algorithm, in bytes.
See also PSA_RAW_KEY_AGREEMENT_OUTPUT_SIZE(key_type, key_bits).
Definition at line 1078 of file crypto_sizes.h.
| #define PSA_RAW_KEY_AGREEMENT_OUTPUT_MAX_SIZE PSA_BITS_TO_BYTES(PSA_VENDOR_FFDH_MAX_KEY_BITS) |
Maximum size of the output from psa_raw_key_agreement().
This macro expands to a compile-time constant integer. This value is the maximum size of the output any raw key agreement algorithm, in bytes.
See also PSA_RAW_KEY_AGREEMENT_OUTPUT_SIZE(key_type, key_bits).
Definition at line 1078 of file crypto_sizes.h.
| #define PSA_RAW_KEY_AGREEMENT_OUTPUT_SIZE | ( | key_type, | |
| key_bits | |||
| ) |
Sufficient output buffer size for psa_raw_key_agreement().
This macro returns a compile-time constant if its arguments are compile-time constants.
See also PSA_RAW_KEY_AGREEMENT_OUTPUT_MAX_SIZE.
| key_type | A supported key type. |
| key_bits | The size of the key in bits. |
Definition at line 1057 of file crypto_sizes.h.
| #define PSA_ROUND_UP_TO_MULTIPLE | ( | block_size, | |
| length | |||
| ) | (((length) + (block_size) - 1) / (block_size) * (block_size)) |
Definition at line 38 of file crypto_sizes.h.
| #define PSA_RSA_MINIMUM_PADDING_SIZE | ( | alg | ) |
Definition at line 594 of file crypto_sizes.h.
| #define PSA_SIGN_OUTPUT_SIZE | ( | key_type, | |
| key_bits, | |||
| alg | |||
| ) |
Sufficient signature buffer size for psa_sign_hash().
This macro returns a sufficient buffer size for a signature using a key of the specified type and size, with the specified algorithm. Note that the actual size of the signature may be smaller (some algorithms produce a variable-size signature).
| key_type | An asymmetric key type (this may indifferently be a key pair type or a public key type). |
| key_bits | The size of the key in bits. |
| alg | The signature algorithm. |
Definition at line 635 of file crypto_sizes.h.
| #define PSA_SIGNATURE_MAX_SIZE 1 |
Maximum size of an asymmetric signature.
This macro expands to a compile-time constant integer. This value is the maximum size of a signature in bytes.
Definition at line 660 of file crypto_sizes.h.
| #define PSA_SIGNATURE_MAX_SIZE PSA_VENDOR_ECDSA_SIGNATURE_MAX_SIZE |
Maximum size of an asymmetric signature.
This macro expands to a compile-time constant integer. This value is the maximum size of a signature in bytes.
Definition at line 660 of file crypto_sizes.h.
| #define PSA_SIGNATURE_MAX_SIZE PSA_BITS_TO_BYTES(PSA_VENDOR_RSA_MAX_KEY_BITS) |
Maximum size of an asymmetric signature.
This macro expands to a compile-time constant integer. This value is the maximum size of a signature in bytes.
Definition at line 660 of file crypto_sizes.h.
| #define PSA_TLS12_ECJPAKE_TO_PMS_DATA_SIZE 32u |
Definition at line 287 of file crypto_sizes.h.
| #define PSA_TLS12_ECJPAKE_TO_PMS_INPUT_SIZE 65u |
Definition at line 282 of file crypto_sizes.h.
| #define PSA_TLS12_PSK_TO_MS_PSK_MAX_SIZE 128u |
This macro returns the maximum supported length of the PSK for the TLS-1.2 PSK-to-MS key derivation (PSA_ALG_TLS12_PSK_TO_MS(hash_alg)).
The maximum supported length does not depend on the chosen hash algorithm.
Quoting RFC 4279, Sect 5.3: TLS implementations supporting these ciphersuites MUST support arbitrary PSK identities up to 128 octets in length, and arbitrary PSKs up to 64 octets in length. Supporting longer identities and keys is RECOMMENDED.
Therefore, no implementation should define a value smaller than 64 for PSA_TLS12_PSK_TO_MS_PSK_MAX_SIZE.
Definition at line 278 of file crypto_sizes.h.
| #define PSA_VENDOR_ECC_MAX_CURVE_BITS 521u |
Definition at line 238 of file crypto_sizes.h.
| #define PSA_VENDOR_ECDSA_SIGNATURE_MAX_SIZE PSA_ECDSA_SIGNATURE_SIZE(PSA_VENDOR_ECC_MAX_CURVE_BITS) |
Definition at line 640 of file crypto_sizes.h.
| #define PSA_VENDOR_FFDH_MAX_KEY_BITS 8192u |
Definition at line 222 of file crypto_sizes.h.
| #define PSA_VENDOR_PBKDF2_MAX_ITERATIONS 0xffffffffU |
Definition at line 291 of file crypto_sizes.h.
| #define PSA_VENDOR_RSA_GENERATE_MIN_KEY_BITS MBEDTLS_RSA_GEN_KEY_MIN_BITS |
Definition at line 214 of file crypto_sizes.h.
| #define PSA_VENDOR_RSA_MAX_KEY_BITS 4096u |
Definition at line 205 of file crypto_sizes.h.
1.8.6