|
1038 | 1038 | PSA_KEY_EXPORT_FFDH_PUBLIC_KEY_MAX_SIZE(PSA_VENDOR_FFDH_MAX_KEY_BITS)
|
1039 | 1039 | #endif
|
1040 | 1040 |
|
| 1041 | +#define PSA_EXPORT_KEY_PAIR_OR_PUBLIC_MAX_SIZE \ |
| 1042 | + ((PSA_EXPORT_KEY_PAIR_MAX_SIZE > PSA_EXPORT_PUBLIC_KEY_MAX_SIZE) ? \ |
| 1043 | + PSA_EXPORT_KEY_PAIR_MAX_SIZE : PSA_EXPORT_PUBLIC_KEY_MAX_SIZE) |
| 1044 | + |
1041 | 1045 | /** Sufficient output buffer size for psa_raw_key_agreement().
|
1042 | 1046 | *
|
1043 | 1047 | * This macro returns a compile-time constant if its arguments are
|
|
1085 | 1089 | #define PSA_RAW_KEY_AGREEMENT_OUTPUT_MAX_SIZE PSA_BITS_TO_BYTES(PSA_VENDOR_FFDH_MAX_KEY_BITS)
|
1086 | 1090 | #endif
|
1087 | 1091 |
|
| 1092 | +/** Maximum key length for ciphers. |
| 1093 | + * |
| 1094 | + * Since there is no additional PSA_WANT_xxx symbol to specifiy the size of |
| 1095 | + * the key once a cipher is enabled (as it happens for asymmetric keys for |
| 1096 | + * example), the maximum key length is taken into account for each cipher. |
| 1097 | + * The resulting value will be the maximum cipher's key length given depending |
| 1098 | + * on which ciphers are enabled. |
| 1099 | + * |
| 1100 | + * Note: max value for AES used below would be doubled if XTS were enabled, but |
| 1101 | + * this mode is currently not supported in Mbed TLS implementation of PSA |
| 1102 | + * APIs. |
| 1103 | + */ |
| 1104 | +#if (defined(PSA_WANT_KEY_TYPE_AES) || defined(PSA_WANT_KEY_TYPE_ARIA) || \ |
| 1105 | + defined(PSA_WANT_KEY_TYPE_CAMELLIA) || defined(PSA_WANT_KEY_TYPE_CHACHA20)) |
| 1106 | +#define PSA_CIPHER_MAX_KEY_LENGTH 32u |
| 1107 | +#elif defined(PSA_WANT_KEY_TYPE_DES) |
| 1108 | +#define PSA_CIPHER_MAX_KEY_LENGTH 24u |
| 1109 | +#else |
| 1110 | +#define PSA_CIPHER_MAX_KEY_LENGTH 0u |
| 1111 | +#endif |
| 1112 | + |
1088 | 1113 | /** The default IV size for a cipher algorithm, in bytes.
|
1089 | 1114 | *
|
1090 | 1115 | * The IV that is generated as part of a call to #psa_cipher_encrypt() is always
|
|
0 commit comments