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 83 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 73 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 106 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 93 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 122 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 143 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 158 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 179 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 191 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 211 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 233 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 244 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 265 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 277 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 290 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 311 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 325 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 344 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 774 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 796 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 808 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 829 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 496 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 504 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 517 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 538 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 552 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 573 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 585 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 604 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 633 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 646 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 660 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 682 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 895 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 1054 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 884 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 931 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 1015 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 990 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 370 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 403 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 352 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 692 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 708 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 725 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 737 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 763 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 842 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 946 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 444 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 481 of file crypto_sizes.h.
#define PSA_MAX_ASYMMETRIC_KEYPAIR_SIZE |
The maximum size of an asymmetric private key pair.
Definition at line 1028 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 1037 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 1023 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 909 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 1043 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 1075 of file crypto_sizes.h.