mbed TLS v2.23.0

Macros | Typedefs
Key and algorithm types

## Macros
#define | PSA_KEY_TYPE_DSA_PUBLIC_KEY ((psa_key_type_t)0x4002)
#define | PSA_KEY_TYPE_DSA_KEY_PAIR ((psa_key_type_t)0x7002)
#define | PSA_KEY_TYPE_IS_DSA(type) (PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(type) == PSA_KEY_TYPE_DSA_PUBLIC_KEY)
#define | PSA_ALG_DSA_BASE ((psa_algorithm_t)0x10040000)
#define | PSA_ALG_DSA(hash_alg) (PSA_ALG_DSA_BASE | ((hash_alg) & PSA_ALG_HASH_MASK))
#define | PSA_ALG_DETERMINISTIC_DSA_BASE ((psa_algorithm_t)0x10050000)
#define | PSA_ALG_DSA_DETERMINISTIC_FLAG PSA_ALG_ECDSA_DETERMINISTIC_FLAG
#define | PSA_ALG_DETERMINISTIC_DSA(hash_alg) (PSA_ALG_DETERMINISTIC_DSA_BASE | ((hash_alg) & PSA_ALG_HASH_MASK))
#define | PSA_ALG_IS_DSA(alg)
#define | PSA_ALG_DSA_IS_DETERMINISTIC(alg) (((alg) & PSA_ALG_DSA_DETERMINISTIC_FLAG) != 0)
#define | PSA_ALG_IS_DETERMINISTIC_DSA(alg) (PSA_ALG_IS_DSA(alg) && PSA_ALG_DSA_IS_DETERMINISTIC(alg))
#define | PSA_ALG_IS_RANDOMIZED_DSA(alg) (PSA_ALG_IS_DSA(alg) && !PSA_ALG_DSA_IS_DETERMINISTIC(alg))
#define | PSA_ALG_IS_HASH_AND_SIGN(alg)
#define | PSA_KEY_TYPE_NONE ((psa_key_type_t)0x0000)
#define | PSA_KEY_TYPE_VENDOR_FLAG ((psa_key_type_t)0x8000)
#define | PSA_KEY_TYPE_CATEGORY_MASK ((psa_key_type_t)0x7000)
#define | PSA_KEY_TYPE_CATEGORY_RAW ((psa_key_type_t)0x1000)
#define | PSA_KEY_TYPE_CATEGORY_SYMMETRIC ((psa_key_type_t)0x2000)
#define | PSA_KEY_TYPE_CATEGORY_PUBLIC_KEY ((psa_key_type_t)0x4000)
#define | PSA_KEY_TYPE_CATEGORY_KEY_PAIR ((psa_key_type_t)0x7000)
#define | PSA_KEY_TYPE_CATEGORY_FLAG_PAIR ((psa_key_type_t)0x3000)
#define | PSA_KEY_TYPE_IS_VENDOR_DEFINED(type) (((type) & PSA_KEY_TYPE_VENDOR_FLAG) != 0)
#define | PSA_KEY_TYPE_IS_UNSTRUCTURED(type)
#define | PSA_KEY_TYPE_IS_ASYMMETRIC(type)
#define | PSA_KEY_TYPE_IS_PUBLIC_KEY(type) (((type) & PSA_KEY_TYPE_CATEGORY_MASK) == PSA_KEY_TYPE_CATEGORY_PUBLIC_KEY)
#define | PSA_KEY_TYPE_IS_KEY_PAIR(type) (((type) & PSA_KEY_TYPE_CATEGORY_MASK) == PSA_KEY_TYPE_CATEGORY_KEY_PAIR)
#define | PSA_KEY_TYPE_KEY_PAIR_OF_PUBLIC_KEY(type) ((type) | PSA_KEY_TYPE_CATEGORY_FLAG_PAIR)
#define | PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(type) ((type) & ~PSA_KEY_TYPE_CATEGORY_FLAG_PAIR)
#define | PSA_KEY_TYPE_RAW_DATA ((psa_key_type_t)0x1001)
#define | PSA_KEY_TYPE_HMAC ((psa_key_type_t)0x1100)
#define | PSA_KEY_TYPE_DERIVE ((psa_key_type_t)0x1200)
#define | PSA_KEY_TYPE_AES ((psa_key_type_t)0x2400)
#define | PSA_KEY_TYPE_DES ((psa_key_type_t)0x2301)
#define | PSA_KEY_TYPE_CAMELLIA ((psa_key_type_t)0x2403)
#define | PSA_KEY_TYPE_ARC4 ((psa_key_type_t)0x2002)
#define | PSA_KEY_TYPE_CHACHA20 ((psa_key_type_t)0x2004)
#define | PSA_KEY_TYPE_RSA_PUBLIC_KEY ((psa_key_type_t)0x4001)
#define | PSA_KEY_TYPE_RSA_KEY_PAIR ((psa_key_type_t)0x7001)
#define | PSA_KEY_TYPE_IS_RSA(type) (PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(type) == PSA_KEY_TYPE_RSA_PUBLIC_KEY)
#define | PSA_KEY_TYPE_ECC_PUBLIC_KEY_BASE ((psa_key_type_t)0x4100)
#define | PSA_KEY_TYPE_ECC_KEY_PAIR_BASE ((psa_key_type_t)0x7100)
#define | PSA_KEY_TYPE_ECC_CURVE_MASK ((psa_key_type_t)0x00ff)
#define | PSA_KEY_TYPE_ECC_KEY_PAIR(curve) (PSA_KEY_TYPE_ECC_KEY_PAIR_BASE | (curve))
#define | PSA_KEY_TYPE_ECC_PUBLIC_KEY(curve) (PSA_KEY_TYPE_ECC_PUBLIC_KEY_BASE | (curve))
#define | PSA_KEY_TYPE_IS_ECC(type)
#define | PSA_KEY_TYPE_IS_ECC_KEY_PAIR(type)
#define | PSA_KEY_TYPE_IS_ECC_PUBLIC_KEY(type)
#define | PSA_KEY_TYPE_GET_CURVE(type)
#define | PSA_ECC_CURVE_SECP_K1 ((psa_ecc_curve_t) 0x17)
#define | PSA_ECC_CURVE_SECP_R1 ((psa_ecc_curve_t) 0x12)
#define | PSA_ECC_CURVE_SECP_R2 ((psa_ecc_curve_t) 0x1b)
#define | PSA_ECC_CURVE_SECT_K1 ((psa_ecc_curve_t) 0x27)
#define | PSA_ECC_CURVE_SECT_R1 ((psa_ecc_curve_t) 0x22)
#define | PSA_ECC_CURVE_SECT_R2 ((psa_ecc_curve_t) 0x2b)
#define | PSA_ECC_CURVE_BRAINPOOL_P_R1 ((psa_ecc_curve_t) 0x30)
#define | PSA_ECC_CURVE_MONTGOMERY ((psa_ecc_curve_t) 0x41)
#define | PSA_KEY_TYPE_DH_PUBLIC_KEY_BASE ((psa_key_type_t)0x4200)
#define | PSA_KEY_TYPE_DH_KEY_PAIR_BASE ((psa_key_type_t)0x7200)
#define | PSA_KEY_TYPE_DH_GROUP_MASK ((psa_key_type_t)0x00ff)
#define | PSA_KEY_TYPE_DH_KEY_PAIR(group) (PSA_KEY_TYPE_DH_KEY_PAIR_BASE | (group))
#define | PSA_KEY_TYPE_DH_PUBLIC_KEY(group) (PSA_KEY_TYPE_DH_PUBLIC_KEY_BASE | (group))
#define | PSA_KEY_TYPE_IS_DH(type)
#define | PSA_KEY_TYPE_IS_DH_KEY_PAIR(type)
#define | PSA_KEY_TYPE_IS_DH_PUBLIC_KEY(type)
#define | PSA_KEY_TYPE_GET_GROUP(type)
#define | PSA_DH_GROUP_RFC7919 ((psa_dh_group_t) 0x03)
#define | PSA_GET_KEY_TYPE_BLOCK_SIZE_EXPONENT(type) (((type) >> 8) & 7)
#define | PSA_BLOCK_CIPHER_BLOCK_SIZE(type)
#define | PSA_ALG_VENDOR_FLAG ((psa_algorithm_t)0x80000000)
#define | PSA_ALG_CATEGORY_MASK ((psa_algorithm_t)0x7f000000)
#define | PSA_ALG_CATEGORY_HASH ((psa_algorithm_t)0x01000000)
#define | PSA_ALG_CATEGORY_MAC ((psa_algorithm_t)0x02000000)
#define | PSA_ALG_CATEGORY_CIPHER ((psa_algorithm_t)0x04000000)
#define | PSA_ALG_CATEGORY_AEAD ((psa_algorithm_t)0x06000000)
#define | PSA_ALG_CATEGORY_SIGN ((psa_algorithm_t)0x10000000)
#define | PSA_ALG_CATEGORY_ASYMMETRIC_ENCRYPTION ((psa_algorithm_t)0x12000000)
#define | PSA_ALG_CATEGORY_KEY_DERIVATION ((psa_algorithm_t)0x20000000)
#define | PSA_ALG_CATEGORY_KEY_AGREEMENT ((psa_algorithm_t)0x30000000)
#define | PSA_ALG_IS_VENDOR_DEFINED(alg) (((alg) & PSA_ALG_VENDOR_FLAG) != 0)
#define | PSA_ALG_IS_HASH(alg) (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_HASH)
#define | PSA_ALG_IS_MAC(alg) (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_MAC)
#define | PSA_ALG_IS_CIPHER(alg) (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_CIPHER)
#define | PSA_ALG_IS_AEAD(alg) (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_AEAD)
#define | PSA_ALG_IS_SIGN(alg) (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_SIGN)
#define | PSA_ALG_IS_ASYMMETRIC_ENCRYPTION(alg) (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_ASYMMETRIC_ENCRYPTION)
#define | PSA_ALG_IS_KEY_AGREEMENT(alg) (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_KEY_AGREEMENT)
#define | PSA_ALG_IS_KEY_DERIVATION(alg) (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_KEY_DERIVATION)
#define | PSA_ALG_HASH_MASK ((psa_algorithm_t)0x000000ff)
#define | PSA_ALG_MD2 ((psa_algorithm_t)0x01000001)
#define | PSA_ALG_MD4 ((psa_algorithm_t)0x01000002)
#define | PSA_ALG_MD5 ((psa_algorithm_t)0x01000003)
#define | PSA_ALG_RIPEMD160 ((psa_algorithm_t)0x01000004)
#define | PSA_ALG_SHA_1 ((psa_algorithm_t)0x01000005)
#define | PSA_ALG_SHA_224 ((psa_algorithm_t)0x01000008)
#define | PSA_ALG_SHA_256 ((psa_algorithm_t)0x01000009)
#define | PSA_ALG_SHA_384 ((psa_algorithm_t)0x0100000a)
#define | PSA_ALG_SHA_512 ((psa_algorithm_t)0x0100000b)
#define | PSA_ALG_SHA_512_224 ((psa_algorithm_t)0x0100000c)
#define | PSA_ALG_SHA_512_256 ((psa_algorithm_t)0x0100000d)
#define | PSA_ALG_SHA3_224 ((psa_algorithm_t)0x01000010)
#define | PSA_ALG_SHA3_256 ((psa_algorithm_t)0x01000011)
#define | PSA_ALG_SHA3_384 ((psa_algorithm_t)0x01000012)
#define | PSA_ALG_SHA3_512 ((psa_algorithm_t)0x01000013)
#define | PSA_ALG_ANY_HASH ((psa_algorithm_t)0x010000ff)
#define | PSA_ALG_MAC_SUBCATEGORY_MASK ((psa_algorithm_t)0x00c00000)
#define | PSA_ALG_HMAC_BASE ((psa_algorithm_t)0x02800000)
#define | PSA_ALG_HMAC(hash_alg) (PSA_ALG_HMAC_BASE | ((hash_alg) & PSA_ALG_HASH_MASK))
#define | PSA_ALG_HMAC_GET_HASH(hmac_alg) (PSA_ALG_CATEGORY_HASH | ((hmac_alg) & PSA_ALG_HASH_MASK))
#define | PSA_ALG_IS_HMAC(alg)
#define | PSA_ALG_MAC_TRUNCATION_MASK ((psa_algorithm_t)0x00003f00)
#define | PSA_MAC_TRUNCATION_OFFSET 8
#define | PSA_ALG_TRUNCATED_MAC(mac_alg, mac_length)
#define | PSA_ALG_FULL_LENGTH_MAC(mac_alg) ((mac_alg) & ~PSA_ALG_MAC_TRUNCATION_MASK)
#define | PSA_MAC_TRUNCATED_LENGTH(mac_alg) (((mac_alg) & PSA_ALG_MAC_TRUNCATION_MASK) >> PSA_MAC_TRUNCATION_OFFSET)
#define | PSA_ALG_CIPHER_MAC_BASE ((psa_algorithm_t)0x02c00000)
#define | PSA_ALG_CBC_MAC ((psa_algorithm_t)0x02c00001)
#define | PSA_ALG_CMAC ((psa_algorithm_t)0x02c00002)
#define | PSA_ALG_IS_BLOCK_CIPHER_MAC(alg)
#define | PSA_ALG_CIPHER_STREAM_FLAG ((psa_algorithm_t)0x00800000)
#define | PSA_ALG_CIPHER_FROM_BLOCK_FLAG ((psa_algorithm_t)0x00400000)
#define | PSA_ALG_IS_STREAM_CIPHER(alg)
#define | PSA_ALG_ARC4 ((psa_algorithm_t)0x04800001)
#define | PSA_ALG_CHACHA20 ((psa_algorithm_t)0x04800005)
#define | PSA_ALG_CTR ((psa_algorithm_t)0x04c00001)
#define | PSA_ALG_CFB ((psa_algorithm_t)0x04c00002)
#define | PSA_ALG_OFB ((psa_algorithm_t)0x04c00003)
#define | PSA_ALG_XTS ((psa_algorithm_t)0x044000ff)
#define | PSA_ALG_CBC_NO_PADDING ((psa_algorithm_t)0x04600100)
#define | PSA_ALG_CBC_PKCS7 ((psa_algorithm_t)0x04600101)
#define | PSA_ALG_AEAD_FROM_BLOCK_FLAG ((psa_algorithm_t)0x00400000)
#define | PSA_ALG_IS_AEAD_ON_BLOCK_CIPHER(alg)
#define | PSA_ALG_CCM ((psa_algorithm_t)0x06401001)
#define | PSA_ALG_GCM ((psa_algorithm_t)0x06401002)
#define | PSA_ALG_CHACHA20_POLY1305 ((psa_algorithm_t)0x06001005)
#define | PSA_ALG_AEAD_TAG_LENGTH_MASK ((psa_algorithm_t)0x00003f00)
#define | PSA_AEAD_TAG_LENGTH_OFFSET 8
#define | PSA_ALG_AEAD_WITH_TAG_LENGTH(aead_alg, tag_length)
#define | PSA_ALG_AEAD_WITH_DEFAULT_TAG_LENGTH(aead_alg)
#define | PSA_ALG_AEAD_WITH_DEFAULT_TAG_LENGTH_CASE(aead_alg, ref)
#define | PSA_ALG_RSA_PKCS1V15_SIGN_BASE ((psa_algorithm_t)0x10020000)
#define | PSA_ALG_RSA_PKCS1V15_SIGN(hash_alg) (PSA_ALG_RSA_PKCS1V15_SIGN_BASE | ((hash_alg) & PSA_ALG_HASH_MASK))
#define | PSA_ALG_RSA_PKCS1V15_SIGN_RAW PSA_ALG_RSA_PKCS1V15_SIGN_BASE
#define | PSA_ALG_IS_RSA_PKCS1V15_SIGN(alg) (((alg) & ~PSA_ALG_HASH_MASK) == PSA_ALG_RSA_PKCS1V15_SIGN_BASE)
#define | PSA_ALG_RSA_PSS_BASE ((psa_algorithm_t)0x10030000)
#define | PSA_ALG_RSA_PSS(hash_alg) (PSA_ALG_RSA_PSS_BASE | ((hash_alg) & PSA_ALG_HASH_MASK))
#define | PSA_ALG_IS_RSA_PSS(alg) (((alg) & ~PSA_ALG_HASH_MASK) == PSA_ALG_RSA_PSS_BASE)
#define | PSA_ALG_ECDSA_BASE ((psa_algorithm_t)0x10060000)
#define | PSA_ALG_ECDSA(hash_alg) (PSA_ALG_ECDSA_BASE | ((hash_alg) & PSA_ALG_HASH_MASK))
#define | PSA_ALG_ECDSA_ANY PSA_ALG_ECDSA_BASE
#define | PSA_ALG_DETERMINISTIC_ECDSA_BASE ((psa_algorithm_t)0x10070000)
#define | PSA_ALG_DETERMINISTIC_ECDSA(hash_alg) (PSA_ALG_DETERMINISTIC_ECDSA_BASE | ((hash_alg) & PSA_ALG_HASH_MASK))
#define | PSA_ALG_ECDSA_DETERMINISTIC_FLAG ((psa_algorithm_t)0x00010000)
#define | PSA_ALG_IS_ECDSA(alg)
#define | PSA_ALG_ECDSA_IS_DETERMINISTIC(alg) (((alg) & PSA_ALG_ECDSA_DETERMINISTIC_FLAG) != 0)
#define | PSA_ALG_IS_DETERMINISTIC_ECDSA(alg) (PSA_ALG_IS_ECDSA(alg) && PSA_ALG_ECDSA_IS_DETERMINISTIC(alg))
#define | PSA_ALG_IS_RANDOMIZED_ECDSA(alg) (PSA_ALG_IS_ECDSA(alg) && !PSA_ALG_ECDSA_IS_DETERMINISTIC(alg))
#define | PSA_ALG_IS_HASH_AND_SIGN(alg)
#define | PSA_ALG_SIGN_GET_HASH(alg)
#define | PSA_ALG_RSA_PKCS1V15_CRYPT ((psa_algorithm_t)0x12020000)
#define | PSA_ALG_RSA_OAEP_BASE ((psa_algorithm_t)0x12030000)
#define | PSA_ALG_RSA_OAEP(hash_alg) (PSA_ALG_RSA_OAEP_BASE | ((hash_alg) & PSA_ALG_HASH_MASK))
#define | PSA_ALG_IS_RSA_OAEP(alg) (((alg) & ~PSA_ALG_HASH_MASK) == PSA_ALG_RSA_OAEP_BASE)
#define | PSA_ALG_RSA_OAEP_GET_HASH(alg)
#define | PSA_ALG_HKDF_BASE ((psa_algorithm_t)0x20000100)
#define | PSA_ALG_HKDF(hash_alg) (PSA_ALG_HKDF_BASE | ((hash_alg) & PSA_ALG_HASH_MASK))
#define | PSA_ALG_IS_HKDF(alg) (((alg) & ~PSA_ALG_HASH_MASK) == PSA_ALG_HKDF_BASE)
#define | PSA_ALG_HKDF_GET_HASH(hkdf_alg) (PSA_ALG_CATEGORY_HASH | ((hkdf_alg) & PSA_ALG_HASH_MASK))
#define | PSA_ALG_TLS12_PRF_BASE ((psa_algorithm_t)0x20000200)
#define | PSA_ALG_TLS12_PRF(hash_alg) (PSA_ALG_TLS12_PRF_BASE | ((hash_alg) & PSA_ALG_HASH_MASK))
#define | PSA_ALG_IS_TLS12_PRF(alg) (((alg) & ~PSA_ALG_HASH_MASK) == PSA_ALG_TLS12_PRF_BASE)
#define | PSA_ALG_TLS12_PRF_GET_HASH(hkdf_alg) (PSA_ALG_CATEGORY_HASH | ((hkdf_alg) & PSA_ALG_HASH_MASK))
#define | PSA_ALG_TLS12_PSK_TO_MS_BASE ((psa_algorithm_t)0x20000300)
#define | PSA_ALG_TLS12_PSK_TO_MS(hash_alg) (PSA_ALG_TLS12_PSK_TO_MS_BASE | ((hash_alg) & PSA_ALG_HASH_MASK))
#define | PSA_ALG_IS_TLS12_PSK_TO_MS(alg) (((alg) & ~PSA_ALG_HASH_MASK) == PSA_ALG_TLS12_PSK_TO_MS_BASE)
#define | PSA_ALG_TLS12_PSK_TO_MS_GET_HASH(hkdf_alg) (PSA_ALG_CATEGORY_HASH | ((hkdf_alg) & PSA_ALG_HASH_MASK))
#define | PSA_ALG_KEY_DERIVATION_MASK ((psa_algorithm_t)0x0803ffff)
#define | PSA_ALG_KEY_AGREEMENT_MASK ((psa_algorithm_t)0x10fc0000)
#define | PSA_ALG_KEY_AGREEMENT(ka_alg, kdf_alg) ((ka_alg) | (kdf_alg))
#define | PSA_ALG_KEY_AGREEMENT_GET_KDF(alg) (((alg) & PSA_ALG_KEY_DERIVATION_MASK) | PSA_ALG_CATEGORY_KEY_DERIVATION)
#define | PSA_ALG_KEY_AGREEMENT_GET_BASE(alg) (((alg) & PSA_ALG_KEY_AGREEMENT_MASK) | PSA_ALG_CATEGORY_KEY_AGREEMENT)
#define | PSA_ALG_IS_RAW_KEY_AGREEMENT(alg)
#define | PSA_ALG_IS_KEY_DERIVATION_OR_AGREEMENT(alg) ((PSA_ALG_IS_KEY_DERIVATION(alg) || PSA_ALG_IS_KEY_AGREEMENT(alg)))
#define | PSA_ALG_FFDH ((psa_algorithm_t)0x30100000)
#define | PSA_ALG_IS_FFDH(alg) (PSA_ALG_KEY_AGREEMENT_GET_BASE(alg) == PSA_ALG_FFDH)
#define | PSA_ALG_ECDH ((psa_algorithm_t)0x30200000)
#define | PSA_ALG_IS_ECDH(alg) (PSA_ALG_KEY_AGREEMENT_GET_BASE(alg) == PSA_ALG_ECDH)
#define | PSA_ALG_IS_WILDCARD(alg)

## Typedefs
typedef uint16_t | psa_key_type_t
| Encoding of a key type. More...
typedef uint8_t | psa_ecc_curve_t
typedef uint8_t | psa_dh_group_t
typedef uint32_t | psa_algorithm_t
| Encoding of a cryptographic algorithm. More...

## Detailed Description

## Macro Definition Documentation

## ◆ PSA_AEAD_TAG_LENGTH_OFFSET

#define PSA_AEAD_TAG_LENGTH_OFFSET 8

Definition at line 1044 of file crypto_values.h.

## ◆ PSA_ALG_AEAD_FROM_BLOCK_FLAG

#define PSA_ALG_AEAD_FROM_BLOCK_FLAG ((psa_algorithm_t)0x00400000)

Definition at line 1001 of file crypto_values.h.

## ◆ PSA_ALG_AEAD_TAG_LENGTH_MASK

#define PSA_ALG_AEAD_TAG_LENGTH_MASK ((psa_algorithm_t)0x00003f00)

Definition at line 1043 of file crypto_values.h.

## ◆ PSA_ALG_AEAD_WITH_DEFAULT_TAG_LENGTH

#define PSA_ALG_AEAD_WITH_DEFAULT_TAG_LENGTH | ( |  | aead_alg | ) |

Value:
( \
PSA_ALG_AEAD_WITH_DEFAULT_TAG_LENGTH_CASE(aead_alg, PSA_ALG_CCM) \
PSA_ALG_AEAD_WITH_DEFAULT_TAG_LENGTH_CASE(aead_alg, PSA_ALG_GCM) \
PSA_ALG_AEAD_WITH_DEFAULT_TAG_LENGTH_CASE(aead_alg, PSA_ALG_CHACHA20_POLY1305) \
0)

Calculate the corresponding AEAD algorithm with the default tag length.

Parameters

  aead_alg | An AEAD algorithm (`PSA_ALG_XXX` value such that PSA_ALG_IS_AEAD(`alg`) is true).

Returns
  The corresponding AEAD algorithm with the default tag length for that algorithm.

Definition at line 1077 of file crypto_values.h.

## ◆ PSA_ALG_AEAD_WITH_DEFAULT_TAG_LENGTH_CASE

#define PSA_ALG_AEAD_WITH_DEFAULT_TAG_LENGTH_CASE | ( |  | aead_alg,
|  |  | ref
| ) |  |

Value:
PSA_ALG_AEAD_WITH_TAG_LENGTH(aead_alg, 0) == \
PSA_ALG_AEAD_WITH_TAG_LENGTH(ref, 0) ? \
ref :

Definition at line 1083 of file crypto_values.h.

## ◆ PSA_ALG_AEAD_WITH_TAG_LENGTH

#define PSA_ALG_AEAD_WITH_TAG_LENGTH | ( |  | aead_alg,
|  |  | tag_length
| ) |  |

Value:
(((aead_alg) & ~PSA_ALG_AEAD_TAG_LENGTH_MASK) | \
((tag_length) << PSA_AEAD_TAG_LENGTH_OFFSET & \
PSA_ALG_AEAD_TAG_LENGTH_MASK))

Macro to build a shortened AEAD algorithm.

A shortened AEAD algorithm is similar to the corresponding AEAD algorithm, but has an authentication tag that consists of fewer bytes. Depending on the algorithm, the tag length may affect the calculation of the ciphertext.

Parameters

  aead_alg | An AEAD algorithm identifier (value of type psa_algorithm_t such that PSA_ALG_IS_AEAD(`alg`) is true).
  tag_length | Desired length of the authentication tag in bytes.

Returns
  The corresponding AEAD algorithm with the specified length.
  Unspecified if `alg` is not a supported AEAD algorithm or if `tag_length` is not valid for the specified AEAD algorithm.

Definition at line 1064 of file crypto_values.h.

## ◆ PSA_ALG_ANY_HASH

#define PSA_ALG_ANY_HASH ((psa_algorithm_t)0x010000ff)

In a hash-and-sign algorithm policy, allow any hash algorithm.

This value may be used to form the algorithm usage field of a policy for a signature algorithm that is parametrized by a hash. The key may then be used to perform operations using the same signature algorithm parametrized with any supported hash.

That is, suppose that `PSA_xxx_SIGNATURE` is one of the following macros:

- PSA_ALG_RSA_PKCS1V15_SIGN, PSA_ALG_RSA_PSS,
- PSA_ALG_ECDSA, PSA_ALG_DETERMINISTIC_ECDSA. Then you may create and use a key as follows:
- Set the key usage field using PSA_ALG_ANY_HASH, for example:
  psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_SIGN_HASH); // or VERIFY
  psa_set_key_algorithm(&attributes, PSA_xxx_SIGNATURE(PSA_ALG_ANY_HASH));
- Import or generate key material.
- Call psa_sign_hash() or psa_verify_hash(), passing an algorithm built from `PSA_xxx_SIGNATURE` and a specific hash. Each call to sign or verify a message may use a different hash.
  psa_sign_hash(handle, PSA_xxx_SIGNATURE(PSA_ALG_SHA_256), ...);
  psa_sign_hash(handle, PSA_xxx_SIGNATURE(PSA_ALG_SHA_512), ...);
  psa_sign_hash(handle, PSA_xxx_SIGNATURE(PSA_ALG_SHA3_256), ...);

This value may not be used to build other algorithms that are parametrized over a hash. For any valid use of this macro to build an algorithm `alg`, PSA_ALG_IS_HASH_AND_SIGN(`alg`) is true.

This value may not be used to build an algorithm specification to perform an operation. It is only valid to build policies.

Definition at line 787 of file crypto_values.h.

## ◆ PSA_ALG_ARC4

#define PSA_ALG_ARC4 ((psa_algorithm_t)0x04800001)

The ARC4 stream cipher algorithm.

Definition at line 941 of file crypto_values.h.

## ◆ PSA_ALG_CATEGORY_AEAD

#define PSA_ALG_CATEGORY_AEAD ((psa_algorithm_t)0x06000000)

Definition at line 618 of file crypto_values.h.

## ◆ PSA_ALG_CATEGORY_ASYMMETRIC_ENCRYPTION

#define PSA_ALG_CATEGORY_ASYMMETRIC_ENCRYPTION ((psa_algorithm_t)0x12000000)

Definition at line 620 of file crypto_values.h.

## ◆ PSA_ALG_CATEGORY_CIPHER

#define PSA_ALG_CATEGORY_CIPHER ((psa_algorithm_t)0x04000000)

Definition at line 617 of file crypto_values.h.

## ◆ PSA_ALG_CATEGORY_HASH

#define PSA_ALG_CATEGORY_HASH ((psa_algorithm_t)0x01000000)

Definition at line 615 of file crypto_values.h.

## ◆ PSA_ALG_CATEGORY_KEY_AGREEMENT

#define PSA_ALG_CATEGORY_KEY_AGREEMENT ((psa_algorithm_t)0x30000000)

Definition at line 622 of file crypto_values.h.

## ◆ PSA_ALG_CATEGORY_KEY_DERIVATION

#define PSA_ALG_CATEGORY_KEY_DERIVATION ((psa_algorithm_t)0x20000000)

Definition at line 621 of file crypto_values.h.

## ◆ PSA_ALG_CATEGORY_MAC

#define PSA_ALG_CATEGORY_MAC ((psa_algorithm_t)0x02000000)

Definition at line 616 of file crypto_values.h.

## ◆ PSA_ALG_CATEGORY_MASK

#define PSA_ALG_CATEGORY_MASK ((psa_algorithm_t)0x7f000000)

Definition at line 614 of file crypto_values.h.

## ◆ PSA_ALG_CATEGORY_SIGN

#define PSA_ALG_CATEGORY_SIGN ((psa_algorithm_t)0x10000000)

Definition at line 619 of file crypto_values.h.

## ◆ PSA_ALG_CBC_MAC

#define PSA_ALG_CBC_MAC ((psa_algorithm_t)0x02c00001)

The CBC-MAC construction over a block cipher

Warning
  CBC-MAC is insecure in many cases. A more secure mode, such as PSA_ALG_CMAC, is recommended.

Definition at line 904 of file crypto_values.h.

## ◆ PSA_ALG_CBC_NO_PADDING

#define PSA_ALG_CBC_NO_PADDING ((psa_algorithm_t)0x04600100)

The CBC block cipher chaining mode, with no padding.

The underlying block cipher is determined by the key type.

This symmetric cipher mode can only be used with messages whose lengths are whole number of blocks for the chosen block cipher.

Definition at line 991 of file crypto_values.h.

## ◆ PSA_ALG_CBC_PKCS7

#define PSA_ALG_CBC_PKCS7 ((psa_algorithm_t)0x04600101)

The CBC block cipher chaining mode with PKCS#7 padding.

The underlying block cipher is determined by the key type.

This is the padding method defined by PKCS#7 (RFC 2315) §10.3.

Definition at line 999 of file crypto_values.h.

## ◆ PSA_ALG_CCM

#define PSA_ALG_CCM ((psa_algorithm_t)0x06401001)

The CCM authenticated encryption algorithm.

The underlying block cipher is determined by the key type.

Definition at line 1020 of file crypto_values.h.

## ◆ PSA_ALG_CFB

#define PSA_ALG_CFB ((psa_algorithm_t)0x04c00002)

The CFB stream cipher mode.

The underlying block cipher is determined by the key type.

Definition at line 968 of file crypto_values.h.

## ◆ PSA_ALG_CHACHA20

#define PSA_ALG_CHACHA20 ((psa_algorithm_t)0x04800005)

The ChaCha20 stream cipher.

ChaCha20 is defined in RFC 7539.

The nonce size for psa_cipher_set_iv() or psa_cipher_generate_iv() must be 12.

The initial block counter is always 0.

Definition at line 953 of file crypto_values.h.

## ◆ PSA_ALG_CHACHA20_POLY1305

#define PSA_ALG_CHACHA20_POLY1305 ((psa_algorithm_t)0x06001005)

The Chacha20-Poly1305 AEAD algorithm.

The ChaCha20_Poly1305 construction is defined in RFC 7539.

Implementations must support 12-byte nonces, may support 8-byte nonces, and should reject other sizes.

Implementations must support 16-byte tags and should reject other sizes.

Definition at line 1037 of file crypto_values.h.

## ◆ PSA_ALG_CIPHER_FROM_BLOCK_FLAG

#define PSA_ALG_CIPHER_FROM_BLOCK_FLAG ((psa_algorithm_t)0x00400000)

Definition at line 921 of file crypto_values.h.

## ◆ PSA_ALG_CIPHER_MAC_BASE

#define PSA_ALG_CIPHER_MAC_BASE ((psa_algorithm_t)0x02c00000)

Definition at line 898 of file crypto_values.h.

## ◆ PSA_ALG_CIPHER_STREAM_FLAG

#define PSA_ALG_CIPHER_STREAM_FLAG ((psa_algorithm_t)0x00800000)

Definition at line 920 of file crypto_values.h.

## ◆ PSA_ALG_CMAC

#define PSA_ALG_CMAC ((psa_algorithm_t)0x02c00002)

The CMAC construction over a block cipher

Definition at line 906 of file crypto_values.h.

## ◆ PSA_ALG_CTR

#define PSA_ALG_CTR ((psa_algorithm_t)0x04c00001)

The CTR stream cipher mode.

CTR is a stream cipher which is built from a block cipher. The underlying block cipher is determined by the key type. For example, to use AES-128-CTR, use this algorithm with a key of type PSA_KEY_TYPE_AES and a length of 128 bits (16 bytes).

Definition at line 962 of file crypto_values.h.

## ◆ PSA_ALG_DETERMINISTIC_DSA

#define PSA_ALG_DETERMINISTIC_DSA | ( |  | hash_alg | ) | (PSA_ALG_DETERMINISTIC_DSA_BASE | ((hash_alg) & PSA_ALG_HASH_MASK))

Deterministic DSA signature with hashing.

This is the deterministic variant defined by RFC 6979 of the signature scheme defined by FIPS 186-4.

Parameters

  hash_alg | A hash algorithm (`PSA_ALG_XXX` value such that PSA_ALG_IS_HASH(`hash_alg`) is true). This includes PSA_ALG_ANY_HASH when specifying the algorithm in a usage policy.

Returns
  The corresponding DSA signature algorithm.
  Unspecified if `hash_alg` is not a supported hash algorithm.

Definition at line 390 of file crypto_extra.h.

## ◆ PSA_ALG_DETERMINISTIC_DSA_BASE

#define PSA_ALG_DETERMINISTIC_DSA_BASE ((psa_algorithm_t)0x10050000)

Definition at line 374 of file crypto_extra.h.

## ◆ PSA_ALG_DETERMINISTIC_ECDSA

#define PSA_ALG_DETERMINISTIC_ECDSA | ( |  | hash_alg | ) | (PSA_ALG_DETERMINISTIC_ECDSA_BASE | ((hash_alg) & PSA_ALG_HASH_MASK))

Deterministic ECDSA signature with hashing.

This is the deterministic ECDSA signature scheme defined by RFC 6979.

The representation of a signature is the same as with PSA_ALG_ECDSA().

Note that when this algorithm is used for verification, signatures made with randomized ECDSA (PSA_ALG_ECDSA(`hash_alg`)) with the same private key are accepted. In other words, PSA_ALG_DETERMINISTIC_ECDSA(`hash_alg`) differs from PSA_ALG_ECDSA(`hash_alg`) only for signature, not for verification.

Parameters

  hash_alg | A hash algorithm (`PSA_ALG_XXX` value such that PSA_ALG_IS_HASH(`hash_alg`) is true). This includes PSA_ALG_ANY_HASH when specifying the algorithm in a usage policy.

Returns
  The corresponding deterministic ECDSA signature algorithm.
  Unspecified if `hash_alg` is not a supported hash algorithm.

Definition at line 1196 of file crypto_values.h.

## ◆ PSA_ALG_DETERMINISTIC_ECDSA_BASE

#define PSA_ALG_DETERMINISTIC_ECDSA_BASE ((psa_algorithm_t)0x10070000)

Definition at line 1173 of file crypto_values.h.

## ◆ PSA_ALG_DSA

#define PSA_ALG_DSA | ( |  | hash_alg | ) | (PSA_ALG_DSA_BASE | ((hash_alg) & PSA_ALG_HASH_MASK))

DSA signature with hashing.

This is the signature scheme defined by FIPS 186-4, with a random per-message secret number (k).

Parameters

  hash_alg | A hash algorithm (`PSA_ALG_XXX` value such that PSA_ALG_IS_HASH(`hash_alg`) is true). This includes PSA_ALG_ANY_HASH when specifying the algorithm in a usage policy.

Returns
  The corresponding DSA signature algorithm.
  Unspecified if `hash_alg` is not a supported hash algorithm.

Definition at line 372 of file crypto_extra.h.

## ◆ PSA_ALG_DSA_BASE

#define PSA_ALG_DSA_BASE ((psa_algorithm_t)0x10040000)

Definition at line 357 of file crypto_extra.h.

## ◆ PSA_ALG_DSA_DETERMINISTIC_FLAG

#define PSA_ALG_DSA_DETERMINISTIC_FLAG PSA_ALG_ECDSA_DETERMINISTIC_FLAG

Definition at line 375 of file crypto_extra.h.

## ◆ PSA_ALG_DSA_IS_DETERMINISTIC

#define PSA_ALG_DSA_IS_DETERMINISTIC | ( |  | alg | ) | (((alg) & PSA_ALG_DSA_DETERMINISTIC_FLAG) != 0)

Definition at line 395 of file crypto_extra.h.

## ◆ PSA_ALG_ECDH

#define PSA_ALG_ECDH ((psa_algorithm_t)0x30200000)

The elliptic curve Diffie-Hellman (ECDH) key agreement algorithm.

The shared secret produced by key agreement is the x-coordinate of the shared secret point. It is always `ceiling(m / 8)` bytes long where `m` is the bit size associated with the curve, i.e. the bit size of the order of the curve's coordinate field. When `m` is not a multiple of 8, the byte containing the most significant bit of the shared secret is padded with zero bits. The byte order is either little-endian or big-endian depending on the curve type.

- For Montgomery curves (curve types `PSA_ECC_CURVE_CURVEXXX`), the shared secret is the x-coordinate of `d_A Q_B = d_B Q_A` in little-endian byte order. The bit size is 448 for Curve448 and 255 for Curve25519.
- For Weierstrass curves over prime fields (curve types `PSA_ECC_CURVE_SECPXXX` and `PSA_ECC_CURVE_BRAINPOOL_PXXX`), the shared secret is the x-coordinate of `d_A Q_B = d_B Q_A` in big-endian byte order. The bit size is `m = ceiling(log_2(p))` for the field `F_p`.
- For Weierstrass curves over binary fields (curve types `PSA_ECC_CURVE_SECTXXX`), the shared secret is the x-coordinate of `d_A Q_B = d_B Q_A` in big-endian byte order. The bit size is `m` for the field `F_{2^m}`.

Definition at line 1502 of file crypto_values.h.

## ◆ PSA_ALG_ECDSA

#define PSA_ALG_ECDSA | ( |  | hash_alg | ) | (PSA_ALG_ECDSA_BASE | ((hash_alg) & PSA_ALG_HASH_MASK))

ECDSA signature with hashing.

This is the ECDSA signature scheme defined by ANSI X9.62, with a random per-message secret number (k).

The representation of the signature as a byte string consists of the concatentation of the signature values r and s. Each of r and s is encoded as an N-octet string, where N is the length of the base point of the curve in octets. Each value is represented in big-endian order (most significant octet first).

Parameters

  hash_alg | A hash algorithm (`PSA_ALG_XXX` value such that PSA_ALG_IS_HASH(`hash_alg`) is true). This includes PSA_ALG_ANY_HASH when specifying the algorithm in a usage policy.

Returns
  The corresponding ECDSA signature algorithm.
  Unspecified if `hash_alg` is not a supported hash algorithm.

Definition at line 1161 of file crypto_values.h.

## ◆ PSA_ALG_ECDSA_ANY

#define PSA_ALG_ECDSA_ANY PSA_ALG_ECDSA_BASE

ECDSA signature without hashing.

This is the same signature scheme as PSA_ALG_ECDSA(), but without specifying a hash algorithm. This algorithm may only be used to sign or verify a sequence of bytes that should be an already-calculated hash. Note that the input is padded with zeros on the left or truncated on the left as required to fit the curve size.

Definition at line 1172 of file crypto_values.h.

## ◆ PSA_ALG_ECDSA_BASE

#define PSA_ALG_ECDSA_BASE ((psa_algorithm_t)0x10060000)

Definition at line 1140 of file crypto_values.h.

## ◆ PSA_ALG_ECDSA_DETERMINISTIC_FLAG

#define PSA_ALG_ECDSA_DETERMINISTIC_FLAG ((psa_algorithm_t)0x00010000)

Definition at line 1198 of file crypto_values.h.

## ◆ PSA_ALG_ECDSA_IS_DETERMINISTIC

#define PSA_ALG_ECDSA_IS_DETERMINISTIC | ( |  | alg | ) | (((alg) & PSA_ALG_ECDSA_DETERMINISTIC_FLAG) != 0)

Definition at line 1202 of file crypto_values.h.

## ◆ PSA_ALG_FFDH

#define PSA_ALG_FFDH ((psa_algorithm_t)0x30100000)

The finite-field Diffie-Hellman (DH) key agreement algorithm.

The shared secret produced by key agreement is `g^{ab}` in big-endian format. It is `ceiling(m / 8)` bytes long where `m` is the size of the prime `p` in bits.

Definition at line 1460 of file crypto_values.h.

## ◆ PSA_ALG_FULL_LENGTH_MAC

#define PSA_ALG_FULL_LENGTH_MAC | ( |  | mac_alg | ) | ((mac_alg) & ~PSA_ALG_MAC_TRUNCATION_MASK)

Macro to build the base MAC algorithm corresponding to a truncated MAC algorithm.

Parameters

  mac_alg | A MAC algorithm identifier (value of type psa_algorithm_t such that PSA_ALG_IS_MAC(`alg`) is true). This may be a truncated or untruncated MAC algorithm.

Returns
  The corresponding base MAC algorithm.
  Unspecified if `alg` is not a supported MAC algorithm.

Definition at line 881 of file crypto_values.h.

## ◆ PSA_ALG_GCM

#define PSA_ALG_GCM ((psa_algorithm_t)0x06401002)

The GCM authenticated encryption algorithm.

The underlying block cipher is determined by the key type.

Definition at line 1026 of file crypto_values.h.

## ◆ PSA_ALG_HASH_MASK

#define PSA_ALG_HASH_MASK ((psa_algorithm_t)0x000000ff)

Definition at line 722 of file crypto_values.h.

## ◆ PSA_ALG_HKDF

#define PSA_ALG_HKDF | ( |  | hash_alg | ) | (PSA_ALG_HKDF_BASE | ((hash_alg) & PSA_ALG_HASH_MASK))

Macro to build an HKDF algorithm.

For example, `PSA_ALG_HKDF(PSA_ALG_SHA256)` is HKDF using HMAC-SHA-256.

This key derivation algorithm uses the following inputs:

- PSA_KEY_DERIVATION_INPUT_SALT is the salt used in the "extract" step. It is optional; if omitted, the derivation uses an empty salt.
- PSA_KEY_DERIVATION_INPUT_SECRET is the secret key used in the "extract" step.
- PSA_KEY_DERIVATION_INPUT_INFO is the info string used in the "expand" step. You must pass PSA_KEY_DERIVATION_INPUT_SALT before PSA_KEY_DERIVATION_INPUT_SECRET. You may pass PSA_KEY_DERIVATION_INPUT_INFO at any time after steup and before starting to generate output.

Parameters

  hash_alg | A hash algorithm (`PSA_ALG_XXX` value such that PSA_ALG_IS_HASH(`hash_alg`) is true).

Returns
  The corresponding HKDF algorithm.
  Unspecified if `hash_alg` is not a supported hash algorithm.

Definition at line 1299 of file crypto_values.h.

## ◆ PSA_ALG_HKDF_BASE

#define PSA_ALG_HKDF_BASE ((psa_algorithm_t)0x20000100)

Definition at line 1278 of file crypto_values.h.

## ◆ PSA_ALG_HKDF_GET_HASH

#define PSA_ALG_HKDF_GET_HASH | ( |  | hkdf_alg | ) | (PSA_ALG_CATEGORY_HASH | ((hkdf_alg) & PSA_ALG_HASH_MASK))

Definition at line 1314 of file crypto_values.h.

## ◆ PSA_ALG_HMAC

#define PSA_ALG_HMAC | ( |  | hash_alg | ) | (PSA_ALG_HMAC_BASE | ((hash_alg) & PSA_ALG_HASH_MASK))

Macro to build an HMAC algorithm.

For example, PSA_ALG_HMAC(PSA_ALG_SHA_256) is HMAC-SHA-256.

Parameters

  hash_alg | A hash algorithm (`PSA_ALG_XXX` value such that PSA_ALG_IS_HASH(`hash_alg`) is true).

Returns
  The corresponding HMAC algorithm.
  Unspecified if `hash_alg` is not a supported hash algorithm.

Definition at line 802 of file crypto_values.h.

## ◆ PSA_ALG_HMAC_BASE

#define PSA_ALG_HMAC_BASE ((psa_algorithm_t)0x02800000)

Definition at line 790 of file crypto_values.h.

## ◆ PSA_ALG_HMAC_GET_HASH

#define PSA_ALG_HMAC_GET_HASH | ( |  | hmac_alg | ) | (PSA_ALG_CATEGORY_HASH | ((hmac_alg) & PSA_ALG_HASH_MASK))

Definition at line 805 of file crypto_values.h.

## ◆ PSA_ALG_IS_AEAD

#define PSA_ALG_IS_AEAD | ( |  | alg | ) | (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_AEAD)

Whether the specified algorithm is an authenticated encryption with associated data (AEAD) algorithm.

Parameters

  alg | An algorithm identifier (value of type psa_algorithm_t).

Returns
  1 if `alg` is an AEAD algorithm, 0 otherwise. This macro may return either 0 or 1 if `alg` is not a supported algorithm identifier.

Definition at line 673 of file crypto_values.h.

## ◆ PSA_ALG_IS_AEAD_ON_BLOCK_CIPHER

#define PSA_ALG_IS_AEAD_ON_BLOCK_CIPHER | ( |  | alg | ) |

Value:
(((alg) & (PSA_ALG_CATEGORY_MASK | PSA_ALG_AEAD_FROM_BLOCK_FLAG)) == \
(PSA_ALG_CATEGORY_AEAD | PSA_ALG_AEAD_FROM_BLOCK_FLAG))

Whether the specified algorithm is an AEAD mode on a block cipher.

Parameters

  alg | An algorithm identifier (value of type psa_algorithm_t).

Returns
  1 if `alg` is an AEAD algorithm which is an AEAD mode based on a block cipher, 0 otherwise. This macro may return either 0 or 1 if `alg` is not a supported algorithm identifier.

Definition at line 1012 of file crypto_values.h.

## ◆ PSA_ALG_IS_ASYMMETRIC_ENCRYPTION

#define PSA_ALG_IS_ASYMMETRIC_ENCRYPTION | ( |  | alg | ) | (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_ASYMMETRIC_ENCRYPTION)

Whether the specified algorithm is an asymmetric encryption algorithm, also known as public-key encryption algorithm.

Parameters

  alg | An algorithm identifier (value of type psa_algorithm_t).

Returns
  1 if `alg` is an asymmetric encryption algorithm, 0 otherwise. This macro may return either 0 or 1 if `alg` is not a supported algorithm identifier.

Definition at line 697 of file crypto_values.h.

## ◆ PSA_ALG_IS_BLOCK_CIPHER_MAC

#define PSA_ALG_IS_BLOCK_CIPHER_MAC | ( |  | alg | ) |

Value:
(((alg) & (PSA_ALG_CATEGORY_MASK | PSA_ALG_MAC_SUBCATEGORY_MASK)) == \
PSA_ALG_CIPHER_MAC_BASE)

Whether the specified algorithm is a MAC algorithm based on a block cipher.

Parameters

  alg | An algorithm identifier (value of type psa_algorithm_t).

Returns
  1 if `alg` is a MAC algorithm based on a block cipher, 0 otherwise. This macro may return either 0 or 1 if `alg` is not a supported algorithm identifier.

Definition at line 916 of file crypto_values.h.

## ◆ PSA_ALG_IS_CIPHER

#define PSA_ALG_IS_CIPHER | ( |  | alg | ) | (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_CIPHER)

Whether the specified algorithm is a symmetric cipher algorithm.

Parameters

  alg | An algorithm identifier (value of type psa_algorithm_t).

Returns
  1 if `alg` is a symmetric cipher algorithm, 0 otherwise. This macro may return either 0 or 1 if `alg` is not a supported algorithm identifier.

Definition at line 661 of file crypto_values.h.

## ◆ PSA_ALG_IS_DETERMINISTIC_DSA

#define PSA_ALG_IS_DETERMINISTIC_DSA | ( |  | alg | ) | (PSA_ALG_IS_DSA(alg) && PSA_ALG_DSA_IS_DETERMINISTIC(alg))

Definition at line 397 of file crypto_extra.h.

## ◆ PSA_ALG_IS_DETERMINISTIC_ECDSA

#define PSA_ALG_IS_DETERMINISTIC_ECDSA | ( |  | alg | ) | (PSA_ALG_IS_ECDSA(alg) && PSA_ALG_ECDSA_IS_DETERMINISTIC(alg))

Definition at line 1204 of file crypto_values.h.

## ◆ PSA_ALG_IS_DSA

#define PSA_ALG_IS_DSA | ( |  | alg | ) |

Value:
(((alg) & ~PSA_ALG_HASH_MASK & ~PSA_ALG_DSA_DETERMINISTIC_FLAG) == \
PSA_ALG_DSA_BASE)

Definition at line 392 of file crypto_extra.h.

## ◆ PSA_ALG_IS_ECDH

#define PSA_ALG_IS_ECDH | ( |  | alg | ) | (PSA_ALG_KEY_AGREEMENT_GET_BASE(alg) == PSA_ALG_ECDH)

Whether the specified algorithm is an elliptic curve Diffie-Hellman algorithm.

This includes the raw elliptic curve Diffie-Hellman algorithm as well as elliptic curve Diffie-Hellman followed by any supporter key derivation algorithm.

Parameters

  alg | An algorithm identifier (value of type psa_algorithm_t).

Returns
  1 if `alg` is an elliptic curve Diffie-Hellman algorithm, 0 otherwise. This macro may return either 0 or 1 if `alg` is not a supported key agreement algorithm identifier.

Definition at line 1518 of file crypto_values.h.

## ◆ PSA_ALG_IS_ECDSA

#define PSA_ALG_IS_ECDSA | ( |  | alg | ) |

Value:
(((alg) & ~PSA_ALG_HASH_MASK & ~PSA_ALG_ECDSA_DETERMINISTIC_FLAG) == \
PSA_ALG_ECDSA_BASE)

Definition at line 1199 of file crypto_values.h.

## ◆ PSA_ALG_IS_FFDH

#define PSA_ALG_IS_FFDH | ( |  | alg | ) | (PSA_ALG_KEY_AGREEMENT_GET_BASE(alg) == PSA_ALG_FFDH)

Whether the specified algorithm is a finite field Diffie-Hellman algorithm.

This includes the raw finite field Diffie-Hellman algorithm as well as finite-field Diffie-Hellman followed by any supporter key derivation algorithm.

Parameters

  alg | An algorithm identifier (value of type psa_algorithm_t).

Returns
  1 if `alg` is a finite field Diffie-Hellman algorithm, 0 otherwise. This macro may return either 0 or 1 if `alg` is not a supported key agreement algorithm identifier.

Definition at line 1474 of file crypto_values.h.

## ◆ PSA_ALG_IS_HASH

#define PSA_ALG_IS_HASH | ( |  | alg | ) | (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_HASH)

Whether the specified algorithm is a hash algorithm.

Parameters

  alg | An algorithm identifier (value of type psa_algorithm_t).

Returns
  1 if `alg` is a hash algorithm, 0 otherwise. This macro may return either 0 or 1 if `alg` is not a supported algorithm identifier.

Definition at line 639 of file crypto_values.h.

## ◆ PSA_ALG_IS_HASH_AND_SIGN [1/2]

#define PSA_ALG_IS_HASH_AND_SIGN | ( |  | alg | ) |

Value:
(PSA_ALG_IS_RSA_PSS(alg) || PSA_ALG_IS_RSA_PKCS1V15_SIGN(alg) || \
PSA_ALG_IS_DSA(alg) || PSA_ALG_IS_ECDSA(alg))

Definition at line 406 of file crypto_extra.h.

## ◆ PSA_ALG_IS_HASH_AND_SIGN [2/2]

#define PSA_ALG_IS_HASH_AND_SIGN | ( |  | alg | ) |

Value:
(PSA_ALG_IS_RSA_PSS(alg) || PSA_ALG_IS_RSA_PKCS1V15_SIGN(alg) || \
PSA_ALG_IS_ECDSA(alg))

Whether the specified algorithm is a hash-and-sign algorithm.

Hash-and-sign algorithms are asymmetric (public-key) signature algorithms structured in two parts: first the calculation of a hash in a way that does not depend on the key, then the calculation of a signature from the hash value and the key.

Parameters

  alg | An algorithm identifier (value of type psa_algorithm_t).

Returns
  1 if `alg` is a hash-and-sign algorithm, 0 otherwise. This macro may return either 0 or 1 if `alg` is not a supported algorithm identifier.

Definition at line 1222 of file crypto_values.h.

## ◆ PSA_ALG_IS_HKDF

#define PSA_ALG_IS_HKDF | ( |  | alg | ) | (((alg) & ~PSA_ALG_HASH_MASK) == PSA_ALG_HKDF_BASE)

Whether the specified algorithm is an HKDF algorithm.

HKDF is a family of key derivation algorithms that are based on a hash function and the HMAC construction.

Parameters

  alg | An algorithm identifier (value of type psa_algorithm_t).

Returns
  1 if `alg` is an HKDF algorithm, 0 otherwise. This macro may return either 0 or 1 if `alg` is not a supported key derivation algorithm identifier.

Definition at line 1312 of file crypto_values.h.

## ◆ PSA_ALG_IS_HMAC

#define PSA_ALG_IS_HMAC | ( |  | alg | ) |

Value:
(((alg) & (PSA_ALG_CATEGORY_MASK | PSA_ALG_MAC_SUBCATEGORY_MASK)) == \
PSA_ALG_HMAC_BASE)

Whether the specified algorithm is an HMAC algorithm.

HMAC is a family of MAC algorithms that are based on a hash function.

Parameters

  alg | An algorithm identifier (value of type psa_algorithm_t).

Returns
  1 if `alg` is an HMAC algorithm, 0 otherwise. This macro may return either 0 or 1 if `alg` is not a supported algorithm identifier.

Definition at line 818 of file crypto_values.h.

## ◆ PSA_ALG_IS_KEY_AGREEMENT

#define PSA_ALG_IS_KEY_AGREEMENT | ( |  | alg | ) | (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_KEY_AGREEMENT)

Whether the specified algorithm is a key agreement algorithm.

Parameters

  alg | An algorithm identifier (value of type psa_algorithm_t).

Returns
  1 if `alg` is a key agreement algorithm, 0 otherwise. This macro may return either 0 or 1 if `alg` is not a supported algorithm identifier.

Definition at line 708 of file crypto_values.h.

## ◆ PSA_ALG_IS_KEY_DERIVATION

#define PSA_ALG_IS_KEY_DERIVATION | ( |  | alg | ) | (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_KEY_DERIVATION)

Whether the specified algorithm is a key derivation algorithm.

Parameters

  alg | An algorithm identifier (value of type psa_algorithm_t).

Returns
  1 if `alg` is a key derivation algorithm, 0 otherwise. This macro may return either 0 or 1 if `alg` is not a supported algorithm identifier.

Definition at line 719 of file crypto_values.h.

## ◆ PSA_ALG_IS_KEY_DERIVATION_OR_AGREEMENT

#define PSA_ALG_IS_KEY_DERIVATION_OR_AGREEMENT | ( |  | alg | ) | ((PSA_ALG_IS_KEY_DERIVATION(alg) || PSA_ALG_IS_KEY_AGREEMENT(alg)))

Definition at line 1450 of file crypto_values.h.

## ◆ PSA_ALG_IS_MAC

#define PSA_ALG_IS_MAC | ( |  | alg | ) | (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_MAC)

Whether the specified algorithm is a MAC algorithm.

Parameters

  alg | An algorithm identifier (value of type psa_algorithm_t).

Returns
  1 if `alg` is a MAC algorithm, 0 otherwise. This macro may return either 0 or 1 if `alg` is not a supported algorithm identifier.

Definition at line 650 of file crypto_values.h.

## ◆ PSA_ALG_IS_RANDOMIZED_DSA

#define PSA_ALG_IS_RANDOMIZED_DSA | ( |  | alg | ) | (PSA_ALG_IS_DSA(alg) && !PSA_ALG_DSA_IS_DETERMINISTIC(alg))

Definition at line 399 of file crypto_extra.h.

## ◆ PSA_ALG_IS_RANDOMIZED_ECDSA

#define PSA_ALG_IS_RANDOMIZED_ECDSA | ( |  | alg | ) | (PSA_ALG_IS_ECDSA(alg) && !PSA_ALG_ECDSA_IS_DETERMINISTIC(alg))

Definition at line 1206 of file crypto_values.h.

## ◆ PSA_ALG_IS_RAW_KEY_AGREEMENT

#define PSA_ALG_IS_RAW_KEY_AGREEMENT | ( |  | alg | ) |

Value:
(PSA_ALG_IS_KEY_AGREEMENT(alg) && \
PSA_ALG_KEY_AGREEMENT_GET_KDF(alg) == PSA_ALG_CATEGORY_KEY_DERIVATION)

Whether the specified algorithm is a raw key agreement algorithm.

A raw key agreement algorithm is one that does not specify a key derivation function. Usually, raw key agreement algorithms are constructed directly with a `PSA_ALG_xxx` macro while non-raw key agreement algorithms are constructed with PSA_ALG_KEY_AGREEMENT().

Parameters

  alg | An algorithm identifier (value of type psa_algorithm_t).

Returns
  1 if `alg` is a raw key agreement algorithm, 0 otherwise. This macro may return either 0 or 1 if `alg` is not a supported algorithm identifier.

Definition at line 1446 of file crypto_values.h.

## ◆ PSA_ALG_IS_RSA_OAEP

#define PSA_ALG_IS_RSA_OAEP | ( |  | alg | ) | (((alg) & ~PSA_ALG_HASH_MASK) == PSA_ALG_RSA_OAEP_BASE)

Definition at line 1271 of file crypto_values.h.

## ◆ PSA_ALG_IS_RSA_PKCS1V15_SIGN

#define PSA_ALG_IS_RSA_PKCS1V15_SIGN | ( |  | alg | ) | (((alg) & ~PSA_ALG_HASH_MASK) == PSA_ALG_RSA_PKCS1V15_SIGN_BASE)

Definition at line 1113 of file crypto_values.h.

## ◆ PSA_ALG_IS_RSA_PSS

#define PSA_ALG_IS_RSA_PSS | ( |  | alg | ) | (((alg) & ~PSA_ALG_HASH_MASK) == PSA_ALG_RSA_PSS_BASE)

Definition at line 1137 of file crypto_values.h.

## ◆ PSA_ALG_IS_SIGN

#define PSA_ALG_IS_SIGN | ( |  | alg | ) | (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_SIGN)

Whether the specified algorithm is an asymmetric signature algorithm, also known as public-key signature algorithm.

Parameters

  alg | An algorithm identifier (value of type psa_algorithm_t).

Returns
  1 if `alg` is an asymmetric signature algorithm, 0 otherwise. This macro may return either 0 or 1 if `alg` is not a supported algorithm identifier.

Definition at line 685 of file crypto_values.h.

## ◆ PSA_ALG_IS_STREAM_CIPHER

#define PSA_ALG_IS_STREAM_CIPHER | ( |  | alg | ) |

Value:
(((alg) & (PSA_ALG_CATEGORY_MASK | PSA_ALG_CIPHER_STREAM_FLAG)) == \
(PSA_ALG_CATEGORY_CIPHER | PSA_ALG_CIPHER_STREAM_FLAG))

Whether the specified algorithm is a stream cipher.

A stream cipher is a symmetric cipher that encrypts or decrypts messages by applying a bitwise-xor with a stream of bytes that is generated from a key.

Parameters

  alg | An algorithm identifier (value of type psa_algorithm_t).

Returns
  1 if `alg` is a stream cipher algorithm, 0 otherwise. This macro may return either 0 or 1 if `alg` is not a supported algorithm identifier or if it is not a symmetric cipher algorithm.

Definition at line 935 of file crypto_values.h.

## ◆ PSA_ALG_IS_TLS12_PRF

#define PSA_ALG_IS_TLS12_PRF | ( |  | alg | ) | (((alg) & ~PSA_ALG_HASH_MASK) == PSA_ALG_TLS12_PRF_BASE)

Whether the specified algorithm is a TLS-1.2 PRF algorithm.

Parameters

  alg | An algorithm identifier (value of type psa_algorithm_t).

Returns
  1 if `alg` is a TLS-1.2 PRF algorithm, 0 otherwise. This macro may return either 0 or 1 if `alg` is not a supported key derivation algorithm identifier.

Definition at line 1355 of file crypto_values.h.

## ◆ PSA_ALG_IS_TLS12_PSK_TO_MS

#define PSA_ALG_IS_TLS12_PSK_TO_MS | ( |  | alg | ) | (((alg) & ~PSA_ALG_HASH_MASK) == PSA_ALG_TLS12_PSK_TO_MS_BASE)

Whether the specified algorithm is a TLS-1.2 PSK to MS algorithm.

Parameters

  alg | An algorithm identifier (value of type psa_algorithm_t).

Returns
  1 if `alg` is a TLS-1.2 PSK to MS algorithm, 0 otherwise. This macro may return either 0 or 1 if `alg` is not a supported key derivation algorithm identifier.

Definition at line 1401 of file crypto_values.h.

## ◆ PSA_ALG_IS_VENDOR_DEFINED

#define PSA_ALG_IS_VENDOR_DEFINED | ( |  | alg | ) | (((alg) & PSA_ALG_VENDOR_FLAG) != 0)

Whether an algorithm is vendor-defined.

See also PSA_ALG_VENDOR_FLAG.

Definition at line 628 of file crypto_values.h.

## ◆ PSA_ALG_IS_WILDCARD

#define PSA_ALG_IS_WILDCARD | ( |  | alg | ) |

Value:
(PSA_ALG_IS_HASH_AND_SIGN(alg) ? \
PSA_ALG_SIGN_GET_HASH(alg) == PSA_ALG_ANY_HASH : \
(alg) == PSA_ALG_ANY_HASH)

Whether the specified algorithm encoding is a wildcard.

Wildcard values may only be used to set the usage algorithm field in a policy, not to perform an operation.

Parameters

  alg | An algorithm identifier (value of type psa_algorithm_t).

Returns
  1 if `alg` is a wildcard algorithm encoding.
  0 if `alg` is a non-wildcard algorithm encoding (suitable for an operation).
  This macro may return either 0 or 1 if `alg` is not a supported algorithm identifier.

Definition at line 1534 of file crypto_values.h.

## ◆ PSA_ALG_KEY_AGREEMENT

#define PSA_ALG_KEY_AGREEMENT | ( |  | ka_alg,
|  |  | kdf_alg
| ) |  | ((ka_alg) | (kdf_alg))

Macro to build a combined algorithm that chains a key agreement with a key derivation.

Parameters

  ka_alg | A key agreement algorithm (`PSA_ALG_XXX` value such that PSA_ALG_IS_KEY_AGREEMENT(`ka_alg`) is true).
  kdf_alg | A key derivation algorithm (`PSA_ALG_XXX` value such that PSA_ALG_IS_KEY_DERIVATION(`kdf_alg`) is true).

Returns
  The corresponding key agreement and derivation algorithm.
  Unspecified if `ka_alg` is not a supported key agreement algorithm or `kdf_alg` is not a supported key derivation algorithm.

Definition at line 1423 of file crypto_values.h.

## ◆ PSA_ALG_KEY_AGREEMENT_GET_BASE

#define PSA_ALG_KEY_AGREEMENT_GET_BASE | ( |  | alg | ) | (((alg) & PSA_ALG_KEY_AGREEMENT_MASK) | PSA_ALG_CATEGORY_KEY_AGREEMENT)

Definition at line 1429 of file crypto_values.h.

## ◆ PSA_ALG_KEY_AGREEMENT_GET_KDF

#define PSA_ALG_KEY_AGREEMENT_GET_KDF | ( |  | alg | ) | (((alg) & PSA_ALG_KEY_DERIVATION_MASK) | PSA_ALG_CATEGORY_KEY_DERIVATION)

Definition at line 1426 of file crypto_values.h.

## ◆ PSA_ALG_KEY_AGREEMENT_MASK

#define PSA_ALG_KEY_AGREEMENT_MASK ((psa_algorithm_t)0x10fc0000)

Definition at line 1407 of file crypto_values.h.

## ◆ PSA_ALG_KEY_DERIVATION_MASK

#define PSA_ALG_KEY_DERIVATION_MASK ((psa_algorithm_t)0x0803ffff)

Definition at line 1406 of file crypto_values.h.

## ◆ PSA_ALG_MAC_SUBCATEGORY_MASK

#define PSA_ALG_MAC_SUBCATEGORY_MASK ((psa_algorithm_t)0x00c00000)

Definition at line 789 of file crypto_values.h.

## ◆ PSA_ALG_MAC_TRUNCATION_MASK

#define PSA_ALG_MAC_TRUNCATION_MASK ((psa_algorithm_t)0x00003f00)

Definition at line 829 of file crypto_values.h.

## ◆ PSA_ALG_MD2

#define PSA_ALG_MD2 ((psa_algorithm_t)0x01000001)

MD2

Definition at line 724 of file crypto_values.h.

## ◆ PSA_ALG_MD4

#define PSA_ALG_MD4 ((psa_algorithm_t)0x01000002)

MD4

Definition at line 726 of file crypto_values.h.

## ◆ PSA_ALG_MD5

#define PSA_ALG_MD5 ((psa_algorithm_t)0x01000003)

MD5

Definition at line 728 of file crypto_values.h.

## ◆ PSA_ALG_OFB

#define PSA_ALG_OFB ((psa_algorithm_t)0x04c00003)

The OFB stream cipher mode.

The underlying block cipher is determined by the key type.

Definition at line 974 of file crypto_values.h.

## ◆ PSA_ALG_RIPEMD160

#define PSA_ALG_RIPEMD160 ((psa_algorithm_t)0x01000004)

PSA_ALG_RIPEMD160

Definition at line 730 of file crypto_values.h.

## ◆ PSA_ALG_RSA_OAEP

#define PSA_ALG_RSA_OAEP | ( |  | hash_alg | ) | (PSA_ALG_RSA_OAEP_BASE | ((hash_alg) & PSA_ALG_HASH_MASK))

RSA OAEP encryption.

This is the encryption scheme defined by RFC 8017 (PKCS#1: RSA Cryptography Specifications) under the name RSAES-OAEP, with the message generation function MGF1.

Parameters

  hash_alg | The hash algorithm (`PSA_ALG_XXX` value such that PSA_ALG_IS_HASH(`hash_alg`) is true) to use for MGF1.

Returns
  The corresponding RSA OAEP encryption algorithm.
  Unspecified if `hash_alg` is not a supported hash algorithm.

Definition at line 1269 of file crypto_values.h.

## ◆ PSA_ALG_RSA_OAEP_BASE

#define PSA_ALG_RSA_OAEP_BASE ((psa_algorithm_t)0x12030000)

Definition at line 1254 of file crypto_values.h.

## ◆ PSA_ALG_RSA_OAEP_GET_HASH

#define PSA_ALG_RSA_OAEP_GET_HASH | ( |  | alg | ) |

Value:
(PSA_ALG_IS_RSA_OAEP(alg) ? \
((alg) & PSA_ALG_HASH_MASK) | PSA_ALG_CATEGORY_HASH : \
0)

Definition at line 1273 of file crypto_values.h.

## ◆ PSA_ALG_RSA_PKCS1V15_CRYPT

#define PSA_ALG_RSA_PKCS1V15_CRYPT ((psa_algorithm_t)0x12020000)

RSA PKCS#1 v1.5 encryption.

Definition at line 1252 of file crypto_values.h.

## ◆ PSA_ALG_RSA_PKCS1V15_SIGN

#define PSA_ALG_RSA_PKCS1V15_SIGN | ( |  | hash_alg | ) | (PSA_ALG_RSA_PKCS1V15_SIGN_BASE | ((hash_alg) & PSA_ALG_HASH_MASK))

RSA PKCS#1 v1.5 signature with hashing.

This is the signature scheme defined by RFC 8017 (PKCS#1: RSA Cryptography Specifications) under the name RSASSA-PKCS1-v1_5.

Parameters

  hash_alg | A hash algorithm (`PSA_ALG_XXX` value such that PSA_ALG_IS_HASH(`hash_alg`) is true). This includes PSA_ALG_ANY_HASH when specifying the algorithm in a usage policy.

Returns
  The corresponding RSA PKCS#1 v1.5 signature algorithm.
  Unspecified if `hash_alg` is not a supported hash algorithm.

Definition at line 1104 of file crypto_values.h.

## ◆ PSA_ALG_RSA_PKCS1V15_SIGN_BASE

#define PSA_ALG_RSA_PKCS1V15_SIGN_BASE ((psa_algorithm_t)0x10020000)

Definition at line 1088 of file crypto_values.h.

## ◆ PSA_ALG_RSA_PKCS1V15_SIGN_RAW

#define PSA_ALG_RSA_PKCS1V15_SIGN_RAW PSA_ALG_RSA_PKCS1V15_SIGN_BASE

Raw PKCS#1 v1.5 signature.

The input to this algorithm is the DigestInfo structure used by RFC 8017 (PKCS#1: RSA Cryptography Specifications), §9.2 steps 3–6.

Definition at line 1112 of file crypto_values.h.

## ◆ PSA_ALG_RSA_PSS

#define PSA_ALG_RSA_PSS | ( |  | hash_alg | ) | (PSA_ALG_RSA_PSS_BASE | ((hash_alg) & PSA_ALG_HASH_MASK))

RSA PSS signature with hashing.

This is the signature scheme defined by RFC 8017 (PKCS#1: RSA Cryptography Specifications) under the name RSASSA-PSS, with the message generation function MGF1, and with a salt length equal to the length of the hash. The specified hash algorithm is used to hash the input message, to create the salted hash, and for the mask generation.

Parameters

  hash_alg | A hash algorithm (`PSA_ALG_XXX` value such that PSA_ALG_IS_HASH(`hash_alg`) is true). This includes PSA_ALG_ANY_HASH when specifying the algorithm in a usage policy.

Returns
  The corresponding RSA PSS signature algorithm.
  Unspecified if `hash_alg` is not a supported hash algorithm.

Definition at line 1135 of file crypto_values.h.

## ◆ PSA_ALG_RSA_PSS_BASE

#define PSA_ALG_RSA_PSS_BASE ((psa_algorithm_t)0x10030000)

Definition at line 1116 of file crypto_values.h.

## ◆ PSA_ALG_SHA3_224

#define PSA_ALG_SHA3_224 ((psa_algorithm_t)0x01000010)

SHA3-224

Definition at line 746 of file crypto_values.h.

## ◆ PSA_ALG_SHA3_256

#define PSA_ALG_SHA3_256 ((psa_algorithm_t)0x01000011)

SHA3-256

Definition at line 748 of file crypto_values.h.

## ◆ PSA_ALG_SHA3_384

#define PSA_ALG_SHA3_384 ((psa_algorithm_t)0x01000012)

SHA3-384

Definition at line 750 of file crypto_values.h.

## ◆ PSA_ALG_SHA3_512

#define PSA_ALG_SHA3_512 ((psa_algorithm_t)0x01000013)

SHA3-512

Definition at line 752 of file crypto_values.h.

## ◆ PSA_ALG_SHA_1

#define PSA_ALG_SHA_1 ((psa_algorithm_t)0x01000005)

SHA1

Definition at line 732 of file crypto_values.h.

## ◆ PSA_ALG_SHA_224

#define PSA_ALG_SHA_224 ((psa_algorithm_t)0x01000008)

SHA2-224

Definition at line 734 of file crypto_values.h.

## ◆ PSA_ALG_SHA_256

#define PSA_ALG_SHA_256 ((psa_algorithm_t)0x01000009)

SHA2-256

Definition at line 736 of file crypto_values.h.

## ◆ PSA_ALG_SHA_384

#define PSA_ALG_SHA_384 ((psa_algorithm_t)0x0100000a)

SHA2-384

Definition at line 738 of file crypto_values.h.

## ◆ PSA_ALG_SHA_512

#define PSA_ALG_SHA_512 ((psa_algorithm_t)0x0100000b)

SHA2-512

Definition at line 740 of file crypto_values.h.

## ◆ PSA_ALG_SHA_512_224

#define PSA_ALG_SHA_512_224 ((psa_algorithm_t)0x0100000c)

SHA2-512/224

Definition at line 742 of file crypto_values.h.

## ◆ PSA_ALG_SHA_512_256

#define PSA_ALG_SHA_512_256 ((psa_algorithm_t)0x0100000d)

SHA2-512/256

Definition at line 744 of file crypto_values.h.

## ◆ PSA_ALG_SIGN_GET_HASH

#define PSA_ALG_SIGN_GET_HASH | ( |  | alg | ) |

Value:
(PSA_ALG_IS_HASH_AND_SIGN(alg) ? \
((alg) & PSA_ALG_HASH_MASK) == 0 ? /*"raw" algorithm*/ 0 : \
((alg) & PSA_ALG_HASH_MASK) | PSA_ALG_CATEGORY_HASH : \
0)

Get the hash used by a hash-and-sign signature algorithm.

A hash-and-sign algorithm is a signature algorithm which is composed of two phases: first a hashing phase which does not use the key and produces a hash of the input message, then a signing phase which only uses the hash and the key and not the message itself.

Parameters

  alg | A signature algorithm (`PSA_ALG_XXX` value such that PSA_ALG_IS_SIGN(`alg`) is true).

Returns
  The underlying hash algorithm if `alg` is a hash-and-sign algorithm.
  0 if `alg` is a signature algorithm that does not follow the hash-and-sign structure.
  Unspecified if `alg` is not a signature algorithm or if it is not supported by the implementation.

Definition at line 1244 of file crypto_values.h.

## ◆ PSA_ALG_TLS12_PRF

#define PSA_ALG_TLS12_PRF | ( |  | hash_alg | ) | (PSA_ALG_TLS12_PRF_BASE | ((hash_alg) & PSA_ALG_HASH_MASK))

Macro to build a TLS-1.2 PRF algorithm.

TLS 1.2 uses a custom pseudorandom function (PRF) for key schedule, specified in Section 5 of RFC 5246. It is based on HMAC and can be used with either SHA-256 or SHA-384.

This key derivation algorithm uses the following inputs, which must be passed in the order given here:

- PSA_KEY_DERIVATION_INPUT_SEED is the seed.
- PSA_KEY_DERIVATION_INPUT_SECRET is the secret key.
- PSA_KEY_DERIVATION_INPUT_LABEL is the label.

For the application to TLS-1.2 key expansion, the seed is the concatenation of ServerHello.Random + ClientHello.Random, and the label is "key expansion".

For example, `PSA_ALG_TLS12_PRF(PSA_ALG_SHA256)` represents the TLS 1.2 PRF using HMAC-SHA-256.

Parameters

  hash_alg | A hash algorithm (`PSA_ALG_XXX` value such that PSA_ALG_IS_HASH(`hash_alg`) is true).

Returns
  The corresponding TLS-1.2 PRF algorithm.
  Unspecified if `hash_alg` is not a supported hash algorithm.

Definition at line 1344 of file crypto_values.h.

## ◆ PSA_ALG_TLS12_PRF_BASE

#define PSA_ALG_TLS12_PRF_BASE ((psa_algorithm_t)0x20000200)

Definition at line 1317 of file crypto_values.h.

## ◆ PSA_ALG_TLS12_PRF_GET_HASH

#define PSA_ALG_TLS12_PRF_GET_HASH | ( |  | hkdf_alg | ) | (PSA_ALG_CATEGORY_HASH | ((hkdf_alg) & PSA_ALG_HASH_MASK))

Definition at line 1357 of file crypto_values.h.

## ◆ PSA_ALG_TLS12_PSK_TO_MS

#define PSA_ALG_TLS12_PSK_TO_MS | ( |  | hash_alg | ) | (PSA_ALG_TLS12_PSK_TO_MS_BASE | ((hash_alg) & PSA_ALG_HASH_MASK))

Macro to build a TLS-1.2 PSK-to-MasterSecret algorithm.

In a pure-PSK handshake in TLS 1.2, the master secret is derived from the PreSharedKey (PSK) through the application of padding (RFC 4279, Section 2) and the TLS-1.2 PRF (RFC 5246, Section 5). The latter is based on HMAC and can be used with either SHA-256 or SHA-384.

This key derivation algorithm uses the following inputs, which must be passed in the order given here:

- PSA_KEY_DERIVATION_INPUT_SEED is the seed.
- PSA_KEY_DERIVATION_INPUT_SECRET is the secret key.
- PSA_KEY_DERIVATION_INPUT_LABEL is the label.

For the application to TLS-1.2, the seed (which is forwarded to the TLS-1.2 PRF) is the concatenation of the ClientHello.Random + ServerHello.Random, and the label is "master secret" or "extended master secret".

For example, `PSA_ALG_TLS12_PSK_TO_MS(PSA_ALG_SHA256)` represents the TLS-1.2 PSK to MasterSecret derivation PRF using HMAC-SHA-256.

Parameters

  hash_alg | A hash algorithm (`PSA_ALG_XXX` value such that PSA_ALG_IS_HASH(`hash_alg`) is true).

Returns
  The corresponding TLS-1.2 PSK to MS algorithm.
  Unspecified if `hash_alg` is not a supported hash algorithm.

Definition at line 1390 of file crypto_values.h.

## ◆ PSA_ALG_TLS12_PSK_TO_MS_BASE

#define PSA_ALG_TLS12_PSK_TO_MS_BASE ((psa_algorithm_t)0x20000300)

Definition at line 1360 of file crypto_values.h.

## ◆ PSA_ALG_TLS12_PSK_TO_MS_GET_HASH

#define PSA_ALG_TLS12_PSK_TO_MS_GET_HASH | ( |  | hkdf_alg | ) | (PSA_ALG_CATEGORY_HASH | ((hkdf_alg) & PSA_ALG_HASH_MASK))

Definition at line 1403 of file crypto_values.h.

## ◆ PSA_ALG_TRUNCATED_MAC

#define PSA_ALG_TRUNCATED_MAC | ( |  | mac_alg,
|  |  | mac_length
| ) |  |

Value:
(((mac_alg) & ~PSA_ALG_MAC_TRUNCATION_MASK) | \
((mac_length) << PSA_MAC_TRUNCATION_OFFSET & PSA_ALG_MAC_TRUNCATION_MASK))

Macro to build a truncated MAC algorithm.

A truncated MAC algorithm is identical to the corresponding MAC algorithm except that the MAC value for the truncated algorithm consists of only the first `mac_length` bytes of the MAC value for the untruncated algorithm.

Note
  This macro may allow constructing algorithm identifiers that are not valid, either because the specified length is larger than the untruncated MAC or because the specified length is smaller than permitted by the implementation.
  It is implementation-defined whether a truncated MAC that is truncated to the same length as the MAC of the untruncated algorithm is considered identical to the untruncated algorithm for policy comparison purposes.

Parameters

  mac_alg | A MAC algorithm identifier (value of type psa_algorithm_t such that PSA_ALG_IS_MAC(`alg`) is true). This may be a truncated or untruncated MAC algorithm.
  mac_length | Desired length of the truncated MAC in bytes. This must be at most the full length of the MAC and must be at least an implementation-specified minimum. The implementation-specified minimum shall not be zero.

Returns
  The corresponding MAC algorithm with the specified length.
  Unspecified if `alg` is not a supported MAC algorithm or if `mac_length` is too small or too large for the specified MAC algorithm.

Definition at line 865 of file crypto_values.h.

## ◆ PSA_ALG_VENDOR_FLAG

#define PSA_ALG_VENDOR_FLAG ((psa_algorithm_t)0x80000000)

Vendor-defined algorithm flag.

Algorithms defined by this standard will never have the PSA_ALG_VENDOR_FLAG bit set. Vendors who define additional algorithms must use an encoding with the PSA_ALG_VENDOR_FLAG bit set and should respect the bitwise structure used by standard encodings whenever practical.

Definition at line 612 of file crypto_values.h.

## ◆ PSA_ALG_XTS

#define PSA_ALG_XTS ((psa_algorithm_t)0x044000ff)

The XTS cipher mode.

XTS is a cipher mode which is built from a block cipher. It requires at least one full block of input, but beyond this minimum the input does not need to be a whole number of blocks.

Definition at line 982 of file crypto_values.h.

## ◆ PSA_BLOCK_CIPHER_BLOCK_SIZE

#define PSA_BLOCK_CIPHER_BLOCK_SIZE | ( |  | type | ) |

Value:
(((type) & PSA_KEY_TYPE_CATEGORY_MASK) == PSA_KEY_TYPE_CATEGORY_SYMMETRIC ? \
1u << PSA_GET_KEY_TYPE_BLOCK_SIZE_EXPONENT(type) : \
0u)

The block size of a block cipher.

Parameters

  type | A cipher key type (value of type psa_key_type_t).

Returns
  The block size for a block cipher, or 1 for a stream cipher. The return value is undefined if `type` is not a supported cipher key type.

Note
  It is possible to build stream cipher algorithms on top of a block cipher, for example CTR mode (PSA_ALG_CTR). This macro only takes the key type into account, so it cannot be used to determine the size of the data that psa_cipher_update() might buffer for future processing in general.
  This macro returns a compile-time constant if its argument is one.

Warning
  This macro may evaluate its argument multiple times.

Definition at line 600 of file crypto_values.h.

## ◆ PSA_DH_GROUP_RFC7919

#define PSA_DH_GROUP_RFC7919 ((psa_dh_group_t) 0x03)

Diffie-Hellman groups defined in RFC 7919 Appendix A.

This family includes groups with the following key sizes (in bits): 2048, 3072, 4096, 6144, 8192. A given implementation may support all of these sizes or only a subset.

Definition at line 578 of file crypto_values.h.

## ◆ PSA_ECC_CURVE_BRAINPOOL_P_R1

#define PSA_ECC_CURVE_BRAINPOOL_P_R1 ((psa_ecc_curve_t) 0x30)

Brainpool P random curves.

This family comprises the following curves: brainpoolP160r1, brainpoolP192r1, brainpoolP224r1, brainpoolP256r1, brainpoolP320r1, brainpoolP384r1, brainpoolP512r1. It is defined in RFC 5639.

Definition at line 521 of file crypto_values.h.

## ◆ PSA_ECC_CURVE_MONTGOMERY

#define PSA_ECC_CURVE_MONTGOMERY ((psa_ecc_curve_t) 0x41)

Curve25519 and Curve448.

This family comprises the following Montgomery curves:

- 255-bit: Bernstein et al., Curve25519: new Diffie-Hellman speed records, LNCS 3958, 2006. The algorithm PSA_ALG_ECDH performs X25519 when used with this curve.
- 448-bit: Hamburg, Ed448-Goldilocks, a new elliptic curve, NIST ECC Workshop, 2015. The algorithm PSA_ALG_ECDH performs X448 when used with this curve.

Definition at line 533 of file crypto_values.h.

## ◆ PSA_ECC_CURVE_SECP_K1

#define PSA_ECC_CURVE_SECP_K1 ((psa_ecc_curve_t) 0x17)

SEC Koblitz curves over prime fields.

This family comprises the following curves: secp192k1, secp224k1, secp256k1. They are defined in Standards for Efficient Cryptography, SEC 2: Recommended Elliptic Curve Domain Parameters. https://www.secg.org/sec2-v2.pdf

Definition at line 470 of file crypto_values.h.

## ◆ PSA_ECC_CURVE_SECP_R1

#define PSA_ECC_CURVE_SECP_R1 ((psa_ecc_curve_t) 0x12)

SEC random curves over prime fields.

This family comprises the following curves: secp192k1, secp224r1, secp256r1, secp384r1, secp521r1. They are defined in Standards for Efficient Cryptography, SEC 2: Recommended Elliptic Curve Domain Parameters. https://www.secg.org/sec2-v2.pdf

Definition at line 480 of file crypto_values.h.

## ◆ PSA_ECC_CURVE_SECP_R2

#define PSA_ECC_CURVE_SECP_R2 ((psa_ecc_curve_t) 0x1b)

Definition at line 482 of file crypto_values.h.

## ◆ PSA_ECC_CURVE_SECT_K1

#define PSA_ECC_CURVE_SECT_K1 ((psa_ecc_curve_t) 0x27)

SEC Koblitz curves over binary fields.

This family comprises the following curves: sect163k1, sect233k1, sect239k1, sect283k1, sect409k1, sect571k1. They are defined in Standards for Efficient Cryptography, SEC 2: Recommended Elliptic Curve Domain Parameters. https://www.secg.org/sec2-v2.pdf

Definition at line 492 of file crypto_values.h.

## ◆ PSA_ECC_CURVE_SECT_R1

#define PSA_ECC_CURVE_SECT_R1 ((psa_ecc_curve_t) 0x22)

SEC random curves over binary fields.

This family comprises the following curves: sect163r1, sect233r1, sect283r1, sect409r1, sect571r1. They are defined in Standards for Efficient Cryptography, SEC 2: Recommended Elliptic Curve Domain Parameters. https://www.secg.org/sec2-v2.pdf

Definition at line 502 of file crypto_values.h.

## ◆ PSA_ECC_CURVE_SECT_R2

#define PSA_ECC_CURVE_SECT_R2 ((psa_ecc_curve_t) 0x2b)

SEC additional random curves over binary fields.

This family comprises the following curve: sect163r2. It is defined in Standards for Efficient Cryptography, SEC 2: Recommended Elliptic Curve Domain Parameters. https://www.secg.org/sec2-v2.pdf

Definition at line 512 of file crypto_values.h.

## ◆ PSA_GET_KEY_TYPE_BLOCK_SIZE_EXPONENT

#define PSA_GET_KEY_TYPE_BLOCK_SIZE_EXPONENT | ( |  | type | ) | (((type) >> 8) & 7)

Definition at line 580 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_AES

#define PSA_KEY_TYPE_AES ((psa_key_type_t)0x2400)

Key for a cipher, AEAD or MAC algorithm based on the AES block cipher.

The size of the key can be 16 bytes (AES-128), 24 bytes (AES-192) or 32 bytes (AES-256).

Definition at line 385 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_ARC4

#define PSA_KEY_TYPE_ARC4 ((psa_key_type_t)0x2002)

Key for the RC4 stream cipher.

Note that RC4 is weak and deprecated and should only be used in legacy protocols.

Definition at line 406 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_CAMELLIA

#define PSA_KEY_TYPE_CAMELLIA ((psa_key_type_t)0x2403)

Key for a cipher, AEAD or MAC algorithm based on the Camellia block cipher.

Definition at line 400 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_CATEGORY_FLAG_PAIR

#define PSA_KEY_TYPE_CATEGORY_FLAG_PAIR ((psa_key_type_t)0x3000)

Definition at line 303 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_CATEGORY_KEY_PAIR

#define PSA_KEY_TYPE_CATEGORY_KEY_PAIR ((psa_key_type_t)0x7000)

Definition at line 301 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_CATEGORY_MASK

#define PSA_KEY_TYPE_CATEGORY_MASK ((psa_key_type_t)0x7000)

Definition at line 297 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_CATEGORY_PUBLIC_KEY

#define PSA_KEY_TYPE_CATEGORY_PUBLIC_KEY ((psa_key_type_t)0x4000)

Definition at line 300 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_CATEGORY_RAW

#define PSA_KEY_TYPE_CATEGORY_RAW ((psa_key_type_t)0x1000)

Definition at line 298 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_CATEGORY_SYMMETRIC

#define PSA_KEY_TYPE_CATEGORY_SYMMETRIC ((psa_key_type_t)0x2000)

Definition at line 299 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_CHACHA20

#define PSA_KEY_TYPE_CHACHA20 ((psa_key_type_t)0x2004)

Key for the ChaCha20 stream cipher or the Chacha20-Poly1305 AEAD algorithm.

ChaCha20 and the ChaCha20_Poly1305 construction are defined in RFC 7539.

Implementations must support 12-byte nonces, may support 8-byte nonces, and should reject other sizes.

Definition at line 415 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_DERIVE

#define PSA_KEY_TYPE_DERIVE ((psa_key_type_t)0x1200)

A secret for key derivation.

The key policy determines which key derivation algorithm the key can be used for.

Definition at line 378 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_DES

#define PSA_KEY_TYPE_DES ((psa_key_type_t)0x2301)

Key for a cipher or MAC algorithm based on DES or 3DES (Triple-DES).

The size of the key can be 8 bytes (single DES), 16 bytes (2-key 3DES) or 24 bytes (3-key 3DES).

Note that single DES and 2-key 3DES are weak and strongly deprecated and should only be used to decrypt legacy data. 3-key 3DES is weak and deprecated and should only be used in legacy protocols.

Definition at line 396 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_DH_GROUP_MASK

#define PSA_KEY_TYPE_DH_GROUP_MASK ((psa_key_type_t)0x00ff)

Definition at line 537 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_DH_KEY_PAIR

#define PSA_KEY_TYPE_DH_KEY_PAIR | ( |  | group | ) | (PSA_KEY_TYPE_DH_KEY_PAIR_BASE | (group))

Diffie-Hellman key pair.

Parameters

  group | A value of type psa_dh_group_t that identifies the Diffie-Hellman group to be used.

Definition at line 543 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_DH_KEY_PAIR_BASE

#define PSA_KEY_TYPE_DH_KEY_PAIR_BASE ((psa_key_type_t)0x7200)

Definition at line 536 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_DH_PUBLIC_KEY

#define PSA_KEY_TYPE_DH_PUBLIC_KEY | ( |  | group | ) | (PSA_KEY_TYPE_DH_PUBLIC_KEY_BASE | (group))

Diffie-Hellman public key.

Parameters

  group | A value of type psa_dh_group_t that identifies the Diffie-Hellman group to be used.

Definition at line 550 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_DH_PUBLIC_KEY_BASE

#define PSA_KEY_TYPE_DH_PUBLIC_KEY_BASE ((psa_key_type_t)0x4200)

Definition at line 535 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_DSA_KEY_PAIR

#define PSA_KEY_TYPE_DSA_KEY_PAIR ((psa_key_type_t)0x7002)

DSA key pair (private and public key).

The import and export format is the representation of the private key `x` as a big-endian byte string. The length of the byte string is the private key size in bytes (leading zeroes are not stripped).

Determinstic DSA key derivation with psa_generate_derived_key follows FIPS 186-4 §B.1.2: interpret the byte string as integer in big-endian order. Discard it if it is not in the range [0, N - 2] where N is the boundary of the private key domain (the prime p for Diffie-Hellman, the subprime q for DSA, or the order of the curve's base point for ECC). Add 1 to the resulting integer and use this as the private key x.

Definition at line 351 of file crypto_extra.h.

## ◆ PSA_KEY_TYPE_DSA_PUBLIC_KEY

#define PSA_KEY_TYPE_DSA_PUBLIC_KEY ((psa_key_type_t)0x4002)

DSA public key.

The import and export format is the representation of the public key `y = g^x mod p` as a big-endian byte string. The length of the byte string is the length of the base prime `p` in bytes.

Definition at line 333 of file crypto_extra.h.

## ◆ PSA_KEY_TYPE_ECC_CURVE_MASK

#define PSA_KEY_TYPE_ECC_CURVE_MASK ((psa_key_type_t)0x00ff)

Definition at line 427 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_ECC_KEY_PAIR

#define PSA_KEY_TYPE_ECC_KEY_PAIR | ( |  | curve | ) | (PSA_KEY_TYPE_ECC_KEY_PAIR_BASE | (curve))

Elliptic curve key pair.

Parameters

  curve | A value of type psa_ecc_curve_t that identifies the ECC curve to be used.

Definition at line 433 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_ECC_KEY_PAIR_BASE

#define PSA_KEY_TYPE_ECC_KEY_PAIR_BASE ((psa_key_type_t)0x7100)

Definition at line 426 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_ECC_PUBLIC_KEY

#define PSA_KEY_TYPE_ECC_PUBLIC_KEY | ( |  | curve | ) | (PSA_KEY_TYPE_ECC_PUBLIC_KEY_BASE | (curve))

Elliptic curve public key.

Parameters

  curve | A value of type psa_ecc_curve_t that identifies the ECC curve to be used.

Definition at line 440 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_ECC_PUBLIC_KEY_BASE

#define PSA_KEY_TYPE_ECC_PUBLIC_KEY_BASE ((psa_key_type_t)0x4100)

Definition at line 425 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_GET_CURVE

#define PSA_KEY_TYPE_GET_CURVE | ( |  | type | ) |

Value:
((psa_ecc_curve_t) (PSA_KEY_TYPE_IS_ECC(type) ? \
((type) & PSA_KEY_TYPE_ECC_CURVE_MASK) : \
0))

Extract the curve from an elliptic curve key type.

Definition at line 457 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_GET_GROUP

#define PSA_KEY_TYPE_GET_GROUP | ( |  | type | ) |

Value:
((psa_dh_group_t) (PSA_KEY_TYPE_IS_DH(type) ? \
((type) & PSA_KEY_TYPE_DH_GROUP_MASK) : \
0))

Extract the group from a Diffie-Hellman key type.

Definition at line 567 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_HMAC

#define PSA_KEY_TYPE_HMAC ((psa_key_type_t)0x1100)

HMAC key.

The key policy determines which underlying hash algorithm the key can be used for.

HMAC keys should generally have the same size as the underlying hash. This size can be calculated with PSA_HASH_SIZE(`alg`) where `alg` is the HMAC algorithm or the underlying hash algorithm.

Definition at line 371 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_IS_ASYMMETRIC

#define PSA_KEY_TYPE_IS_ASYMMETRIC | ( |  | type | ) |

Value:
(((type) & PSA_KEY_TYPE_CATEGORY_MASK \
& ~PSA_KEY_TYPE_CATEGORY_FLAG_PAIR) == \
PSA_KEY_TYPE_CATEGORY_PUBLIC_KEY)

Whether a key type is asymmetric: either a key pair or a public key.

Definition at line 321 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_IS_DH

#define PSA_KEY_TYPE_IS_DH | ( |  | type | ) |

Value:
((PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(type) & \
~PSA_KEY_TYPE_DH_GROUP_MASK) == PSA_KEY_TYPE_DH_PUBLIC_KEY_BASE)

Whether a key type is a Diffie-Hellman key (pair or public-only).

Definition at line 554 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_IS_DH_KEY_PAIR

#define PSA_KEY_TYPE_IS_DH_KEY_PAIR | ( |  | type | ) |

Value:
(((type) & ~PSA_KEY_TYPE_DH_GROUP_MASK) == \
PSA_KEY_TYPE_DH_KEY_PAIR_BASE)

Whether a key type is a Diffie-Hellman key pair.

Definition at line 558 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_IS_DH_PUBLIC_KEY

#define PSA_KEY_TYPE_IS_DH_PUBLIC_KEY | ( |  | type | ) |

Value:
(((type) & ~PSA_KEY_TYPE_DH_GROUP_MASK) == \
PSA_KEY_TYPE_DH_PUBLIC_KEY_BASE)

Whether a key type is a Diffie-Hellman public key.

Definition at line 562 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_IS_DSA

#define PSA_KEY_TYPE_IS_DSA | ( |  | type | ) | (PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(type) == PSA_KEY_TYPE_DSA_PUBLIC_KEY)

Whether a key type is an DSA key (pair or public-only).

Definition at line 354 of file crypto_extra.h.

## ◆ PSA_KEY_TYPE_IS_ECC

#define PSA_KEY_TYPE_IS_ECC | ( |  | type | ) |

Value:
((PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(type) & \
~PSA_KEY_TYPE_ECC_CURVE_MASK) == PSA_KEY_TYPE_ECC_PUBLIC_KEY_BASE)

Whether a key type is an elliptic curve key (pair or public-only).

Definition at line 444 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_IS_ECC_KEY_PAIR

#define PSA_KEY_TYPE_IS_ECC_KEY_PAIR | ( |  | type | ) |

Value:
(((type) & ~PSA_KEY_TYPE_ECC_CURVE_MASK) == \
PSA_KEY_TYPE_ECC_KEY_PAIR_BASE)

Whether a key type is an elliptic curve key pair.

Definition at line 448 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_IS_ECC_PUBLIC_KEY

#define PSA_KEY_TYPE_IS_ECC_PUBLIC_KEY | ( |  | type | ) |

Value:
(((type) & ~PSA_KEY_TYPE_ECC_CURVE_MASK) == \
PSA_KEY_TYPE_ECC_PUBLIC_KEY_BASE)

Whether a key type is an elliptic curve public key.

Definition at line 452 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_IS_KEY_PAIR

#define PSA_KEY_TYPE_IS_KEY_PAIR | ( |  | type | ) | (((type) & PSA_KEY_TYPE_CATEGORY_MASK) == PSA_KEY_TYPE_CATEGORY_KEY_PAIR)

Whether a key type is a key pair containing a private part and a public part.

Definition at line 330 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_IS_PUBLIC_KEY

#define PSA_KEY_TYPE_IS_PUBLIC_KEY | ( |  | type | ) | (((type) & PSA_KEY_TYPE_CATEGORY_MASK) == PSA_KEY_TYPE_CATEGORY_PUBLIC_KEY)

Whether a key type is the public part of a key pair.

Definition at line 326 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_IS_RSA

#define PSA_KEY_TYPE_IS_RSA | ( |  | type | ) | (PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(type) == PSA_KEY_TYPE_RSA_PUBLIC_KEY)

Whether a key type is an RSA key (pair or public-only).

Definition at line 422 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_IS_UNSTRUCTURED

#define PSA_KEY_TYPE_IS_UNSTRUCTURED | ( |  | type | ) |

Value:
(((type) & PSA_KEY_TYPE_CATEGORY_MASK) == PSA_KEY_TYPE_CATEGORY_RAW || \
((type) & PSA_KEY_TYPE_CATEGORY_MASK) == PSA_KEY_TYPE_CATEGORY_SYMMETRIC)

Whether a key type is an unstructured array of bytes.

This encompasses both symmetric keys and non-key data.

Definition at line 316 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_IS_VENDOR_DEFINED

#define PSA_KEY_TYPE_IS_VENDOR_DEFINED | ( |  | type | ) | (((type) & PSA_KEY_TYPE_VENDOR_FLAG) != 0)

Whether a key type is vendor-defined.

See also PSA_KEY_TYPE_VENDOR_FLAG.

Definition at line 309 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_KEY_PAIR_OF_PUBLIC_KEY

#define PSA_KEY_TYPE_KEY_PAIR_OF_PUBLIC_KEY | ( |  | type | ) | ((type) | PSA_KEY_TYPE_CATEGORY_FLAG_PAIR)

The key pair type corresponding to a public key type.

You may also pass a key pair type as `type`, it will be left unchanged.

Parameters

  type | A public key type or key pair type.

Returns
  The corresponding key pair type. If `type` is not a public key or a key pair, the return value is undefined.

Definition at line 342 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_NONE

#define PSA_KEY_TYPE_NONE ((psa_key_type_t)0x0000)

An invalid key type value.

Zero is not the encoding of any key type.

Definition at line 286 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR

#define PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR | ( |  | type | ) | ((type) & ~PSA_KEY_TYPE_CATEGORY_FLAG_PAIR)

The public key type corresponding to a key pair type.

You may also pass a key pair type as `type`, it will be left unchanged.

Parameters

  type | A public key type or key pair type.

Returns
  The corresponding public key type. If `type` is not a public key or a key pair, the return value is undefined.

Definition at line 354 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_RAW_DATA

#define PSA_KEY_TYPE_RAW_DATA ((psa_key_type_t)0x1001)

Raw data.

A "key" of this type cannot be used for any cryptographic operation. Applications may use this type to store arbitrary data in the keystore.

Definition at line 361 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_RSA_KEY_PAIR

#define PSA_KEY_TYPE_RSA_KEY_PAIR ((psa_key_type_t)0x7001)

RSA key pair (private and public key).

Definition at line 420 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_RSA_PUBLIC_KEY

#define PSA_KEY_TYPE_RSA_PUBLIC_KEY ((psa_key_type_t)0x4001)

RSA public key.

Definition at line 418 of file crypto_values.h.

## ◆ PSA_KEY_TYPE_VENDOR_FLAG

#define PSA_KEY_TYPE_VENDOR_FLAG ((psa_key_type_t)0x8000)

Vendor-defined key type flag.

Key types defined by this standard will never have the PSA_KEY_TYPE_VENDOR_FLAG bit set. Vendors who define additional key types must use an encoding with the PSA_KEY_TYPE_VENDOR_FLAG bit set and should respect the bitwise structure used by standard encodings whenever practical.

Definition at line 295 of file crypto_values.h.

## ◆ PSA_MAC_TRUNCATED_LENGTH

#define PSA_MAC_TRUNCATED_LENGTH | ( |  | mac_alg | ) | (((mac_alg) & PSA_ALG_MAC_TRUNCATION_MASK) >> PSA_MAC_TRUNCATION_OFFSET)

Length to which a MAC algorithm is truncated.

Parameters

  mac_alg | A MAC algorithm identifier (value of type psa_algorithm_t such that PSA_ALG_IS_MAC(`alg`) is true).

Returns
  Length of the truncated MAC in bytes.
  0 if `alg` is a non-truncated MAC algorithm.
  Unspecified if `alg` is not a supported MAC algorithm.

Definition at line 895 of file crypto_values.h.

## ◆ PSA_MAC_TRUNCATION_OFFSET

#define PSA_MAC_TRUNCATION_OFFSET 8

Definition at line 830 of file crypto_values.h.

## Typedef Documentation

## ◆ psa_algorithm_t

typedef uint32_t psa_algorithm_t

Encoding of a cryptographic algorithm.

For algorithms that can be applied to multiple key types, this type does not encode the key type. For example, for symmetric ciphers based on a block cipher, psa_algorithm_t encodes the block cipher mode and the padding mode while the block cipher itself is encoded via psa_key_type_t.

Definition at line 98 of file crypto_types.h.

## ◆ psa_dh_group_t

typedef uint8_t psa_dh_group_t

The type of PSA Diffie-Hellman group family identifiers.

The group identifier is required to create an Diffie-Hellman key using the PSA_KEY_TYPE_DH_KEY_PAIR() or PSA_KEY_TYPE_DH_PUBLIC_KEY() macros.

Values defined by this standard will never be in the range 0x80-0xff. Vendors who define additional families must use an encoding in this range.

Definition at line 88 of file crypto_types.h.

## ◆ psa_ecc_curve_t

typedef uint8_t psa_ecc_curve_t

The type of PSA elliptic curve family identifiers.

The curve identifier is required to create an ECC key using the PSA_KEY_TYPE_ECC_KEY_PAIR() or PSA_KEY_TYPE_ECC_PUBLIC_KEY() macros.

Values defined by this standard will never be in the range 0x80-0xff. Vendors who define additional families must use an encoding in this range.

Definition at line 77 of file crypto_types.h.

## ◆ psa_key_type_t

typedef uint16_t psa_key_type_t

Encoding of a key type.

Definition at line 66 of file crypto_types.h.

PSA_KEY_USAGE_SIGN_HASH
#define PSA_KEY_USAGE_SIGN_HASH
Definition: crypto_values.h:1717
PSA_ALG_CHACHA20_POLY1305
#define PSA_ALG_CHACHA20_POLY1305
Definition: crypto_values.h:1036
PSA_ALG_IS_RSA_PKCS1V15_SIGN
#define PSA_ALG_IS_RSA_PKCS1V15_SIGN(alg)
Definition: crypto_values.h:1112
PSA_ALG_IS_HASH_AND_SIGN
#define PSA_ALG_IS_HASH_AND_SIGN(alg)
Definition: crypto_values.h:1221
PSA_KEY_TYPE_CATEGORY_SYMMETRIC
#define PSA_KEY_TYPE_CATEGORY_SYMMETRIC
Definition: crypto_values.h:298
PSA_ALG_ANY_HASH
#define PSA_ALG_ANY_HASH
Definition: crypto_values.h:786
PSA_ALG_GCM
#define PSA_ALG_GCM
Definition: crypto_values.h:1025
psa_set_key_algorithm
static void psa_set_key_algorithm(psa_key_attributes_t *attributes, psa_algorithm_t alg)
PSA_ALG_HASH_MASK
#define PSA_ALG_HASH_MASK
Definition: crypto_values.h:721
PSA_KEY_TYPE_CATEGORY_FLAG_PAIR
#define PSA_KEY_TYPE_CATEGORY_FLAG_PAIR
Definition: crypto_values.h:302
psa_ecc_curve_t
uint8_t psa_ecc_curve_t
Definition: crypto_types.h:77
PSA_ALG_CATEGORY_CIPHER
#define PSA_ALG_CATEGORY_CIPHER
Definition: crypto_values.h:616
PSA_KEY_TYPE_IS_DH
#define PSA_KEY_TYPE_IS_DH(type)
Definition: crypto_values.h:553
PSA_MAC_TRUNCATION_OFFSET
#define PSA_MAC_TRUNCATION_OFFSET
Definition: crypto_values.h:829
PSA_KEY_TYPE_ECC_PUBLIC_KEY_BASE
#define PSA_KEY_TYPE_ECC_PUBLIC_KEY_BASE
Definition: crypto_values.h:424
PSA_ALG_AEAD_TAG_LENGTH_MASK
#define PSA_ALG_AEAD_TAG_LENGTH_MASK
Definition: crypto_values.h:1042
psa_sign_hash
psa_status_t psa_sign_hash(psa_key_handle_t handle, psa_algorithm_t alg, const uint8_t *hash, size_t hash_length, uint8_t *signature, size_t signature_size, size_t *signature_length)
Sign a hash or short message with a private key.
PSA_AEAD_TAG_LENGTH_OFFSET
#define PSA_AEAD_TAG_LENGTH_OFFSET
Definition: crypto_values.h:1043
PSA_ALG_SHA_512
#define PSA_ALG_SHA_512
Definition: crypto_values.h:739
PSA_ALG_MAC_TRUNCATION_MASK
#define PSA_ALG_MAC_TRUNCATION_MASK
Definition: crypto_values.h:828
PSA_ALG_SHA_256
#define PSA_ALG_SHA_256
Definition: crypto_values.h:735
PSA_ALG_IS_KEY_AGREEMENT
#define PSA_ALG_IS_KEY_AGREEMENT(alg)
Definition: crypto_values.h:707
PSA_ALG_DSA_DETERMINISTIC_FLAG
#define PSA_ALG_DSA_DETERMINISTIC_FLAG
Definition: crypto_extra.h:374
PSA_ALG_IS_RSA_PSS
#define PSA_ALG_IS_RSA_PSS(alg)
Definition: crypto_values.h:1136
PSA_KEY_TYPE_ECC_CURVE_MASK
#define PSA_KEY_TYPE_ECC_CURVE_MASK
Definition: crypto_values.h:426
PSA_ALG_CIPHER_MAC_BASE
#define PSA_ALG_CIPHER_MAC_BASE
Definition: crypto_values.h:897
PSA_KEY_TYPE_CATEGORY_RAW
#define PSA_KEY_TYPE_CATEGORY_RAW
Definition: crypto_values.h:297
PSA_KEY_TYPE_DH_GROUP_MASK
#define PSA_KEY_TYPE_DH_GROUP_MASK
Definition: crypto_values.h:536
PSA_ALG_CATEGORY_KEY_DERIVATION
#define PSA_ALG_CATEGORY_KEY_DERIVATION
Definition: crypto_values.h:620
PSA_GET_KEY_TYPE_BLOCK_SIZE_EXPONENT
#define PSA_GET_KEY_TYPE_BLOCK_SIZE_EXPONENT(type)
Definition: crypto_values.h:579
PSA_ALG_CATEGORY_AEAD
#define PSA_ALG_CATEGORY_AEAD
Definition: crypto_values.h:617
PSA_ALG_CATEGORY_HASH
#define PSA_ALG_CATEGORY_HASH
Definition: crypto_values.h:614
PSA_KEY_TYPE_CATEGORY_MASK
#define PSA_KEY_TYPE_CATEGORY_MASK
Definition: crypto_values.h:296
PSA_ALG_ECDSA_DETERMINISTIC_FLAG
#define PSA_ALG_ECDSA_DETERMINISTIC_FLAG
Definition: crypto_values.h:1197
PSA_KEY_TYPE_DH_PUBLIC_KEY_BASE
#define PSA_KEY_TYPE_DH_PUBLIC_KEY_BASE
Definition: crypto_values.h:534
PSA_ALG_HMAC_BASE
#define PSA_ALG_HMAC_BASE
Definition: crypto_values.h:789
psa_set_key_usage_flags
static void psa_set_key_usage_flags(psa_key_attributes_t *attributes, psa_key_usage_t usage_flags)
PSA_ALG_IS_ECDSA
#define PSA_ALG_IS_ECDSA(alg)
Definition: crypto_values.h:1198
PSA_ALG_CIPHER_STREAM_FLAG
#define PSA_ALG_CIPHER_STREAM_FLAG
Definition: crypto_values.h:919
PSA_ALG_CCM
#define PSA_ALG_CCM
Definition: crypto_values.h:1019
PSA_ALG_IS_RSA_OAEP
#define PSA_ALG_IS_RSA_OAEP(alg)
Definition: crypto_values.h:1270
PSA_KEY_TYPE_IS_ECC
#define PSA_KEY_TYPE_IS_ECC(type)
Definition: crypto_values.h:443
PSA_ALG_AEAD_WITH_TAG_LENGTH
#define PSA_ALG_AEAD_WITH_TAG_LENGTH(aead_alg, tag_length)
Definition: crypto_values.h:1063
psa_dh_group_t
uint8_t psa_dh_group_t
Definition: crypto_types.h:88
PSA_ALG_CATEGORY_MASK
#define PSA_ALG_CATEGORY_MASK
Definition: crypto_values.h:613
PSA_ALG_AEAD_FROM_BLOCK_FLAG
#define PSA_ALG_AEAD_FROM_BLOCK_FLAG
Definition: crypto_values.h:1000
PSA_ALG_MAC_SUBCATEGORY_MASK
#define PSA_ALG_MAC_SUBCATEGORY_MASK
Definition: crypto_values.h:788
PSA_ALG_SHA3_256
#define PSA_ALG_SHA3_256
Definition: crypto_values.h:747
PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR
#define PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(type)
Definition: crypto_values.h:353