Size definitions for PSA Crypto. More...
Size definitions for PSA Crypto.
Definition in file crypto_sizes.h.
Go to the source code of this file.
#define | PSA_BITS_TO_BYTES(bits) (size_t)(((bits) + 7) / 8) |
Functions to convert bits to bytes. | |
#define | PSA_BYTES_TO_BITS(bytes) ((bytes) * 8) |
Functions to convert bytes to bits. | |
#define | CONFIG_PSA_MAX_KEY_SIZE 0 |
Maximum key size in bytes, determined by the build system. | |
#define | CONFIG_PSA_ASYMMETRIC_KEYPAIR_COUNT 0 |
Number of required allocated asymmetric key pair slots. | |
#define | CONFIG_PSA_SINGLE_KEY_COUNT 0 |
Number of required allocated single key slots. | |
#define | CONFIG_PSA_PROTECTED_KEY_COUNT 0 |
Number of required allocated protected key slots. | |
#define | PSA_AEAD_DECRYPT_OUTPUT_MAX_SIZE(ciphertext_length) /* implementation-defined value */ |
A sufficient plaintext buffer size for psa_aead_decrypt(), for any of the supported key types and AEAD algorithms. | |
#define | PSA_AEAD_DECRYPT_OUTPUT_SIZE(key_type, alg, ciphertext_length) /* implementation-defined value */ |
A sufficient plaintext buffer size for psa_aead_decrypt(), in bytes. | |
#define | PSA_AEAD_ENCRYPT_OUTPUT_MAX_SIZE(plaintext_length) /* implementation-defined value */ |
A sufficient ciphertext buffer size for psa_aead_encrypt(), for any of the supported key types and AEAD algorithms. | |
#define | PSA_AEAD_ENCRYPT_OUTPUT_SIZE(key_type, alg, plaintext_length) /* implementation-defined value */ |
A sufficient ciphertext buffer size for psa_aead_encrypt(), in bytes. | |
#define | PSA_AEAD_FINISH_OUTPUT_MAX_SIZE /* implementation-defined value */ |
A sufficient ciphertext buffer size for psa_aead_finish(), for any of the supported key types and AEAD algorithms. | |
#define | PSA_AEAD_FINISH_OUTPUT_SIZE(key_type, alg) /* implementation-defined value */ |
A sufficient ciphertext buffer size for psa_aead_finish(). | |
#define | PSA_AEAD_NONCE_LENGTH(key_type, alg) /* implementation-defined value */ |
The default nonce size for an AEAD algorithm, in bytes. | |
#define | PSA_AEAD_NONCE_MAX_SIZE /* implementation-defined value */ |
A sufficient buffer size for storing the nonce generated by psa_aead_generate_nonce(), for any of the supported key types and AEAD algorithms. | |
#define | PSA_AEAD_TAG_LENGTH(key_type, key_bits, alg) /* implementation-defined value */ |
The length of a tag for an AEAD algorithm, in bytes. | |
#define | PSA_AEAD_TAG_MAX_SIZE /* implementation-defined value */ |
A sufficient buffer size for storing the tag output by psa_aead_finish(), for any of the supported key types and AEAD algorithms. | |
#define | PSA_AEAD_UPDATE_OUTPUT_MAX_SIZE(input_length) /* implementation-defined value */ |
A sufficient output buffer size for psa_aead_update(), for any of the supported key types and AEAD algorithms. | |
#define | PSA_AEAD_UPDATE_OUTPUT_SIZE(key_type, alg, input_length) /* implementation-defined value */ |
A sufficient output buffer size for psa_aead_update(). | |
#define | PSA_AEAD_VERIFY_OUTPUT_MAX_SIZE /* implementation-defined value */ |
A sufficient output buffer size for psa_aead_update(), for any of the supported key types and AEAD algorithms. | |
#define | PSA_AEAD_VERIFY_OUTPUT_SIZE(key_type, alg) /* implementation-defined value */ |
A sufficient plaintext buffer size for psa_aead_verify(), in bytes. | |
#define | PSA_HASH_MAX_SIZE (64) |
Maximum size of a hash supported by this implementation, in bytes. | |
#define | PSA_HASH_BLOCK_LENGTH(alg) |
The input block size of a hash algorithm, in bytes. | |
#define | PSA_HASH_LENGTH(alg) |
The size of the output of psa_hash_compute() and psa_hash_finish(), in bytes. | |
#define | PSA_MAC_LENGTH(key_type, key_bits, alg) |
The size of the output of psa_mac_compute() and psa_mac_sign_finish(), in bytes. | |
#define | PSA_MAC_MAX_SIZE 0 |
A sufficient buffer size for storing the MAC output by psa_mac_verify() and psa_mac_verify_finish(), for any of the supported key types and MAC algorithms. | |
#define | PSA_BLOCK_CIPHER_BLOCK_LENGTH(type) (1u << (((type) >> 8) & 7)) |
The block size of a block cipher. | |
#define | PSA_BLOCK_CIPHER_BLOCK_MAX_SIZE /* implementation-defined value */ |
The maximum block size of a block cipher supported by the implementation. | |
#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. | |
#define | PSA_CIPHER_DECRYPT_OUTPUT_SIZE(key_type, alg, input_length) (input_length - PSA_CIPHER_IV_LENGTH(key_type, alg)) |
The maximum size of the output of psa_cipher_decrypt(), in bytes. | |
#define | PSA_CIPHER_ENCRYPT_OUTPUT_MAX_SIZE(input_length) (PSA_CIPHER_ENCRYPT_OUTPUT_SIZE(PSA_KEY_TYPE_AES, PSA_ALG_CBC_NO_PADDING, input_length)) |
A sufficient output buffer size for psa_cipher_encrypt(), for any of the supported key types and cipher algorithms. | |
#define | PSA_CIPHER_ENCRYPT_OUTPUT_SIZE(key_type, alg, input_length) (input_length + PSA_CIPHER_IV_LENGTH(key_type, alg)) |
The maximum size of the output of psa_cipher_encrypt(), in bytes. | |
#define | PSA_CIPHER_FINISH_OUTPUT_MAX_SIZE /* implementation-defined value */ |
A sufficient output buffer size for psa_cipher_finish(), for any of the supported key types and cipher algorithms. | |
#define | PSA_CIPHER_FINISH_OUTPUT_SIZE(key_type, alg) /* implementation-defined value */ |
A sufficient output buffer size for psa_cipher_finish(). | |
#define | PSA_CIPHER_IV_LENGTH(key_type, alg) |
The default IV size for a cipher algorithm, in bytes. | |
#define | PSA_CIPHER_IV_MAX_SIZE /* implementation-defined value */ |
A sufficient buffer size for storing the IV generated by psa_cipher_generate_iv(), for any of the supported key types and cipher algorithms. | |
#define | PSA_CIPHER_UPDATE_OUTPUT_MAX_SIZE(input_length) /* implementation-defined value */ |
A sufficient output buffer size for psa_cipher_update(), for any of the supported key types and cipher algorithms. | |
#define | PSA_CIPHER_UPDATE_OUTPUT_SIZE(key_type, alg, input_length) /* implementation-defined value */ |
A sufficient output buffer size for psa_cipher_update(). | |
#define | PSA_HASH_SUSPEND_ALGORITHM_FIELD_LENGTH ((size_t)4) |
The size of the algorithm field that is part of the output of psa_hash_suspend(), in bytes. | |
#define | PSA_HASH_SUSPEND_HASH_STATE_FIELD_LENGTH(alg) /* specification-defined value */ |
The size of the hash-state field that is part of the output of psa_hash_suspend(), in bytes. | |
#define | PSA_HASH_SUSPEND_INPUT_LENGTH_FIELD_LENGTH(alg) /* specification-defined value */ |
The size of the input-length field that is part of the output of psa_hash_suspend(), in bytes. | |
#define | PSA_HASH_SUSPEND_OUTPUT_MAX_SIZE /* implementation-defined value */ |
A sufficient hash suspend state buffer size for psa_hash_suspend(), for any supported hash algorithms. | |
#define | PSA_HASH_SUSPEND_OUTPUT_SIZE(alg) /* specification-defined value */ |
A sufficient hash suspend state buffer size for psa_hash_suspend(), in bytes. | |
#define | PSA_ASYMMETRIC_DECRYPT_OUTPUT_MAX_SIZE /* implementation-defined value */ |
A sufficient output buffer size for psa_asymmetric_decrypt(), for any of the supported key types and asymmetric encryption algorithms. | |
#define | PSA_ASYMMETRIC_DECRYPT_OUTPUT_SIZE(key_type, key_bits, alg) /* implementation-defined value */ |
Sufficient output buffer size for psa_asymmetric_decrypt(). | |
#define | PSA_ASYMMETRIC_ENCRYPT_OUTPUT_MAX_SIZE /* implementation-defined value */ |
A sufficient output buffer size for psa_asymmetric_encrypt(), for any of the supported key types and asymmetric encryption algorithms. | |
#define | PSA_ASYMMETRIC_ENCRYPT_OUTPUT_SIZE(key_type, key_bits, alg) /* implementation-defined value */ |
Sufficient output buffer size for psa_asymmetric_encrypt(). | |
#define | PSA_KEY_EXPORT_ECC_KEY_MAX_SIZE(key_type, key_bits) |
Maximum size of the export encoding of an ECC keypair. | |
#define | PSA_EXPORT_KEY_OUTPUT_SIZE(key_type, key_bits) |
Sufficient output buffer size for psa_export_key(). | |
#define | PSA_ECC_KEY_SIZE_IS_VALID(type, bits) |
Check whether the key size is a valid ECC size for key type. | |
#define | PSA_MAX_PRIV_KEY_SIZE (PSA_BYTES_TO_BITS(CONFIG_PSA_MAX_KEY_SIZE)) |
The maximum size of an asymmetric private key. | |
#define | PSA_EXPORT_KEY_PAIR_MAX_SIZE 0 |
Sufficient buffer size for exporting any asymmetric key pair. | |
#define | PSA_KEY_EXPORT_ECC_PUBLIC_KEY_MAX_SIZE(key_type, key_bits) |
Maximum size of the export encoding of an ECC public key. | |
#define | PSA_EXPORT_PUBLIC_KEY_OUTPUT_SIZE(key_type, key_bits) |
Sufficient output buffer size for psa_export_public_key(). | |
#define | PSA_EXPORT_PUBLIC_KEY_MAX_SIZE 0 |
Sufficient buffer size for exporting any asymmetric public key. | |
#define | PSA_MAX_PRIV_KEY_BUFFER_SIZE (PSA_BITS_TO_BYTES(PSA_MAX_PRIV_KEY_SIZE)) |
The maximum size of an asymmetric private key buffer. | |
#define | PSA_MAX_ASYMMETRIC_KEYPAIR_SIZE |
The maximum size of an asymmetric private key pair. | |
#define | PSA_MAX_KEY_DATA_SIZE (CONFIG_PSA_MAX_KEY_SIZE) |
The maximum size of the used key data. | |
#define | PSA_MAX_UNSTRUCTURED_KEY_SIZE (CONFIG_PSA_MAX_KEY_SIZE) |
The maximum size of an unstructured key. | |
#define | PSA_ECDSA_SIGNATURE_SIZE(curve_bits) ((size_t)(PSA_BITS_TO_BYTES(curve_bits) * 2)) |
ECDSA signature size for a given curve bit size. | |
#define | PSA_SIGN_OUTPUT_SIZE(key_type, key_bits, alg) |
Sufficient signature buffer size for psa_sign_message() and psa_sign_hash(). | |
#define CONFIG_PSA_ASYMMETRIC_KEYPAIR_COUNT 0 |
Number of required allocated asymmetric key pair slots.
These should be defined by the developer to fit their requirements. The default number is 0.
Definition at line 84 of file crypto_sizes.h.
#define CONFIG_PSA_MAX_KEY_SIZE 0 |
Maximum key size in bytes, determined by the build system.
The maximum key size is set automatically, depending on the features chosen at compile-time. They should not be changed manually.
Definition at line 74 of file crypto_sizes.h.
#define CONFIG_PSA_PROTECTED_KEY_COUNT 0 |
Number of required allocated protected key slots.
These should be defined by the developer to fit their requirements. The default number is 5.
Definition at line 107 of file crypto_sizes.h.
#define CONFIG_PSA_SINGLE_KEY_COUNT 0 |
Number of required allocated single key slots.
These should be defined by the developer to fit their requirements. The default number is 0.
Definition at line 94 of file crypto_sizes.h.
#define PSA_AEAD_DECRYPT_OUTPUT_MAX_SIZE | ( | ciphertext_length | ) | /* implementation-defined value */ |
A sufficient plaintext 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().
ciphertext_length | Size of the ciphertext in bytes. |
Definition at line 123 of file crypto_sizes.h.
#define PSA_AEAD_DECRYPT_OUTPUT_SIZE | ( | key_type, | |
alg, | |||
ciphertext_length | |||
) | /* implementation-defined value */ |
A sufficient plaintext buffer size for 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 might be smaller.
See also PSA_AEAD_DECRYPT_OUTPUT_MAX_SIZE.
key_type | A symmetric key type that is compatible with algorithm alg. |
alg | An AEAD algorithm: a value of type psa_algorithm_t such that PSA_ALG_IS_AEAD(alg ) is true. |
ciphertext_length | Size of the ciphertext in bytes. |
Definition at line 144 of file crypto_sizes.h.
#define PSA_AEAD_ENCRYPT_OUTPUT_MAX_SIZE | ( | plaintext_length | ) | /* implementation-defined value */ |
A sufficient ciphertext 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().
plaintext_length | Size of the plaintext in bytes. |
Definition at line 159 of file crypto_sizes.h.
#define PSA_AEAD_ENCRYPT_OUTPUT_SIZE | ( | key_type, | |
alg, | |||
plaintext_length | |||
) | /* implementation-defined value */ |
A sufficient ciphertext buffer size for 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 might be smaller.
See also PSA_AEAD_ENCRYPT_OUTPUT_MAX_SIZE.
key_type | A symmetric key type that is compatible with algorithm alg. |
alg | An AEAD algorithm: a value of type psa_algorithm_t such that PSA_ALG_IS_AEAD(alg) is true. |
plaintext_length | Size of the plaintext in bytes. |
Definition at line 180 of file crypto_sizes.h.
#define PSA_AEAD_FINISH_OUTPUT_MAX_SIZE /* implementation-defined value */ |
A sufficient ciphertext buffer size for psa_aead_finish(), 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_finish() will not fail due to an insufficient ciphertext buffer size.
See also PSA_AEAD_FINISH_OUTPUT_SIZE().
Definition at line 192 of file crypto_sizes.h.
#define PSA_AEAD_FINISH_OUTPUT_SIZE | ( | key_type, | |
alg | |||
) | /* implementation-defined value */ |
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 might 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: a value of type psa_algorithm_t such that PSA_ALG_IS_AEAD(alg ) is true. |
Definition at line 212 of file crypto_sizes.h.
#define PSA_AEAD_NONCE_LENGTH | ( | key_type, | |
alg | |||
) | /* implementation-defined value */ |
The default nonce size for an AEAD algorithm, in bytes.
If the size of the nonce buffer is at least this large, it is guaranteed that psa_aead_generate_nonce() will not fail due to an insufficient buffer size.
For most AEAD algorithms, PSA_AEAD_NONCE_LENGTH() evaluates to the exact size of the nonce generated by 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: a value of type psa_algorithm_t such that PSA_ALG_IS_AEAD(alg ) is true. |
Definition at line 234 of file crypto_sizes.h.
#define PSA_AEAD_NONCE_MAX_SIZE /* implementation-defined value */ |
A sufficient buffer size for storing the nonce generated by psa_aead_generate_nonce(), for any of the supported key types and AEAD algorithms.
If the size of the nonce buffer is at least this large, it is guaranteed that psa_aead_generate_nonce() will not fail due to an insufficient buffer size.
See also PSA_AEAD_NONCE_LENGTH().
Definition at line 245 of file crypto_sizes.h.
#define PSA_AEAD_TAG_LENGTH | ( | key_type, | |
key_bits, | |||
alg | |||
) | /* implementation-defined value */ |
The length of a tag for an AEAD algorithm, in bytes.
This is the size of the tag output from psa_aead_finish(). If the size of the tag buffer is at least this large, it is guaranteed that psa_aead_finish() will not fail due to an insufficient tag buffer size.
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: a value of type psa_algorithm_t such that PSA_ALG_IS_AEAD(alg ) is true. |
Definition at line 266 of file crypto_sizes.h.
#define PSA_AEAD_TAG_MAX_SIZE /* implementation-defined value */ |
A sufficient buffer size for storing the tag output by psa_aead_finish(), for any of the supported key types and AEAD algorithms.
If the size of the tag buffer is at least this large, it is guaranteed that psa_aead_finish() will not fail due to an insufficient buffer size.
See also PSA_AEAD_TAG_LENGTH().
Definition at line 278 of file crypto_sizes.h.
#define PSA_AEAD_UPDATE_OUTPUT_MAX_SIZE | ( | input_length | ) | /* implementation-defined value */ |
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().
input_length | Size of the input in bytes. |
Definition at line 291 of file crypto_sizes.h.
#define PSA_AEAD_UPDATE_OUTPUT_SIZE | ( | key_type, | |
alg, | |||
input_length | |||
) | /* implementation-defined value */ |
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 might be smaller in any given call.
See also PSA_AEAD_UPDATE_OUTPUT_MAX_SIZE.
key_type | A symmetric key type that is compatible with algorithm alg. |
alg | An AEAD algorithm: a value of type psa_algorithm_t such that PSA_ALG_IS_AEAD(alg ) is true. |
input_length | Size of the input in bytes. |
Definition at line 312 of file crypto_sizes.h.
#define PSA_AEAD_VERIFY_OUTPUT_MAX_SIZE /* implementation-defined value */ |
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().
input_length | Size of the input in bytes. |
Definition at line 326 of file crypto_sizes.h.
#define PSA_AEAD_VERIFY_OUTPUT_SIZE | ( | key_type, | |
alg | |||
) | /* implementation-defined value */ |
A sufficient plaintext buffer size for psa_aead_verify(), in bytes.
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 might 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: a value of type psa_algorithm_t such that PSA_ALG_IS_AEAD(alg ) is true. |
Definition at line 345 of file crypto_sizes.h.
#define PSA_ASYMMETRIC_DECRYPT_OUTPUT_MAX_SIZE /* implementation-defined value */ |
A sufficient output buffer size for psa_asymmetric_decrypt(), for any of the supported key types and asymmetric encryption algorithms.
If the size of the output buffer is at least this large, it is guaranteed that psa_asymmetric_decrypt() will not fail due to an insufficient buffer size.
See also PSA_ASYMMETRIC_DECRYPT_OUTPUT_SIZE().
Definition at line 776 of file crypto_sizes.h.
#define PSA_ASYMMETRIC_DECRYPT_OUTPUT_SIZE | ( | key_type, | |
key_bits, | |||
alg | |||
) | /* implementation-defined value */ |
Sufficient output buffer size for psa_asymmetric_decrypt().
If the size of the output buffer is at least this large, it is guaranteed that psa_asymmetric_decrypt() 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_ASYMMETRIC_DECRYPT_OUTPUT_MAX_SIZE.
key_type | An asymmetric key type, either a key pair or a public key. |
key_bits | The size of the key in bits. |
alg | An asymmetric encryption algorithm: a value of type psa_algorithm_t such that PSA_ALG_IS_ASYMMETRIC_ENCRYPTION(alg ) is true. |
Definition at line 798 of file crypto_sizes.h.
#define PSA_ASYMMETRIC_ENCRYPT_OUTPUT_MAX_SIZE /* implementation-defined value */ |
A sufficient output buffer size for psa_asymmetric_encrypt(), for any of the supported key types and asymmetric encryption algorithms.
If the size of the output buffer is at least this large, it is guaranteed that psa_asymmetric_encrypt() will not fail due to an insufficient buffer size.
See also PSA_ASYMMETRIC_ENCRYPT_OUTPUT_SIZE().
Definition at line 810 of file crypto_sizes.h.
#define PSA_ASYMMETRIC_ENCRYPT_OUTPUT_SIZE | ( | key_type, | |
key_bits, | |||
alg | |||
) | /* implementation-defined value */ |
Sufficient output buffer size for psa_asymmetric_encrypt().
If the size of the output buffer is at least this large, it is guaranteed that psa_asymmetric_encrypt() 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_ASYMMETRIC_ENCRYPT_OUTPUT_MAX_SIZE.
key_type | An asymmetric key type, either a key pair or a public key. |
key_bits | The size of the key in bits. |
alg | An asymmetric encryption algorithm: a value of type psa_algorithm_t such that PSA_ALG_IS_ASYMMETRIC_ENCRYPTION(alg ) is true. |
Definition at line 831 of file crypto_sizes.h.
#define PSA_BITS_TO_BYTES | ( | bits | ) | (size_t)(((bits) + 7) / 8) |
Functions to convert bits to bytes.
bits |
Definition at line 42 of file crypto_sizes.h.
#define PSA_BLOCK_CIPHER_BLOCK_LENGTH | ( | type | ) | (1u << (((type) >> 8) & 7)) |
The block size of a block cipher.
type | A cipher key type (value of type psa_key_type_t). |
Definition at line 497 of file crypto_sizes.h.
#define PSA_BLOCK_CIPHER_BLOCK_MAX_SIZE /* implementation-defined value */ |
The maximum block size of a block cipher supported by the implementation.
See also PSA_BLOCK_CIPHER_BLOCK_LENGTH().
Definition at line 505 of file crypto_sizes.h.
#define PSA_BYTES_TO_BITS | ( | bytes | ) | ((bytes) * 8) |
Functions to convert bytes to bits.
bytes |
Definition at line 51 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().
input_length | Size of the input in bytes. |
Definition at line 518 of file crypto_sizes.h.
#define PSA_CIPHER_DECRYPT_OUTPUT_SIZE | ( | key_type, | |
alg, | |||
input_length | |||
) | (input_length - PSA_CIPHER_IV_LENGTH(key_type, alg)) |
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.
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 539 of file crypto_sizes.h.
#define PSA_CIPHER_ENCRYPT_OUTPUT_MAX_SIZE | ( | input_length | ) | (PSA_CIPHER_ENCRYPT_OUTPUT_SIZE(PSA_KEY_TYPE_AES, PSA_ALG_CBC_NO_PADDING, 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().
input_length | Size of the input in bytes. |
Definition at line 553 of file crypto_sizes.h.
#define PSA_CIPHER_ENCRYPT_OUTPUT_SIZE | ( | key_type, | |
alg, | |||
input_length | |||
) | (input_length + PSA_CIPHER_IV_LENGTH(key_type, alg)) |
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.
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 574 of file crypto_sizes.h.
#define PSA_CIPHER_FINISH_OUTPUT_MAX_SIZE /* implementation-defined value */ |
A sufficient output buffer size for psa_cipher_finish(), 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_finish() will not fail due to an insufficient buffer size.
See also PSA_CIPHER_FINISH_OUTPUT_SIZE().
Definition at line 586 of file crypto_sizes.h.
#define PSA_CIPHER_FINISH_OUTPUT_SIZE | ( | key_type, | |
alg | |||
) | /* implementation-defined value */ |
A sufficient output buffer size for psa_cipher_finish().
If the size of the output buffer is at least this large, it is guaranteed that psa_cipher_finish() 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_FINISH_OUTPUT_MAX_SIZE.
key_type | A symmetric key type that is compatible with algorithm alg. |
alg | A cipher algorithm: a value of type psa_algorithm_t such that PSA_ALG_IS_CIPHER(alg ) is true. |
Definition at line 605 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 634 of file crypto_sizes.h.
#define PSA_CIPHER_IV_MAX_SIZE /* implementation-defined value */ |
A sufficient buffer size for storing the IV generated by psa_cipher_generate_iv(), for any of the supported key types and cipher algorithms.
If the size of the IV buffer is at least this large, it is guaranteed that psa_cipher_generate_iv() will not fail due to an insufficient buffer size.
See also PSA_CIPHER_IV_LENGTH().
Definition at line 648 of file crypto_sizes.h.
#define PSA_CIPHER_UPDATE_OUTPUT_MAX_SIZE | ( | input_length | ) | /* implementation-defined value */ |
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().
input_length | Size of the input in bytes. |
Definition at line 662 of file crypto_sizes.h.
#define PSA_CIPHER_UPDATE_OUTPUT_SIZE | ( | key_type, | |
alg, | |||
input_length | |||
) | /* implementation-defined value */ |
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.
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 684 of file crypto_sizes.h.
#define PSA_ECC_KEY_SIZE_IS_VALID | ( | type, | |
bits | |||
) |
Check whether the key size is a valid ECC size for key type.
type | key type of of type psa_key_type_t |
bits | Key size of type psa_key_bits_t |
Definition at line 897 of file crypto_sizes.h.
#define PSA_ECDSA_SIGNATURE_SIZE | ( | curve_bits | ) | ((size_t)(PSA_BITS_TO_BYTES(curve_bits) * 2)) |
ECDSA signature size for a given curve bit size.
curve_bits | Curve size in bits. |
Definition at line 1056 of file crypto_sizes.h.
#define PSA_EXPORT_KEY_OUTPUT_SIZE | ( | key_type, | |
key_bits | |||
) |
Sufficient output buffer size for psa_export_key().
The following code illustrates how to allocate enough memory to export a key by querying the key type and size at runtime.
See also PSA_EXPORT_KEY_PAIR_MAX_SIZE and PSA_EXPORT_PUBLIC_KEY_MAX_SIZE.
key_type | A supported key type. |
key_bits | The size of the key in bits. |
Definition at line 886 of file crypto_sizes.h.
#define PSA_EXPORT_KEY_PAIR_MAX_SIZE 0 |
Sufficient buffer size for exporting any asymmetric key pair.
This value must be a sufficient buffer size when calling psa_export_key() to export any asymmetric key pair that is supported by the implementation, regardless of the exact key type and key size.
See also PSA_EXPORT_KEY_OUTPUT_SIZE().
Definition at line 933 of file crypto_sizes.h.
#define PSA_EXPORT_PUBLIC_KEY_MAX_SIZE 0 |
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 1017 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. |
key_type
), key_bits
). Definition at line 992 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: a value of type psa_algorithm_t such that PSA_ALG_IS_HASH(alg ) is true. |
Definition at line 371 of file crypto_sizes.h.
#define PSA_HASH_LENGTH | ( | alg | ) |
The size of the output of psa_hash_compute() and psa_hash_finish(), in bytes.
This is also the hash length that psa_hash_compare() and psa_hash_verify() expect.
See also PSA_HASH_MAX_SIZE.
alg | A hash algorithm or an HMAC algorithm: a value of type psa_algorithm_t such that (PSA_ALG_IS_HASH(alg ) || PSA_ALG_IS_HMAC(alg )) is true. |
Definition at line 404 of file crypto_sizes.h.
#define PSA_HASH_MAX_SIZE (64) |
Maximum size of a hash supported by this implementation, in bytes.
See also @ref PSA_HASH_LENGTH().
Definition at line 353 of file crypto_sizes.h.
#define PSA_HASH_SUSPEND_ALGORITHM_FIELD_LENGTH ((size_t)4) |
The size of the algorithm field that is part of the output of psa_hash_suspend(), in bytes.
Applications can use this value to unpack the hash suspend state that is output by psa_hash_suspend().
Definition at line 694 of file crypto_sizes.h.
#define PSA_HASH_SUSPEND_HASH_STATE_FIELD_LENGTH | ( | alg | ) | /* specification-defined value */ |
The size of the hash-state field that is part of the output of psa_hash_suspend(), in bytes.
Applications can use this value to unpack the hash suspend state that is output by psa_hash_suspend().
alg | A hash algorithm: a value of type psa_algorithm_t such that PSA_ALG_IS_HASH(alg ) is true. |
Definition at line 710 of file crypto_sizes.h.
#define PSA_HASH_SUSPEND_INPUT_LENGTH_FIELD_LENGTH | ( | alg | ) | /* specification-defined value */ |
The size of the input-length field that is part of the output of psa_hash_suspend(), in bytes.
Applications can use this value to unpack the hash suspend state that is output by psa_hash_suspend().
alg | A hash algorithm: a value of type psa_algorithm_t such that PSA_ALG_IS_HASH(alg ) is true. |
Definition at line 727 of file crypto_sizes.h.
#define PSA_HASH_SUSPEND_OUTPUT_MAX_SIZE /* implementation-defined value */ |
A sufficient hash suspend state buffer size for psa_hash_suspend(), for any supported hash algorithms.
If the size of the hash state buffer is at least this large, it is guaranteed that psa_hash_suspend() will not fail due to an insufficient buffer size.
See also PSA_HASH_SUSPEND_OUTPUT_SIZE().
Definition at line 739 of file crypto_sizes.h.
#define PSA_HASH_SUSPEND_OUTPUT_SIZE | ( | alg | ) | /* specification-defined value */ |
A sufficient hash suspend state buffer size for psa_hash_suspend(), in bytes.
If the size of the hash state buffer is at least this large, it is guaranteed that psa_hash_suspend() 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_HASH_SUSPEND_OUTPUT_MAX_SIZE.
alg | A hash algorithm: a value of type psa_algorithm_t such that PSA_ALG_IS_HASH(alg) is true. |
For a supported hash algorithm alg, the following expression is true:
Definition at line 765 of file crypto_sizes.h.
#define PSA_KEY_EXPORT_ECC_KEY_MAX_SIZE | ( | key_type, | |
key_bits | |||
) |
Maximum size of the export encoding of an ECC keypair.
The representation of an ECC keypair follows https://arm-software.github.io/psa-api/crypto/1.1/api/keys/management.html#key-formats and is dependent on the family:
ceiling(m/8)
-byte string, big-endian where m is the bit size associated with the curve. Definition at line 844 of file crypto_sizes.h.
#define PSA_KEY_EXPORT_ECC_PUBLIC_KEY_MAX_SIZE | ( | key_type, | |
key_bits | |||
) |
Maximum size of the export encoding of an ECC public key.
The representation of an ECC public key is dependent on the family:
x_P
as a ceiling(m/8)
-byte string, big-endian;y_P
as a ceiling(m/8)
-byte string, big-endian;Definition at line 948 of file crypto_sizes.h.
#define PSA_MAC_LENGTH | ( | key_type, | |
key_bits, | |||
alg | |||
) |
The size of the output of psa_mac_compute() and psa_mac_sign_finish(), in bytes.
If the size of the MAC buffer is at least this large, it is guaranteed that psa_mac_compute() and psa_mac_sign_finish() will not fail due to an insufficient buffer size.
This is also the MAC length that psa_mac_verify() and psa_mac_verify_finish() expect.
See also PSA_MAC_MAX_SIZE.
key_type | The type of the MAC key. |
key_bits | The size of the MAC key in bits. |
alg | A MAC algorithm: a value of type psa_algorithm_t such that PSA_ALG_IS_MAC(alg ) is true. |
Definition at line 445 of file crypto_sizes.h.
#define PSA_MAC_MAX_SIZE 0 |
A sufficient buffer size for storing the MAC output by psa_mac_verify() and psa_mac_verify_finish(), for any of the supported key types and MAC algorithms.
If the size of the MAC buffer is at least this large, it is guaranteed that psa_mac_verify() and psa_mac_verify_finish() will not fail due to an insufficient buffer size.
See also PSA_MAC_LENGTH().
Definition at line 482 of file crypto_sizes.h.
#define PSA_MAX_ASYMMETRIC_KEYPAIR_SIZE |
The maximum size of an asymmetric private key pair.
Definition at line 1030 of file crypto_sizes.h.
#define PSA_MAX_KEY_DATA_SIZE (CONFIG_PSA_MAX_KEY_SIZE) |
The maximum size of the used key data.
Definition at line 1039 of file crypto_sizes.h.
#define PSA_MAX_PRIV_KEY_BUFFER_SIZE (PSA_BITS_TO_BYTES(PSA_MAX_PRIV_KEY_SIZE)) |
The maximum size of an asymmetric private key buffer.
If only a secure element driver is present, the private key will always be stored in a key slot and PSA Crypto will only allocate memory for an 8 Byte key slot number.
Definition at line 1025 of file crypto_sizes.h.
#define PSA_MAX_PRIV_KEY_SIZE (PSA_BYTES_TO_BITS(CONFIG_PSA_MAX_KEY_SIZE)) |
The maximum size of an asymmetric private key.
Definition at line 911 of file crypto_sizes.h.
#define PSA_MAX_UNSTRUCTURED_KEY_SIZE (CONFIG_PSA_MAX_KEY_SIZE) |
The maximum size of an unstructured key.
Definition at line 1045 of file crypto_sizes.h.
#define PSA_SIGN_OUTPUT_SIZE | ( | key_type, | |
key_bits, | |||
alg | |||
) |
Sufficient signature buffer size for psa_sign_message() and psa_sign_hash().
If the size of the signature buffer is at least this large, it is guaranteed that psa_sign_message() and psa_sign_hash() 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_SIGNATURE_MAX_SIZE.
key_type | An asymmetric key type. This can 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 1077 of file crypto_sizes.h.