SE RT Services Utilities library

General Description

Key types operations definitions.

Macros

#define IFX_SE_KEY_BITS_TOO_LARGE   ( ( ifx_se_key_bits_t ) -1 )
 The maximum value of the type used to represent bit-sizes. More...
 
#define IFX_SE_MAX_KEY_BITS   0xfff8
 The maximum size of a key in bits. More...
 
#define IFX_SE_KEY_ID_FIH_INIT_VALUE(owner, id)    { { (id), IFX_SE_FIH_VAL_MASK(id) }, { (owner), IFX_SE_FIH_VAL_MASK(owner) } }
 The initial value of the keys identifier transfer data with specified key id and owner.
 
#define IFX_SE_KEY_ID_FIH_INIT   IFX_SE_KEY_ID_FIH_INIT_VALUE(0, 0)
 The initial value of the keys identifier transfer data.
 
#define IFX_SE_KEY_TYPE_NONE   ((ifx_se_key_type_t)0x0000)
 An invalid key type value. More...
 
#define IFX_SE_KEY_TYPE_VENDOR_FLAG   ((ifx_se_key_type_t)0x8000)
 Vendor-defined key type flag. More...
 
#define IFX_SE_KEY_TYPE_IS_VENDOR_DEFINED(type)    (((type) & IFX_SE_KEY_TYPE_VENDOR_FLAG) != 0)
 Whether a key type is vendor-defined. More...
 
#define IFX_SE_KEY_TYPE_IS_UNSTRUCTURED(type)
 Whether a key type is an unstructured array of bytes. More...
 
#define IFX_SE_KEY_TYPE_IS_ASYMMETRIC(type)
 Whether a key type is asymmetric: either a key pair or a public key. More...
 
#define IFX_SE_KEY_TYPE_IS_PUBLIC_KEY(type)    (((type) & IFX_SE_KEY_TYPE_CATEGORY_MASK) == IFX_SE_KEY_TYPE_CATEGORY_PUBLIC_KEY)
 Whether a key type is the public part of a key pair.
 
#define IFX_SE_KEY_TYPE_IS_KEY_PAIR(type)    (((type) & IFX_SE_KEY_TYPE_CATEGORY_MASK) == IFX_SE_KEY_TYPE_CATEGORY_KEY_PAIR)
 Whether a key type is a key pair containing a private part and a public part.
 
#define IFX_SE_KEY_TYPE_KEY_PAIR_OF_PUBLIC_KEY(type)    ((type) | IFX_SE_KEY_TYPE_CATEGORY_FLAG_PAIR)
 The key pair type corresponding to a public key type. More...
 
#define IFX_SE_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(type)    ((type) & ~IFX_SE_KEY_TYPE_CATEGORY_FLAG_PAIR)
 The public key type corresponding to a key pair type. More...
 
#define IFX_SE_KEY_TYPE_RAW_DATA   ((ifx_se_key_type_t)0x1001)
 Raw data. More...
 
#define IFX_SE_KEY_TYPE_HMAC   ((ifx_se_key_type_t)0x1100)
 HMAC key. More...
 
#define IFX_SE_KEY_TYPE_DERIVE   ((ifx_se_key_type_t)0x1200)
 A secret for key derivation. More...
 
#define IFX_SE_KEY_TYPE_PASSWORD   ((ifx_se_key_type_t)0x1203)
 A low-entropy secret for password hashing or key derivation. More...
 
#define IFX_SE_KEY_TYPE_PASSWORD_HASH   ((ifx_se_key_type_t)0x1205)
 A secret value that can be used to verify a password hash. More...
 
#define IFX_SE_KEY_TYPE_PEPPER   ((ifx_se_key_type_t)0x1206)
 A secret value that can be used in when computing a password hash. More...
 
#define IFX_SE_KEY_TYPE_AES   ((ifx_se_key_type_t)0x2400)
 Key for a cipher, AEAD or MAC algorithm based on the AES block cipher. More...
 
#define IFX_SE_KEY_TYPE_ARIA   ((ifx_se_key_type_t)0x2406)
 Key for a cipher, AEAD or MAC algorithm based on the ARIA block cipher.
 
#define IFX_SE_KEY_TYPE_DES   ((ifx_se_key_type_t)0x2301)
 Key for a cipher or MAC algorithm based on DES or 3DES (Triple-DES). More...
 
#define IFX_SE_KEY_TYPE_CAMELLIA   ((ifx_se_key_type_t)0x2403)
 Key for a cipher, AEAD or MAC algorithm based on the Camellia block cipher.
 
#define IFX_SE_KEY_TYPE_CHACHA20   ((ifx_se_key_type_t)0x2004)
 Key for the ChaCha20 stream cipher or the Chacha20-Poly1305 AEAD algorithm. More...
 
#define IFX_SE_KEY_TYPE_RSA_PUBLIC_KEY   ((ifx_se_key_type_t)0x4001)
 RSA public key. More...
 
#define IFX_SE_KEY_TYPE_RSA_KEY_PAIR   ((ifx_se_key_type_t)0x7001)
 RSA key pair (private and public key). More...
 
#define IFX_SE_KEY_TYPE_IS_RSA(type)    (IFX_SE_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(type) == IFX_SE_KEY_TYPE_RSA_PUBLIC_KEY)
 Whether a key type is an RSA key (pair or public-only).
 
#define IFX_SE_KEY_TYPE_ECC_KEY_PAIR(curve)    (IFX_SE_KEY_TYPE_ECC_KEY_PAIR_BASE | (curve))
 Elliptic curve key pair. More...
 
#define IFX_SE_KEY_TYPE_ECC_PUBLIC_KEY(curve)    (IFX_SE_KEY_TYPE_ECC_PUBLIC_KEY_BASE | (curve))
 Elliptic curve public key. More...
 
#define IFX_SE_KEY_TYPE_IS_ECC(type)
 Whether a key type is an elliptic curve key (pair or public-only). More...
 
#define IFX_SE_KEY_TYPE_IS_ECC_KEY_PAIR(type)
 Whether a key type is an elliptic curve key pair. More...
 
#define IFX_SE_KEY_TYPE_IS_ECC_PUBLIC_KEY(type)
 Whether a key type is an elliptic curve public key. More...
 
#define IFX_SE_KEY_TYPE_ECC_GET_FAMILY(type)
 Extract the curve from an elliptic curve key type. More...
 
#define IFX_SE_ECC_FAMILY_IS_WEIERSTRASS(family)   ((family & 0xc0) == 0)
 Check if the curve of given family is Weierstrass elliptic curve.
 
#define IFX_SE_ECC_FAMILY_SECP_K1   ((ifx_se_ecc_family_t) 0x17)
 SEC Koblitz curves over prime fields. More...
 
#define IFX_SE_ECC_FAMILY_SECP_R1   ((ifx_se_ecc_family_t) 0x12)
 SEC random curves over prime fields. More...
 
#define IFX_SE_ECC_FAMILY_SECP_R2   ((ifx_se_ecc_family_t) 0x1b)
 SECP160R2 (SEC2 v1, obsolete)
 
#define IFX_SE_ECC_FAMILY_SECT_K1   ((ifx_se_ecc_family_t) 0x27)
 SEC Koblitz curves over binary fields. More...
 
#define IFX_SE_ECC_FAMILY_SECT_R1   ((ifx_se_ecc_family_t) 0x22)
 SEC random curves over binary fields. More...
 
#define IFX_SE_ECC_FAMILY_SECT_R2   ((ifx_se_ecc_family_t) 0x2b)
 SEC additional random curves over binary fields. More...
 
#define IFX_SE_ECC_FAMILY_BRAINPOOL_P_R1   ((ifx_se_ecc_family_t) 0x30)
 Brainpool P random curves. More...
 
#define IFX_SE_ECC_FAMILY_MONTGOMERY   ((ifx_se_ecc_family_t) 0x41)
 Curve25519 and Curve448. More...
 
#define IFX_SE_ECC_FAMILY_TWISTED_EDWARDS   ((ifx_se_ecc_family_t) 0x42)
 The twisted Edwards curves Ed25519 and Ed448. More...
 
#define IFX_SE_KEY_TYPE_DH_KEY_PAIR(group)    (IFX_SE_KEY_TYPE_DH_KEY_PAIR_BASE | (group))
 Diffie-Hellman key pair. More...
 
#define IFX_SE_KEY_TYPE_DH_PUBLIC_KEY(group)    (IFX_SE_KEY_TYPE_DH_PUBLIC_KEY_BASE | (group))
 Diffie-Hellman public key. More...
 
#define IFX_SE_KEY_TYPE_IS_DH(type)
 Whether a key type is a Diffie-Hellman key (pair or public-only). More...
 
#define IFX_SE_KEY_TYPE_IS_DH_KEY_PAIR(type)
 Whether a key type is a Diffie-Hellman key pair. More...
 
#define IFX_SE_KEY_TYPE_IS_DH_PUBLIC_KEY(type)
 Whether a key type is a Diffie-Hellman public key. More...
 
#define IFX_SE_KEY_TYPE_DH_GET_FAMILY(type)
 Extract the group from a Diffie-Hellman key type. More...
 
#define IFX_SE_DH_FAMILY_RFC7919   ((ifx_se_dh_family_t) 0x03)
 Diffie-Hellman groups defined in RFC 7919 Appendix A. More...
 
#define IFX_SE_BLOCK_CIPHER_BLOCK_LENGTH(type)
 The block size of a block cipher. More...
 

Typedefs

typedef uint16_t ifx_se_key_bits_t
 The type used internally for key sizes. More...
 
typedef uint16_t ifx_se_key_type_t
 Encoding of a key type.
 
typedef uint8_t ifx_se_ecc_family_t
 The type of PSA elliptic curve family identifiers. More...
 
typedef uint8_t ifx_se_dh_family_t
 The type of PSA Diffie-Hellman group family identifiers. More...
 

Functions

static void ifx_se_set_key_type (ifx_se_key_attributes_t *attributes, ifx_se_key_type_t type)
 Sets key type in key attributes structure. More...
 
static ifx_se_key_type_t ifx_se_get_key_type (const ifx_se_key_attributes_t *attributes)
 Gets key type from key attributes structure. More...
 
static void ifx_se_set_key_bits (ifx_se_key_attributes_t *attributes, size_t bits)
 Sets key length in bits in key attributes structure. More...
 
static size_t ifx_se_get_key_bits (const ifx_se_key_attributes_t *attributes)
 Gets key length in bits from key attributes structure. More...
 
static ifx_se_key_id_fih_t ifx_se_key_id_fih_init (void)
 Sets key FIH transfer data with initial value. More...
 
static ifx_se_key_id_fih_t ifx_se_key_id_fih_make (int32_t owner_id, ifx_se_key_id_t key_id)
 Utility to initialize a key identifier FIH transfer data at runtime. More...
 
static ifx_se_key_id_fih_t ifx_se_key_id_make (ifx_se_fih_uint owner_id, ifx_se_fih_uint key_id)
 Utility to initialize a key identifier FIH transfer data from FIH values at runtime. More...
 

Macro Definition Documentation

◆ IFX_SE_KEY_BITS_TOO_LARGE

#define IFX_SE_KEY_BITS_TOO_LARGE   ( ( ifx_se_key_bits_t ) -1 )

The maximum value of the type used to represent bit-sizes.

This is used to mark an invalid key size.

◆ IFX_SE_MAX_KEY_BITS

#define IFX_SE_MAX_KEY_BITS   0xfff8

The maximum size of a key in bits.

Currently defined as the maximum that can be represented, rounded down to a whole number of bytes. This is an uncast value so that it can be used in preprocessor conditionals.

◆ IFX_SE_KEY_TYPE_NONE

#define IFX_SE_KEY_TYPE_NONE   ((ifx_se_key_type_t)0x0000)

An invalid key type value.

Zero is not the encoding of any key type.

◆ IFX_SE_KEY_TYPE_VENDOR_FLAG

#define IFX_SE_KEY_TYPE_VENDOR_FLAG   ((ifx_se_key_type_t)0x8000)

Vendor-defined key type flag.

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

◆ IFX_SE_KEY_TYPE_IS_VENDOR_DEFINED

#define IFX_SE_KEY_TYPE_IS_VENDOR_DEFINED (   type)     (((type) & IFX_SE_KEY_TYPE_VENDOR_FLAG) != 0)

Whether a key type is vendor-defined.

See also IFX_SE_KEY_TYPE_VENDOR_FLAG.

◆ IFX_SE_KEY_TYPE_IS_UNSTRUCTURED

#define IFX_SE_KEY_TYPE_IS_UNSTRUCTURED (   type)
Value:
(((type) & IFX_SE_KEY_TYPE_CATEGORY_MASK) == IFX_SE_KEY_TYPE_CATEGORY_RAW || \
((type) & IFX_SE_KEY_TYPE_CATEGORY_MASK) == IFX_SE_KEY_TYPE_CATEGORY_SYMMETRIC)

Whether a key type is an unstructured array of bytes.

This encompasses both symmetric keys and non-key data.

◆ IFX_SE_KEY_TYPE_IS_ASYMMETRIC

#define IFX_SE_KEY_TYPE_IS_ASYMMETRIC (   type)
Value:
(((type) & IFX_SE_KEY_TYPE_CATEGORY_MASK \
& ~IFX_SE_KEY_TYPE_CATEGORY_FLAG_PAIR) == \
IFX_SE_KEY_TYPE_CATEGORY_PUBLIC_KEY)

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

◆ IFX_SE_KEY_TYPE_KEY_PAIR_OF_PUBLIC_KEY

#define IFX_SE_KEY_TYPE_KEY_PAIR_OF_PUBLIC_KEY (   type)     ((type) | IFX_SE_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
typeA 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.

◆ IFX_SE_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR

#define IFX_SE_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR (   type)     ((type) & ~IFX_SE_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
typeA 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.

◆ IFX_SE_KEY_TYPE_RAW_DATA

#define IFX_SE_KEY_TYPE_RAW_DATA   ((ifx_se_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.

◆ IFX_SE_KEY_TYPE_HMAC

#define IFX_SE_KEY_TYPE_HMAC   ((ifx_se_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 IFX_SE_HASH_LENGTH(alg) where alg is the HMAC algorithm or the underlying hash algorithm.

◆ IFX_SE_KEY_TYPE_DERIVE

#define IFX_SE_KEY_TYPE_DERIVE   ((ifx_se_key_type_t)0x1200)

A secret for key derivation.

This key type is for high-entropy secrets only. For low-entropy secrets, IFX_SE_KEY_TYPE_PASSWORD should be used instead.

These keys can be used as the IFX_SE_KEY_DERIVATION_INPUT_SECRET or IFX_SE_KEY_DERIVATION_INPUT_PASSWORD input of key derivation algorithms.

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

◆ IFX_SE_KEY_TYPE_PASSWORD

#define IFX_SE_KEY_TYPE_PASSWORD   ((ifx_se_key_type_t)0x1203)

A low-entropy secret for password hashing or key derivation.

This key type is suitable for passwords and passphrases which are typically intended to be memorizable by humans, and have a low entropy relative to their size. It can be used for randomly generated or derived keys with maximum or near-maximum entropy, but IFX_SE_KEY_TYPE_DERIVE is more suitable for such keys. It is not suitable for passwords with extremely low entropy, such as numerical PINs.

These keys can be used as the IFX_SE_KEY_DERIVATION_INPUT_PASSWORD input of key derivation algorithms. Algorithms that accept such an input were designed to accept low-entropy secret and are known as password hashing or key stretching algorithms.

These keys cannot be used as the IFX_SE_KEY_DERIVATION_INPUT_SECRET input of key derivation algorithms, as the algorithms that take such an input expect it to be high-entropy.

The key policy determines which key derivation algorithm the key can be used for, among the permissible subset defined above.

◆ IFX_SE_KEY_TYPE_PASSWORD_HASH

#define IFX_SE_KEY_TYPE_PASSWORD_HASH   ((ifx_se_key_type_t)0x1205)

A secret value that can be used to verify a password hash.

The key policy determines which key derivation algorithm the key can be used for, among the same permissible subset as for IFX_SE_KEY_TYPE_PASSWORD.

◆ IFX_SE_KEY_TYPE_PEPPER

#define IFX_SE_KEY_TYPE_PEPPER   ((ifx_se_key_type_t)0x1206)

A secret value that can be used in when computing a password hash.

The key policy determines which key derivation algorithm the key can be used for, among the subset of algorithms that can use pepper.

◆ IFX_SE_KEY_TYPE_AES

#define IFX_SE_KEY_TYPE_AES   ((ifx_se_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).

◆ IFX_SE_KEY_TYPE_DES

#define IFX_SE_KEY_TYPE_DES   ((ifx_se_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 64 bits (single DES), 128 bits (2-key 3DES) or 192 bits (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.

◆ IFX_SE_KEY_TYPE_CHACHA20

#define IFX_SE_KEY_TYPE_CHACHA20   ((ifx_se_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.

Note
For ChaCha20 and ChaCha20_Poly1305, Mbed TLS only supports 12-byte nonces.
For ChaCha20, the initial counter value is 0. To encrypt or decrypt with the initial counter value 1, you can process and discard a 64-byte block before the real data.

◆ IFX_SE_KEY_TYPE_RSA_PUBLIC_KEY

#define IFX_SE_KEY_TYPE_RSA_PUBLIC_KEY   ((ifx_se_key_type_t)0x4001)

RSA public key.

The size of an RSA key is the bit size of the modulus.

◆ IFX_SE_KEY_TYPE_RSA_KEY_PAIR

#define IFX_SE_KEY_TYPE_RSA_KEY_PAIR   ((ifx_se_key_type_t)0x7001)

RSA key pair (private and public key).

The size of an RSA key is the bit size of the modulus.

◆ IFX_SE_KEY_TYPE_ECC_KEY_PAIR

#define IFX_SE_KEY_TYPE_ECC_KEY_PAIR (   curve)     (IFX_SE_KEY_TYPE_ECC_KEY_PAIR_BASE | (curve))

Elliptic curve key pair.

The size of an elliptic curve key is the bit size associated with the curve, i.e. the bit size of q for a curve over a field *Fq*. See the documentation of IFX_SE_ECC_FAMILY_xxx curve families for details.

Parameters
curveA value of type ifx_se_ecc_family_t that identifies the ECC curve to be used.

◆ IFX_SE_KEY_TYPE_ECC_PUBLIC_KEY

#define IFX_SE_KEY_TYPE_ECC_PUBLIC_KEY (   curve)     (IFX_SE_KEY_TYPE_ECC_PUBLIC_KEY_BASE | (curve))

Elliptic curve public key.

The size of an elliptic curve public key is the same as the corresponding private key (see IFX_SE_KEY_TYPE_ECC_KEY_PAIR and the documentation of IFX_SE_ECC_FAMILY_xxx curve families).

Parameters
curveA value of type ifx_se_ecc_family_t that identifies the ECC curve to be used.

◆ IFX_SE_KEY_TYPE_IS_ECC

#define IFX_SE_KEY_TYPE_IS_ECC (   type)
Value:
~IFX_SE_KEY_TYPE_ECC_CURVE_MASK) == IFX_SE_KEY_TYPE_ECC_PUBLIC_KEY_BASE)
#define IFX_SE_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(type)
The public key type corresponding to a key pair type.
Definition: ifx_se_psacrypto_values.h:407

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

◆ IFX_SE_KEY_TYPE_IS_ECC_KEY_PAIR

#define IFX_SE_KEY_TYPE_IS_ECC_KEY_PAIR (   type)
Value:
(((type) & ~IFX_SE_KEY_TYPE_ECC_CURVE_MASK) == \
IFX_SE_KEY_TYPE_ECC_KEY_PAIR_BASE)

Whether a key type is an elliptic curve key pair.

◆ IFX_SE_KEY_TYPE_IS_ECC_PUBLIC_KEY

#define IFX_SE_KEY_TYPE_IS_ECC_PUBLIC_KEY (   type)
Value:
(((type) & ~IFX_SE_KEY_TYPE_ECC_CURVE_MASK) == \
IFX_SE_KEY_TYPE_ECC_PUBLIC_KEY_BASE)

Whether a key type is an elliptic curve public key.

◆ IFX_SE_KEY_TYPE_ECC_GET_FAMILY

#define IFX_SE_KEY_TYPE_ECC_GET_FAMILY (   type)
Value:
((type) & IFX_SE_KEY_TYPE_ECC_CURVE_MASK) : \
0))
uint8_t ifx_se_ecc_family_t
The type of PSA elliptic curve family identifiers.
Definition: ifx_se_psacrypto_types.h:143
#define IFX_SE_KEY_TYPE_IS_ECC(type)
Whether a key type is an elliptic curve key (pair or public-only).
Definition: ifx_se_psacrypto_values.h:560

Extract the curve from an elliptic curve key type.

◆ IFX_SE_ECC_FAMILY_SECP_K1

#define IFX_SE_ECC_FAMILY_SECP_K1   ((ifx_se_ecc_family_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

◆ IFX_SE_ECC_FAMILY_SECP_R1

#define IFX_SE_ECC_FAMILY_SECP_R1   ((ifx_se_ecc_family_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

◆ IFX_SE_ECC_FAMILY_SECT_K1

#define IFX_SE_ECC_FAMILY_SECT_K1   ((ifx_se_ecc_family_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

◆ IFX_SE_ECC_FAMILY_SECT_R1

#define IFX_SE_ECC_FAMILY_SECT_R1   ((ifx_se_ecc_family_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

◆ IFX_SE_ECC_FAMILY_SECT_R2

#define IFX_SE_ECC_FAMILY_SECT_R2   ((ifx_se_ecc_family_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

◆ IFX_SE_ECC_FAMILY_BRAINPOOL_P_R1

#define IFX_SE_ECC_FAMILY_BRAINPOOL_P_R1   ((ifx_se_ecc_family_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.

◆ IFX_SE_ECC_FAMILY_MONTGOMERY

#define IFX_SE_ECC_FAMILY_MONTGOMERY   ((ifx_se_ecc_family_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 IFX_SE_ALG_ECDH performs X25519 when used with this curve.
  • 448-bit: Hamburg, Ed448-Goldilocks, a new elliptic curve, NIST ECC Workshop, 2015. The algorithm IFX_SE_ALG_ECDH performs X448 when used with this curve.

◆ IFX_SE_ECC_FAMILY_TWISTED_EDWARDS

#define IFX_SE_ECC_FAMILY_TWISTED_EDWARDS   ((ifx_se_ecc_family_t) 0x42)

The twisted Edwards curves Ed25519 and Ed448.

These curves are suitable for EdDSA (IFX_SE_ALG_PURE_EDDSA for both curves, IFX_SE_ALG_ED25519PH for the 255-bit curve, IFX_SE_ALG_ED448PH for the 448-bit curve).

This family comprises the following twisted Edwards curves:

  • 255-bit: Edwards25519, the twisted Edwards curve birationally equivalent to Curve25519. Bernstein et al., Twisted Edwards curves, Africacrypt 2008.
  • 448-bit: Edwards448, the twisted Edwards curve birationally equivalent to Curve448. Hamburg, Ed448-Goldilocks, a new elliptic curve, NIST ECC Workshop, 2015.

◆ IFX_SE_KEY_TYPE_DH_KEY_PAIR

#define IFX_SE_KEY_TYPE_DH_KEY_PAIR (   group)     (IFX_SE_KEY_TYPE_DH_KEY_PAIR_BASE | (group))

Diffie-Hellman key pair.

Parameters
groupA value of type ifx_se_dh_family_t that identifies the Diffie-Hellman group to be used.

◆ IFX_SE_KEY_TYPE_DH_PUBLIC_KEY

#define IFX_SE_KEY_TYPE_DH_PUBLIC_KEY (   group)     (IFX_SE_KEY_TYPE_DH_PUBLIC_KEY_BASE | (group))

Diffie-Hellman public key.

Parameters
groupA value of type ifx_se_dh_family_t that identifies the Diffie-Hellman group to be used.

◆ IFX_SE_KEY_TYPE_IS_DH

#define IFX_SE_KEY_TYPE_IS_DH (   type)
Value:
~IFX_SE_KEY_TYPE_DH_GROUP_MASK) == IFX_SE_KEY_TYPE_DH_PUBLIC_KEY_BASE)

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

◆ IFX_SE_KEY_TYPE_IS_DH_KEY_PAIR

#define IFX_SE_KEY_TYPE_IS_DH_KEY_PAIR (   type)
Value:
(((type) & ~IFX_SE_KEY_TYPE_DH_GROUP_MASK) == \
IFX_SE_KEY_TYPE_DH_KEY_PAIR_BASE)

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

◆ IFX_SE_KEY_TYPE_IS_DH_PUBLIC_KEY

#define IFX_SE_KEY_TYPE_IS_DH_PUBLIC_KEY (   type)
Value:
(((type) & ~IFX_SE_KEY_TYPE_DH_GROUP_MASK) == \
IFX_SE_KEY_TYPE_DH_PUBLIC_KEY_BASE)

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

◆ IFX_SE_KEY_TYPE_DH_GET_FAMILY

#define IFX_SE_KEY_TYPE_DH_GET_FAMILY (   type)
Value:
((type) & IFX_SE_KEY_TYPE_DH_GROUP_MASK) : \
0))
uint8_t ifx_se_dh_family_t
The type of PSA Diffie-Hellman group family identifiers.
Definition: ifx_se_psacrypto_types.h:154
#define IFX_SE_KEY_TYPE_IS_DH(type)
Whether a key type is a Diffie-Hellman key (pair or public-only).
Definition: ifx_se_psacrypto_values.h:699

Extract the group from a Diffie-Hellman key type.

◆ IFX_SE_DH_FAMILY_RFC7919

#define IFX_SE_DH_FAMILY_RFC7919   ((ifx_se_dh_family_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.

◆ IFX_SE_BLOCK_CIPHER_BLOCK_LENGTH

#define IFX_SE_BLOCK_CIPHER_BLOCK_LENGTH (   type)
Value:
(((type) & IFX_SE_KEY_TYPE_CATEGORY_MASK) == IFX_SE_KEY_TYPE_CATEGORY_SYMMETRIC ? \
1u << IFX_SE_GET_KEY_TYPE_BLOCK_SIZE_EXPONENT(type) : \
0u)

The block size of a block cipher.

Parameters
typeA cipher key type (value of type ifx_se_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 (IFX_SE_ALG_CTR). This macro only takes the key type into account, so it cannot be used to determine the size of the data that ifx_se_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.

Typedef Documentation

◆ ifx_se_key_bits_t

typedef uint16_t ifx_se_key_bits_t

The type used internally for key sizes.

Public interfaces use size_t, but internally we use a smaller type.

◆ ifx_se_ecc_family_t

typedef uint8_t ifx_se_ecc_family_t

The type of PSA elliptic curve family identifiers.

The curve identifier is required to create an ECC key using the IFX_SE_KEY_TYPE_ECC_KEY_PAIR() or IFX_SE_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.

◆ ifx_se_dh_family_t

typedef uint8_t ifx_se_dh_family_t

The type of PSA Diffie-Hellman group family identifiers.

The group identifier is required to create an Diffie-Hellman key using the IFX_SE_KEY_TYPE_DH_KEY_PAIR() or IFX_SE_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.

Function Documentation

◆ ifx_se_set_key_type()

static void ifx_se_set_key_type ( ifx_se_key_attributes_t attributes,
ifx_se_key_type_t  type 
)
inlinestatic

Sets key type in key attributes structure.

Parameters
[in]attributesKey attributes structure
[in]typeKey type

◆ ifx_se_get_key_type()

static ifx_se_key_type_t ifx_se_get_key_type ( const ifx_se_key_attributes_t attributes)
inlinestatic

Gets key type from key attributes structure.

Parameters
[in]attributesKey attributes structure
Returns
Key type

◆ ifx_se_set_key_bits()

static void ifx_se_set_key_bits ( ifx_se_key_attributes_t attributes,
size_t  bits 
)
inlinestatic

Sets key length in bits in key attributes structure.

Parameters
[in]attributesKey attributes structure
[in]bitsKey length in bits

◆ ifx_se_get_key_bits()

static size_t ifx_se_get_key_bits ( const ifx_se_key_attributes_t attributes)
inlinestatic

Gets key length in bits from key attributes structure.

Parameters
[in]attributesKey attributes structure
Returns
Key length in bits

◆ ifx_se_key_id_fih_init()

static ifx_se_key_id_fih_t ifx_se_key_id_fih_init ( void  )
inlinestatic

Sets key FIH transfer data with initial value.

Returns
ifx_se_key_id_fih_s structure

◆ ifx_se_key_id_fih_make()

static ifx_se_key_id_fih_t ifx_se_key_id_fih_make ( int32_t  owner_id,
ifx_se_key_id_t  key_id 
)
inlinestatic

Utility to initialize a key identifier FIH transfer data at runtime.

Parameters
owner_idIdentifier of the key owner.
key_idIdentifier of the key.
Returns
ifx_se_key_id_fih_s structure

◆ ifx_se_key_id_make()

static ifx_se_key_id_fih_t ifx_se_key_id_make ( ifx_se_fih_uint  owner_id,
ifx_se_fih_uint  key_id 
)
inlinestatic

Utility to initialize a key identifier FIH transfer data from FIH values at runtime.

Parameters
owner_idIdentifier of the key owner.
key_idIdentifier of the key.
Returns
ifx_se_key_id_fih_s structure