PSA_SIGN_OUTPUT_SIZE macro
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). \warning This function may call its arguments multiple times or zero times, so you should not pass arguments that contain side effects.
Syntax
#define PSA_SIGN_OUTPUT_SIZE(key_type, key_bits, alg) \
(PSA_KEY_TYPE_IS_RSA(key_type) ? ((void) alg, PSA_BITS_TO_BYTES(key_bits)) : \
PSA_KEY_TYPE_IS_ECC(key_type) ? PSA_ECDSA_SIGNATURE_SIZE(key_bits) : \
((void) alg, 0u))
Arguments
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.
Return value
If the parameters are valid and supported, return a buffer size in bytes that guarantees that psa_sign_hash() will not fail with #PSA_ERROR_BUFFER_TOO_SMALL. If the parameters are a valid combination that is not supported, return either a sensible size or 0. If the parameters are not valid, the return value is unspecified.
![]()
#define PSA_SIGN_OUTPUT_SIZE(key_type, key_bits, alg) \