1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright (c) 2015, Linaro Limited
4  */
5 
6 #ifndef TEE_FS_KEY_MANAGER_H
7 #define TEE_FS_KEY_MANAGER_H
8 
9 #include <tee_api_types.h>
10 #include <utee_defines.h>
11 
12 #define TEE_FS_KM_CHIP_ID_LENGTH    U(32)
13 #define TEE_FS_KM_HMAC_ALG          TEE_ALG_HMAC_SHA256
14 #define TEE_FS_KM_ENC_FEK_ALG       TEE_ALG_AES_ECB_NOPAD
15 #define TEE_FS_KM_SSK_SIZE          TEE_SHA256_HASH_SIZE
16 #define TEE_FS_KM_TSK_SIZE          TEE_SHA256_HASH_SIZE
17 #define TEE_FS_KM_FEK_SIZE          U(16)  /* bytes */
18 
19 TEE_Result tee_fs_generate_fek(const TEE_UUID *uuid, void *encrypted_fek,
20 			       size_t fek_size);
21 TEE_Result tee_fs_crypt_block(const TEE_UUID *uuid, uint8_t *out,
22 			      const uint8_t *in, size_t size,
23 			      uint16_t blk_idx, const uint8_t *encrypted_fek,
24 			      TEE_OperationMode mode);
25 
26 TEE_Result tee_fs_fek_crypt(const TEE_UUID *uuid, TEE_OperationMode mode,
27 			    const uint8_t *in_key, size_t size,
28 			    uint8_t *out_key);
29 
30 #endif
31