driver: tee: Handle NULL pointer indication from client

TEE Client introduce a new capability "TEE_GEN_CAP_MEMREF_NULL"
to handle the support of the shared memory buffer with a NULL pointer.

This capability depends on TEE Capabilities and driver support.
Driver and TEE exchange capabilities at driver initialization.

Signed-off-by: Michael Whitfield <michael.whitfield@nxp.com>
Signed-off-by: Cedric Neveux <cedric.neveux@nxp.com>
Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
Tested-by: Joakim Bech <joakim.bech@linaro.org> (QEMU)
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
This commit is contained in:
Cedric Neveux
2019-03-04 08:54:23 +01:00
committed by Jens Wiklander
parent 9123e3a74e
commit ba171d3f08
5 changed files with 56 additions and 17 deletions

View File

@@ -51,6 +51,9 @@
#define TEE_GEN_CAP_GP (1 << 0)/* GlobalPlatform compliant TEE */
#define TEE_GEN_CAP_PRIVILEGED (1 << 1)/* Privileged device (for supplicant) */
#define TEE_GEN_CAP_REG_MEM (1 << 2)/* Supports registering shared memory */
#define TEE_GEN_CAP_MEMREF_NULL (1 << 3)/* NULL MemRef support */
#define TEE_MEMREF_NULL (__u64)(-1) /* NULL MemRef Buffer */
/*
* TEE Implementation ID
@@ -200,6 +203,16 @@ struct tee_ioctl_buf_data {
* a part of a shared memory by specifying an offset (@a) and size (@b) of
* the object. To supply the entire shared memory object set the offset
* (@a) to 0 and size (@b) to the previously returned size of the object.
*
* A client may need to present a NULL pointer in the argument
* passed to a trusted application in the TEE.
* This is also a requirement in GlobalPlatform Client API v1.0c
* (section 3.2.5 memory references), which can be found at
* http://www.globalplatform.org/specificationsdevice.asp
*
* If a NULL pointer is passed to a TA in the TEE, the (@c)
* IOCTL parameters value must be set to TEE_MEMREF_NULL indicating a NULL
* memory reference.
*/
struct tee_ioctl_param {
__u64 attr;