|
Platform Security Architecture — cryptography and keystore interface
Working draft
|
Macros | |
| #define | PSA_KEY_TYPE_NONE ((psa_key_type_t)0x00000000) |
| #define | PSA_KEY_TYPE_VENDOR_FLAG ((psa_key_type_t)0x80000000) |
| #define | PSA_KEY_TYPE_CATEGORY_MASK ((psa_key_type_t)0x7e000000) |
| #define | PSA_KEY_TYPE_RAW_DATA ((psa_key_type_t)0x02000000) |
| #define | PSA_KEY_TYPE_CATEGORY_SYMMETRIC ((psa_key_type_t)0x04000000) |
| #define | PSA_KEY_TYPE_CATEGORY_ASYMMETRIC ((psa_key_type_t)0x06000000) |
| #define | PSA_KEY_TYPE_PAIR_FLAG ((psa_key_type_t)0x01000000) |
| #define | PSA_KEY_TYPE_HMAC ((psa_key_type_t)0x02000001) |
| #define | PSA_KEY_TYPE_DERIVE ((psa_key_type_t)0x02000101) |
| #define | PSA_KEY_TYPE_AES ((psa_key_type_t)0x04000001) |
| #define | PSA_KEY_TYPE_DES ((psa_key_type_t)0x04000002) |
| #define | PSA_KEY_TYPE_CAMELLIA ((psa_key_type_t)0x04000003) |
| #define | PSA_KEY_TYPE_ARC4 ((psa_key_type_t)0x04000004) |
| #define | PSA_KEY_TYPE_RSA_PUBLIC_KEY ((psa_key_type_t)0x06010000) |
| #define | PSA_KEY_TYPE_RSA_KEYPAIR ((psa_key_type_t)0x07010000) |
| #define | PSA_KEY_TYPE_DSA_PUBLIC_KEY ((psa_key_type_t)0x06020000) |
| #define | PSA_KEY_TYPE_DSA_KEYPAIR ((psa_key_type_t)0x07020000) |
| #define | PSA_KEY_TYPE_ECC_PUBLIC_KEY_BASE ((psa_key_type_t)0x06030000) |
| #define | PSA_KEY_TYPE_ECC_KEYPAIR_BASE ((psa_key_type_t)0x07030000) |
| #define | PSA_KEY_TYPE_ECC_CURVE_MASK ((psa_key_type_t)0x0000ffff) |
| #define | PSA_KEY_TYPE_ECC_KEYPAIR(curve) (PSA_KEY_TYPE_ECC_KEYPAIR_BASE | (curve)) |
| #define | PSA_KEY_TYPE_ECC_PUBLIC_KEY(curve) (PSA_KEY_TYPE_ECC_PUBLIC_KEY_BASE | (curve)) |
| #define | PSA_KEY_TYPE_IS_VENDOR_DEFINED(type) (((type) & PSA_KEY_TYPE_VENDOR_FLAG) != 0) |
| #define | PSA_KEY_TYPE_IS_ASYMMETRIC(type) (((type) & PSA_KEY_TYPE_CATEGORY_MASK) == PSA_KEY_TYPE_CATEGORY_ASYMMETRIC) |
| #define | PSA_KEY_TYPE_IS_PUBLIC_KEY(type) |
| #define | PSA_KEY_TYPE_IS_KEYPAIR(type) |
| #define | PSA_KEY_TYPE_KEYPAIR_OF_PUBLIC_KEY(type) ((type) | PSA_KEY_TYPE_PAIR_FLAG) |
| #define | PSA_KEY_TYPE_PUBLIC_KEY_OF_KEYPAIR(type) ((type) & ~PSA_KEY_TYPE_PAIR_FLAG) |
| #define | PSA_KEY_TYPE_IS_RSA(type) (PSA_KEY_TYPE_PUBLIC_KEY_OF_KEYPAIR(type) == PSA_KEY_TYPE_RSA_PUBLIC_KEY) |
| #define | PSA_KEY_TYPE_IS_ECC(type) |
| #define | PSA_KEY_TYPE_IS_ECC_KEYPAIR(type) |
| #define | PSA_KEY_TYPE_IS_ECC_PUBLIC_KEY(type) |
| #define | PSA_KEY_TYPE_GET_CURVE(type) |
| #define | PSA_ECC_CURVE_SECT163K1 ((psa_ecc_curve_t) 0x0001) |
| #define | PSA_ECC_CURVE_SECT163R1 ((psa_ecc_curve_t) 0x0002) |
| #define | PSA_ECC_CURVE_SECT163R2 ((psa_ecc_curve_t) 0x0003) |
| #define | PSA_ECC_CURVE_SECT193R1 ((psa_ecc_curve_t) 0x0004) |
| #define | PSA_ECC_CURVE_SECT193R2 ((psa_ecc_curve_t) 0x0005) |
| #define | PSA_ECC_CURVE_SECT233K1 ((psa_ecc_curve_t) 0x0006) |
| #define | PSA_ECC_CURVE_SECT233R1 ((psa_ecc_curve_t) 0x0007) |
| #define | PSA_ECC_CURVE_SECT239K1 ((psa_ecc_curve_t) 0x0008) |
| #define | PSA_ECC_CURVE_SECT283K1 ((psa_ecc_curve_t) 0x0009) |
| #define | PSA_ECC_CURVE_SECT283R1 ((psa_ecc_curve_t) 0x000a) |
| #define | PSA_ECC_CURVE_SECT409K1 ((psa_ecc_curve_t) 0x000b) |
| #define | PSA_ECC_CURVE_SECT409R1 ((psa_ecc_curve_t) 0x000c) |
| #define | PSA_ECC_CURVE_SECT571K1 ((psa_ecc_curve_t) 0x000d) |
| #define | PSA_ECC_CURVE_SECT571R1 ((psa_ecc_curve_t) 0x000e) |
| #define | PSA_ECC_CURVE_SECP160K1 ((psa_ecc_curve_t) 0x000f) |
| #define | PSA_ECC_CURVE_SECP160R1 ((psa_ecc_curve_t) 0x0010) |
| #define | PSA_ECC_CURVE_SECP160R2 ((psa_ecc_curve_t) 0x0011) |
| #define | PSA_ECC_CURVE_SECP192K1 ((psa_ecc_curve_t) 0x0012) |
| #define | PSA_ECC_CURVE_SECP192R1 ((psa_ecc_curve_t) 0x0013) |
| #define | PSA_ECC_CURVE_SECP224K1 ((psa_ecc_curve_t) 0x0014) |
| #define | PSA_ECC_CURVE_SECP224R1 ((psa_ecc_curve_t) 0x0015) |
| #define | PSA_ECC_CURVE_SECP256K1 ((psa_ecc_curve_t) 0x0016) |
| #define | PSA_ECC_CURVE_SECP256R1 ((psa_ecc_curve_t) 0x0017) |
| #define | PSA_ECC_CURVE_SECP384R1 ((psa_ecc_curve_t) 0x0018) |
| #define | PSA_ECC_CURVE_SECP521R1 ((psa_ecc_curve_t) 0x0019) |
| #define | PSA_ECC_CURVE_BRAINPOOL_P256R1 ((psa_ecc_curve_t) 0x001a) |
| #define | PSA_ECC_CURVE_BRAINPOOL_P384R1 ((psa_ecc_curve_t) 0x001b) |
| #define | PSA_ECC_CURVE_BRAINPOOL_P512R1 ((psa_ecc_curve_t) 0x001c) |
| #define | PSA_ECC_CURVE_CURVE25519 ((psa_ecc_curve_t) 0x001d) |
| #define | PSA_ECC_CURVE_CURVE448 ((psa_ecc_curve_t) 0x001e) |
| #define | PSA_ECC_CURVE_FFDHE_2048 ((psa_ecc_curve_t) 0x0100) |
| #define | PSA_ECC_CURVE_FFDHE_3072 ((psa_ecc_curve_t) 0x0101) |
| #define | PSA_ECC_CURVE_FFDHE_4096 ((psa_ecc_curve_t) 0x0102) |
| #define | PSA_ECC_CURVE_FFDHE_6144 ((psa_ecc_curve_t) 0x0103) |
| #define | PSA_ECC_CURVE_FFDHE_8192 ((psa_ecc_curve_t) 0x0104) |
| #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_AGREEMENT ((psa_algorithm_t)0x22000000) |
| #define | PSA_ALG_CATEGORY_KEY_DERIVATION ((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_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_HASH(hmac_alg) (PSA_ALG_CATEGORY_HASH | ((hmac_alg) & PSA_ALG_HASH_MASK)) |
| #define | PSA_ALG_IS_HMAC(alg) |
| #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_GMAC ((psa_algorithm_t)0x02c00003) |
| #define | PSA_ALG_IS_CIPHER_MAC(alg) |
| #define | PSA_ALG_CIPHER_SUBCATEGORY_MASK ((psa_algorithm_t)0x00c00000) |
| #define | PSA_ALG_BLOCK_CIPHER_BASE ((psa_algorithm_t)0x04000000) |
| #define | PSA_ALG_BLOCK_CIPHER_MODE_MASK ((psa_algorithm_t)0x000000ff) |
| #define | PSA_ALG_BLOCK_CIPHER_PADDING_MASK ((psa_algorithm_t)0x003f0000) |
| #define | PSA_ALG_BLOCK_CIPHER_PAD_NONE ((psa_algorithm_t)0x00000000) |
| #define | PSA_ALG_BLOCK_CIPHER_PAD_PKCS7 ((psa_algorithm_t)0x00010000) |
| #define | PSA_ALG_IS_BLOCK_CIPHER(alg) |
| #define | PSA_ALG_CBC_BASE ((psa_algorithm_t)0x04000001) |
| #define | PSA_ALG_CFB_BASE ((psa_algorithm_t)0x04000002) |
| #define | PSA_ALG_OFB_BASE ((psa_algorithm_t)0x04000003) |
| #define | PSA_ALG_XTS_BASE ((psa_algorithm_t)0x04000004) |
| #define | PSA_ALG_STREAM_CIPHER_BASE ((psa_algorithm_t)0x04800000) |
| #define | PSA_ALG_CTR ((psa_algorithm_t)0x04800001) |
| #define | PSA_ALG_ARC4 ((psa_algorithm_t)0x04800002) |
| #define | PSA_ALG_IS_STREAM_CIPHER(alg) |
| #define | PSA_ALG_CCM ((psa_algorithm_t)0x06000001) |
| #define | PSA_ALG_GCM ((psa_algorithm_t)0x06000002) |
| #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_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_algorithm_t)0x00010000) |
| #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_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_IS_ECDSA(alg) |
| #define | PSA_ALG_ECDSA_IS_DETERMINISTIC(alg) (((alg) & PSA_ALG_DSA_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_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)0x30000100) |
| #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)) |
Typedefs | |
| typedef uint32_t | psa_key_type_t |
| Encoding of a key type. | |
| typedef uint16_t | psa_ecc_curve_t |
| typedef uint32_t | psa_algorithm_t |
| Encoding of a cryptographic algorithm. More... | |
| #define PSA_ALG_ARC4 ((psa_algorithm_t)0x04800002) |
The ARC4 stream cipher algorithm.
| #define PSA_ALG_BLOCK_CIPHER_PAD_NONE ((psa_algorithm_t)0x00000000) |
Use a block cipher mode without padding.
This padding mode may only be used with messages whose lengths are a whole number of blocks for the chosen block cipher.
| #define PSA_ALG_CBC_BASE ((psa_algorithm_t)0x04000001) |
The CBC block cipher mode.
| #define PSA_ALG_CTR ((psa_algorithm_t)0x04800001) |
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).
| #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.
| hash_alg | A hash algorithm (PSA_ALG_XXX value such that PSA_ALG_IS_HASH(hash_alg) is true). |
alg is not a supported hash algorithm. | #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).
| hash_alg | A hash algorithm (PSA_ALG_XXX value such that PSA_ALG_IS_HASH(hash_alg) is true). |
alg is not a supported hash algorithm. | #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).
| hash_alg | A hash algorithm (PSA_ALG_XXX value such that PSA_ALG_IS_HASH(hash_alg) is true). |
alg is not a supported hash algorithm. | #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.
| #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.
| hash_alg | A hash algorithm (PSA_ALG_XXX value such that PSA_ALG_IS_HASH(hash_alg) is true). |
alg is not a supported hash algorithm. | #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.
| hash_alg | A hash algorithm (PSA_ALG_XXX value such that PSA_ALG_IS_HASH(hash_alg) is true). |
alg is not a supported hash algorithm. | #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.
| alg | An algorithm identifier (value of type psa_algorithm_t). |
alg is an AEAD algorithm, 0 otherwise. This macro may return either 0 or 1 if alg is not a supported algorithm identifier. | #define PSA_ALG_IS_ASYMMETRIC_ENCRYPTION | ( | alg | ) | (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_ASYMMETRIC_ENCRYPTION) |
Whether the specified algorithm is a public-key encryption algorithm.
| alg | An algorithm identifier (value of type psa_algorithm_t). |
alg is a public-key encryption algorithm, 0 otherwise. This macro may return either 0 or 1 if alg is not a supported algorithm identifier. | #define PSA_ALG_IS_BLOCK_CIPHER | ( | alg | ) |
Whether the specified algorithm is a block cipher.
A block cipher is a symmetric cipher that encrypts or decrypts messages by chopping them into fixed-size blocks. Processing a message requires applying a padding mode to transform the message into one whose length is a whole number of blocks. To construct an algorithm identifier for a block cipher, apply a bitwise-or between the block cipher mode and the padding mode. For example, CBC with PKCS#7 padding is PSA_ALG_CBC_BASE | PSA_ALG_BLOCK_CIPHER_PAD_PKCS7.
The transformation applied to each block is determined by the key type. For example, to use AES-128-CBC-PKCS7, use the algorithm above with a key of type PSA_KEY_TYPE_AES and a length of 128 bits (16 bytes).
| alg | An algorithm identifier (value of type psa_algorithm_t). |
alg is a block 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. | #define PSA_ALG_IS_CIPHER | ( | alg | ) | (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_CIPHER) |
Whether the specified algorithm is a symmetric cipher algorithm.
| alg | An algorithm identifier (value of type psa_algorithm_t). |
alg is a symmetric cipher algorithm, 0 otherwise. This macro may return either 0 or 1 if alg is not a supported algorithm identifier. | #define PSA_ALG_IS_CIPHER_MAC | ( | alg | ) |
Whether the specified algorithm is a MAC algorithm based on a block cipher.
| alg | An algorithm identifier (value of type psa_algorithm_t). |
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. | #define PSA_ALG_IS_DSA | ( | alg | ) |
| #define PSA_ALG_IS_ECDSA | ( | alg | ) |
| #define PSA_ALG_IS_HASH | ( | alg | ) | (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_HASH) |
Whether the specified algorithm is a hash algorithm.
| alg | An algorithm identifier (value of type psa_algorithm_t). |
alg is a hash algorithm, 0 otherwise. This macro may return either 0 or 1 if alg is not a supported algorithm identifier. | #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.
| alg | An algorithm identifier (value of type psa_algorithm_t). |
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. | #define PSA_ALG_IS_HMAC | ( | alg | ) |
Whether the specified algorithm is an HMAC algorithm.
HMAC is a family of MAC algorithms that are based on a hash function.
| alg | An algorithm identifier (value of type psa_algorithm_t). |
alg is an HMAC algorithm, 0 otherwise. This macro may return either 0 or 1 if alg is not a supported algorithm identifier. | #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.
| alg | An algorithm identifier (value of type psa_algorithm_t). |
alg is a key agreement algorithm, 0 otherwise. This macro may return either 0 or 1 if alg is not a supported algorithm identifier. | #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.
| alg | An algorithm identifier (value of type psa_algorithm_t). |
alg is a key derivation algorithm, 0 otherwise. This macro may return either 0 or 1 if alg is not a supported algorithm identifier. | #define PSA_ALG_IS_MAC | ( | alg | ) | (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_MAC) |
Whether the specified algorithm is a MAC algorithm.
| alg | An algorithm identifier (value of type psa_algorithm_t). |
alg is a MAC algorithm, 0 otherwise. This macro may return either 0 or 1 if alg is not a supported algorithm identifier. | #define PSA_ALG_IS_SIGN | ( | alg | ) | (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_SIGN) |
Whether the specified algorithm is a public-key signature algorithm.
| alg | An algorithm identifier (value of type psa_algorithm_t). |
alg is a public-key signature algorithm, 0 otherwise. This macro may return either 0 or 1 if alg is not a supported algorithm identifier. | #define PSA_ALG_IS_STREAM_CIPHER | ( | alg | ) |
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.
| alg | An algorithm identifier (value of type psa_algorithm_t). |
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. | #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.
| hash_alg | The hash algorithm (PSA_ALG_XXX value such that PSA_ALG_IS_HASH(hash_alg) is true) to use for MGF1. |
alg is not a supported hash algorithm. | #define PSA_ALG_RSA_OAEP_GET_HASH | ( | alg | ) |
| #define PSA_ALG_RSA_PKCS1V15_CRYPT ((psa_algorithm_t)0x12020000) |
RSA PKCS#1 v1.5 encryption.
| #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.
| hash_alg | A hash algorithm (PSA_ALG_XXX value such that PSA_ALG_IS_HASH(hash_alg) is true). |
alg is not a supported hash algorithm. | #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.
| #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.
| hash_alg | A hash algorithm (PSA_ALG_XXX value such that PSA_ALG_IS_HASH(hash_alg) is true). |
alg is not a supported hash algorithm. | #define PSA_ALG_SHA3_224 ((psa_algorithm_t)0x01000010) |
SHA3-224
| #define PSA_ALG_SHA3_256 ((psa_algorithm_t)0x01000011) |
SHA3-256
| #define PSA_ALG_SHA3_384 ((psa_algorithm_t)0x01000012) |
SHA3-384
| #define PSA_ALG_SHA3_512 ((psa_algorithm_t)0x01000013) |
SHA3-512
| #define PSA_ALG_SHA_224 ((psa_algorithm_t)0x01000008) |
SHA2-224
| #define PSA_ALG_SHA_256 ((psa_algorithm_t)0x01000009) |
SHA2-256
| #define PSA_ALG_SHA_384 ((psa_algorithm_t)0x0100000a) |
SHA2-384
| #define PSA_ALG_SHA_512 ((psa_algorithm_t)0x0100000b) |
SHA2-512
| #define PSA_ALG_SHA_512_224 ((psa_algorithm_t)0x0100000c) |
SHA2-512/224
| #define PSA_ALG_SHA_512_256 ((psa_algorithm_t)0x0100000d) |
SHA2-512/256
| #define PSA_ALG_SIGN_GET_HASH | ( | alg | ) |
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.
| alg | A signature algorithm (PSA_ALG_XXX value such that PSA_ALG_IS_SIGN(alg) is true). |
alg is a hash-and-sign algorithm. alg is a signature algorithm that does not follow the hash-and-sign structure. alg is not a signature algorithm or if it is not supported by the implementation. | #define PSA_BLOCK_CIPHER_BLOCK_SIZE | ( | type | ) |
The block size of a block cipher.
| type | A cipher key type (value of type psa_key_type_t). |
type is not a supported cipher key type.| #define PSA_KEY_TYPE_AES ((psa_key_type_t)0x04000001) |
Key for an 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).
| #define PSA_KEY_TYPE_ARC4 ((psa_key_type_t)0x04000004) |
Key for the RC4 stream cipher.
Note that RC4 is weak and deprecated and should only be used in legacy protocols.
| #define PSA_KEY_TYPE_CAMELLIA ((psa_key_type_t)0x04000003) |
Key for an cipher, AEAD or MAC algorithm based on the Camellia block cipher.
| #define PSA_KEY_TYPE_DERIVE ((psa_key_type_t)0x02000101) |
A secret for key derivation.
The key policy determines which key derivation algorithm the key can be used for.
| #define PSA_KEY_TYPE_DES ((psa_key_type_t)0x04000002) |
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.
| #define PSA_KEY_TYPE_DSA_KEYPAIR ((psa_key_type_t)0x07020000) |
DSA key pair (private and public key).
| #define PSA_KEY_TYPE_DSA_PUBLIC_KEY ((psa_key_type_t)0x06020000) |
DSA public key.
| #define PSA_KEY_TYPE_ECC_KEYPAIR | ( | curve | ) | (PSA_KEY_TYPE_ECC_KEYPAIR_BASE | (curve)) |
Elliptic curve key pair.
| #define PSA_KEY_TYPE_ECC_PUBLIC_KEY | ( | curve | ) | (PSA_KEY_TYPE_ECC_PUBLIC_KEY_BASE | (curve)) |
Elliptic curve public key.
| #define PSA_KEY_TYPE_GET_CURVE | ( | type | ) |
Extract the curve from an elliptic curve key type.
| #define PSA_KEY_TYPE_HMAC ((psa_key_type_t)0x02000001) |
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.
| #define PSA_KEY_TYPE_IS_ASYMMETRIC | ( | type | ) | (((type) & PSA_KEY_TYPE_CATEGORY_MASK) == PSA_KEY_TYPE_CATEGORY_ASYMMETRIC) |
Whether a key type is asymmetric: either a key pair or a public key.
| #define PSA_KEY_TYPE_IS_ECC | ( | type | ) |
Whether a key type is an elliptic curve key (pair or public-only).
| #define PSA_KEY_TYPE_IS_ECC_KEYPAIR | ( | type | ) |
| #define PSA_KEY_TYPE_IS_ECC_PUBLIC_KEY | ( | type | ) |
| #define PSA_KEY_TYPE_IS_KEYPAIR | ( | type | ) |
Whether a key type is a key pair containing a private part and a public part.
| #define PSA_KEY_TYPE_IS_PUBLIC_KEY | ( | type | ) |
Whether a key type is the public part of a key pair.
| #define PSA_KEY_TYPE_IS_RSA | ( | type | ) | (PSA_KEY_TYPE_PUBLIC_KEY_OF_KEYPAIR(type) == PSA_KEY_TYPE_RSA_PUBLIC_KEY) |
Whether a key type is an RSA key (pair or public-only).
| #define PSA_KEY_TYPE_IS_VENDOR_DEFINED | ( | type | ) | (((type) & PSA_KEY_TYPE_VENDOR_FLAG) != 0) |
Whether a key type is vendor-defined.
| #define PSA_KEY_TYPE_KEYPAIR_OF_PUBLIC_KEY | ( | type | ) | ((type) | PSA_KEY_TYPE_PAIR_FLAG) |
The key pair type corresponding to a public key type.
| #define PSA_KEY_TYPE_NONE ((psa_key_type_t)0x00000000) |
An invalid key type value.
Zero is not the encoding of any key type.
| #define PSA_KEY_TYPE_PUBLIC_KEY_OF_KEYPAIR | ( | type | ) | ((type) & ~PSA_KEY_TYPE_PAIR_FLAG) |
The public key type corresponding to a key pair type.
| #define PSA_KEY_TYPE_RAW_DATA ((psa_key_type_t)0x02000000) |
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.
| #define PSA_KEY_TYPE_RSA_KEYPAIR ((psa_key_type_t)0x07010000) |
RSA key pair (private and public key).
| #define PSA_KEY_TYPE_RSA_PUBLIC_KEY ((psa_key_type_t)0x06010000) |
RSA public key.
| #define PSA_KEY_TYPE_VENDOR_FLAG ((psa_key_type_t)0x80000000) |
Vendor-defined 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.
| 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.
| typedef uint16_t psa_ecc_curve_t |
The type of PSA elliptic curve identifiers.
1.8.13