1 /* 2 * Copyright (c) 2001-2019, Arm Limited and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 8 9 #ifndef _CC_PAL_BUFF_ATTR_H 10 #define _CC_PAL_BUFF_ATTR_H 11 12 /*! 13 @file 14 @brief This file contains the definitions and APIs to get inout data buffer attributes. 15 This is a place holder for platform specific inout data attributes functions implementation 16 The module should be updated whether data buffer is secure or non-secure, 17 in order to notify the low level driver how to configure the HW accordigly. 18 @defgroup cc_pal_buff_attr CryptoCell PAL Data Buffer Attributes APIs 19 @{ 20 @ingroup cc_pal 21 22 */ 23 24 #ifdef __cplusplus 25 extern "C" 26 { 27 #endif 28 29 #include "cc_pal_types.h" 30 31 /****************************************************************************** 32 * Buffer Information 33 ******************************************************************************/ 34 35 /*! User buffer attribute (secure / non-secure). */ 36 #define DATA_BUFFER_IS_NONSECURE 1 37 #define DATA_BUFFER_IS_SECURE 0 38 /*! Buffer attribute (secure / non-secure) as used by arm_cmse.h . */ 39 #define CMSE_NONSECURE 0 40 #define CMSE_SECURE 1 41 42 /****************************************************************************** 43 * Functions 44 ******************************************************************************/ 45 46 /** 47 * @brief This function purpose is to verify the buffer's attributes according to address, size, and type (in/out). 48 * The function returns whether the buffer is secure or non-secure. 49 * In any case of invalid memory, the function shall return an error (i.e.mixed regions of secured and non-secure memory). 50 * 51 * @return Zero on success. 52 * @return A non-zero value in case of failure. 53 */ 54 CCError_t CC_PalDataBufferAttrGet(const unsigned char *pDataBuffer, /*!< [in] Address of data buffer. */ 55 size_t buffSize, /*!< [in] Buffer size in bytes. */ 56 uint8_t buffType, /* ! [in] Input for read / output for write */ 57 uint8_t *pBuffNs /*!< [out] HNONSEC buffer attribute (0 for secure, 1 for non-secure) */ 58 ); 59 60 #ifdef __cplusplus 61 } 62 #endif 63 /** 64 @} 65 */ 66 #endif 67 68 69