Skip to content

Commit

Permalink
xtest: regression 1100: add OCALL tests
Browse files Browse the repository at this point in the history
Add 10 tests that check the behaviour of the OCALL functionality. The tests
in question are detailed below:

OCALL without parameters:
-------------------------
Performs an OCALL without any parameters.

OCALL with value parameters (in/inout/out/in):
----------------------------------------------
Performs an OCALL with value parameters and in parameter directions,
verifying that the values are transferred correctly between normal world
and secure world.

OCALL with memref parameters (in/inout/out/in):
-----------------------------------------------
Performs an OCALL with memref parameters and in parameter directions,
verifying that the bufers are transferred correctly between normal world
and secure world.

Close session during OCALL:
---------------------------
Performs an OCALL that closes the session through which the original
function invocation was performed. Ascertains that the OCALL is cancelled
and that the session is closed.

Finalize context during OCALL:
------------------------------
Performs an OCALL that finalizes the context through which the original
function invocation was performed. Ascertains that the OCALL is cancelled
and that the session that was originally used to perform the function
invocation is closed as a result of the context being finalized.

NULL memref param:
------------------
Verifies that OCALLs can carry memref parameters with NULL buffers in all
directions.

NULL memref param (mixed params):
---------------------------------
Verifies that OCALLs can carry memref parameters with NULL buffers
alongside value and non-NULL memref parameters in various directions.

NULL memref param (invalid params):
-----------------------------------
Verifies that attempting to perform an OCALL with memref parameters with a
NULL buffer and a non-zero size and with a non-NULL buffer and a zero size
fails at the Internal Core API layer.

OCALL during session open:
--------------------------
Ascertains that the CA can receive an OCALL during session open.

Finalize context during session open OCALL:
-------------------------------------------
Performs an OCALL during session open that finalizes the context via which
the session was being opened, verifies that the OCALL is cancelled, and
that the session fails to open.

Signed-off-by: Hernan Gatta <hegatta@microsoft.com>
  • Loading branch information
HernanGatta committed Jun 10, 2020
1 parent 3ef6bf9 commit 9811147
Show file tree
Hide file tree
Showing 16 changed files with 1,237 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ LOCAL_C_INCLUDES += $(LOCAL_PATH)/host/xtest \
$(LOCAL_PATH)/ta/aes_perf/include \
$(LOCAL_PATH)/ta/socket/include \
$(LOCAL_PATH)/ta/sdp_basic/include \
$(LOCAL_PATH)/ta/tpm_log_test/include
$(LOCAL_PATH)/ta/tpm_log_test/include \
$(LOCAL_PATH)/ta/ocall/include

# Include configuration file generated by OP-TEE OS (CFG_* macros)
LOCAL_CFLAGS += -I $(TA_DEV_KIT_DIR)/host_include -include conf.h
Expand Down
4 changes: 4 additions & 0 deletions host/xtest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ if (CFG_PKCS11_TA)
list (APPEND SRC pkcs11_1000.c)
endif()

if (CFG_OCALL)
list (APPEND SRC regression_1100.c)
endif()

################################################################################
# Built binary
################################################################################
Expand Down
6 changes: 6 additions & 0 deletions host/xtest/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ endif #OPTEE_OPENSSL_EXPORT
endif #require OpenSSL

srcs := regression_1000.c
srcs := regression_1100.c

ifeq ($(CFG_GP_SOCKETS),y)
srcs += regression_2000.c \
Expand Down Expand Up @@ -111,6 +112,10 @@ srcs += gp_7000.c \
gp_9000.c
endif

ifeq ($(CFG_OCALL),y)
srcs += regression_1100.c
endif

objs := $(patsubst %.c,$(out-dir)/xtest/%.o, $(srcs))

CFLAGS += -I./
Expand Down Expand Up @@ -138,6 +143,7 @@ CFLAGS += -I../../ta/aes_perf/include
CFLAGS += -I../../ta/socket/include
CFLAGS += -I../../ta/sdp_basic/include
CFLAGS += -I../../ta/tpm_log_test/include
CFLAGS += -I../../ta/ocall/include

ifdef CFG_GP_PACKAGE_PATH
CFLAGS += -I../../ta/GP_TTA_Arithmetical
Expand Down

0 comments on commit 9811147

Please sign in to comment.