xref: /optee_os/lib/libutee/include/utee_defines.h (revision 3f61056de4fb3e67cfd2524f31ba765cbbd11496)
11bb92983SJerome Forissier /* SPDX-License-Identifier: BSD-2-Clause */
2b0104773SPascal Brand /*
3b0104773SPascal Brand  * Copyright (c) 2014, STMicroelectronics International N.V.
4eee637e7SAlexander Zakharov  * Copyright (c) 2021, SumUp Services GmbH
5b0104773SPascal Brand  */
6b0104773SPascal Brand #ifndef UTEE_DEFINES_H
7b0104773SPascal Brand #define UTEE_DEFINES_H
8b0104773SPascal Brand 
909d93d24SJens Wiklander #include <compiler.h>
1091fc6bd8SJerome Forissier #include <tee_api_defines.h>
11688c335dSJerome Forissier #include <tee_api_defines_extensions.h>
1209d93d24SJens Wiklander #include <types_ext.h>
1309d93d24SJens Wiklander 
14b0104773SPascal Brand /*
15b0104773SPascal Brand  * Copied from TEE Internal API specificaion v1.0 table 6-9 "Structure of
16b0104773SPascal Brand  * Algorithm Identifier".
17b0104773SPascal Brand  */
18b0104773SPascal Brand #define TEE_MAIN_ALGO_MD5        0x01
19b0104773SPascal Brand #define TEE_MAIN_ALGO_SHA1       0x02
20b0104773SPascal Brand #define TEE_MAIN_ALGO_SHA224     0x03
21b0104773SPascal Brand #define TEE_MAIN_ALGO_SHA256     0x04
22b0104773SPascal Brand #define TEE_MAIN_ALGO_SHA384     0x05
23b0104773SPascal Brand #define TEE_MAIN_ALGO_SHA512     0x06
2447645577SJerome Forissier #define TEE_MAIN_ALGO_SM3        0x07
25b0104773SPascal Brand #define TEE_MAIN_ALGO_AES        0x10
26b0104773SPascal Brand #define TEE_MAIN_ALGO_DES        0x11
27b0104773SPascal Brand #define TEE_MAIN_ALGO_DES2       0x12
28b0104773SPascal Brand #define TEE_MAIN_ALGO_DES3       0x13
29ade6f848SJerome Forissier #define TEE_MAIN_ALGO_SM4        0x14 /* Not in v1.2, extrapolated */
30b0104773SPascal Brand #define TEE_MAIN_ALGO_RSA        0x30
31b0104773SPascal Brand #define TEE_MAIN_ALGO_DSA        0x31
32b0104773SPascal Brand #define TEE_MAIN_ALGO_DH         0x32
33c988227aSPascal Brand #define TEE_MAIN_ALGO_ECDSA      0x41
34c988227aSPascal Brand #define TEE_MAIN_ALGO_ECDH       0x42
350f151943SJerome Forissier #define TEE_MAIN_ALGO_SM2_DSA_SM3 0x45 /* Not in v1.2 spec */
365b385b3fSJerome Forissier #define TEE_MAIN_ALGO_SM2_KEP    0x46 /* Not in v1.2 spec */
3791fc6bd8SJerome Forissier #define TEE_MAIN_ALGO_SM2_PKE    0x47 /* Not in v1.2 spec */
38cdb198a7SJerome Forissier #define TEE_MAIN_ALGO_HKDF       0xC0 /* OP-TEE extension */
398854d3c6SJerome Forissier #define TEE_MAIN_ALGO_CONCAT_KDF 0xC1 /* OP-TEE extension */
400f2293b7SJerome Forissier #define TEE_MAIN_ALGO_PBKDF2     0xC2 /* OP-TEE extension */
41*3f61056dSSohaib ul Hassan #define TEE_MAIN_ALGO_X25519     0x44 /* Not in v1.2 spec */
428854d3c6SJerome Forissier 
43b0104773SPascal Brand 
44b0104773SPascal Brand #define TEE_CHAIN_MODE_ECB_NOPAD        0x0
45b0104773SPascal Brand #define TEE_CHAIN_MODE_CBC_NOPAD        0x1
46b0104773SPascal Brand #define TEE_CHAIN_MODE_CTR              0x2
47b0104773SPascal Brand #define TEE_CHAIN_MODE_CTS              0x3
48b0104773SPascal Brand #define TEE_CHAIN_MODE_XTS              0x4
49b0104773SPascal Brand #define TEE_CHAIN_MODE_CBC_MAC_PKCS5    0x5
50b0104773SPascal Brand #define TEE_CHAIN_MODE_CMAC             0x6
51b0104773SPascal Brand #define TEE_CHAIN_MODE_CCM              0x7
52b0104773SPascal Brand #define TEE_CHAIN_MODE_GCM              0x8
53b0104773SPascal Brand #define TEE_CHAIN_MODE_PKCS1_PSS_MGF1   0x9	/* ??? */
54b0104773SPascal Brand 
55b0104773SPascal Brand 
5691fc6bd8SJerome Forissier static inline uint32_t __tee_alg_get_class(uint32_t algo)
5791fc6bd8SJerome Forissier {
5891fc6bd8SJerome Forissier 	if (algo == TEE_ALG_SM2_PKE)
5991fc6bd8SJerome Forissier 		return TEE_OPERATION_ASYMMETRIC_CIPHER;
605b385b3fSJerome Forissier 	if (algo == TEE_ALG_SM2_KEP)
615b385b3fSJerome Forissier 		return TEE_OPERATION_KEY_DERIVATION;
62688c335dSJerome Forissier 	if (algo == TEE_ALG_RSASSA_PKCS1_V1_5)
63688c335dSJerome Forissier 		return TEE_OPERATION_ASYMMETRIC_SIGNATURE;
64eee637e7SAlexander Zakharov 	if (algo == TEE_ALG_DES3_CMAC)
65eee637e7SAlexander Zakharov 		return TEE_OPERATION_MAC;
66b0104773SPascal Brand 
6791fc6bd8SJerome Forissier 	return (algo >> 28) & 0xF; /* Bits [31:28] */
6891fc6bd8SJerome Forissier }
6991fc6bd8SJerome Forissier 
7091fc6bd8SJerome Forissier #define TEE_ALG_GET_CLASS(algo) __tee_alg_get_class(algo)
7191fc6bd8SJerome Forissier 
7291fc6bd8SJerome Forissier static inline uint32_t __tee_alg_get_main_alg(uint32_t algo)
7391fc6bd8SJerome Forissier {
7491fc6bd8SJerome Forissier 	switch (algo) {
7591fc6bd8SJerome Forissier 	case TEE_ALG_SM2_PKE:
7691fc6bd8SJerome Forissier 		return TEE_MAIN_ALGO_SM2_PKE;
775b385b3fSJerome Forissier 	case TEE_ALG_SM2_KEP:
785b385b3fSJerome Forissier 		return TEE_MAIN_ALGO_SM2_KEP;
79*3f61056dSSohaib ul Hassan 	case TEE_ALG_X25519:
80*3f61056dSSohaib ul Hassan 		return TEE_MAIN_ALGO_X25519;
8191fc6bd8SJerome Forissier 	default:
8291fc6bd8SJerome Forissier 		break;
8391fc6bd8SJerome Forissier 	}
8491fc6bd8SJerome Forissier 
8591fc6bd8SJerome Forissier 	return algo & 0xff;
8691fc6bd8SJerome Forissier }
8791fc6bd8SJerome Forissier 
8891fc6bd8SJerome Forissier #define TEE_ALG_GET_MAIN_ALG(algo) __tee_alg_get_main_alg(algo)
89b0104773SPascal Brand 
90b0104773SPascal Brand 	/* Bits [11:8] */
91b0104773SPascal Brand #define TEE_ALG_GET_CHAIN_MODE(algo)    (((algo) >> 8) & 0xF)
92b0104773SPascal Brand 
930f151943SJerome Forissier /*
940f151943SJerome Forissier  * Value not defined in the GP spec, and not used as bits 15-12 of any TEE_ALG*
950f151943SJerome Forissier  * value. TEE_ALG_SM2_DSA_SM3 has value 0x6 for bits 15-12 which would yield the
960f151943SJerome Forissier  * SHA512 digest if we were to apply the bit masks that were valid up to the TEE
970f151943SJerome Forissier  * Internal Core API v1.1.
980f151943SJerome Forissier  */
990f151943SJerome Forissier #define __TEE_MAIN_HASH_SM3 0x7
1000f151943SJerome Forissier 
1010f151943SJerome Forissier static inline uint32_t __tee_alg_get_digest_hash(uint32_t algo)
1020f151943SJerome Forissier {
1030f151943SJerome Forissier 	if (algo == TEE_ALG_SM2_DSA_SM3)
1040f151943SJerome Forissier 		return __TEE_MAIN_HASH_SM3;
1050f151943SJerome Forissier 
106b0104773SPascal Brand 	/* Bits [15:12] */
1070f151943SJerome Forissier 	return (algo >> 12) & 0xF;
1080f151943SJerome Forissier }
1090f151943SJerome Forissier 
1100f151943SJerome Forissier #define TEE_ALG_GET_DIGEST_HASH(algo) __tee_alg_get_digest_hash(algo)
111b0104773SPascal Brand 
112b0104773SPascal Brand 	/* Bits [23:20] */
113b0104773SPascal Brand #define TEE_ALG_GET_INTERNAL_HASH(algo) (((algo) >> 20) & 0x7)
114b0104773SPascal Brand 
11591fc6bd8SJerome Forissier static inline uint32_t __tee_alg_get_key_type(uint32_t algo, bool with_priv)
11691fc6bd8SJerome Forissier {
11791fc6bd8SJerome Forissier 	uint32_t key_type = 0xA0000000 |  TEE_ALG_GET_MAIN_ALG(algo);
11891fc6bd8SJerome Forissier 
11991fc6bd8SJerome Forissier 	if (with_priv)
12091fc6bd8SJerome Forissier 		key_type |= 0x01000000;
12191fc6bd8SJerome Forissier 
12291fc6bd8SJerome Forissier 	return key_type;
12391fc6bd8SJerome Forissier }
12491fc6bd8SJerome Forissier 
12591fc6bd8SJerome Forissier #define TEE_ALG_GET_KEY_TYPE(algo, with_private_key) \
12691fc6bd8SJerome Forissier 	__tee_alg_get_key_type(algo, with_private_key)
12791fc6bd8SJerome Forissier 
1280f151943SJerome Forissier static inline uint32_t __tee_alg_hash_algo(uint32_t main_hash)
1290f151943SJerome Forissier {
1300f151943SJerome Forissier 	if (main_hash == __TEE_MAIN_HASH_SM3)
1310f151943SJerome Forissier 		return TEE_ALG_SM3;
1320f151943SJerome Forissier 
1330f151943SJerome Forissier 	return (TEE_OPERATION_DIGEST << 28) | main_hash;
1340f151943SJerome Forissier }
1350f151943SJerome Forissier 
136b0104773SPascal Brand 	/* Return hash algorithm based on main hash */
1370f151943SJerome Forissier #define TEE_ALG_HASH_ALGO(main_hash) __tee_alg_hash_algo(main_hash)
138b0104773SPascal Brand 
139b0104773SPascal Brand 	/* Extract internal hash and return hash algorithm */
140b0104773SPascal Brand #define TEE_INTERNAL_HASH_TO_ALGO(algo) \
141b0104773SPascal Brand                 TEE_ALG_HASH_ALGO(TEE_ALG_GET_INTERNAL_HASH(algo))
142b0104773SPascal Brand 
143b0104773SPascal Brand 	/* Extract digest hash and return hash algorithm */
144b0104773SPascal Brand #define TEE_DIGEST_HASH_TO_ALGO(algo) \
145b0104773SPascal Brand                 TEE_ALG_HASH_ALGO(TEE_ALG_GET_DIGEST_HASH(algo))
146b0104773SPascal Brand 
147cdb198a7SJerome Forissier /* Return HMAC algorithm based on main hash */
148cdb198a7SJerome Forissier #define TEE_ALG_HMAC_ALGO(main_hash) \
149cdb198a7SJerome Forissier 	(TEE_OPERATION_MAC << 28 | (main_hash))
150cdb198a7SJerome Forissier 
151b0104773SPascal Brand #define TEE_AES_BLOCK_SIZE  16UL
152b0104773SPascal Brand #define TEE_DES_BLOCK_SIZE  8UL
153ade6f848SJerome Forissier #define TEE_SM4_BLOCK_SIZE  16UL
154b0104773SPascal Brand 
155b0104773SPascal Brand #define TEE_AES_MAX_KEY_SIZE    32UL
156b0104773SPascal Brand 
157b0104773SPascal Brand 	/* SHA-512 */
158b0104773SPascal Brand #ifndef TEE_MD5_HASH_SIZE
159b0104773SPascal Brand typedef enum {
160b0104773SPascal Brand 	TEE_MD5_HASH_SIZE = 16,
161b0104773SPascal Brand 	TEE_SHA1_HASH_SIZE = 20,
162b0104773SPascal Brand 	TEE_SHA224_HASH_SIZE = 28,
163b0104773SPascal Brand 	TEE_SHA256_HASH_SIZE = 32,
16447645577SJerome Forissier 	TEE_SM3_HASH_SIZE = 32,
165b0104773SPascal Brand 	TEE_SHA384_HASH_SIZE = 48,
166b0104773SPascal Brand 	TEE_SHA512_HASH_SIZE = 64,
167b0104773SPascal Brand 	TEE_MD5SHA1_HASH_SIZE = (TEE_MD5_HASH_SIZE + TEE_SHA1_HASH_SIZE),
168b0104773SPascal Brand 	TEE_MAX_HASH_SIZE = 64,
169b0104773SPascal Brand } t_hash_size;
170b0104773SPascal Brand #endif
171b0104773SPascal Brand 
172b0104773SPascal Brand #define TEE_MAC_SIZE_AES_CBC_MAC_NOPAD
173b0104773SPascal Brand #define TEE_MAC_SIZE_AES_CBC_MAC_PKCS5
174b0104773SPascal Brand #define TEE_MAC_SIZE_AES_CMAC
175b0104773SPascal Brand #define TEE_MAC_SIZE_DES_CBC_MAC_PKCS5
176b0104773SPascal Brand 
1772e5e6460SAlbert Schwarzkopf static inline size_t __tee_alg_get_digest_size(uint32_t algo)
1782e5e6460SAlbert Schwarzkopf {
1792e5e6460SAlbert Schwarzkopf 	switch (algo) {
1802e5e6460SAlbert Schwarzkopf 	case TEE_ALG_MD5:
1812e5e6460SAlbert Schwarzkopf 	case TEE_ALG_HMAC_MD5:
1822e5e6460SAlbert Schwarzkopf 		return TEE_MD5_HASH_SIZE;
1832e5e6460SAlbert Schwarzkopf 	case TEE_ALG_SHA1:
1842e5e6460SAlbert Schwarzkopf 	case TEE_ALG_HMAC_SHA1:
1852e5e6460SAlbert Schwarzkopf 	case TEE_ALG_DSA_SHA1:
1862e5e6460SAlbert Schwarzkopf 		return TEE_SHA1_HASH_SIZE;
1872e5e6460SAlbert Schwarzkopf 	case TEE_ALG_SHA224:
1882e5e6460SAlbert Schwarzkopf 	case TEE_ALG_HMAC_SHA224:
1892e5e6460SAlbert Schwarzkopf 	case TEE_ALG_DSA_SHA224:
1902e5e6460SAlbert Schwarzkopf 		return TEE_SHA224_HASH_SIZE;
1912e5e6460SAlbert Schwarzkopf 	case TEE_ALG_SHA256:
1922e5e6460SAlbert Schwarzkopf 	case TEE_ALG_HMAC_SHA256:
1932e5e6460SAlbert Schwarzkopf 	case TEE_ALG_DSA_SHA256:
1942e5e6460SAlbert Schwarzkopf 		return TEE_SHA256_HASH_SIZE;
1952e5e6460SAlbert Schwarzkopf 	case TEE_ALG_SHA384:
1962e5e6460SAlbert Schwarzkopf 	case TEE_ALG_HMAC_SHA384:
1972e5e6460SAlbert Schwarzkopf 		return TEE_SHA384_HASH_SIZE;
1982e5e6460SAlbert Schwarzkopf 	case TEE_ALG_SHA512:
1992e5e6460SAlbert Schwarzkopf 	case TEE_ALG_HMAC_SHA512:
2002e5e6460SAlbert Schwarzkopf 		return TEE_SHA512_HASH_SIZE;
2012e5e6460SAlbert Schwarzkopf 	case TEE_ALG_SM3:
2022e5e6460SAlbert Schwarzkopf 	case TEE_ALG_HMAC_SM3:
2032e5e6460SAlbert Schwarzkopf 		return TEE_SM3_HASH_SIZE;
2042e5e6460SAlbert Schwarzkopf 	case TEE_ALG_AES_CBC_MAC_NOPAD:
2052e5e6460SAlbert Schwarzkopf 	case TEE_ALG_AES_CBC_MAC_PKCS5:
2062e5e6460SAlbert Schwarzkopf 	case TEE_ALG_AES_CMAC:
2072e5e6460SAlbert Schwarzkopf 		return TEE_AES_BLOCK_SIZE;
2082e5e6460SAlbert Schwarzkopf 	case TEE_ALG_DES_CBC_MAC_NOPAD:
2092e5e6460SAlbert Schwarzkopf 	case TEE_ALG_DES_CBC_MAC_PKCS5:
2102e5e6460SAlbert Schwarzkopf 	case TEE_ALG_DES3_CBC_MAC_NOPAD:
2112e5e6460SAlbert Schwarzkopf 	case TEE_ALG_DES3_CBC_MAC_PKCS5:
212eee637e7SAlexander Zakharov 	case TEE_ALG_DES3_CMAC:
2132e5e6460SAlbert Schwarzkopf 		return TEE_DES_BLOCK_SIZE;
2142e5e6460SAlbert Schwarzkopf 	default:
2152e5e6460SAlbert Schwarzkopf 		return 0;
2162e5e6460SAlbert Schwarzkopf 	}
2172e5e6460SAlbert Schwarzkopf }
2182e5e6460SAlbert Schwarzkopf 
2192e5e6460SAlbert Schwarzkopf 	/* Return algorithm digest size */
2202e5e6460SAlbert Schwarzkopf #define TEE_ALG_GET_DIGEST_SIZE(algo) __tee_alg_get_digest_size(algo)
2212e5e6460SAlbert Schwarzkopf 
222b0104773SPascal Brand /*
223b0104773SPascal Brand  * Bit indicating that the attribute is a value attribute
224b0104773SPascal Brand  * See TEE Internal API specificaion v1.0 table 6-12 "Partial Structure of
225b0104773SPascal Brand  * Attribute Identifier"
226b0104773SPascal Brand  */
227b0104773SPascal Brand 
22809d93d24SJens Wiklander 
22909d93d24SJens Wiklander #ifdef __compiler_bswap64
23009d93d24SJens Wiklander #define TEE_U64_BSWAP(x) __compiler_bswap64((x))
23109d93d24SJens Wiklander #else
23209d93d24SJens Wiklander #define TEE_U64_BSWAP(x) ((uint64_t)( \
23309d93d24SJens Wiklander         (((uint64_t)(x) & UINT64_C(0xff00000000000000ULL)) >> 56) | \
23409d93d24SJens Wiklander         (((uint64_t)(x) & UINT64_C(0x00ff000000000000ULL)) >> 40) | \
23509d93d24SJens Wiklander         (((uint64_t)(x) & UINT64_C(0x0000ff0000000000ULL)) >> 24) | \
23609d93d24SJens Wiklander         (((uint64_t)(x) & UINT64_C(0x000000ff00000000ULL)) >>  8) | \
23709d93d24SJens Wiklander         (((uint64_t)(x) & UINT64_C(0x00000000ff000000ULL)) <<  8) | \
23809d93d24SJens Wiklander         (((uint64_t)(x) & UINT64_C(0x0000000000ff0000ULL)) << 24) | \
23909d93d24SJens Wiklander         (((uint64_t)(x) & UINT64_C(0x000000000000ff00ULL)) << 40) | \
24009d93d24SJens Wiklander         (((uint64_t)(x) & UINT64_C(0x00000000000000ffULL)) << 56)))
24109d93d24SJens Wiklander #endif
24209d93d24SJens Wiklander 
24309d93d24SJens Wiklander #ifdef __compiler_bswap32
24409d93d24SJens Wiklander #define TEE_U32_BSWAP(x) __compiler_bswap32((x))
24509d93d24SJens Wiklander #else
24609d93d24SJens Wiklander #define TEE_U32_BSWAP(x) ((uint32_t)( \
24709d93d24SJens Wiklander         (((uint32_t)(x) & UINT32_C(0xff000000)) >> 24) | \
24809d93d24SJens Wiklander         (((uint32_t)(x) & UINT32_C(0x00ff0000)) >>  8) | \
24909d93d24SJens Wiklander         (((uint32_t)(x) & UINT32_C(0x0000ff00)) <<  8) | \
25009d93d24SJens Wiklander         (((uint32_t)(x) & UINT32_C(0x000000ff)) << 24)))
25109d93d24SJens Wiklander #endif
25209d93d24SJens Wiklander 
25309d93d24SJens Wiklander #ifdef __compiler_bswap16
25409d93d24SJens Wiklander #define TEE_U16_BSWAP(x) __compiler_bswap16((x))
25509d93d24SJens Wiklander #else
25609d93d24SJens Wiklander #define TEE_U16_BSWAP(x) ((uint16_t)( \
25709d93d24SJens Wiklander         (((uint16_t)(x) & UINT16_C(0xff00)) >> 8) | \
25809d93d24SJens Wiklander         (((uint16_t)(x) & UINT16_C(0x00ff)) << 8)))
25909d93d24SJens Wiklander #endif
260b0104773SPascal Brand 
261b0104773SPascal Brand /* If we we're on a big endian platform we'll have to update these */
26209d93d24SJens Wiklander #define TEE_U64_FROM_BIG_ENDIAN(x)  TEE_U64_BSWAP(x)
263b0104773SPascal Brand #define TEE_U32_FROM_BIG_ENDIAN(x)  TEE_U32_BSWAP(x)
264b0104773SPascal Brand #define TEE_U16_FROM_BIG_ENDIAN(x)  TEE_U16_BSWAP(x)
26509d93d24SJens Wiklander #define TEE_U64_TO_BIG_ENDIAN(x)    TEE_U64_BSWAP(x)
266b0104773SPascal Brand #define TEE_U32_TO_BIG_ENDIAN(x)    TEE_U32_BSWAP(x)
267b0104773SPascal Brand #define TEE_U16_TO_BIG_ENDIAN(x)    TEE_U16_BSWAP(x)
268b0104773SPascal Brand 
269b0104773SPascal Brand #define TEE_TIME_MILLIS_BASE    1000
270b0104773SPascal Brand 
271b0104773SPascal Brand #define TEE_TIME_LT(t1, t2)				\
272b0104773SPascal Brand     (((t1).seconds == (t2).seconds) ?			\
273b0104773SPascal Brand         ((t1).millis < (t2).millis) :			\
274b0104773SPascal Brand         ((t1).seconds < (t2).seconds))
275b0104773SPascal Brand 
276b0104773SPascal Brand #define TEE_TIME_LE(t1, t2)				\
277b0104773SPascal Brand     (((t1).seconds == (t2).seconds) ?			\
278b0104773SPascal Brand         ((t1).millis <= (t2).millis) :			\
279b0104773SPascal Brand         ((t1).seconds <= (t2).seconds))
280b0104773SPascal Brand 
281b0104773SPascal Brand #define TEE_TIME_ADD(t1, t2, dst) do {                      \
282b0104773SPascal Brand         (dst).seconds = (t1).seconds + (t2).seconds;        \
283b0104773SPascal Brand         (dst).millis = (t1).millis + (t2).millis;           \
284b0104773SPascal Brand         if ((dst).millis >= TEE_TIME_MILLIS_BASE) {         \
285b0104773SPascal Brand             (dst).seconds++;                                \
286b0104773SPascal Brand             (dst).millis -= TEE_TIME_MILLIS_BASE;           \
287b0104773SPascal Brand         }                                                   \
288b0104773SPascal Brand     } while (0)
289b0104773SPascal Brand 
290b0104773SPascal Brand #define TEE_TIME_SUB(t1, t2, dst) do {                      \
291b0104773SPascal Brand         (dst).seconds = (t1).seconds - (t2).seconds;        \
292b0104773SPascal Brand         if ((t1).millis < (t2).millis) {                    \
293b0104773SPascal Brand             (dst).seconds--;                                \
294b0104773SPascal Brand             (dst).millis = (t1).millis + TEE_TIME_MILLIS_BASE - (t2).millis;\
295b0104773SPascal Brand         } else {                                            \
296b0104773SPascal Brand             (dst).millis = (t1).millis - (t2).millis;       \
297b0104773SPascal Brand         }                                                   \
298b0104773SPascal Brand     } while (0)
299b0104773SPascal Brand 
300b0104773SPascal Brand /* ------------------------------------------------------------ */
301b0104773SPascal Brand /* OTP mapping                                                  */
302b0104773SPascal Brand /* ------------------------------------------------------------ */
303b0104773SPascal Brand #define HW_UNIQUE_KEY_WORD1      (8)
304b0104773SPascal Brand #define HW_UNIQUE_KEY_LENGTH     (16)
305b0104773SPascal Brand #define HW_UNIQUE_KEY_WORD2      (HW_UNIQUE_KEY_WORD1 + 1)
306b0104773SPascal Brand #define HW_UNIQUE_KEY_WORD3      (HW_UNIQUE_KEY_WORD1 + 2)
307b0104773SPascal Brand #define HW_UNIQUE_KEY_WORD4      (HW_UNIQUE_KEY_WORD1 + 3)
308b0104773SPascal Brand 
309e86f1266SJens Wiklander #define UTEE_SE_READER_PRESENT			(1 << 0)
310e86f1266SJens Wiklander #define UTEE_SE_READER_TEE_ONLY			(1 << 1)
311e86f1266SJens Wiklander #define UTEE_SE_READER_SELECT_RESPONE_ENABLE	(1 << 2)
312e86f1266SJens Wiklander 
313b0104773SPascal Brand #endif /* UTEE_DEFINES_H */
314