Macros | |
#define | CY_P64_PSA_HASH_SIZE(alg) |
The size of the output of psa_hash_finish(), in bytes. More... | |
#define | CY_P64_PSA_HASH_MAX_SIZE (32) |
The maximum size of a hash. More... | |
#define | CY_P64_PSA_KEY_EXPORT_ECC_PUBLIC_KEY_MAX_SIZE(key_bits) (2 * CY_P64_PSA_BITS_TO_BYTES(key_bits) + 1) |
Maximum size of the export encoding of an ECC public key. More... | |
#define | CY_P64_PSA_KEY_EXPORT_ECC_KEY_PAIR_MAX_SIZE(key_bits) (CY_P64_PSA_BITS_TO_BYTES(key_bits)) |
The maximum size of the export encoding of an ECC key pair. More... | |
#define | CY_P64_PSA_KEY_EXPORT_MAX_SIZE(key_type, key_bits) |
The sufficient output buffer size for psa_export_key() or psa_export_public_key(). More... | |
#define CY_P64_PSA_HASH_SIZE | ( | alg | ) |
The size of the output of psa_hash_finish(), in bytes.
This is also the hash size that cy_p64_psa_hash_verify() expects.
alg | A hash algorithm (CY_P64_ALG_XXX value such that CY_P64_PSA_ALG_IS_HASH(alg ) is true), or an HMAC algorithm (CY_P64_PSA_ALG_HMAC(hash_alg ) where hash_alg is a hash algorithm). |
#define CY_P64_PSA_HASH_MAX_SIZE (32) |
The maximum size of a hash.
This macro must expand to a compile-time constant integer. This value should be the maximum size of a hash supported by the implementation, in bytes, and must be no smaller than this maximum.
#define CY_P64_PSA_KEY_EXPORT_ECC_PUBLIC_KEY_MAX_SIZE | ( | key_bits | ) | (2 * CY_P64_PSA_BITS_TO_BYTES(key_bits) + 1) |
Maximum size of the export encoding of an ECC public key.
The representation of an ECC public key is:
x_P
as a ceiling(m/8)
-byte string, big-endian;y_P
as a ceiling(m/8)
-byte string, big-endian; where m is the bit size associated with the curve. 1 byte + 2 * point size. #define CY_P64_PSA_KEY_EXPORT_ECC_KEY_PAIR_MAX_SIZE | ( | key_bits | ) | (CY_P64_PSA_BITS_TO_BYTES(key_bits)) |
The maximum size of the export encoding of an ECC key pair.
The ECC key pair is represented by the secret value.
#define CY_P64_PSA_KEY_EXPORT_MAX_SIZE | ( | key_type, | |
key_bits | |||
) |
The 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.
For psa_export_public_key(), calculate the buffer size from the public key type. You can use the macro CY_P64_PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR to convert a key pair type to the corresponding public key type.
key_type | A supported key type. |
key_bits | The size of the key in bits. |