Loading...
Searching...
No Matches
sizes.h File Reference

Asymmetric signature size definitions for the PSA Crypto API. More...

Detailed Description

Asymmetric signature size definitions for the PSA Crypto API.

Author
Armin Wolf wolf..nosp@m.armi.nosp@m.n@mai.nosp@m.lbox.nosp@m..tu-d.nosp@m.resd.nosp@m.en.de
Lena Boeckmann lena..nosp@m.boec.nosp@m.kmann.nosp@m.@haw.nosp@m.-hamb.nosp@m.urg..nosp@m.de

Definition in file sizes.h.

#include "psa/sizes.h"
#include "psa/key/type.h"
+ Include dependency graph for sizes.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

#define PSA_SIGNATURE_MAX_SIZE   /* implementation-defined value */
 A sufficient signature buffer size for psa_sign_message() and psa_sign_hash(), for any of the supported key types and asymmetric signature algorithms.
 
#define PSA_ECDSA_SIGNATURE_SIZE(curve_bits)
 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().
 

Macro Definition Documentation

◆ PSA_ECDSA_SIGNATURE_SIZE

#define PSA_ECDSA_SIGNATURE_SIZE ( curve_bits)
Value:
((size_t)(PSA_BITS_TO_BYTES(curve_bits) * 2))
#define PSA_BITS_TO_BYTES(bits)
Functions to convert bits to bytes.
Definition sizes.h:35

ECDSA signature size for a given curve bit size.

Note
This macro returns a compile-time constant if its argument is one.
Parameters
curve_bitsCurve size in bits.
Returns
Signature size in bytes.

Definition at line 53 of file sizes.h.

◆ PSA_SIGN_OUTPUT_SIZE

#define PSA_SIGN_OUTPUT_SIZE ( key_type,
key_bits,
alg )
Value:
(PSA_KEY_TYPE_IS_ECC(key_type) ? PSA_ECDSA_SIGNATURE_SIZE(key_bits) : \
((void)alg, 0))
#define PSA_ECDSA_SIGNATURE_SIZE(curve_bits)
ECDSA signature size for a given curve bit size.
Definition sizes.h:53
#define PSA_KEY_TYPE_IS_ECC(type)
Whether a key type is an elliptic curve key, either a key pair or a public key.
Definition type.h:743

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.

Parameters
key_typeAn asymmetric key type. This can be a key pair type or a public key type.
key_bitsThe size of the key in bits.
algThe signature algorithm.
Returns
A sufficient signature buffer size for the specified asymmetric signature algorithm and key parameters. 0 if algorithm and key parameters are not supported. If the parameters are not valid, the return value is unspecified.

Definition at line 74 of file sizes.h.

◆ PSA_SIGNATURE_MAX_SIZE

#define PSA_SIGNATURE_MAX_SIZE   /* implementation-defined value */

A sufficient signature buffer size for psa_sign_message() and psa_sign_hash(), for any of the supported key types and asymmetric signature algorithms.

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.

See also PSA_SIGN_OUTPUT_SIZE().

Definition at line 42 of file sizes.h.