1 /* SPDX-License-Identifier: BSD-2-Clause */ 2 /* 3 * Copyright (C) Foundries Ltd. 2021 4 * Author: Jorge Ramirez <jorge@foundries.io> 5 */ 6 7 #ifndef __DRIVERS_ZYNQMP_CSU_AES_H_ 8 #define __DRIVERS_ZYNQMP_CSU_AES_H_ 9 10 #include <drivers/zynqmp_csudma.h> 11 #include <types_ext.h> 12 #include <tee_api_types.h> 13 14 #define __aligned_csuaes __aligned_csudma 15 16 #define ZYNQMP_GCM_TAG_SIZE 16 17 #define ZYNQMP_GCM_IV_SIZE 12 18 19 enum zynqmp_csu_key { 20 ZYNQMP_CSU_AES_KEY_SRC_KUP = 0, 21 ZYNQMP_CSU_AES_KEY_SRC_DEV 22 }; 23 24 #define ZYNQMP_CSU_AES_DST_LEN(x) ((x) + ZYNQMP_GCM_TAG_SIZE) 25 26 TEE_Result zynqmp_csu_aes_encrypt_data(const void *src, size_t src_len, 27 void *dst, size_t dst_len, 28 void *tag, size_t tag_len, 29 const void *iv, size_t iv_len, 30 enum zynqmp_csu_key key); 31 32 TEE_Result zynqmp_csu_aes_decrypt_data(const void *src, size_t src_len, 33 void *dst, size_t len, 34 const void *tag, size_t tag_len, 35 const void *iv, size_t iv_len, 36 enum zynqmp_csu_key key); 37 38 TEE_Result zynqmp_csu_aes_dt_enable_secure_status(void); 39 40 #endif 41