summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorarthur-trustonic <arthur.cassegrain@trustonic.com>2015-11-30 17:00:15 +0100
committerAndreas Schneider <asn@cryptomilk.org>2017-02-12 19:49:36 +0100
commit9f7e96a70478d3e607b8e10128d6e73356244ba1 (patch)
tree1f282f3c221075bdfe34b2d7c5da6ef77db2c72a
parentcd93ec98b043012ca0e2e18fc2211300bca0e0c0 (diff)
downloadandroid_hardware_samsung_slsi_exynos5430-9f7e96a70478d3e607b8e10128d6e73356244ba1.tar.gz
android_hardware_samsung_slsi_exynos5430-9f7e96a70478d3e607b8e10128d6e73356244ba1.tar.xz
android_hardware_samsung_slsi_exynos5430-9f7e96a70478d3e607b8e10128d6e73356244ba1.zip
[301C] Align Code with 301C-V001
rel_t-base-301C_qc@26129
-rw-r--r--[-rwxr-xr-x]include/gralloc_priv.h0
-rw-r--r--mobicore/Android.mk33
-rw-r--r--mobicore/MobiCoreDriverLib/Android.mk195
-rw-r--r--mobicore/MobiCoreDriverLib/Application.mk7
-rw-r--r--mobicore/MobiCoreDriverLib/CleanSpec.mk (renamed from MobiCoreDriverLib/CleanSpec.mk)0
-rw-r--r--mobicore/MobiCoreDriverLib/ClientLib/ClientLib.cpp515
-rw-r--r--mobicore/MobiCoreDriverLib/ClientLib/ClientLib.h373
-rw-r--r--mobicore/MobiCoreDriverLib/ClientLib/Contrib/common_client.cpp254
-rw-r--r--mobicore/MobiCoreDriverLib/ClientLib/Contrib/common_client.h76
-rw-r--r--mobicore/MobiCoreDriverLib/ClientLib/Contrib/driver_client.h61
-rw-r--r--mobicore/MobiCoreDriverLib/ClientLib/Contrib/iclient.h62
-rw-r--r--mobicore/MobiCoreDriverLib/ClientLib/Contrib/mc_client_api.cpp784
-rw-r--r--mobicore/MobiCoreDriverLib/ClientLib/Contrib/mc_user.h178
-rw-r--r--mobicore/MobiCoreDriverLib/ClientLib/Contrib/proxy_client.cpp820
-rw-r--r--mobicore/MobiCoreDriverLib/ClientLib/Contrib/proxy_client.h61
-rw-r--r--mobicore/MobiCoreDriverLib/ClientLib/Contrib/proxy_common.h354
-rw-r--r--mobicore/MobiCoreDriverLib/ClientLib/Contrib/proxy_server.cpp903
-rw-r--r--mobicore/MobiCoreDriverLib/ClientLib/Contrib/tee_client_api.cpp969
-rw-r--r--mobicore/MobiCoreDriverLib/ClientLib/Device.cpp3
-rw-r--r--mobicore/MobiCoreDriverLib/ClientLib/Device.h28
-rw-r--r--mobicore/MobiCoreDriverLib/ClientLib/GP/tee_client_api.cpp849
-rw-r--r--mobicore/MobiCoreDriverLib/ClientLib/Session.h1
-rw-r--r--mobicore/MobiCoreDriverLib/ClientLib/driver_client.cpp400
-rw-r--r--mobicore/MobiCoreDriverLib/ClientLib/mc.pb.cpp5695
-rw-r--r--mobicore/MobiCoreDriverLib/ClientLib/mc.pb.h4365
-rw-r--r--mobicore/MobiCoreDriverLib/ClientLib/public/GP/tee_client_api.h10
-rw-r--r--mobicore/MobiCoreDriverLib/ClientLib/public/GP/tee_client_api_imp.h21
-rw-r--r--mobicore/MobiCoreDriverLib/ClientLib/public/GP/tee_type.h66
-rw-r--r--mobicore/MobiCoreDriverLib/ClientLib/public/proxy_server.h46
-rw-r--r--mobicore/MobiCoreDriverLib/Common/CThread.cpp27
-rw-r--r--mobicore/MobiCoreDriverLib/Common/CThread.h9
-rw-r--r--mobicore/MobiCoreDriverLib/Common/Connection.cpp27
-rw-r--r--mobicore/MobiCoreDriverLib/Common/Connection.h4
-rw-r--r--mobicore/MobiCoreDriverLib/Common/NetlinkConnection.cpp4
-rw-r--r--mobicore/MobiCoreDriverLib/Common/NetlinkConnection.h4
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/Device/DeviceIrqHandler.cpp4
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/Device/DeviceScheduler.cpp4
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/Device/MobiCoreDevice.cpp151
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/Device/Platforms/Android.mk4
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/Device/Platforms/Generic/TrustZoneDevice.cpp37
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/Device/TAExitHandler.cpp4
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/Device/public/MobiCoreDevice.h2
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/FSD/FSD.cpp5
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/MobiCoreDriverDaemon.cpp340
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/MobiCoreDriverDaemon.h31
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/Server/Client.h112
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/Server/NetlinkServer.cpp16
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/Server/Queue.h69
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/Server/Server.cpp194
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/Server/public/ConnectionHandler.h19
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/Server/public/NetlinkServer.h21
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/Server/public/Server.h25
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/public/MobiCoreDriverCmd.h2
-rw-r--r--mobicore/MobiCoreDriverLib/Kernel/Platforms/Generic/CMcKMod.cpp37
-rw-r--r--mobicore/MobiCoreDriverLib/MODULE_LICENSE_BSD (renamed from MobiCoreDriverLib/MODULE_LICENSE_BSD)0
-rw-r--r--mobicore/MobiCoreDriverLib/Registry/PrivateRegistry.cpp6
-rw-r--r--mobicore/MobiCoreDriverLib/Registry/Registry.cpp2
-rw-r--r--mobicore/MobiCoreDriverLib/buildTag.h4
-rw-r--r--mobicore/common/LogWrapper/Android.mk2
-rw-r--r--mobicore/common/MobiCore/inc/McLib/GpTci.h9
-rw-r--r--mobicore/common/MobiCore/inc/TlCm/2.0/cmp.h181
-rw-r--r--mobicore/common/MobiCore/inc/TlCm/2.0/tlCmApi.h57
-rw-r--r--mobicore/common/MobiCore/inc/TlCm/3.0/cmp.h221
-rw-r--r--mobicore/common/MobiCore/inc/TlCm/3.0/cmpMap.h201
-rw-r--r--mobicore/common/MobiCore/inc/TlCm/3.0/tlCmApi.h63
-rw-r--r--mobicore/common/MobiCore/inc/TlCm/cmpCommon.h146
-rw-r--r--mobicore/common/MobiCore/inc/TlCm/tlCmApiCommon.h62
-rw-r--r--mobicore/common/MobiCore/inc/TlCm/tlCmError.h57
-rw-r--r--mobicore/common/MobiCore/inc/TlCm/tlCmUuid.h53
-rw-r--r--mobicore/common/MobiCore/inc/TlCm/version.h53
-rw-r--r--mobicore/rootpa/Android.mk7
-rw-r--r--mobicore/rootpa/Code/Android/app/Android.mk3
-rw-r--r--mobicore/rootpa/Code/Android/app/jni/Android.mk1
-rw-r--r--mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/Android.mk7
-rw-r--r--mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/CmpBase.cpp70
-rw-r--r--mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/CmpBase.h62
-rw-r--r--mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/CmpCommands.cpp82
-rw-r--r--mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/CmpCommands.h62
-rw-r--r--mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/CmpResponses.cpp86
-rw-r--r--mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/CmpResponses.h62
-rw-r--r--mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/JniHelpers.cpp130
-rw-r--r--mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/JniHelpers.h62
-rw-r--r--mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/com_gd_mobicore_pa_jni_CommonPAWrapper.h58
-rw-r--r--mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/commonwrapper.cpp236
-rw-r--r--mobicore/rootpa/Code/Android/app/jni/McStub/Android.mk2
-rw-r--r--mobicore/rootpa/Code/Android/app/src/com/gd/mobicore/pa/jni/CommonPAWrapper.java90
-rw-r--r--mobicore/rootpa/Code/Android/app/src/com/gd/mobicore/pa/service/BaseService.java167
-rw-r--r--mobicore/rootpa/Code/Android/app/src/com/gd/mobicore/pa/service/DeveloperService.java146
-rw-r--r--mobicore/rootpa/Code/Android/app/src/com/gd/mobicore/pa/service/Log.java98
-rw-r--r--mobicore/rootpa/Code/Android/app/src/com/gd/mobicore/pa/service/OemService.java92
-rw-r--r--mobicore/rootpa/Code/Android/app/src/com/gd/mobicore/pa/service/ProvisioningService.java206
-rw-r--r--mobicore/rootpa/Code/Android/lib/Android.mk1
-rw-r--r--mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/AbstractEnumParcel.java58
-rw-r--r--mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/BooleanResult.aidl58
-rw-r--r--mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/BooleanResult.java58
-rw-r--r--mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/CmpCommand.aidl58
-rw-r--r--mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/CmpCommand.java82
-rw-r--r--mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/CmpMsg.java106
-rw-r--r--mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/CmpResponse.aidl58
-rw-r--r--mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/CmpResponse.java82
-rw-r--r--mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/CommandResult.aidl58
-rw-r--r--mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/CommandResult.java130
-rw-r--r--mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/IfcVersion.java58
-rw-r--r--mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/RootPADeveloperIfc.aidl148
-rw-r--r--mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/RootPAOemIfc.aidl68
-rw-r--r--mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/RootPAProvisioningIntents.java72
-rw-r--r--mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/RootPAServiceIfc.aidl90
-rw-r--r--mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SPContainerState.java58
-rw-r--r--mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SPContainerStateParcel.aidl58
-rw-r--r--mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SPContainerStateParcel.java58
-rw-r--r--mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SPContainerStructure.aidl58
-rw-r--r--mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SPContainerStructure.java58
-rw-r--r--mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SPID.aidl58
-rw-r--r--mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SPID.java58
-rw-r--r--mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SUID.aidl58
-rw-r--r--mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SUID.java58
-rw-r--r--mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/TrustletContainer.aidl58
-rw-r--r--mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/TrustletContainer.java58
-rw-r--r--mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/TrustletContainerState.java58
-rw-r--r--mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/TrustletContainerStateParcel.aidl58
-rw-r--r--mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/TrustletContainerStateParcel.java58
-rw-r--r--mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/Version.aidl58
-rw-r--r--mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/Version.java60
-rw-r--r--mobicore/rootpa/Code/CMakeLists.txt43
-rw-r--r--mobicore/rootpa/Code/Common/Android.mk11
-rw-r--r--mobicore/rootpa/Code/Common/base64.c108
-rw-r--r--mobicore/rootpa/Code/Common/base64.h58
-rw-r--r--mobicore/rootpa/Code/Common/cacerts.h115
-rw-r--r--mobicore/rootpa/Code/Common/commandhandler.c177
-rw-r--r--mobicore/rootpa/Code/Common/contentmanager.c94
-rw-r--r--mobicore/rootpa/Code/Common/contentmanager.h58
-rw-r--r--mobicore/rootpa/Code/Common/enrollmentservicexmlschema.h58
-rw-r--r--mobicore/rootpa/Code/Common/include/logging.h85
-rw-r--r--mobicore/rootpa/Code/Common/include/provisioningagent.h144
-rw-r--r--mobicore/rootpa/Code/Common/include/rootpa.h102
-rw-r--r--mobicore/rootpa/Code/Common/include/rootpaErrors.h86
-rw-r--r--mobicore/rootpa/Code/Common/include/version.h60
-rw-r--r--mobicore/rootpa/Code/Common/include/wrapper.h30
-rw-r--r--mobicore/rootpa/Code/Common/pacmp3.c190
-rw-r--r--mobicore/rootpa/Code/Common/pacmp3.h62
-rw-r--r--mobicore/rootpa/Code/Common/pacmtl.c168
-rw-r--r--mobicore/rootpa/Code/Common/pacmtl.h58
-rw-r--r--mobicore/rootpa/Code/Common/provisioningengine.c179
-rw-r--r--mobicore/rootpa/Code/Common/provisioningengine.h58
-rw-r--r--mobicore/rootpa/Code/Common/registry.c73
-rw-r--r--mobicore/rootpa/Code/Common/registry.h58
-rw-r--r--mobicore/rootpa/Code/Common/seclient.c348
-rw-r--r--mobicore/rootpa/Code/Common/seclient.h62
-rw-r--r--mobicore/rootpa/Code/Common/tools.h70
-rw-r--r--mobicore/rootpa/Code/Common/trustletchannel.c98
-rw-r--r--mobicore/rootpa/Code/Common/trustletchannel.h60
-rw-r--r--mobicore/rootpa/Code/Common/xmlmessagehandler.c424
-rw-r--r--mobicore/rootpa/Code/Common/xmlmessagehandler.h84
-rw-r--r--mobicore/tlcm/Android.mk12
154 files changed, 20896 insertions, 5579 deletions
diff --git a/include/gralloc_priv.h b/include/gralloc_priv.h
index 197fbbc..197fbbc 100755..100644
--- a/include/gralloc_priv.h
+++ b/include/gralloc_priv.h
diff --git a/mobicore/Android.mk b/mobicore/Android.mk
index 85fb67c..53f4332 100644
--- a/mobicore/Android.mk
+++ b/mobicore/Android.mk
@@ -3,21 +3,31 @@
# Makefile pointing to all makefiles within the project.
#
# =============================================================================
+
+# Only compile proxy support for Android M (use stlport absence as indicator)
+use_proxy =
+ifeq ($(wildcard external/stlport/libstlport.mk),)
+ use_proxy = yes
+endif
+
MOBICORE_PROJECT_PATH := $(call my-dir)
# Setup common variables
-LOG_WRAPPER := $(MOBICORE_PROJECT_PATH)/common/LogWrapper
+COMP_PATH_Logwrapper := $(MOBICORE_PROJECT_PATH)/common/LogWrapper
COMP_PATH_MobiCore := $(MOBICORE_PROJECT_PATH)/common/MobiCore
COMP_PATH_MobiCoreDriverMod := $(MOBICORE_PROJECT_PATH)/include
-
+COMP_PATH_AndroidOpenSsl := $(MOBICORE_PROJECT_PATH)/../openssl
# Application wide Cflags
GLOBAL_INCLUDES := bionic \
external/stlport/stlport \
$(COMP_PATH_MobiCore)/inc \
+ $(COMP_PATH_MobiCore)/inc/McLib \
$(COMP_PATH_MobiCoreDriverMod)/Public \
$(COMP_PATH_MobiCore)/inc/TlCm
+ifndef use_proxy
GLOBAL_LIBRARIES := libstlport
+endif
# Include the Daemon
include $(MOBICORE_PROJECT_PATH)/MobiCoreDriverLib/Android.mk
@@ -31,8 +41,25 @@ MC_DEBUG := _DEBUG
SYSTEM_LIB_DIR=/system/lib
GDM_PROVLIB_SHARED_LIBS=libMcClient
-MOBICORE_DIR_INC := $(MC_INCLUDE_DIR)
+
+MOBICORE_DIR_INC := $(MC_INCLUDE_DIR) $(MOBICORE_PROJECT_PATH)/common/curl/include
+ifeq ($(wildcard external/curl/Android.mk),)
+include $(MOBICORE_PROJECT_PATH)/common/curl/Android.mk
+endif
+include $(MOBICORE_PROJECT_PATH)/tlcm/Android.mk
include $(MOBICORE_PROJECT_PATH)/rootpa/Code/Common/Android.mk
include $(MOBICORE_PROJECT_PATH)/rootpa/Code/Android/app/jni/Android.mk
include $(MOBICORE_PROJECT_PATH)/rootpa/Code/Android/lib/Android.mk
include $(MOBICORE_PROJECT_PATH)/rootpa/Code/Android/app/Android.mk
+
+# Include the TuiService
+ifneq ($(wildcard $(MOBICORE_PROJECT_PATH)/TuiService/Android.mk),)
+include $(MOBICORE_PROJECT_PATH)/TuiService/Android.mk
+include $(MOBICORE_PROJECT_PATH)/TuiService/jni/Android.mk
+endif
+
+# Include TlcTeeKeymaster
+ifneq ($(wildcard $(MOBICORE_PROJECT_PATH)/TlcTeeKeymaster/Android.mk),)
+include $(MOBICORE_PROJECT_PATH)/TlcTeeKeymaster/Android.mk
+endif
+
diff --git a/mobicore/MobiCoreDriverLib/Android.mk b/mobicore/MobiCoreDriverLib/Android.mk
index ec78785..5bfbc98 100644
--- a/mobicore/MobiCoreDriverLib/Android.mk
+++ b/mobicore/MobiCoreDriverLib/Android.mk
@@ -6,6 +6,12 @@
LOCAL_PATH := $(call my-dir)
+# Only compile proxy support for Android M (use stlport absence as indicator)
+use_proxy =
+ifeq ($(wildcard external/stlport/libstlport.mk),)
+ use_proxy = yes
+endif
+
# Client Library
# =============================================================================
include $(CLEAR_VARS)
@@ -17,36 +23,108 @@ LOCAL_SHARED_LIBRARIES += $(GLOBAL_LIBRARIES)
LOCAL_CFLAGS := -fvisibility=hidden -fvisibility-inlines-hidden
LOCAL_CFLAGS += -include buildTag.h
LOCAL_CFLAGS += -DLOG_TAG=\"McClient\"
-LOCAL_CFLAGS += -DTBASE_API_LEVEL=3
-
-# Add new source files here
+LOCAL_CFLAGS += -DTBASE_API_LEVEL=5
+LOCAL_CFLAGS += -std=c++11
+ifdef use_proxy
+LOCAL_CFLAGS += -DGOOGLE_PROTOBUF_NO_RTTI
+else # use_proxy
+LOCAL_CFLAGS += -DWITHOUT_PROXY
+endif # !use_proxy
+LOCAL_CFLAGS += -DLOG_D=LOG_I
+
+LOCAL_SRC_FILES := \
+ ClientLib/Device.cpp \
+ ClientLib/ClientLib.cpp \
+ ClientLib/Session.cpp \
+ ClientLib/driver_client.cpp \
+ Common/CMutex.cpp \
+ Common/Connection.cpp \
+ ClientLib/Contrib/common_client.cpp \
+ ClientLib/Contrib/mc_client_api.cpp \
+ ClientLib/Contrib/tee_client_api.cpp
+
+ifdef use_proxy
LOCAL_SRC_FILES += \
- ClientLib/Device.cpp \
- ClientLib/ClientLib.cpp \
- ClientLib/Session.cpp \
- Common/CMutex.cpp \
- Common/Connection.cpp \
- ClientLib/GP/tee_client_api.cpp
-
-LOCAL_C_INCLUDES +=\
- $(LOCAL_PATH)/Common \
- $(LOCAL_PATH)/ClientLib/public \
- $(LOCAL_PATH)/ClientLib/public/GP \
- $(MOBICORE_PROJECT_PATH)/include/GPD_TEE_Internal_API \
- $(MOBICORE_PROJECT_PATH)/include/public \
- $(COMP_PATH_MobiCore)/inc \
- $(COMP_PATH_MobiCore)/inc/McLib
-
-LOCAL_EXPORT_C_INCLUDE_DIRS +=\
- $(COMP_PATH_MobiCore)/inc \
- $(LOCAL_PATH)/ClientLib/public
+ ClientLib/Contrib/proxy_client.cpp \
+ ClientLib/mc.pb.cpp
+endif # use_proxy
+
+LOCAL_C_INCLUDES += \
+ $(LOCAL_PATH)/Common \
+ $(LOCAL_PATH)/ClientLib \
+ $(LOCAL_PATH)/ClientLib/Contrib \
+ $(LOCAL_PATH)/ClientLib/public \
+ $(LOCAL_PATH)/ClientLib/public/GP \
+ $(MOBICORE_PROJECT_PATH)/include/GPD_TEE_Internal_API \
+ $(MOBICORE_PROJECT_PATH)/include/public \
+ $(COMP_PATH_MobiCore)/inc \
+ $(COMP_PATH_MobiCore)/inc/McLib
+
+ifdef use_proxy
+LOCAL_C_INCLUDES += \
+ external/protobuf/src
+
+LOCAL_SHARED_LIBRARIES += \
+ libprotobuf-cpp-lite
+endif # use_proxy
+
+LOCAL_EXPORT_C_INCLUDE_DIRS += \
+ $(COMP_PATH_MobiCore)/inc \
+ $(LOCAL_PATH)/ClientLib/public
include $(LOCAL_PATH)/Kernel/Android.mk
# Import logwrapper
-include $(LOG_WRAPPER)/Android.mk
+include $(COMP_PATH_Logwrapper)/Android.mk
include $(BUILD_SHARED_LIBRARY)
+ifdef use_proxy
+
+# Proxy server lib
+# =============================================================================
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libMcProxy
+LOCAL_MODULE_TAGS := eng
+
+LOCAL_CFLAGS := -fvisibility=hidden
+LOCAL_CFLAGS += -DLOG_TAG=\"McProxy\"
+LOCAL_CFLAGS += -DTBASE_API_LEVEL=5
+LOCAL_CFLAGS += -Wall -Wextra
+LOCAL_CFLAGS += -std=c++11
+LOCAL_CFLAGS += -DLOG_ANDROID
+LOCAL_CFLAGS += -DGOOGLE_PROTOBUF_NO_RTTI
+LOCAL_CFLAGS += -DLOG_D=LOG_I
+
+LOCAL_C_INCLUDES := $(GLOBAL_INCLUDES) \
+ $(LOCAL_PATH)/Common \
+ $(LOCAL_PATH)/ClientLib \
+ $(LOCAL_PATH)/ClientLib/Contrib \
+ $(LOCAL_PATH)/ClientLib/public \
+ $(LOCAL_PATH)/ClientLib/public/GP \
+ $(COMP_PATH_MobiCore_Src_Code)/McLib/public \
+ external/protobuf/src
+
+LOCAL_SHARED_LIBRARIES += \
+ libprotobuf-cpp-lite
+
+LOCAL_SRC_FILES := \
+ ClientLib/driver_client.cpp \
+ ClientLib/mc.pb.cpp \
+ ClientLib/Contrib/proxy_server.cpp
+
+LOCAL_EXPORT_CFLAGS := -DLOG_ANDROID
+LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_EXPORT_C_INCLUDES)
+
+include $(LOCAL_PATH)/Kernel/Android.mk
+# Import logwrapper
+include $(COMP_PATH_Logwrapper)/Android.mk
+
+include $(BUILD_STATIC_LIBRARY)
+
+endif # use_proxy
+
# Daemon Application
# =============================================================================
include $(CLEAR_VARS)
@@ -56,38 +134,51 @@ LOCAL_MODULE_TAGS := debug eng optional
LOCAL_CFLAGS += -include buildTag.h
LOCAL_CFLAGS += -DLOG_TAG=\"McDaemon\"
LOCAL_CFLAGS += -DTBASE_API_LEVEL=3
+ifndef use_proxy
+LOCAL_CFLAGS += -DWITHOUT_PROXY
+endif
+
LOCAL_C_INCLUDES += $(GLOBAL_INCLUDES)
-LOCAL_SHARED_LIBRARIES += $(GLOBAL_LIBRARIES) libMcClient
+LOCAL_SHARED_LIBRARIES += $(GLOBAL_LIBRARIES) libMcClient libMcRegistry
+
+ifdef use_proxy
+LOCAL_STATIC_LIBRARIES := \
+ libMcProxy
+
+LOCAL_SHARED_LIBRARIES += \
+ libprotobuf-cpp-lite
+endif # use_proxy
include $(LOCAL_PATH)/Daemon/Android.mk
# Common Source files required for building the daemon
-LOCAL_SRC_FILES += Common/CMutex.cpp \
- Common/Connection.cpp \
- Common/NetlinkConnection.cpp \
- Common/CSemaphore.cpp \
- Common/CThread.cpp
+LOCAL_SRC_FILES += \
+ Common/CMutex.cpp \
+ Common/Connection.cpp \
+ Common/NetlinkConnection.cpp \
+ Common/CSemaphore.cpp \
+ Common/CThread.cpp \
+ Registry/PrivateRegistry.cpp
# Includes required for the Daemon
-LOCAL_C_INCLUDES +=\
- $(LOCAL_PATH)/Common \
- $(LOCAL_PATH)/common/MobiCore/inc \
- $(LOCAL_PATH)/ClientLib/public \
- $(LOCAL_PATH)/ClientLib/public/GP \
- $(MOBICORE_PROJECT_PATH)/include/public \
- $(COMP_PATH_MobiCore)/inc \
- $(COMP_PATH_MobiCore)/inc/McLib
+LOCAL_C_INCLUDES += \
+ $(LOCAL_PATH)/Common \
+ $(LOCAL_PATH)/common/MobiCore/inc \
+ $(LOCAL_PATH)/ClientLib/public \
+ $(LOCAL_PATH)/ClientLib/public/GP \
+ $(MOBICORE_PROJECT_PATH)/include/public \
+ $(COMP_PATH_MobiCore)/inc \
+ $(COMP_PATH_MobiCore)/inc/McLib
# Private Registry components
-LOCAL_C_INCLUDES += $(LOCAL_PATH)/Registry/Public \
- $(LOCAL_PATH)/Registry
-
-LOCAL_SRC_FILES += Registry/PrivateRegistry.cpp
+LOCAL_C_INCLUDES += \
+ $(LOCAL_PATH)/Registry/Public \
+ $(LOCAL_PATH)/Registry
# Common components
include $(LOCAL_PATH)/Kernel/Android.mk
# Logwrapper
-include $(LOG_WRAPPER)/Android.mk
+include $(COMP_PATH_Logwrapper)/Android.mk
include $(BUILD_EXECUTABLE)
@@ -97,24 +188,24 @@ include $(CLEAR_VARS)
LOCAL_MODULE := libMcRegistry
LOCAL_MODULE_TAGS := debug eng optional
-LOCAL_CFLAGS += -DLOG_TAG=\"McRegistry\"
+LOCAL_CFLAGS := -DLOG_TAG=\"McRegistry\"
LOCAL_C_INCLUDES += $(GLOBAL_INCLUDES)
LOCAL_SHARED_LIBRARIES += $(GLOBAL_LIBRARIES)
-LOCAL_C_INCLUDES += $(LOCAL_PATH)/Common \
- $(LOCAL_PATH)/Daemon/public \
- $(LOCAL_PATH)/ClientLib/public
+LOCAL_C_INCLUDES += \
+ $(LOCAL_PATH)/Common \
+ $(LOCAL_PATH)/Daemon/public \
+ $(LOCAL_PATH)/ClientLib/public
# Common Source files required for building the daemon
-LOCAL_SRC_FILES += Common/CMutex.cpp \
- Common/Connection.cpp \
- Common/CSemaphore.cpp
-
-#LOCAL_LDLIBS := -lthread_db
+LOCAL_SRC_FILES += \
+ Common/CMutex.cpp \
+ Common/Connection.cpp \
+ Common/CSemaphore.cpp
include $(LOCAL_PATH)/Registry/Android.mk
# Import logwrapper
-include $(LOG_WRAPPER)/Android.mk
+include $(COMP_PATH_Logwrapper)/Android.mk
include $(BUILD_SHARED_LIBRARY)
diff --git a/mobicore/MobiCoreDriverLib/Application.mk b/mobicore/MobiCoreDriverLib/Application.mk
index fddc817..54e6e00 100644
--- a/mobicore/MobiCoreDriverLib/Application.mk
+++ b/mobicore/MobiCoreDriverLib/Application.mk
@@ -7,7 +7,9 @@
# Don't remove this - mandatory
APP_PROJECT_PATH := $(abspath $(call my-dir))
-APP_STL := stlport_static
+APP_STL := gnustl_static
+
+NDK_TOOLCHAIN_VERSION := 4.8
# Don't optimize for better debugging
APP_OPTIM := debug
@@ -29,3 +31,6 @@ APP_PLATFORM := android-9
# Position Independent Executable
APP_PIE := true
+
+# Force compilation of proxy server
+APP_MODULES := libMcClient libMcRegistry mcDriverDaemon
diff --git a/MobiCoreDriverLib/CleanSpec.mk b/mobicore/MobiCoreDriverLib/CleanSpec.mk
index 7dd6f6c..7dd6f6c 100644
--- a/MobiCoreDriverLib/CleanSpec.mk
+++ b/mobicore/MobiCoreDriverLib/CleanSpec.mk
diff --git a/mobicore/MobiCoreDriverLib/ClientLib/ClientLib.cpp b/mobicore/MobiCoreDriverLib/ClientLib/ClientLib.cpp
index e7f4aae..8e7a2af 100644
--- a/mobicore/MobiCoreDriverLib/ClientLib/ClientLib.cpp
+++ b/mobicore/MobiCoreDriverLib/ClientLib/ClientLib.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2014 TRUSTONIC LIMITED
+ * Copyright (c) 2013-2015 TRUSTONIC LIMITED
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -58,6 +58,8 @@
#include "Mci/mcimcp.h"
+#include "ClientLib.h"
+
MC_CHECK_VERSION(DAEMON, 0, 2);
/** Notification data structure. */
@@ -66,83 +68,29 @@ typedef struct {
int32_t payload; /**< Additional notification information. */
} notification_t;
-using namespace std;
-
-static list<Device *> devices;
-
-// Forward declarations.
-uint32_t getDaemonVersion(Connection *devCon, uint32_t *version);
-
-static CMutex devMutex;
-//------------------------------------------------------------------------------
-Device *resolveDeviceId(uint32_t deviceId)
-{
- for (list<Device *>::iterator iterator = devices.begin();
- iterator != devices.end();
- ++iterator) {
- Device *device = (*iterator);
-
- if (device->deviceId == deviceId) {
- return device;
- }
- }
- return NULL;
-}
-
-
-//------------------------------------------------------------------------------
-void addDevice(Device *device)
-{
- devices.push_back(device);
-}
-
-
-//------------------------------------------------------------------------------
-bool removeDevice(uint32_t deviceId)
-{
- for (list<Device *>::iterator iterator = devices.begin();
- iterator != devices.end();
- ++iterator) {
- Device *device = (*iterator);
-
- if (device->deviceId == deviceId) {
- devices.erase(iterator);
- delete device;
- return true;
- }
- }
- return false;
-}
+#ifndef WIN32
+// Forward declaration
+static uint32_t getDaemonVersion(Connection *devCon, uint32_t *version);
+#endif
//------------------------------------------------------------------------------
// Parameter checking functions
// Note that android-ndk renames __func__ to __PRETTY_FUNCTION__
// see also /prebuilt/ndk/android-ndk-r4/platforms/android-8/arch-arm/usr/include/sys/cdefs.h
-#define CHECK_DEVICE(device) \
- if (NULL == device) \
+#define CHECK_NOT_NULL(X) \
+ if (NULL == X) \
{ \
- LOG_E("Device has not been found"); \
- mcResult = MC_DRV_ERR_UNKNOWN_DEVICE; \
+ LOG_E("Parameter \""#X "\" is NULL"); \
+ mcResult = MC_DRV_ERR_NULL_POINTER; \
break; \
}
-#define CHECK_DEVICE_CLOSED(device, deviceId) \
- if (NULL == device && MC_DEVICE_ID_DEFAULT == deviceId) \
- { \
- LOG_E("Device not open"); \
- mcResult = MC_DRV_ERR_DAEMON_DEVICE_NOT_OPEN; \
- break; \
- } else \
- CHECK_DEVICE(device);
-
-
-
-#define CHECK_NOT_NULL(X) \
+#define CHECK_DEVICE(X) \
if (NULL == X) \
{ \
LOG_E("Parameter \""#X "\" is NULL"); \
- mcResult = MC_DRV_ERR_NULL_POINTER; \
+ mcResult = MC_DRV_ERR_DAEMON_DEVICE_NOT_OPEN; \
break; \
}
@@ -189,25 +137,14 @@ bool removeDevice(uint32_t deviceId)
#endif /* WIN32 */
//------------------------------------------------------------------------------
-__MC_CLIENT_LIB_API mcResult_t mcOpenDevice(uint32_t deviceId)
+__MC_CLIENT_LIB_API mcResult_t mcOpenDevice_(Device** device)
{
mcResult_t mcResult = MC_DRV_OK;
#ifndef WIN32
-
+ LOG_I("===%s(%p)===", __FUNCTION__, device);
Connection *devCon = NULL;
- devMutex.lock();
- LOG_I("===%s(%i)===", __FUNCTION__, deviceId);
-
do {
- Device *device = resolveDeviceId(deviceId);
- if (device != NULL) {
- LOG_E("Device %d already opened", deviceId);
- mcResult = MC_DRV_OK;
- device->openCount++;
- break;
- }
-
// Handle SIGPIPE inside write()
// If Daemon crashes and ClientLib writes to named socket,
// a sigpipe is send to ClientLib/TLC and kills it.
@@ -236,7 +173,7 @@ __MC_CLIENT_LIB_API mcResult_t mcOpenDevice(uint32_t deviceId)
LOG_I(" %s", errmsg);
// Forward device open to the daemon and read result
- SEND_TO_DAEMON(devCon, MC_DRV_CMD_OPEN_DEVICE, deviceId);
+ SEND_TO_DAEMON(devCon, MC_DRV_CMD_OPEN_DEVICE, 0);
RECV_FROM_DAEMON(devCon, &mcResult);
@@ -247,26 +184,23 @@ __MC_CLIENT_LIB_API mcResult_t mcOpenDevice(uint32_t deviceId)
// there is no payload to read
- device = new Device(deviceId, devCon);
- mcResult = device->open("/dev/" MC_USER_DEVNODE);
+ Device* local_device = new Device(0, devCon);
+ mcResult = local_device->open("/dev/" MC_USER_DEVNODE);
if (mcResult != MC_DRV_OK) {
- delete device;
+ delete local_device;
// devCon is freed in the Device destructor
devCon = NULL;
LOG_E("Could not open device file: /dev/%s", MC_USER_DEVNODE);
break;
}
- addDevice(device);
- device->openCount++;
-
+ *device = local_device;
} while (false);
- devMutex.unlock();
if (mcResult != MC_DRV_OK) {
if (devCon != NULL)
delete devCon;
- LOG_I(" Device not opened.");
+ LOG_I(" Device not open.");
} else {
LOG_I(" Successfully opened the device.");
}
@@ -277,30 +211,22 @@ __MC_CLIENT_LIB_API mcResult_t mcOpenDevice(uint32_t deviceId)
//------------------------------------------------------------------------------
-__MC_CLIENT_LIB_API mcResult_t mcCloseDevice(
- uint32_t deviceId
+__MC_CLIENT_LIB_API mcResult_t mcCloseDevice_(
+ Device* device
)
{
mcResult_t mcResult = MC_DRV_OK;
#ifndef WIN32
- devMutex.lock();
- LOG_I("===%s(%i)===", __FUNCTION__, deviceId);
+ LOG_I("===%s(%p)===", __FUNCTION__, device);
do {
- Device *device = resolveDeviceId(deviceId);
- CHECK_DEVICE_CLOSED(device, deviceId);
-
+ CHECK_DEVICE(device);
Connection *devCon = device->connection;
- if (device->openCount != 1) {
- device->openCount--;
- break;
- }
-
// Check if daemon is still alive
if (!devCon->isConnectionAlive()) {
- removeDevice(deviceId);
- LOG_E("Daemon is dead removing device");
+ device->setInvalid();
+ LOG_E("Daemon is dead removing device");
mcResult = MC_DRV_ERR_DAEMON_UNREACHABLE;
break;
}
@@ -322,36 +248,79 @@ __MC_CLIENT_LIB_API mcResult_t mcCloseDevice(
break;
}
- removeDevice(deviceId);
-
+ device->setInvalid();
} while (false);
- devMutex.unlock();
-
#endif /* WIN32 */
return mcResult;
}
//------------------------------------------------------------------------------
-__MC_CLIENT_LIB_API mcResult_t mcOpenSession(
- mcSessionHandle_t *session,
- const mcUuid_t *uuid,
- uint8_t *tci,
- uint32_t len
+__MC_CLIENT_LIB_API bool mcDeviceIsValid_(
+ Device* device
+)
+{
+ if (!device) {
+ return false;
+ }
+ return device->isValid();
+}
+
+
+//------------------------------------------------------------------------------
+__MC_CLIENT_LIB_API mcResult_t mcDeviceHasOpenSessions_(
+ Device* device
+)
+{
+ mcResult_t mcResult = MC_DRV_OK;
+
+#ifndef WIN32
+ LOG_I("===%s(%p)===", __FUNCTION__, device);
+ do {
+ CHECK_DEVICE(device);
+ Connection *devCon = device->connection;
+
+ // Check if daemon is still alive
+ if (!devCon->isConnectionAlive()) {
+ device->setInvalid();
+ LOG_E("Daemon is dead removing device");
+ mcResult = MC_DRV_ERR_DAEMON_UNREACHABLE;
+ break;
+ }
+
+ // Return if not all sessions have been closed
+ if (device->hasSessions()) {
+ LOG_E("Trying to close device while sessions are still pending.");
+ mcResult = MC_DRV_ERR_SESSION_PENDING;
+ break;
+ }
+ } while (false);
+#endif /* WIN32 */
+
+ return mcResult;
+}
+
+
+//------------------------------------------------------------------------------
+__MC_CLIENT_LIB_API mcResult_t mcOpenSession_(
+ Device* device,
+ uint32_t* sessionId,
+ const mcUuid_t* uuid,
+ uint8_t* tci,
+ uint32_t len
)
{
mcResult_t mcResult = MC_DRV_OK;
#ifndef WIN32
- devMutex.lock();
LOG_I("===%s()===", __FUNCTION__);
BulkBufferDescriptor *bulkBuf = NULL;
do {
uint32_t handle = 0;
- CHECK_NOT_NULL(session);
+ CHECK_DEVICE(device);
CHECK_NOT_NULL(uuid);
if (len > MC_MAX_TCI_LEN) {
@@ -360,10 +329,6 @@ __MC_CLIENT_LIB_API mcResult_t mcOpenSession(
break;
}
- // Get the device associated with the given session
- Device *device = resolveDeviceId(session->deviceId);
- CHECK_DEVICE(device);
-
Connection *devCon = device->connection;
// First assume the TCI is a contiguous buffer
@@ -394,7 +359,7 @@ __MC_CLIENT_LIB_API mcResult_t mcOpenSession(
}
SEND_TO_DAEMON(devCon, MC_DRV_CMD_OPEN_SESSION,
- session->deviceId,
+ 0,
*uuid,
(uint32_t)((uintptr_t)tci & 0xFFF),
handle,
@@ -452,7 +417,8 @@ __MC_CLIENT_LIB_API mcResult_t mcOpenSession(
RECV_FROM_DAEMON(devCon, &rspOpenSessionPayload);
// Register session with handle
- session->sessionId = rspOpenSessionPayload.sessionId;
+ *sessionId = rspOpenSessionPayload.sessionId;
+
LOG_I(" Service is started. Setting up channel for notifications.");
@@ -469,8 +435,8 @@ __MC_CLIENT_LIB_API mcResult_t mcOpenSession(
do {
SEND_TO_DAEMON(sessionConnection, MC_DRV_CMD_NQ_CONNECT,
- session->deviceId,
- session->sessionId,
+ 0,
+ *sessionId,
rspOpenSessionPayload.deviceSessionId,
rspOpenSessionPayload.sessionMagic);
@@ -492,12 +458,13 @@ __MC_CLIENT_LIB_API mcResult_t mcOpenSession(
// there is no payload.
// Session has been established, new session object must be created
- Session *sessionObj = device->createNewSession(session->sessionId, sessionConnection);
+ Session *sessionObj = device->createNewSession(*sessionId, sessionConnection);
+
// If the session tci was a mapped buffer then register it
if (bulkBuf)
sessionObj->addBulkBuf(bulkBuf);
- LOG_I(" Successfully opened session %03x.", session->sessionId);
+ LOG_I(" Successfully opened session %03x.", *sessionId);
} while (false);
@@ -508,18 +475,18 @@ __MC_CLIENT_LIB_API mcResult_t mcOpenSession(
// TODO: enable as soon as there are more error codes
// if (mcResult == MC_DRV_ERR_SOCKET_WRITE || mcResult == MC_DRV_ERR_SOCKET_READ) {
// LOG_E("Connection is dead, removing device.");
-// removeDevice(session->deviceId);
+// device->setInvalid();
// }
- devMutex.unlock();
-
+
#endif /* WIN32 */
return mcResult;
}
//------------------------------------------------------------------------------
-__MC_CLIENT_LIB_API mcResult_t mcOpenTrustlet(
- mcSessionHandle_t *session,
+__MC_CLIENT_LIB_API mcResult_t mcOpenTrustlet_(
+ Device* device,
+ uint32_t* sessionId,
mcSpid_t spid,
uint8_t *trustlet,
uint32_t tlen,
@@ -530,14 +497,13 @@ __MC_CLIENT_LIB_API mcResult_t mcOpenTrustlet(
mcResult_t mcResult = MC_DRV_OK;
#ifndef WIN32
- devMutex.lock();
LOG_I("===%s()===", __FUNCTION__);
BulkBufferDescriptor *bulkBuf = NULL;
do {
uint32_t handle = 0;
- CHECK_NOT_NULL(session);
+ CHECK_DEVICE(device);
CHECK_NOT_NULL(trustlet);
CHECK_NOT_NULL(tci);
@@ -547,10 +513,6 @@ __MC_CLIENT_LIB_API mcResult_t mcOpenTrustlet(
break;
}
- // Get the device associated with the given session
- Device *device = resolveDeviceId(session->deviceId);
- CHECK_DEVICE(device);
-
Connection *devCon = device->connection;
// First assume the TCI is a contiguous buffer
@@ -575,7 +537,7 @@ __MC_CLIENT_LIB_API mcResult_t mcOpenTrustlet(
}
SEND_TO_DAEMON(devCon, MC_DRV_CMD_OPEN_TRUSTLET,
- session->deviceId,
+ 0,
spid,
(uint32_t)tlen,
(uint32_t)((uintptr_t)tci & 0xFFF),
@@ -644,7 +606,7 @@ __MC_CLIENT_LIB_API mcResult_t mcOpenTrustlet(
RECV_FROM_DAEMON(devCon, &rspOpenSessionPayload);
// Register session with handle
- session->sessionId = rspOpenSessionPayload.sessionId;
+ *sessionId = rspOpenSessionPayload.sessionId;
LOG_I(" Service is started. Setting up channel for notifications.");
@@ -661,8 +623,8 @@ __MC_CLIENT_LIB_API mcResult_t mcOpenTrustlet(
do {
SEND_TO_DAEMON(sessionConnection, MC_DRV_CMD_NQ_CONNECT,
- session->deviceId,
- session->sessionId,
+ 0,
+ *sessionId,
rspOpenSessionPayload.deviceSessionId,
rspOpenSessionPayload.sessionMagic);
@@ -685,12 +647,12 @@ __MC_CLIENT_LIB_API mcResult_t mcOpenTrustlet(
// there is no payload.
// Session has been established, new session object must be created
- Session *sessionObj = device->createNewSession(session->sessionId, sessionConnection);
+ Session *sessionObj = device->createNewSession(*sessionId, sessionConnection);
// If the session tci was a mapped buffer then register it
if (bulkBuf)
sessionObj->addBulkBuf(bulkBuf);
- LOG_I(" Successfully opened session %03x.", session->sessionId);
+ LOG_I(" Successfully opened session %03x.", *sessionId);
} while (false);
@@ -701,18 +663,17 @@ __MC_CLIENT_LIB_API mcResult_t mcOpenTrustlet(
// TODO: enable as soon as there are more error codes
// if (mcResult == MC_DRV_ERR_SOCKET_WRITE || mcResult == MC_DRV_ERR_SOCKET_READ) {
// LOG_E("Connection is dead, removing device.");
-// removeDevice(session->deviceId);
+// device->setInvalid();
// }
- devMutex.unlock();
-
#endif /* WIN32 */
return mcResult;
}
//------------------------------------------------------------------------------
-__MC_CLIENT_LIB_API mcResult_t mcOpenGPTA(
- mcSessionHandle_t *session,
+__MC_CLIENT_LIB_API mcResult_t mcOpenGPTA_(
+ Device* device,
+ uint32_t* sessionId,
const mcUuid_t *uuid,
uint8_t *tci,
uint32_t len
@@ -721,14 +682,14 @@ __MC_CLIENT_LIB_API mcResult_t mcOpenGPTA(
mcResult_t mcResult = MC_DRV_OK;
#ifndef WIN32
- devMutex.lock();
+
LOG_I("===%s()===", __FUNCTION__);
BulkBufferDescriptor *bulkBuf = NULL;
do {
uint32_t handle = 0;
- CHECK_NOT_NULL(session);
+ CHECK_DEVICE(device);
CHECK_NOT_NULL(uuid);
if (len > MC_MAX_TCI_LEN) {
@@ -737,10 +698,6 @@ __MC_CLIENT_LIB_API mcResult_t mcOpenGPTA(
break;
}
- // Get the device associated with the given session
- Device *device = resolveDeviceId(session->deviceId);
- CHECK_DEVICE(device);
-
Connection *devCon = device->connection;
// First assume the TCI is a contiguous buffer
@@ -771,7 +728,7 @@ __MC_CLIENT_LIB_API mcResult_t mcOpenGPTA(
}
SEND_TO_DAEMON(devCon, MC_DRV_CMD_OPEN_TRUSTED_APP,
- session->deviceId,
+ 0,
*uuid,
(uint32_t)((uintptr_t)tci & 0xFFF),
handle,
@@ -829,7 +786,7 @@ __MC_CLIENT_LIB_API mcResult_t mcOpenGPTA(
RECV_FROM_DAEMON(devCon, &rspOpenSessionPayload);
// Register session with handle
- session->sessionId = rspOpenSessionPayload.sessionId;
+ *sessionId = rspOpenSessionPayload.sessionId;
LOG_I(" Service is started. Setting up channel for notifications.");
@@ -846,8 +803,8 @@ __MC_CLIENT_LIB_API mcResult_t mcOpenGPTA(
do {
SEND_TO_DAEMON(sessionConnection, MC_DRV_CMD_NQ_CONNECT,
- session->deviceId,
- session->sessionId,
+ 0,
+ *sessionId,
rspOpenSessionPayload.deviceSessionId,
rspOpenSessionPayload.sessionMagic);
@@ -869,12 +826,12 @@ __MC_CLIENT_LIB_API mcResult_t mcOpenGPTA(
// there is no payload.
// Session has been established, new session object must be created
- Session *sessionObj = device->createNewSession(session->sessionId, sessionConnection);
+ Session *sessionObj = device->createNewSession(*sessionId, sessionConnection);
// If the session tci was a mapped buffer then register it
if (bulkBuf)
sessionObj->addBulkBuf(bulkBuf);
- LOG_I(" Successfully opened session %03x.", session->sessionId);
+ LOG_I(" Successfully opened session %03x.", *sessionId);
} while (false);
@@ -885,37 +842,34 @@ __MC_CLIENT_LIB_API mcResult_t mcOpenGPTA(
// TODO: enable as soon as there are more error codes
// if (mcResult == MC_DRV_ERR_SOCKET_WRITE || mcResult == MC_DRV_ERR_SOCKET_READ) {
// LOG_E("Connection is dead, removing device.");
-// removeDevice(session->deviceId);
+// device->setInvalid();
// }
- devMutex.unlock();
-
+
#endif /* WIN32 */
return mcResult;
}
//------------------------------------------------------------------------------
-__MC_CLIENT_LIB_API mcResult_t mcCloseSession(mcSessionHandle_t *session)
+__MC_CLIENT_LIB_API mcResult_t mcCloseSession_(
+ Device* device,
+ uint32_t sessionId
+ )
+
{
mcResult_t mcResult = MC_DRV_OK;
#ifndef WIN32
- LOG_I("===%s()===", __FUNCTION__);
- devMutex.lock();
+ LOG_I("===%s()===", __FUNCTION__);
do {
- CHECK_NOT_NULL(session);
- LOG_I(" Closing session %03x.", session->sessionId);
-
- Device *device = resolveDeviceId(session->deviceId);
CHECK_DEVICE(device);
+ LOG_I(" Closing session %03x.", sessionId);
Connection *devCon = device->connection;
+ Session *nqSession = device->resolveSessionId(sessionId);
+ CHECK_SESSION(nqSession, sessionId);
- Session *nqSession = device->resolveSessionId(session->sessionId);
-
- CHECK_SESSION(nqSession, session->sessionId);
-
- SEND_TO_DAEMON(devCon, MC_DRV_CMD_CLOSE_SESSION, session->sessionId);
+ SEND_TO_DAEMON(devCon, MC_DRV_CMD_CLOSE_SESSION, sessionId);
RECV_FROM_DAEMON(devCon, &mcResult);
@@ -926,7 +880,7 @@ __MC_CLIENT_LIB_API mcResult_t mcCloseSession(mcSessionHandle_t *session)
break;
}
- bool r = device->removeSession(session->sessionId);
+ bool r = device->removeSession(sessionId);
if (!r)
{
LOG_E("removeSession failed");
@@ -939,10 +893,9 @@ __MC_CLIENT_LIB_API mcResult_t mcCloseSession(mcSessionHandle_t *session)
if (mcResult == MC_DRV_ERR_SOCKET_WRITE || mcResult == MC_DRV_ERR_SOCKET_READ) {
LOG_E("Connection is dead, removing device.");
- removeDevice(session->deviceId);
+ device->setInvalid();
}
-
- devMutex.unlock();
+
#endif /* WIN32 */
return mcResult;
@@ -950,70 +903,58 @@ __MC_CLIENT_LIB_API mcResult_t mcCloseSession(mcSessionHandle_t *session)
//------------------------------------------------------------------------------
-__MC_CLIENT_LIB_API mcResult_t mcNotify(
- mcSessionHandle_t *session
+__MC_CLIENT_LIB_API mcResult_t mcNotify_(
+ Device* device,
+ uint32_t sessionId
)
{
mcResult_t mcResult = MC_DRV_OK;
#ifndef WIN32
-
- devMutex.lock();
+
LOG_I("===%s()===", __FUNCTION__);
do {
- CHECK_NOT_NULL(session);
- LOG_I(" Notifying session %03x.", session->sessionId);
-
- Device *device = resolveDeviceId(session->deviceId);
CHECK_DEVICE(device);
+ LOG_I(" Notifying session %03x.", sessionId);
Connection *devCon = device->connection;
+ Session *nqsession = device->resolveSessionId(sessionId);
+ CHECK_SESSION(nqsession, sessionId);
- Session *nqsession = device->resolveSessionId(session->sessionId);
- CHECK_SESSION(nqsession, session->sessionId);
+ SEND_TO_DAEMON(devCon, MC_DRV_CMD_NOTIFY, sessionId);
- SEND_TO_DAEMON(devCon, MC_DRV_CMD_NOTIFY, session->sessionId);
// Daemon will not return a response
} while (false);
if (mcResult == MC_DRV_ERR_SOCKET_WRITE) {
LOG_E("Connection is dead, removing device.");
- removeDevice(session->deviceId);
+ device->setInvalid();
}
- devMutex.unlock();
-
#endif /* WIN32 */
return mcResult;
}
//------------------------------------------------------------------------------
-__MC_CLIENT_LIB_API mcResult_t mcWaitNotification(
- mcSessionHandle_t *session,
+__MC_CLIENT_LIB_API mcResult_t mcWaitNotification_(
+ Device* device,
+ uint32_t sessionId,
int32_t timeout
)
{
mcResult_t mcResult = MC_DRV_OK;
#ifndef WIN32
- // TODO-2012-11-02-gurel: devMutex locking and unlocking had to be commented out
- // below. Otherwise, when there are multiple threads in Nwd TLC side, we endup a
- // deadlock situation, e.g. one thread waits for notification and another one sends
- // notification.
-
- //devMutex.lock();
LOG_I("===%s()===", __FUNCTION__);
do {
- CHECK_NOT_NULL(session);
- LOG_I(" Waiting for notification of session %03x.", session->sessionId);
-
- Device *device = resolveDeviceId(session->deviceId);
+
CHECK_DEVICE(device);
+ LOG_I(" Waiting for notification of session %03x.", sessionId);
- Session *nqSession = device->resolveSessionId(session->sessionId);
- CHECK_SESSION(nqSession, session->sessionId);
+ Session *nqSession = device->resolveSessionId(sessionId);
+ CHECK_SESSION(nqSession, sessionId);
Connection *nqconnection = nqSession->notificationConnection;
uint32_t count = 0;
@@ -1043,7 +984,7 @@ __MC_CLIENT_LIB_API mcResult_t mcWaitNotification(
}
if (count == 0 && numRead == 0 ) {
LOG_E("Connection is dead, removing device.");
- removeDevice(session->deviceId);
+ device->setInvalid();
mcResult = MC_DRV_ERR_NOTIFICATION;
break;
}
@@ -1079,8 +1020,7 @@ __MC_CLIENT_LIB_API mcResult_t mcWaitNotification(
} // for(;;)
} while (false);
-
- //devMutex.unlock();
+
#endif /* WIN32 */
return mcResult;
@@ -1088,29 +1028,21 @@ __MC_CLIENT_LIB_API mcResult_t mcWaitNotification(
//------------------------------------------------------------------------------
-__MC_CLIENT_LIB_API mcResult_t mcMallocWsm(
- uint32_t deviceId,
- uint32_t /*align*/,
- uint32_t len,
- uint8_t **wsm,
- uint32_t /*wsmFlags*/)
+__MC_CLIENT_LIB_API mcResult_t mcMallocWsm_(
+ Device* device,
+ uint32_t len,
+ uint8_t** wsm
+)
+
{
mcResult_t mcResult = MC_DRV_ERR_UNKNOWN;
#ifndef WIN32
LOG_I("===%s(len=%i)===", __FUNCTION__, len);
-
- devMutex.lock();
-
+
do {
- Device *device = resolveDeviceId(deviceId);
-
- // Is the device known
- // CHECK_DEVICE(device);
-
- // Is the device opened.
- CHECK_DEVICE_CLOSED(device, deviceId)
-
+ CHECK_DEVICE(device);
+
CHECK_NOT_NULL(wsm);
CWsm_ptr pWsm;
@@ -1124,8 +1056,7 @@ __MC_CLIENT_LIB_API mcResult_t mcMallocWsm(
mcResult = MC_DRV_OK;
} while (false);
-
- devMutex.unlock();
+
#endif /* WIN32 */
return mcResult;
@@ -1133,30 +1064,20 @@ __MC_CLIENT_LIB_API mcResult_t mcMallocWsm(
//------------------------------------------------------------------------------
-__MC_CLIENT_LIB_API mcResult_t mcFreeWsm(
- uint32_t deviceId,
- uint8_t *wsm
+__MC_CLIENT_LIB_API mcResult_t mcFreeWsm_(
+ Device* device,
+ uint8_t* wsm
)
{
mcResult_t mcResult = MC_DRV_ERR_UNKNOWN;
#ifndef WIN32
- Device *device;
-
- devMutex.lock();
-
+
LOG_I("===%s(%p)===", __FUNCTION__, wsm);
do {
- // Get the device associated wit the given session
- device = resolveDeviceId(deviceId);
-
- // Is the device known
- CHECK_DEVICE(device);
-
- // Is the device opened.
- CHECK_DEVICE_CLOSED(device, deviceId)
+ CHECK_DEVICE(device);
// find WSM object
CWsm_ptr pWsm = device->findContiguousWsm(wsm);
@@ -1175,16 +1096,16 @@ __MC_CLIENT_LIB_API mcResult_t mcFreeWsm(
mcResult = MC_DRV_OK;
} while (false);
-
- devMutex.unlock();
+
#endif /* WIN32 */
return mcResult;
}
//------------------------------------------------------------------------------
-__MC_CLIENT_LIB_API mcResult_t mcMap(
- mcSessionHandle_t *sessionHandle,
+__MC_CLIENT_LIB_API mcResult_t mcMap_(
+ Device* device,
+ uint32_t sessionId,
void *buf,
uint32_t bufLen,
mcBulkMap_t *mapInfo
@@ -1196,29 +1117,20 @@ __MC_CLIENT_LIB_API mcResult_t mcMap(
static CMutex mutex;
LOG_I("===%s()===", __FUNCTION__);
-
- devMutex.lock();
+
do {
- CHECK_NOT_NULL(sessionHandle);
+ CHECK_DEVICE(device);
CHECK_NOT_NULL(mapInfo);
CHECK_NOT_NULL(buf);
- // Determine device the session belongs to
- Device *device = resolveDeviceId(sessionHandle->deviceId);
- // Is the device known
- CHECK_DEVICE(device);
-
- // Is the device opened.
- CHECK_DEVICE_CLOSED(device, sessionHandle->deviceId)
-
Connection *devCon = device->connection;
// Get session
- Session *session = device->resolveSessionId(sessionHandle->sessionId);
- CHECK_SESSION(session, sessionHandle->sessionId);
+ Session *session = device->resolveSessionId(sessionId);
+ CHECK_SESSION(session, sessionId);
- LOG_I(" Mapping %p to session %03x.", buf, sessionHandle->sessionId);
+ LOG_I(" Mapping %p to session %03x.", buf, sessionId);
// Register mapped bulk buffer to Kernel Module and keep mapped bulk buffer in mind
BulkBufferDescriptor *bulkBuf;
@@ -1229,7 +1141,7 @@ __MC_CLIENT_LIB_API mcResult_t mcMap(
}
SEND_TO_DAEMON(devCon, MC_DRV_CMD_MAP_BULK_BUF,
- session->sessionId,
+ sessionId,
bulkBuf->handle,
0,
(uint32_t)((uintptr_t)bulkBuf->virtAddr & 0xFFF),
@@ -1270,18 +1182,18 @@ __MC_CLIENT_LIB_API mcResult_t mcMap(
// // TODO: enable as soon as there are more error codes
// if (mcResult == MC_DRV_ERR_SOCKET_WRITE || mcResult == MC_DRV_ERR_SOCKET_READ) {
// LOG_E("Connection is dead, removing device.");
-// removeDevice(sessionHandle->deviceId);
+// device->setInvalid();
// }
- devMutex.unlock();
-
+
#endif /* WIN32 */
return mcResult;
}
//------------------------------------------------------------------------------
-__MC_CLIENT_LIB_API mcResult_t mcUnmap(
- mcSessionHandle_t *sessionHandle,
+__MC_CLIENT_LIB_API mcResult_t mcUnmap_(
+ Device* device,
+ uint32_t sessionId,
void *buf,
mcBulkMap_t *mapInfo
)
@@ -1293,10 +1205,9 @@ __MC_CLIENT_LIB_API mcResult_t mcUnmap(
LOG_I("===%s()===", __FUNCTION__);
- devMutex.lock();
-
+
do {
- CHECK_NOT_NULL(sessionHandle);
+ CHECK_DEVICE(device);
CHECK_NOT_NULL(mapInfo);
CHECK_NOT_NULL(buf);
if (mapInfo->sVirtualAddr == 0) {
@@ -1304,20 +1215,12 @@ __MC_CLIENT_LIB_API mcResult_t mcUnmap(
mcResult = MC_DRV_ERR_NULL_POINTER;
break;
}
-
- // Determine device the session belongs to
- Device *device = resolveDeviceId(sessionHandle->deviceId);
- // Is the device known
- CHECK_DEVICE(device);
-
- // Is the device opened.
- CHECK_DEVICE_CLOSED(device, sessionHandle->deviceId)
-
+
Connection *devCon = device->connection;
// Get session
- Session *session = device->resolveSessionId(sessionHandle->sessionId);
- CHECK_SESSION(session, sessionHandle->sessionId);
+ Session *session = device->resolveSessionId(sessionId);
+ CHECK_SESSION(session, sessionId);
uint32_t handle = session->getBufHandle((uint32_t)mapInfo->sVirtualAddr, mapInfo->sVirtualLen);
if (handle == 0) {
@@ -1326,10 +1229,10 @@ __MC_CLIENT_LIB_API mcResult_t mcUnmap(
break;
}
- LOG_I(" Unmapping %p(handle=%u) from session %03x.", buf, handle, sessionHandle->sessionId);
+ LOG_I(" Unmapping %p(handle=%u) from session %03x.", buf, handle, sessionId);
SEND_TO_DAEMON(devCon, MC_DRV_CMD_UNMAP_BULK_BUF,
- session->sessionId,
+ sessionId,
handle,
(uint32_t)mapInfo->sVirtualAddr,
mapInfo->sVirtualLen);
@@ -1357,10 +1260,9 @@ __MC_CLIENT_LIB_API mcResult_t mcUnmap(
if (mcResult == MC_DRV_ERR_SOCKET_WRITE || mcResult == MC_DRV_ERR_SOCKET_READ) {
LOG_E("Connection is dead, removing device.");
- removeDevice(sessionHandle->deviceId);
+ device->setInvalid();
}
-
- devMutex.unlock();
+
#endif /* WIN32 */
return mcResult;
@@ -1368,65 +1270,51 @@ __MC_CLIENT_LIB_API mcResult_t mcUnmap(
//------------------------------------------------------------------------------
-__MC_CLIENT_LIB_API mcResult_t mcGetSessionErrorCode(
- mcSessionHandle_t *session,
+__MC_CLIENT_LIB_API mcResult_t mcGetSessionErrorCode_(
+ Device* device,
+ uint32_t sessionId,
int32_t *lastErr
)
{
mcResult_t mcResult = MC_DRV_OK;
#ifndef WIN32
- devMutex.lock();
+
LOG_I("===%s()===", __FUNCTION__);
do {
- CHECK_NOT_NULL(session);
- CHECK_NOT_NULL(lastErr);
-
- // Get device
- Device *device = resolveDeviceId(session->deviceId);
- // Is the device known
CHECK_DEVICE(device);
-
- // Is the device opened.
- CHECK_DEVICE_CLOSED(device, session->deviceId)
+ CHECK_NOT_NULL(lastErr);
// Get session
- Session *nqsession = device->resolveSessionId(session->sessionId);
- CHECK_SESSION(nqsession, session->sessionId);
+ Session *nqsession = device->resolveSessionId(sessionId);
+ CHECK_SESSION(nqsession, sessionId);
// get session error code from session
*lastErr = nqsession->getLastErr();
- } while (false);
-
- devMutex.unlock();
+ } while (false);
#endif /* WIN32 */
return mcResult;
}
//------------------------------------------------------------------------------
-__MC_CLIENT_LIB_API mcResult_t mcGetMobiCoreVersion(
- uint32_t deviceId,
- mcVersionInfo_t *versionInfo
+__MC_CLIENT_LIB_API mcResult_t mcGetMobiCoreVersion_(
+ Device* device,
+ mcVersionInfo_t* versionInfo
+
)
{
mcResult_t mcResult = MC_DRV_OK;
#ifndef WIN32
-
- devMutex.lock();
+
LOG_I("===%s()===", __FUNCTION__);
do {
- Device *device = resolveDeviceId(deviceId);
- // Is the device known
CHECK_DEVICE(device);
- // Is the device opened.
- CHECK_DEVICE_CLOSED(device, deviceId)
-
CHECK_NOT_NULL(versionInfo);
Connection *devCon = device->connection;
@@ -1451,8 +1339,7 @@ __MC_CLIENT_LIB_API mcResult_t mcGetMobiCoreVersion(
*versionInfo = versionInfo_socket;
} while (0);
-
- devMutex.unlock();
+
#endif /* WIN32 */
return mcResult;
@@ -1461,8 +1348,8 @@ __MC_CLIENT_LIB_API mcResult_t mcGetMobiCoreVersion(
#ifndef WIN32
//------------------------------------------------------------------------------
// Only called by mcOpenDevice()
-// Must be taken with devMutex locked.
-uint32_t getDaemonVersion(Connection *devCon, uint32_t *version)
+static uint32_t getDaemonVersion(Connection *devCon, uint32_t *version)
+
{
mcResult_t mcResult = MC_DRV_OK;
uint32_t v = 0;
diff --git a/mobicore/MobiCoreDriverLib/ClientLib/ClientLib.h b/mobicore/MobiCoreDriverLib/ClientLib/ClientLib.h
new file mode 100644
index 0000000..fff42da
--- /dev/null
+++ b/mobicore/MobiCoreDriverLib/ClientLib/ClientLib.h
@@ -0,0 +1,373 @@
+/*
+ * Copyright (c) 2013-2015 TRUSTONIC LIMITED
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the TRUSTONIC LIMITED nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * MobiCore Driver API.
+ *
+ * The MobiCore (MC) Driver API provides access functions to the t-base trusted execution environment and the contained Trusted Applications.
+ */
+#ifndef CLIENTLIB_H_
+#define CLIENTLIB_H_
+
+#define __MC_CLIENT_LIB_API extern "C"
+
+#ifndef WIN32
+/* Mark only the following functions for export */
+#pragma GCC visibility push(default)
+#endif
+
+#include "Device.h"
+
+/** Open a new connection to a t-base device.
+ *
+ * mcOpenDevice() initializes all device specific resources required to communicate
+ * with an t-base instance located on the specified device in the system. If the device
+ * does not exist the function will return MC_DRV_ERR_UNKNOWN_DEVICE.
+ *
+ * @param [out] device Device struct for the connection/driver.
+ *
+ * @return MC_DRV_OK if operation has been successfully completed.
+ * @return MC_DRV_ERR_INVALID_OPERATION if device already opened.
+ * @return MC_DRV_ERR_DAEMON_UNREACHABLE when problems with daemon occur.
+ * @return MC_DRV_ERR_UNKNOWN_DEVICE when deviceId is unknown.
+ * @return MC_DRV_ERR_INVALID_DEVICE_FILE if kernel module under /dev/mobicore cannot be opened
+ *
+ * Uses a Mutex.
+ */
+__MC_CLIENT_LIB_API mcResult_t mcOpenDevice_(
+ Device** device
+);
+
+/** Close the connection to a t-base device.
+ * When closing a device, active sessions have to be closed beforehand.
+ * Resources associated with the device will be released.
+ * The device may be opened again after it has been closed.
+ *
+ * @param [in] device Device struct for the connection/driver.
+ *
+ * @return MC_DRV_OK if operation has been successfully completed.
+ * @return MC_DRV_ERR_UNKNOWN_DEVICE when device id is invalid.
+ * @return MC_DRV_ERR_SESSION_PENDING when a session is still open.
+ * @return MC_DRV_ERR_DAEMON_UNREACHABLE when problems with daemon occur.
+ *
+ * Uses a Mutex.
+ */
+__MC_CLIENT_LIB_API mcResult_t mcCloseDevice_(
+ Device* device
+);
+
+__MC_CLIENT_LIB_API bool mcDeviceIsValid_(
+ Device* device
+);
+
+__MC_CLIENT_LIB_API mcResult_t mcDeviceHasOpenSessions_(
+ Device* device
+);
+
+/** Open a new session to a Trusted Application. The Trusted Application with the given UUID has to be available in the flash filesystem.
+ *
+ * Write MCP open message to buffer and notify t-base about the availability of a new command.
+ * Waits till t-base responds with the new session ID (stored in the MCP buffer).
+ *
+ * @param [in,out] session On success, the session data will be returned. Note that session.deviceId has to be the device id of an opened device.
+ * @param [in] uuid UUID of the Trusted Application to be opened.
+ * @param [in] tci TCI buffer for communicating with the Trusted Application.
+ * @param [in] tciLen Length of the TCI buffer. Maximum allowed value is MC_MAX_TCI_LEN.
+ *
+ * @return MC_DRV_OK if operation has been successfully completed.
+ * @return MC_DRV_INVALID_PARAMETER if session parameter is invalid.
+ * @return MC_DRV_ERR_UNKNOWN_DEVICE when device id is invalid.
+ * @return MC_DRV_ERR_DAEMON_UNREACHABLE when problems with daemon socket occur.
+ * @return MC_DRV_ERR_UNKNOWN_DEVICE when daemon returns an error.
+ * @return MC_DRV_ERR_TRUSTED_APPLICATION_NOT_FOUND when Trusted Application or driver cannot be loaded.
+ *
+ * Uses a Mutex.
+ */
+__MC_CLIENT_LIB_API mcResult_t mcOpenSession_(
+ Device* device,
+ uint32_t* session_id,
+ const mcUuid_t* uuid,
+ uint8_t* tci,
+ uint32_t tciLen
+);
+
+/** Open a new session to a Trusted Application(Trustlet). The Trusted Application will be loaded from the memory buffer.
+ *
+ * Write MCP open message to buffer and notify t-base about the availability of a new command.
+ * Waits till t-base responds with the new session ID (stored in the MCP buffer).
+ *
+ * @param [in,out] session On success, the session data will be returned. Note that session.deviceId has to be the device id of an opened device.
+ * @param [in] spid Service Provider ID(for Service provider trustlets otherwise ignored)
+ * @param [in] trustedapp memory buffer containing the Trusted Application binary
+ * @param [in] tlen length of the memory buffer containing the Trusted Application
+ * @param [in] tci TCI buffer for communicating with the Trusted Application.
+ * @param [in] tciLen Length of the TCI buffer. Maximum allowed value is MC_MAX_TCI_LEN.
+ *
+ * @return MC_DRV_OK if operation has been successfully completed.
+ * @return MC_DRV_INVALID_PARAMETER if session parameter is invalid.
+ * @return MC_DRV_ERR_UNKNOWN_DEVICE when device id is invalid.
+ * @return MC_DRV_ERR_DAEMON_UNREACHABLE when problems with daemon socket occur.
+ * @return MC_DRV_ERR_UNKNOWN_DEVICE when daemon returns an error.
+ * @return MC_DRV_ERR_TRUSTED_APPLICATION_NOT_FOUND when Trusted Application cannot be loaded.
+ *
+ * Uses a Mutex.
+ */
+__MC_CLIENT_LIB_API mcResult_t mcOpenTrustlet_(
+ Device* device,
+ uint32_t* session_id,
+ mcSpid_t spid,
+ uint8_t* trustedapp,
+ uint32_t tLen,
+ uint8_t* tci,
+ uint32_t tciLen
+);
+
+__MC_CLIENT_LIB_API mcResult_t mcOpenGPTA_(
+ Device* device,
+ uint32_t* session_id,
+ const mcUuid_t* uuid,
+ uint8_t* tci,
+ uint32_t len
+);
+
+/** Close a Trusted Application session.
+ *
+ * Closes the specified t-base session. The call will block until the session has been closed.
+ *
+ * @pre Device deviceId has to be opened in advance.
+ *
+ * @param [in] session Session to be closed.
+ *
+ * @return MC_DRV_OK if operation has been successfully completed.
+ * @return MC_DRV_INVALID_PARAMETER if session parameter is invalid.
+ * @return MC_DRV_ERR_UNKNOWN_SESSION when session id is invalid.
+ * @return MC_DRV_ERR_UNKNOWN_DEVICE when device id of session is invalid.
+ * @return MC_DRV_ERR_DAEMON_UNREACHABLE when problems with daemon occur.
+ * @return MC_DRV_ERR_INVALID_DEVICE_FILE when daemon cannot open trustlet file.
+ *
+ * Uses a Mutex.
+ */
+__MC_CLIENT_LIB_API mcResult_t mcCloseSession_(
+ Device* device,
+ uint32_t session_id
+);
+
+/** Notify a session.
+ * Notifies the session end point about available message data.
+ * If the session parameter is correct, notify will always succeed.
+ * Corresponding errors can only be received by mcWaitNotification().
+ * @pre A session has to be opened in advance.
+ *
+ * @param session The session to be notified.
+ *
+ * @return MC_DRV_OK if operation has been successfully completed.
+ * @return MC_DRV_INVALID_PARAMETER if session parameter is invalid.
+ * @return MC_DRV_ERR_UNKNOWN_SESSION when session id is invalid.
+ * @return MC_DRV_ERR_UNKNOWN_DEVICE when device id of session is invalid.
+ */
+__MC_CLIENT_LIB_API mcResult_t mcNotify_(
+ Device* device,
+ uint32_t session_id
+);
+
+/** Wait for a notification.
+ *
+ * Wait for a notification issued by t-base for a specific session.
+ * The timeout parameter specifies the number of milliseconds the call will wait for a notification.
+ * If the caller passes 0 as timeout value the call will immediately return. If timeout value is below 0 the call will block
+ * until a notification for the session has been received.
+ *
+ * @attention if timeout is below 0, call will block:
+ * Caller has to trust the other side to send a notification to wake him up again.
+ *
+ * @param [in] session The session the notification should correspond to.
+ * @param [in] timeout Time in milliseconds to wait (MC_NO_TIMEOUT : direct return, > 0 : milliseconds, MC_INFINITE_TIMEOUT : wait indefinitely, MC_INFINITE_TIMEOUT_INTERRUPTIBLE : wait indefinitely except if signal received)
+ *
+ * @return MC_DRV_OK if notification is available.
+ * @return MC_DRV_ERR_TIMEOUT if no notification arrived in time.
+ * @return MC_DRV_INFO_NOTIFICATION if a problem with the session was encountered. Get more details with mcGetSessionErrorCode().
+ * @return MC_DRV_ERR_NOTIFICATION if a problem with the socket occurred.
+ * @return MC_DRV_INVALID_PARAMETER if a parameter is invalid.
+ * @return MC_DRV_ERR_UNKNOWN_SESSION when session id is invalid.
+ * @return MC_DRV_ERR_UNKNOWN_DEVICE when device id of session is invalid.
+ */
+__MC_CLIENT_LIB_API mcResult_t mcWaitNotification_(
+ Device* device,
+ uint32_t session_id,
+ int32_t timeout
+);
+
+/**
+ * Allocate a block of world shared memory (WSM).
+ * The MC driver allocates a contiguous block of memory which can be used as WSM.
+ * This implicates that the allocated memory is aligned according to the alignment parameter.
+ * Always returns a buffer of size WSM_SIZE aligned to 4K.
+ *
+ * @param [in] deviceId The ID of an opened device to retrieve the WSM from.
+ * @param [in] align The alignment (number of pages) of the memory block (e.g. 0x00000001 for 4kB).
+ * @param [in] len Length of the block in bytes.
+ * @param [out] wsm Virtual address of the world shared memory block.
+ * @param [in] wsmFlags Platform specific flags describing the memory to be allocated.
+ *
+ * @attention: align and wsmFlags are currently ignored
+ *
+ * @return MC_DRV_OK if operation has been successfully completed.
+ * @return MC_DRV_INVALID_PARAMETER if a parameter is invalid.
+ * @return MC_DRV_ERR_UNKNOWN_DEVICE when device id is invalid.
+ * @return MC_DRV_ERR_NO_FREE_MEMORY if no more contiguous memory is available in this size or for this process.
+ *
+ * Uses a Mutex.
+ */
+__MC_CLIENT_LIB_API mcResult_t mcMallocWsm_(
+ Device* device,
+ uint32_t len,
+ uint8_t** wsm
+);
+
+/**
+ * Free a block of world shared memory (WSM).
+ * The MC driver will free a block of world shared memory (WSM) previously allocated with
+ * mcMallocWsm(). The caller has to assure that the address handed over to the driver
+ * is a valid WSM address.
+ *
+ * @param [in] deviceId The ID to which the given address belongs.
+ * @param [in] wsm Address of WSM block to be freed.
+ *
+ * @return MC_DRV_OK if operation has been successfully completed.
+ * @return MC_DRV_INVALID_PARAMETER if a parameter is invalid.
+ * @return MC_DRV_ERR_UNKNOWN_DEVICE when device id is invalid.
+ * @return MC_DRV_ERR_FREE_MEMORY_FAILED on failures.
+ *
+ * Uses a Mutex.
+ */
+__MC_CLIENT_LIB_API mcResult_t mcFreeWsm_(
+ Device* device,
+ uint8_t* wsm
+);
+
+/**
+ * Map additional bulk buffer between a Client Application (CA) and the Trusted Application (TA) for a session.
+ * Memory allocated in user space of the CA can be mapped as additional communication channel
+ * (besides TCI) to the Trusted Application. Limitation of the Trusted Application memory structure apply: only 6 chunks can be mapped
+ * with a maximum chunk size of 1 MiB each.
+ *
+ * @attention It is up to the application layer (CA) to inform the Trusted Application about the additional mapped bulk memory.
+ *
+ * @param [in] session Session handle with information of the deviceId and the sessionId. The
+ * given buffer is mapped to the session specified in the sessionHandle.
+ * @param [in] buf Virtual address of a memory portion (relative to CA) to be shared with the Trusted Application, already includes a possible offset!
+ * @param [in] len length of buffer block in bytes.
+ * @param [out] mapInfo Information structure about the mapped Bulk buffer between the CA (NWd) and
+ * the TA (SWd).
+ *
+ * @return MC_DRV_OK if operation has been successfully completed.
+ * @return MC_DRV_INVALID_PARAMETER if a parameter is invalid.
+ * @return MC_DRV_ERR_UNKNOWN_SESSION when session id is invalid.
+ * @return MC_DRV_ERR_UNKNOWN_DEVICE when device id of session is invalid.
+ * @return MC_DRV_ERR_DAEMON_UNREACHABLE when problems with daemon occur.
+ * @return MC_DRV_ERR_BULK_MAPPING when buf is already uses as bulk buffer or when registering the buffer failed.
+ *
+ * Uses a Mutex.
+ */
+__MC_CLIENT_LIB_API mcResult_t mcMap_(
+ Device* device,
+ uint32_t session_id,
+ void* buf,
+ uint32_t len,
+ mcBulkMap_t* mapInfo
+);
+
+/**
+ * Remove additional mapped bulk buffer between Client Application (CA) and the Trusted Application (TA) for a session.
+ *
+ * @attention The bulk buffer will immediately be unmapped from the session context.
+ * @attention The application layer (CA) must inform the TA about unmapping of the additional bulk memory before calling mcUnmap!
+ *
+ * @param [in] session Session handle with information of the deviceId and the sessionId. The
+ * given buffer is unmapped from the session specified in the sessionHandle.
+ * @param [in] buf Virtual address of a memory portion (relative to CA) shared with the TA, already includes a possible offset!
+ * @param [in] mapInfo Information structure about the mapped Bulk buffer between the CA (NWd) and
+ * the TA (SWd).
+ * @attention The clientlib currently ignores the len field in mapInfo.
+ *
+ * @return MC_DRV_OK if operation has been successfully completed.
+ * @return MC_DRV_INVALID_PARAMETER if a parameter is invalid.
+ * @return MC_DRV_ERR_UNKNOWN_SESSION when session id is invalid.
+ * @return MC_DRV_ERR_UNKNOWN_DEVICE when device id of session is invalid.
+ * @return MC_DRV_ERR_DAEMON_UNREACHABLE when problems with daemon occur.
+ * @return MC_DRV_ERR_BULK_UNMAPPING when buf was not registered earlier or when unregistering failed.
+ *
+ * Uses a Mutex.
+ */
+__MC_CLIENT_LIB_API mcResult_t mcUnmap_(
+ Device* device,
+ uint32_t session_id,
+ void* buf,
+ mcBulkMap_t* mapInfo
+);
+
+/**
+ * Get additional error information of the last error that occurred on a session.
+ * After the request the stored error code will be deleted.
+ *
+ * @param [in] session Session handle with information of the deviceId and the sessionId.
+ * @param [out] lastErr >0 Trusted Application has terminated itself with this value, <0 Trusted Application is dead because of an error within t-base (e.g. Kernel exception).
+ * See also notificationPayload_t enum in MCI definition at "mcinq.h".
+ *
+ * @return MC_DRV_OK if operation has been successfully completed.
+ * @return MC_DRV_INVALID_PARAMETER if a parameter is invalid.
+ * @return MC_DRV_ERR_UNKNOWN_SESSION when session id is invalid.
+ * @return MC_DRV_ERR_UNKNOWN_DEVICE when device id of session is invalid.
+ */
+__MC_CLIENT_LIB_API mcResult_t mcGetSessionErrorCode_(
+ Device* device,
+ uint32_t session_id,
+ int32_t* lastErr
+);
+
+/**
+ * Get t-base version information of a device.
+ *
+ * @param [in] deviceId of an open device.
+ * @param [out] versionInfo t-base version info.
+ *
+ * @return MC_DRV_OK if operation has been successfully completed.
+ * @return MC_DRV_ERR_UNKNOWN_DEVICE when device is not open.
+ * @return MC_DRV_INVALID_PARAMETER if a parameter is invalid.
+ * @return MC_DRV_ERR_DAEMON_UNREACHABLE when problems with daemon occur.
+ */
+__MC_CLIENT_LIB_API mcResult_t mcGetMobiCoreVersion_(
+ Device* device,
+ mcVersionInfo_t* versionInfo
+);
+#ifndef WIN32
+#pragma GCC visibility pop
+#endif
+#endif /** CLIENTLIB_H_ */
diff --git a/mobicore/MobiCoreDriverLib/ClientLib/Contrib/common_client.cpp b/mobicore/MobiCoreDriverLib/ClientLib/Contrib/common_client.cpp
new file mode 100644
index 0000000..3d6bdcd
--- /dev/null
+++ b/mobicore/MobiCoreDriverLib/ClientLib/Contrib/common_client.cpp
@@ -0,0 +1,254 @@
+/*
+ * Copyright (c) 2013-2015 TRUSTONIC LIMITED
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the TRUSTONIC LIMITED nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <pthread.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+#include <string.h>
+
+#undef LOG_TAG
+#define LOG_TAG "TeeCommonClient"
+#include "log.h"
+#include "mcVersionHelper.h"
+#include "driver_client.h"
+#ifndef WITHOUT_PROXY
+#include "proxy_client.h"
+#endif
+#include "common_client.h"
+
+#ifdef LOG_FPRINTF
+// Set default log destination (needs to be somewhere)
+FILE* mc_log_file_ = stdout;
+#endif
+
+struct CommonClient::Impl {
+ pthread_mutex_t mutex;
+ int open_count;
+ DriverClient driver;
+#ifndef WITHOUT_PROXY
+ ProxyClient proxy;
+#endif
+ IClient* client;
+ OpenMode open_mode;
+ Impl(): open_count(0), client(NULL), open_mode(AUTO) {
+ pthread_mutex_init(&mutex, NULL);
+ }
+};
+
+CommonClient::CommonClient(): pimpl_(new Impl) {
+}
+
+CommonClient::~CommonClient() {
+ delete pimpl_;
+}
+
+int CommonClient::open() {
+ int ret = 0;
+ pthread_mutex_lock(&pimpl_->mutex);
+ if (pimpl_->client && !pimpl_->client->isOpen()) {
+ pimpl_->open_count = 0;
+ }
+ if (pimpl_->open_count == 0) {
+ if ((pimpl_->open_mode != PROXY) && (pimpl_->driver.open() >= 0)) {
+ pimpl_->client = &pimpl_->driver;
+#ifndef WITHOUT_PROXY
+ } else if ((pimpl_->open_mode != DRIVER) &&
+ (pimpl_->proxy.open() >= 0)) {
+ pimpl_->client = &pimpl_->proxy;
+#endif
+ } else {
+ LOG_E("Failed to open lower layersssss: %s", strerror(errno));
+ ret = -1;
+ }
+ }
+ if (pimpl_->client) {
+ pimpl_->open_count++;
+ }
+ pthread_mutex_unlock(&pimpl_->mutex);
+ LOG_D("%s ret=%d open_count=%d", __FUNCTION__, ret, pimpl_->open_count);
+ return ret;
+}
+
+int CommonClient::closeCheck() {
+ int ret;
+ pthread_mutex_lock(&pimpl_->mutex);
+ if (pimpl_->open_count > 1) {
+ pimpl_->open_count--;
+ ret = 0;
+ } else {
+ errno = EPERM;
+ ret = -1;
+ }
+ pthread_mutex_unlock(&pimpl_->mutex);
+ LOG_D("%s ret=%d open_count=%d", __FUNCTION__, ret, pimpl_->open_count);
+ return ret;
+}
+
+int CommonClient::close() {
+ int ret = -1;
+ pthread_mutex_lock(&pimpl_->mutex);
+ /* Not open */
+ if (!pimpl_->client) {
+ errno = EBADF;
+ } else {
+ /* Last token */
+ if (pimpl_->open_count == 1) {
+ ret = pimpl_->client->close();
+ pimpl_->client = NULL;
+ } else {
+ ret = 0;
+ }
+ pimpl_->open_count--;
+ }
+ pthread_mutex_unlock(&pimpl_->mutex);
+ LOG_D("%s ret=%d open_count=%d", __FUNCTION__, ret, pimpl_->open_count);
+ return ret;
+}
+
+bool CommonClient::isOpen() const {
+ return pimpl_->open_count > 0;
+}
+
+int CommonClient::hasOpenSessions() const {
+ if (!pimpl_->client) {
+ errno = EBADF;
+ return -1;
+ }
+ return pimpl_->client->hasOpenSessions();
+}
+
+int CommonClient::openSession(struct mc_ioctl_open_session& session) {
+ if (!pimpl_->client) {
+ errno = EBADF;
+ return -1;
+ }
+ return pimpl_->client->openSession(session);
+}
+
+int CommonClient::openTrustlet(struct mc_ioctl_open_trustlet& trustlet) {
+ if (!pimpl_->client) {
+ errno = EBADF;
+ return -1;
+ }
+ return pimpl_->client->openTrustlet(trustlet);
+}
+
+int CommonClient::closeSession(uint32_t session_id) {
+ if (!pimpl_->client) {
+ errno = EBADF;
+ return -1;
+ }
+ return pimpl_->client->closeSession(session_id);
+}
+
+int CommonClient::notify(uint32_t session_id) {
+ if (!pimpl_->client) {
+ errno = EBADF;
+ return -1;
+ }
+ return pimpl_->client->notify(session_id);
+}
+
+int CommonClient::waitNotification(const struct mc_ioctl_wait& wait) {
+ if (!pimpl_->client) {
+ errno = EBADF;
+ return -1;
+ }
+ return pimpl_->client->waitNotification(wait);
+}
+
+int CommonClient::malloc(uint8_t** buffer, uint32_t length) {
+ if (!pimpl_->client) {
+ errno = EBADF;
+ return -1;
+ }
+ return pimpl_->client->malloc(buffer, length);
+}
+
+int CommonClient::free(uint8_t* buffer, uint32_t length) {
+ if (!pimpl_->client) {
+ errno = EBADF;
+ return -1;
+ }
+ return pimpl_->client->free(buffer, length);
+}
+
+int CommonClient::map(struct mc_ioctl_map& map) {
+ if (!pimpl_->client) {
+ errno = EBADF;
+ return -1;
+ }
+ return pimpl_->client->map(map);
+}
+
+int CommonClient::unmap(const struct mc_ioctl_map& map) {
+ if (!pimpl_->client) {
+ errno = EBADF;
+ return -1;
+ }
+ return pimpl_->client->unmap(map);
+}
+
+int CommonClient::getError(struct mc_ioctl_geterr& err) {
+ if (!pimpl_->client) {
+ errno = EBADF;
+ return -1;
+ }
+ return pimpl_->client->getError(err);
+}
+
+int CommonClient::getVersion(struct mc_version_info& version_info) {
+ if (!pimpl_->client) {
+ errno = EBADF;
+ return -1;
+ }
+ return pimpl_->client->getVersion(version_info);
+}
+
+int CommonClient::gpRequestCancellation(uint32_t session_id) {
+ if (!pimpl_->client) {
+ errno = EBADF;
+ return -1;
+ }
+ return pimpl_->client->gpRequestCancellation(session_id);
+}
+
+void CommonClient::setOpenMode(OpenMode open_mode) {
+#ifdef WITHOUT_PROXY
+ (void) open_mode;
+#else
+ pimpl_->open_mode = open_mode;
+#endif
+}
diff --git a/mobicore/MobiCoreDriverLib/ClientLib/Contrib/common_client.h b/mobicore/MobiCoreDriverLib/ClientLib/Contrib/common_client.h
new file mode 100644
index 0000000..0458999
--- /dev/null
+++ b/mobicore/MobiCoreDriverLib/ClientLib/Contrib/common_client.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2013-2015 TRUSTONIC LIMITED
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the TRUSTONIC LIMITED nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* Common open/file device functions for Mobicore and GP */
+
+#ifndef __CLIENT_COMMON_H__
+#define __CLIENT_COMMON_H__
+
+#include "iclient.h"
+
+class CommonClient: public IClient {
+ struct Impl;
+ Impl* const pimpl_;
+ CommonClient();
+public:
+ ~CommonClient();
+ virtual int open();
+ int closeCheck();
+ virtual int close();
+ virtual bool isOpen() const;
+ virtual int hasOpenSessions() const;
+ virtual int openSession(struct mc_ioctl_open_session& session);
+ virtual int openTrustlet(struct mc_ioctl_open_trustlet& trustlet);
+ virtual int closeSession(uint32_t session_id);
+ virtual int notify(uint32_t session_id);
+ virtual int waitNotification(const struct mc_ioctl_wait& wait);
+ virtual int malloc(uint8_t** buffer, uint32_t length);
+ virtual int free(uint8_t* buffer, uint32_t length);
+ virtual int map(struct mc_ioctl_map& map);
+ virtual int unmap(const struct mc_ioctl_map& map);
+ virtual int getError(struct mc_ioctl_geterr& err);
+ virtual int getVersion(struct mc_version_info& version_info);
+ virtual int gpRequestCancellation(uint32_t session_id);
+ // Singleton
+ static CommonClient& getInstance() {
+ static CommonClient client;
+ return client;
+ }
+ // For test purpose
+ enum OpenMode {
+ AUTO,
+ DRIVER = 0x44525652,
+ PROXY = 0x50525859,
+ };
+ void setOpenMode(OpenMode open_mode);
+};
+
+#endif // __CLIENT_COMMON_H__
diff --git a/mobicore/MobiCoreDriverLib/ClientLib/Contrib/driver_client.h b/mobicore/MobiCoreDriverLib/ClientLib/Contrib/driver_client.h
new file mode 100644
index 0000000..6902714
--- /dev/null
+++ b/mobicore/MobiCoreDriverLib/ClientLib/Contrib/driver_client.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2013-2015 TRUSTONIC LIMITED
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the TRUSTONIC LIMITED nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __CLIENT_DRIVER_H__
+#define __CLIENT_DRIVER_H__
+
+#include "iclient.h"
+
+class DriverClient: public IClient {
+ struct Impl;
+ Impl* const pimpl_;
+public:
+ DriverClient();
+ ~DriverClient();
+ virtual int open();
+ virtual int close();
+ virtual bool isOpen() const;
+ virtual int hasOpenSessions() const;
+ virtual int openSession(struct mc_ioctl_open_session& session);
+ virtual int openTrustlet(struct mc_ioctl_open_trustlet& trustlet);
+ virtual int closeSession(uint32_t session_id);
+ virtual int notify(uint32_t session_id);
+ virtual int waitNotification(const struct mc_ioctl_wait& wait);
+ virtual int malloc(uint8_t** buffer, uint32_t length);
+ virtual int free(uint8_t* buffer, uint32_t length);
+ virtual int map(struct mc_ioctl_map& map);
+ virtual int unmap(const struct mc_ioctl_map& map);
+ virtual int getError(struct mc_ioctl_geterr& err);
+ virtual int getVersion(struct mc_version_info& version_info);
+ virtual int gpRequestCancellation(uint32_t session_id);
+};
+
+#endif // __CLIENT_DRIVER_H__
diff --git a/mobicore/MobiCoreDriverLib/ClientLib/Contrib/iclient.h b/mobicore/MobiCoreDriverLib/ClientLib/Contrib/iclient.h
new file mode 100644
index 0000000..f95186c
--- /dev/null
+++ b/mobicore/MobiCoreDriverLib/ClientLib/Contrib/iclient.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2013-2015 TRUSTONIC LIMITED
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the TRUSTONIC LIMITED nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __CLIENT_INTERFACE_H__
+#define __CLIENT_INTERFACE_H__
+
+#include <stdint.h> // *int*_t
+#include <sys/types.h> // uid_t git_t
+#include "mc_user.h" // ioctl structures
+
+class IClient {
+public:
+ virtual ~IClient() {}
+ virtual int open() = 0;
+ virtual int close() = 0;
+ virtual bool isOpen() const = 0;
+ // MC protocol, also used by GP for now
+ virtual int hasOpenSessions() const = 0;
+ virtual int openSession(struct mc_ioctl_open_session& session) = 0;
+ virtual int openTrustlet(struct mc_ioctl_open_trustlet& trustlet) = 0;
+ virtual int closeSession(uint32_t session_id) = 0;
+ virtual int notify(uint32_t session_id) = 0;
+ virtual int waitNotification(const struct mc_ioctl_wait& wait) = 0;
+ virtual int malloc(uint8_t** buffer, uint32_t length) = 0;
+ virtual int free(uint8_t* buffer, uint32_t length) = 0;
+ virtual int map(struct mc_ioctl_map& map) = 0;
+ virtual int unmap(const struct mc_ioctl_map& map) = 0;
+ virtual int getError(struct mc_ioctl_geterr& err) = 0;
+ virtual int getVersion(struct mc_version_info& version_info) = 0;
+ // GP protocol only
+ virtual int gpRequestCancellation(uint32_t session_id) = 0;
+};
+
+#endif // __CLIENT_INTERFACE_H__
diff --git a/mobicore/MobiCoreDriverLib/ClientLib/Contrib/mc_client_api.cpp b/mobicore/MobiCoreDriverLib/ClientLib/Contrib/mc_client_api.cpp
new file mode 100644
index 0000000..1128b86
--- /dev/null
+++ b/mobicore/MobiCoreDriverLib/ClientLib/Contrib/mc_client_api.cpp
@@ -0,0 +1,784 @@
+/*
+ * Copyright (c) 2013-2015 TRUSTONIC LIMITED
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the TRUSTONIC LIMITED nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdint.h>
+#include <string.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <pthread.h>
+#include <stdbool.h>
+
+#undef LOG_TAG
+#define LOG_TAG "TeeMcClient"
+#include "log.h"
+#include "MobiCoreDriverApi.h"
+#include "common_client.h"
+#include "buildTag.h"
+
+static const __attribute__((used)) char* buildtag =
+ MOBICORE_COMPONENT_BUILD_TAG;
+
+//------------------------------------------------------------------------------
+
+/*
+ * On mcCloseDevice(), all mappings need to be removed, which means we need to
+ * keep them somewhere. We keep them in an array, resized when needed.
+ * Both map and length must be kept in user-space, as after a fork another
+ * mapping with same address may have appeared from the other process(es).
+ */
+struct maplen {
+ uint8_t* wsm;
+ uint32_t len;
+};
+
+static struct maplen* wsms;
+static size_t wsms_capacity, wsms_length;
+static pthread_mutex_t wsms_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+static CommonClient& client = CommonClient::getInstance();
+
+static inline int wsms_add(uint8_t* wsm, uint32_t len) {
+ int ret = 0;
+ pthread_mutex_lock(&wsms_mutex);
+ if (wsms_length == wsms_capacity) {
+ size_t new_wsms_capacity = wsms_capacity;
+ /* Need some room */
+ if (new_wsms_capacity == 0) {
+ new_wsms_capacity = 16;
+ } else {
+ new_wsms_capacity *= 2;
+ }
+ struct maplen* new_wsms = static_cast<struct maplen*>(realloc(wsms,
+ new_wsms_capacity * sizeof(*wsms)));
+ if (!new_wsms) {
+ LOG_ERRNO("resize WSMs array");
+ ret = -1;
+ } else {
+ wsms = new_wsms;
+ wsms_capacity = new_wsms_capacity;
+ }
+ }
+ if (ret == 0) {
+ wsms[wsms_length].wsm = wsm;
+ wsms[wsms_length].len = len;
+ wsms_length++;
+ }
+ pthread_mutex_unlock(&wsms_mutex);
+ return ret;
+}
+
+static inline int wsms_remove(uint8_t* wsm) {
+ int ret = 0;
+ pthread_mutex_lock(&wsms_mutex);
+ /* Find position of WSM */
+ size_t i;
+ for (i = 0; i < wsms_length; i++) {
+ if (wsms[i].wsm == wsm) {
+ break;
+ }
+ }
+ if (i == wsms_length) {
+ LOG_E("WSM %p not found in array", wsm);
+ ret = -1;
+ } else {
+ /* Replace WSM with last so the first free element remains wsms[wsms_length] */
+ wsms[i] = wsms[--wsms_length];
+ }
+ pthread_mutex_unlock(&wsms_mutex);
+ return ret;
+}
+
+static inline uint32_t wsms_len(uint8_t* wsm) {
+ uint32_t len = 0;
+ pthread_mutex_lock(&wsms_mutex);
+ for (size_t i = 0; i < wsms_length; i++) {
+ if (wsms[i].wsm == wsm) {
+ len = wsms[i].len;
+ break;
+ }
+ }
+ pthread_mutex_unlock(&wsms_mutex);
+ return len;
+}
+
+static inline struct maplen wsms_removeLast(void) {
+ struct maplen wsm;
+ pthread_mutex_lock(&wsms_mutex);
+ if (wsms_length > 0) {
+ wsm = wsms[--wsms_length];
+ } else {
+ wsm.wsm = NULL;
+ // To make Coverity happy
+ wsm.len = 0;
+ }
+ pthread_mutex_unlock(&wsms_mutex);
+ return wsm;
+}
+
+/* Only 1 device is supported */
+static inline bool isValidDevice(uint32_t deviceId) {
+ return (MC_DEVICE_ID_DEFAULT == deviceId);
+}
+
+/* Convert driver errors into tbase set */
+static mcResult_t convert_syscall_error(int32_t ret) {
+ switch (ret) {
+ case 0:
+ return MC_DRV_OK;
+ case -1:
+ switch (errno) {
+ case ENOMSG:
+ return MC_DRV_NO_NOTIFICATION;
+ case EBADMSG:
+ return MC_DRV_ERR_NOTIFICATION;
+ case ENOSPC:
+ return MC_DRV_ERR_OUT_OF_RESOURCES;
+ case EHOSTDOWN:
+ return MC_DRV_ERR_INIT;
+ case ENODEV:
+ return MC_DRV_ERR_UNKNOWN_DEVICE;
+ case ENXIO:
+ return MC_DRV_ERR_UNKNOWN_SESSION;
+ case EPERM:
+ return MC_DRV_ERR_INVALID_OPERATION;
+ case EBADE:
+ return MC_DRV_ERR_INVALID_RESPONSE;
+ case ETIME:
+ return MC_DRV_ERR_TIMEOUT;
+ case ENOMEM:
+ return MC_DRV_ERR_NO_FREE_MEMORY;
+ case EUCLEAN:
+ return MC_DRV_ERR_FREE_MEMORY_FAILED;
+ case ENOTEMPTY:
+ return MC_DRV_ERR_SESSION_PENDING;
+ case EHOSTUNREACH:
+ return MC_DRV_ERR_DAEMON_UNREACHABLE;
+ case ENOENT:
+ return MC_DRV_ERR_INVALID_DEVICE_FILE;
+ case EINVAL:
+ return MC_DRV_ERR_INVALID_PARAMETER;
+ case EPROTO:
+ return MC_DRV_ERR_KERNEL_MODULE;
+ case EADDRINUSE:
+ return MC_DRV_ERR_BULK_MAPPING;
+ case EADDRNOTAVAIL:
+ return MC_DRV_ERR_BULK_UNMAPPING;
+ case ECOMM:
+ return MC_DRV_INFO_NOTIFICATION;
+ case EUNATCH:
+ return MC_DRV_ERR_NQ_FAILED;
+ case EBADF:
+ return MC_DRV_ERR_DAEMON_DEVICE_NOT_OPEN;
+ case EINTR:
+ return MC_DRV_ERR_INTERRUPTED_BY_SIGNAL;
+ case EKEYREJECTED:
+ return MC_DRV_ERR_WRONG_PUBLIC_KEY;
+ default:
+ LOG_ERRNO("syscall");
+ return MC_DRV_ERR_UNKNOWN;
+ }
+ default:
+ LOG_E("Unknown code %d", ret);
+ return MC_DRV_ERR_UNKNOWN;
+ }
+}
+
+//------------------------------------------------------------------------------
+// CLIENT API
+//------------------------------------------------------------------------------
+__MC_CLIENT_LIB_API mcResult_t mcOpenDevice(
+ uint32_t deviceId
+) {
+ LOG_D("===%s(%i)===", __FUNCTION__, deviceId);
+
+ // Check parameters
+ if (!isValidDevice(deviceId) &&
+ (deviceId != CommonClient::DRIVER) &&
+ (deviceId != CommonClient::PROXY)) {
+ return MC_DRV_ERR_UNKNOWN_DEVICE;
+ }
+
+ // For test purpose
+ switch (deviceId) {
+ case CommonClient::DRIVER:
+ client.setOpenMode(CommonClient::DRIVER);
+ break;
+ case CommonClient::PROXY:
+ client.setOpenMode(CommonClient::PROXY);
+ break;
+ }
+
+ if (client.open()) {
+ return convert_syscall_error(-1);
+ }
+
+ return MC_DRV_OK;
+}
+
+
+//------------------------------------------------------------------------------
+__MC_CLIENT_LIB_API mcResult_t mcCloseDevice(
+ uint32_t deviceId
+) {
+ LOG_D("===%s(%i)===", __FUNCTION__, deviceId);
+
+ // Check parameters
+ if (!isValidDevice(deviceId)) {
+ return MC_DRV_ERR_UNKNOWN_DEVICE;
+ }
+
+ // Check whether there are still some 'devices open'
+ if (client.closeCheck() == 0) {
+ return MC_DRV_OK;
+ }
+
+ // Check that all sessions are closed for client
+ mcResult_t mcResult = convert_syscall_error(client.hasOpenSessions());
+ if (mcResult != MC_DRV_OK) {
+ return mcResult;
+ }
+
+ // Free all remaining WSMs
+ while (true) {
+ struct maplen wsm = wsms_removeLast();
+ if (wsm.wsm == NULL) {
+ break;
+ }
+ mcFreeWsm(deviceId, wsm.wsm);
+ }
+
+ // Close the device
+ client.close();
+ return MC_DRV_OK;
+}
+
+
+//------------------------------------------------------------------------------
+__MC_CLIENT_LIB_API mcResult_t mcOpenSession(
+ mcSessionHandle_t* session,
+ const mcUuid_t* uuid,
+ uint8_t* tci,
+ uint32_t len
+) {
+ mcResult_t mcResult = MC_DRV_ERR_UNKNOWN;
+ struct mc_ioctl_open_session sess;
+ int ret;
+
+ LOG_D("===%s()===", __FUNCTION__);
+
+ do {
+ // Check parameters
+ if (!session) {
+ mcResult = MC_DRV_ERR_INVALID_PARAMETER;
+ break;
+ }
+ if (!isValidDevice(session->deviceId)) {
+ mcResult = MC_DRV_ERR_UNKNOWN_DEVICE;
+ break;
+ }
+ if (!uuid) {
+ mcResult = MC_DRV_ERR_INVALID_PARAMETER;
+ break;
+ }
+
+ // Call ioctl
+ sess.sid = 0;
+ memcpy( (void*)&sess.uuid, uuid, sizeof(sess.uuid) );
+ sess.tci = (uintptr_t)tci;
+ sess.tcilen = len;
+ sess.is_gp_uuid = false;
+ sess.identity.login_type = LOGIN_PUBLIC;
+ sess.identity.pid = 0;
+ ret = client.openSession(sess);
+ mcResult = convert_syscall_error(ret);
+ if (MC_DRV_OK != mcResult) {
+ break;
+ }
+
+ // Fill in return parameters
+ session->sessionId = sess.sid;
+ } while (false);
+
+ /* Legacy error matching */
+ if (MC_DRV_OK != mcResult) {
+ if (MC_DRV_ERR_UNKNOWN == mcResult) {
+ mcResult = MC_DRV_ERR_INVALID_PARAMETER;
+ }
+
+ LOG_E("return 0x%x", mcResult);
+ }
+
+ return mcResult;
+}
+
+//------------------------------------------------------------------------------
+__MC_CLIENT_LIB_API mcResult_t mcOpenTrustlet(
+ mcSessionHandle_t* session,
+ mcSpid_t spid,
+ uint8_t* trustlet,
+ uint32_t tLen,
+ uint8_t* tci,
+ uint32_t tciLen
+) {
+ mcResult_t mcResult = MC_DRV_ERR_UNKNOWN;
+ struct mc_ioctl_open_trustlet trus;
+ int ret;
+
+ LOG_D("===%s()===", __FUNCTION__);
+
+ do {
+ // Check parameters
+ if (!session) {
+ LOG_E("Session handle is null");
+ mcResult = MC_DRV_ERR_INVALID_PARAMETER;
+ break;
+ }
+ if (!isValidDevice(session->deviceId)) {
+ mcResult = MC_DRV_ERR_UNKNOWN_DEVICE;
+ break;
+ }
+
+ // Call ioctl
+ trus.sid = 0;
+ trus.spid = spid;
+ trus.buffer = (uintptr_t)trustlet;
+ trus.tlen = tLen;
+ trus.tci = (uintptr_t)tci;
+ trus.tcilen = tciLen;
+ ret = client.openTrustlet(trus);
+ mcResult = convert_syscall_error(ret);
+
+ // Fill in return parameters
+ if (MC_DRV_OK == mcResult) {
+ session->sessionId = trus.sid;
+ }
+
+ } while (false);
+
+ /* Legacy error matching */
+ if (MC_DRV_OK != mcResult) {
+ if (MC_DRV_ERR_UNKNOWN == mcResult) {
+ mcResult = MC_DRV_ERR_INVALID_PARAMETER;
+ }
+
+ LOG_E("return 0x%x", mcResult);
+ }
+
+ return mcResult;
+}
+
+
+//------------------------------------------------------------------------------
+__MC_CLIENT_LIB_API mcResult_t mcCloseSession(
+ mcSessionHandle_t* session
+) {
+ mcResult_t mcResult = MC_DRV_ERR_UNKNOWN;
+ int ret;
+
+ LOG_D("===%s()===", __FUNCTION__);
+
+ do {
+ // Check parameters
+ if (!session) {
+ LOG_E("Session handle is null");
+ mcResult = MC_DRV_ERR_INVALID_PARAMETER;
+ break;
+ }
+ if (!isValidDevice(session->deviceId)) {
+ mcResult = MC_DRV_ERR_UNKNOWN_DEVICE;
+ break;
+ }
+
+ // Call ioctl
+ ret = client.closeSession(session->sessionId);
+ mcResult = convert_syscall_error(ret);
+
+ } while (false);
+
+ return mcResult;
+}
+
+
+//------------------------------------------------------------------------------
+__MC_CLIENT_LIB_API mcResult_t mcNotify(
+ mcSessionHandle_t* session
+) {
+ mcResult_t mcResult = MC_DRV_ERR_UNKNOWN;
+ int ret;
+
+ LOG_D("===%s()===", __FUNCTION__);
+
+ do {
+ // Check parameters
+ if (!session) {
+ LOG_E("Session handle is null");
+ mcResult = MC_DRV_ERR_INVALID_PARAMETER;
+ break;
+ }
+ if (!isValidDevice(session->deviceId)) {
+ mcResult = MC_DRV_ERR_UNKNOWN_DEVICE;
+ break;
+ }
+
+ // Call ioctl
+ ret = client.notify(session->sessionId);
+ mcResult = convert_syscall_error(ret);
+
+ } while (false);
+
+ return mcResult;
+}
+
+
+//------------------------------------------------------------------------------
+__MC_CLIENT_LIB_API mcResult_t mcWaitNotification(
+ mcSessionHandle_t* session,
+ int32_t timeout
+) {
+ mcResult_t mcResult = MC_DRV_ERR_UNKNOWN;
+ struct mc_ioctl_wait wait;
+ int ret;
+
+ LOG_D("===%s()===", __FUNCTION__);
+
+ do {
+ // Check parameters
+ if (!session) {
+ LOG_E("Session handle is null");
+ mcResult = MC_DRV_ERR_INVALID_PARAMETER;
+ break;
+ }
+ if (!isValidDevice(session->deviceId)) {
+ mcResult = MC_DRV_ERR_UNKNOWN_DEVICE;
+ break;
+ }
+
+ // Call ioctl
+ wait.sid = session->sessionId;
+ wait.timeout = timeout;
+ do {
+ ret = client.waitNotification(wait);
+ mcResult = convert_syscall_error(ret);
+ } while (MC_INFINITE_TIMEOUT == timeout &&
+ MC_DRV_ERR_INTERRUPTED_BY_SIGNAL == mcResult);
+
+ } while (false);
+
+ return mcResult;
+}
+
+
+//------------------------------------------------------------------------------
+__MC_CLIENT_LIB_API mcResult_t mcMallocWsm(
+ uint32_t deviceId,
+ uint32_t align,
+ uint32_t len,
+ uint8_t** wsm,
+ uint32_t wsmFlags
+) {
+ (void) align;
+ (void) wsmFlags;
+ mcResult_t mcResult = MC_DRV_ERR_UNKNOWN;
+ LOG_D("===%s(len=%i)===", __FUNCTION__, len);
+
+ do {
+ // Check parameters
+ if (!isValidDevice(deviceId)) {
+ mcResult = MC_DRV_ERR_UNKNOWN_DEVICE;
+ break;
+ }
+ if (!client.isOpen()) {
+ LOG_E("Client not open");
+ mcResult = MC_DRV_ERR_DAEMON_DEVICE_NOT_OPEN;
+ break;
+ }
+ if (!wsm) {
+ LOG_E("Wsm pointer is null");
+ mcResult = MC_DRV_ERR_INVALID_PARAMETER;
+ break;
+ }
+ // Alloc and map kernel buffer into user space
+ if (client.malloc(wsm, len)) {
+ mcResult = convert_syscall_error(-1);
+ break;
+ }
+ wsms_add(*wsm, len);
+ mcResult = MC_DRV_OK;
+
+ } while (false);
+
+ return mcResult;
+}
+
+
+//------------------------------------------------------------------------------
+// Note: mcFreeWsm() only succeeds if wsm is as returned by mcMallocWsm().
+__MC_CLIENT_LIB_API mcResult_t mcFreeWsm(
+ uint32_t deviceId,
+ uint8_t* wsm
+) {
+ mcResult_t mcResult = MC_DRV_ERR_UNKNOWN;
+
+ LOG_D("===%s(%p)===", __FUNCTION__, wsm);
+
+ do {
+ // Check parameters
+ if (!isValidDevice(deviceId)) {
+ mcResult = MC_DRV_ERR_UNKNOWN_DEVICE;
+ break;
+ }
+ if (!client.isOpen()) {
+ LOG_E("Client not open");
+ mcResult = MC_DRV_ERR_DAEMON_DEVICE_NOT_OPEN;
+ break;
+ }
+ // Get mapping length
+ uint32_t len = wsms_len(wsm);
+ if (len == 0) {
+ LOG_E("wsm %p length not available", wsm);
+ mcResult = MC_DRV_ERR_INVALID_PARAMETER;
+ } else {
+ // Unmap and free kernel buffer
+ int ret = client.free(wsm, len);
+ mcResult = convert_syscall_error(ret);
+ if (ret == 0) {
+ wsms_remove(wsm);
+ }
+ }
+ } while (false);
+
+ return mcResult;
+}
+
+//------------------------------------------------------------------------------
+__MC_CLIENT_LIB_API mcResult_t mcMap(
+ mcSessionHandle_t* session,
+ void* buf,
+ uint32_t bufLen,
+ mcBulkMap_t* mapInfo
+) {
+ mcResult_t mcResult = MC_DRV_ERR_UNKNOWN;
+ struct mc_ioctl_map map;
+ int ret;
+
+ LOG_D("===%s()===", __FUNCTION__);
+
+ do {
+ // Check parameters
+ if (!session) {
+ LOG_E("Session handle is null");
+ mcResult = MC_DRV_ERR_INVALID_PARAMETER;
+ break;
+ }
+ if (!isValidDevice(session->deviceId)) {
+ mcResult = MC_DRV_ERR_UNKNOWN_DEVICE;
+ break;
+ }
+ if (!mapInfo) {
+ LOG_E("mapInfo pointer is null");
+ mcResult = MC_DRV_ERR_INVALID_PARAMETER;
+ break;
+ }
+
+ // Call ioctl
+ map.sid = session->sessionId;
+ map.bufs[0].va = (uintptr_t)buf;
+ map.bufs[0].len = bufLen;
+ map.bufs[0].flags = MC_IO_MAP_INPUT_OUTPUT;
+ LOG_D("map va=%llx len=%u", map.bufs[0].va, map.bufs[0].len);
+ for (int i = 1; i < MC_MAP_MAX; i++) {
+ map.bufs[i].va = 0;
+ }
+ ret = client.map(map);
+ mcResult = convert_syscall_error(ret);
+ if (MC_DRV_OK != mcResult) {
+ break;
+ }
+ LOG_D("map'd va=%llx len=%u sva=%llx",
+ map.bufs[0].va, map.bufs[0].len, map.bufs[0].sva);
+
+ // Fill in return parameters
+#if ( __WORDSIZE != 64 )
+ mapInfo->sVirtualAddr = (void*)(uintptr_t)map.bufs[0].sva;
+#else
+ mapInfo->sVirtualAddr = (uint32_t)map.bufs[0].sva;
+#endif
+ mapInfo->sVirtualLen = map.bufs[0].len;
+ } while (false);
+
+ /* Legacy error matching */
+ if (MC_DRV_OK != mcResult) {
+ if (MC_DRV_ERR_UNKNOWN == mcResult) {
+ mcResult = MC_DRV_ERR_BULK_MAPPING;
+ }
+
+ LOG_E("return 0x%x", mcResult);
+ }
+
+ return mcResult;
+}
+
+//------------------------------------------------------------------------------
+__MC_CLIENT_LIB_API mcResult_t mcUnmap(
+ mcSessionHandle_t* session,
+ void* buf,
+ mcBulkMap_t* mapInfo
+) {
+ mcResult_t mcResult = MC_DRV_ERR_UNKNOWN;
+ struct mc_ioctl_map map;
+ int ret;
+
+ LOG_D("===%s()===", __FUNCTION__);
+
+ do {
+ // Check parameters
+ if (!session) {
+ LOG_E("Session handle is null");
+ mcResult = MC_DRV_ERR_INVALID_PARAMETER;
+ break;
+ }
+ if (!isValidDevice(session->deviceId)) {
+ mcResult = MC_DRV_ERR_UNKNOWN_DEVICE;
+ break;
+ }
+ if (!mapInfo) {
+ LOG_E("mapInfo pointer is null");
+ mcResult = MC_DRV_ERR_INVALID_PARAMETER;
+ break;
+ }
+
+ // Call ioctl
+ map.sid = session->sessionId;
+ map.bufs[0].va = (uintptr_t)buf;
+ map.bufs[0].sva = (uintptr_t)mapInfo->sVirtualAddr;
+ map.bufs[0].len = mapInfo->sVirtualLen;
+ LOG_D("unmap va=%llx len=%u sva=%llx",
+ map.bufs[0].va, map.bufs[0].len, map.bufs[0].sva);
+ for (int i = 1; i < MC_MAP_MAX; i++) {
+ map.bufs[i].va = 0;
+ }
+ ret = client.unmap(map);
+ mcResult = convert_syscall_error(ret);
+
+ } while (false);
+
+ if (MC_DRV_OK != mcResult) {
+ if (MC_DRV_ERR_UNKNOWN == mcResult) {
+ mcResult = MC_DRV_ERR_BULK_UNMAPPING;
+ }
+
+ LOG_E("return 0x%x", mcResult);
+ }
+
+ return mcResult;
+}
+
+
+//------------------------------------------------------------------------------
+__MC_CLIENT_LIB_API mcResult_t mcGetSessionErrorCode(
+ mcSessionHandle_t* session,
+ int32_t* lastErr
+) {
+ mcResult_t mcResult = MC_DRV_ERR_UNKNOWN;
+ struct mc_ioctl_geterr err;
+ int ret;
+
+ LOG_D("===%s()===", __FUNCTION__);
+
+ do {
+ // Check parameters
+ if (!session) {
+ LOG_E("Session handle is null");
+ mcResult = MC_DRV_ERR_INVALID_PARAMETER;
+ break;
+ }
+ if (!isValidDevice(session->deviceId)) {
+ mcResult = MC_DRV_ERR_UNKNOWN_DEVICE;
+ break;
+ }
+ if (!lastErr) {
+ mcResult = MC_DRV_ERR_INVALID_PARAMETER;
+ break;
+ }
+
+ // Call ioctl
+ err.sid = session->sessionId;
+ ret = client.getError(err);
+ mcResult = convert_syscall_error(ret);
+ if (MC_DRV_OK != mcResult) {
+ break;
+ }
+
+ // Fill in return parameters
+ *lastErr = err.value;
+
+ } while (false);
+
+ return mcResult;
+}
+
+//------------------------------------------------------------------------------
+__MC_CLIENT_LIB_API mcResult_t mcGetMobiCoreVersion(
+ uint32_t deviceId,
+ mcVersionInfo_t* versionInfo
+) {
+ mcResult_t mcResult = MC_DRV_ERR_UNKNOWN;
+ int ret;
+
+ LOG_D("===%s()===", __FUNCTION__);
+
+ do {
+ // Check parameters
+ if (!isValidDevice(deviceId)) {
+ mcResult = MC_DRV_ERR_UNKNOWN_DEVICE;
+ break;
+ }
+ if (!versionInfo) {
+ LOG_E("versionInfo pointer is null");
+ mcResult = MC_DRV_ERR_INVALID_PARAMETER;
+ break;
+ }
+
+ struct mc_version_info version_info;
+ ret = client.getVersion(version_info);
+ if (!ret) {
+ memcpy(versionInfo, &version_info, sizeof(*versionInfo));
+ }
+ mcResult = convert_syscall_error(ret);
+ } while (false);
+
+ return mcResult;
+}
diff --git a/mobicore/MobiCoreDriverLib/ClientLib/Contrib/mc_user.h b/mobicore/MobiCoreDriverLib/ClientLib/Contrib/mc_user.h
new file mode 100644
index 0000000..7c2df39
--- /dev/null
+++ b/mobicore/MobiCoreDriverLib/ClientLib/Contrib/mc_user.h
@@ -0,0 +1,178 @@
+/*
+ * Copyright (c) 2013-2015 TRUSTONIC LIMITED
+ * All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _MC_USER_H_
+#define _MC_USER_H_
+
+#define MCDRVMODULEAPI_VERSION_MAJOR 2
+#define MCDRVMODULEAPI_VERSION_MINOR 1
+
+#include <linux/types.h>
+
+#define MC_USER_DEVNODE "mobicore-user"
+
+/** Maximum length of MobiCore product ID string. */
+#define MC_PRODUCT_ID_LEN 64
+
+/** Number of buffers that can be mapped at once */
+#define MC_MAP_MAX 4
+
+/** Max length for buffers */
+#define BUFFER_LENGTH_MAX 0x100000
+
+/** Flags for buffers to map (aligned on GP) */
+#define MC_IO_MAP_INPUT 0x1
+#define MC_IO_MAP_OUTPUT 0x2
+#define MC_IO_MAP_INPUT_OUTPUT (MC_IO_MAP_INPUT | MC_IO_MAP_OUTPUT)
+
+/*
+ * Universally Unique Identifier (UUID) according to ISO/IEC 11578.
+ */
+struct mc_uuid_t {
+ __u8 value[16]; /* Value of the UUID. */
+};
+
+/*
+ * GP TA login types.
+ */
+enum mc_login_type {
+ LOGIN_PUBLIC = 0,
+ LOGIN_USER,
+ LOGIN_GROUP,
+ LOGIN_APPLICATION = 4,
+ LOGIN_USER_APPLICATION,
+ LOGIN_GROUP_APPLICATION,
+};
+
+/*
+ * GP TA identity structure.
+ */
+struct mc_identity {
+ enum mc_login_type login_type;
+ union {
+ __u8 login_data[16];
+ gid_t gid; /* Requested group id */
+ struct {
+ uid_t euid;
+ uid_t ruid;
+ } uid;
+ };
+ pid_t pid; /* Client, when using proxy */
+};
+
+/*
+ * Data exchange structure of the MC_IO_OPEN_SESSION ioctl command.
+ */
+struct mc_ioctl_open_session {
+ struct mc_uuid_t uuid; /* trustlet uuid */
+ __u32 is_gp_uuid; /* uuid is for GP TA */
+ __u32 sid; /* session id (out) */
+ __u64 tci; /* tci buffer pointer */
+ __u32 tcilen; /* tci length */
+ struct mc_identity identity; /* GP TA identity */
+};
+
+/*
+ * Data exchange structure of the MC_IO_OPEN_TRUSTLET ioctl command.
+ */
+struct mc_ioctl_open_trustlet {
+ __u32 sid; /* session id (out) */
+ __u32 spid; /* trustlet spid */
+ __u64 buffer; /* trustlet binary pointer */
+ __u32 tlen; /* binary length */
+ __u64 tci; /* tci buffer pointer */
+ __u32 tcilen; /* tci length */
+};
+
+/*
+ * Data exchange structure of the MC_IO_WAIT ioctl command.
+ */
+struct mc_ioctl_wait {
+ __u32 sid; /* session id (in) */
+ __s32 timeout; /* notification timeout */
+ __u32 partial; /* for proxy server to retry silently */
+};
+
+/*
+ * Data exchange structure of the MC_IO_ALLOC ioctl command.
+ */
+struct mc_ioctl_alloc {
+ __u32 len; /* buffer length */
+ __u32 handle; /* user handle for the buffer (out) */
+};
+
+/*
+ * Buffer mapping incoming and outgoing information.
+ */
+struct mc_ioctl_buffer {
+ __u64 va; /* user space address of buffer */
+ __u32 len; /* buffer length */
+ __u64 sva; /* SWd virt address of buffer (out) */
+ __u32 flags; /* buffer flags */
+};
+
+/*
+ * Data exchange structure of the MC_IO_MAP and MC_IO_UNMAP ioctl commands.
+ */
+struct mc_ioctl_map {
+ __u32 sid; /* session id */
+ struct mc_ioctl_buffer bufs[MC_MAP_MAX]; /* buffers info */
+};
+
+/*
+ * Data exchange structure of the MC_IO_ERR ioctl command.
+ */
+struct mc_ioctl_geterr {
+ __u32 sid; /* session id */
+ __s32 value; /* error value (out) */
+};
+
+/*
+ * Global MobiCore Version Information.
+ */
+struct mc_version_info {
+ char product_id[MC_PRODUCT_ID_LEN]; /** Product ID string */
+ __u32 version_mci; /** Mobicore Control Interface */
+ __u32 version_so; /** Secure Objects */
+ __u32 version_mclf; /** MobiCore Load Format */
+ __u32 version_container; /** MobiCore Container Format */
+ __u32 version_mc_config; /** MobiCore Config. Block Format */
+ __u32 version_tl_api; /** MobiCore Trustlet API */
+ __u32 version_dr_api; /** MobiCore Driver API */
+ __u32 version_nwd; /** This Driver */
+};
+
+/*
+ * defines for the ioctl mobicore driver module function call from user space.
+ */
+/* MobiCore IOCTL magic number */
+#define MC_IOC_MAGIC 'M'
+
+/*
+ * Implement corresponding functions from user api
+ */
+#define MC_IO_OPEN_SESSION \
+ _IOWR(MC_IOC_MAGIC, 0, struct mc_ioctl_open_session)
+#define MC_IO_OPEN_TRUSTLET \
+ _IOWR(MC_IOC_MAGIC, 1, struct mc_ioctl_open_trustlet)
+#define MC_IO_CLOSE_SESSION _IO(MC_IOC_MAGIC, 2)
+#define MC_IO_NOTIFY _IO(MC_IOC_MAGIC, 3)
+#define MC_IO_WAIT _IOW(MC_IOC_MAGIC, 4, struct mc_ioctl_wait)
+#define MC_IO_MAP _IOWR(MC_IOC_MAGIC, 5, struct mc_ioctl_map)
+#define MC_IO_UNMAP _IOW(MC_IOC_MAGIC, 6, struct mc_ioctl_map)
+#define MC_IO_ERR _IOWR(MC_IOC_MAGIC, 7, struct mc_ioctl_geterr)
+#define MC_IO_HAS_SESSIONS _IO(MC_IOC_MAGIC, 8)
+#define MC_IO_VERSION _IOR(MC_IOC_MAGIC, 9, struct mc_version_info)
+
+#endif /* _MC_USER_H_ */
diff --git a/mobicore/MobiCoreDriverLib/ClientLib/Contrib/proxy_client.cpp b/mobicore/MobiCoreDriverLib/ClientLib/Contrib/proxy_client.cpp
new file mode 100644
index 0000000..a290c2b
--- /dev/null
+++ b/mobicore/MobiCoreDriverLib/ClientLib/Contrib/proxy_client.cpp
@@ -0,0 +1,820 @@
+/*
+ * Copyright (c) 2013-2015 TRUSTONIC LIMITED
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the TRUSTONIC LIMITED nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <memory>
+#include <mutex>
+#include <string>
+#include <vector>
+
+#include <string.h> // strncpy
+#include <sys/mman.h> // mmap, munmap
+#include <sys/socket.h>
+#include <sys/un.h>
+
+#undef LOG_TAG
+#define LOG_TAG "TeeProxyClient"
+#include "log.h"
+#include "mcVersionHelper.h"
+#include "proxy_common.h"
+#include "proxy_client.h"
+
+using namespace com::trustonic::tee_proxy;
+
+class ClientConnection {
+ std::string buffer_;
+ std::mutex comm_mutex_;
+ std::mutex comm_queue_mutex_;
+ int socket_ = -1;
+ bool is_open_ = false;
+ bool is_broken_ = false;
+ Session* session_ = nullptr;
+public:
+ ~ClientConnection() {
+ if (is_open_) {
+ close();
+ }
+ delete session_;
+ }
+ int open() {
+ socket_ = ::socket(AF_UNIX, SOCK_STREAM, 0);
+ if (socket_ < 0) {
+ LOG_ERRNO("socket");
+ return -1;
+ }
+ struct sockaddr_un sock_un;
+ sock_un.sun_family = AF_UNIX;
+ ::strncpy(sock_un.sun_path, SOCKET_PATH, sizeof(sock_un.sun_path) - 1);
+ socklen_t len = static_cast<socklen_t>(strlen(sock_un.sun_path) +
+ sizeof(sock_un.sun_family));
+ sock_un.sun_path[0] = '\0'; // Abstract
+ if (::connect(socket_, reinterpret_cast<struct sockaddr*>(&sock_un),
+ len) < 0) {
+ LOG_ERRNO("connect");
+ return -1;
+ }
+ is_open_ = true;
+ LOG_D("socket %d connected", socket_);
+ return 0;
+ }
+ int close() {
+ ::close(socket_);
+ is_open_ = false;
+ LOG_D("socket %d session %x closed", socket_, session_ ? session_->id() : 0);
+ return 0;
+ }
+ bool isBroken() const {
+ return is_broken_;
+ }
+ void setSession(Session* session) {
+ session_ = session;
+ }
+ Session* session() const {
+ return session_;
+ }
+ int call(RpcMethod method, const ::google::protobuf::MessageLite& request,
+ ::google::protobuf::MessageLite& response) {
+ // Trick to ensure round-robin access to two callers
+ comm_queue_mutex_.lock();
+ std::lock_guard<std::mutex> comm_lock(comm_mutex_);
+ comm_queue_mutex_.unlock();
+ LOG_D("socket %d session %x call %s", socket_,
+ session_ ? session_->id() : 0, methodToString(method));
+
+ // Request
+ {
+ // Serialize request
+ if (!request.SerializeToString(&buffer_)) {
+ LOG_E("Failed to serialize");
+ is_broken_ = true;
+ return -1;
+ }
+
+ // Send request header
+ RequestHeader header;
+ ::memcpy(header.magic, PROTOCOL_MAGIC, sizeof(header.magic));
+ header.version = PROTOCOL_VERSION;
+ header.method = static_cast<uint16_t>(method);
+ header.length = static_cast<uint32_t>(buffer_.length());
+ if (send_all(socket_, "header", &header, sizeof(header))) {
+ is_broken_ = true;
+ return -1;
+ }
+
+ // Send request data
+ LOG_D("send %u bytes of data", header.length);
+ if (send_all(socket_, "data", &buffer_[0], header.length)) {
+ is_broken_ = true;
+ return -1;
+ }
+ }
+
+ // Response
+ {
+ // Receive response header
+ ResponseHeader header;
+ if (recv_all(socket_, "header", &header, sizeof(header))) {
+ is_broken_ = true;
+ return -1;
+ }
+
+ // Check header
+ if (::memcmp(header.magic, PROTOCOL_MAGIC, sizeof(header.magic))) {
+ LOG_E("Wrong magic");
+ is_broken_ = true;
+ return -1;
+ }
+ if (header.version != PROTOCOL_VERSION) {
+ LOG_E("Wrong version");
+ is_broken_ = true;
+ return -1;
+ }
+ if (header.proto_rc < 0) {
+ errno = -header.proto_rc;
+ LOG_E("Protocol error reported: %s",
+ strerror(-header.proto_rc));
+ is_broken_ = true;
+ return -1;
+ }
+
+ // Receive response data
+ LOG_D("receive %d bytes of data", header.proto_rc);
+ if (header.proto_rc != 0) {
+ // Receive response data
+ int length = header.proto_rc;
+ buffer_.resize(length);
+ if (recv_all(socket_, "data", &buffer_[0], length)) {
+ is_broken_ = true;
+ return -1;
+ }
+
+ // Parse response
+ if (!response.ParseFromString(buffer_)) {
+ LOG_E("Failed to parse");
+ is_broken_ = true;
+ return -1;
+ }
+ }
+
+ // Method errors do not require specific method action
+ if (header.method_rc) {
+ errno = header.method_rc;
+ LOG_D("Error reported: %s", strerror(errno));
+ return -1;
+ }
+ }
+ LOG_D("socket %d session %x call done", socket_,
+ session_ ? session_->id() : 0);
+ return 0;
+ }
+};
+
+class SessionConnectionsList {
+ std::mutex mutex_;
+ std::vector<ClientConnection*> connections_;
+public:
+ ClientConnection* find(uint32_t id) {
+ std::lock_guard<std::mutex> lock(mutex_);
+ for (auto& connection: connections_) {
+ if (connection->session()->id() == id) {
+ return connection;
+ }
+ }
+ return nullptr;
+ }
+ int deleteConnection(uint32_t id) {
+ LOG_D("%s %p: %x", __FUNCTION__, this, id);
+ std::lock_guard<std::mutex> lock(mutex_);
+ auto it = std::find_if(connections_.begin(), connections_.end(),
+ [this, id](ClientConnection* connection) {
+ return connection->session()->id() == id;
+ });
+ if (it == connections_.end()) {
+ // Not found
+ return -1;
+ }
+ delete *it;
+ connections_.erase(it);
+ return 0;
+ }
+ void push_back(ClientConnection* connection) {
+ LOG_D("%s %p: %x", __FUNCTION__, this, connection->session()->id());
+ std::lock_guard<std::mutex> lock(mutex_);
+ connections_.push_back(connection);
+ }
+ bool empty() const {
+ return connections_.empty();
+ }
+};
+
+struct ProxyClient::Impl {
+ bool is_open_;
+ // Versions
+ mc_version_info version_info;
+ // Sessions
+ SessionConnectionsList connections;
+ Impl(): is_open_(false) {
+ ::memset(&version_info, 0, sizeof(version_info));
+ }
+ int getVersion(ClientConnection& conn, struct mc_version_info& version_info);
+};
+
+ProxyClient::ProxyClient(): pimpl_(new Impl) {
+}
+
+ProxyClient::~ProxyClient() {
+ delete pimpl_;
+}
+
+int ProxyClient::open() {
+ ClientConnection conn;
+ if (conn.open()) {
+ return -1;
+ }
+ // Cache versions
+ if (pimpl_->getVersion(conn, pimpl_->version_info)) {
+ return -1;
+ }
+ conn.close();
+ pimpl_->is_open_ = true;
+ LOG_I("proxy client open");
+ return 0;
+}
+
+int ProxyClient::close() {
+ pimpl_->is_open_ = false;
+ LOG_I("proxy client closed");
+ return 0;
+}
+
+bool ProxyClient::isOpen() const {
+ return pimpl_->is_open_;
+}
+
+int ProxyClient::hasOpenSessions() const {
+ int ret = 0;
+ if (!pimpl_->connections.empty()) {
+ ret = -1;
+ errno = ENOTEMPTY;
+ }
+ LOG_D("%s rc=%d", __FUNCTION__, ret);
+ return ret;
+}
+
+int ProxyClient::openSession(struct mc_ioctl_open_session& session) {
+ LOG_I("tci 0x%llx len %u", session.tci, session.tcilen);
+ if ((session.tci && !session.tcilen) ||
+ (!session.tci && session.tcilen)) {
+ LOG_E("TCI and its length are inconsistent");
+ errno = EINVAL;
+ return -1;
+ }
+ // So we return the correct error code
+ if (session.tcilen > BUFFER_LENGTH_MAX) {
+ errno = EINVAL;
+ return -1;
+ }
+ // Open the session
+ void* tci = reinterpret_cast<void*>(static_cast<uintptr_t>(session.tci));
+ int saved_errno = errno;
+ errno = EHOSTUNREACH;
+ // Request
+ OpenSessionRequest request;
+ request.set_uuid(static_cast<void*>(&session.uuid), sizeof(session.uuid));
+ request.set_is_gp_uuid(session.is_gp_uuid);
+ if (tci) {
+ request.set_tci(tci, session.tcilen);
+ }
+ request.set_login_type(static_cast<LoginType>(session.identity.login_type));
+ request.set_login_data(static_cast<void*>(session.identity.login_data),
+ sizeof(session.identity.login_data));
+ // Create connection
+ std::unique_ptr<ClientConnection> conn(new ClientConnection);
+ if (conn->open()) {
+ LOG_E("Failed to open connection");
+ return -1;
+ }
+ // Exchange
+ OpenSessionResponse response;
+ if (conn->call(OPEN_SESSION, request, response)) {
+ // Error logged in call()
+ return -1;
+ }
+ // Response
+ if (!response.has_id()) {
+ LOG_E("Required parameter missing");
+ return -1;
+ }
+ // Success
+ errno = saved_errno;
+ session.sid = response.id();
+ LOG_D("session %x open", session.sid);
+ Session::Buffer* buffer;
+ if (tci) {
+ buffer = new Session::Buffer(tci, session.tcilen);
+ } else {
+ buffer = nullptr;
+ }
+ conn->setSession(new Session(session.sid, buffer));
+ pimpl_->connections.push_back(conn.release());
+ return 0;
+}
+
+int ProxyClient::openTrustlet(struct mc_ioctl_open_trustlet& trustlet) {
+ LOG_D("tci 0x%llx len %u", trustlet.tci, trustlet.tcilen);
+ if ((trustlet.tci && !trustlet.tcilen) ||
+ (!trustlet.tci && trustlet.tcilen)) {
+ LOG_E("TCI and its length are inconsistent");
+ return -1;
+ }
+ // So we return the correct error code
+ if (trustlet.tcilen > BUFFER_LENGTH_MAX) {
+ errno = EINVAL;
+ return -1;
+ }
+ // Open the trustlet
+ void* app = reinterpret_cast<void*>(static_cast<uintptr_t>(trustlet.buffer));
+ void* tci = reinterpret_cast<void*>(static_cast<uintptr_t>(trustlet.tci));
+ int saved_errno = errno;
+ errno = EHOSTUNREACH;
+ // Request
+ OpenTrustletRequest request;
+ request.set_spid(trustlet.spid);
+ request.set_trustapp(app, trustlet.tlen);
+ if (tci) {
+ request.set_tci(tci, trustlet.tcilen);
+ }
+ // Create connection
+ std::unique_ptr<ClientConnection> conn(new ClientConnection);
+ if (conn->open()) {
+ LOG_E("Failed to open connection");
+ return -1;
+ }
+ // Exchange
+ OpenTrustletResponse response;
+ if (conn->call(OPEN_TRUSTLET, request, response)) {
+ // Error logged in call()
+ return -1;
+ }
+ // Response
+ if (!response.has_id()) {
+ LOG_E("Required parameter missing");
+ return -1;
+ }
+ // Success
+ errno = saved_errno;
+ trustlet.sid = response.id();
+ LOG_D("session %x open", trustlet.sid);
+ // Create session management object
+ Session::Buffer* buffer;
+ if (tci) {
+ buffer = new Session::Buffer(tci, trustlet.tcilen);
+ } else {
+ buffer = nullptr;
+ }
+ conn->setSession(new Session(trustlet.sid, buffer));
+ pimpl_->connections.push_back(conn.release());
+ return 0;
+}
+
+int ProxyClient::closeSession(uint32_t session_id) {
+ LOG_D("session %x close", session_id);
+ // Find session connection
+ auto connection = pimpl_->connections.find(session_id);
+ if (!connection) {
+ errno = ENXIO;
+ return -1;
+ }
+ int saved_errno = errno;
+ errno = EHOSTUNREACH;
+ // Request
+ CloseSessionRequest request;
+ request.set_id(session_id);
+ // Exchange
+ CloseSessionResponse response;
+ if (connection->call(CLOSE_SESSION, request, response)) {
+ // Error logged in call()
+ if (connection->isBroken()) {
+ pimpl_->connections.deleteConnection(session_id);
+ }
+ return -1;
+ }
+ // No response
+ // Success
+ errno = saved_errno;
+ if (pimpl_->connections.deleteConnection(session_id)) {
+ errno = ENXIO;
+ return -1;
+ }
+ LOG_D("session %x closed", session_id);
+ return 0;
+}
+
+int ProxyClient::notify(uint32_t session_id) {
+ LOG_D("session %x notify", session_id);
+ // Find session connection
+ auto connection = pimpl_->connections.find(session_id);
+ if (!connection) {
+ errno = ENXIO;
+ return -1;
+ }
+ int saved_errno = errno;
+ errno = EHOSTUNREACH;
+ // Request
+ NotifyRequest request;
+ request.set_sid(session_id);
+ auto session = connection->session();
+ if (session->hasTci()) {
+ request.set_tci(session->tci(), session->tciLen());
+ }
+ std::lock_guard<std::mutex> buffers_lock(session->buffersMutex());
+ auto& buffers = session->buffers();
+ for (auto& buf: buffers) {
+ if (buf->info().flags & MC_IO_MAP_INPUT) {
+ NotifyRequest_Buffers* buffer = request.add_buffers();
+ buffer->set_sva(buf->info().sva);
+ buffer->set_data(buf->address(), buf->info().len);
+ }
+ }
+ // Exchange
+ NotifyResponse response;
+ if (connection->call(NOTIFY, request, response)) {
+ // Error logged in call()
+ if (connection->isBroken()) {
+ pimpl_->connections.deleteConnection(session_id);
+ }
+ return -1;
+ }
+ // No response
+ // Success
+ errno = saved_errno;
+ LOG_D("session %x notification sent", session_id);
+ return 0;
+}
+
+int ProxyClient::waitNotification(const struct mc_ioctl_wait& wait) {
+ LOG_D("session %x wait for notification", wait.sid);
+ // Find session connection
+ auto connection = pimpl_->connections.find(wait.sid);
+ if (!connection) {
+ errno = ENXIO;
+ return -1;
+ }
+ int saved_errno = errno;
+ errno = EHOSTUNREACH;
+ // Request
+ WaitNotificationRequest request;
+ request.set_sid(wait.sid);
+ // Timeout to server cannot exceed a few seconds, retry every 5s
+ int32_t timeout_left = wait.timeout;
+ WaitNotificationResponse response;
+ bool failed = false;
+ while (true) {
+ if (wait.timeout < 0) {
+ // Infinite
+ request.set_timeout(timeout_max);
+ request.set_partial(true);
+ } else if (timeout_left > timeout_max) {
+ // Big
+ request.set_timeout(timeout_max);
+ request.set_partial(true);
+ timeout_left -= timeout_max;
+ } else {
+ // Small enough
+ request.set_timeout(timeout_left);
+ request.set_partial(false);
+ timeout_left = 0;
+ }
+ LOG_D("timeout: asked=%d left=%d set=%d",
+ wait.timeout, timeout_left, request.timeout());
+ // Exchange
+ if (!connection->call(WAIT, request, response)) {
+ LOG_D("done");
+ break;
+ }
+ // Real timeout or other error
+ if ((errno != ETIME) || !request.partial()) {
+ // Error logged in call()
+ if (connection->isBroken()) {
+ pimpl_->connections.deleteConnection(wait.sid);
+ LOG_D("abort");
+ return -1;
+ }
+ LOG_D("give up, but update buffers");
+ failed = true;
+ break;
+ }
+ LOG_D("retry");
+ }
+ // Response
+ auto session = connection->session();
+ if (response.has_tci() && session->updateTci(response.tci())) {
+ LOG_E("Could not update TCI");
+ return -1;
+ }
+ for (int i = 0; i < response.buffers_size(); i++) {
+ const WaitNotificationResponse_Buffers& buffer = response.buffers(i);
+ if (!buffer.has_sva() || !buffer.has_data()) {
+ LOG_E("Required parameter missing");
+ return -1;
+ }
+ std::lock_guard<std::mutex> buffers_lock(session->buffersMutex());
+ auto buf = session->findBuffer(buffer.sva());
+ if (!buf) {
+ LOG_E("Buffer not found for SVA %jx", buffer.sva());
+ return -1;
+ }
+ if (buffer.data().length() != buf->info().len) {
+ LOG_E("Buffer sizes differ for SVA %jx: %zu != %u",
+ buffer.sva(), buffer.data().length(), buf->info().len);
+ return -1;
+ }
+ ::memcpy(buf->address(), buffer.data().c_str(), buf->info().len);
+ }
+ if (failed) {
+ return -1;
+ }
+ // Success
+ errno = saved_errno;
+ LOG_D("session %x notification received", wait.sid);
+ return 0;
+}
+
+int ProxyClient::malloc(uint8_t** buffer, uint32_t length) {
+ // Cannot share kernel buffers through the proxy
+ if (!length) {
+ if (pimpl_->version_info.version_nwd < MC_MAKE_VERSION(2, 0)) {
+ errno = ENOMEM;
+ } else {
+ errno = EINVAL;
+ }
+ return -1;
+ }
+ *buffer = (uint8_t*)::mmap(0, length, PROT_READ | PROT_WRITE,
+ MAP_SHARED | MAP_ANONYMOUS, -1, 0);
+ if (*buffer == MAP_FAILED) {
+ errno = ENOMEM;
+ return -1;
+ }
+ LOG_D("mmap'd buffer %p len %u", *buffer, length);
+ return 0;
+}
+
+int ProxyClient::free(uint8_t* buffer, uint32_t length) {
+ LOG_D("munmap'd buffer %p len %u", buffer, length);
+ ::munmap(buffer, length);
+ return 0;
+}
+
+int ProxyClient::map(struct mc_ioctl_map& map) {
+ LOG_D("map buffer(s) to session %x", map.sid);
+ // Find session connection
+ auto connection = pimpl_->connections.find(map.sid);
+ if (!connection) {
+ errno = ENXIO;
+ return -1;
+ }
+ int saved_errno = errno;
+ errno = EHOSTUNREACH;
+ // Request
+ MapRequest request;
+ request.set_sid(map.sid);
+ for (int i = 0; i < MC_MAP_MAX; i++) {
+ if (map.bufs[i].va) {
+ if (map.bufs[i].len > BUFFER_LENGTH_MAX) {
+ LOG_E("Incorrect length for buffer: %u", map.bufs[i].len);
+ errno = -EINVAL;
+ return -1;
+ }
+ auto buffer = request.add_buffers();
+ buffer->set_len(map.bufs[i].len);
+ buffer->set_flags(map.bufs[i].flags);
+ }
+ }
+ // Exchange
+ MapResponse response;
+ if (connection->call(MAP, request, response)) {
+ // Error logged in call()
+ if (connection->isBroken()) {
+ pimpl_->connections.deleteConnection(map.sid);
+ }
+ return -1;
+ }
+ // Response
+ if (response.buffers_size() != request.buffers_size()) {
+ LOG_E("Response buffers size (%d) does not match request's (%d)",
+ response.buffers_size(), request.buffers_size());
+ return -1;
+ }
+ int buffer_index = 0;
+ for (int i = 0; i < MC_MAP_MAX; i++) {
+ if (map.bufs[i].va) {
+ const MapResponse_Buffers& buf = response.buffers(buffer_index++);
+ if (!buf.has_sva()) {
+ LOG_E("Required parameter missing");
+ return -1;
+ }
+ map.bufs[i].sva = buf.sva();
+ }
+ }
+ // Success
+ errno = saved_errno;
+ auto session = connection->session();
+ for (int i = 0; i < MC_MAP_MAX; i++) {
+ if (map.bufs[i].va) {
+ session->addBuffer(map.bufs[i]);
+ }
+ }
+ LOG_D("session %x buffer(s) mapped", map.sid);
+ return 0;
+}
+
+int ProxyClient::unmap(const struct mc_ioctl_map& map) {
+ LOG_D("unmap buffer(s) to session %x", map.sid);
+ // Find session connection
+ auto connection = pimpl_->connections.find(map.sid);
+ if (!connection) {
+ errno = ENXIO;
+ return -1;
+ }
+ int saved_errno = errno;
+ errno = EHOSTUNREACH;
+ // Request
+ UnmapRequest request;
+ request.set_sid(map.sid);
+ for (int i = 0; i < MC_MAP_MAX; i++) {
+ if (map.bufs[i].va) {
+ if (!map.bufs[i].sva) {
+ errno = EINVAL;
+ return -1;
+ }
+ UnmapRequest_Buffers* buffer = request.add_buffers();
+ buffer->set_sva(map.bufs[i].sva);
+ }
+ }
+ // Exchange
+ UnmapResponse response;
+ if (connection->call(UNMAP, request, response)) {
+ // Error logged in call()
+ if (connection->isBroken()) {
+ pimpl_->connections.deleteConnection(map.sid);
+ }
+ return -1;
+ }
+ // No response
+ // Success
+ errno = saved_errno;
+ auto session = connection->session();
+ for (int i = 0; i < MC_MAP_MAX; i++) {
+ if (map.bufs[i].va) {
+ if (session->removeBuffer(map.bufs[i].sva)) {
+ LOG_E("Unmapped buffer not found in session: %llu",
+ map.bufs[i].sva);
+ return -1;
+ }
+ }
+ }
+ LOG_D("session %x buffer(s) unmapped", map.sid);
+ return 0;
+}
+
+int ProxyClient::getError(struct mc_ioctl_geterr& err) {
+ LOG_D("get session %x exit code", err.sid);
+ // Find session connection
+ auto connection = pimpl_->connections.find(err.sid);
+ if (!connection) {
+ errno = ENXIO;
+ return -1;
+ }
+ int saved_errno = errno;
+ errno = EHOSTUNREACH;
+ // Request
+ GetErrorRequest request;
+ request.set_sid(err.sid);
+ // Exchange
+ GetErrorResponse response;
+ if (connection->call(GET_ERROR, request, response)) {
+ // Error logged in call()
+ if (connection->isBroken()) {
+ pimpl_->connections.deleteConnection(err.sid);
+ }
+ return -1;
+ }
+ // Response
+ if (!response.has_exit_code()) {
+ LOG_E("Required parameter missing");
+ return -1;
+ }
+ // Success
+ errno = saved_errno;
+ err.value = response.exit_code();
+ LOG_D("session %x exit code %d", err.sid, err.value);
+ return 0;
+}
+
+int ProxyClient::Impl::getVersion(ClientConnection& conn,
+ struct mc_version_info& version_info) {
+ LOG_D("get version");
+ int saved_errno = errno;
+ errno = EHOSTUNREACH;
+ // Request
+ GetVersionRequest request;
+ // No inputs to set
+ // Exchange
+ GetVersionResponse response;
+ if (conn.call(GET_VERSION, request, response)) {
+ // Error logged in call()
+ return -1;
+ }
+ // Response
+ if (!response.has_product_id() ||
+ !response.has_mci() ||
+ !response.has_so() ||
+ !response.has_mclf() ||
+ !response.has_container() ||
+ !response.has_mc_config() ||
+ !response.has_tl_api() ||
+ !response.has_dr_api() ||
+ !response.has_nwd()) {
+ LOG_E("Required parameter missing");
+ return -1;
+ }
+ // Success
+ errno = saved_errno;
+ ::strncpy(version_info.product_id, response.product_id().c_str(),
+ MC_PRODUCT_ID_LEN);
+ version_info.product_id[MC_PRODUCT_ID_LEN - 1] = '\0';
+ version_info.version_mci = response.mci();
+ version_info.version_so = response.so();
+ version_info.version_mclf = response.mclf();
+ version_info.version_container = response.container();
+ version_info.version_mc_config = response.mc_config();
+ version_info.version_tl_api = response.tl_api();
+ version_info.version_dr_api = response.dr_api();
+ version_info.version_nwd = response.nwd();
+ return 0;
+}
+
+int ProxyClient::getVersion(struct mc_version_info& version_info) {
+ if (!pimpl_->is_open_) {
+ errno = EBADF;
+ return -1;
+ }
+ version_info = pimpl_->version_info;
+ return 0;
+}
+
+int ProxyClient::gpRequestCancellation(uint32_t session_id) {
+ LOG_D("cancel GP operation on session %x", session_id);
+ // Find session connection
+ auto connection = pimpl_->connections.find(session_id);
+ if (!connection) {
+ errno = ENXIO;
+ return -1;
+ }
+ int saved_errno = errno;
+ errno = EHOSTUNREACH;
+ // Request
+ GpRequestCancellationRequest request;
+ request.set_sid(session_id);
+ // Exchange
+ GpRequestCancellationResponse response;
+ if (connection->call(GP_REQUESTCANCELLATION, request, response)) {
+ // Error logged in call()
+ if (connection->isBroken()) {
+ pimpl_->connections.deleteConnection(session_id);
+ }
+ return -1;
+ }
+ // No response
+ // Success
+ errno = saved_errno;
+ return 0;
+}
diff --git a/mobicore/MobiCoreDriverLib/ClientLib/Contrib/proxy_client.h b/mobicore/MobiCoreDriverLib/ClientLib/Contrib/proxy_client.h
new file mode 100644
index 0000000..7fee59f
--- /dev/null
+++ b/mobicore/MobiCoreDriverLib/ClientLib/Contrib/proxy_client.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2013-2015 TRUSTONIC LIMITED
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the TRUSTONIC LIMITED nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __PROXY_CLIENT_H__
+#define __PROXY_CLIENT_H__
+
+#include "iclient.h"
+
+class ProxyClient: public IClient {
+ struct Impl;
+ Impl* const pimpl_;
+public:
+ ProxyClient();
+ ~ProxyClient();
+ virtual int open() override;
+ virtual int close() override;
+ virtual bool isOpen() const override;
+ virtual int hasOpenSessions() const override;
+ virtual int openSession(struct mc_ioctl_open_session& session) override;
+ virtual int openTrustlet(struct mc_ioctl_open_trustlet& trustlet) override;
+ virtual int closeSession(uint32_t session_id) override;
+ virtual int notify(uint32_t session_id) override;
+ virtual int waitNotification(const struct mc_ioctl_wait& wait) override;
+ virtual int malloc(uint8_t** buffer, uint32_t length) override;
+ virtual int free(uint8_t* buffer, uint32_t length) override;
+ virtual int map(struct mc_ioctl_map& map) override;
+ virtual int unmap(const struct mc_ioctl_map& map) override;
+ virtual int getError(struct mc_ioctl_geterr& err) override;
+ virtual int getVersion(struct mc_version_info& version_info) override;
+ virtual int gpRequestCancellation(uint32_t session_id) override;
+};
+
+#endif // __PROXY_CLIENT_H__
diff --git a/mobicore/MobiCoreDriverLib/ClientLib/Contrib/proxy_common.h b/mobicore/MobiCoreDriverLib/ClientLib/Contrib/proxy_common.h
new file mode 100644
index 0000000..b2c7ca8
--- /dev/null
+++ b/mobicore/MobiCoreDriverLib/ClientLib/Contrib/proxy_common.h
@@ -0,0 +1,354 @@
+/*
+ * Copyright (c) 2013-2015 TRUSTONIC LIMITED
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the TRUSTONIC LIMITED nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <algorithm>
+#include <mutex>
+#include <string>
+#include <vector>
+
+#include <stdlib.h> // malloc, free
+#include <sys/mman.h> // mmap, munmap
+
+#include "mc_user.h" // mc_ioctl_buffer
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wconversion"
+#include "mc.pb.h"
+#pragma GCC diagnostic pop
+
+#define SOCKET_PATH "@/com/trustonic/tee_proxy"
+#define PROTOCOL_MAGIC "T7e3"
+#define PROTOCOL_VERSION 1
+
+/*
+ * ProtoBuf gives us the serialisation mechanism, but that's not enough to send
+ * our RPC messages: we also need to pass the method we want to call, the total
+ * length of the data, and a magic number is usually welcome too. While at it,
+ * we'll throw a version number just in case.
+ *
+ * Hence:
+ * ----------------------
+ * | Magic number | 4 bytes (text)
+ * ----------------------
+ * | Method | Version | 2 + 2 bytes (LE)
+ * ----------------------
+ * | Message length | 4 bytes (LE)
+ * ----------------------
+ * | |
+ * | Message data | N bytes (text)
+ * ~ ~
+ * | |
+ * ----------------------
+ */
+
+namespace com {
+namespace trustonic {
+namespace tee_proxy {
+
+struct RequestHeader {
+ char magic[4];
+ uint16_t version;
+ uint16_t method;
+ uint32_t length;
+};
+
+struct ResponseHeader {
+ char magic[4];
+ uint16_t version;
+ uint16_t method;
+ int32_t proto_rc; // -errno if negative, length of data otherwise
+ uint32_t method_rc; // errno from called method on server side
+};
+
+enum RpcMethod {
+ OPEN_SESSION = 0,
+ OPEN_TRUSTLET = 1,
+ CLOSE_SESSION = 2,
+ NOTIFY = 3,
+ WAIT = 4,
+ MAP = 5,
+ UNMAP = 6,
+ GET_ERROR = 7,
+ GET_VERSION = 9,
+ GP_REQUESTCANCELLATION = 27,
+};
+
+class Session {
+public:
+ class Buffer {
+ enum Type {
+ NONE, // No buffer
+ CLIENT, // Buffer managed by caller (client side)
+ SERVER, // Buffer mmap'd (server side)
+ };
+ mc_ioctl_buffer info_;
+ void* address_;
+ Type type_;
+ int alloc(size_t length, uint32_t flags = MC_IO_MAP_INPUT_OUTPUT) {
+ // No posix_memalign, aligned_alloc, valloc, memalign, pvalloc in
+ // Android so we rely on mmap to give us page-aligned memory
+ size_t page_mask = sysconf(_SC_PAGESIZE) - 1;
+ size_t aligned_length = (length + page_mask) & ~page_mask;
+ void* buf = ::mmap(0, aligned_length, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ if (buf == MAP_FAILED) {
+ LOG_E("Failed to allocate");
+ return -1;
+ }
+ type_ = SERVER;
+ address_ = buf;
+ info_.va = reinterpret_cast<uintptr_t>(address_);
+ info_.len = static_cast<uint32_t>(length);
+ info_.flags = flags;
+ LOG_D("alloc'd buffer %p:%u:%x", address_, info_.len, info_.flags);
+ return 0;
+ }
+ public:
+ Buffer(const Buffer&) = delete;
+ Buffer& operator=(const Buffer&) = delete;
+ // Constructor from buffer: allocate and fill in
+ Buffer(std::string buffer): address_(nullptr) {
+ if (!alloc(buffer.length())) {
+ update(buffer);
+ }
+ }
+ // Constructor for client TCI: pointer and length (can be null) given
+ Buffer(void* address, size_t length): address_(address) {
+ if (address_) {
+ info_.va = reinterpret_cast<uintptr_t>(address_);
+ info_.len = static_cast<uint32_t>(length);
+ info_.flags = MC_IO_MAP_INPUT_OUTPUT;
+ type_ = CLIENT;
+ LOG_D("use buffer %p:%u:%x", address_, info_.len, info_.flags);
+ } else {
+ info_.va = 0;
+ info_.len = 0;
+ info_.flags = 0;
+ type_ = NONE;
+ }
+ info_.sva = 0;
+ }
+ // Constructor for server buffer: allocate
+ Buffer(uint32_t length, uint32_t flags): address_(nullptr) {
+ alloc(length, flags);
+ }
+ // Constructor for client buffer: info given
+ Buffer(mc_ioctl_buffer info): info_(info) {
+ address_ = reinterpret_cast<void*>(
+ static_cast<uintptr_t>(info_.va));
+ type_ = CLIENT;
+ LOG_D("use buffer %p:%u:%x", address_, info_.len, info_.flags);
+ }
+ ~Buffer() {
+ if (type_ == Buffer::SERVER) {
+ LOG_D("unmap buffer %p:%u:%x", address_, info_.len,
+ info_.flags);
+ ::munmap(address_, info_.len);
+ }
+ }
+ // Accessors
+ const mc_ioctl_buffer& info() const {
+ return info_;
+ }
+ void* address() const {
+ return address_;
+ }
+ void setSva(uint64_t sva) {
+ info_.sva = sva;
+ }
+ int update(const std::string& buf) {
+ if (buf.length() != info_.len) {
+ LOG_E("Failed to update TCI");
+ return -1;
+ }
+ if (type_ != NONE) {
+ ::memcpy(address_, buf.c_str(), info_.len);
+ }
+ return 0;
+ }
+ };
+private:
+ uint32_t id_;
+ Buffer* tci_;
+ std::mutex buffers_mutex_;
+ std::vector<Buffer*> buffers_;
+public:
+ Session(uint32_t id, Buffer* tci): id_(id), tci_(tci) {}
+ ~Session() {
+ delete tci_;
+ for (auto& buf: buffers_) {
+ delete buf;
+ }
+ }
+ uint32_t id() const {
+ return id_;
+ }
+ bool hasTci() const {
+ return tci_;
+ }
+ const void* tci() const {
+ return tci_->address();
+ }
+ size_t tciLen() const {
+ return tci_->info().len;
+ }
+ int updateTci(const std::string& buf) {
+ return tci_->update(buf);
+ }
+ void addBuffer(Buffer* buffer) {
+ LOG_D("%p %s: 0x%llx", this, __FUNCTION__, buffer->info().sva);
+ std::lock_guard<std::mutex> buffers_lock(buffers_mutex_);
+ buffers_.push_back(buffer);
+ }
+ void addBuffer(mc_ioctl_buffer& info) {
+ LOG_D("%p %s: 0x%llx", this, __FUNCTION__, info.sva);
+ std::lock_guard<std::mutex> buffers_lock(buffers_mutex_);
+ auto buffer = new Buffer(info);
+ buffers_.push_back(buffer);
+ }
+ int removeBuffer(uint64_t sva) {
+ LOG_D("%p %s: %jx", this, __FUNCTION__, sva);
+ std::lock_guard<std::mutex> buffers_lock(buffers_mutex_);
+ auto it = std::find_if(buffers_.begin(), buffers_.end(),
+ [this, sva](Buffer* buffer) {
+ return buffer->info().sva == sva;
+ });
+ if (it == buffers_.end()) {
+ // Not found
+ return -1;
+ }
+ delete *it;
+ buffers_.erase(it);
+ return 0;
+ }
+ // Must be called under buffers_mutex_
+ Buffer* findBuffer(uint64_t sva) {
+ for (auto& buf: buffers_) {
+ if (buf->info().sva == sva) {
+ return buf;
+ }
+ }
+ return nullptr;
+ }
+ std::mutex& buffersMutex() {
+ return buffers_mutex_;
+ }
+ const std::vector<Buffer*>& buffers() {
+ return buffers_;
+ }
+};
+
+static int recv_all(int sock, const char* what, void* buffer, size_t length,
+ bool may_close = false) {
+ auto cbuffer = static_cast<char*>(buffer);
+ size_t count = 0;
+ while (count < length) {
+ ssize_t rc = ::recv(sock, &cbuffer[count], length - count, 0);
+ if (rc <= 0) {
+ if (rc == 0) {
+ if (may_close) {
+ LOG_D("socket closed");
+ } else {
+ LOG_E("socket closed while receiving %s", what);
+ }
+ return -1;
+ }
+ if (errno != EINTR) {
+ LOG_ERRNO(what);
+ return -1;
+ }
+ LOG_D("signal ignored while sending %s", what);
+ continue;
+ } else {
+ count += rc;
+ }
+ }
+ return 0;
+}
+
+static const int32_t timeout_max = 1000; // 1s
+
+static int send_all(int sock, const char* what, const void* buffer,
+ size_t length) {
+ auto cbuffer = static_cast<const char*>(buffer);
+ size_t count = 0;
+ while (count < length) {
+ ssize_t rc = ::send(sock, &cbuffer[count], length - count,
+ MSG_NOSIGNAL);
+ if (rc <= 0) {
+ if (rc == 0) {
+ LOG_E("socket closed while sending %s", what);
+ return -1;
+ }
+ if (errno != EINTR) {
+ LOG_ERRNO(what);
+ return -1;
+ }
+ LOG_D("signal ignored while sending %s", what);
+ continue;
+ } else {
+ count += rc;
+ }
+ }
+ return 0;
+}
+
+#ifndef NDEBUG
+static const char* methodToString(enum RpcMethod method) {
+ switch (method) {
+ case OPEN_SESSION:
+ return "openSession";
+ case OPEN_TRUSTLET:
+ return "openTruslet";
+ case CLOSE_SESSION:
+ return "closeSession";
+ case NOTIFY:
+ return "notify";
+ case WAIT:
+ return "waitNotification";
+ case MAP:
+ return "map";
+ case UNMAP:
+ return "unmap";
+ case GET_ERROR:
+ return "getError";
+ case GET_VERSION:
+ return "getVersion";
+ case GP_REQUESTCANCELLATION:
+ return "gpRequestCancellation";
+ }
+ return "unknown";
+}
+#endif
+
+} // namespace tee_proxy
+} // namespace trustonic
+} // namespace com
diff --git a/mobicore/MobiCoreDriverLib/ClientLib/Contrib/proxy_server.cpp b/mobicore/MobiCoreDriverLib/ClientLib/Contrib/proxy_server.cpp
new file mode 100644
index 0000000..454cf7e
--- /dev/null
+++ b/mobicore/MobiCoreDriverLib/ClientLib/Contrib/proxy_server.cpp
@@ -0,0 +1,903 @@
+/*
+ * Copyright (c) 2013-2015 TRUSTONIC LIMITED
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the TRUSTONIC LIMITED nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <memory>
+#include <mutex>
+#include <thread>
+#include <string>
+
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <errno.h>
+
+#include "driver_client.h"
+#undef LOG_TAG
+#define LOG_TAG "TeeProxyServer"
+#include "log.h"
+#include "proxy_common.h"
+#include "proxy_server.h"
+
+using namespace com::trustonic::tee_proxy;
+
+template <class T>
+class FreeMe {
+ T* t_;
+public:
+ FreeMe(T* t): t_(t) {}
+ ~FreeMe() {
+ ::free(t_);
+ }
+ operator T* () {
+ return t_;
+ }
+ operator uintptr_t () {
+ return reinterpret_cast<uintptr_t>(t_);
+ }
+};
+
+class ServerConnection {
+ int listen_socket_;
+ int socket_ = -1;
+ pid_t pid_ = 0;
+ DriverClient driver;
+ std::mutex connection_mutex; // Protects is_running_ and session_
+ bool is_running_ = false;
+ Session* session_ = nullptr;
+ std::thread thread_;
+ int receiveCredentials() {
+ // Make sure we can receive credentials
+ int enable = 1;
+ if (::setsockopt(socket_, SOL_SOCKET, SO_PASSCRED, &enable,
+ sizeof(enable))) {
+ LOG_ERRNO("setsockopt");
+ return -1;
+ }
+
+ struct ucred credentials;
+ char ctrl[CMSG_SPACE(sizeof(credentials))];
+ struct iovec iov[1] = { { 0, 0 } };
+ struct msghdr msg = { 0, 0, iov, 1, ctrl, sizeof(ctrl), 0 };
+
+ msg.msg_iov->iov_base = nullptr;
+ msg.msg_iov->iov_len = 0;
+ do {
+ if (::recvmsg(socket_, &msg, 0) == 0) {
+ break;
+ }
+ if ((errno != EINTR) && (errno != EAGAIN)) {
+ LOG_ERRNO("recvmsg");
+ return -1;
+ }
+ } while (true);
+
+ if (msg.msg_controllen < sizeof(struct cmsghdr)) {
+ errno = EINVAL;
+ LOG_ERRNO("check");
+ return -1;
+ }
+ struct cmsghdr* cmptr = CMSG_FIRSTHDR(&msg);
+ size_t size = sizeof(credentials);
+ if ((cmptr->cmsg_len != CMSG_LEN(size)) ||
+ (cmptr->cmsg_level != SOL_SOCKET) ||
+ (cmptr->cmsg_type != SCM_CREDENTIALS)) {
+ errno = EINVAL;
+ LOG_ERRNO("check");
+ return -1;
+ }
+
+ credentials = *(struct ucred*)CMSG_DATA(cmptr);
+ pid_ = credentials.pid;
+ return 0;
+ }
+ void connectionThread() {
+ LOG_D("thread entered %p", this);
+ std::string buffer;
+ do {
+ // Request
+ RpcMethod method;
+ {
+ // Receive request header
+ RequestHeader header;
+ if (recv_all(socket_, "header", &header, sizeof(header),
+ true)) {
+ break;
+ }
+ if (::memcmp(header.magic, PROTOCOL_MAGIC,
+ sizeof(header.magic))) {
+ LOG_E("Wrong magic");
+ break;
+ }
+ if (header.version != PROTOCOL_VERSION) {
+ LOG_E("Wrong version");
+ break;
+ }
+ method = static_cast<RpcMethod>(header.method);
+ buffer.resize(header.length);
+ LOG_D("receive %u bytes of data for method %s",
+ header.length, methodToString(method));
+
+ // Receive request data
+ if (recv_all(socket_, "data", &buffer[0], header.length)) {
+ break;
+ }
+ }
+
+ // Dispatch:
+ // * method_rc is return code from lower layer
+ // * call returns -errno in case of error, length of data otherwise
+ int method_rc = 0;
+ int proto_rc = call(method, buffer, method_rc);
+
+ // Response
+ {
+ // Send response header
+ ResponseHeader header;
+ ::memcpy(header.magic, PROTOCOL_MAGIC, sizeof(header.magic));
+ header.version = PROTOCOL_VERSION;
+ header.method = static_cast<uint16_t>(method);
+ header.proto_rc = proto_rc;
+ header.method_rc = method_rc;
+ if (send_all(socket_, "header", &header, sizeof(header))) {
+ break;
+ }
+
+ // Send response data
+ if (header.proto_rc > 0) {
+ LOG_D("send %d bytes of data", header.proto_rc);
+ if (send_all(socket_, "data", &buffer[0],
+ header.proto_rc)) {
+ break;
+ }
+ }
+ }
+ } while (driver.isOpen());
+ LOG_D("thread exiting %p", this);
+
+ // Close associated client
+ driver.close();
+ ::close(socket_);
+ is_running_ = false;
+ LOG_D("thread exited %p", this);
+ }
+public:
+ ServerConnection(int listen_socket): listen_socket_(listen_socket) {}
+ ~ServerConnection() {
+ delete session_;
+ }
+ int open() {
+ socket_ = ::accept(listen_socket_, 0, 0);
+ if (socket_ < 0) {
+ return -1;
+ }
+ if (receiveCredentials() < 0) {
+ ::close(socket_);
+ return -1;
+ }
+ // Create specific client for this connection
+ if (driver.open()) {
+ LOG_ERRNO("open driver");
+ ::close(socket_);
+ return -1;
+ }
+ // Start thread
+ is_running_ = true;
+ thread_ = std::thread(&ServerConnection::connectionThread, this);
+ LOG_I("proxy server open, client PID: %d", pid_);
+ return 0;
+ }
+ int close() {
+ thread_.join();
+ // driver and socket are closed at end of thread
+ LOG_I("proxy server closed, client PID: %d", pid_);
+ return 0;
+ }
+ bool isRunning() const {
+ return is_running_;
+ }
+ int call(RpcMethod method, std::string& buffer, int& method_rc) {
+ switch (method) {
+ case OPEN_SESSION:
+ return openSession(buffer, method_rc);
+ case OPEN_TRUSTLET:
+ return openTrustlet(buffer, method_rc);
+ case CLOSE_SESSION:
+ return closeSession(buffer, method_rc);
+ case NOTIFY:
+ return notify(buffer, method_rc);
+ case WAIT:
+ return waitNotification(buffer, method_rc);
+ case MAP:
+ return map(buffer, method_rc);
+ case UNMAP:
+ return unmap(buffer, method_rc);
+ case GET_ERROR:
+ return getError(buffer, method_rc);
+ case GET_VERSION:
+ return getVersion(buffer, method_rc);
+ case GP_REQUESTCANCELLATION:
+ return gpRequestCancellation(buffer, method_rc);
+ }
+ LOG_E("unkown method %d", method);
+ return -1;
+ }
+ // Actions
+ int openSession(std::string& buffer, int& method_rc);
+ int openTrustlet(std::string& buffer, int& method_rc);
+ int closeSession(std::string& buffer, int& method_rc);
+ int notify(std::string& buffer, int& method_rc);
+ int waitNotification(std::string& buffer, int& method_rc);
+ int map(std::string& buffer, int& method_rc);
+ int unmap(std::string& buffer, int& method_rc);
+ int getError(std::string& buffer, int& method_rc);
+ int getVersion(std::string& buffer, int& method_rc);
+ int gpRequestCancellation(std::string& buffer, int& method_rc);
+};
+
+struct ProxyServer::Impl {
+ int listen_socket = -1;
+ int signal_pipe[2];
+ std::thread thread;
+};
+
+ProxyServer::ProxyServer(): pimpl_(new Impl) {
+}
+
+ProxyServer::~ProxyServer() {
+ delete pimpl_;
+}
+
+int ProxyServer::open() {
+ // Make sure we have access to the driver
+ DriverClient driver;
+ if (driver.open()) {
+ LOG_ERRNO("open driver");
+ return -1;
+ }
+ driver.close();
+
+ // Make sure we're alone
+ int sock = ::socket(AF_UNIX, SOCK_STREAM, 0);
+ if (sock < 0) {
+ LOG_ERRNO("socket");
+ return -1;
+ }
+ struct sockaddr_un sock_un;
+ sock_un.sun_family = AF_UNIX;
+ ::strncpy(sock_un.sun_path, SOCKET_PATH, sizeof(sock_un.sun_path) - 1);
+ socklen_t len = static_cast<socklen_t>(strlen(sock_un.sun_path) +
+ sizeof(sock_un.sun_family));
+ sock_un.sun_path[0] = '\0'; // Abstract
+ if (::bind(sock, reinterpret_cast<struct sockaddr*>(&sock_un), len) == 0) {
+ if (::listen(sock, 5) == 0) {
+ pimpl_->listen_socket = sock;
+ pipe(pimpl_->signal_pipe);
+ pimpl_->thread = std::thread(&ProxyServer::run, this);
+ LOG_D("proxy open");
+ return 0;
+ } else {
+ LOG_ERRNO("listen");
+ }
+ } else {
+ LOG_ERRNO("bind");
+ }
+ ::close(sock);
+ return -1;
+}
+
+int ProxyServer::close() {
+ if (pimpl_->listen_socket < 0) {
+ errno = EBADF;
+ return -1;
+ }
+ ::close(pimpl_->listen_socket);
+ pimpl_->listen_socket = -1;
+ // Make thread stop
+ if (pimpl_->thread.joinable()) {
+ ::write(pimpl_->signal_pipe[1], "c", 1);
+ ::close(pimpl_->signal_pipe[1]);
+ pimpl_->thread.join();
+ }
+ LOG_D("proxy closed");
+ return 0;
+}
+
+void ProxyServer::run() {
+ std::vector<ServerConnection*> connections;
+
+ LOG_D("proxy ready");
+ while (pimpl_->listen_socket >= 0) {
+ // Wait for new connections
+ fd_set fds;
+ FD_ZERO(&fds);
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wold-style-cast"
+ FD_SET(pimpl_->signal_pipe[0], &fds);
+ FD_SET(pimpl_->listen_socket, &fds);
+#pragma GCC diagnostic pop
+ if ((::select(FD_SETSIZE, &fds, nullptr, nullptr, nullptr) < 0) &&
+ (errno != EINTR)) {
+ LOG_ERRNO("listen on server socket");
+ break;
+ }
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wold-style-cast"
+ if (FD_ISSET(pimpl_->signal_pipe[0], &fds)) {
+#pragma GCC diagnostic pop
+ LOG_I("thread received stop message");
+ // Wait for client threads to stop
+ for (auto& connection: connections) {
+ connection->close();
+ LOG_D("delete connection %p", connection);
+ delete connection;
+ }
+ break;
+ }
+ auto connection = new ServerConnection(pimpl_->listen_socket);
+ if (connection->open() < 0) {
+ LOG_ERRNO("new connection");
+ delete connection;
+ // Relax
+ usleep(100000);
+ } else {
+ LOG_D("new connection %p", connection);
+ connections.push_back(connection);
+ }
+ // Cleanup dead connections
+ auto it = connections.begin();
+ while (it != connections.end()) {
+ auto connection = *it;
+ if (!connection->isRunning()) {
+ it = connections.erase(it);
+ connection->close();
+ LOG_D("delete connection %p", connection);
+ delete connection;
+ } else {
+ it++;
+ }
+ }
+ }
+ LOG_D("proxy exited");
+}
+
+int ServerConnection::openSession(std::string& buffer, int& method_rc) {
+ LOG_D("enter %s", __FUNCTION__);
+ std::lock_guard<std::mutex> connection_lock(connection_mutex);
+ if (session_) {
+ LOG_E("Session exists");
+ return -EBUSY;
+ }
+ // Request
+ OpenSessionRequest request;
+ if (!request.ParseFromString(buffer)) {
+ LOG_E("Failed to parse");
+ return -EPIPE;
+ }
+ if (!request.has_uuid() || !request.has_is_gp_uuid() ||
+ !request.has_login_type() || !request.has_login_data()) {
+ LOG_E("Required parameter missing");
+ return -EINVAL;
+ }
+ // Call driver
+ struct mc_ioctl_open_session session;
+ if (request.uuid().length() != sizeof(session.uuid)) {
+ LOG_E("Incorrect parameter uuid");
+ return -EINVAL;
+ }
+ ::memcpy(&session.uuid, request.uuid().c_str(), sizeof(session.uuid));
+ session.is_gp_uuid = request.is_gp_uuid();
+ Session::Buffer* tci;
+ if (request.has_tci()) {
+ tci = new Session::Buffer(request.tci());
+ session.tcilen = tci->info().len;
+ session.tci = tci->info().va;
+ } else {
+ tci = nullptr;
+ session.tcilen = 0;
+ session.tci = 0;
+ }
+ std::unique_ptr<Session::Buffer> tci_ptr(tci);
+ session.identity.login_type =
+ static_cast<mc_login_type>(request.login_type());
+ session.identity.pid = pid_;
+ if (request.login_data().length() != sizeof(session.identity.login_data)) {
+ LOG_E("Incorrect parameter login_data");
+ return -EINVAL;
+ }
+ ::memcpy(&session.identity.login_data, request.login_data().c_str(),
+ sizeof(session.identity.login_data));
+
+ // Call
+ if (driver.openSession(session)) {
+ method_rc = errno;
+ LOG_D("Error reported %s", strerror(errno));
+ return 0;
+ }
+
+ // Response
+ OpenSessionResponse response;
+ response.set_id(session.sid);
+ if (!response.SerializeToString(&buffer)) {
+ LOG_E("Failed to serialize");
+ return -EPIPE;
+ }
+ LOG_D("session %x open", session.sid);
+ session_ = new Session(session.sid, tci_ptr.release());
+ return static_cast<int>(buffer.length());
+}
+
+int ServerConnection::openTrustlet(std::string& buffer, int& method_rc) {
+ LOG_D("enter %s", __FUNCTION__);
+ std::lock_guard<std::mutex> connection_lock(connection_mutex);
+ if (session_) {
+ LOG_E("Session exists");
+ return -EBUSY;
+ }
+ // Request
+ OpenTrustletRequest request;
+ if (!request.ParseFromString(buffer)) {
+ LOG_E("Failed to parse");
+ return -EPIPE;
+ }
+ if (!request.has_spid() || !request.has_trustapp()) {
+ LOG_E("Required parameter missing");
+ return -EINVAL;
+ }
+ // Call driver
+ struct mc_ioctl_open_trustlet trustlet;
+ trustlet.spid = request.spid();
+ trustlet.tlen = static_cast<int>(request.trustapp().length());
+ // Create TrustApp buffer
+ FreeMe<void> trustapp = ::malloc(trustlet.tlen);
+ if (!trustapp) {
+ LOG_E("Failed to allocate TrustApp");
+ return -ENOMEM;
+ }
+ ::memcpy(trustapp, request.trustapp().c_str(), trustlet.tlen);
+ trustlet.buffer = trustapp;
+ Session::Buffer* tci;
+ if (request.has_tci()) {
+ tci = new Session::Buffer(request.tci());
+ trustlet.tcilen = tci->info().len;
+ trustlet.tci = tci->info().va;
+ } else {
+ tci = nullptr;
+ trustlet.tcilen = 0;
+ trustlet.tci = 0;
+ }
+ std::unique_ptr<Session::Buffer> tci_ptr(tci);
+
+ // Call
+ if (driver.openTrustlet(trustlet)) {
+ method_rc = errno;
+ LOG_D("Error reported %s", strerror(errno));
+ return 0;
+ }
+
+ // Response
+ OpenTrustletResponse response;
+ response.set_id(trustlet.sid);
+ if (!response.SerializeToString(&buffer)) {
+ LOG_E("Failed to serialize");
+ return -EPIPE;
+ }
+ LOG_D("session %x open", trustlet.sid);
+ session_ = new Session(trustlet.sid, tci_ptr.release());
+ return static_cast<int>(buffer.length());
+}
+
+int ServerConnection::closeSession(std::string& buffer, int& method_rc) {
+ // Request
+ CloseSessionRequest request;
+ if (!request.ParseFromString(buffer)) {
+ LOG_E("Failed to parse");
+ return -EPIPE;
+ }
+ if (!request.has_id()) {
+ LOG_E("Required parameter missing");
+ return -EINVAL;
+ }
+ // Check session
+ std::lock_guard<std::mutex> connection_lock(connection_mutex);
+ if (!session_) {
+ LOG_E("No session");
+ return -ENOENT;
+ }
+
+ // Call
+ if (driver.closeSession(request.id())) {
+ method_rc = errno;
+ LOG_D("Error reported %s", strerror(errno));
+ return 0;
+ }
+
+ // No response
+ LOG_D("session %x closed", request.id());
+ delete session_;
+ session_ = nullptr;
+ return 0;
+}
+
+int ServerConnection::notify(std::string& buffer, int& method_rc) {
+ // Request
+ NotifyRequest request;
+ if (!request.ParseFromString(buffer)) {
+ LOG_E("Failed to parse");
+ return -EPIPE;
+ }
+ // Check session
+ std::lock_guard<std::mutex> connection_lock(connection_mutex);
+ if (!session_) {
+ LOG_E("No session");
+ return -ENOENT;
+ }
+ if (!request.has_sid() || (session_->hasTci() && !request.has_tci())) {
+ LOG_E("Required parameter missing");
+ return -EINVAL;
+ }
+ // Update TCI
+ if (session_->hasTci() && session_->updateTci(request.tci())) {
+ LOG_E("Failed to update TCI");
+ return -EINVAL;
+ }
+ // Update mapped buffers
+ if (request.buffers_size() > static_cast<int>(session_->buffers().size())) {
+ LOG_E("Too many buffers: %d > %zu", request.buffers_size(),
+ session_->buffers().size());
+ return -EINVAL;
+ }
+ for (int i = 0; i < request.buffers_size(); i++) {
+ const NotifyRequest_Buffers& session_buffer = request.buffers(i);
+ if (!session_buffer.has_sva()) {
+ LOG_E("Given buffer has no SVA");
+ return -EINVAL;
+ }
+ if (!session_buffer.has_data()) {
+ LOG_E("Given buffer has no data");
+ return -EINVAL;
+ }
+ auto buf = session_->findBuffer(session_buffer.sva());
+ if (!buf) {
+ LOG_E("No buffer record for SVA %jx in session %x",
+ session_buffer.sva(), request.sid());
+ return -EPIPE;
+ }
+ buf->update(session_buffer.data());
+ }
+
+ // Call
+ if (driver.notify(request.sid())) {
+ method_rc = errno;
+ return 0;
+ }
+
+ // No response
+ LOG_D("session %x notification sent", request.sid());
+ return 0;
+}
+
+int ServerConnection::waitNotification(std::string& buffer, int& method_rc) {
+ // Request
+ WaitNotificationRequest request;
+ if (!request.ParseFromString(buffer)) {
+ LOG_E("Failed to parse");
+ return -EPIPE;
+ }
+ if (!request.has_sid() || !request.has_timeout() ||
+ !request.has_partial()) {
+ LOG_E("Required parameter missing");
+ return -EINVAL;
+ }
+ // Refuse big timeouts (client shall retry so we know it's still around)
+ if ((request.timeout() < 0) || (request.timeout() > timeout_max)) {
+ LOG_E("Timeout exceeds 10s");
+ return -ENOENT;
+ }
+
+ // Find session
+ LOG_D("session %x wait for notification", request.sid());
+ // Check session
+ std::lock_guard<std::mutex> connection_lock(connection_mutex);
+ if (!session_) {
+ LOG_E("No session");
+ return -ENOENT;
+ }
+ // Call driver
+ struct mc_ioctl_wait wait;
+ wait.sid = request.sid();
+ wait.timeout = request.timeout();
+
+ // Call
+ if (driver.waitNotification(wait)) {
+ method_rc = errno;
+ if ((errno == ETIME) && request.partial()) {
+ // No point sending buffers on partial timeout
+ return 0;
+ }
+ // Send potentially modified buffers back on failure too
+ LOG_ERRNO("waitNotification");
+ }
+
+ // Response
+ WaitNotificationResponse response;
+ // Send updated TCI
+ if (session_->hasTci()) {
+ response.set_tci(session_->tci(), session_->tciLen());
+ }
+ // Send updated mapped buffers
+ auto& buffers = session_->buffers();
+ for (auto& buf: buffers) {
+ if (buf->info().flags & MC_IO_MAP_OUTPUT) {
+ auto session_buffer = response.add_buffers();
+ session_buffer->set_sva(buf->info().sva);
+ session_buffer->set_data(buf->address(), buf->info().len);
+ }
+ }
+ if (!response.SerializeToString(&buffer)) {
+ LOG_E("Failed to serialize");
+ return -EPIPE;
+ }
+ LOG_D("session %x notification received", request.sid());
+ return static_cast<int>(buffer.length());
+}
+
+int ServerConnection::map(std::string& buffer, int& method_rc) {
+ // Request
+ MapRequest request;
+ if (!request.ParseFromString(buffer)) {
+ LOG_E("Failed to parse");
+ return -EPIPE;
+ }
+ if (!request.has_sid()) {
+ LOG_E("Required parameter missing");
+ return -EINVAL;
+ }
+ // Check session
+ std::lock_guard<std::mutex> connection_lock(connection_mutex);
+ if (!session_) {
+ LOG_E("No session");
+ return -ENOENT;
+ }
+ if (request.buffers_size() > MC_MAP_MAX) {
+ LOG_E("Incorrect number of buffers: %d > %d", request.buffers_size(),
+ MC_MAP_MAX);
+ return -EINVAL;
+ }
+ // Prepare local buffers
+ struct mc_ioctl_map map;
+ map.sid = request.sid();
+ LOG_D("map %d buffers to session %x", request.buffers_size(), map.sid);
+ std::unique_ptr<Session::Buffer> buffers[4];
+ for (int i = 0; i < request.buffers_size(); i++) {
+ const MapRequest_Buffers& session_buffer = request.buffers(i);
+ if (!session_buffer.has_len() || !session_buffer.has_flags()) {
+ LOG_E("Required parameter missing");
+ return -EINVAL;
+ }
+ if (!(session_buffer.flags() & MC_IO_MAP_INPUT_OUTPUT) ||
+ (session_buffer.flags() & ~MC_IO_MAP_INPUT_OUTPUT)) {
+ LOG_E("Incorrect flags for buffer: %x", session_buffer.flags());
+ return -EINVAL;
+ }
+ auto buf = new Session::Buffer(session_buffer.len(),
+ session_buffer.flags());
+ map.bufs[i] = buf->info();
+ buffers[i].reset(buf);
+ }
+ for (int i = request.buffers_size(); i < MC_MAP_MAX; i++) {
+ map.bufs[i].va = 0;
+ }
+
+ // Call
+ if (driver.map(map)) {
+ method_rc = errno;
+ LOG_D("Error reported %s", strerror(errno));
+ return 0;
+ }
+
+ // Response
+ MapResponse response;
+ // Confirm/return buffers
+ for (int i = 0; i < request.buffers_size(); i++) {
+ Session::Buffer* buf = buffers[i].release();
+ buf->setSva(map.bufs[i].sva);
+ session_->addBuffer(buf);
+ auto session_buffer = response.add_buffers();
+ session_buffer->set_sva(map.bufs[i].sva);
+ }
+ if (!response.SerializeToString(&buffer)) {
+ LOG_E("Failed to serialize");
+ return -EPIPE;
+ }
+ LOG_D("session %x %d buffer(s) mapped", map.sid, request.buffers_size());
+ return static_cast<int>(buffer.length());
+}
+
+int ServerConnection::unmap(std::string& buffer, int& method_rc) {
+ // Request
+ UnmapRequest request;
+ if (!request.ParseFromString(buffer)) {
+ LOG_E("Failed to parse");
+ return -EPIPE;
+ }
+ if (!request.has_sid()) {
+ LOG_E("Required parameter missing");
+ return -EINVAL;
+ }
+ if (request.buffers_size() > MC_MAP_MAX) {
+ LOG_E("Incorrect number of buffers: %d", request.buffers_size());
+ return -EINVAL;
+ }
+ // Check session
+ std::lock_guard<std::mutex> connection_lock(connection_mutex);
+ if (!session_) {
+ LOG_E("No session");
+ return -ENOENT;
+ }
+ // Find local buffers
+ struct mc_ioctl_map map;
+ map.sid = request.sid();
+ LOG_D("unmap %d buffers from session %x", request.buffers_size(), map.sid);
+ if (request.buffers_size() > static_cast<int>(session_->buffers().size())) {
+ LOG_E("More buffers to unmap than we have: %d > %zu",
+ request.buffers_size(), session_->buffers().size());
+ return -EINVAL;
+ }
+ std::vector<Session::Buffer*> buffers;
+ for (int i = 0; i < request.buffers_size(); i++) {
+ // Need to find buffer to get VA/length
+ const UnmapRequest_Buffers& session_buffer = request.buffers(i);
+ if (!session_buffer.has_sva()) {
+ LOG_E("Given buffer has no SVA");
+ return -EINVAL;
+ }
+ auto buf = session_->findBuffer(session_buffer.sva());
+ if (!buf) {
+ LOG_E("No buffer record for SVA %jx in session %x",
+ session_buffer.sva(), request.sid());
+ method_rc = EINVAL;
+ return 0;
+ }
+ map.bufs[i] = buf->info();
+ buffers.push_back(buf);
+ }
+ for (int i = request.buffers_size(); i < MC_MAP_MAX; i++) {
+ map.bufs[i].va = 0;
+ }
+
+ // Call
+ if (driver.unmap(map)) {
+ method_rc = errno;
+ LOG_D("Error reported %s", strerror(errno));
+ return 0;
+ }
+
+ // No response
+ // Delete buffers
+ for (size_t i = 0; i < buffers.size(); i++) {
+ if (session_->removeBuffer(buffers[i]->info().sva)) {
+ LOG_E("Did not find our buffer anymore!?!");
+ return -EPIPE;
+ }
+ }
+ LOG_D("session %x %d buffer(s) unmapped", map.sid, request.buffers_size());
+ return 0;
+}
+
+int ServerConnection::getError(std::string& buffer, int& method_rc) {
+ // Request
+ GetErrorRequest request;
+ if (!request.ParseFromString(buffer)) {
+ LOG_E("Failed to parse");
+ return -EPIPE;
+ }
+ if (!request.has_sid()) {
+ LOG_E("Required parameter missing");
+ return -EINVAL;
+ }
+ struct mc_ioctl_geterr err;
+ err.sid = request.sid();
+
+ // Call
+ if (driver.getError(err)) {
+ method_rc = errno;
+ LOG_D("Error reported %s", strerror(errno));
+ return 0;
+ }
+
+ // Response
+ GetErrorResponse response;
+ response.set_exit_code(err.value);
+ if (!response.SerializeToString(&buffer)) {
+ LOG_E("Failed to serialize");
+ return -EPIPE;
+ }
+ LOG_D("session %x exit code %d", err.sid, err.value);
+ return static_cast<int>(buffer.length());
+}
+
+int ServerConnection::getVersion(std::string& buffer, int& method_rc) {
+ // Request
+ GetVersionRequest request;
+ if (!request.ParseFromString(buffer)) {
+ LOG_E("Failed to parse");
+ return -EPIPE;
+ }
+ // No inputs to check
+ struct mc_version_info version_info;
+
+ // Call
+ if (driver.getVersion(version_info)) {
+ method_rc = errno;
+ LOG_D("Error reported %s", strerror(errno));
+ return 0;
+ }
+
+ // Response
+ GetVersionResponse response;
+ response.set_product_id(version_info.product_id);
+ response.set_mci(version_info.version_mci);
+ response.set_so(version_info.version_so);
+ response.set_mclf(version_info.version_mclf);
+ response.set_container(version_info.version_container);
+ response.set_mc_config(version_info.version_mc_config);
+ response.set_tl_api(version_info.version_tl_api);
+ response.set_dr_api(version_info.version_dr_api);
+ response.set_nwd(version_info.version_nwd);
+ if (!response.SerializeToString(&buffer)) {
+ LOG_E("Failed to serialize");
+ return -EPIPE;
+ }
+ return static_cast<int>(buffer.length());
+}
+
+int ServerConnection::gpRequestCancellation(std::string& buffer,
+ int& method_rc) {
+ // Request
+ GetErrorRequest request;
+ if (!request.ParseFromString(buffer)) {
+ LOG_E("Failed to parse");
+ return -EPIPE;
+ }
+ if (!request.has_sid()) {
+ LOG_E("Required parameter missing");
+ return -EINVAL;
+ }
+
+ // Call
+ if (driver.gpRequestCancellation(request.sid())) {
+ method_rc = errno;
+ LOG_D("Error reported %s", strerror(errno));
+ return 0;
+ }
+
+ // No response
+ return 0;
+}
diff --git a/mobicore/MobiCoreDriverLib/ClientLib/Contrib/tee_client_api.cpp b/mobicore/MobiCoreDriverLib/ClientLib/Contrib/tee_client_api.cpp
new file mode 100644
index 0000000..3424ca7
--- /dev/null
+++ b/mobicore/MobiCoreDriverLib/ClientLib/Contrib/tee_client_api.cpp
@@ -0,0 +1,969 @@
+/*
+ * Copyright (c) 2013-2015 TRUSTONIC LIMITED
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the TRUSTONIC LIMITED nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdint.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include "Mci/mcinq.h" /* TA termination codes */
+
+#undef LOG_TAG
+#define LOG_TAG "TeeGpClient"
+#include "log.h"
+#include "common_client.h"
+#include "tee_client_api.h"
+#include "GpTci.h" /* Needs stuff from tee_client_api.h or its includes */
+
+//------------------------------------------------------------------------------
+// Macros
+#define _TEEC_GET_PARAM_TYPE(t, i) (((t) >> (4*i)) & 0xF)
+
+//Parameter number
+#define _TEEC_PARAMETER_NUMBER 4
+
+/**
+ * These error codes are still to be decided by GP and as we do not wish to
+ * expose any part of the GP TAF as of yet, for now they will have to live here
+ * until we decide what to do about them.
+ */
+#define TEEC_ERROR_TA_LOCKED 0xFFFF0257
+#define TEEC_ERROR_SD_BLOCKED 0xFFFF0258
+#define TEEC_ERROR_TARGET_KILLED 0xFFFF0259
+
+static CommonClient& client = CommonClient::getInstance();
+
+//------------------------------------------------------------------------------
+// Local functions
+static TEEC_Result _TEEC_UnwindOperation(
+ TEEC_Session_IMP* session,
+ _TEEC_TCI* tci,
+ TEEC_Operation* operation,
+ bool copyValues,
+ uint32_t* returnOrigin);
+
+//------------------------------------------------------------------------------
+static void _libUuidToArray(
+ const TEEC_UUID* uuid,
+ uint8_t* uuidArr) {
+ uint8_t* pIdentifierCursor = (uint8_t*)uuid;
+ /* offsets and syntax constants. See explanations above */
+#ifdef S_BIG_ENDIAN
+ uint32_t offsets = 0;
+#else
+ uint32_t offsets = 0xF1F1DF13;
+#endif
+ uint32_t i;
+
+ for (i = 0; i < sizeof(TEEC_UUID); i++) {
+ /* Two-digit hex number */
+ uint8_t number;
+ int32_t offset = ((int32_t)((offsets & 0xF) << 28)) >> 28;
+ number = pIdentifierCursor[offset];
+ offsets >>= 4;
+ pIdentifierCursor++;
+
+ uuidArr[i] = number;
+ }
+}
+
+//------------------------------------------------------------------------------
+static TEEC_Result _TEEC_SetupOperation(
+ TEEC_Session_IMP* session,
+ _TEEC_TCI* tci,
+ TEEC_Operation* operation,
+ uint32_t* returnOrigin) {
+ uint32_t i;
+ _TEEC_ParameterInternal* imp;
+ TEEC_Parameter* ext;
+ TEEC_Result teecResult = TEEC_SUCCESS;
+
+ LOG_D(" %s()", __func__);
+
+ tci->operation.isCancelled = false;
+ tci->operation.paramTypes = 0;
+
+ //operation can be NULL
+ if (operation) {
+ uint32_t n_buf = 0;
+ operation->started = 1;
+ // Buffers to map to SWd
+ struct mc_ioctl_map map;
+ map.sid = session->sessionId;
+ // Operation parameters for the buffers above
+ _TEEC_ParameterInternal* imps[_TEEC_PARAMETER_NUMBER] = { NULL };
+
+ //This design allows a non-NULL buffer with a size of 0 bytes to allow trivial integration with any
+ //implementations of the C library malloc, in which is valid to allocate a zero byte buffer and receive a non-
+ //NULL pointer which may not be de-referenced in return.
+
+ for (i = 0; i < _TEEC_PARAMETER_NUMBER && teecResult == TEEC_SUCCESS; i++) {
+ uint8_t paramType = _TEEC_GET_PARAM_TYPE(operation->paramTypes, i);
+
+ imp = &tci->operation.params[i];
+ ext = &operation->params[i];
+
+ switch (paramType) {
+ case TEEC_VALUE_OUTPUT:
+ LOG_D(" cycle %d, TEEC_VALUE_OUTPUT", i);
+ break;
+ case TEEC_NONE:
+ LOG_D(" cycle %d, TEEC_NONE", i);
+ break;
+ case TEEC_VALUE_INPUT:
+ case TEEC_VALUE_INOUT: {
+ LOG_D(" cycle %d, TEEC_VALUE_IN*", i);
+ imp->value.a = ext->value.a;
+ imp->value.b = ext->value.b;
+ break;
+ }
+ case TEEC_MEMREF_TEMP_INPUT:
+ case TEEC_MEMREF_TEMP_OUTPUT:
+ case TEEC_MEMREF_TEMP_INOUT: {
+ // A Temporary Memory Reference may be null, which can be used
+ // to denote a special case for the parameter. Output Memory
+ // References that are null are typically used to request the
+ // required output size.
+ LOG_D(" cycle %d, TEEC_MEMREF_TEMP_*", i);
+ if ((ext->tmpref.size) && (ext->tmpref.buffer)) {
+ map.bufs[n_buf].va = (uintptr_t)ext->tmpref.buffer;
+ map.bufs[n_buf].len = (uint32_t)ext->tmpref.size;
+ map.bufs[n_buf].flags = paramType & TEEC_MEM_INOUT;
+ imps[n_buf] = imp;
+ n_buf++;
+ } else {
+ LOG_D(" cycle %d, TEEC_TEMP_IN* - zero pointer or size", i);
+ }
+ break;
+ }
+ case TEEC_MEMREF_WHOLE: {
+ LOG_D(" cycle %d, TEEC_MEMREF_WHOLE", i);
+ if (ext->memref.parent->size) {
+ map.bufs[n_buf].va = (uintptr_t)ext->memref.parent->buffer;
+ map.bufs[n_buf].len = (uint32_t)ext->memref.parent->size;
+ map.bufs[n_buf].flags = ext->memref.parent->flags & TEEC_MEM_INOUT;
+ imps[n_buf] = imp;
+ n_buf++;
+ }
+ /* We don't transmit that the mem ref is the whole shared mem */
+ /* Magic number 4 means that it is a mem ref */
+ paramType = (uint8_t)ext->memref.parent->flags | 4;
+ break;
+ }
+ case TEEC_MEMREF_PARTIAL_INPUT:
+ case TEEC_MEMREF_PARTIAL_OUTPUT:
+ case TEEC_MEMREF_PARTIAL_INOUT: {
+ LOG_D(" cycle %d, TEEC_MEMREF_PARTIAL_*", i);
+ //Check data flow consistency
+ if ((((ext->memref.parent->flags & TEEC_MEM_INOUT) == TEEC_MEM_INPUT) &&
+ (paramType == TEEC_MEMREF_PARTIAL_OUTPUT)) ||
+ (((ext->memref.parent->flags & TEEC_MEM_INOUT) == TEEC_MEM_OUTPUT) &&
+ (paramType == TEEC_MEMREF_PARTIAL_INPUT))) {
+ LOG_E("PARTIAL data flow inconsistency");
+ *returnOrigin = TEEC_ORIGIN_API;
+ teecResult = TEEC_ERROR_BAD_PARAMETERS;
+ break;
+ }
+ /* We don't transmit that the mem ref is partial */
+ paramType &= TEEC_MEMREF_TEMP_INOUT;
+
+ if (ext->memref.offset + ext->memref.size > ext->memref.parent->size) {
+ LOG_E("PARTIAL offset/size error");
+ *returnOrigin = TEEC_ORIGIN_API;
+ teecResult = TEEC_ERROR_BAD_PARAMETERS;
+ break;
+ }
+ if (ext->memref.size) {
+ map.bufs[n_buf].va = (uintptr_t)ext->memref.parent->buffer + ext->memref.offset;
+ map.bufs[n_buf].len = (uint32_t)ext->memref.size;
+ map.bufs[n_buf].flags = paramType & TEEC_MEM_INOUT;
+ imps[n_buf] = imp;
+ n_buf++;
+ }
+ break;
+ }
+ default:
+ LOG_E("cycle %d, default", i);
+ *returnOrigin = TEEC_ORIGIN_API;
+ teecResult = TEEC_ERROR_BAD_PARAMETERS;
+ break;
+ }
+ tci->operation.paramTypes |= (uint32_t)(paramType << i * 4);
+ }
+
+ if (n_buf > MC_MAP_MAX) {
+ LOG_E("too many buffers: %s", strerror(errno));
+ teecResult = TEEC_ERROR_EXCESS_DATA;
+ }
+
+ if ((teecResult == TEEC_SUCCESS) && (tci->operation.isCancelled)) {
+ LOG_E("the operation has been cancelled in COMMS");
+ *returnOrigin = TEEC_ORIGIN_COMMS;
+ teecResult = TEEC_ERROR_CANCEL;
+ }
+
+ // Map buffers
+ if ((teecResult == TEEC_SUCCESS) && (n_buf > 0)) {
+ for (i = n_buf; i < MC_MAP_MAX; i++) {
+ map.bufs[i].va = 0;
+ }
+ if (client.map(map) == 0) {
+ for (i = 0; i < MC_MAP_MAX; i++) {
+ if (map.bufs[i].va) {
+ imps[i]->memref.sVirtualAddr = (uint32_t)map.bufs[i].sva;
+ imps[i]->memref.sVirtualLen = map.bufs[i].len;
+ }
+ }
+ } else {
+ LOG_E("client map failed: %s", strerror(errno));
+ *returnOrigin = TEEC_ORIGIN_COMMS;
+ teecResult = TEEC_ERROR_GENERIC;
+ }
+ }
+
+ if (teecResult != TEEC_SUCCESS) {
+ uint32_t retOrigIgnored;
+ _TEEC_UnwindOperation(session, tci, operation, false, &retOrigIgnored);
+ //Zeroing out tci->operation
+ memset(&tci->operation, 0, sizeof(tci->operation));
+ return teecResult;
+ }
+ }
+
+ //Copy version indicator field
+ memcpy(tci->header, "TCIGP000", sizeof(tci->header));
+
+ // Fill in invalid values for secure world to overwrite
+ tci->returnStatus = TEEC_ERROR_BAD_STATE;
+
+ // Signal completion of request writing
+ tci->ready = 1;
+
+ return teecResult;
+}
+
+//------------------------------------------------------------------------------
+static TEEC_Result _TEEC_UnwindOperation(
+ TEEC_Session_IMP* session,
+ _TEEC_TCI* tci,
+ TEEC_Operation* operation,
+ bool copyValues,
+ uint32_t* returnOrigin) {
+ uint32_t i;
+ _TEEC_ParameterInternal* imp;
+ TEEC_Parameter* ext;
+ uint32_t n_buf = 0;
+
+ //operation can be NULL
+ if (operation == NULL) {
+ return TEEC_SUCCESS;
+ }
+
+ LOG_D(" %s()", __func__);
+
+ operation->started = 2;
+ // Buffers to unmap from SWd
+ struct mc_ioctl_map map;
+ map.sid = session->sessionId;
+ // Some sanity checks
+ if (tci->returnOrigin == 0 ||
+ ((tci->returnOrigin != TEEC_ORIGIN_TRUSTED_APP) &&
+ (tci->returnStatus != TEEC_SUCCESS))) {
+ *returnOrigin = TEEC_ORIGIN_COMMS;
+ return TEEC_ERROR_COMMUNICATION;
+ }
+ *returnOrigin = tci->returnOrigin;
+
+ //Clear sVirtualLen to unMap further
+ for (i = 0; i < _TEEC_PARAMETER_NUMBER; i++) {
+ imp = &tci->operation.params[i];
+ ext = &operation->params[i];
+
+ switch (_TEEC_GET_PARAM_TYPE(operation->paramTypes, i)) {
+ case TEEC_VALUE_INPUT:
+ LOG_D(" cycle %d, TEEC_VALUE_INPUT", i);
+ break;
+ case TEEC_NONE:
+ LOG_D(" cycle %d, TEEC_NONE", i);
+ break;
+ case TEEC_VALUE_OUTPUT:
+ case TEEC_VALUE_INOUT: {
+ LOG_D(" cycle %d, TEEC_VALUE_*OUT", i);
+ if (copyValues) {
+ ext->value.a = imp->value.a;
+ ext->value.b = imp->value.b;
+ }
+ break;
+ }
+ case TEEC_MEMREF_TEMP_OUTPUT:
+ case TEEC_MEMREF_TEMP_INPUT:
+ case TEEC_MEMREF_TEMP_INOUT: {
+ LOG_D(" cycle %d, TEEC_TEMP*", i);
+ if ((copyValues) &&
+ (_TEEC_GET_PARAM_TYPE(operation->paramTypes, i) != TEEC_MEMREF_TEMP_INPUT)) {
+ ext->tmpref.size = imp->memref.outputSize;
+ }
+ if (imp->memref.sVirtualLen > 0) {
+ map.bufs[n_buf].va = (uintptr_t)ext->tmpref.buffer;
+ map.bufs[n_buf].sva = imp->memref.sVirtualAddr;
+ map.bufs[n_buf].len = imp->memref.sVirtualLen;
+ n_buf++;
+ }
+ break;
+ }
+ case TEEC_MEMREF_WHOLE: {
+ LOG_D(" cycle %d, TEEC_MEMREF_WHOLE", i);
+ if ((copyValues) && (ext->memref.parent->flags != TEEC_MEM_INPUT)) {
+ ext->memref.size = imp->memref.outputSize;
+ }
+ if (imp->memref.sVirtualLen > 0) {
+ map.bufs[n_buf].va = (uintptr_t)ext->memref.parent->buffer;
+ map.bufs[n_buf].sva = imp->memref.sVirtualAddr;
+ map.bufs[n_buf].len = imp->memref.sVirtualLen;
+ n_buf++;
+ }
+ break;
+ }
+
+ case TEEC_MEMREF_PARTIAL_OUTPUT:
+ case TEEC_MEMREF_PARTIAL_INOUT:
+ case TEEC_MEMREF_PARTIAL_INPUT: {
+ LOG_D(" cycle %d, TEEC_MEMREF_PARTIAL*", i);
+ if ((copyValues) &&
+ (_TEEC_GET_PARAM_TYPE(operation->paramTypes, i) != TEEC_MEMREF_PARTIAL_INPUT)) {
+ ext->memref.size = imp->memref.outputSize;
+ }
+ if (imp->memref.sVirtualLen > 0) {
+ map.bufs[n_buf].va = (uintptr_t)ext->memref.parent->buffer + ext->memref.offset;
+ map.bufs[n_buf].sva = imp->memref.sVirtualAddr;
+ map.bufs[n_buf].len = imp->memref.sVirtualLen;
+ n_buf++;
+ }
+ break;
+ }
+ default:
+ LOG_E("cycle %d, bad parameter", i);
+ break;
+ }
+ }
+
+ if (n_buf > MC_MAP_MAX) {
+ LOG_E("too many buffers: %s", strerror(errno));
+ return TEEC_ERROR_EXCESS_DATA;
+ }
+
+ for (i = n_buf; i < MC_MAP_MAX; i++) {
+ map.bufs[i].va = 0;
+ }
+
+ if (n_buf > 0) {
+ // This function assumes that we cannot handle errors
+ if (client.unmap(map) < 0) {
+ LOG_E("client unmap failed: %s", strerror(errno));
+ }
+ }
+
+ return tci->returnStatus;
+}
+
+//------------------------------------------------------------------------------
+//TEEC_InitializeContext: TEEC_SUCCESS, Another error code from Table 4-2.
+TEEC_Result TEEC_InitializeContext(
+ const char* name,
+ TEEC_Context* context) {
+ (void) name;
+ LOG_D("== %s() ==============", __func__);
+
+ if (context == NULL) {
+ LOG_E("context is NULL");
+ return TEEC_ERROR_BAD_PARAMETERS;
+ }
+
+ // For test purpose
+ switch (context->imp.reserved) {
+ case CommonClient::DRIVER:
+ client.setOpenMode(CommonClient::DRIVER);
+ break;
+ case CommonClient::PROXY:
+ client.setOpenMode(CommonClient::PROXY);
+ break;
+ }
+
+ if (client.open()) {
+ switch (errno) {
+ case ENOENT:
+ return TEEC_ERROR_COMMUNICATION;
+ case EINVAL:
+ return TEEC_ERROR_BAD_PARAMETERS;
+ default:
+ return TEEC_ERROR_GENERIC;
+ }
+ }
+
+ return TEEC_SUCCESS;
+}
+
+//------------------------------------------------------------------------------
+//TEEC_FinalizeContext: void
+
+// The implementation of this function MUST NOT be able to fail: after this function returns the Client
+// Application must be able to consider that the Context has been closed.
+
+void TEEC_FinalizeContext(
+ TEEC_Context* context) {
+ LOG_D("== %s() ==============", __func__);
+
+ // The parameter context MUST point to an initialized TEE Context.
+ if (context == NULL) {
+ LOG_E("context is NULL");
+ return;
+ }
+
+ // The implementation of this function MUST NOT be able to fail: after this function returns the Client
+ // Application must be able to consider that the Context has been closed.
+ if (client.close()) {
+ LOG_E("mcCloseDevice failed: %s", strerror(errno));
+ /* continue even in case of error */;
+ }
+}
+
+static void _TEEC_DeleteTci(TEEC_Session_IMP* session_imp) {
+ if (session_imp->tci) {
+ ::munmap(session_imp->tci, (size_t)sysconf(_SC_PAGESIZE));
+ session_imp->tci = NULL;
+ }
+}
+
+static void _TEEC_CloseSession(TEEC_Session_IMP* session_imp) {
+ if (client.closeSession(session_imp->sessionId)) {
+ LOG_E("%s failed: %s", __func__, strerror(errno));
+ }
+ session_imp->active = false;
+}
+
+//------------------------------------------------------------------------------
+static TEEC_Result _TEEC_CallTA(
+ TEEC_Session_IMP* session,
+ TEEC_Operation* operation,
+ uint32_t* returnOrigin) {
+ TEEC_Result teecRes;
+ TEEC_Result teecError = TEEC_SUCCESS;
+ int ret = 0;
+
+ LOG_D(" %s()", __func__);
+
+ // Phase 1: start the operation and wait for the result
+ _TEEC_TCI* tci = static_cast<_TEEC_TCI*>(session->tci);
+ teecRes = _TEEC_SetupOperation(session, tci, operation, returnOrigin);
+ if (teecRes != TEEC_SUCCESS ) {
+ LOG_E("_TEEC_SetupOperation failed (%08x)", teecRes);
+ return teecRes;
+ }
+
+ // Signal the Trusted App
+ ret = client.notify(session->sessionId);
+ if (ret) {
+ LOG_E("Notify failed: %s", strerror(errno));
+ teecError = TEEC_ERROR_COMMUNICATION;
+ } else {
+ // -------------------------------------------------------------
+ // Wait for the Trusted App response
+ struct mc_ioctl_wait wait;
+ wait.sid = session->sessionId;
+ wait.timeout = -1;
+ ret = client.waitNotification(wait);
+ if (ret) {
+ teecError = TEEC_ERROR_COMMUNICATION;
+ if (errno == ECOMM) {
+ struct mc_ioctl_geterr err;
+ err.sid = session->sessionId;
+
+ ret = client.getError(err);
+ switch (err.value) {
+ case TA_EXIT_CODE_FINISHED:
+ // We may get here if the TA_OpenSessionEntryPoint returns an error and TA goes fast through DestroyEntryPoint and exits the TA.
+ teecError = TEEC_SUCCESS;
+ break;
+ /* case ERR_SESSION_KILLED:
+ teecError = TEEC_ERROR_TARGET_KILLED;
+ break;
+ */
+ case ERR_INVALID_SID:
+ case ERR_SID_NOT_ACTIVE:
+ LOG_E("mcWaitNotification failed: %s", strerror(errno));
+ LOG_E("mcGetSessionErrorCode returned %d", err.value);
+ break;
+ default:
+ LOG_E("Target is DEAD");
+ *returnOrigin = TEEC_ORIGIN_TEE;
+ teecError = TEEC_ERROR_TARGET_DEAD;
+ break;
+ }
+ }
+ }
+ }
+ // Phase 2: Return values and cleanup
+ // unmap memory and copy values if no error
+ teecRes = _TEEC_UnwindOperation(session, tci, operation,
+ (teecError == TEEC_SUCCESS), returnOrigin);
+ if (teecRes != TEEC_SUCCESS ) {
+ LOG_E("_TEEC_UnwindOperation (%08x)", teecRes);
+ /* continue even in case of error */;
+ }
+
+ // Cleanup
+ if (teecError != TEEC_SUCCESS) {
+ if (teecError == TEEC_ERROR_COMMUNICATION) {
+ *returnOrigin = TEEC_ORIGIN_COMMS;
+ }
+ // Previous interactions failed, either TA is dead or communication error
+ _TEEC_CloseSession(session);
+ _TEEC_DeleteTci(session);
+ }
+ return teecError;
+}
+
+//------------------------------------------------------------------------------
+//TEEC_OpenSession: if the returnOrigin is different from TEEC_ORIGIN_TRUSTED_APP, an error code from Table 4-2
+// If the returnOrigin is equal to TEEC_ORIGIN_TRUSTED_APP, a return code defined by the
+//protocol between the Client Application and the Trusted Application.
+TEEC_Result TEEC_OpenSession (
+ TEEC_Context* context,
+ TEEC_Session* session,
+ const TEEC_UUID* destination,
+ uint32_t connectionMethod,
+ const void* connectionData,
+ TEEC_Operation* operation,
+ uint32_t* returnOrigin) {
+ TEEC_Result teecRes;
+ uint32_t returnOrigin_local = TEEC_ORIGIN_API;
+ struct mc_uuid_t tauuid;
+ int ret = 0;
+
+ LOG_D("== %s() ==============", __func__);
+ // -------------------------------------------------------------
+ //The parameter context MUST point to an initialized TEE Context.
+ if (context == NULL) {
+ LOG_E("context is NULL");
+ if (returnOrigin) {
+ *returnOrigin = TEEC_ORIGIN_API;
+ }
+ return TEEC_ERROR_BAD_PARAMETERS;
+ }
+
+ if (session == NULL) {
+ LOG_E("session is NULL");
+ if (returnOrigin) {
+ *returnOrigin = TEEC_ORIGIN_API;
+ }
+ return TEEC_ERROR_BAD_PARAMETERS;
+ }
+
+ if ((connectionMethod != TEEC_LOGIN_PUBLIC) &&
+ (connectionMethod != TEEC_LOGIN_USER) &&
+ (connectionMethod != TEEC_LOGIN_GROUP) &&
+ (connectionMethod != TEEC_LOGIN_APPLICATION) &&
+ (connectionMethod != TEEC_LOGIN_USER_APPLICATION) &&
+ (connectionMethod != TEEC_LOGIN_GROUP_APPLICATION)) {
+ LOG_E("connectionMethod not supported");
+ if (returnOrigin) {
+ *returnOrigin = TEEC_ORIGIN_API;
+ }
+ return TEEC_ERROR_NOT_IMPLEMENTED;
+ }
+
+ if ((TEEC_LOGIN_GROUP == connectionMethod) ||
+ (TEEC_LOGIN_GROUP_APPLICATION == connectionMethod)) {
+ if (NULL == connectionData) {
+ LOG_E("connectionData is NULL");
+ if (returnOrigin) {
+ *returnOrigin = TEEC_ORIGIN_API;
+ }
+ return TEEC_ERROR_BAD_PARAMETERS;
+ }
+ }
+
+ // -------------------------------------------------------------
+ session->imp.active = false;
+
+ _libUuidToArray(destination, tauuid.value);
+
+ if (operation) {
+ operation->imp.session = &session->imp;
+ }
+
+ //Allocate a 4kB page with mmap, zero it out, and set session->imp.tci to its address.
+ session->imp.tci = NULL;
+ void* bulkBuf = (void*)mmap(0, (size_t)sysconf(_SC_PAGESIZE),
+ PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ if (bulkBuf == MAP_FAILED) {
+ LOG_E("mmap failed on tci buffer allocation");
+ if (returnOrigin) {
+ *returnOrigin = TEEC_ORIGIN_API;
+ }
+ return TEEC_ERROR_OUT_OF_MEMORY;
+ }
+
+ session->imp.tci = bulkBuf;
+ memset(session->imp.tci, 0, (size_t)sysconf(_SC_PAGESIZE));
+
+ pthread_mutex_init(&session->imp.mutex_tci, NULL);
+ pthread_mutex_lock(&session->imp.mutex_tci);
+
+ //Fill the TCI buffer session.tci with the destination UUID.
+ _TEEC_TCI* tci = static_cast<_TEEC_TCI*>(session->imp.tci);
+ memcpy(&tci->destination, destination, sizeof(tci->destination));
+ // -------------------------------------------------------------
+ struct mc_ioctl_open_session sess;
+ sess.sid = 0;
+ sess.tci = (uintptr_t)tci;
+ sess.tcilen = sizeof(_TEEC_TCI);
+ sess.uuid = tauuid;
+ sess.is_gp_uuid = 1;
+ sess.identity.login_type = static_cast<mc_login_type>(connectionMethod);
+ sess.identity.pid = 0;
+ if (connectionData) {
+ memcpy(&sess.identity.login_data, connectionData,
+ sizeof(sess.identity.login_data));
+ }
+
+ ret = client.openSession(sess);
+ if (ret) {
+ LOG_E("%s failed: %s", __func__, strerror(errno));
+ if (returnOrigin) {
+ *returnOrigin = TEEC_ORIGIN_COMMS;
+ }
+ switch (errno) {
+ case ENOENT:
+ teecRes = TEEC_ERROR_ITEM_NOT_FOUND;
+ break;
+ case EACCES:
+ teecRes = TEEC_ERROR_ACCESS_DENIED;
+ break;
+ case EINVAL:
+ teecRes = TEEC_ERROR_NOT_IMPLEMENTED;
+ break;
+ case ECONNREFUSED:
+ teecRes = TEEC_ERROR_SD_BLOCKED;
+ break;
+ case ECONNABORTED:
+ teecRes = TEEC_ERROR_TA_LOCKED;
+ break;
+ case ECONNRESET:
+ teecRes = TEEC_ERROR_TARGET_KILLED;
+ break;
+ case EBUSY:
+ teecRes = TEEC_ERROR_BUSY;
+ break;
+ default:
+ teecRes = TEEC_ERROR_GENERIC;
+ }
+ goto error;
+ }
+
+ session->imp.context = context->imp;
+ session->imp.sessionId = sess.sid;
+ session->imp.active = true;
+ LOG_I(" created session ID %x", session->imp.sessionId);
+
+ // Let TA go through entry points
+ LOG_D(" let TA go through entry points");
+ tci->operation.type = _TA_OPERATION_OPEN_SESSION;
+ teecRes = _TEEC_CallTA(&session->imp, operation, &returnOrigin_local);
+
+ // Check for error on communication level
+ if (teecRes != TEEC_SUCCESS ) {
+ LOG_E("_TEEC_CallTA failed(%08x)", teecRes);
+ // Nothing to do here because _TEEC_CallTA closes broken sessions
+ if (returnOrigin) {
+ *returnOrigin = returnOrigin_local;
+ }
+ goto error;
+ }
+ LOG_D(" no errors in com layer");
+
+ // Check for error from TA
+ if (returnOrigin) {
+ *returnOrigin = tci->returnOrigin;
+ }
+ teecRes = tci->returnStatus;
+ if (teecRes != TEEC_SUCCESS ) {
+ LOG_E("TA OpenSession EP failed(%08x)", teecRes);
+ goto error;
+ }
+
+ LOG_D(" %s() = TEEC_SUCCESS ", __func__);
+ pthread_mutex_unlock(&session->imp.mutex_tci);
+
+ if (returnOrigin) {
+ *returnOrigin = TEEC_ORIGIN_TRUSTED_APP;
+ }
+ return TEEC_SUCCESS;
+
+ // -------------------------------------------------------------
+error:
+ if (session->imp.active) {
+ // After notifying us, TA went to Destry EP, so close session now
+ _TEEC_CloseSession(&session->imp);
+ }
+
+ pthread_mutex_unlock(&session->imp.mutex_tci);
+ pthread_mutex_destroy(&session->imp.mutex_tci);
+ _TEEC_DeleteTci(&session->imp);
+
+ LOG_D(" %s() = 0x%x", __func__, teecRes);
+ return teecRes;
+}
+
+//------------------------------------------------------------------------------
+TEEC_Result TEEC_InvokeCommand(
+ TEEC_Session* session,
+ uint32_t commandID,
+ TEEC_Operation* operation,
+ uint32_t* returnOrigin) {
+ TEEC_Result teecRes;
+ uint32_t returnOrigin_local = TEEC_ORIGIN_API;
+
+ LOG_D("== %s() ==============", __func__);
+
+ // -------------------------------------------------------------
+ if (session == NULL) {
+ LOG_E("session is NULL");
+ if (returnOrigin) {
+ *returnOrigin = TEEC_ORIGIN_API;
+ }
+ return TEEC_ERROR_BAD_PARAMETERS;
+ }
+
+ if (!session->imp.active) {
+ LOG_E("session is inactive");
+ if (returnOrigin) {
+ *returnOrigin = TEEC_ORIGIN_API;
+ }
+ return TEEC_ERROR_BAD_STATE;
+ }
+ // -------------------------------------------------------------
+ if (operation) {
+ operation->imp.session = &session->imp;
+ }
+
+ pthread_mutex_lock(&session->imp.mutex_tci);
+
+ // Call TA
+ _TEEC_TCI* tci = static_cast<_TEEC_TCI*>(session->imp.tci);
+ tci->operation.commandId = commandID;
+ tci->operation.type = _TA_OPERATION_INVOKE_COMMAND;
+ teecRes = _TEEC_CallTA(&session->imp, operation, &returnOrigin_local);
+ if (teecRes != TEEC_SUCCESS ) {
+ LOG_E("_TEEC_CallTA failed(%08x)", teecRes);
+ if (returnOrigin) {
+ *returnOrigin = returnOrigin_local;
+ }
+ } else {
+ if (returnOrigin) {
+ *returnOrigin = tci->returnOrigin;
+ }
+ teecRes = tci->returnStatus;
+ }
+
+ pthread_mutex_unlock(&session->imp.mutex_tci);
+ LOG_D(" %s() = 0x%x", __func__, teecRes);
+ return teecRes;
+}
+
+//------------------------------------------------------------------------------
+void TEEC_CloseSession(TEEC_Session* session) {
+ TEEC_Result teecRes = TEEC_SUCCESS;
+ uint32_t returnOrigin;
+
+ LOG_D("== %s() ==============", __func__);
+
+ // -------------------------------------------------------------
+ //The Implementation MUST do nothing if the session parameter is NULL.
+ if (session == NULL) {
+ LOG_E("session is NULL");
+ return;
+ }
+
+ // -------------------------------------------------------------
+ if (session->imp.active) {
+ // Let TA go through CloseSession and Destroy entry points
+ LOG_D(" let TA go through close entry points");
+ pthread_mutex_lock(&session->imp.mutex_tci);
+ _TEEC_TCI* tci = static_cast<_TEEC_TCI*>(session->imp.tci);
+ tci->operation.type = _TA_OPERATION_CLOSE_SESSION;
+ teecRes = _TEEC_CallTA(&session->imp, NULL, &returnOrigin);
+ if (teecRes != TEEC_SUCCESS ) {
+ /* continue even in case of error */;
+ LOG_E("_TEEC_CallTA failed(%08x)", teecRes);
+ }
+
+ if (session->imp.active) {
+ _TEEC_CloseSession(&session->imp);
+ }
+ pthread_mutex_unlock(&session->imp.mutex_tci);
+ }
+
+ pthread_mutex_destroy(&session->imp.mutex_tci);
+ _TEEC_DeleteTci(&session->imp);
+
+ LOG_D(" %s() = 0x%x", __func__, teecRes);
+}
+
+//------------------------------------------------------------------------------
+TEEC_Result TEEC_RegisterSharedMemory(
+ TEEC_Context* context,
+ TEEC_SharedMemory* sharedMem) {
+ LOG_D("== %s() ==============", __func__);
+
+ //The parameter context MUST point to an initialized TEE Context.
+ if (context == NULL) {
+ LOG_E("context is NULL");
+ return TEEC_ERROR_BAD_PARAMETERS;
+ }
+ //The parameter sharedMem MUST point to the Shared Memory structure defining
+ //the memory region to register.
+ if (sharedMem == NULL) {
+ LOG_E("sharedMem is NULL");
+ return TEEC_ERROR_BAD_PARAMETERS;
+ }
+ //The buffer field MUST point to the memory region to be shared, and MUST not be NULL.
+ if (sharedMem->buffer == NULL) {
+ LOG_E("sharedMem->buffer is NULL");
+ return TEEC_ERROR_BAD_PARAMETERS;
+ }
+ if ((static_cast<int>(sharedMem->flags) & ~TEEC_MEM_INOUT)) {
+ LOG_E("sharedMem->flags is incorrect");
+ return TEEC_ERROR_BAD_PARAMETERS;
+ }
+ if (sharedMem->flags == 0) {
+ LOG_E("sharedMem->flags is incorrect");
+ return TEEC_ERROR_BAD_PARAMETERS;
+ }
+
+ sharedMem->imp.implementation_allocated = false;
+ return TEEC_SUCCESS;
+}
+
+//------------------------------------------------------------------------------
+TEEC_Result TEEC_AllocateSharedMemory(
+ TEEC_Context* context,
+ TEEC_SharedMemory* sharedMem) {
+ //No connection to "context"?
+ LOG_D("== %s() ==============", __func__);
+
+ //The parameter context MUST point to an initialized TEE Context.
+ if (context == NULL) {
+ LOG_E("context is NULL");
+ return TEEC_ERROR_BAD_PARAMETERS;
+ }
+ //The parameter sharedMem MUST point to the Shared Memory structure defining
+ //the memory region to register.
+ if (sharedMem == NULL) {
+ LOG_E("sharedMem is NULL");
+ return TEEC_ERROR_BAD_PARAMETERS;
+ }
+ if (static_cast<int>(sharedMem->flags) & ~TEEC_MEM_INOUT) {
+ LOG_E("sharedMem->flags is incorrect");
+ return TEEC_ERROR_BAD_PARAMETERS;
+ }
+ if (sharedMem->flags == 0) {
+ LOG_E("sharedMem->flags is incorrect");
+ return TEEC_ERROR_BAD_PARAMETERS;
+ }
+
+ sharedMem->buffer = malloc(sharedMem->size);
+ if (sharedMem->buffer == NULL) {
+ LOG_E("malloc failed");
+ return TEEC_ERROR_OUT_OF_MEMORY;
+ }
+ sharedMem->imp.implementation_allocated = true;
+
+ return TEEC_SUCCESS;
+}
+
+//------------------------------------------------------------------------------
+void TEEC_ReleaseSharedMemory (
+ TEEC_SharedMemory* sharedMem) {
+ //No connection to "context"?
+ LOG_D("== %s() ==============", __func__);
+
+ //The Implementation MUST do nothing if the sharedMem parameter is NULL
+ if (sharedMem == NULL) {
+ LOG_E("sharedMem is NULL");
+ return;
+ }
+
+ //For a memory buffer allocated using TEEC_AllocateSharedMemory the Implementation
+ //MUST free the underlying memory
+ if (sharedMem->imp.implementation_allocated) {
+ if (sharedMem->buffer) {
+ free(sharedMem->buffer);
+ sharedMem->buffer = NULL;
+ sharedMem->size = 0;
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+void TEEC_RequestCancellation(
+ TEEC_Operation* operation) {
+ LOG_D("== %s() ==============", __func__);
+
+ while (operation->started == 0);
+
+ LOG_D("while(operation->started ==0) passed");
+
+ if (operation->started > 1) {
+ LOG_D("The operation has finished");
+ return;
+ }
+
+ TEEC_Session_IMP* session = operation->imp.session;
+ operation->started = 2;
+
+ if (!session->active) {
+ LOG_D("Corresponding session is not active");
+ return;
+ }
+
+ if (client.gpRequestCancellation(session->sessionId)) {
+ LOG_ERRNO("gpRequestCancellation");
+ }
+}
+
+//------------------------------------------------------------------------------
diff --git a/mobicore/MobiCoreDriverLib/ClientLib/Device.cpp b/mobicore/MobiCoreDriverLib/ClientLib/Device.cpp
index 703f28d..cd972ab 100644
--- a/mobicore/MobiCoreDriverLib/ClientLib/Device.cpp
+++ b/mobicore/MobiCoreDriverLib/ClientLib/Device.cpp
@@ -48,7 +48,8 @@ Device::Device(uint32_t deviceId, Connection *connection)
{
this->deviceId = deviceId;
this->connection = connection;
- this->openCount = 0;
+ this->isValid_ = true;
+
pMcKMod = new CMcKMod();
}
diff --git a/mobicore/MobiCoreDriverLib/ClientLib/Device.h b/mobicore/MobiCoreDriverLib/ClientLib/Device.h
index 2be2e97..d363bab 100644
--- a/mobicore/MobiCoreDriverLib/ClientLib/Device.h
+++ b/mobicore/MobiCoreDriverLib/ClientLib/Device.h
@@ -44,19 +44,20 @@
#include "CWsm.h"
-class Device
-{
+class Device {
+
private:
sessionList_t sessionList; /**< MobiCore Trustlet session associated with the device */
wsmList_t wsmL2List; /**< WSM L2 Table */
+ bool isValid_;
+
public:
uint32_t deviceId; /**< Device identifier */
Connection *connection; /**< The device connection */
- CMcKMod_ptr pMcKMod;
- uint32_t openCount;
+ CMcKMod_ptr pMcKMod;
Device(
uint32_t deviceId,
@@ -82,6 +83,24 @@ public:
void close(
void
);
+
+ /**
+ * Mark device as invalid.
+ */
+ void setInvalid()
+ {
+ isValid_ = false;
+ }
+
+ /**
+ * Return whether device is valid.
+ */
+ bool isValid()
+ {
+ return isValid_;
+ }
+
+
/**
* Check if the device has open sessions.
@@ -167,4 +186,3 @@ public:
};
#endif /* DEVICE_H_ */
-
diff --git a/mobicore/MobiCoreDriverLib/ClientLib/GP/tee_client_api.cpp b/mobicore/MobiCoreDriverLib/ClientLib/GP/tee_client_api.cpp
deleted file mode 100644
index 0568935..0000000
--- a/mobicore/MobiCoreDriverLib/ClientLib/GP/tee_client_api.cpp
+++ /dev/null
@@ -1,849 +0,0 @@
-/*
- * Copyright (c) 2013-2014 TRUSTONIC LIMITED
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the TRUSTONIC LIMITED nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#undef LOG_TAG
-#define LOG_TAG "GpClient"
-#include "tee_client_api.h"
-#include "log.h"
-#include "MobiCoreDriverApi.h"
-#include "Mci/mcinq.h"
-#include <stdlib.h>
-#include <sys/mman.h>
-#include "GpTci.h"
-#include "../Session.h"
-
-//------------------------------------------------------------------------------
-// Macros
-#define _TEEC_GET_PARAM_TYPE(t, i) (((t) >> (4*i)) & 0xF)
-
-//Parameter number
-#define _TEEC_PARAMETER_NUMBER 4
-
-
-//------------------------------------------------------------------------------
-//Local satic functions
-static void _libUuidToArray(
- const TEEC_UUID *uuid,
- uint8_t *uuid_str);
-
-
-static TEEC_Result _TEEC_UnwindOperation(
- _TEEC_TCI *tci,
- mcSessionHandle_t *handle,
- TEEC_Operation *operation,
- bool copyValues,
- uint32_t *returnOrigin);
-
-static TEEC_Result _TEEC_SetupOperation(
- _TEEC_TCI *tci,
- mcSessionHandle_t *handle,
- TEEC_Operation *operation,
- uint32_t *returnOrigin);
-
-//------------------------------------------------------------------------------
-static void _libUuidToArray(
- const TEEC_UUID *uuid,
- uint8_t *uuidArr)
-{
- uint8_t *pIdentifierCursor = (uint8_t *)uuid;
- /* offsets and syntax constants. See explanations above */
-#ifdef S_BIG_ENDIAN
- uint32_t offsets = 0;
-#else
- uint32_t offsets = 0xF1F1DF13;
-#endif
- uint32_t i;
-
- for (i = 0; i < sizeof(TEEC_UUID); i++) {
- /* Two-digit hex number */
- uint8_t number;
- int32_t offset = ((int32_t)((offsets & 0xF) << 28)) >> 28;
- number = pIdentifierCursor[offset];
- offsets >>= 4;
- pIdentifierCursor++;
-
- uuidArr[i] = number;
- }
-}
-
-//------------------------------------------------------------------------------
-static TEEC_Result _TEEC_SetupOperation(
- _TEEC_TCI *tci,
- mcSessionHandle_t *handle,
- TEEC_Operation *operation,
- uint32_t *returnOrigin)
-{
- uint32_t i;
- _TEEC_ParameterInternal *imp;
- TEEC_Parameter *ext;
- mcResult_t mcRet = MC_DRV_OK;
- TEEC_Result teecResult = TEEC_SUCCESS;
-
- LOG_I(" %s()", __func__);
-
- tci->operation.isCancelled = false;
- tci->operation.paramTypes = 0;
-
- //operation can be NULL
- if (operation != NULL) {
-
- operation->started = 1;
-
- //This design allows a non-NULL buffer with a size of 0 bytes to allow trivial integration with any
- //implementations of the C library malloc, in which is valid to allocate a zero byte buffer and receive a non-
- //NULL pointer which may not be de-referenced in return.
-
- for (i = 0; i < _TEEC_PARAMETER_NUMBER; i++) {
- uint8_t paramType = _TEEC_GET_PARAM_TYPE(operation->paramTypes, i);
-
- imp = &tci->operation.params[i];
- ext = &operation->params[i];
-
- switch (paramType) {
- case TEEC_VALUE_OUTPUT:
- LOG_I(" cycle %d, TEEC_VALUE_OUTPUT", i);
- break;
- case TEEC_NONE:
- LOG_I(" cycle %d, TEEC_NONE", i);
- break;
- case TEEC_VALUE_INPUT:
- case TEEC_VALUE_INOUT: {
- LOG_I(" cycle %d, TEEC_VALUE_IN*", i);
- imp->value.a = ext->value.a;
- imp->value.b = ext->value.b;
- break;
- }
- case TEEC_MEMREF_TEMP_INPUT:
- case TEEC_MEMREF_TEMP_OUTPUT:
- case TEEC_MEMREF_TEMP_INOUT: {
- //TODO: A Temporary Memory Reference may be null, which can be used to denote a special case for the
- //parameter. Output Memory References that are null are typically used to request the required output size.
- LOG_I(" cycle %d, TEEC_TEMP_IN*", i);
- imp->memref.mapInfo.sVirtualLen = 0;
- if ((ext->tmpref.size) && (ext->tmpref.buffer)) {
- mcRet = mcMap(handle, ext->tmpref.buffer, ext->tmpref.size, &imp->memref.mapInfo);
- if (mcRet != MC_DRV_OK) {
- LOG_E("mcMap failed, mcRet=0x%08X", mcRet);
- *returnOrigin = TEEC_ORIGIN_COMMS;
- i = _TEEC_PARAMETER_NUMBER;
- }
- } else {
- LOG_I(" cycle %d, TEEC_TEMP_IN* - zero pointer or size", i);
- }
- break;
- }
- case TEEC_MEMREF_WHOLE: {
- LOG_I(" cycle %d, TEEC_MEMREF_WHOLE", i);
- imp->memref.mapInfo.sVirtualLen = 0;
- if (ext->memref.parent->size) {
- mcRet = mcMap(handle, ext->memref.parent->buffer, ext->memref.parent->size, &imp->memref.mapInfo);
- if (mcRet != MC_DRV_OK) {
- LOG_E("mcMap failed, mcRet=0x%08X", mcRet);
- *returnOrigin = TEEC_ORIGIN_COMMS;
- i = _TEEC_PARAMETER_NUMBER;
- }
- }
- /* We don't transmit that the mem ref is the whole shared mem */
- /* Magic number 4 means that it is a mem ref */
- paramType = ext->memref.parent->flags | 4;
- break;
- }
- case TEEC_MEMREF_PARTIAL_INPUT:
- case TEEC_MEMREF_PARTIAL_OUTPUT:
- case TEEC_MEMREF_PARTIAL_INOUT: {
- LOG_I(" cycle %d, TEEC_PARTIAL_IN*", i);
- //Check data flow consistency
- if ((((ext->memref.parent->flags & (TEEC_MEM_INPUT | TEEC_MEM_OUTPUT)) == TEEC_MEM_INPUT) &&
- (paramType == TEEC_MEMREF_PARTIAL_OUTPUT)) ||
- (((ext->memref.parent->flags & (TEEC_MEM_INPUT | TEEC_MEM_OUTPUT)) == TEEC_MEM_OUTPUT) &&
- (paramType == TEEC_MEMREF_PARTIAL_INPUT))) {
- LOG_E("PARTIAL data flow inconsistency");
- *returnOrigin = TEEC_ORIGIN_API;
- teecResult = TEEC_ERROR_BAD_PARAMETERS;
- i = _TEEC_PARAMETER_NUMBER;
- break;
- }
- /* We don't transmit that the mem ref is partial */
- paramType &= TEEC_MEMREF_TEMP_INOUT;
-
- if (ext->memref.offset + ext->memref.size > ext->memref.parent->size) {
- LOG_E("PARTIAL offset/size error");
- *returnOrigin = TEEC_ORIGIN_API;
- teecResult = TEEC_ERROR_BAD_PARAMETERS;
- i = _TEEC_PARAMETER_NUMBER;
- break;
- }
- imp->memref.mapInfo.sVirtualLen = 0;
- if (ext->memref.size) {
- mcRet = mcMap(handle, (uint8_t *)ext->memref.parent->buffer + ext->memref.offset, ext->memref.size, &imp->memref.mapInfo);
- if (mcRet != MC_DRV_OK) {
- LOG_E("mcMap failed, mcRet=0x%08X", mcRet);
- *returnOrigin = TEEC_ORIGIN_COMMS;
- i = _TEEC_PARAMETER_NUMBER;
- }
- }
- break;
- }
- default:
- LOG_E("cycle %d, default", i);
- *returnOrigin = TEEC_ORIGIN_API;
- teecResult = TEEC_ERROR_BAD_PARAMETERS;
- i = _TEEC_PARAMETER_NUMBER;
- break;
- }
- tci->operation.paramTypes |= (paramType<<i*4);
- }
-
- if (tci->operation.isCancelled) {
- LOG_E("the operation has been cancelled in COMMS");
- *returnOrigin = TEEC_ORIGIN_COMMS;
- teecResult = TEEC_ERROR_CANCEL;
- }
-
- if ((mcRet != MC_DRV_OK) || (teecResult != TEEC_SUCCESS)) {
- uint32_t retOrigIgnored;
- _TEEC_UnwindOperation(tci, handle, operation, false, &retOrigIgnored);
- //Zeroing out tci->operation
- memset(&tci->operation, 0, sizeof(tci->operation));
- if (teecResult != TEEC_SUCCESS) return teecResult;
- return TEEC_ERROR_GENERIC;
- }
- }
-
- //Copy version indicator field
- memcpy(tci->header, "TCIGP000", sizeof(tci->header));
-
- // Fill in invalid values for secure world to overwrite
- tci->returnStatus = TEEC_ERROR_BAD_STATE;
-
- // Signal completion of request writing
- tci->ready = 1;
-
- return teecResult;
-}
-
-//------------------------------------------------------------------------------
-static TEEC_Result _TEEC_UnwindOperation(
- _TEEC_TCI *tci,
- mcSessionHandle_t *handle,
- TEEC_Operation *operation,
- bool copyValues,
- uint32_t *returnOrigin)
-{
- uint32_t i;
- _TEEC_ParameterInternal *imp;
- TEEC_Parameter *ext;
- uint8_t *buffer;
-
- //operation can be NULL
- if (operation == NULL) return TEEC_SUCCESS;
-
- LOG_I(" %s()", __func__);
-
- operation->started = 2;
-
- // Some sanity checks
- if (tci->returnOrigin == 0 ||
- ((tci->returnOrigin != TEEC_ORIGIN_TRUSTED_APP) && (tci->returnStatus != TEEC_SUCCESS))) {
- *returnOrigin = TEEC_ORIGIN_COMMS;
- return TEEC_ERROR_COMMUNICATION;
- }
- *returnOrigin = tci->returnOrigin;
-
- //Clear sVirtualLen to unMap further
- for (i = 0; i < _TEEC_PARAMETER_NUMBER; i++) {
- imp = &tci->operation.params[i];
- ext = &operation->params[i];
- buffer = NULL;
-
- switch (_TEEC_GET_PARAM_TYPE(operation->paramTypes, i)) {
- case TEEC_VALUE_INPUT:
- LOG_I(" cycle %d, TEEC_VALUE_INPUT", i);
- break;
- case TEEC_NONE:
- LOG_I(" cycle %d, TEEC_NONE", i);
- break;
- case TEEC_VALUE_OUTPUT:
- case TEEC_VALUE_INOUT: {
- LOG_I(" cycle %d, TEEC_VALUE_*OUT", i);
- if (copyValues) {
- ext->value.a = imp->value.a;
- ext->value.b = imp->value.b;
- }
- break;
- }
- case TEEC_MEMREF_TEMP_OUTPUT:
- case TEEC_MEMREF_TEMP_INPUT:
- case TEEC_MEMREF_TEMP_INOUT: {
- LOG_I(" cycle %d, TEEC_TEMP*", i);
- if ((copyValues) && (_TEEC_GET_PARAM_TYPE(operation->paramTypes, i) != TEEC_MEMREF_TEMP_INPUT)) {
- ext->tmpref.size = imp->memref.outputSize;
- }
- buffer = (uint8_t *)ext->tmpref.buffer;
- break;
- }
- case TEEC_MEMREF_WHOLE: {
- LOG_I(" cycle %d, TEEC_MEMREF_WHOLE", i);
- if ((copyValues) && (ext->memref.parent->flags != TEEC_MEM_INPUT)) {
- ext->memref.size = imp->memref.outputSize;
- }
- buffer = (uint8_t *)ext->memref.parent->buffer;
- break;
- }
-
- case TEEC_MEMREF_PARTIAL_OUTPUT:
- case TEEC_MEMREF_PARTIAL_INOUT:
- case TEEC_MEMREF_PARTIAL_INPUT: {
- LOG_I(" cycle %d, TEEC_MEMREF_PARTIAL*", i);
- if ((copyValues) && (_TEEC_GET_PARAM_TYPE(operation->paramTypes, i) != TEEC_MEMREF_PARTIAL_INPUT)) {
- ext->memref.size = imp->memref.outputSize;
- }
- buffer = (uint8_t *)ext->memref.parent->buffer + ext->memref.offset;
- break;
- }
- default:
- LOG_E("cycle %d, bad parameter", i);
- break;
- }
-
- if ((buffer != NULL) && (imp->memref.mapInfo.sVirtualLen != 0)) {
- // This function assumes that we cannot handle error of mcUnmap
- (void)mcUnmap(handle, buffer, &imp->memref.mapInfo);
- }
- }
-
- return tci->returnStatus;
-}
-
-//------------------------------------------------------------------------------
-//TEEC_InitializeContext: TEEC_SUCCESS, Another error code from Table 4-2.
-//MC_DRV_OK, MC_DRV_ERR_INVALID_OPERATION, MC_DRV_ERR_DAEMON_UNREACHABLE, MC_DRV_ERR_UNKNOWN_DEVICE, MC_DRV_ERR_INVALID_DEVICE_FILE
-TEEC_Result TEEC_InitializeContext(
- const char */*name*/,
- TEEC_Context *context)
-{
- LOG_I("== %s() ==============", __func__);
-
- if (context == NULL) return TEEC_ERROR_BAD_PARAMETERS;
- context->imp.reserved = MC_DEVICE_ID_DEFAULT;
-
- switch (mcOpenDevice(MC_DEVICE_ID_DEFAULT)) {
- case MC_DRV_OK:
- return TEEC_SUCCESS;
- case MC_DRV_ERR_DAEMON_UNREACHABLE:
- return TEEC_ERROR_COMMUNICATION;
- case MC_DRV_ERR_UNKNOWN_DEVICE:
- return TEEC_ERROR_BAD_PARAMETERS;
- case MC_DRV_ERR_INVALID_DEVICE_FILE:
- return TEEC_ERROR_COMMUNICATION;
- }
-
- return TEEC_ERROR_GENERIC;
-}
-
-//------------------------------------------------------------------------------
-//mcCloseDevice: MC_DRV_OK, MC_DRV_ERR_UNKNOWN_DEVICE, MC_DRV_ERR_SESSION_PENDING, MC_DRV_ERR_DAEMON_UNREACHABLE
-//TEEC_FinalizeContext: void
-
-//TODO: The implementation of this function MUST NOT be able to fail: after this function returns the Client
-//Application must be able to consider that the Context has been closed.
-
-void TEEC_FinalizeContext(TEEC_Context *context)
-{
- mcResult_t mcRet;
-
- LOG_I("== %s() ==============", __func__);
-
- //The parameter context MUST point to an initialized TEE Context.
- //Just realized: The function implementation MUST do nothing if context is NULL.
- if (context == NULL) {
- LOG_E("context is NULL");
- return;
- }
-
- //The implementation of this function MUST NOT be able to fail: after this function returns the Client
- //Application must be able to consider that the Context has been closed.
- mcRet = mcCloseDevice(context->imp.reserved);
- if (mcRet != MC_DRV_OK) {
- LOG_E("mcCloseDevice failed (%08x)", mcRet);
- /* continue even in case of error */;
- }
-}
-
-//------------------------------------------------------------------------------
-static TEEC_Result _TEEC_CallTA(
- TEEC_Session *session,
- TEEC_Operation *operation,
- uint32_t *returnOrigin)
-{
- mcResult_t mcRet;
- TEEC_Result teecRes;
- TEEC_Result teecError = TEEC_SUCCESS;
-
- LOG_I(" %s()", __func__);
-
- // Phase 1: start the operation and wait for the result
- teecRes = _TEEC_SetupOperation((_TEEC_TCI *)session->imp.tci, &session->imp.handle, operation, returnOrigin);
- if (teecRes != TEEC_SUCCESS ) {
- LOG_E("_TEEC_SetupOperation failed (%08x)", teecRes);
- return teecRes;
- }
-
- // Signal the Trusted App
- mcRet = mcNotify(&session->imp.handle);
- if (MC_DRV_OK != mcRet) {
- LOG_E("Notify failed (%08x)", mcRet);
- teecError = TEEC_ERROR_COMMUNICATION;
- goto end;
- }
-
- // -------------------------------------------------------------
- // Wait for the Trusted App response
- mcRet = mcWaitNotification(&session->imp.handle, MC_INFINITE_TIMEOUT);
- if (mcRet != MC_DRV_OK) {
- teecError = TEEC_ERROR_COMMUNICATION;
- if (mcRet == MC_DRV_INFO_NOTIFICATION) {
- int32_t lastErr = SESSION_ERR_NO;
- mcGetSessionErrorCode(&session->imp.handle, &lastErr);
- if (lastErr == TA_EXIT_CODE_FINISHED) {
- // We may get here if the TA_OpenSessionEntryPoint returns an error and TA goes fast through DestroyEntryPoint and exits the TA.
- teecError = TEEC_SUCCESS;
- } else if (lastErr != ERR_INVALID_SID && lastErr != ERR_SID_NOT_ACTIVE) {
- LOG_E("Target is DEAD");
-
- *returnOrigin = TEEC_ORIGIN_TEE;
- teecError = TEEC_ERROR_TARGET_DEAD;
- } else {
- LOG_E("mcWaitNotification failed (%08x)", mcRet);
- LOG_E("mcGetSessionErrorCode returned %d", lastErr);
- }
- }
- }
- // Phase 2: Return values and cleanup
-end:
- // unmap memory and copy values if no error
- teecRes = _TEEC_UnwindOperation((_TEEC_TCI *)session->imp.tci, &session->imp.handle, operation,
- (teecError == TEEC_SUCCESS), returnOrigin);
- if (teecRes != TEEC_SUCCESS ) {
- LOG_E("_TEEC_UnwindOperation (%08x)", teecRes);
- /* continue even in case of error */;
- }
-
- // Cleanup
- if (teecError != TEEC_SUCCESS) {
- // Previous interactions failed, either TA is dead or communication error
- mcRet = mcCloseSession(&session->imp.handle);
- if (mcRet != MC_DRV_OK) {
- LOG_E("mcCloseSession failed (%08x)", mcRet);
- /* continue even in case of error */;
- }
- session->imp.active = false;
- if (teecError == TEEC_ERROR_COMMUNICATION) {
- *returnOrigin = TEEC_ORIGIN_COMMS;
- }
- munmap(session->imp.tci, sysconf(_SC_PAGESIZE));
- session->imp.tci = NULL;
- }
- return teecError;
-}
-
-//------------------------------------------------------------------------------
-__MC_CLIENT_LIB_API mcResult_t mcOpenGPTA(
- mcSessionHandle_t *session,
- const mcUuid_t *uuid,
- uint8_t *tci,
- uint32_t len
-);
-//------------------------------------------------------------------------------
-//TEEC_OpenSession: if the returnOrigin is different from TEEC_ORIGIN_TRUSTED_APP, an error code from Table 4-2
-// If the returnOrigin is equal to TEEC_ORIGIN_TRUSTED_APP, a return code defined by the
-//protocol between the Client Application and the Trusted Application.
-TEEC_Result TEEC_OpenSession (
- TEEC_Context *context,
- TEEC_Session *session,
- const TEEC_UUID *destination,
- uint32_t connectionMethod,
- void */*connectionData*/,
- TEEC_Operation *operation,
- uint32_t *returnOrigin)
-{
- mcResult_t mcRet;
- TEEC_Result teecRes;
- uint32_t returnOrigin_local;
- mcUuid_t tauuid;
-
- LOG_I("== %s() ==============", __func__);
- // -------------------------------------------------------------
- //The parameter context MUST point to an initialized TEE Context.
- if (context == NULL) {
- LOG_E("context is NULL");
- if (returnOrigin != NULL) *returnOrigin = TEEC_ORIGIN_API;
- return TEEC_ERROR_BAD_PARAMETERS;
- }
-
- if (session == NULL) {
- LOG_E("session is NULL");
- if (returnOrigin != NULL) *returnOrigin = TEEC_ORIGIN_API;
- return TEEC_ERROR_BAD_PARAMETERS;
- }
-
- if (connectionMethod != TEEC_LOGIN_PUBLIC) {
- //JACKET: Client authorization is not supported. The connectionMethod parameter
- //must be TEEC LOGIN PUBLIC, otherwise return TEEC ERROR NOT IMPLEMENTED.
- LOG_E("connectionMethod != TEEC_LOGIN_PUBLIC");
- if (returnOrigin != NULL) *returnOrigin = TEEC_ORIGIN_API;
- return TEEC_ERROR_NOT_IMPLEMENTED;
- }
-
- // -------------------------------------------------------------
- session->imp.active = false;
-
- _libUuidToArray((TEEC_UUID *)destination, (uint8_t *)tauuid.value);
-
- if (operation) operation->imp.session = &session->imp;
-
- //Allocate a 4kB page with mmap, zero it out, and set session->imp.tci to its address.
- session->imp.tci = NULL;
- void *bulkBuf = (void *)mmap(0, sysconf(_SC_PAGESIZE), PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
- if (bulkBuf == MAP_FAILED) {
- LOG_E("mmap failed on tci buffer allocation");
- if (returnOrigin != NULL) *returnOrigin = TEEC_ORIGIN_API;
- return TEEC_ERROR_OUT_OF_MEMORY;
- }
-
- session->imp.tci = bulkBuf;
- memset(session->imp.tci, 0, sysconf(_SC_PAGESIZE));
-
- pthread_mutex_init(&session->imp.mutex_tci, NULL);
- pthread_mutex_lock(&session->imp.mutex_tci);
-
- //Fill the TCI buffer session.tci with the destination UUID.
- memcpy(&(((_TEEC_TCI *)session->imp.tci)->destination), destination, sizeof(TEEC_UUID));
- // -------------------------------------------------------------
- memset(&session->imp.handle, 0, sizeof(mcSessionHandle_t));
- session->imp.handle.deviceId = context->imp.reserved ; // The device ID (default device is used)
- mcRet = mcOpenGPTA(
- &session->imp.handle,
- &tauuid,
- (uint8_t *)session->imp.tci,
- sizeof(_TEEC_TCI));
- if (mcRet != MC_DRV_OK) {
- LOG_E("mcOpenGPTA failed (%08x)", mcRet);
- if (returnOrigin != NULL) *returnOrigin = TEEC_ORIGIN_COMMS;
- if (mcRet == MC_DRV_ERR_TRUSTED_APPLICATION_NOT_FOUND) {
- teecRes = TEEC_ERROR_ITEM_NOT_FOUND;
- } else {
- //TODO: Improve the error codes
- teecRes = TEEC_ERROR_GENERIC;
- }
- goto error;
- }
-
- session->imp.active = true;
-
- // Let TA go through entry points
- LOG_I(" let TA go through entry points");
- ((_TEEC_TCI *)session->imp.tci)->operation.type = _TA_OPERATION_OPEN_SESSION;
- teecRes = _TEEC_CallTA(session, operation, &returnOrigin_local);
-
- // Check for error on communication level
- if (teecRes != TEEC_SUCCESS ) {
- LOG_E("_TEEC_CallTA failed(%08x)", teecRes);
- // Nothing to do here because _TEEC_CallTA closes broken sessions
- if (returnOrigin != NULL) *returnOrigin = returnOrigin_local;
- goto error;
- }
- LOG_I(" no errors in com layer");
-
- // Check for error from TA
- if (returnOrigin != NULL) *returnOrigin = ((_TEEC_TCI *)session->imp.tci)->returnOrigin;
- teecRes = ((_TEEC_TCI *)session->imp.tci)->returnStatus;
- if (teecRes != TEEC_SUCCESS ) {
- LOG_E("TA OpenSession EP failed(%08x)", teecRes);
- goto error;
- }
-
- LOG_I(" %s() = TEEC_SUCCESS ", __func__);
- pthread_mutex_unlock(&session->imp.mutex_tci);
-
- if (returnOrigin != NULL) *returnOrigin = TEEC_ORIGIN_TRUSTED_APP;
- return TEEC_SUCCESS;
-
- // -------------------------------------------------------------
-error:
- if (session->imp.active) {
- // After notifying us, TA went to Destry EP, so close session now
- mcRet = mcCloseSession(&session->imp.handle);
- if (mcRet != MC_DRV_OK) {
- LOG_E("mcCloseSession failed (%08x)", mcRet);
- /* continue even in case of error */;
- }
- session->imp.active = false;
- }
-
- pthread_mutex_unlock(&session->imp.mutex_tci);
- pthread_mutex_destroy(&session->imp.mutex_tci);
- if (session->imp.tci) {
- munmap(session->imp.tci, sysconf(_SC_PAGESIZE));
- session->imp.tci = NULL;
- }
-
- LOG_I(" %s() = 0x%x", __func__, teecRes);
- return teecRes;
-}
-
-//------------------------------------------------------------------------------
-TEEC_Result TEEC_InvokeCommand(
- TEEC_Session *session,
- uint32_t commandID,
- TEEC_Operation *operation,
- uint32_t *returnOrigin)
-{
- TEEC_Result teecRes;
- uint32_t returnOrigin_local;
-
- LOG_I("== %s() ==============", __func__);
-
- // -------------------------------------------------------------
- if (session == NULL) {
- LOG_E("session is NULL");
- if (returnOrigin != NULL) *returnOrigin = TEEC_ORIGIN_API;
- return TEEC_ERROR_BAD_PARAMETERS;
- }
-
- if (!session->imp.active) {
- LOG_E("session is inactive");
- if (returnOrigin != NULL) *returnOrigin = TEEC_ORIGIN_API;
- return TEEC_ERROR_BAD_STATE;
- }
- // -------------------------------------------------------------
- if (operation) operation->imp.session = &session->imp;
-
- pthread_mutex_lock(&session->imp.mutex_tci);
-
- // Call TA
- ((_TEEC_TCI *)session->imp.tci)->operation.commandId = commandID;
- ((_TEEC_TCI *)session->imp.tci)->operation.type = _TA_OPERATION_INVOKE_COMMAND;
- teecRes = _TEEC_CallTA(session, operation, &returnOrigin_local);
- if (teecRes != TEEC_SUCCESS ) {
- LOG_E("_TEEC_CallTA failed(%08x)", teecRes);
- if (returnOrigin != NULL) *returnOrigin = returnOrigin_local;
- } else {
- if (returnOrigin != NULL) *returnOrigin = ((_TEEC_TCI *)session->imp.tci)->returnOrigin;
- teecRes = ((_TEEC_TCI *)session->imp.tci)->returnStatus;
- }
-
- pthread_mutex_unlock(&session->imp.mutex_tci);
- LOG_I(" %s() = 0x%x", __func__, teecRes);
- return teecRes;
-}
-
-//------------------------------------------------------------------------------
-void TEEC_CloseSession(TEEC_Session *session)
-{
- mcResult_t mcRet;
- TEEC_Result teecRes = TEEC_SUCCESS;
- uint32_t returnOrigin;
-
- LOG_I("== %s() ==============", __func__);
-
- // -------------------------------------------------------------
- //The Implementation MUST do nothing if the session parameter is NULL.
- if (session == NULL) {
- LOG_E("session is NULL");
- return;
- }
-
- // -------------------------------------------------------------
- if (session->imp.active) {
- // Let TA go through CloseSession and Destroy entry points
- LOG_I(" let TA go through close entry points");
- pthread_mutex_lock(&session->imp.mutex_tci);
- ((_TEEC_TCI *)session->imp.tci)->operation.type = _TA_OPERATION_CLOSE_SESSION;
- teecRes = _TEEC_CallTA(session, NULL, &returnOrigin);
- if (teecRes != TEEC_SUCCESS ) {
- /* continue even in case of error */;
- LOG_E("_TEEC_CallTA failed(%08x)", teecRes);
- }
-
- if (session->imp.active) {
- // Close Session
- mcRet = mcCloseSession(&session->imp.handle);
- if (mcRet != MC_DRV_OK) {
- LOG_E("mcCloseSession failed (%08x)", mcRet);
- /* ignore error and also there shouldn't be one */
- }
- }
- pthread_mutex_unlock(&session->imp.mutex_tci);
- }
-
- pthread_mutex_destroy(&session->imp.mutex_tci);
- if (session->imp.tci) {
- munmap(session->imp.tci, sysconf(_SC_PAGESIZE));
- session->imp.tci = NULL;
- }
- session->imp.active = false;
-
- LOG_I(" %s() = 0x%x", __func__, teecRes);
-}
-
-//------------------------------------------------------------------------------
-TEEC_Result TEEC_RegisterSharedMemory(
- TEEC_Context *context,
- TEEC_SharedMemory *sharedMem)
-{
- LOG_I("== %s() ==============", __func__);
-
- //The parameter context MUST point to an initialized TEE Context.
- if (context == NULL) {
- LOG_E("context is NULL");
- return TEEC_ERROR_BAD_PARAMETERS;
- }
- //The parameter sharedMem MUST point to the Shared Memory structure defining
- //the memory region to register.
- if (sharedMem == NULL) {
- LOG_E("sharedMem is NULL");
- return TEEC_ERROR_BAD_PARAMETERS;
- }
- //The buffer field MUST point to the memory region to be shared, and MUST not be NULL.
- if (sharedMem->buffer == NULL) {
- LOG_E("sharedMem->buffer is NULL");
- return TEEC_ERROR_BAD_PARAMETERS;
- }
- if ((sharedMem->flags & ~(TEEC_MEM_INPUT | TEEC_MEM_OUTPUT)) != 0) {
- LOG_E("sharedMem->flags is incorrect");
- return TEEC_ERROR_BAD_PARAMETERS;
- }
- if (sharedMem->flags == 0) {
- LOG_E("sharedMem->flags is incorrect");
- return TEEC_ERROR_BAD_PARAMETERS;
- }
-
- sharedMem->imp.implementation_allocated = false;
- return TEEC_SUCCESS;
-}
-
-//------------------------------------------------------------------------------
-TEEC_Result TEEC_AllocateSharedMemory(
- TEEC_Context *context,
- TEEC_SharedMemory *sharedMem)
-{
- //No connection to "context"?
- LOG_I("== %s() ==============", __func__);
-
- //The parameter context MUST point to an initialized TEE Context.
- if (context == NULL) {
- LOG_E("context is NULL");
- return TEEC_ERROR_BAD_PARAMETERS;
- }
- //The parameter sharedMem MUST point to the Shared Memory structure defining
- //the memory region to register.
- if (sharedMem == NULL) {
- LOG_E("sharedMem is NULL");
- return TEEC_ERROR_BAD_PARAMETERS;
- }
- if ((sharedMem->flags & ~(TEEC_MEM_INPUT | TEEC_MEM_OUTPUT)) != 0) {
- LOG_E("sharedMem->flags is incorrect");
- return TEEC_ERROR_BAD_PARAMETERS;
- }
- if (sharedMem->flags == 0) {
- LOG_E("sharedMem->flags is incorrect");
- return TEEC_ERROR_BAD_PARAMETERS;
- }
-
- sharedMem->buffer = malloc(sharedMem->size);
- if (sharedMem->buffer == NULL) {
- LOG_E("malloc failed");
- return TEEC_ERROR_OUT_OF_MEMORY;
- }
- sharedMem->imp.implementation_allocated = true;
-
- return TEEC_SUCCESS;
-}
-
-//------------------------------------------------------------------------------
-void TEEC_ReleaseSharedMemory (
- TEEC_SharedMemory *sharedMem)
-{
- //No connection to "context"?
- LOG_I("== %s() ==============", __func__);
-
- //The Implementation MUST do nothing if the sharedMem parameter is NULL
- if (sharedMem == NULL) {
- LOG_E("sharedMem is NULL");
- return;
- }
-
- //For a memory buffer allocated using TEEC_AllocateSharedMemory the Implementation
- //MUST free the underlying memory
- if (sharedMem->imp.implementation_allocated) {
- if (sharedMem->buffer) {
- free(sharedMem->buffer);
- sharedMem->buffer = NULL;
- sharedMem->size = 0;
- }
- }
-
- //TODO: Attempting to release Shared Memory which is used by a pending operation.
-
-}
-
-//------------------------------------------------------------------------------
-void TEEC_RequestCancellation(
- TEEC_Operation *operation)
-{
- LOG_I("== %s() ==============", __func__);
-
- while (operation->started == 0);
-
- LOG_I("while(operation->started ==0) passed");
-
- if (operation->started > 1) {
- LOG_I("The operation has finished");
- return;
- }
-
- TEEC_Session_IMP *session = operation->imp.session;
- operation->started = 2;
-
- if (!session->active) {
- LOG_I("Corresponding session is not active");
- return;
- }
- ((_TEEC_TCI *)session->tci)->operation.isCancelled = true;
-
- // Step 4.3: signal the Trustlet
- mcResult_t mcRet = mcNotify(&session->handle);
- if (MC_DRV_OK != mcRet) {
- LOG_E("Notify failed (%08x)", mcRet);
- }
-}
-
-//------------------------------------------------------------------------------
diff --git a/mobicore/MobiCoreDriverLib/ClientLib/Session.h b/mobicore/MobiCoreDriverLib/ClientLib/Session.h
index 1f3529e..b376a18 100644
--- a/mobicore/MobiCoreDriverLib/ClientLib/Session.h
+++ b/mobicore/MobiCoreDriverLib/ClientLib/Session.h
@@ -34,7 +34,6 @@
#include <stdint.h>
#include <list>
-#include "mc_linux.h"
#include "Connection.h"
#include "CMcKMod.h"
#include "CMutex.h"
diff --git a/mobicore/MobiCoreDriverLib/ClientLib/driver_client.cpp b/mobicore/MobiCoreDriverLib/ClientLib/driver_client.cpp
new file mode 100644
index 0000000..5243695
--- /dev/null
+++ b/mobicore/MobiCoreDriverLib/ClientLib/driver_client.cpp
@@ -0,0 +1,400 @@
+/*
+ * Copyright (c) 2013-2015 TRUSTONIC LIMITED
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the TRUSTONIC LIMITED nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <vector>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <pthread.h>
+
+#include <MobiCoreDriverApi.h> // mcResult_t
+#include <tee_client_api.h> // TEEC_UUID
+#include <GpTci.h> // _TEEC_TCI
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "McDriverClient"
+#include "log.h"
+#include "ClientLib.h"
+#include "driver_client.h"
+
+/* Convert TEE errors into errno */
+static int mcresult_to_errno[] = {
+ 0, // MC_DRV_OK 0
+ ENOMSG, // MC_DRV_NO_NOTIFICATION 1
+ EBADMSG, // MC_DRV_ERR_NOTIFICATION 2
+ ENOLINK, // MC_DRV_ERR_NOT_IMPLEMENTED 3
+ ENOSPC, // MC_DRV_ERR_OUT_OF_RESOURCES 4
+ EHOSTDOWN, // MC_DRV_ERR_INIT 5
+ ENOLINK, // MC_DRV_ERR_UNKNOWN 6
+ ENODEV, // MC_DRV_ERR_UNKNOWN_DEVICE 7
+ ENXIO, // MC_DRV_ERR_UNKNOWN_SESSION 8
+ EPERM, // MC_DRV_ERR_INVALID_OPERATION 9
+ EBADE, // MC_DRV_ERR_INVALID_RESPONSE 10
+ ETIME, // MC_DRV_ERR_TIMEOUT 11
+ ENOMEM, // MC_DRV_ERR_NO_FREE_MEMORY 12
+ EUCLEAN, // MC_DRV_ERR_FREE_MEMORY_FAILED 13
+ ENOTEMPTY, // MC_DRV_ERR_SESSION_PENDING 14
+ EHOSTUNREACH, // MC_DRV_ERR_DAEMON_UNREACHABLE 15
+ ENOENT, // MC_DRV_ERR_INVALID_DEVICE_FILE 16
+ EINVAL, // MC_DRV_ERR_INVALID_PARAMETER 17
+ EPROTO, // MC_DRV_ERR_KERNEL_MODULE 18
+ EADDRINUSE, // MC_DRV_ERR_BULK_MAPPING 19
+ EADDRNOTAVAIL, // MC_DRV_ERR_BULK_UNMAPPING 20
+ ECOMM, // MC_DRV_INFO_NOTIFICATION 21
+ EUNATCH, // MC_DRV_ERR_NQ_FAILED 22
+ ENOLINK, // MC_DRV_ERR_DAEMON_VERSION 23
+ ENOLINK, // MC_DRV_ERR_CONTAINER_VERSION 24
+ EKEYREJECTED, // MC_DRV_ERR_WRONG_PUBLIC_KEY 25
+ ENOLINK, // MC_DRV_ERR_CONTAINER_TYPE_MISMATCH 26
+ ENOLINK, // MC_DRV_ERR_CONTAINER_LOCKED 27
+ ENOLINK, // MC_DRV_ERR_SP_NO_CHILD 28
+ ENOLINK, // MC_DRV_ERR_TL_NO_CHILD 29
+ ENOLINK, // MC_DRV_ERR_UNWRAP_ROOT_FAILED 30
+ ENOLINK, // MC_DRV_ERR_UNWRAP_SP_FAILED 31
+ ENOLINK, // MC_DRV_ERR_UNWRAP_TRUSTLET_FAILED 32
+ EBADF, // MC_DRV_ERR_DAEMON_DEVICE_NOT_OPEN 33
+ ENOLINK, // MC_DRV_ERR_TA_ATTESTATION_ERROR 34
+ EINTR, // MC_DRV_ERR_INTERRUPTED_BY_SIGNAL 35
+ ECONNREFUSED, // MC_DRV_ERR_SERVICE_BLOCKED 36
+ ECONNABORTED, // MC_DRV_ERR_SERVICE_LOCKED 37
+ ECONNRESET, // MC_DRV_ERR_SERVICE_KILLED 38
+ ENOLINK, // MC_DRV_ERR_NO_FREE_INSTANCES 39
+};
+
+static int set_errno_from_mcresult(mcResult_t result) {
+ // Out of range, analyse some special cases
+ if (result > 39) {
+ switch (result) {
+ case 0xe0012:
+#if ( __WORDSIZE == 64 )
+ errno = EINVAL;
+#else
+ errno = ENOMEM;
+#endif
+ break;
+ default:
+ errno = EBADSLT;
+ }
+ return -1;
+ }
+ int local_errno = mcresult_to_errno[result];
+ if (local_errno > 0) {
+ errno = local_errno;
+ return -1;
+ }
+ return 0;
+}
+
+struct DriverClient::Impl {
+ struct GpSession {
+ uint32_t id;
+ _TEEC_TCI* tci;
+ GpSession(uint32_t i, uint64_t t): id(i) {
+ tci = reinterpret_cast<_TEEC_TCI*>(static_cast<uintptr_t>(t));
+ }
+ };
+ pthread_mutex_t gp_sessions_mutex;
+ std::vector<GpSession*> gp_sessions;
+ Device* device;
+ Impl(): device(nullptr) {
+ ::pthread_mutex_init(&gp_sessions_mutex, nullptr);
+ }
+ ~Impl() {
+ delete device;
+ ::pthread_mutex_destroy(&gp_sessions_mutex);
+ }
+};
+
+DriverClient::DriverClient(): pimpl_(new Impl) {
+}
+
+DriverClient::~DriverClient() {
+ delete pimpl_;
+}
+
+int DriverClient::open() {
+ int ret = set_errno_from_mcresult(mcOpenDevice_(&pimpl_->device));
+ if (ret) {
+ _LOG_E("%s in %s", strerror(errno), __FUNCTION__);
+ return ret;
+ }
+ LOG_I("driver client open");
+ return 0;
+}
+
+int DriverClient::close() {
+ mcResult_t mc_result = mcCloseDevice_(pimpl_->device);
+ if (mc_result != MC_DRV_ERR_SESSION_PENDING) {
+ // Device closed
+ delete pimpl_->device;
+ pimpl_->device = nullptr;
+ }
+ int ret = set_errno_from_mcresult(mc_result);
+ if (ret) {
+ _LOG_E("%s in %s", strerror(errno), __FUNCTION__);
+ return ret;
+ }
+ LOG_I("driver client closed");
+ return 0;
+}
+
+bool DriverClient::isOpen() const {
+ return pimpl_->device && pimpl_->device->isValid();
+}
+
+int DriverClient::hasOpenSessions() const {
+ if (!pimpl_->device->isValid()) {
+ // Connection dead
+ return 0;
+ }
+ return set_errno_from_mcresult(mcDeviceHasOpenSessions_(pimpl_->device));
+}
+
+int DriverClient::openSession(struct mc_ioctl_open_session& session) {
+ if (session.identity.login_type != LOGIN_PUBLIC) {
+ errno = EINVAL;
+ _LOG_E("%s in %s", strerror(errno), __FUNCTION__);
+ return -1;
+ }
+ mcResult_t mc_result;
+ auto uuid = reinterpret_cast<const mcUuid_t*>(&session.uuid);
+ auto tci = reinterpret_cast<uint8_t*>(static_cast<uintptr_t>(session.tci));
+ if (session.is_gp_uuid) {
+ mc_result = mcOpenGPTA_(pimpl_->device, &session.sid, uuid, tci, session.tcilen);
+ } else {
+ mc_result = mcOpenSession_(pimpl_->device, &session.sid, uuid, tci, session.tcilen);
+ }
+ int ret = set_errno_from_mcresult(mc_result);
+ if (ret) {
+ _LOG_E("%s in %s", strerror(errno), __FUNCTION__);
+ return ret;
+ }
+ if (session.is_gp_uuid) {
+ pthread_mutex_lock(&pimpl_->gp_sessions_mutex);
+ pimpl_->gp_sessions.push_back(
+ new Impl::GpSession(session.sid, session.tci));
+ pthread_mutex_unlock(&pimpl_->gp_sessions_mutex);
+ }
+ return ret;
+}
+
+int DriverClient::openTrustlet(struct mc_ioctl_open_trustlet& trustlet) {
+ mcResult_t mc_result;
+ auto trustapp = reinterpret_cast<uint8_t*>(static_cast<uintptr_t>(trustlet.buffer));
+ auto tci = reinterpret_cast<uint8_t*>(static_cast<uintptr_t>(trustlet.tci));
+ mc_result = mcOpenTrustlet_(pimpl_->device, &trustlet.sid, trustlet.spid,
+ trustapp, trustlet.tlen, tci, trustlet.tcilen);
+ int ret = set_errno_from_mcresult(mc_result);
+ if (ret) {
+ _LOG_E("%s in %s", strerror(errno), __FUNCTION__);
+ return ret;
+ }
+ return ret;
+}
+
+int DriverClient::closeSession(uint32_t session_id) {
+ mcResult_t mc_result = mcCloseSession_(pimpl_->device, session_id);
+ int ret = set_errno_from_mcresult(mc_result);
+ if (ret) {
+ _LOG_E("%s in %s", strerror(errno), __FUNCTION__);
+ return ret;
+ }
+ pthread_mutex_lock(&pimpl_->gp_sessions_mutex);
+ for (auto it = pimpl_->gp_sessions.begin();
+ it != pimpl_->gp_sessions.end(); it++) {
+ auto gp_session = *it;
+ if (gp_session->id == session_id) {
+ pimpl_->gp_sessions.erase(it);
+ delete gp_session;
+ break;
+ }
+ }
+ pthread_mutex_unlock(&pimpl_->gp_sessions_mutex);
+ return ret;
+}
+
+int DriverClient::notify(uint32_t session_id) {
+ mcResult_t mc_result = mcNotify_(pimpl_->device, session_id);
+ int ret = set_errno_from_mcresult(mc_result);
+ if (ret) {
+ _LOG_E("%s in %s", strerror(errno), __FUNCTION__);
+ }
+ return ret;
+}
+
+int DriverClient::waitNotification(const struct mc_ioctl_wait& wait) {
+ mcResult_t mc_result = mcWaitNotification_(pimpl_->device, wait.sid, wait.timeout);
+ int ret = set_errno_from_mcresult(mc_result);
+ if (ret) {
+ _LOG_E("%s in %s", strerror(errno), __FUNCTION__);
+ }
+ return ret;
+}
+
+int DriverClient::malloc(uint8_t **buffer, uint32_t length) {
+ mcResult_t mc_result = mcMallocWsm_(pimpl_->device, length, buffer);
+ int ret = set_errno_from_mcresult(mc_result);
+ if (ret) {
+ _LOG_E("%s in %s", strerror(errno), __FUNCTION__);
+ }
+ return ret;
+}
+
+int DriverClient::free(uint8_t *buffer, uint32_t) {
+ mcResult_t mc_result = mcFreeWsm_(pimpl_->device, buffer);
+ int ret = set_errno_from_mcresult(mc_result);
+ if (ret) {
+ _LOG_E("%s in %s", strerror(errno), __FUNCTION__);
+ }
+ return ret;
+}
+
+int DriverClient::map(struct mc_ioctl_map& map) {
+ int ret = 0;
+ bool mapped = false;
+ int i;
+ for (i = 0; i < MC_MAP_MAX; i++) {
+ if (!map.bufs[i].va) {
+ continue;
+ }
+ if (ret) {
+ // Error reported, make sure we don't unmap skipped buffers
+ map.bufs[i].va = 0;
+ continue;
+ }
+ mcBulkMap_t map_handle;
+ auto buf = reinterpret_cast<uint8_t*>(static_cast<uintptr_t>(map.bufs[i].va));
+ mcResult_t mc_result = mcMap_(pimpl_->device, map.sid, buf, map.bufs[i].len, &map_handle);
+ ret = set_errno_from_mcresult(mc_result);
+ if (ret) {
+ _LOG_E("%s in %s, buffer #%d", strerror(errno), __FUNCTION__, i);
+ continue;
+ }
+ mapped = true;
+#if ( __WORDSIZE != 64 )
+ map.bufs[i].sva = reinterpret_cast<uintptr_t>(map_handle.sVirtualAddr);
+#else
+ map.bufs[i].sva = map_handle.sVirtualAddr;
+#endif
+ }
+ if (!ret) {
+ if (!mapped) {
+ // No buffers in set
+ errno = EINVAL;
+ return -1;
+ }
+ return 0;
+ } else if (!mapped) {
+ // No buffers to unmap
+ return ret;
+ }
+ // Unwind
+ unmap(map);
+ return ret;
+}
+
+int DriverClient::unmap(const struct mc_ioctl_map& map) {
+ int ret = 0;
+ bool unmapped = false;
+ for (int i = 0; i < MC_MAP_MAX; i++) {
+ if (!map.bufs[i].va) {
+ continue;
+ }
+ mcBulkMap_t map_handle;
+ map_handle.sVirtualLen = map.bufs[i].len;
+#if ( __WORDSIZE != 64 )
+ map_handle.sVirtualAddr = reinterpret_cast<void*>(static_cast<uintptr_t>(map.bufs[i].sva));
+#else
+ map_handle.sVirtualAddr = static_cast<uint32_t>(map.bufs[i].sva);
+#endif
+ auto buf = reinterpret_cast<uint8_t*>(static_cast<uintptr_t>(map.bufs[i].va));
+ mcResult_t mc_result = mcUnmap_(pimpl_->device, map.sid, buf, &map_handle);
+ int local_ret = set_errno_from_mcresult(mc_result);
+ if (local_ret) {
+ ret = local_ret;
+ _LOG_E("%s in %s", strerror(errno), __FUNCTION__);
+ // Keep going
+ continue;
+ }
+ unmapped = true;
+ }
+ if (!ret && !unmapped) {
+ errno = EINVAL;
+ ret = -1;
+ }
+ return ret;
+}
+
+int DriverClient::getError(struct mc_ioctl_geterr& err) {
+ mcResult_t mc_result = mcGetSessionErrorCode_(pimpl_->device, err.sid, &err.value);
+ int ret = set_errno_from_mcresult(mc_result);
+ if (ret) {
+ _LOG_E("%s in %s", strerror(errno), __FUNCTION__);
+ }
+ return ret;
+}
+
+int DriverClient::getVersion(struct mc_version_info& version_info) {
+ mcVersionInfo_t versionInfo;
+ int ret = mcGetMobiCoreVersion_(pimpl_->device, &versionInfo);
+ if (ret) {
+ _LOG_E("%s in %s", strerror(errno), __FUNCTION__);
+ } else {
+ ::memcpy(&version_info, &versionInfo, sizeof(version_info));
+ }
+ return ret;
+}
+
+// This class will need to handle the GP protocol at some point, but for now it
+// only deals with cancellation
+int DriverClient::gpRequestCancellation(uint32_t session_id) {
+ bool found = false;
+ pthread_mutex_lock(&pimpl_->gp_sessions_mutex);
+ for (auto it = pimpl_->gp_sessions.begin(); it != pimpl_->gp_sessions.end();
+ it++) {
+ auto gp_session = *it;
+ if (gp_session->id == session_id) {
+ // Will be reset by caller at next InvokeCommand
+ gp_session->tci->operation.isCancelled = true;
+ found = true;
+ }
+ }
+ pthread_mutex_unlock(&pimpl_->gp_sessions_mutex);
+ if (!found) {
+ errno = ENOENT;
+ return -1;
+ }
+ return notify(session_id);
+}
diff --git a/mobicore/MobiCoreDriverLib/ClientLib/mc.pb.cpp b/mobicore/MobiCoreDriverLib/ClientLib/mc.pb.cpp
new file mode 100644
index 0000000..a36a527
--- /dev/null
+++ b/mobicore/MobiCoreDriverLib/ClientLib/mc.pb.cpp
@@ -0,0 +1,5695 @@
+/*
+ * Copyright (c) 2013-2015 TRUSTONIC LIMITED
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the TRUSTONIC LIMITED nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: mc.proto
+
+#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
+#include "mc.pb.h"
+
+#include <algorithm>
+
+#include <google/protobuf/stubs/common.h>
+#include <google/protobuf/stubs/once.h>
+#include <google/protobuf/io/coded_stream.h>
+#include <google/protobuf/wire_format_lite_inl.h>
+#include <google/protobuf/io/zero_copy_stream_impl_lite.h>
+// @@protoc_insertion_point(includes)
+
+namespace com {
+namespace trustonic {
+namespace tee_proxy {
+
+void protobuf_ShutdownFile_mc_2eproto() {
+ delete OpenSessionRequest::default_instance_;
+ delete OpenSessionResponse::default_instance_;
+ delete OpenTrustletRequest::default_instance_;
+ delete OpenTrustletResponse::default_instance_;
+ delete CloseSessionRequest::default_instance_;
+ delete CloseSessionResponse::default_instance_;
+ delete NotifyRequest::default_instance_;
+ delete NotifyRequest_Buffers::default_instance_;
+ delete NotifyResponse::default_instance_;
+ delete WaitNotificationRequest::default_instance_;
+ delete WaitNotificationResponse::default_instance_;
+ delete WaitNotificationResponse_Buffers::default_instance_;
+ delete MapRequest::default_instance_;
+ delete MapRequest_Buffers::default_instance_;
+ delete MapResponse::default_instance_;
+ delete MapResponse_Buffers::default_instance_;
+ delete UnmapRequest::default_instance_;
+ delete UnmapRequest_Buffers::default_instance_;
+ delete UnmapResponse::default_instance_;
+ delete GetErrorRequest::default_instance_;
+ delete GetErrorResponse::default_instance_;
+ delete GetVersionRequest::default_instance_;
+ delete GetVersionResponse::default_instance_;
+ delete GpRequestCancellationRequest::default_instance_;
+ delete GpRequestCancellationResponse::default_instance_;
+}
+
+#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+void protobuf_AddDesc_mc_2eproto_impl() {
+ GOOGLE_PROTOBUF_VERIFY_VERSION;
+
+#else
+void protobuf_AddDesc_mc_2eproto() {
+ static bool already_here = false;
+ if (already_here) return;
+ already_here = true;
+ GOOGLE_PROTOBUF_VERIFY_VERSION;
+
+#endif
+ OpenSessionRequest::default_instance_ = new OpenSessionRequest();
+ OpenSessionResponse::default_instance_ = new OpenSessionResponse();
+ OpenTrustletRequest::default_instance_ = new OpenTrustletRequest();
+ OpenTrustletResponse::default_instance_ = new OpenTrustletResponse();
+ CloseSessionRequest::default_instance_ = new CloseSessionRequest();
+ CloseSessionResponse::default_instance_ = new CloseSessionResponse();
+ NotifyRequest::default_instance_ = new NotifyRequest();
+ NotifyRequest_Buffers::default_instance_ = new NotifyRequest_Buffers();
+ NotifyResponse::default_instance_ = new NotifyResponse();
+ WaitNotificationRequest::default_instance_ = new WaitNotificationRequest();
+ WaitNotificationResponse::default_instance_ = new WaitNotificationResponse();
+ WaitNotificationResponse_Buffers::default_instance_ = new WaitNotificationResponse_Buffers();
+ MapRequest::default_instance_ = new MapRequest();
+ MapRequest_Buffers::default_instance_ = new MapRequest_Buffers();
+ MapResponse::default_instance_ = new MapResponse();
+ MapResponse_Buffers::default_instance_ = new MapResponse_Buffers();
+ UnmapRequest::default_instance_ = new UnmapRequest();
+ UnmapRequest_Buffers::default_instance_ = new UnmapRequest_Buffers();
+ UnmapResponse::default_instance_ = new UnmapResponse();
+ GetErrorRequest::default_instance_ = new GetErrorRequest();
+ GetErrorResponse::default_instance_ = new GetErrorResponse();
+ GetVersionRequest::default_instance_ = new GetVersionRequest();
+ GetVersionResponse::default_instance_ = new GetVersionResponse();
+ GpRequestCancellationRequest::default_instance_ = new GpRequestCancellationRequest();
+ GpRequestCancellationResponse::default_instance_ = new GpRequestCancellationResponse();
+ OpenSessionRequest::default_instance_->InitAsDefaultInstance();
+ OpenSessionResponse::default_instance_->InitAsDefaultInstance();
+ OpenTrustletRequest::default_instance_->InitAsDefaultInstance();
+ OpenTrustletResponse::default_instance_->InitAsDefaultInstance();
+ CloseSessionRequest::default_instance_->InitAsDefaultInstance();
+ CloseSessionResponse::default_instance_->InitAsDefaultInstance();
+ NotifyRequest::default_instance_->InitAsDefaultInstance();
+ NotifyRequest_Buffers::default_instance_->InitAsDefaultInstance();
+ NotifyResponse::default_instance_->InitAsDefaultInstance();
+ WaitNotificationRequest::default_instance_->InitAsDefaultInstance();
+ WaitNotificationResponse::default_instance_->InitAsDefaultInstance();
+ WaitNotificationResponse_Buffers::default_instance_->InitAsDefaultInstance();
+ MapRequest::default_instance_->InitAsDefaultInstance();
+ MapRequest_Buffers::default_instance_->InitAsDefaultInstance();
+ MapResponse::default_instance_->InitAsDefaultInstance();
+ MapResponse_Buffers::default_instance_->InitAsDefaultInstance();
+ UnmapRequest::default_instance_->InitAsDefaultInstance();
+ UnmapRequest_Buffers::default_instance_->InitAsDefaultInstance();
+ UnmapResponse::default_instance_->InitAsDefaultInstance();
+ GetErrorRequest::default_instance_->InitAsDefaultInstance();
+ GetErrorResponse::default_instance_->InitAsDefaultInstance();
+ GetVersionRequest::default_instance_->InitAsDefaultInstance();
+ GetVersionResponse::default_instance_->InitAsDefaultInstance();
+ GpRequestCancellationRequest::default_instance_->InitAsDefaultInstance();
+ GpRequestCancellationResponse::default_instance_->InitAsDefaultInstance();
+ ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_mc_2eproto);
+}
+
+#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AddDesc_mc_2eproto_once_);
+void protobuf_AddDesc_mc_2eproto() {
+ ::google::protobuf::GoogleOnceInit(&protobuf_AddDesc_mc_2eproto_once_,
+ &protobuf_AddDesc_mc_2eproto_impl);
+}
+#else
+// Force AddDescriptors() to be called at static initialization time.
+struct StaticDescriptorInitializer_mc_2eproto {
+ StaticDescriptorInitializer_mc_2eproto() {
+ protobuf_AddDesc_mc_2eproto();
+ }
+} static_descriptor_initializer_mc_2eproto_;
+#endif
+bool LoginType_IsValid(int value) {
+ switch(value) {
+ case 0:
+ case 1:
+ case 2:
+ case 4:
+ case 5:
+ case 6:
+ return true;
+ default:
+ return false;
+ }
+}
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
+const int OpenSessionRequest::kUuidFieldNumber;
+const int OpenSessionRequest::kIsGpUuidFieldNumber;
+const int OpenSessionRequest::kTciFieldNumber;
+const int OpenSessionRequest::kLoginTypeFieldNumber;
+const int OpenSessionRequest::kLoginDataFieldNumber;
+#endif // !_MSC_VER
+
+OpenSessionRequest::OpenSessionRequest()
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ // @@protoc_insertion_point(constructor:com.trustonic.tee_proxy.OpenSessionRequest)
+}
+
+void OpenSessionRequest::InitAsDefaultInstance() {
+}
+
+OpenSessionRequest::OpenSessionRequest(const OpenSessionRequest& from)
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ MergeFrom(from);
+ // @@protoc_insertion_point(copy_constructor:com.trustonic.tee_proxy.OpenSessionRequest)
+}
+
+void OpenSessionRequest::SharedCtor() {
+ ::google::protobuf::internal::GetEmptyString();
+ _cached_size_ = 0;
+ uuid_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ is_gp_uuid_ = false;
+ tci_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ login_type_ = 0;
+ login_data_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+OpenSessionRequest::~OpenSessionRequest() {
+ // @@protoc_insertion_point(destructor:com.trustonic.tee_proxy.OpenSessionRequest)
+ SharedDtor();
+}
+
+void OpenSessionRequest::SharedDtor() {
+ if (uuid_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ delete uuid_;
+ }
+ if (tci_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ delete tci_;
+ }
+ if (login_data_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ delete login_data_;
+ }
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ if (this != &default_instance()) {
+ #else
+ if (this != default_instance_) {
+ #endif
+ }
+}
+
+void OpenSessionRequest::SetCachedSize(int size) const {
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const OpenSessionRequest& OpenSessionRequest::default_instance() {
+#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ protobuf_AddDesc_mc_2eproto();
+#else
+ if (default_instance_ == NULL) protobuf_AddDesc_mc_2eproto();
+#endif
+ return *default_instance_;
+}
+
+OpenSessionRequest* OpenSessionRequest::default_instance_ = NULL;
+
+OpenSessionRequest* OpenSessionRequest::New() const {
+ return new OpenSessionRequest;
+}
+
+void OpenSessionRequest::Clear() {
+#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
+ &reinterpret_cast<OpenSessionRequest*>(16)->f) - \
+ reinterpret_cast<char*>(16))
+
+#define ZR_(first, last) do { \
+ size_t f = OFFSET_OF_FIELD_(first); \
+ size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
+ ::memset(&first, 0, n); \
+ } while (0)
+
+ if (_has_bits_[0 / 32] & 31) {
+ ZR_(is_gp_uuid_, login_type_);
+ if (has_uuid()) {
+ if (uuid_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ uuid_->clear();
+ }
+ }
+ if (has_tci()) {
+ if (tci_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ tci_->clear();
+ }
+ }
+ if (has_login_data()) {
+ if (login_data_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ login_data_->clear();
+ }
+ }
+ }
+
+#undef OFFSET_OF_FIELD_
+#undef ZR_
+
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+ mutable_unknown_fields()->clear();
+}
+
+bool OpenSessionRequest::MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
+ ::google::protobuf::uint32 tag;
+ ::google::protobuf::io::StringOutputStream unknown_fields_string(
+ mutable_unknown_fields());
+ ::google::protobuf::io::CodedOutputStream unknown_fields_stream(
+ &unknown_fields_string);
+ // @@protoc_insertion_point(parse_start:com.trustonic.tee_proxy.OpenSessionRequest)
+ for (;;) {
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
+ tag = p.first;
+ if (!p.second) goto handle_unusual;
+ switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+ // required bytes uuid = 1;
+ case 1: {
+ if (tag == 10) {
+ DO_(::google::protobuf::internal::WireFormatLite::ReadBytes(
+ input, this->mutable_uuid()));
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectTag(16)) goto parse_is_gp_uuid;
+ break;
+ }
+
+ // required bool is_gp_uuid = 2;
+ case 2: {
+ if (tag == 16) {
+ parse_is_gp_uuid:
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+ bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
+ input, &is_gp_uuid_)));
+ set_has_is_gp_uuid();
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectTag(26)) goto parse_tci;
+ break;
+ }
+
+ // optional bytes tci = 3;
+ case 3: {
+ if (tag == 26) {
+ parse_tci:
+ DO_(::google::protobuf::internal::WireFormatLite::ReadBytes(
+ input, this->mutable_tci()));
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectTag(32)) goto parse_login_type;
+ break;
+ }
+
+ // required .com.trustonic.tee_proxy.LoginType login_type = 4;
+ case 4: {
+ if (tag == 32) {
+ parse_login_type:
+ int value;
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+ int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
+ input, &value)));
+ if (::com::trustonic::tee_proxy::LoginType_IsValid(value)) {
+ set_login_type(static_cast< ::com::trustonic::tee_proxy::LoginType >(value));
+ } else {
+ unknown_fields_stream.WriteVarint32(tag);
+ unknown_fields_stream.WriteVarint32(value);
+ }
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectTag(42)) goto parse_login_data;
+ break;
+ }
+
+ // required bytes login_data = 5;
+ case 5: {
+ if (tag == 42) {
+ parse_login_data:
+ DO_(::google::protobuf::internal::WireFormatLite::ReadBytes(
+ input, this->mutable_login_data()));
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectAtEnd()) goto success;
+ break;
+ }
+
+ default: {
+ handle_unusual:
+ if (tag == 0 ||
+ ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+ goto success;
+ }
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(
+ input, tag, &unknown_fields_stream));
+ break;
+ }
+ }
+ }
+success:
+ // @@protoc_insertion_point(parse_success:com.trustonic.tee_proxy.OpenSessionRequest)
+ return true;
+failure:
+ // @@protoc_insertion_point(parse_failure:com.trustonic.tee_proxy.OpenSessionRequest)
+ return false;
+#undef DO_
+}
+
+void OpenSessionRequest::SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const {
+ // @@protoc_insertion_point(serialize_start:com.trustonic.tee_proxy.OpenSessionRequest)
+ // required bytes uuid = 1;
+ if (has_uuid()) {
+ ::google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased(
+ 1, this->uuid(), output);
+ }
+
+ // required bool is_gp_uuid = 2;
+ if (has_is_gp_uuid()) {
+ ::google::protobuf::internal::WireFormatLite::WriteBool(2, this->is_gp_uuid(), output);
+ }
+
+ // optional bytes tci = 3;
+ if (has_tci()) {
+ ::google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased(
+ 3, this->tci(), output);
+ }
+
+ // required .com.trustonic.tee_proxy.LoginType login_type = 4;
+ if (has_login_type()) {
+ ::google::protobuf::internal::WireFormatLite::WriteEnum(
+ 4, this->login_type(), output);
+ }
+
+ // required bytes login_data = 5;
+ if (has_login_data()) {
+ ::google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased(
+ 5, this->login_data(), output);
+ }
+
+ output->WriteRaw(unknown_fields().data(),
+ unknown_fields().size());
+ // @@protoc_insertion_point(serialize_end:com.trustonic.tee_proxy.OpenSessionRequest)
+}
+
+int OpenSessionRequest::ByteSize() const {
+ int total_size = 0;
+
+ if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ // required bytes uuid = 1;
+ if (has_uuid()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::BytesSize(
+ this->uuid());
+ }
+
+ // required bool is_gp_uuid = 2;
+ if (has_is_gp_uuid()) {
+ total_size += 1 + 1;
+ }
+
+ // optional bytes tci = 3;
+ if (has_tci()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::BytesSize(
+ this->tci());
+ }
+
+ // required .com.trustonic.tee_proxy.LoginType login_type = 4;
+ if (has_login_type()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::EnumSize(this->login_type());
+ }
+
+ // required bytes login_data = 5;
+ if (has_login_data()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::BytesSize(
+ this->login_data());
+ }
+
+ }
+ total_size += unknown_fields().size();
+
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = total_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+ return total_size;
+}
+
+void OpenSessionRequest::CheckTypeAndMergeFrom(
+ const ::google::protobuf::MessageLite& from) {
+ MergeFrom(*::google::protobuf::down_cast<const OpenSessionRequest*>(&from));
+}
+
+void OpenSessionRequest::MergeFrom(const OpenSessionRequest& from) {
+ GOOGLE_CHECK_NE(&from, this);
+ if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ if (from.has_uuid()) {
+ set_uuid(from.uuid());
+ }
+ if (from.has_is_gp_uuid()) {
+ set_is_gp_uuid(from.is_gp_uuid());
+ }
+ if (from.has_tci()) {
+ set_tci(from.tci());
+ }
+ if (from.has_login_type()) {
+ set_login_type(from.login_type());
+ }
+ if (from.has_login_data()) {
+ set_login_data(from.login_data());
+ }
+ }
+ mutable_unknown_fields()->append(from.unknown_fields());
+}
+
+void OpenSessionRequest::CopyFrom(const OpenSessionRequest& from) {
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+bool OpenSessionRequest::IsInitialized() const {
+ if ((_has_bits_[0] & 0x0000001b) != 0x0000001b) return false;
+
+ return true;
+}
+
+void OpenSessionRequest::Swap(OpenSessionRequest* other) {
+ if (other != this) {
+ std::swap(uuid_, other->uuid_);
+ std::swap(is_gp_uuid_, other->is_gp_uuid_);
+ std::swap(tci_, other->tci_);
+ std::swap(login_type_, other->login_type_);
+ std::swap(login_data_, other->login_data_);
+ std::swap(_has_bits_[0], other->_has_bits_[0]);
+ _unknown_fields_.swap(other->_unknown_fields_);
+ std::swap(_cached_size_, other->_cached_size_);
+ }
+}
+
+::std::string OpenSessionRequest::GetTypeName() const {
+ return "com.trustonic.tee_proxy.OpenSessionRequest";
+}
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
+const int OpenSessionResponse::kIdFieldNumber;
+#endif // !_MSC_VER
+
+OpenSessionResponse::OpenSessionResponse()
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ // @@protoc_insertion_point(constructor:com.trustonic.tee_proxy.OpenSessionResponse)
+}
+
+void OpenSessionResponse::InitAsDefaultInstance() {
+}
+
+OpenSessionResponse::OpenSessionResponse(const OpenSessionResponse& from)
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ MergeFrom(from);
+ // @@protoc_insertion_point(copy_constructor:com.trustonic.tee_proxy.OpenSessionResponse)
+}
+
+void OpenSessionResponse::SharedCtor() {
+ _cached_size_ = 0;
+ id_ = 0u;
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+OpenSessionResponse::~OpenSessionResponse() {
+ // @@protoc_insertion_point(destructor:com.trustonic.tee_proxy.OpenSessionResponse)
+ SharedDtor();
+}
+
+void OpenSessionResponse::SharedDtor() {
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ if (this != &default_instance()) {
+ #else
+ if (this != default_instance_) {
+ #endif
+ }
+}
+
+void OpenSessionResponse::SetCachedSize(int size) const {
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const OpenSessionResponse& OpenSessionResponse::default_instance() {
+#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ protobuf_AddDesc_mc_2eproto();
+#else
+ if (default_instance_ == NULL) protobuf_AddDesc_mc_2eproto();
+#endif
+ return *default_instance_;
+}
+
+OpenSessionResponse* OpenSessionResponse::default_instance_ = NULL;
+
+OpenSessionResponse* OpenSessionResponse::New() const {
+ return new OpenSessionResponse;
+}
+
+void OpenSessionResponse::Clear() {
+ id_ = 0u;
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+ mutable_unknown_fields()->clear();
+}
+
+bool OpenSessionResponse::MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
+ ::google::protobuf::uint32 tag;
+ ::google::protobuf::io::StringOutputStream unknown_fields_string(
+ mutable_unknown_fields());
+ ::google::protobuf::io::CodedOutputStream unknown_fields_stream(
+ &unknown_fields_string);
+ // @@protoc_insertion_point(parse_start:com.trustonic.tee_proxy.OpenSessionResponse)
+ for (;;) {
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
+ tag = p.first;
+ if (!p.second) goto handle_unusual;
+ switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+ // required uint32 id = 1;
+ case 1: {
+ if (tag == 8) {
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+ ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
+ input, &id_)));
+ set_has_id();
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectAtEnd()) goto success;
+ break;
+ }
+
+ default: {
+ handle_unusual:
+ if (tag == 0 ||
+ ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+ goto success;
+ }
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(
+ input, tag, &unknown_fields_stream));
+ break;
+ }
+ }
+ }
+success:
+ // @@protoc_insertion_point(parse_success:com.trustonic.tee_proxy.OpenSessionResponse)
+ return true;
+failure:
+ // @@protoc_insertion_point(parse_failure:com.trustonic.tee_proxy.OpenSessionResponse)
+ return false;
+#undef DO_
+}
+
+void OpenSessionResponse::SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const {
+ // @@protoc_insertion_point(serialize_start:com.trustonic.tee_proxy.OpenSessionResponse)
+ // required uint32 id = 1;
+ if (has_id()) {
+ ::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->id(), output);
+ }
+
+ output->WriteRaw(unknown_fields().data(),
+ unknown_fields().size());
+ // @@protoc_insertion_point(serialize_end:com.trustonic.tee_proxy.OpenSessionResponse)
+}
+
+int OpenSessionResponse::ByteSize() const {
+ int total_size = 0;
+
+ if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ // required uint32 id = 1;
+ if (has_id()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::UInt32Size(
+ this->id());
+ }
+
+ }
+ total_size += unknown_fields().size();
+
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = total_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+ return total_size;
+}
+
+void OpenSessionResponse::CheckTypeAndMergeFrom(
+ const ::google::protobuf::MessageLite& from) {
+ MergeFrom(*::google::protobuf::down_cast<const OpenSessionResponse*>(&from));
+}
+
+void OpenSessionResponse::MergeFrom(const OpenSessionResponse& from) {
+ GOOGLE_CHECK_NE(&from, this);
+ if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ if (from.has_id()) {
+ set_id(from.id());
+ }
+ }
+ mutable_unknown_fields()->append(from.unknown_fields());
+}
+
+void OpenSessionResponse::CopyFrom(const OpenSessionResponse& from) {
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+bool OpenSessionResponse::IsInitialized() const {
+ if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false;
+
+ return true;
+}
+
+void OpenSessionResponse::Swap(OpenSessionResponse* other) {
+ if (other != this) {
+ std::swap(id_, other->id_);
+ std::swap(_has_bits_[0], other->_has_bits_[0]);
+ _unknown_fields_.swap(other->_unknown_fields_);
+ std::swap(_cached_size_, other->_cached_size_);
+ }
+}
+
+::std::string OpenSessionResponse::GetTypeName() const {
+ return "com.trustonic.tee_proxy.OpenSessionResponse";
+}
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
+const int OpenTrustletRequest::kSpidFieldNumber;
+const int OpenTrustletRequest::kTrustappFieldNumber;
+const int OpenTrustletRequest::kTciFieldNumber;
+#endif // !_MSC_VER
+
+OpenTrustletRequest::OpenTrustletRequest()
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ // @@protoc_insertion_point(constructor:com.trustonic.tee_proxy.OpenTrustletRequest)
+}
+
+void OpenTrustletRequest::InitAsDefaultInstance() {
+}
+
+OpenTrustletRequest::OpenTrustletRequest(const OpenTrustletRequest& from)
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ MergeFrom(from);
+ // @@protoc_insertion_point(copy_constructor:com.trustonic.tee_proxy.OpenTrustletRequest)
+}
+
+void OpenTrustletRequest::SharedCtor() {
+ ::google::protobuf::internal::GetEmptyString();
+ _cached_size_ = 0;
+ spid_ = 0u;
+ trustapp_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ tci_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+OpenTrustletRequest::~OpenTrustletRequest() {
+ // @@protoc_insertion_point(destructor:com.trustonic.tee_proxy.OpenTrustletRequest)
+ SharedDtor();
+}
+
+void OpenTrustletRequest::SharedDtor() {
+ if (trustapp_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ delete trustapp_;
+ }
+ if (tci_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ delete tci_;
+ }
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ if (this != &default_instance()) {
+ #else
+ if (this != default_instance_) {
+ #endif
+ }
+}
+
+void OpenTrustletRequest::SetCachedSize(int size) const {
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const OpenTrustletRequest& OpenTrustletRequest::default_instance() {
+#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ protobuf_AddDesc_mc_2eproto();
+#else
+ if (default_instance_ == NULL) protobuf_AddDesc_mc_2eproto();
+#endif
+ return *default_instance_;
+}
+
+OpenTrustletRequest* OpenTrustletRequest::default_instance_ = NULL;
+
+OpenTrustletRequest* OpenTrustletRequest::New() const {
+ return new OpenTrustletRequest;
+}
+
+void OpenTrustletRequest::Clear() {
+ if (_has_bits_[0 / 32] & 7) {
+ spid_ = 0u;
+ if (has_trustapp()) {
+ if (trustapp_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ trustapp_->clear();
+ }
+ }
+ if (has_tci()) {
+ if (tci_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ tci_->clear();
+ }
+ }
+ }
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+ mutable_unknown_fields()->clear();
+}
+
+bool OpenTrustletRequest::MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
+ ::google::protobuf::uint32 tag;
+ ::google::protobuf::io::StringOutputStream unknown_fields_string(
+ mutable_unknown_fields());
+ ::google::protobuf::io::CodedOutputStream unknown_fields_stream(
+ &unknown_fields_string);
+ // @@protoc_insertion_point(parse_start:com.trustonic.tee_proxy.OpenTrustletRequest)
+ for (;;) {
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
+ tag = p.first;
+ if (!p.second) goto handle_unusual;
+ switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+ // required uint32 spid = 1;
+ case 1: {
+ if (tag == 8) {
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+ ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
+ input, &spid_)));
+ set_has_spid();
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectTag(18)) goto parse_trustapp;
+ break;
+ }
+
+ // required bytes trustapp = 2;
+ case 2: {
+ if (tag == 18) {
+ parse_trustapp:
+ DO_(::google::protobuf::internal::WireFormatLite::ReadBytes(
+ input, this->mutable_trustapp()));
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectTag(26)) goto parse_tci;
+ break;
+ }
+
+ // optional bytes tci = 3;
+ case 3: {
+ if (tag == 26) {
+ parse_tci:
+ DO_(::google::protobuf::internal::WireFormatLite::ReadBytes(
+ input, this->mutable_tci()));
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectAtEnd()) goto success;
+ break;
+ }
+
+ default: {
+ handle_unusual:
+ if (tag == 0 ||
+ ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+ goto success;
+ }
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(
+ input, tag, &unknown_fields_stream));
+ break;
+ }
+ }
+ }
+success:
+ // @@protoc_insertion_point(parse_success:com.trustonic.tee_proxy.OpenTrustletRequest)
+ return true;
+failure:
+ // @@protoc_insertion_point(parse_failure:com.trustonic.tee_proxy.OpenTrustletRequest)
+ return false;
+#undef DO_
+}
+
+void OpenTrustletRequest::SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const {
+ // @@protoc_insertion_point(serialize_start:com.trustonic.tee_proxy.OpenTrustletRequest)
+ // required uint32 spid = 1;
+ if (has_spid()) {
+ ::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->spid(), output);
+ }
+
+ // required bytes trustapp = 2;
+ if (has_trustapp()) {
+ ::google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased(
+ 2, this->trustapp(), output);
+ }
+
+ // optional bytes tci = 3;
+ if (has_tci()) {
+ ::google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased(
+ 3, this->tci(), output);
+ }
+
+ output->WriteRaw(unknown_fields().data(),
+ unknown_fields().size());
+ // @@protoc_insertion_point(serialize_end:com.trustonic.tee_proxy.OpenTrustletRequest)
+}
+
+int OpenTrustletRequest::ByteSize() const {
+ int total_size = 0;
+
+ if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ // required uint32 spid = 1;
+ if (has_spid()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::UInt32Size(
+ this->spid());
+ }
+
+ // required bytes trustapp = 2;
+ if (has_trustapp()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::BytesSize(
+ this->trustapp());
+ }
+
+ // optional bytes tci = 3;
+ if (has_tci()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::BytesSize(
+ this->tci());
+ }
+
+ }
+ total_size += unknown_fields().size();
+
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = total_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+ return total_size;
+}
+
+void OpenTrustletRequest::CheckTypeAndMergeFrom(
+ const ::google::protobuf::MessageLite& from) {
+ MergeFrom(*::google::protobuf::down_cast<const OpenTrustletRequest*>(&from));
+}
+
+void OpenTrustletRequest::MergeFrom(const OpenTrustletRequest& from) {
+ GOOGLE_CHECK_NE(&from, this);
+ if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ if (from.has_spid()) {
+ set_spid(from.spid());
+ }
+ if (from.has_trustapp()) {
+ set_trustapp(from.trustapp());
+ }
+ if (from.has_tci()) {
+ set_tci(from.tci());
+ }
+ }
+ mutable_unknown_fields()->append(from.unknown_fields());
+}
+
+void OpenTrustletRequest::CopyFrom(const OpenTrustletRequest& from) {
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+bool OpenTrustletRequest::IsInitialized() const {
+ if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false;
+
+ return true;
+}
+
+void OpenTrustletRequest::Swap(OpenTrustletRequest* other) {
+ if (other != this) {
+ std::swap(spid_, other->spid_);
+ std::swap(trustapp_, other->trustapp_);
+ std::swap(tci_, other->tci_);
+ std::swap(_has_bits_[0], other->_has_bits_[0]);
+ _unknown_fields_.swap(other->_unknown_fields_);
+ std::swap(_cached_size_, other->_cached_size_);
+ }
+}
+
+::std::string OpenTrustletRequest::GetTypeName() const {
+ return "com.trustonic.tee_proxy.OpenTrustletRequest";
+}
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
+const int OpenTrustletResponse::kIdFieldNumber;
+#endif // !_MSC_VER
+
+OpenTrustletResponse::OpenTrustletResponse()
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ // @@protoc_insertion_point(constructor:com.trustonic.tee_proxy.OpenTrustletResponse)
+}
+
+void OpenTrustletResponse::InitAsDefaultInstance() {
+}
+
+OpenTrustletResponse::OpenTrustletResponse(const OpenTrustletResponse& from)
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ MergeFrom(from);
+ // @@protoc_insertion_point(copy_constructor:com.trustonic.tee_proxy.OpenTrustletResponse)
+}
+
+void OpenTrustletResponse::SharedCtor() {
+ _cached_size_ = 0;
+ id_ = 0u;
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+OpenTrustletResponse::~OpenTrustletResponse() {
+ // @@protoc_insertion_point(destructor:com.trustonic.tee_proxy.OpenTrustletResponse)
+ SharedDtor();
+}
+
+void OpenTrustletResponse::SharedDtor() {
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ if (this != &default_instance()) {
+ #else
+ if (this != default_instance_) {
+ #endif
+ }
+}
+
+void OpenTrustletResponse::SetCachedSize(int size) const {
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const OpenTrustletResponse& OpenTrustletResponse::default_instance() {
+#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ protobuf_AddDesc_mc_2eproto();
+#else
+ if (default_instance_ == NULL) protobuf_AddDesc_mc_2eproto();
+#endif
+ return *default_instance_;
+}
+
+OpenTrustletResponse* OpenTrustletResponse::default_instance_ = NULL;
+
+OpenTrustletResponse* OpenTrustletResponse::New() const {
+ return new OpenTrustletResponse;
+}
+
+void OpenTrustletResponse::Clear() {
+ id_ = 0u;
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+ mutable_unknown_fields()->clear();
+}
+
+bool OpenTrustletResponse::MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
+ ::google::protobuf::uint32 tag;
+ ::google::protobuf::io::StringOutputStream unknown_fields_string(
+ mutable_unknown_fields());
+ ::google::protobuf::io::CodedOutputStream unknown_fields_stream(
+ &unknown_fields_string);
+ // @@protoc_insertion_point(parse_start:com.trustonic.tee_proxy.OpenTrustletResponse)
+ for (;;) {
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
+ tag = p.first;
+ if (!p.second) goto handle_unusual;
+ switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+ // required uint32 id = 1;
+ case 1: {
+ if (tag == 8) {
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+ ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
+ input, &id_)));
+ set_has_id();
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectAtEnd()) goto success;
+ break;
+ }
+
+ default: {
+ handle_unusual:
+ if (tag == 0 ||
+ ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+ goto success;
+ }
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(
+ input, tag, &unknown_fields_stream));
+ break;
+ }
+ }
+ }
+success:
+ // @@protoc_insertion_point(parse_success:com.trustonic.tee_proxy.OpenTrustletResponse)
+ return true;
+failure:
+ // @@protoc_insertion_point(parse_failure:com.trustonic.tee_proxy.OpenTrustletResponse)
+ return false;
+#undef DO_
+}
+
+void OpenTrustletResponse::SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const {
+ // @@protoc_insertion_point(serialize_start:com.trustonic.tee_proxy.OpenTrustletResponse)
+ // required uint32 id = 1;
+ if (has_id()) {
+ ::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->id(), output);
+ }
+
+ output->WriteRaw(unknown_fields().data(),
+ unknown_fields().size());
+ // @@protoc_insertion_point(serialize_end:com.trustonic.tee_proxy.OpenTrustletResponse)
+}
+
+int OpenTrustletResponse::ByteSize() const {
+ int total_size = 0;
+
+ if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ // required uint32 id = 1;
+ if (has_id()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::UInt32Size(
+ this->id());
+ }
+
+ }
+ total_size += unknown_fields().size();
+
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = total_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+ return total_size;
+}
+
+void OpenTrustletResponse::CheckTypeAndMergeFrom(
+ const ::google::protobuf::MessageLite& from) {
+ MergeFrom(*::google::protobuf::down_cast<const OpenTrustletResponse*>(&from));
+}
+
+void OpenTrustletResponse::MergeFrom(const OpenTrustletResponse& from) {
+ GOOGLE_CHECK_NE(&from, this);
+ if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ if (from.has_id()) {
+ set_id(from.id());
+ }
+ }
+ mutable_unknown_fields()->append(from.unknown_fields());
+}
+
+void OpenTrustletResponse::CopyFrom(const OpenTrustletResponse& from) {
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+bool OpenTrustletResponse::IsInitialized() const {
+ if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false;
+
+ return true;
+}
+
+void OpenTrustletResponse::Swap(OpenTrustletResponse* other) {
+ if (other != this) {
+ std::swap(id_, other->id_);
+ std::swap(_has_bits_[0], other->_has_bits_[0]);
+ _unknown_fields_.swap(other->_unknown_fields_);
+ std::swap(_cached_size_, other->_cached_size_);
+ }
+}
+
+::std::string OpenTrustletResponse::GetTypeName() const {
+ return "com.trustonic.tee_proxy.OpenTrustletResponse";
+}
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
+const int CloseSessionRequest::kIdFieldNumber;
+#endif // !_MSC_VER
+
+CloseSessionRequest::CloseSessionRequest()
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ // @@protoc_insertion_point(constructor:com.trustonic.tee_proxy.CloseSessionRequest)
+}
+
+void CloseSessionRequest::InitAsDefaultInstance() {
+}
+
+CloseSessionRequest::CloseSessionRequest(const CloseSessionRequest& from)
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ MergeFrom(from);
+ // @@protoc_insertion_point(copy_constructor:com.trustonic.tee_proxy.CloseSessionRequest)
+}
+
+void CloseSessionRequest::SharedCtor() {
+ _cached_size_ = 0;
+ id_ = 0u;
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+CloseSessionRequest::~CloseSessionRequest() {
+ // @@protoc_insertion_point(destructor:com.trustonic.tee_proxy.CloseSessionRequest)
+ SharedDtor();
+}
+
+void CloseSessionRequest::SharedDtor() {
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ if (this != &default_instance()) {
+ #else
+ if (this != default_instance_) {
+ #endif
+ }
+}
+
+void CloseSessionRequest::SetCachedSize(int size) const {
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const CloseSessionRequest& CloseSessionRequest::default_instance() {
+#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ protobuf_AddDesc_mc_2eproto();
+#else
+ if (default_instance_ == NULL) protobuf_AddDesc_mc_2eproto();
+#endif
+ return *default_instance_;
+}
+
+CloseSessionRequest* CloseSessionRequest::default_instance_ = NULL;
+
+CloseSessionRequest* CloseSessionRequest::New() const {
+ return new CloseSessionRequest;
+}
+
+void CloseSessionRequest::Clear() {
+ id_ = 0u;
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+ mutable_unknown_fields()->clear();
+}
+
+bool CloseSessionRequest::MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
+ ::google::protobuf::uint32 tag;
+ ::google::protobuf::io::StringOutputStream unknown_fields_string(
+ mutable_unknown_fields());
+ ::google::protobuf::io::CodedOutputStream unknown_fields_stream(
+ &unknown_fields_string);
+ // @@protoc_insertion_point(parse_start:com.trustonic.tee_proxy.CloseSessionRequest)
+ for (;;) {
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
+ tag = p.first;
+ if (!p.second) goto handle_unusual;
+ switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+ // required uint32 id = 1;
+ case 1: {
+ if (tag == 8) {
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+ ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
+ input, &id_)));
+ set_has_id();
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectAtEnd()) goto success;
+ break;
+ }
+
+ default: {
+ handle_unusual:
+ if (tag == 0 ||
+ ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+ goto success;
+ }
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(
+ input, tag, &unknown_fields_stream));
+ break;
+ }
+ }
+ }
+success:
+ // @@protoc_insertion_point(parse_success:com.trustonic.tee_proxy.CloseSessionRequest)
+ return true;
+failure:
+ // @@protoc_insertion_point(parse_failure:com.trustonic.tee_proxy.CloseSessionRequest)
+ return false;
+#undef DO_
+}
+
+void CloseSessionRequest::SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const {
+ // @@protoc_insertion_point(serialize_start:com.trustonic.tee_proxy.CloseSessionRequest)
+ // required uint32 id = 1;
+ if (has_id()) {
+ ::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->id(), output);
+ }
+
+ output->WriteRaw(unknown_fields().data(),
+ unknown_fields().size());
+ // @@protoc_insertion_point(serialize_end:com.trustonic.tee_proxy.CloseSessionRequest)
+}
+
+int CloseSessionRequest::ByteSize() const {
+ int total_size = 0;
+
+ if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ // required uint32 id = 1;
+ if (has_id()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::UInt32Size(
+ this->id());
+ }
+
+ }
+ total_size += unknown_fields().size();
+
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = total_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+ return total_size;
+}
+
+void CloseSessionRequest::CheckTypeAndMergeFrom(
+ const ::google::protobuf::MessageLite& from) {
+ MergeFrom(*::google::protobuf::down_cast<const CloseSessionRequest*>(&from));
+}
+
+void CloseSessionRequest::MergeFrom(const CloseSessionRequest& from) {
+ GOOGLE_CHECK_NE(&from, this);
+ if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ if (from.has_id()) {
+ set_id(from.id());
+ }
+ }
+ mutable_unknown_fields()->append(from.unknown_fields());
+}
+
+void CloseSessionRequest::CopyFrom(const CloseSessionRequest& from) {
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+bool CloseSessionRequest::IsInitialized() const {
+ if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false;
+
+ return true;
+}
+
+void CloseSessionRequest::Swap(CloseSessionRequest* other) {
+ if (other != this) {
+ std::swap(id_, other->id_);
+ std::swap(_has_bits_[0], other->_has_bits_[0]);
+ _unknown_fields_.swap(other->_unknown_fields_);
+ std::swap(_cached_size_, other->_cached_size_);
+ }
+}
+
+::std::string CloseSessionRequest::GetTypeName() const {
+ return "com.trustonic.tee_proxy.CloseSessionRequest";
+}
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
+#endif // !_MSC_VER
+
+CloseSessionResponse::CloseSessionResponse()
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ // @@protoc_insertion_point(constructor:com.trustonic.tee_proxy.CloseSessionResponse)
+}
+
+void CloseSessionResponse::InitAsDefaultInstance() {
+}
+
+CloseSessionResponse::CloseSessionResponse(const CloseSessionResponse& from)
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ MergeFrom(from);
+ // @@protoc_insertion_point(copy_constructor:com.trustonic.tee_proxy.CloseSessionResponse)
+}
+
+void CloseSessionResponse::SharedCtor() {
+ _cached_size_ = 0;
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+CloseSessionResponse::~CloseSessionResponse() {
+ // @@protoc_insertion_point(destructor:com.trustonic.tee_proxy.CloseSessionResponse)
+ SharedDtor();
+}
+
+void CloseSessionResponse::SharedDtor() {
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ if (this != &default_instance()) {
+ #else
+ if (this != default_instance_) {
+ #endif
+ }
+}
+
+void CloseSessionResponse::SetCachedSize(int size) const {
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const CloseSessionResponse& CloseSessionResponse::default_instance() {
+#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ protobuf_AddDesc_mc_2eproto();
+#else
+ if (default_instance_ == NULL) protobuf_AddDesc_mc_2eproto();
+#endif
+ return *default_instance_;
+}
+
+CloseSessionResponse* CloseSessionResponse::default_instance_ = NULL;
+
+CloseSessionResponse* CloseSessionResponse::New() const {
+ return new CloseSessionResponse;
+}
+
+void CloseSessionResponse::Clear() {
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+ mutable_unknown_fields()->clear();
+}
+
+bool CloseSessionResponse::MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
+ ::google::protobuf::uint32 tag;
+ ::google::protobuf::io::StringOutputStream unknown_fields_string(
+ mutable_unknown_fields());
+ ::google::protobuf::io::CodedOutputStream unknown_fields_stream(
+ &unknown_fields_string);
+ // @@protoc_insertion_point(parse_start:com.trustonic.tee_proxy.CloseSessionResponse)
+ for (;;) {
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
+ tag = p.first;
+ if (!p.second) goto handle_unusual;
+ handle_unusual:
+ if (tag == 0 ||
+ ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+ goto success;
+ }
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(
+ input, tag, &unknown_fields_stream));
+ }
+success:
+ // @@protoc_insertion_point(parse_success:com.trustonic.tee_proxy.CloseSessionResponse)
+ return true;
+failure:
+ // @@protoc_insertion_point(parse_failure:com.trustonic.tee_proxy.CloseSessionResponse)
+ return false;
+#undef DO_
+}
+
+void CloseSessionResponse::SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const {
+ // @@protoc_insertion_point(serialize_start:com.trustonic.tee_proxy.CloseSessionResponse)
+ output->WriteRaw(unknown_fields().data(),
+ unknown_fields().size());
+ // @@protoc_insertion_point(serialize_end:com.trustonic.tee_proxy.CloseSessionResponse)
+}
+
+int CloseSessionResponse::ByteSize() const {
+ int total_size = 0;
+
+ total_size += unknown_fields().size();
+
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = total_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+ return total_size;
+}
+
+void CloseSessionResponse::CheckTypeAndMergeFrom(
+ const ::google::protobuf::MessageLite& from) {
+ MergeFrom(*::google::protobuf::down_cast<const CloseSessionResponse*>(&from));
+}
+
+void CloseSessionResponse::MergeFrom(const CloseSessionResponse& from) {
+ GOOGLE_CHECK_NE(&from, this);
+ mutable_unknown_fields()->append(from.unknown_fields());
+}
+
+void CloseSessionResponse::CopyFrom(const CloseSessionResponse& from) {
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+bool CloseSessionResponse::IsInitialized() const {
+
+ return true;
+}
+
+void CloseSessionResponse::Swap(CloseSessionResponse* other) {
+ if (other != this) {
+ _unknown_fields_.swap(other->_unknown_fields_);
+ std::swap(_cached_size_, other->_cached_size_);
+ }
+}
+
+::std::string CloseSessionResponse::GetTypeName() const {
+ return "com.trustonic.tee_proxy.CloseSessionResponse";
+}
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
+const int NotifyRequest_Buffers::kSvaFieldNumber;
+const int NotifyRequest_Buffers::kDataFieldNumber;
+#endif // !_MSC_VER
+
+NotifyRequest_Buffers::NotifyRequest_Buffers()
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ // @@protoc_insertion_point(constructor:com.trustonic.tee_proxy.NotifyRequest.Buffers)
+}
+
+void NotifyRequest_Buffers::InitAsDefaultInstance() {
+}
+
+NotifyRequest_Buffers::NotifyRequest_Buffers(const NotifyRequest_Buffers& from)
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ MergeFrom(from);
+ // @@protoc_insertion_point(copy_constructor:com.trustonic.tee_proxy.NotifyRequest.Buffers)
+}
+
+void NotifyRequest_Buffers::SharedCtor() {
+ ::google::protobuf::internal::GetEmptyString();
+ _cached_size_ = 0;
+ sva_ = GOOGLE_ULONGLONG(0);
+ data_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+NotifyRequest_Buffers::~NotifyRequest_Buffers() {
+ // @@protoc_insertion_point(destructor:com.trustonic.tee_proxy.NotifyRequest.Buffers)
+ SharedDtor();
+}
+
+void NotifyRequest_Buffers::SharedDtor() {
+ if (data_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ delete data_;
+ }
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ if (this != &default_instance()) {
+ #else
+ if (this != default_instance_) {
+ #endif
+ }
+}
+
+void NotifyRequest_Buffers::SetCachedSize(int size) const {
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const NotifyRequest_Buffers& NotifyRequest_Buffers::default_instance() {
+#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ protobuf_AddDesc_mc_2eproto();
+#else
+ if (default_instance_ == NULL) protobuf_AddDesc_mc_2eproto();
+#endif
+ return *default_instance_;
+}
+
+NotifyRequest_Buffers* NotifyRequest_Buffers::default_instance_ = NULL;
+
+NotifyRequest_Buffers* NotifyRequest_Buffers::New() const {
+ return new NotifyRequest_Buffers;
+}
+
+void NotifyRequest_Buffers::Clear() {
+ if (_has_bits_[0 / 32] & 3) {
+ sva_ = GOOGLE_ULONGLONG(0);
+ if (has_data()) {
+ if (data_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ data_->clear();
+ }
+ }
+ }
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+ mutable_unknown_fields()->clear();
+}
+
+bool NotifyRequest_Buffers::MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
+ ::google::protobuf::uint32 tag;
+ ::google::protobuf::io::StringOutputStream unknown_fields_string(
+ mutable_unknown_fields());
+ ::google::protobuf::io::CodedOutputStream unknown_fields_stream(
+ &unknown_fields_string);
+ // @@protoc_insertion_point(parse_start:com.trustonic.tee_proxy.NotifyRequest.Buffers)
+ for (;;) {
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
+ tag = p.first;
+ if (!p.second) goto handle_unusual;
+ switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+ // required uint64 sva = 1;
+ case 1: {
+ if (tag == 8) {
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+ ::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
+ input, &sva_)));
+ set_has_sva();
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectTag(18)) goto parse_data;
+ break;
+ }
+
+ // required bytes data = 2;
+ case 2: {
+ if (tag == 18) {
+ parse_data:
+ DO_(::google::protobuf::internal::WireFormatLite::ReadBytes(
+ input, this->mutable_data()));
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectAtEnd()) goto success;
+ break;
+ }
+
+ default: {
+ handle_unusual:
+ if (tag == 0 ||
+ ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+ goto success;
+ }
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(
+ input, tag, &unknown_fields_stream));
+ break;
+ }
+ }
+ }
+success:
+ // @@protoc_insertion_point(parse_success:com.trustonic.tee_proxy.NotifyRequest.Buffers)
+ return true;
+failure:
+ // @@protoc_insertion_point(parse_failure:com.trustonic.tee_proxy.NotifyRequest.Buffers)
+ return false;
+#undef DO_
+}
+
+void NotifyRequest_Buffers::SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const {
+ // @@protoc_insertion_point(serialize_start:com.trustonic.tee_proxy.NotifyRequest.Buffers)
+ // required uint64 sva = 1;
+ if (has_sva()) {
+ ::google::protobuf::internal::WireFormatLite::WriteUInt64(1, this->sva(), output);
+ }
+
+ // required bytes data = 2;
+ if (has_data()) {
+ ::google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased(
+ 2, this->data(), output);
+ }
+
+ output->WriteRaw(unknown_fields().data(),
+ unknown_fields().size());
+ // @@protoc_insertion_point(serialize_end:com.trustonic.tee_proxy.NotifyRequest.Buffers)
+}
+
+int NotifyRequest_Buffers::ByteSize() const {
+ int total_size = 0;
+
+ if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ // required uint64 sva = 1;
+ if (has_sva()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::UInt64Size(
+ this->sva());
+ }
+
+ // required bytes data = 2;
+ if (has_data()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::BytesSize(
+ this->data());
+ }
+
+ }
+ total_size += unknown_fields().size();
+
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = total_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+ return total_size;
+}
+
+void NotifyRequest_Buffers::CheckTypeAndMergeFrom(
+ const ::google::protobuf::MessageLite& from) {
+ MergeFrom(*::google::protobuf::down_cast<const NotifyRequest_Buffers*>(&from));
+}
+
+void NotifyRequest_Buffers::MergeFrom(const NotifyRequest_Buffers& from) {
+ GOOGLE_CHECK_NE(&from, this);
+ if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ if (from.has_sva()) {
+ set_sva(from.sva());
+ }
+ if (from.has_data()) {
+ set_data(from.data());
+ }
+ }
+ mutable_unknown_fields()->append(from.unknown_fields());
+}
+
+void NotifyRequest_Buffers::CopyFrom(const NotifyRequest_Buffers& from) {
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+bool NotifyRequest_Buffers::IsInitialized() const {
+ if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false;
+
+ return true;
+}
+
+void NotifyRequest_Buffers::Swap(NotifyRequest_Buffers* other) {
+ if (other != this) {
+ std::swap(sva_, other->sva_);
+ std::swap(data_, other->data_);
+ std::swap(_has_bits_[0], other->_has_bits_[0]);
+ _unknown_fields_.swap(other->_unknown_fields_);
+ std::swap(_cached_size_, other->_cached_size_);
+ }
+}
+
+::std::string NotifyRequest_Buffers::GetTypeName() const {
+ return "com.trustonic.tee_proxy.NotifyRequest.Buffers";
+}
+
+
+// -------------------------------------------------------------------
+
+#ifndef _MSC_VER
+const int NotifyRequest::kSidFieldNumber;
+const int NotifyRequest::kTciFieldNumber;
+const int NotifyRequest::kBuffersFieldNumber;
+#endif // !_MSC_VER
+
+NotifyRequest::NotifyRequest()
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ // @@protoc_insertion_point(constructor:com.trustonic.tee_proxy.NotifyRequest)
+}
+
+void NotifyRequest::InitAsDefaultInstance() {
+}
+
+NotifyRequest::NotifyRequest(const NotifyRequest& from)
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ MergeFrom(from);
+ // @@protoc_insertion_point(copy_constructor:com.trustonic.tee_proxy.NotifyRequest)
+}
+
+void NotifyRequest::SharedCtor() {
+ ::google::protobuf::internal::GetEmptyString();
+ _cached_size_ = 0;
+ sid_ = 0u;
+ tci_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+NotifyRequest::~NotifyRequest() {
+ // @@protoc_insertion_point(destructor:com.trustonic.tee_proxy.NotifyRequest)
+ SharedDtor();
+}
+
+void NotifyRequest::SharedDtor() {
+ if (tci_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ delete tci_;
+ }
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ if (this != &default_instance()) {
+ #else
+ if (this != default_instance_) {
+ #endif
+ }
+}
+
+void NotifyRequest::SetCachedSize(int size) const {
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const NotifyRequest& NotifyRequest::default_instance() {
+#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ protobuf_AddDesc_mc_2eproto();
+#else
+ if (default_instance_ == NULL) protobuf_AddDesc_mc_2eproto();
+#endif
+ return *default_instance_;
+}
+
+NotifyRequest* NotifyRequest::default_instance_ = NULL;
+
+NotifyRequest* NotifyRequest::New() const {
+ return new NotifyRequest;
+}
+
+void NotifyRequest::Clear() {
+ if (_has_bits_[0 / 32] & 3) {
+ sid_ = 0u;
+ if (has_tci()) {
+ if (tci_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ tci_->clear();
+ }
+ }
+ }
+ buffers_.Clear();
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+ mutable_unknown_fields()->clear();
+}
+
+bool NotifyRequest::MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
+ ::google::protobuf::uint32 tag;
+ ::google::protobuf::io::StringOutputStream unknown_fields_string(
+ mutable_unknown_fields());
+ ::google::protobuf::io::CodedOutputStream unknown_fields_stream(
+ &unknown_fields_string);
+ // @@protoc_insertion_point(parse_start:com.trustonic.tee_proxy.NotifyRequest)
+ for (;;) {
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
+ tag = p.first;
+ if (!p.second) goto handle_unusual;
+ switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+ // required uint32 sid = 1;
+ case 1: {
+ if (tag == 8) {
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+ ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
+ input, &sid_)));
+ set_has_sid();
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectTag(18)) goto parse_tci;
+ break;
+ }
+
+ // optional bytes tci = 2;
+ case 2: {
+ if (tag == 18) {
+ parse_tci:
+ DO_(::google::protobuf::internal::WireFormatLite::ReadBytes(
+ input, this->mutable_tci()));
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectTag(26)) goto parse_buffers;
+ break;
+ }
+
+ // repeated .com.trustonic.tee_proxy.NotifyRequest.Buffers buffers = 3;
+ case 3: {
+ if (tag == 26) {
+ parse_buffers:
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
+ input, add_buffers()));
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectTag(26)) goto parse_buffers;
+ if (input->ExpectAtEnd()) goto success;
+ break;
+ }
+
+ default: {
+ handle_unusual:
+ if (tag == 0 ||
+ ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+ goto success;
+ }
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(
+ input, tag, &unknown_fields_stream));
+ break;
+ }
+ }
+ }
+success:
+ // @@protoc_insertion_point(parse_success:com.trustonic.tee_proxy.NotifyRequest)
+ return true;
+failure:
+ // @@protoc_insertion_point(parse_failure:com.trustonic.tee_proxy.NotifyRequest)
+ return false;
+#undef DO_
+}
+
+void NotifyRequest::SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const {
+ // @@protoc_insertion_point(serialize_start:com.trustonic.tee_proxy.NotifyRequest)
+ // required uint32 sid = 1;
+ if (has_sid()) {
+ ::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->sid(), output);
+ }
+
+ // optional bytes tci = 2;
+ if (has_tci()) {
+ ::google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased(
+ 2, this->tci(), output);
+ }
+
+ // repeated .com.trustonic.tee_proxy.NotifyRequest.Buffers buffers = 3;
+ for (int i = 0; i < this->buffers_size(); i++) {
+ ::google::protobuf::internal::WireFormatLite::WriteMessage(
+ 3, this->buffers(i), output);
+ }
+
+ output->WriteRaw(unknown_fields().data(),
+ unknown_fields().size());
+ // @@protoc_insertion_point(serialize_end:com.trustonic.tee_proxy.NotifyRequest)
+}
+
+int NotifyRequest::ByteSize() const {
+ int total_size = 0;
+
+ if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ // required uint32 sid = 1;
+ if (has_sid()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::UInt32Size(
+ this->sid());
+ }
+
+ // optional bytes tci = 2;
+ if (has_tci()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::BytesSize(
+ this->tci());
+ }
+
+ }
+ // repeated .com.trustonic.tee_proxy.NotifyRequest.Buffers buffers = 3;
+ total_size += 1 * this->buffers_size();
+ for (int i = 0; i < this->buffers_size(); i++) {
+ total_size +=
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
+ this->buffers(i));
+ }
+
+ total_size += unknown_fields().size();
+
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = total_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+ return total_size;
+}
+
+void NotifyRequest::CheckTypeAndMergeFrom(
+ const ::google::protobuf::MessageLite& from) {
+ MergeFrom(*::google::protobuf::down_cast<const NotifyRequest*>(&from));
+}
+
+void NotifyRequest::MergeFrom(const NotifyRequest& from) {
+ GOOGLE_CHECK_NE(&from, this);
+ buffers_.MergeFrom(from.buffers_);
+ if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ if (from.has_sid()) {
+ set_sid(from.sid());
+ }
+ if (from.has_tci()) {
+ set_tci(from.tci());
+ }
+ }
+ mutable_unknown_fields()->append(from.unknown_fields());
+}
+
+void NotifyRequest::CopyFrom(const NotifyRequest& from) {
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+bool NotifyRequest::IsInitialized() const {
+ if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false;
+
+ if (!::google::protobuf::internal::AllAreInitialized(this->buffers())) return false;
+ return true;
+}
+
+void NotifyRequest::Swap(NotifyRequest* other) {
+ if (other != this) {
+ std::swap(sid_, other->sid_);
+ std::swap(tci_, other->tci_);
+ buffers_.Swap(&other->buffers_);
+ std::swap(_has_bits_[0], other->_has_bits_[0]);
+ _unknown_fields_.swap(other->_unknown_fields_);
+ std::swap(_cached_size_, other->_cached_size_);
+ }
+}
+
+::std::string NotifyRequest::GetTypeName() const {
+ return "com.trustonic.tee_proxy.NotifyRequest";
+}
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
+#endif // !_MSC_VER
+
+NotifyResponse::NotifyResponse()
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ // @@protoc_insertion_point(constructor:com.trustonic.tee_proxy.NotifyResponse)
+}
+
+void NotifyResponse::InitAsDefaultInstance() {
+}
+
+NotifyResponse::NotifyResponse(const NotifyResponse& from)
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ MergeFrom(from);
+ // @@protoc_insertion_point(copy_constructor:com.trustonic.tee_proxy.NotifyResponse)
+}
+
+void NotifyResponse::SharedCtor() {
+ _cached_size_ = 0;
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+NotifyResponse::~NotifyResponse() {
+ // @@protoc_insertion_point(destructor:com.trustonic.tee_proxy.NotifyResponse)
+ SharedDtor();
+}
+
+void NotifyResponse::SharedDtor() {
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ if (this != &default_instance()) {
+ #else
+ if (this != default_instance_) {
+ #endif
+ }
+}
+
+void NotifyResponse::SetCachedSize(int size) const {
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const NotifyResponse& NotifyResponse::default_instance() {
+#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ protobuf_AddDesc_mc_2eproto();
+#else
+ if (default_instance_ == NULL) protobuf_AddDesc_mc_2eproto();
+#endif
+ return *default_instance_;
+}
+
+NotifyResponse* NotifyResponse::default_instance_ = NULL;
+
+NotifyResponse* NotifyResponse::New() const {
+ return new NotifyResponse;
+}
+
+void NotifyResponse::Clear() {
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+ mutable_unknown_fields()->clear();
+}
+
+bool NotifyResponse::MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
+ ::google::protobuf::uint32 tag;
+ ::google::protobuf::io::StringOutputStream unknown_fields_string(
+ mutable_unknown_fields());
+ ::google::protobuf::io::CodedOutputStream unknown_fields_stream(
+ &unknown_fields_string);
+ // @@protoc_insertion_point(parse_start:com.trustonic.tee_proxy.NotifyResponse)
+ for (;;) {
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
+ tag = p.first;
+ if (!p.second) goto handle_unusual;
+ handle_unusual:
+ if (tag == 0 ||
+ ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+ goto success;
+ }
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(
+ input, tag, &unknown_fields_stream));
+ }
+success:
+ // @@protoc_insertion_point(parse_success:com.trustonic.tee_proxy.NotifyResponse)
+ return true;
+failure:
+ // @@protoc_insertion_point(parse_failure:com.trustonic.tee_proxy.NotifyResponse)
+ return false;
+#undef DO_
+}
+
+void NotifyResponse::SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const {
+ // @@protoc_insertion_point(serialize_start:com.trustonic.tee_proxy.NotifyResponse)
+ output->WriteRaw(unknown_fields().data(),
+ unknown_fields().size());
+ // @@protoc_insertion_point(serialize_end:com.trustonic.tee_proxy.NotifyResponse)
+}
+
+int NotifyResponse::ByteSize() const {
+ int total_size = 0;
+
+ total_size += unknown_fields().size();
+
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = total_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+ return total_size;
+}
+
+void NotifyResponse::CheckTypeAndMergeFrom(
+ const ::google::protobuf::MessageLite& from) {
+ MergeFrom(*::google::protobuf::down_cast<const NotifyResponse*>(&from));
+}
+
+void NotifyResponse::MergeFrom(const NotifyResponse& from) {
+ GOOGLE_CHECK_NE(&from, this);
+ mutable_unknown_fields()->append(from.unknown_fields());
+}
+
+void NotifyResponse::CopyFrom(const NotifyResponse& from) {
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+bool NotifyResponse::IsInitialized() const {
+
+ return true;
+}
+
+void NotifyResponse::Swap(NotifyResponse* other) {
+ if (other != this) {
+ _unknown_fields_.swap(other->_unknown_fields_);
+ std::swap(_cached_size_, other->_cached_size_);
+ }
+}
+
+::std::string NotifyResponse::GetTypeName() const {
+ return "com.trustonic.tee_proxy.NotifyResponse";
+}
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
+const int WaitNotificationRequest::kSidFieldNumber;
+const int WaitNotificationRequest::kTimeoutFieldNumber;
+const int WaitNotificationRequest::kPartialFieldNumber;
+#endif // !_MSC_VER
+
+WaitNotificationRequest::WaitNotificationRequest()
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ // @@protoc_insertion_point(constructor:com.trustonic.tee_proxy.WaitNotificationRequest)
+}
+
+void WaitNotificationRequest::InitAsDefaultInstance() {
+}
+
+WaitNotificationRequest::WaitNotificationRequest(const WaitNotificationRequest& from)
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ MergeFrom(from);
+ // @@protoc_insertion_point(copy_constructor:com.trustonic.tee_proxy.WaitNotificationRequest)
+}
+
+void WaitNotificationRequest::SharedCtor() {
+ _cached_size_ = 0;
+ sid_ = 0u;
+ timeout_ = 0;
+ partial_ = false;
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+WaitNotificationRequest::~WaitNotificationRequest() {
+ // @@protoc_insertion_point(destructor:com.trustonic.tee_proxy.WaitNotificationRequest)
+ SharedDtor();
+}
+
+void WaitNotificationRequest::SharedDtor() {
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ if (this != &default_instance()) {
+ #else
+ if (this != default_instance_) {
+ #endif
+ }
+}
+
+void WaitNotificationRequest::SetCachedSize(int size) const {
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const WaitNotificationRequest& WaitNotificationRequest::default_instance() {
+#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ protobuf_AddDesc_mc_2eproto();
+#else
+ if (default_instance_ == NULL) protobuf_AddDesc_mc_2eproto();
+#endif
+ return *default_instance_;
+}
+
+WaitNotificationRequest* WaitNotificationRequest::default_instance_ = NULL;
+
+WaitNotificationRequest* WaitNotificationRequest::New() const {
+ return new WaitNotificationRequest;
+}
+
+void WaitNotificationRequest::Clear() {
+#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
+ &reinterpret_cast<WaitNotificationRequest*>(16)->f) - \
+ reinterpret_cast<char*>(16))
+
+#define ZR_(first, last) do { \
+ size_t f = OFFSET_OF_FIELD_(first); \
+ size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
+ ::memset(&first, 0, n); \
+ } while (0)
+
+ ZR_(sid_, partial_);
+
+#undef OFFSET_OF_FIELD_
+#undef ZR_
+
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+ mutable_unknown_fields()->clear();
+}
+
+bool WaitNotificationRequest::MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
+ ::google::protobuf::uint32 tag;
+ ::google::protobuf::io::StringOutputStream unknown_fields_string(
+ mutable_unknown_fields());
+ ::google::protobuf::io::CodedOutputStream unknown_fields_stream(
+ &unknown_fields_string);
+ // @@protoc_insertion_point(parse_start:com.trustonic.tee_proxy.WaitNotificationRequest)
+ for (;;) {
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
+ tag = p.first;
+ if (!p.second) goto handle_unusual;
+ switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+ // required uint32 sid = 1;
+ case 1: {
+ if (tag == 8) {
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+ ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
+ input, &sid_)));
+ set_has_sid();
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectTag(16)) goto parse_timeout;
+ break;
+ }
+
+ // required sint32 timeout = 2;
+ case 2: {
+ if (tag == 16) {
+ parse_timeout:
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+ ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_SINT32>(
+ input, &timeout_)));
+ set_has_timeout();
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectTag(24)) goto parse_partial;
+ break;
+ }
+
+ // required bool partial = 3;
+ case 3: {
+ if (tag == 24) {
+ parse_partial:
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+ bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
+ input, &partial_)));
+ set_has_partial();
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectAtEnd()) goto success;
+ break;
+ }
+
+ default: {
+ handle_unusual:
+ if (tag == 0 ||
+ ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+ goto success;
+ }
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(
+ input, tag, &unknown_fields_stream));
+ break;
+ }
+ }
+ }
+success:
+ // @@protoc_insertion_point(parse_success:com.trustonic.tee_proxy.WaitNotificationRequest)
+ return true;
+failure:
+ // @@protoc_insertion_point(parse_failure:com.trustonic.tee_proxy.WaitNotificationRequest)
+ return false;
+#undef DO_
+}
+
+void WaitNotificationRequest::SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const {
+ // @@protoc_insertion_point(serialize_start:com.trustonic.tee_proxy.WaitNotificationRequest)
+ // required uint32 sid = 1;
+ if (has_sid()) {
+ ::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->sid(), output);
+ }
+
+ // required sint32 timeout = 2;
+ if (has_timeout()) {
+ ::google::protobuf::internal::WireFormatLite::WriteSInt32(2, this->timeout(), output);
+ }
+
+ // required bool partial = 3;
+ if (has_partial()) {
+ ::google::protobuf::internal::WireFormatLite::WriteBool(3, this->partial(), output);
+ }
+
+ output->WriteRaw(unknown_fields().data(),
+ unknown_fields().size());
+ // @@protoc_insertion_point(serialize_end:com.trustonic.tee_proxy.WaitNotificationRequest)
+}
+
+int WaitNotificationRequest::ByteSize() const {
+ int total_size = 0;
+
+ if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ // required uint32 sid = 1;
+ if (has_sid()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::UInt32Size(
+ this->sid());
+ }
+
+ // required sint32 timeout = 2;
+ if (has_timeout()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::SInt32Size(
+ this->timeout());
+ }
+
+ // required bool partial = 3;
+ if (has_partial()) {
+ total_size += 1 + 1;
+ }
+
+ }
+ total_size += unknown_fields().size();
+
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = total_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+ return total_size;
+}
+
+void WaitNotificationRequest::CheckTypeAndMergeFrom(
+ const ::google::protobuf::MessageLite& from) {
+ MergeFrom(*::google::protobuf::down_cast<const WaitNotificationRequest*>(&from));
+}
+
+void WaitNotificationRequest::MergeFrom(const WaitNotificationRequest& from) {
+ GOOGLE_CHECK_NE(&from, this);
+ if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ if (from.has_sid()) {
+ set_sid(from.sid());
+ }
+ if (from.has_timeout()) {
+ set_timeout(from.timeout());
+ }
+ if (from.has_partial()) {
+ set_partial(from.partial());
+ }
+ }
+ mutable_unknown_fields()->append(from.unknown_fields());
+}
+
+void WaitNotificationRequest::CopyFrom(const WaitNotificationRequest& from) {
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+bool WaitNotificationRequest::IsInitialized() const {
+ if ((_has_bits_[0] & 0x00000007) != 0x00000007) return false;
+
+ return true;
+}
+
+void WaitNotificationRequest::Swap(WaitNotificationRequest* other) {
+ if (other != this) {
+ std::swap(sid_, other->sid_);
+ std::swap(timeout_, other->timeout_);
+ std::swap(partial_, other->partial_);
+ std::swap(_has_bits_[0], other->_has_bits_[0]);
+ _unknown_fields_.swap(other->_unknown_fields_);
+ std::swap(_cached_size_, other->_cached_size_);
+ }
+}
+
+::std::string WaitNotificationRequest::GetTypeName() const {
+ return "com.trustonic.tee_proxy.WaitNotificationRequest";
+}
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
+const int WaitNotificationResponse_Buffers::kSvaFieldNumber;
+const int WaitNotificationResponse_Buffers::kDataFieldNumber;
+#endif // !_MSC_VER
+
+WaitNotificationResponse_Buffers::WaitNotificationResponse_Buffers()
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ // @@protoc_insertion_point(constructor:com.trustonic.tee_proxy.WaitNotificationResponse.Buffers)
+}
+
+void WaitNotificationResponse_Buffers::InitAsDefaultInstance() {
+}
+
+WaitNotificationResponse_Buffers::WaitNotificationResponse_Buffers(const WaitNotificationResponse_Buffers& from)
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ MergeFrom(from);
+ // @@protoc_insertion_point(copy_constructor:com.trustonic.tee_proxy.WaitNotificationResponse.Buffers)
+}
+
+void WaitNotificationResponse_Buffers::SharedCtor() {
+ ::google::protobuf::internal::GetEmptyString();
+ _cached_size_ = 0;
+ sva_ = GOOGLE_ULONGLONG(0);
+ data_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+WaitNotificationResponse_Buffers::~WaitNotificationResponse_Buffers() {
+ // @@protoc_insertion_point(destructor:com.trustonic.tee_proxy.WaitNotificationResponse.Buffers)
+ SharedDtor();
+}
+
+void WaitNotificationResponse_Buffers::SharedDtor() {
+ if (data_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ delete data_;
+ }
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ if (this != &default_instance()) {
+ #else
+ if (this != default_instance_) {
+ #endif
+ }
+}
+
+void WaitNotificationResponse_Buffers::SetCachedSize(int size) const {
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const WaitNotificationResponse_Buffers& WaitNotificationResponse_Buffers::default_instance() {
+#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ protobuf_AddDesc_mc_2eproto();
+#else
+ if (default_instance_ == NULL) protobuf_AddDesc_mc_2eproto();
+#endif
+ return *default_instance_;
+}
+
+WaitNotificationResponse_Buffers* WaitNotificationResponse_Buffers::default_instance_ = NULL;
+
+WaitNotificationResponse_Buffers* WaitNotificationResponse_Buffers::New() const {
+ return new WaitNotificationResponse_Buffers;
+}
+
+void WaitNotificationResponse_Buffers::Clear() {
+ if (_has_bits_[0 / 32] & 3) {
+ sva_ = GOOGLE_ULONGLONG(0);
+ if (has_data()) {
+ if (data_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ data_->clear();
+ }
+ }
+ }
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+ mutable_unknown_fields()->clear();
+}
+
+bool WaitNotificationResponse_Buffers::MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
+ ::google::protobuf::uint32 tag;
+ ::google::protobuf::io::StringOutputStream unknown_fields_string(
+ mutable_unknown_fields());
+ ::google::protobuf::io::CodedOutputStream unknown_fields_stream(
+ &unknown_fields_string);
+ // @@protoc_insertion_point(parse_start:com.trustonic.tee_proxy.WaitNotificationResponse.Buffers)
+ for (;;) {
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
+ tag = p.first;
+ if (!p.second) goto handle_unusual;
+ switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+ // required uint64 sva = 1;
+ case 1: {
+ if (tag == 8) {
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+ ::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
+ input, &sva_)));
+ set_has_sva();
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectTag(18)) goto parse_data;
+ break;
+ }
+
+ // required bytes data = 2;
+ case 2: {
+ if (tag == 18) {
+ parse_data:
+ DO_(::google::protobuf::internal::WireFormatLite::ReadBytes(
+ input, this->mutable_data()));
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectAtEnd()) goto success;
+ break;
+ }
+
+ default: {
+ handle_unusual:
+ if (tag == 0 ||
+ ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+ goto success;
+ }
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(
+ input, tag, &unknown_fields_stream));
+ break;
+ }
+ }
+ }
+success:
+ // @@protoc_insertion_point(parse_success:com.trustonic.tee_proxy.WaitNotificationResponse.Buffers)
+ return true;
+failure:
+ // @@protoc_insertion_point(parse_failure:com.trustonic.tee_proxy.WaitNotificationResponse.Buffers)
+ return false;
+#undef DO_
+}
+
+void WaitNotificationResponse_Buffers::SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const {
+ // @@protoc_insertion_point(serialize_start:com.trustonic.tee_proxy.WaitNotificationResponse.Buffers)
+ // required uint64 sva = 1;
+ if (has_sva()) {
+ ::google::protobuf::internal::WireFormatLite::WriteUInt64(1, this->sva(), output);
+ }
+
+ // required bytes data = 2;
+ if (has_data()) {
+ ::google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased(
+ 2, this->data(), output);
+ }
+
+ output->WriteRaw(unknown_fields().data(),
+ unknown_fields().size());
+ // @@protoc_insertion_point(serialize_end:com.trustonic.tee_proxy.WaitNotificationResponse.Buffers)
+}
+
+int WaitNotificationResponse_Buffers::ByteSize() const {
+ int total_size = 0;
+
+ if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ // required uint64 sva = 1;
+ if (has_sva()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::UInt64Size(
+ this->sva());
+ }
+
+ // required bytes data = 2;
+ if (has_data()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::BytesSize(
+ this->data());
+ }
+
+ }
+ total_size += unknown_fields().size();
+
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = total_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+ return total_size;
+}
+
+void WaitNotificationResponse_Buffers::CheckTypeAndMergeFrom(
+ const ::google::protobuf::MessageLite& from) {
+ MergeFrom(*::google::protobuf::down_cast<const WaitNotificationResponse_Buffers*>(&from));
+}
+
+void WaitNotificationResponse_Buffers::MergeFrom(const WaitNotificationResponse_Buffers& from) {
+ GOOGLE_CHECK_NE(&from, this);
+ if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ if (from.has_sva()) {
+ set_sva(from.sva());
+ }
+ if (from.has_data()) {
+ set_data(from.data());
+ }
+ }
+ mutable_unknown_fields()->append(from.unknown_fields());
+}
+
+void WaitNotificationResponse_Buffers::CopyFrom(const WaitNotificationResponse_Buffers& from) {
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+bool WaitNotificationResponse_Buffers::IsInitialized() const {
+ if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false;
+
+ return true;
+}
+
+void WaitNotificationResponse_Buffers::Swap(WaitNotificationResponse_Buffers* other) {
+ if (other != this) {
+ std::swap(sva_, other->sva_);
+ std::swap(data_, other->data_);
+ std::swap(_has_bits_[0], other->_has_bits_[0]);
+ _unknown_fields_.swap(other->_unknown_fields_);
+ std::swap(_cached_size_, other->_cached_size_);
+ }
+}
+
+::std::string WaitNotificationResponse_Buffers::GetTypeName() const {
+ return "com.trustonic.tee_proxy.WaitNotificationResponse.Buffers";
+}
+
+
+// -------------------------------------------------------------------
+
+#ifndef _MSC_VER
+const int WaitNotificationResponse::kTciFieldNumber;
+const int WaitNotificationResponse::kBuffersFieldNumber;
+#endif // !_MSC_VER
+
+WaitNotificationResponse::WaitNotificationResponse()
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ // @@protoc_insertion_point(constructor:com.trustonic.tee_proxy.WaitNotificationResponse)
+}
+
+void WaitNotificationResponse::InitAsDefaultInstance() {
+}
+
+WaitNotificationResponse::WaitNotificationResponse(const WaitNotificationResponse& from)
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ MergeFrom(from);
+ // @@protoc_insertion_point(copy_constructor:com.trustonic.tee_proxy.WaitNotificationResponse)
+}
+
+void WaitNotificationResponse::SharedCtor() {
+ ::google::protobuf::internal::GetEmptyString();
+ _cached_size_ = 0;
+ tci_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+WaitNotificationResponse::~WaitNotificationResponse() {
+ // @@protoc_insertion_point(destructor:com.trustonic.tee_proxy.WaitNotificationResponse)
+ SharedDtor();
+}
+
+void WaitNotificationResponse::SharedDtor() {
+ if (tci_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ delete tci_;
+ }
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ if (this != &default_instance()) {
+ #else
+ if (this != default_instance_) {
+ #endif
+ }
+}
+
+void WaitNotificationResponse::SetCachedSize(int size) const {
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const WaitNotificationResponse& WaitNotificationResponse::default_instance() {
+#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ protobuf_AddDesc_mc_2eproto();
+#else
+ if (default_instance_ == NULL) protobuf_AddDesc_mc_2eproto();
+#endif
+ return *default_instance_;
+}
+
+WaitNotificationResponse* WaitNotificationResponse::default_instance_ = NULL;
+
+WaitNotificationResponse* WaitNotificationResponse::New() const {
+ return new WaitNotificationResponse;
+}
+
+void WaitNotificationResponse::Clear() {
+ if (has_tci()) {
+ if (tci_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ tci_->clear();
+ }
+ }
+ buffers_.Clear();
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+ mutable_unknown_fields()->clear();
+}
+
+bool WaitNotificationResponse::MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
+ ::google::protobuf::uint32 tag;
+ ::google::protobuf::io::StringOutputStream unknown_fields_string(
+ mutable_unknown_fields());
+ ::google::protobuf::io::CodedOutputStream unknown_fields_stream(
+ &unknown_fields_string);
+ // @@protoc_insertion_point(parse_start:com.trustonic.tee_proxy.WaitNotificationResponse)
+ for (;;) {
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
+ tag = p.first;
+ if (!p.second) goto handle_unusual;
+ switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+ // optional bytes tci = 1;
+ case 1: {
+ if (tag == 10) {
+ DO_(::google::protobuf::internal::WireFormatLite::ReadBytes(
+ input, this->mutable_tci()));
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectTag(18)) goto parse_buffers;
+ break;
+ }
+
+ // repeated .com.trustonic.tee_proxy.WaitNotificationResponse.Buffers buffers = 2;
+ case 2: {
+ if (tag == 18) {
+ parse_buffers:
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
+ input, add_buffers()));
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectTag(18)) goto parse_buffers;
+ if (input->ExpectAtEnd()) goto success;
+ break;
+ }
+
+ default: {
+ handle_unusual:
+ if (tag == 0 ||
+ ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+ goto success;
+ }
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(
+ input, tag, &unknown_fields_stream));
+ break;
+ }
+ }
+ }
+success:
+ // @@protoc_insertion_point(parse_success:com.trustonic.tee_proxy.WaitNotificationResponse)
+ return true;
+failure:
+ // @@protoc_insertion_point(parse_failure:com.trustonic.tee_proxy.WaitNotificationResponse)
+ return false;
+#undef DO_
+}
+
+void WaitNotificationResponse::SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const {
+ // @@protoc_insertion_point(serialize_start:com.trustonic.tee_proxy.WaitNotificationResponse)
+ // optional bytes tci = 1;
+ if (has_tci()) {
+ ::google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased(
+ 1, this->tci(), output);
+ }
+
+ // repeated .com.trustonic.tee_proxy.WaitNotificationResponse.Buffers buffers = 2;
+ for (int i = 0; i < this->buffers_size(); i++) {
+ ::google::protobuf::internal::WireFormatLite::WriteMessage(
+ 2, this->buffers(i), output);
+ }
+
+ output->WriteRaw(unknown_fields().data(),
+ unknown_fields().size());
+ // @@protoc_insertion_point(serialize_end:com.trustonic.tee_proxy.WaitNotificationResponse)
+}
+
+int WaitNotificationResponse::ByteSize() const {
+ int total_size = 0;
+
+ if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ // optional bytes tci = 1;
+ if (has_tci()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::BytesSize(
+ this->tci());
+ }
+
+ }
+ // repeated .com.trustonic.tee_proxy.WaitNotificationResponse.Buffers buffers = 2;
+ total_size += 1 * this->buffers_size();
+ for (int i = 0; i < this->buffers_size(); i++) {
+ total_size +=
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
+ this->buffers(i));
+ }
+
+ total_size += unknown_fields().size();
+
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = total_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+ return total_size;
+}
+
+void WaitNotificationResponse::CheckTypeAndMergeFrom(
+ const ::google::protobuf::MessageLite& from) {
+ MergeFrom(*::google::protobuf::down_cast<const WaitNotificationResponse*>(&from));
+}
+
+void WaitNotificationResponse::MergeFrom(const WaitNotificationResponse& from) {
+ GOOGLE_CHECK_NE(&from, this);
+ buffers_.MergeFrom(from.buffers_);
+ if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ if (from.has_tci()) {
+ set_tci(from.tci());
+ }
+ }
+ mutable_unknown_fields()->append(from.unknown_fields());
+}
+
+void WaitNotificationResponse::CopyFrom(const WaitNotificationResponse& from) {
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+bool WaitNotificationResponse::IsInitialized() const {
+
+ if (!::google::protobuf::internal::AllAreInitialized(this->buffers())) return false;
+ return true;
+}
+
+void WaitNotificationResponse::Swap(WaitNotificationResponse* other) {
+ if (other != this) {
+ std::swap(tci_, other->tci_);
+ buffers_.Swap(&other->buffers_);
+ std::swap(_has_bits_[0], other->_has_bits_[0]);
+ _unknown_fields_.swap(other->_unknown_fields_);
+ std::swap(_cached_size_, other->_cached_size_);
+ }
+}
+
+::std::string WaitNotificationResponse::GetTypeName() const {
+ return "com.trustonic.tee_proxy.WaitNotificationResponse";
+}
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
+const int MapRequest_Buffers::kLenFieldNumber;
+const int MapRequest_Buffers::kFlagsFieldNumber;
+#endif // !_MSC_VER
+
+MapRequest_Buffers::MapRequest_Buffers()
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ // @@protoc_insertion_point(constructor:com.trustonic.tee_proxy.MapRequest.Buffers)
+}
+
+void MapRequest_Buffers::InitAsDefaultInstance() {
+}
+
+MapRequest_Buffers::MapRequest_Buffers(const MapRequest_Buffers& from)
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ MergeFrom(from);
+ // @@protoc_insertion_point(copy_constructor:com.trustonic.tee_proxy.MapRequest.Buffers)
+}
+
+void MapRequest_Buffers::SharedCtor() {
+ _cached_size_ = 0;
+ len_ = 0u;
+ flags_ = 0u;
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+MapRequest_Buffers::~MapRequest_Buffers() {
+ // @@protoc_insertion_point(destructor:com.trustonic.tee_proxy.MapRequest.Buffers)
+ SharedDtor();
+}
+
+void MapRequest_Buffers::SharedDtor() {
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ if (this != &default_instance()) {
+ #else
+ if (this != default_instance_) {
+ #endif
+ }
+}
+
+void MapRequest_Buffers::SetCachedSize(int size) const {
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const MapRequest_Buffers& MapRequest_Buffers::default_instance() {
+#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ protobuf_AddDesc_mc_2eproto();
+#else
+ if (default_instance_ == NULL) protobuf_AddDesc_mc_2eproto();
+#endif
+ return *default_instance_;
+}
+
+MapRequest_Buffers* MapRequest_Buffers::default_instance_ = NULL;
+
+MapRequest_Buffers* MapRequest_Buffers::New() const {
+ return new MapRequest_Buffers;
+}
+
+void MapRequest_Buffers::Clear() {
+#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
+ &reinterpret_cast<MapRequest_Buffers*>(16)->f) - \
+ reinterpret_cast<char*>(16))
+
+#define ZR_(first, last) do { \
+ size_t f = OFFSET_OF_FIELD_(first); \
+ size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
+ ::memset(&first, 0, n); \
+ } while (0)
+
+ ZR_(len_, flags_);
+
+#undef OFFSET_OF_FIELD_
+#undef ZR_
+
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+ mutable_unknown_fields()->clear();
+}
+
+bool MapRequest_Buffers::MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
+ ::google::protobuf::uint32 tag;
+ ::google::protobuf::io::StringOutputStream unknown_fields_string(
+ mutable_unknown_fields());
+ ::google::protobuf::io::CodedOutputStream unknown_fields_stream(
+ &unknown_fields_string);
+ // @@protoc_insertion_point(parse_start:com.trustonic.tee_proxy.MapRequest.Buffers)
+ for (;;) {
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
+ tag = p.first;
+ if (!p.second) goto handle_unusual;
+ switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+ // required uint32 len = 1;
+ case 1: {
+ if (tag == 8) {
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+ ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
+ input, &len_)));
+ set_has_len();
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectTag(16)) goto parse_flags;
+ break;
+ }
+
+ // required uint32 flags = 2;
+ case 2: {
+ if (tag == 16) {
+ parse_flags:
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+ ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
+ input, &flags_)));
+ set_has_flags();
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectAtEnd()) goto success;
+ break;
+ }
+
+ default: {
+ handle_unusual:
+ if (tag == 0 ||
+ ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+ goto success;
+ }
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(
+ input, tag, &unknown_fields_stream));
+ break;
+ }
+ }
+ }
+success:
+ // @@protoc_insertion_point(parse_success:com.trustonic.tee_proxy.MapRequest.Buffers)
+ return true;
+failure:
+ // @@protoc_insertion_point(parse_failure:com.trustonic.tee_proxy.MapRequest.Buffers)
+ return false;
+#undef DO_
+}
+
+void MapRequest_Buffers::SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const {
+ // @@protoc_insertion_point(serialize_start:com.trustonic.tee_proxy.MapRequest.Buffers)
+ // required uint32 len = 1;
+ if (has_len()) {
+ ::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->len(), output);
+ }
+
+ // required uint32 flags = 2;
+ if (has_flags()) {
+ ::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->flags(), output);
+ }
+
+ output->WriteRaw(unknown_fields().data(),
+ unknown_fields().size());
+ // @@protoc_insertion_point(serialize_end:com.trustonic.tee_proxy.MapRequest.Buffers)
+}
+
+int MapRequest_Buffers::ByteSize() const {
+ int total_size = 0;
+
+ if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ // required uint32 len = 1;
+ if (has_len()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::UInt32Size(
+ this->len());
+ }
+
+ // required uint32 flags = 2;
+ if (has_flags()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::UInt32Size(
+ this->flags());
+ }
+
+ }
+ total_size += unknown_fields().size();
+
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = total_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+ return total_size;
+}
+
+void MapRequest_Buffers::CheckTypeAndMergeFrom(
+ const ::google::protobuf::MessageLite& from) {
+ MergeFrom(*::google::protobuf::down_cast<const MapRequest_Buffers*>(&from));
+}
+
+void MapRequest_Buffers::MergeFrom(const MapRequest_Buffers& from) {
+ GOOGLE_CHECK_NE(&from, this);
+ if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ if (from.has_len()) {
+ set_len(from.len());
+ }
+ if (from.has_flags()) {
+ set_flags(from.flags());
+ }
+ }
+ mutable_unknown_fields()->append(from.unknown_fields());
+}
+
+void MapRequest_Buffers::CopyFrom(const MapRequest_Buffers& from) {
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+bool MapRequest_Buffers::IsInitialized() const {
+ if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false;
+
+ return true;
+}
+
+void MapRequest_Buffers::Swap(MapRequest_Buffers* other) {
+ if (other != this) {
+ std::swap(len_, other->len_);
+ std::swap(flags_, other->flags_);
+ std::swap(_has_bits_[0], other->_has_bits_[0]);
+ _unknown_fields_.swap(other->_unknown_fields_);
+ std::swap(_cached_size_, other->_cached_size_);
+ }
+}
+
+::std::string MapRequest_Buffers::GetTypeName() const {
+ return "com.trustonic.tee_proxy.MapRequest.Buffers";
+}
+
+
+// -------------------------------------------------------------------
+
+#ifndef _MSC_VER
+const int MapRequest::kSidFieldNumber;
+const int MapRequest::kBuffersFieldNumber;
+#endif // !_MSC_VER
+
+MapRequest::MapRequest()
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ // @@protoc_insertion_point(constructor:com.trustonic.tee_proxy.MapRequest)
+}
+
+void MapRequest::InitAsDefaultInstance() {
+}
+
+MapRequest::MapRequest(const MapRequest& from)
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ MergeFrom(from);
+ // @@protoc_insertion_point(copy_constructor:com.trustonic.tee_proxy.MapRequest)
+}
+
+void MapRequest::SharedCtor() {
+ _cached_size_ = 0;
+ sid_ = 0u;
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+MapRequest::~MapRequest() {
+ // @@protoc_insertion_point(destructor:com.trustonic.tee_proxy.MapRequest)
+ SharedDtor();
+}
+
+void MapRequest::SharedDtor() {
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ if (this != &default_instance()) {
+ #else
+ if (this != default_instance_) {
+ #endif
+ }
+}
+
+void MapRequest::SetCachedSize(int size) const {
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const MapRequest& MapRequest::default_instance() {
+#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ protobuf_AddDesc_mc_2eproto();
+#else
+ if (default_instance_ == NULL) protobuf_AddDesc_mc_2eproto();
+#endif
+ return *default_instance_;
+}
+
+MapRequest* MapRequest::default_instance_ = NULL;
+
+MapRequest* MapRequest::New() const {
+ return new MapRequest;
+}
+
+void MapRequest::Clear() {
+ sid_ = 0u;
+ buffers_.Clear();
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+ mutable_unknown_fields()->clear();
+}
+
+bool MapRequest::MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
+ ::google::protobuf::uint32 tag;
+ ::google::protobuf::io::StringOutputStream unknown_fields_string(
+ mutable_unknown_fields());
+ ::google::protobuf::io::CodedOutputStream unknown_fields_stream(
+ &unknown_fields_string);
+ // @@protoc_insertion_point(parse_start:com.trustonic.tee_proxy.MapRequest)
+ for (;;) {
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
+ tag = p.first;
+ if (!p.second) goto handle_unusual;
+ switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+ // required uint32 sid = 1;
+ case 1: {
+ if (tag == 8) {
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+ ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
+ input, &sid_)));
+ set_has_sid();
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectTag(18)) goto parse_buffers;
+ break;
+ }
+
+ // repeated .com.trustonic.tee_proxy.MapRequest.Buffers buffers = 2;
+ case 2: {
+ if (tag == 18) {
+ parse_buffers:
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
+ input, add_buffers()));
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectTag(18)) goto parse_buffers;
+ if (input->ExpectAtEnd()) goto success;
+ break;
+ }
+
+ default: {
+ handle_unusual:
+ if (tag == 0 ||
+ ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+ goto success;
+ }
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(
+ input, tag, &unknown_fields_stream));
+ break;
+ }
+ }
+ }
+success:
+ // @@protoc_insertion_point(parse_success:com.trustonic.tee_proxy.MapRequest)
+ return true;
+failure:
+ // @@protoc_insertion_point(parse_failure:com.trustonic.tee_proxy.MapRequest)
+ return false;
+#undef DO_
+}
+
+void MapRequest::SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const {
+ // @@protoc_insertion_point(serialize_start:com.trustonic.tee_proxy.MapRequest)
+ // required uint32 sid = 1;
+ if (has_sid()) {
+ ::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->sid(), output);
+ }
+
+ // repeated .com.trustonic.tee_proxy.MapRequest.Buffers buffers = 2;
+ for (int i = 0; i < this->buffers_size(); i++) {
+ ::google::protobuf::internal::WireFormatLite::WriteMessage(
+ 2, this->buffers(i), output);
+ }
+
+ output->WriteRaw(unknown_fields().data(),
+ unknown_fields().size());
+ // @@protoc_insertion_point(serialize_end:com.trustonic.tee_proxy.MapRequest)
+}
+
+int MapRequest::ByteSize() const {
+ int total_size = 0;
+
+ if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ // required uint32 sid = 1;
+ if (has_sid()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::UInt32Size(
+ this->sid());
+ }
+
+ }
+ // repeated .com.trustonic.tee_proxy.MapRequest.Buffers buffers = 2;
+ total_size += 1 * this->buffers_size();
+ for (int i = 0; i < this->buffers_size(); i++) {
+ total_size +=
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
+ this->buffers(i));
+ }
+
+ total_size += unknown_fields().size();
+
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = total_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+ return total_size;
+}
+
+void MapRequest::CheckTypeAndMergeFrom(
+ const ::google::protobuf::MessageLite& from) {
+ MergeFrom(*::google::protobuf::down_cast<const MapRequest*>(&from));
+}
+
+void MapRequest::MergeFrom(const MapRequest& from) {
+ GOOGLE_CHECK_NE(&from, this);
+ buffers_.MergeFrom(from.buffers_);
+ if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ if (from.has_sid()) {
+ set_sid(from.sid());
+ }
+ }
+ mutable_unknown_fields()->append(from.unknown_fields());
+}
+
+void MapRequest::CopyFrom(const MapRequest& from) {
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+bool MapRequest::IsInitialized() const {
+ if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false;
+
+ if (!::google::protobuf::internal::AllAreInitialized(this->buffers())) return false;
+ return true;
+}
+
+void MapRequest::Swap(MapRequest* other) {
+ if (other != this) {
+ std::swap(sid_, other->sid_);
+ buffers_.Swap(&other->buffers_);
+ std::swap(_has_bits_[0], other->_has_bits_[0]);
+ _unknown_fields_.swap(other->_unknown_fields_);
+ std::swap(_cached_size_, other->_cached_size_);
+ }
+}
+
+::std::string MapRequest::GetTypeName() const {
+ return "com.trustonic.tee_proxy.MapRequest";
+}
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
+const int MapResponse_Buffers::kSvaFieldNumber;
+#endif // !_MSC_VER
+
+MapResponse_Buffers::MapResponse_Buffers()
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ // @@protoc_insertion_point(constructor:com.trustonic.tee_proxy.MapResponse.Buffers)
+}
+
+void MapResponse_Buffers::InitAsDefaultInstance() {
+}
+
+MapResponse_Buffers::MapResponse_Buffers(const MapResponse_Buffers& from)
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ MergeFrom(from);
+ // @@protoc_insertion_point(copy_constructor:com.trustonic.tee_proxy.MapResponse.Buffers)
+}
+
+void MapResponse_Buffers::SharedCtor() {
+ _cached_size_ = 0;
+ sva_ = GOOGLE_ULONGLONG(0);
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+MapResponse_Buffers::~MapResponse_Buffers() {
+ // @@protoc_insertion_point(destructor:com.trustonic.tee_proxy.MapResponse.Buffers)
+ SharedDtor();
+}
+
+void MapResponse_Buffers::SharedDtor() {
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ if (this != &default_instance()) {
+ #else
+ if (this != default_instance_) {
+ #endif
+ }
+}
+
+void MapResponse_Buffers::SetCachedSize(int size) const {
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const MapResponse_Buffers& MapResponse_Buffers::default_instance() {
+#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ protobuf_AddDesc_mc_2eproto();
+#else
+ if (default_instance_ == NULL) protobuf_AddDesc_mc_2eproto();
+#endif
+ return *default_instance_;
+}
+
+MapResponse_Buffers* MapResponse_Buffers::default_instance_ = NULL;
+
+MapResponse_Buffers* MapResponse_Buffers::New() const {
+ return new MapResponse_Buffers;
+}
+
+void MapResponse_Buffers::Clear() {
+ sva_ = GOOGLE_ULONGLONG(0);
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+ mutable_unknown_fields()->clear();
+}
+
+bool MapResponse_Buffers::MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
+ ::google::protobuf::uint32 tag;
+ ::google::protobuf::io::StringOutputStream unknown_fields_string(
+ mutable_unknown_fields());
+ ::google::protobuf::io::CodedOutputStream unknown_fields_stream(
+ &unknown_fields_string);
+ // @@protoc_insertion_point(parse_start:com.trustonic.tee_proxy.MapResponse.Buffers)
+ for (;;) {
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
+ tag = p.first;
+ if (!p.second) goto handle_unusual;
+ switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+ // required uint64 sva = 1;
+ case 1: {
+ if (tag == 8) {
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+ ::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
+ input, &sva_)));
+ set_has_sva();
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectAtEnd()) goto success;
+ break;
+ }
+
+ default: {
+ handle_unusual:
+ if (tag == 0 ||
+ ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+ goto success;
+ }
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(
+ input, tag, &unknown_fields_stream));
+ break;
+ }
+ }
+ }
+success:
+ // @@protoc_insertion_point(parse_success:com.trustonic.tee_proxy.MapResponse.Buffers)
+ return true;
+failure:
+ // @@protoc_insertion_point(parse_failure:com.trustonic.tee_proxy.MapResponse.Buffers)
+ return false;
+#undef DO_
+}
+
+void MapResponse_Buffers::SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const {
+ // @@protoc_insertion_point(serialize_start:com.trustonic.tee_proxy.MapResponse.Buffers)
+ // required uint64 sva = 1;
+ if (has_sva()) {
+ ::google::protobuf::internal::WireFormatLite::WriteUInt64(1, this->sva(), output);
+ }
+
+ output->WriteRaw(unknown_fields().data(),
+ unknown_fields().size());
+ // @@protoc_insertion_point(serialize_end:com.trustonic.tee_proxy.MapResponse.Buffers)
+}
+
+int MapResponse_Buffers::ByteSize() const {
+ int total_size = 0;
+
+ if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ // required uint64 sva = 1;
+ if (has_sva()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::UInt64Size(
+ this->sva());
+ }
+
+ }
+ total_size += unknown_fields().size();
+
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = total_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+ return total_size;
+}
+
+void MapResponse_Buffers::CheckTypeAndMergeFrom(
+ const ::google::protobuf::MessageLite& from) {
+ MergeFrom(*::google::protobuf::down_cast<const MapResponse_Buffers*>(&from));
+}
+
+void MapResponse_Buffers::MergeFrom(const MapResponse_Buffers& from) {
+ GOOGLE_CHECK_NE(&from, this);
+ if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ if (from.has_sva()) {
+ set_sva(from.sva());
+ }
+ }
+ mutable_unknown_fields()->append(from.unknown_fields());
+}
+
+void MapResponse_Buffers::CopyFrom(const MapResponse_Buffers& from) {
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+bool MapResponse_Buffers::IsInitialized() const {
+ if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false;
+
+ return true;
+}
+
+void MapResponse_Buffers::Swap(MapResponse_Buffers* other) {
+ if (other != this) {
+ std::swap(sva_, other->sva_);
+ std::swap(_has_bits_[0], other->_has_bits_[0]);
+ _unknown_fields_.swap(other->_unknown_fields_);
+ std::swap(_cached_size_, other->_cached_size_);
+ }
+}
+
+::std::string MapResponse_Buffers::GetTypeName() const {
+ return "com.trustonic.tee_proxy.MapResponse.Buffers";
+}
+
+
+// -------------------------------------------------------------------
+
+#ifndef _MSC_VER
+const int MapResponse::kBuffersFieldNumber;
+#endif // !_MSC_VER
+
+MapResponse::MapResponse()
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ // @@protoc_insertion_point(constructor:com.trustonic.tee_proxy.MapResponse)
+}
+
+void MapResponse::InitAsDefaultInstance() {
+}
+
+MapResponse::MapResponse(const MapResponse& from)
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ MergeFrom(from);
+ // @@protoc_insertion_point(copy_constructor:com.trustonic.tee_proxy.MapResponse)
+}
+
+void MapResponse::SharedCtor() {
+ _cached_size_ = 0;
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+MapResponse::~MapResponse() {
+ // @@protoc_insertion_point(destructor:com.trustonic.tee_proxy.MapResponse)
+ SharedDtor();
+}
+
+void MapResponse::SharedDtor() {
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ if (this != &default_instance()) {
+ #else
+ if (this != default_instance_) {
+ #endif
+ }
+}
+
+void MapResponse::SetCachedSize(int size) const {
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const MapResponse& MapResponse::default_instance() {
+#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ protobuf_AddDesc_mc_2eproto();
+#else
+ if (default_instance_ == NULL) protobuf_AddDesc_mc_2eproto();
+#endif
+ return *default_instance_;
+}
+
+MapResponse* MapResponse::default_instance_ = NULL;
+
+MapResponse* MapResponse::New() const {
+ return new MapResponse;
+}
+
+void MapResponse::Clear() {
+ buffers_.Clear();
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+ mutable_unknown_fields()->clear();
+}
+
+bool MapResponse::MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
+ ::google::protobuf::uint32 tag;
+ ::google::protobuf::io::StringOutputStream unknown_fields_string(
+ mutable_unknown_fields());
+ ::google::protobuf::io::CodedOutputStream unknown_fields_stream(
+ &unknown_fields_string);
+ // @@protoc_insertion_point(parse_start:com.trustonic.tee_proxy.MapResponse)
+ for (;;) {
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
+ tag = p.first;
+ if (!p.second) goto handle_unusual;
+ switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+ // repeated .com.trustonic.tee_proxy.MapResponse.Buffers buffers = 1;
+ case 1: {
+ if (tag == 10) {
+ parse_buffers:
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
+ input, add_buffers()));
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectTag(10)) goto parse_buffers;
+ if (input->ExpectAtEnd()) goto success;
+ break;
+ }
+
+ default: {
+ handle_unusual:
+ if (tag == 0 ||
+ ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+ goto success;
+ }
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(
+ input, tag, &unknown_fields_stream));
+ break;
+ }
+ }
+ }
+success:
+ // @@protoc_insertion_point(parse_success:com.trustonic.tee_proxy.MapResponse)
+ return true;
+failure:
+ // @@protoc_insertion_point(parse_failure:com.trustonic.tee_proxy.MapResponse)
+ return false;
+#undef DO_
+}
+
+void MapResponse::SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const {
+ // @@protoc_insertion_point(serialize_start:com.trustonic.tee_proxy.MapResponse)
+ // repeated .com.trustonic.tee_proxy.MapResponse.Buffers buffers = 1;
+ for (int i = 0; i < this->buffers_size(); i++) {
+ ::google::protobuf::internal::WireFormatLite::WriteMessage(
+ 1, this->buffers(i), output);
+ }
+
+ output->WriteRaw(unknown_fields().data(),
+ unknown_fields().size());
+ // @@protoc_insertion_point(serialize_end:com.trustonic.tee_proxy.MapResponse)
+}
+
+int MapResponse::ByteSize() const {
+ int total_size = 0;
+
+ // repeated .com.trustonic.tee_proxy.MapResponse.Buffers buffers = 1;
+ total_size += 1 * this->buffers_size();
+ for (int i = 0; i < this->buffers_size(); i++) {
+ total_size +=
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
+ this->buffers(i));
+ }
+
+ total_size += unknown_fields().size();
+
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = total_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+ return total_size;
+}
+
+void MapResponse::CheckTypeAndMergeFrom(
+ const ::google::protobuf::MessageLite& from) {
+ MergeFrom(*::google::protobuf::down_cast<const MapResponse*>(&from));
+}
+
+void MapResponse::MergeFrom(const MapResponse& from) {
+ GOOGLE_CHECK_NE(&from, this);
+ buffers_.MergeFrom(from.buffers_);
+ mutable_unknown_fields()->append(from.unknown_fields());
+}
+
+void MapResponse::CopyFrom(const MapResponse& from) {
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+bool MapResponse::IsInitialized() const {
+
+ if (!::google::protobuf::internal::AllAreInitialized(this->buffers())) return false;
+ return true;
+}
+
+void MapResponse::Swap(MapResponse* other) {
+ if (other != this) {
+ buffers_.Swap(&other->buffers_);
+ std::swap(_has_bits_[0], other->_has_bits_[0]);
+ _unknown_fields_.swap(other->_unknown_fields_);
+ std::swap(_cached_size_, other->_cached_size_);
+ }
+}
+
+::std::string MapResponse::GetTypeName() const {
+ return "com.trustonic.tee_proxy.MapResponse";
+}
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
+const int UnmapRequest_Buffers::kSvaFieldNumber;
+#endif // !_MSC_VER
+
+UnmapRequest_Buffers::UnmapRequest_Buffers()
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ // @@protoc_insertion_point(constructor:com.trustonic.tee_proxy.UnmapRequest.Buffers)
+}
+
+void UnmapRequest_Buffers::InitAsDefaultInstance() {
+}
+
+UnmapRequest_Buffers::UnmapRequest_Buffers(const UnmapRequest_Buffers& from)
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ MergeFrom(from);
+ // @@protoc_insertion_point(copy_constructor:com.trustonic.tee_proxy.UnmapRequest.Buffers)
+}
+
+void UnmapRequest_Buffers::SharedCtor() {
+ _cached_size_ = 0;
+ sva_ = GOOGLE_ULONGLONG(0);
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+UnmapRequest_Buffers::~UnmapRequest_Buffers() {
+ // @@protoc_insertion_point(destructor:com.trustonic.tee_proxy.UnmapRequest.Buffers)
+ SharedDtor();
+}
+
+void UnmapRequest_Buffers::SharedDtor() {
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ if (this != &default_instance()) {
+ #else
+ if (this != default_instance_) {
+ #endif
+ }
+}
+
+void UnmapRequest_Buffers::SetCachedSize(int size) const {
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const UnmapRequest_Buffers& UnmapRequest_Buffers::default_instance() {
+#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ protobuf_AddDesc_mc_2eproto();
+#else
+ if (default_instance_ == NULL) protobuf_AddDesc_mc_2eproto();
+#endif
+ return *default_instance_;
+}
+
+UnmapRequest_Buffers* UnmapRequest_Buffers::default_instance_ = NULL;
+
+UnmapRequest_Buffers* UnmapRequest_Buffers::New() const {
+ return new UnmapRequest_Buffers;
+}
+
+void UnmapRequest_Buffers::Clear() {
+ sva_ = GOOGLE_ULONGLONG(0);
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+ mutable_unknown_fields()->clear();
+}
+
+bool UnmapRequest_Buffers::MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
+ ::google::protobuf::uint32 tag;
+ ::google::protobuf::io::StringOutputStream unknown_fields_string(
+ mutable_unknown_fields());
+ ::google::protobuf::io::CodedOutputStream unknown_fields_stream(
+ &unknown_fields_string);
+ // @@protoc_insertion_point(parse_start:com.trustonic.tee_proxy.UnmapRequest.Buffers)
+ for (;;) {
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
+ tag = p.first;
+ if (!p.second) goto handle_unusual;
+ switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+ // required uint64 sva = 1;
+ case 1: {
+ if (tag == 8) {
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+ ::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
+ input, &sva_)));
+ set_has_sva();
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectAtEnd()) goto success;
+ break;
+ }
+
+ default: {
+ handle_unusual:
+ if (tag == 0 ||
+ ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+ goto success;
+ }
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(
+ input, tag, &unknown_fields_stream));
+ break;
+ }
+ }
+ }
+success:
+ // @@protoc_insertion_point(parse_success:com.trustonic.tee_proxy.UnmapRequest.Buffers)
+ return true;
+failure:
+ // @@protoc_insertion_point(parse_failure:com.trustonic.tee_proxy.UnmapRequest.Buffers)
+ return false;
+#undef DO_
+}
+
+void UnmapRequest_Buffers::SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const {
+ // @@protoc_insertion_point(serialize_start:com.trustonic.tee_proxy.UnmapRequest.Buffers)
+ // required uint64 sva = 1;
+ if (has_sva()) {
+ ::google::protobuf::internal::WireFormatLite::WriteUInt64(1, this->sva(), output);
+ }
+
+ output->WriteRaw(unknown_fields().data(),
+ unknown_fields().size());
+ // @@protoc_insertion_point(serialize_end:com.trustonic.tee_proxy.UnmapRequest.Buffers)
+}
+
+int UnmapRequest_Buffers::ByteSize() const {
+ int total_size = 0;
+
+ if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ // required uint64 sva = 1;
+ if (has_sva()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::UInt64Size(
+ this->sva());
+ }
+
+ }
+ total_size += unknown_fields().size();
+
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = total_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+ return total_size;
+}
+
+void UnmapRequest_Buffers::CheckTypeAndMergeFrom(
+ const ::google::protobuf::MessageLite& from) {
+ MergeFrom(*::google::protobuf::down_cast<const UnmapRequest_Buffers*>(&from));
+}
+
+void UnmapRequest_Buffers::MergeFrom(const UnmapRequest_Buffers& from) {
+ GOOGLE_CHECK_NE(&from, this);
+ if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ if (from.has_sva()) {
+ set_sva(from.sva());
+ }
+ }
+ mutable_unknown_fields()->append(from.unknown_fields());
+}
+
+void UnmapRequest_Buffers::CopyFrom(const UnmapRequest_Buffers& from) {
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+bool UnmapRequest_Buffers::IsInitialized() const {
+ if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false;
+
+ return true;
+}
+
+void UnmapRequest_Buffers::Swap(UnmapRequest_Buffers* other) {
+ if (other != this) {
+ std::swap(sva_, other->sva_);
+ std::swap(_has_bits_[0], other->_has_bits_[0]);
+ _unknown_fields_.swap(other->_unknown_fields_);
+ std::swap(_cached_size_, other->_cached_size_);
+ }
+}
+
+::std::string UnmapRequest_Buffers::GetTypeName() const {
+ return "com.trustonic.tee_proxy.UnmapRequest.Buffers";
+}
+
+
+// -------------------------------------------------------------------
+
+#ifndef _MSC_VER
+const int UnmapRequest::kSidFieldNumber;
+const int UnmapRequest::kBuffersFieldNumber;
+#endif // !_MSC_VER
+
+UnmapRequest::UnmapRequest()
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ // @@protoc_insertion_point(constructor:com.trustonic.tee_proxy.UnmapRequest)
+}
+
+void UnmapRequest::InitAsDefaultInstance() {
+}
+
+UnmapRequest::UnmapRequest(const UnmapRequest& from)
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ MergeFrom(from);
+ // @@protoc_insertion_point(copy_constructor:com.trustonic.tee_proxy.UnmapRequest)
+}
+
+void UnmapRequest::SharedCtor() {
+ _cached_size_ = 0;
+ sid_ = 0u;
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+UnmapRequest::~UnmapRequest() {
+ // @@protoc_insertion_point(destructor:com.trustonic.tee_proxy.UnmapRequest)
+ SharedDtor();
+}
+
+void UnmapRequest::SharedDtor() {
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ if (this != &default_instance()) {
+ #else
+ if (this != default_instance_) {
+ #endif
+ }
+}
+
+void UnmapRequest::SetCachedSize(int size) const {
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const UnmapRequest& UnmapRequest::default_instance() {
+#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ protobuf_AddDesc_mc_2eproto();
+#else
+ if (default_instance_ == NULL) protobuf_AddDesc_mc_2eproto();
+#endif
+ return *default_instance_;
+}
+
+UnmapRequest* UnmapRequest::default_instance_ = NULL;
+
+UnmapRequest* UnmapRequest::New() const {
+ return new UnmapRequest;
+}
+
+void UnmapRequest::Clear() {
+ sid_ = 0u;
+ buffers_.Clear();
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+ mutable_unknown_fields()->clear();
+}
+
+bool UnmapRequest::MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
+ ::google::protobuf::uint32 tag;
+ ::google::protobuf::io::StringOutputStream unknown_fields_string(
+ mutable_unknown_fields());
+ ::google::protobuf::io::CodedOutputStream unknown_fields_stream(
+ &unknown_fields_string);
+ // @@protoc_insertion_point(parse_start:com.trustonic.tee_proxy.UnmapRequest)
+ for (;;) {
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
+ tag = p.first;
+ if (!p.second) goto handle_unusual;
+ switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+ // required uint32 sid = 1;
+ case 1: {
+ if (tag == 8) {
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+ ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
+ input, &sid_)));
+ set_has_sid();
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectTag(18)) goto parse_buffers;
+ break;
+ }
+
+ // repeated .com.trustonic.tee_proxy.UnmapRequest.Buffers buffers = 2;
+ case 2: {
+ if (tag == 18) {
+ parse_buffers:
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
+ input, add_buffers()));
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectTag(18)) goto parse_buffers;
+ if (input->ExpectAtEnd()) goto success;
+ break;
+ }
+
+ default: {
+ handle_unusual:
+ if (tag == 0 ||
+ ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+ goto success;
+ }
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(
+ input, tag, &unknown_fields_stream));
+ break;
+ }
+ }
+ }
+success:
+ // @@protoc_insertion_point(parse_success:com.trustonic.tee_proxy.UnmapRequest)
+ return true;
+failure:
+ // @@protoc_insertion_point(parse_failure:com.trustonic.tee_proxy.UnmapRequest)
+ return false;
+#undef DO_
+}
+
+void UnmapRequest::SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const {
+ // @@protoc_insertion_point(serialize_start:com.trustonic.tee_proxy.UnmapRequest)
+ // required uint32 sid = 1;
+ if (has_sid()) {
+ ::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->sid(), output);
+ }
+
+ // repeated .com.trustonic.tee_proxy.UnmapRequest.Buffers buffers = 2;
+ for (int i = 0; i < this->buffers_size(); i++) {
+ ::google::protobuf::internal::WireFormatLite::WriteMessage(
+ 2, this->buffers(i), output);
+ }
+
+ output->WriteRaw(unknown_fields().data(),
+ unknown_fields().size());
+ // @@protoc_insertion_point(serialize_end:com.trustonic.tee_proxy.UnmapRequest)
+}
+
+int UnmapRequest::ByteSize() const {
+ int total_size = 0;
+
+ if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ // required uint32 sid = 1;
+ if (has_sid()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::UInt32Size(
+ this->sid());
+ }
+
+ }
+ // repeated .com.trustonic.tee_proxy.UnmapRequest.Buffers buffers = 2;
+ total_size += 1 * this->buffers_size();
+ for (int i = 0; i < this->buffers_size(); i++) {
+ total_size +=
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
+ this->buffers(i));
+ }
+
+ total_size += unknown_fields().size();
+
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = total_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+ return total_size;
+}
+
+void UnmapRequest::CheckTypeAndMergeFrom(
+ const ::google::protobuf::MessageLite& from) {
+ MergeFrom(*::google::protobuf::down_cast<const UnmapRequest*>(&from));
+}
+
+void UnmapRequest::MergeFrom(const UnmapRequest& from) {
+ GOOGLE_CHECK_NE(&from, this);
+ buffers_.MergeFrom(from.buffers_);
+ if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ if (from.has_sid()) {
+ set_sid(from.sid());
+ }
+ }
+ mutable_unknown_fields()->append(from.unknown_fields());
+}
+
+void UnmapRequest::CopyFrom(const UnmapRequest& from) {
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+bool UnmapRequest::IsInitialized() const {
+ if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false;
+
+ if (!::google::protobuf::internal::AllAreInitialized(this->buffers())) return false;
+ return true;
+}
+
+void UnmapRequest::Swap(UnmapRequest* other) {
+ if (other != this) {
+ std::swap(sid_, other->sid_);
+ buffers_.Swap(&other->buffers_);
+ std::swap(_has_bits_[0], other->_has_bits_[0]);
+ _unknown_fields_.swap(other->_unknown_fields_);
+ std::swap(_cached_size_, other->_cached_size_);
+ }
+}
+
+::std::string UnmapRequest::GetTypeName() const {
+ return "com.trustonic.tee_proxy.UnmapRequest";
+}
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
+#endif // !_MSC_VER
+
+UnmapResponse::UnmapResponse()
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ // @@protoc_insertion_point(constructor:com.trustonic.tee_proxy.UnmapResponse)
+}
+
+void UnmapResponse::InitAsDefaultInstance() {
+}
+
+UnmapResponse::UnmapResponse(const UnmapResponse& from)
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ MergeFrom(from);
+ // @@protoc_insertion_point(copy_constructor:com.trustonic.tee_proxy.UnmapResponse)
+}
+
+void UnmapResponse::SharedCtor() {
+ _cached_size_ = 0;
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+UnmapResponse::~UnmapResponse() {
+ // @@protoc_insertion_point(destructor:com.trustonic.tee_proxy.UnmapResponse)
+ SharedDtor();
+}
+
+void UnmapResponse::SharedDtor() {
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ if (this != &default_instance()) {
+ #else
+ if (this != default_instance_) {
+ #endif
+ }
+}
+
+void UnmapResponse::SetCachedSize(int size) const {
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const UnmapResponse& UnmapResponse::default_instance() {
+#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ protobuf_AddDesc_mc_2eproto();
+#else
+ if (default_instance_ == NULL) protobuf_AddDesc_mc_2eproto();
+#endif
+ return *default_instance_;
+}
+
+UnmapResponse* UnmapResponse::default_instance_ = NULL;
+
+UnmapResponse* UnmapResponse::New() const {
+ return new UnmapResponse;
+}
+
+void UnmapResponse::Clear() {
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+ mutable_unknown_fields()->clear();
+}
+
+bool UnmapResponse::MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
+ ::google::protobuf::uint32 tag;
+ ::google::protobuf::io::StringOutputStream unknown_fields_string(
+ mutable_unknown_fields());
+ ::google::protobuf::io::CodedOutputStream unknown_fields_stream(
+ &unknown_fields_string);
+ // @@protoc_insertion_point(parse_start:com.trustonic.tee_proxy.UnmapResponse)
+ for (;;) {
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
+ tag = p.first;
+ if (!p.second) goto handle_unusual;
+ handle_unusual:
+ if (tag == 0 ||
+ ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+ goto success;
+ }
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(
+ input, tag, &unknown_fields_stream));
+ }
+success:
+ // @@protoc_insertion_point(parse_success:com.trustonic.tee_proxy.UnmapResponse)
+ return true;
+failure:
+ // @@protoc_insertion_point(parse_failure:com.trustonic.tee_proxy.UnmapResponse)
+ return false;
+#undef DO_
+}
+
+void UnmapResponse::SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const {
+ // @@protoc_insertion_point(serialize_start:com.trustonic.tee_proxy.UnmapResponse)
+ output->WriteRaw(unknown_fields().data(),
+ unknown_fields().size());
+ // @@protoc_insertion_point(serialize_end:com.trustonic.tee_proxy.UnmapResponse)
+}
+
+int UnmapResponse::ByteSize() const {
+ int total_size = 0;
+
+ total_size += unknown_fields().size();
+
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = total_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+ return total_size;
+}
+
+void UnmapResponse::CheckTypeAndMergeFrom(
+ const ::google::protobuf::MessageLite& from) {
+ MergeFrom(*::google::protobuf::down_cast<const UnmapResponse*>(&from));
+}
+
+void UnmapResponse::MergeFrom(const UnmapResponse& from) {
+ GOOGLE_CHECK_NE(&from, this);
+ mutable_unknown_fields()->append(from.unknown_fields());
+}
+
+void UnmapResponse::CopyFrom(const UnmapResponse& from) {
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+bool UnmapResponse::IsInitialized() const {
+
+ return true;
+}
+
+void UnmapResponse::Swap(UnmapResponse* other) {
+ if (other != this) {
+ _unknown_fields_.swap(other->_unknown_fields_);
+ std::swap(_cached_size_, other->_cached_size_);
+ }
+}
+
+::std::string UnmapResponse::GetTypeName() const {
+ return "com.trustonic.tee_proxy.UnmapResponse";
+}
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
+const int GetErrorRequest::kSidFieldNumber;
+#endif // !_MSC_VER
+
+GetErrorRequest::GetErrorRequest()
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ // @@protoc_insertion_point(constructor:com.trustonic.tee_proxy.GetErrorRequest)
+}
+
+void GetErrorRequest::InitAsDefaultInstance() {
+}
+
+GetErrorRequest::GetErrorRequest(const GetErrorRequest& from)
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ MergeFrom(from);
+ // @@protoc_insertion_point(copy_constructor:com.trustonic.tee_proxy.GetErrorRequest)
+}
+
+void GetErrorRequest::SharedCtor() {
+ _cached_size_ = 0;
+ sid_ = 0u;
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+GetErrorRequest::~GetErrorRequest() {
+ // @@protoc_insertion_point(destructor:com.trustonic.tee_proxy.GetErrorRequest)
+ SharedDtor();
+}
+
+void GetErrorRequest::SharedDtor() {
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ if (this != &default_instance()) {
+ #else
+ if (this != default_instance_) {
+ #endif
+ }
+}
+
+void GetErrorRequest::SetCachedSize(int size) const {
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const GetErrorRequest& GetErrorRequest::default_instance() {
+#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ protobuf_AddDesc_mc_2eproto();
+#else
+ if (default_instance_ == NULL) protobuf_AddDesc_mc_2eproto();
+#endif
+ return *default_instance_;
+}
+
+GetErrorRequest* GetErrorRequest::default_instance_ = NULL;
+
+GetErrorRequest* GetErrorRequest::New() const {
+ return new GetErrorRequest;
+}
+
+void GetErrorRequest::Clear() {
+ sid_ = 0u;
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+ mutable_unknown_fields()->clear();
+}
+
+bool GetErrorRequest::MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
+ ::google::protobuf::uint32 tag;
+ ::google::protobuf::io::StringOutputStream unknown_fields_string(
+ mutable_unknown_fields());
+ ::google::protobuf::io::CodedOutputStream unknown_fields_stream(
+ &unknown_fields_string);
+ // @@protoc_insertion_point(parse_start:com.trustonic.tee_proxy.GetErrorRequest)
+ for (;;) {
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
+ tag = p.first;
+ if (!p.second) goto handle_unusual;
+ switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+ // required uint32 sid = 1;
+ case 1: {
+ if (tag == 8) {
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+ ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
+ input, &sid_)));
+ set_has_sid();
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectAtEnd()) goto success;
+ break;
+ }
+
+ default: {
+ handle_unusual:
+ if (tag == 0 ||
+ ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+ goto success;
+ }
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(
+ input, tag, &unknown_fields_stream));
+ break;
+ }
+ }
+ }
+success:
+ // @@protoc_insertion_point(parse_success:com.trustonic.tee_proxy.GetErrorRequest)
+ return true;
+failure:
+ // @@protoc_insertion_point(parse_failure:com.trustonic.tee_proxy.GetErrorRequest)
+ return false;
+#undef DO_
+}
+
+void GetErrorRequest::SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const {
+ // @@protoc_insertion_point(serialize_start:com.trustonic.tee_proxy.GetErrorRequest)
+ // required uint32 sid = 1;
+ if (has_sid()) {
+ ::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->sid(), output);
+ }
+
+ output->WriteRaw(unknown_fields().data(),
+ unknown_fields().size());
+ // @@protoc_insertion_point(serialize_end:com.trustonic.tee_proxy.GetErrorRequest)
+}
+
+int GetErrorRequest::ByteSize() const {
+ int total_size = 0;
+
+ if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ // required uint32 sid = 1;
+ if (has_sid()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::UInt32Size(
+ this->sid());
+ }
+
+ }
+ total_size += unknown_fields().size();
+
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = total_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+ return total_size;
+}
+
+void GetErrorRequest::CheckTypeAndMergeFrom(
+ const ::google::protobuf::MessageLite& from) {
+ MergeFrom(*::google::protobuf::down_cast<const GetErrorRequest*>(&from));
+}
+
+void GetErrorRequest::MergeFrom(const GetErrorRequest& from) {
+ GOOGLE_CHECK_NE(&from, this);
+ if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ if (from.has_sid()) {
+ set_sid(from.sid());
+ }
+ }
+ mutable_unknown_fields()->append(from.unknown_fields());
+}
+
+void GetErrorRequest::CopyFrom(const GetErrorRequest& from) {
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+bool GetErrorRequest::IsInitialized() const {
+ if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false;
+
+ return true;
+}
+
+void GetErrorRequest::Swap(GetErrorRequest* other) {
+ if (other != this) {
+ std::swap(sid_, other->sid_);
+ std::swap(_has_bits_[0], other->_has_bits_[0]);
+ _unknown_fields_.swap(other->_unknown_fields_);
+ std::swap(_cached_size_, other->_cached_size_);
+ }
+}
+
+::std::string GetErrorRequest::GetTypeName() const {
+ return "com.trustonic.tee_proxy.GetErrorRequest";
+}
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
+const int GetErrorResponse::kExitCodeFieldNumber;
+#endif // !_MSC_VER
+
+GetErrorResponse::GetErrorResponse()
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ // @@protoc_insertion_point(constructor:com.trustonic.tee_proxy.GetErrorResponse)
+}
+
+void GetErrorResponse::InitAsDefaultInstance() {
+}
+
+GetErrorResponse::GetErrorResponse(const GetErrorResponse& from)
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ MergeFrom(from);
+ // @@protoc_insertion_point(copy_constructor:com.trustonic.tee_proxy.GetErrorResponse)
+}
+
+void GetErrorResponse::SharedCtor() {
+ _cached_size_ = 0;
+ exit_code_ = 0;
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+GetErrorResponse::~GetErrorResponse() {
+ // @@protoc_insertion_point(destructor:com.trustonic.tee_proxy.GetErrorResponse)
+ SharedDtor();
+}
+
+void GetErrorResponse::SharedDtor() {
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ if (this != &default_instance()) {
+ #else
+ if (this != default_instance_) {
+ #endif
+ }
+}
+
+void GetErrorResponse::SetCachedSize(int size) const {
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const GetErrorResponse& GetErrorResponse::default_instance() {
+#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ protobuf_AddDesc_mc_2eproto();
+#else
+ if (default_instance_ == NULL) protobuf_AddDesc_mc_2eproto();
+#endif
+ return *default_instance_;
+}
+
+GetErrorResponse* GetErrorResponse::default_instance_ = NULL;
+
+GetErrorResponse* GetErrorResponse::New() const {
+ return new GetErrorResponse;
+}
+
+void GetErrorResponse::Clear() {
+ exit_code_ = 0;
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+ mutable_unknown_fields()->clear();
+}
+
+bool GetErrorResponse::MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
+ ::google::protobuf::uint32 tag;
+ ::google::protobuf::io::StringOutputStream unknown_fields_string(
+ mutable_unknown_fields());
+ ::google::protobuf::io::CodedOutputStream unknown_fields_stream(
+ &unknown_fields_string);
+ // @@protoc_insertion_point(parse_start:com.trustonic.tee_proxy.GetErrorResponse)
+ for (;;) {
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
+ tag = p.first;
+ if (!p.second) goto handle_unusual;
+ switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+ // required sint32 exit_code = 1;
+ case 1: {
+ if (tag == 8) {
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+ ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_SINT32>(
+ input, &exit_code_)));
+ set_has_exit_code();
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectAtEnd()) goto success;
+ break;
+ }
+
+ default: {
+ handle_unusual:
+ if (tag == 0 ||
+ ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+ goto success;
+ }
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(
+ input, tag, &unknown_fields_stream));
+ break;
+ }
+ }
+ }
+success:
+ // @@protoc_insertion_point(parse_success:com.trustonic.tee_proxy.GetErrorResponse)
+ return true;
+failure:
+ // @@protoc_insertion_point(parse_failure:com.trustonic.tee_proxy.GetErrorResponse)
+ return false;
+#undef DO_
+}
+
+void GetErrorResponse::SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const {
+ // @@protoc_insertion_point(serialize_start:com.trustonic.tee_proxy.GetErrorResponse)
+ // required sint32 exit_code = 1;
+ if (has_exit_code()) {
+ ::google::protobuf::internal::WireFormatLite::WriteSInt32(1, this->exit_code(), output);
+ }
+
+ output->WriteRaw(unknown_fields().data(),
+ unknown_fields().size());
+ // @@protoc_insertion_point(serialize_end:com.trustonic.tee_proxy.GetErrorResponse)
+}
+
+int GetErrorResponse::ByteSize() const {
+ int total_size = 0;
+
+ if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ // required sint32 exit_code = 1;
+ if (has_exit_code()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::SInt32Size(
+ this->exit_code());
+ }
+
+ }
+ total_size += unknown_fields().size();
+
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = total_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+ return total_size;
+}
+
+void GetErrorResponse::CheckTypeAndMergeFrom(
+ const ::google::protobuf::MessageLite& from) {
+ MergeFrom(*::google::protobuf::down_cast<const GetErrorResponse*>(&from));
+}
+
+void GetErrorResponse::MergeFrom(const GetErrorResponse& from) {
+ GOOGLE_CHECK_NE(&from, this);
+ if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ if (from.has_exit_code()) {
+ set_exit_code(from.exit_code());
+ }
+ }
+ mutable_unknown_fields()->append(from.unknown_fields());
+}
+
+void GetErrorResponse::CopyFrom(const GetErrorResponse& from) {
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+bool GetErrorResponse::IsInitialized() const {
+ if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false;
+
+ return true;
+}
+
+void GetErrorResponse::Swap(GetErrorResponse* other) {
+ if (other != this) {
+ std::swap(exit_code_, other->exit_code_);
+ std::swap(_has_bits_[0], other->_has_bits_[0]);
+ _unknown_fields_.swap(other->_unknown_fields_);
+ std::swap(_cached_size_, other->_cached_size_);
+ }
+}
+
+::std::string GetErrorResponse::GetTypeName() const {
+ return "com.trustonic.tee_proxy.GetErrorResponse";
+}
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
+#endif // !_MSC_VER
+
+GetVersionRequest::GetVersionRequest()
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ // @@protoc_insertion_point(constructor:com.trustonic.tee_proxy.GetVersionRequest)
+}
+
+void GetVersionRequest::InitAsDefaultInstance() {
+}
+
+GetVersionRequest::GetVersionRequest(const GetVersionRequest& from)
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ MergeFrom(from);
+ // @@protoc_insertion_point(copy_constructor:com.trustonic.tee_proxy.GetVersionRequest)
+}
+
+void GetVersionRequest::SharedCtor() {
+ _cached_size_ = 0;
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+GetVersionRequest::~GetVersionRequest() {
+ // @@protoc_insertion_point(destructor:com.trustonic.tee_proxy.GetVersionRequest)
+ SharedDtor();
+}
+
+void GetVersionRequest::SharedDtor() {
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ if (this != &default_instance()) {
+ #else
+ if (this != default_instance_) {
+ #endif
+ }
+}
+
+void GetVersionRequest::SetCachedSize(int size) const {
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const GetVersionRequest& GetVersionRequest::default_instance() {
+#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ protobuf_AddDesc_mc_2eproto();
+#else
+ if (default_instance_ == NULL) protobuf_AddDesc_mc_2eproto();
+#endif
+ return *default_instance_;
+}
+
+GetVersionRequest* GetVersionRequest::default_instance_ = NULL;
+
+GetVersionRequest* GetVersionRequest::New() const {
+ return new GetVersionRequest;
+}
+
+void GetVersionRequest::Clear() {
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+ mutable_unknown_fields()->clear();
+}
+
+bool GetVersionRequest::MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
+ ::google::protobuf::uint32 tag;
+ ::google::protobuf::io::StringOutputStream unknown_fields_string(
+ mutable_unknown_fields());
+ ::google::protobuf::io::CodedOutputStream unknown_fields_stream(
+ &unknown_fields_string);
+ // @@protoc_insertion_point(parse_start:com.trustonic.tee_proxy.GetVersionRequest)
+ for (;;) {
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
+ tag = p.first;
+ if (!p.second) goto handle_unusual;
+ handle_unusual:
+ if (tag == 0 ||
+ ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+ goto success;
+ }
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(
+ input, tag, &unknown_fields_stream));
+ }
+success:
+ // @@protoc_insertion_point(parse_success:com.trustonic.tee_proxy.GetVersionRequest)
+ return true;
+failure:
+ // @@protoc_insertion_point(parse_failure:com.trustonic.tee_proxy.GetVersionRequest)
+ return false;
+#undef DO_
+}
+
+void GetVersionRequest::SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const {
+ // @@protoc_insertion_point(serialize_start:com.trustonic.tee_proxy.GetVersionRequest)
+ output->WriteRaw(unknown_fields().data(),
+ unknown_fields().size());
+ // @@protoc_insertion_point(serialize_end:com.trustonic.tee_proxy.GetVersionRequest)
+}
+
+int GetVersionRequest::ByteSize() const {
+ int total_size = 0;
+
+ total_size += unknown_fields().size();
+
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = total_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+ return total_size;
+}
+
+void GetVersionRequest::CheckTypeAndMergeFrom(
+ const ::google::protobuf::MessageLite& from) {
+ MergeFrom(*::google::protobuf::down_cast<const GetVersionRequest*>(&from));
+}
+
+void GetVersionRequest::MergeFrom(const GetVersionRequest& from) {
+ GOOGLE_CHECK_NE(&from, this);
+ mutable_unknown_fields()->append(from.unknown_fields());
+}
+
+void GetVersionRequest::CopyFrom(const GetVersionRequest& from) {
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+bool GetVersionRequest::IsInitialized() const {
+
+ return true;
+}
+
+void GetVersionRequest::Swap(GetVersionRequest* other) {
+ if (other != this) {
+ _unknown_fields_.swap(other->_unknown_fields_);
+ std::swap(_cached_size_, other->_cached_size_);
+ }
+}
+
+::std::string GetVersionRequest::GetTypeName() const {
+ return "com.trustonic.tee_proxy.GetVersionRequest";
+}
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
+const int GetVersionResponse::kProductIdFieldNumber;
+const int GetVersionResponse::kMciFieldNumber;
+const int GetVersionResponse::kSoFieldNumber;
+const int GetVersionResponse::kMclfFieldNumber;
+const int GetVersionResponse::kContainerFieldNumber;
+const int GetVersionResponse::kMcConfigFieldNumber;
+const int GetVersionResponse::kTlApiFieldNumber;
+const int GetVersionResponse::kDrApiFieldNumber;
+const int GetVersionResponse::kNwdFieldNumber;
+#endif // !_MSC_VER
+
+GetVersionResponse::GetVersionResponse()
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ // @@protoc_insertion_point(constructor:com.trustonic.tee_proxy.GetVersionResponse)
+}
+
+void GetVersionResponse::InitAsDefaultInstance() {
+}
+
+GetVersionResponse::GetVersionResponse(const GetVersionResponse& from)
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ MergeFrom(from);
+ // @@protoc_insertion_point(copy_constructor:com.trustonic.tee_proxy.GetVersionResponse)
+}
+
+void GetVersionResponse::SharedCtor() {
+ ::google::protobuf::internal::GetEmptyString();
+ _cached_size_ = 0;
+ product_id_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ mci_ = 0u;
+ so_ = 0u;
+ mclf_ = 0u;
+ container_ = 0u;
+ mc_config_ = 0u;
+ tl_api_ = 0u;
+ dr_api_ = 0u;
+ nwd_ = 0u;
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+GetVersionResponse::~GetVersionResponse() {
+ // @@protoc_insertion_point(destructor:com.trustonic.tee_proxy.GetVersionResponse)
+ SharedDtor();
+}
+
+void GetVersionResponse::SharedDtor() {
+ if (product_id_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ delete product_id_;
+ }
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ if (this != &default_instance()) {
+ #else
+ if (this != default_instance_) {
+ #endif
+ }
+}
+
+void GetVersionResponse::SetCachedSize(int size) const {
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const GetVersionResponse& GetVersionResponse::default_instance() {
+#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ protobuf_AddDesc_mc_2eproto();
+#else
+ if (default_instance_ == NULL) protobuf_AddDesc_mc_2eproto();
+#endif
+ return *default_instance_;
+}
+
+GetVersionResponse* GetVersionResponse::default_instance_ = NULL;
+
+GetVersionResponse* GetVersionResponse::New() const {
+ return new GetVersionResponse;
+}
+
+void GetVersionResponse::Clear() {
+#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
+ &reinterpret_cast<GetVersionResponse*>(16)->f) - \
+ reinterpret_cast<char*>(16))
+
+#define ZR_(first, last) do { \
+ size_t f = OFFSET_OF_FIELD_(first); \
+ size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
+ ::memset(&first, 0, n); \
+ } while (0)
+
+ if (_has_bits_[0 / 32] & 255) {
+ ZR_(mci_, dr_api_);
+ if (has_product_id()) {
+ if (product_id_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ product_id_->clear();
+ }
+ }
+ }
+ nwd_ = 0u;
+
+#undef OFFSET_OF_FIELD_
+#undef ZR_
+
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+ mutable_unknown_fields()->clear();
+}
+
+bool GetVersionResponse::MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
+ ::google::protobuf::uint32 tag;
+ ::google::protobuf::io::StringOutputStream unknown_fields_string(
+ mutable_unknown_fields());
+ ::google::protobuf::io::CodedOutputStream unknown_fields_stream(
+ &unknown_fields_string);
+ // @@protoc_insertion_point(parse_start:com.trustonic.tee_proxy.GetVersionResponse)
+ for (;;) {
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
+ tag = p.first;
+ if (!p.second) goto handle_unusual;
+ switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+ // required string product_id = 1;
+ case 1: {
+ if (tag == 10) {
+ DO_(::google::protobuf::internal::WireFormatLite::ReadString(
+ input, this->mutable_product_id()));
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectTag(16)) goto parse_mci;
+ break;
+ }
+
+ // required uint32 mci = 2;
+ case 2: {
+ if (tag == 16) {
+ parse_mci:
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+ ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
+ input, &mci_)));
+ set_has_mci();
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectTag(24)) goto parse_so;
+ break;
+ }
+
+ // required uint32 so = 3;
+ case 3: {
+ if (tag == 24) {
+ parse_so:
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+ ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
+ input, &so_)));
+ set_has_so();
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectTag(32)) goto parse_mclf;
+ break;
+ }
+
+ // required uint32 mclf = 4;
+ case 4: {
+ if (tag == 32) {
+ parse_mclf:
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+ ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
+ input, &mclf_)));
+ set_has_mclf();
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectTag(40)) goto parse_container;
+ break;
+ }
+
+ // required uint32 container = 5;
+ case 5: {
+ if (tag == 40) {
+ parse_container:
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+ ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
+ input, &container_)));
+ set_has_container();
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectTag(48)) goto parse_mc_config;
+ break;
+ }
+
+ // required uint32 mc_config = 6;
+ case 6: {
+ if (tag == 48) {
+ parse_mc_config:
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+ ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
+ input, &mc_config_)));
+ set_has_mc_config();
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectTag(56)) goto parse_tl_api;
+ break;
+ }
+
+ // required uint32 tl_api = 7;
+ case 7: {
+ if (tag == 56) {
+ parse_tl_api:
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+ ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
+ input, &tl_api_)));
+ set_has_tl_api();
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectTag(64)) goto parse_dr_api;
+ break;
+ }
+
+ // required uint32 dr_api = 8;
+ case 8: {
+ if (tag == 64) {
+ parse_dr_api:
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+ ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
+ input, &dr_api_)));
+ set_has_dr_api();
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectTag(72)) goto parse_nwd;
+ break;
+ }
+
+ // required uint32 nwd = 9;
+ case 9: {
+ if (tag == 72) {
+ parse_nwd:
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+ ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
+ input, &nwd_)));
+ set_has_nwd();
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectAtEnd()) goto success;
+ break;
+ }
+
+ default: {
+ handle_unusual:
+ if (tag == 0 ||
+ ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+ goto success;
+ }
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(
+ input, tag, &unknown_fields_stream));
+ break;
+ }
+ }
+ }
+success:
+ // @@protoc_insertion_point(parse_success:com.trustonic.tee_proxy.GetVersionResponse)
+ return true;
+failure:
+ // @@protoc_insertion_point(parse_failure:com.trustonic.tee_proxy.GetVersionResponse)
+ return false;
+#undef DO_
+}
+
+void GetVersionResponse::SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const {
+ // @@protoc_insertion_point(serialize_start:com.trustonic.tee_proxy.GetVersionResponse)
+ // required string product_id = 1;
+ if (has_product_id()) {
+ ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
+ 1, this->product_id(), output);
+ }
+
+ // required uint32 mci = 2;
+ if (has_mci()) {
+ ::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->mci(), output);
+ }
+
+ // required uint32 so = 3;
+ if (has_so()) {
+ ::google::protobuf::internal::WireFormatLite::WriteUInt32(3, this->so(), output);
+ }
+
+ // required uint32 mclf = 4;
+ if (has_mclf()) {
+ ::google::protobuf::internal::WireFormatLite::WriteUInt32(4, this->mclf(), output);
+ }
+
+ // required uint32 container = 5;
+ if (has_container()) {
+ ::google::protobuf::internal::WireFormatLite::WriteUInt32(5, this->container(), output);
+ }
+
+ // required uint32 mc_config = 6;
+ if (has_mc_config()) {
+ ::google::protobuf::internal::WireFormatLite::WriteUInt32(6, this->mc_config(), output);
+ }
+
+ // required uint32 tl_api = 7;
+ if (has_tl_api()) {
+ ::google::protobuf::internal::WireFormatLite::WriteUInt32(7, this->tl_api(), output);
+ }
+
+ // required uint32 dr_api = 8;
+ if (has_dr_api()) {
+ ::google::protobuf::internal::WireFormatLite::WriteUInt32(8, this->dr_api(), output);
+ }
+
+ // required uint32 nwd = 9;
+ if (has_nwd()) {
+ ::google::protobuf::internal::WireFormatLite::WriteUInt32(9, this->nwd(), output);
+ }
+
+ output->WriteRaw(unknown_fields().data(),
+ unknown_fields().size());
+ // @@protoc_insertion_point(serialize_end:com.trustonic.tee_proxy.GetVersionResponse)
+}
+
+int GetVersionResponse::ByteSize() const {
+ int total_size = 0;
+
+ if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ // required string product_id = 1;
+ if (has_product_id()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::StringSize(
+ this->product_id());
+ }
+
+ // required uint32 mci = 2;
+ if (has_mci()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::UInt32Size(
+ this->mci());
+ }
+
+ // required uint32 so = 3;
+ if (has_so()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::UInt32Size(
+ this->so());
+ }
+
+ // required uint32 mclf = 4;
+ if (has_mclf()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::UInt32Size(
+ this->mclf());
+ }
+
+ // required uint32 container = 5;
+ if (has_container()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::UInt32Size(
+ this->container());
+ }
+
+ // required uint32 mc_config = 6;
+ if (has_mc_config()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::UInt32Size(
+ this->mc_config());
+ }
+
+ // required uint32 tl_api = 7;
+ if (has_tl_api()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::UInt32Size(
+ this->tl_api());
+ }
+
+ // required uint32 dr_api = 8;
+ if (has_dr_api()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::UInt32Size(
+ this->dr_api());
+ }
+
+ }
+ if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) {
+ // required uint32 nwd = 9;
+ if (has_nwd()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::UInt32Size(
+ this->nwd());
+ }
+
+ }
+ total_size += unknown_fields().size();
+
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = total_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+ return total_size;
+}
+
+void GetVersionResponse::CheckTypeAndMergeFrom(
+ const ::google::protobuf::MessageLite& from) {
+ MergeFrom(*::google::protobuf::down_cast<const GetVersionResponse*>(&from));
+}
+
+void GetVersionResponse::MergeFrom(const GetVersionResponse& from) {
+ GOOGLE_CHECK_NE(&from, this);
+ if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ if (from.has_product_id()) {
+ set_product_id(from.product_id());
+ }
+ if (from.has_mci()) {
+ set_mci(from.mci());
+ }
+ if (from.has_so()) {
+ set_so(from.so());
+ }
+ if (from.has_mclf()) {
+ set_mclf(from.mclf());
+ }
+ if (from.has_container()) {
+ set_container(from.container());
+ }
+ if (from.has_mc_config()) {
+ set_mc_config(from.mc_config());
+ }
+ if (from.has_tl_api()) {
+ set_tl_api(from.tl_api());
+ }
+ if (from.has_dr_api()) {
+ set_dr_api(from.dr_api());
+ }
+ }
+ if (from._has_bits_[8 / 32] & (0xffu << (8 % 32))) {
+ if (from.has_nwd()) {
+ set_nwd(from.nwd());
+ }
+ }
+ mutable_unknown_fields()->append(from.unknown_fields());
+}
+
+void GetVersionResponse::CopyFrom(const GetVersionResponse& from) {
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+bool GetVersionResponse::IsInitialized() const {
+ if ((_has_bits_[0] & 0x000001ff) != 0x000001ff) return false;
+
+ return true;
+}
+
+void GetVersionResponse::Swap(GetVersionResponse* other) {
+ if (other != this) {
+ std::swap(product_id_, other->product_id_);
+ std::swap(mci_, other->mci_);
+ std::swap(so_, other->so_);
+ std::swap(mclf_, other->mclf_);
+ std::swap(container_, other->container_);
+ std::swap(mc_config_, other->mc_config_);
+ std::swap(tl_api_, other->tl_api_);
+ std::swap(dr_api_, other->dr_api_);
+ std::swap(nwd_, other->nwd_);
+ std::swap(_has_bits_[0], other->_has_bits_[0]);
+ _unknown_fields_.swap(other->_unknown_fields_);
+ std::swap(_cached_size_, other->_cached_size_);
+ }
+}
+
+::std::string GetVersionResponse::GetTypeName() const {
+ return "com.trustonic.tee_proxy.GetVersionResponse";
+}
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
+const int GpRequestCancellationRequest::kSidFieldNumber;
+#endif // !_MSC_VER
+
+GpRequestCancellationRequest::GpRequestCancellationRequest()
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ // @@protoc_insertion_point(constructor:com.trustonic.tee_proxy.GpRequestCancellationRequest)
+}
+
+void GpRequestCancellationRequest::InitAsDefaultInstance() {
+}
+
+GpRequestCancellationRequest::GpRequestCancellationRequest(const GpRequestCancellationRequest& from)
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ MergeFrom(from);
+ // @@protoc_insertion_point(copy_constructor:com.trustonic.tee_proxy.GpRequestCancellationRequest)
+}
+
+void GpRequestCancellationRequest::SharedCtor() {
+ _cached_size_ = 0;
+ sid_ = 0u;
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+GpRequestCancellationRequest::~GpRequestCancellationRequest() {
+ // @@protoc_insertion_point(destructor:com.trustonic.tee_proxy.GpRequestCancellationRequest)
+ SharedDtor();
+}
+
+void GpRequestCancellationRequest::SharedDtor() {
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ if (this != &default_instance()) {
+ #else
+ if (this != default_instance_) {
+ #endif
+ }
+}
+
+void GpRequestCancellationRequest::SetCachedSize(int size) const {
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const GpRequestCancellationRequest& GpRequestCancellationRequest::default_instance() {
+#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ protobuf_AddDesc_mc_2eproto();
+#else
+ if (default_instance_ == NULL) protobuf_AddDesc_mc_2eproto();
+#endif
+ return *default_instance_;
+}
+
+GpRequestCancellationRequest* GpRequestCancellationRequest::default_instance_ = NULL;
+
+GpRequestCancellationRequest* GpRequestCancellationRequest::New() const {
+ return new GpRequestCancellationRequest;
+}
+
+void GpRequestCancellationRequest::Clear() {
+ sid_ = 0u;
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+ mutable_unknown_fields()->clear();
+}
+
+bool GpRequestCancellationRequest::MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
+ ::google::protobuf::uint32 tag;
+ ::google::protobuf::io::StringOutputStream unknown_fields_string(
+ mutable_unknown_fields());
+ ::google::protobuf::io::CodedOutputStream unknown_fields_stream(
+ &unknown_fields_string);
+ // @@protoc_insertion_point(parse_start:com.trustonic.tee_proxy.GpRequestCancellationRequest)
+ for (;;) {
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
+ tag = p.first;
+ if (!p.second) goto handle_unusual;
+ switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+ // required uint32 sid = 1;
+ case 1: {
+ if (tag == 8) {
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+ ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
+ input, &sid_)));
+ set_has_sid();
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectAtEnd()) goto success;
+ break;
+ }
+
+ default: {
+ handle_unusual:
+ if (tag == 0 ||
+ ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+ goto success;
+ }
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(
+ input, tag, &unknown_fields_stream));
+ break;
+ }
+ }
+ }
+success:
+ // @@protoc_insertion_point(parse_success:com.trustonic.tee_proxy.GpRequestCancellationRequest)
+ return true;
+failure:
+ // @@protoc_insertion_point(parse_failure:com.trustonic.tee_proxy.GpRequestCancellationRequest)
+ return false;
+#undef DO_
+}
+
+void GpRequestCancellationRequest::SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const {
+ // @@protoc_insertion_point(serialize_start:com.trustonic.tee_proxy.GpRequestCancellationRequest)
+ // required uint32 sid = 1;
+ if (has_sid()) {
+ ::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->sid(), output);
+ }
+
+ output->WriteRaw(unknown_fields().data(),
+ unknown_fields().size());
+ // @@protoc_insertion_point(serialize_end:com.trustonic.tee_proxy.GpRequestCancellationRequest)
+}
+
+int GpRequestCancellationRequest::ByteSize() const {
+ int total_size = 0;
+
+ if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ // required uint32 sid = 1;
+ if (has_sid()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::UInt32Size(
+ this->sid());
+ }
+
+ }
+ total_size += unknown_fields().size();
+
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = total_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+ return total_size;
+}
+
+void GpRequestCancellationRequest::CheckTypeAndMergeFrom(
+ const ::google::protobuf::MessageLite& from) {
+ MergeFrom(*::google::protobuf::down_cast<const GpRequestCancellationRequest*>(&from));
+}
+
+void GpRequestCancellationRequest::MergeFrom(const GpRequestCancellationRequest& from) {
+ GOOGLE_CHECK_NE(&from, this);
+ if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ if (from.has_sid()) {
+ set_sid(from.sid());
+ }
+ }
+ mutable_unknown_fields()->append(from.unknown_fields());
+}
+
+void GpRequestCancellationRequest::CopyFrom(const GpRequestCancellationRequest& from) {
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+bool GpRequestCancellationRequest::IsInitialized() const {
+ if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false;
+
+ return true;
+}
+
+void GpRequestCancellationRequest::Swap(GpRequestCancellationRequest* other) {
+ if (other != this) {
+ std::swap(sid_, other->sid_);
+ std::swap(_has_bits_[0], other->_has_bits_[0]);
+ _unknown_fields_.swap(other->_unknown_fields_);
+ std::swap(_cached_size_, other->_cached_size_);
+ }
+}
+
+::std::string GpRequestCancellationRequest::GetTypeName() const {
+ return "com.trustonic.tee_proxy.GpRequestCancellationRequest";
+}
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
+#endif // !_MSC_VER
+
+GpRequestCancellationResponse::GpRequestCancellationResponse()
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ // @@protoc_insertion_point(constructor:com.trustonic.tee_proxy.GpRequestCancellationResponse)
+}
+
+void GpRequestCancellationResponse::InitAsDefaultInstance() {
+}
+
+GpRequestCancellationResponse::GpRequestCancellationResponse(const GpRequestCancellationResponse& from)
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ MergeFrom(from);
+ // @@protoc_insertion_point(copy_constructor:com.trustonic.tee_proxy.GpRequestCancellationResponse)
+}
+
+void GpRequestCancellationResponse::SharedCtor() {
+ _cached_size_ = 0;
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+GpRequestCancellationResponse::~GpRequestCancellationResponse() {
+ // @@protoc_insertion_point(destructor:com.trustonic.tee_proxy.GpRequestCancellationResponse)
+ SharedDtor();
+}
+
+void GpRequestCancellationResponse::SharedDtor() {
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ if (this != &default_instance()) {
+ #else
+ if (this != default_instance_) {
+ #endif
+ }
+}
+
+void GpRequestCancellationResponse::SetCachedSize(int size) const {
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const GpRequestCancellationResponse& GpRequestCancellationResponse::default_instance() {
+#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ protobuf_AddDesc_mc_2eproto();
+#else
+ if (default_instance_ == NULL) protobuf_AddDesc_mc_2eproto();
+#endif
+ return *default_instance_;
+}
+
+GpRequestCancellationResponse* GpRequestCancellationResponse::default_instance_ = NULL;
+
+GpRequestCancellationResponse* GpRequestCancellationResponse::New() const {
+ return new GpRequestCancellationResponse;
+}
+
+void GpRequestCancellationResponse::Clear() {
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+ mutable_unknown_fields()->clear();
+}
+
+bool GpRequestCancellationResponse::MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
+ ::google::protobuf::uint32 tag;
+ ::google::protobuf::io::StringOutputStream unknown_fields_string(
+ mutable_unknown_fields());
+ ::google::protobuf::io::CodedOutputStream unknown_fields_stream(
+ &unknown_fields_string);
+ // @@protoc_insertion_point(parse_start:com.trustonic.tee_proxy.GpRequestCancellationResponse)
+ for (;;) {
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
+ tag = p.first;
+ if (!p.second) goto handle_unusual;
+ handle_unusual:
+ if (tag == 0 ||
+ ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+ goto success;
+ }
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(
+ input, tag, &unknown_fields_stream));
+ }
+success:
+ // @@protoc_insertion_point(parse_success:com.trustonic.tee_proxy.GpRequestCancellationResponse)
+ return true;
+failure:
+ // @@protoc_insertion_point(parse_failure:com.trustonic.tee_proxy.GpRequestCancellationResponse)
+ return false;
+#undef DO_
+}
+
+void GpRequestCancellationResponse::SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const {
+ // @@protoc_insertion_point(serialize_start:com.trustonic.tee_proxy.GpRequestCancellationResponse)
+ output->WriteRaw(unknown_fields().data(),
+ unknown_fields().size());
+ // @@protoc_insertion_point(serialize_end:com.trustonic.tee_proxy.GpRequestCancellationResponse)
+}
+
+int GpRequestCancellationResponse::ByteSize() const {
+ int total_size = 0;
+
+ total_size += unknown_fields().size();
+
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = total_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+ return total_size;
+}
+
+void GpRequestCancellationResponse::CheckTypeAndMergeFrom(
+ const ::google::protobuf::MessageLite& from) {
+ MergeFrom(*::google::protobuf::down_cast<const GpRequestCancellationResponse*>(&from));
+}
+
+void GpRequestCancellationResponse::MergeFrom(const GpRequestCancellationResponse& from) {
+ GOOGLE_CHECK_NE(&from, this);
+ mutable_unknown_fields()->append(from.unknown_fields());
+}
+
+void GpRequestCancellationResponse::CopyFrom(const GpRequestCancellationResponse& from) {
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+bool GpRequestCancellationResponse::IsInitialized() const {
+
+ return true;
+}
+
+void GpRequestCancellationResponse::Swap(GpRequestCancellationResponse* other) {
+ if (other != this) {
+ _unknown_fields_.swap(other->_unknown_fields_);
+ std::swap(_cached_size_, other->_cached_size_);
+ }
+}
+
+::std::string GpRequestCancellationResponse::GetTypeName() const {
+ return "com.trustonic.tee_proxy.GpRequestCancellationResponse";
+}
+
+
+// @@protoc_insertion_point(namespace_scope)
+
+} // namespace tee_proxy
+} // namespace trustonic
+} // namespace com
+
+// @@protoc_insertion_point(global_scope)
diff --git a/mobicore/MobiCoreDriverLib/ClientLib/mc.pb.h b/mobicore/MobiCoreDriverLib/ClientLib/mc.pb.h
new file mode 100644
index 0000000..c74bdab
--- /dev/null
+++ b/mobicore/MobiCoreDriverLib/ClientLib/mc.pb.h
@@ -0,0 +1,4365 @@
+/*
+ * Copyright (c) 2013-2015 TRUSTONIC LIMITED
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the TRUSTONIC LIMITED nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: mc.proto
+
+#ifndef PROTOBUF_mc_2eproto__INCLUDED
+#define PROTOBUF_mc_2eproto__INCLUDED
+
+#include <string>
+
+#include <google/protobuf/stubs/common.h>
+
+#if GOOGLE_PROTOBUF_VERSION < 2006000
+#error This file was generated by a newer version of protoc which is
+#error incompatible with your Protocol Buffer headers. Please update
+#error your headers.
+#endif
+#if 2006001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
+#error This file was generated by an older version of protoc which is
+#error incompatible with your Protocol Buffer headers. Please
+#error regenerate this file with a newer version of protoc.
+#endif
+
+#include <google/protobuf/generated_message_util.h>
+#include <google/protobuf/message_lite.h>
+#include <google/protobuf/repeated_field.h>
+#include <google/protobuf/extension_set.h>
+// @@protoc_insertion_point(includes)
+
+namespace com {
+namespace trustonic {
+namespace tee_proxy {
+
+// Internal implementation detail -- do not call these.
+void protobuf_AddDesc_mc_2eproto();
+void protobuf_AssignDesc_mc_2eproto();
+void protobuf_ShutdownFile_mc_2eproto();
+
+class OpenSessionRequest;
+class OpenSessionResponse;
+class OpenTrustletRequest;
+class OpenTrustletResponse;
+class CloseSessionRequest;
+class CloseSessionResponse;
+class NotifyRequest;
+class NotifyRequest_Buffers;
+class NotifyResponse;
+class WaitNotificationRequest;
+class WaitNotificationResponse;
+class WaitNotificationResponse_Buffers;
+class MapRequest;
+class MapRequest_Buffers;
+class MapResponse;
+class MapResponse_Buffers;
+class UnmapRequest;
+class UnmapRequest_Buffers;
+class UnmapResponse;
+class GetErrorRequest;
+class GetErrorResponse;
+class GetVersionRequest;
+class GetVersionResponse;
+class GpRequestCancellationRequest;
+class GpRequestCancellationResponse;
+
+enum LoginType {
+ TEEC_LOGIN_PUBLIC = 0,
+ TEEC_LOGIN_USER = 1,
+ TEEC_LOGIN_GROUP = 2,
+ TEEC_LOGIN_APPLICATION = 4,
+ TEEC_LOGIN_USER_APPLICATION = 5,
+ TEEC_LOGIN_GROUP_APPLICATION = 6
+};
+bool LoginType_IsValid(int value);
+const LoginType LoginType_MIN = TEEC_LOGIN_PUBLIC;
+const LoginType LoginType_MAX = TEEC_LOGIN_GROUP_APPLICATION;
+const int LoginType_ARRAYSIZE = LoginType_MAX + 1;
+
+// ===================================================================
+
+class OpenSessionRequest : public ::google::protobuf::MessageLite {
+ public:
+ OpenSessionRequest();
+ virtual ~OpenSessionRequest();
+
+ OpenSessionRequest(const OpenSessionRequest& from);
+
+ inline OpenSessionRequest& operator=(const OpenSessionRequest& from) {
+ CopyFrom(from);
+ return *this;
+ }
+
+ inline const ::std::string& unknown_fields() const {
+ return _unknown_fields_;
+ }
+
+ inline ::std::string* mutable_unknown_fields() {
+ return &_unknown_fields_;
+ }
+
+ static const OpenSessionRequest& default_instance();
+
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ // Returns the internal default instance pointer. This function can
+ // return NULL thus should not be used by the user. This is intended
+ // for Protobuf internal code. Please use default_instance() declared
+ // above instead.
+ static inline const OpenSessionRequest* internal_default_instance() {
+ return default_instance_;
+ }
+ #endif
+
+ void Swap(OpenSessionRequest* other);
+
+ // implements Message ----------------------------------------------
+
+ OpenSessionRequest* New() const;
+ void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from);
+ void CopyFrom(const OpenSessionRequest& from);
+ void MergeFrom(const OpenSessionRequest& from);
+ void Clear();
+ bool IsInitialized() const;
+
+ int ByteSize() const;
+ bool MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input);
+ void SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const;
+ void DiscardUnknownFields();
+ int GetCachedSize() const { return _cached_size_; }
+ private:
+ void SharedCtor();
+ void SharedDtor();
+ void SetCachedSize(int size) const;
+ public:
+ ::std::string GetTypeName() const;
+
+ // nested types ----------------------------------------------------
+
+ // accessors -------------------------------------------------------
+
+ // required bytes uuid = 1;
+ inline bool has_uuid() const;
+ inline void clear_uuid();
+ static const int kUuidFieldNumber = 1;
+ inline const ::std::string& uuid() const;
+ inline void set_uuid(const ::std::string& value);
+ inline void set_uuid(const char* value);
+ inline void set_uuid(const void* value, size_t size);
+ inline ::std::string* mutable_uuid();
+ inline ::std::string* release_uuid();
+ inline void set_allocated_uuid(::std::string* uuid);
+
+ // required bool is_gp_uuid = 2;
+ inline bool has_is_gp_uuid() const;
+ inline void clear_is_gp_uuid();
+ static const int kIsGpUuidFieldNumber = 2;
+ inline bool is_gp_uuid() const;
+ inline void set_is_gp_uuid(bool value);
+
+ // optional bytes tci = 3;
+ inline bool has_tci() const;
+ inline void clear_tci();
+ static const int kTciFieldNumber = 3;
+ inline const ::std::string& tci() const;
+ inline void set_tci(const ::std::string& value);
+ inline void set_tci(const char* value);
+ inline void set_tci(const void* value, size_t size);
+ inline ::std::string* mutable_tci();
+ inline ::std::string* release_tci();
+ inline void set_allocated_tci(::std::string* tci);
+
+ // required .com.trustonic.tee_proxy.LoginType login_type = 4;
+ inline bool has_login_type() const;
+ inline void clear_login_type();
+ static const int kLoginTypeFieldNumber = 4;
+ inline ::com::trustonic::tee_proxy::LoginType login_type() const;
+ inline void set_login_type(::com::trustonic::tee_proxy::LoginType value);
+
+ // required bytes login_data = 5;
+ inline bool has_login_data() const;
+ inline void clear_login_data();
+ static const int kLoginDataFieldNumber = 5;
+ inline const ::std::string& login_data() const;
+ inline void set_login_data(const ::std::string& value);
+ inline void set_login_data(const char* value);
+ inline void set_login_data(const void* value, size_t size);
+ inline ::std::string* mutable_login_data();
+ inline ::std::string* release_login_data();
+ inline void set_allocated_login_data(::std::string* login_data);
+
+ // @@protoc_insertion_point(class_scope:com.trustonic.tee_proxy.OpenSessionRequest)
+ private:
+ inline void set_has_uuid();
+ inline void clear_has_uuid();
+ inline void set_has_is_gp_uuid();
+ inline void clear_has_is_gp_uuid();
+ inline void set_has_tci();
+ inline void clear_has_tci();
+ inline void set_has_login_type();
+ inline void clear_has_login_type();
+ inline void set_has_login_data();
+ inline void clear_has_login_data();
+
+ ::std::string _unknown_fields_;
+
+ ::google::protobuf::uint32 _has_bits_[1];
+ mutable int _cached_size_;
+ ::std::string* uuid_;
+ ::std::string* tci_;
+ bool is_gp_uuid_;
+ int login_type_;
+ ::std::string* login_data_;
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ friend void protobuf_AddDesc_mc_2eproto_impl();
+ #else
+ friend void protobuf_AddDesc_mc_2eproto();
+ #endif
+ friend void protobuf_AssignDesc_mc_2eproto();
+ friend void protobuf_ShutdownFile_mc_2eproto();
+
+ void InitAsDefaultInstance();
+ static OpenSessionRequest* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class OpenSessionResponse : public ::google::protobuf::MessageLite {
+ public:
+ OpenSessionResponse();
+ virtual ~OpenSessionResponse();
+
+ OpenSessionResponse(const OpenSessionResponse& from);
+
+ inline OpenSessionResponse& operator=(const OpenSessionResponse& from) {
+ CopyFrom(from);
+ return *this;
+ }
+
+ inline const ::std::string& unknown_fields() const {
+ return _unknown_fields_;
+ }
+
+ inline ::std::string* mutable_unknown_fields() {
+ return &_unknown_fields_;
+ }
+
+ static const OpenSessionResponse& default_instance();
+
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ // Returns the internal default instance pointer. This function can
+ // return NULL thus should not be used by the user. This is intended
+ // for Protobuf internal code. Please use default_instance() declared
+ // above instead.
+ static inline const OpenSessionResponse* internal_default_instance() {
+ return default_instance_;
+ }
+ #endif
+
+ void Swap(OpenSessionResponse* other);
+
+ // implements Message ----------------------------------------------
+
+ OpenSessionResponse* New() const;
+ void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from);
+ void CopyFrom(const OpenSessionResponse& from);
+ void MergeFrom(const OpenSessionResponse& from);
+ void Clear();
+ bool IsInitialized() const;
+
+ int ByteSize() const;
+ bool MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input);
+ void SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const;
+ void DiscardUnknownFields();
+ int GetCachedSize() const { return _cached_size_; }
+ private:
+ void SharedCtor();
+ void SharedDtor();
+ void SetCachedSize(int size) const;
+ public:
+ ::std::string GetTypeName() const;
+
+ // nested types ----------------------------------------------------
+
+ // accessors -------------------------------------------------------
+
+ // required uint32 id = 1;
+ inline bool has_id() const;
+ inline void clear_id();
+ static const int kIdFieldNumber = 1;
+ inline ::google::protobuf::uint32 id() const;
+ inline void set_id(::google::protobuf::uint32 value);
+
+ // @@protoc_insertion_point(class_scope:com.trustonic.tee_proxy.OpenSessionResponse)
+ private:
+ inline void set_has_id();
+ inline void clear_has_id();
+
+ ::std::string _unknown_fields_;
+
+ ::google::protobuf::uint32 _has_bits_[1];
+ mutable int _cached_size_;
+ ::google::protobuf::uint32 id_;
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ friend void protobuf_AddDesc_mc_2eproto_impl();
+ #else
+ friend void protobuf_AddDesc_mc_2eproto();
+ #endif
+ friend void protobuf_AssignDesc_mc_2eproto();
+ friend void protobuf_ShutdownFile_mc_2eproto();
+
+ void InitAsDefaultInstance();
+ static OpenSessionResponse* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class OpenTrustletRequest : public ::google::protobuf::MessageLite {
+ public:
+ OpenTrustletRequest();
+ virtual ~OpenTrustletRequest();
+
+ OpenTrustletRequest(const OpenTrustletRequest& from);
+
+ inline OpenTrustletRequest& operator=(const OpenTrustletRequest& from) {
+ CopyFrom(from);
+ return *this;
+ }
+
+ inline const ::std::string& unknown_fields() const {
+ return _unknown_fields_;
+ }
+
+ inline ::std::string* mutable_unknown_fields() {
+ return &_unknown_fields_;
+ }
+
+ static const OpenTrustletRequest& default_instance();
+
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ // Returns the internal default instance pointer. This function can
+ // return NULL thus should not be used by the user. This is intended
+ // for Protobuf internal code. Please use default_instance() declared
+ // above instead.
+ static inline const OpenTrustletRequest* internal_default_instance() {
+ return default_instance_;
+ }
+ #endif
+
+ void Swap(OpenTrustletRequest* other);
+
+ // implements Message ----------------------------------------------
+
+ OpenTrustletRequest* New() const;
+ void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from);
+ void CopyFrom(const OpenTrustletRequest& from);
+ void MergeFrom(const OpenTrustletRequest& from);
+ void Clear();
+ bool IsInitialized() const;
+
+ int ByteSize() const;
+ bool MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input);
+ void SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const;
+ void DiscardUnknownFields();
+ int GetCachedSize() const { return _cached_size_; }
+ private:
+ void SharedCtor();
+ void SharedDtor();
+ void SetCachedSize(int size) const;
+ public:
+ ::std::string GetTypeName() const;
+
+ // nested types ----------------------------------------------------
+
+ // accessors -------------------------------------------------------
+
+ // required uint32 spid = 1;
+ inline bool has_spid() const;
+ inline void clear_spid();
+ static const int kSpidFieldNumber = 1;
+ inline ::google::protobuf::uint32 spid() const;
+ inline void set_spid(::google::protobuf::uint32 value);
+
+ // required bytes trustapp = 2;
+ inline bool has_trustapp() const;
+ inline void clear_trustapp();
+ static const int kTrustappFieldNumber = 2;
+ inline const ::std::string& trustapp() const;
+ inline void set_trustapp(const ::std::string& value);
+ inline void set_trustapp(const char* value);
+ inline void set_trustapp(const void* value, size_t size);
+ inline ::std::string* mutable_trustapp();
+ inline ::std::string* release_trustapp();
+ inline void set_allocated_trustapp(::std::string* trustapp);
+
+ // optional bytes tci = 3;
+ inline bool has_tci() const;
+ inline void clear_tci();
+ static const int kTciFieldNumber = 3;
+ inline const ::std::string& tci() const;
+ inline void set_tci(const ::std::string& value);
+ inline void set_tci(const char* value);
+ inline void set_tci(const void* value, size_t size);
+ inline ::std::string* mutable_tci();
+ inline ::std::string* release_tci();
+ inline void set_allocated_tci(::std::string* tci);
+
+ // @@protoc_insertion_point(class_scope:com.trustonic.tee_proxy.OpenTrustletRequest)
+ private:
+ inline void set_has_spid();
+ inline void clear_has_spid();
+ inline void set_has_trustapp();
+ inline void clear_has_trustapp();
+ inline void set_has_tci();
+ inline void clear_has_tci();
+
+ ::std::string _unknown_fields_;
+
+ ::google::protobuf::uint32 _has_bits_[1];
+ mutable int _cached_size_;
+ ::std::string* trustapp_;
+ ::std::string* tci_;
+ ::google::protobuf::uint32 spid_;
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ friend void protobuf_AddDesc_mc_2eproto_impl();
+ #else
+ friend void protobuf_AddDesc_mc_2eproto();
+ #endif
+ friend void protobuf_AssignDesc_mc_2eproto();
+ friend void protobuf_ShutdownFile_mc_2eproto();
+
+ void InitAsDefaultInstance();
+ static OpenTrustletRequest* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class OpenTrustletResponse : public ::google::protobuf::MessageLite {
+ public:
+ OpenTrustletResponse();
+ virtual ~OpenTrustletResponse();
+
+ OpenTrustletResponse(const OpenTrustletResponse& from);
+
+ inline OpenTrustletResponse& operator=(const OpenTrustletResponse& from) {
+ CopyFrom(from);
+ return *this;
+ }
+
+ inline const ::std::string& unknown_fields() const {
+ return _unknown_fields_;
+ }
+
+ inline ::std::string* mutable_unknown_fields() {
+ return &_unknown_fields_;
+ }
+
+ static const OpenTrustletResponse& default_instance();
+
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ // Returns the internal default instance pointer. This function can
+ // return NULL thus should not be used by the user. This is intended
+ // for Protobuf internal code. Please use default_instance() declared
+ // above instead.
+ static inline const OpenTrustletResponse* internal_default_instance() {
+ return default_instance_;
+ }
+ #endif
+
+ void Swap(OpenTrustletResponse* other);
+
+ // implements Message ----------------------------------------------
+
+ OpenTrustletResponse* New() const;
+ void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from);
+ void CopyFrom(const OpenTrustletResponse& from);
+ void MergeFrom(const OpenTrustletResponse& from);
+ void Clear();
+ bool IsInitialized() const;
+
+ int ByteSize() const;
+ bool MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input);
+ void SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const;
+ void DiscardUnknownFields();
+ int GetCachedSize() const { return _cached_size_; }
+ private:
+ void SharedCtor();
+ void SharedDtor();
+ void SetCachedSize(int size) const;
+ public:
+ ::std::string GetTypeName() const;
+
+ // nested types ----------------------------------------------------
+
+ // accessors -------------------------------------------------------
+
+ // required uint32 id = 1;
+ inline bool has_id() const;
+ inline void clear_id();
+ static const int kIdFieldNumber = 1;
+ inline ::google::protobuf::uint32 id() const;
+ inline void set_id(::google::protobuf::uint32 value);
+
+ // @@protoc_insertion_point(class_scope:com.trustonic.tee_proxy.OpenTrustletResponse)
+ private:
+ inline void set_has_id();
+ inline void clear_has_id();
+
+ ::std::string _unknown_fields_;
+
+ ::google::protobuf::uint32 _has_bits_[1];
+ mutable int _cached_size_;
+ ::google::protobuf::uint32 id_;
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ friend void protobuf_AddDesc_mc_2eproto_impl();
+ #else
+ friend void protobuf_AddDesc_mc_2eproto();
+ #endif
+ friend void protobuf_AssignDesc_mc_2eproto();
+ friend void protobuf_ShutdownFile_mc_2eproto();
+
+ void InitAsDefaultInstance();
+ static OpenTrustletResponse* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class CloseSessionRequest : public ::google::protobuf::MessageLite {
+ public:
+ CloseSessionRequest();
+ virtual ~CloseSessionRequest();
+
+ CloseSessionRequest(const CloseSessionRequest& from);
+
+ inline CloseSessionRequest& operator=(const CloseSessionRequest& from) {
+ CopyFrom(from);
+ return *this;
+ }
+
+ inline const ::std::string& unknown_fields() const {
+ return _unknown_fields_;
+ }
+
+ inline ::std::string* mutable_unknown_fields() {
+ return &_unknown_fields_;
+ }
+
+ static const CloseSessionRequest& default_instance();
+
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ // Returns the internal default instance pointer. This function can
+ // return NULL thus should not be used by the user. This is intended
+ // for Protobuf internal code. Please use default_instance() declared
+ // above instead.
+ static inline const CloseSessionRequest* internal_default_instance() {
+ return default_instance_;
+ }
+ #endif
+
+ void Swap(CloseSessionRequest* other);
+
+ // implements Message ----------------------------------------------
+
+ CloseSessionRequest* New() const;
+ void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from);
+ void CopyFrom(const CloseSessionRequest& from);
+ void MergeFrom(const CloseSessionRequest& from);
+ void Clear();
+ bool IsInitialized() const;
+
+ int ByteSize() const;
+ bool MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input);
+ void SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const;
+ void DiscardUnknownFields();
+ int GetCachedSize() const { return _cached_size_; }
+ private:
+ void SharedCtor();
+ void SharedDtor();
+ void SetCachedSize(int size) const;
+ public:
+ ::std::string GetTypeName() const;
+
+ // nested types ----------------------------------------------------
+
+ // accessors -------------------------------------------------------
+
+ // required uint32 id = 1;
+ inline bool has_id() const;
+ inline void clear_id();
+ static const int kIdFieldNumber = 1;
+ inline ::google::protobuf::uint32 id() const;
+ inline void set_id(::google::protobuf::uint32 value);
+
+ // @@protoc_insertion_point(class_scope:com.trustonic.tee_proxy.CloseSessionRequest)
+ private:
+ inline void set_has_id();
+ inline void clear_has_id();
+
+ ::std::string _unknown_fields_;
+
+ ::google::protobuf::uint32 _has_bits_[1];
+ mutable int _cached_size_;
+ ::google::protobuf::uint32 id_;
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ friend void protobuf_AddDesc_mc_2eproto_impl();
+ #else
+ friend void protobuf_AddDesc_mc_2eproto();
+ #endif
+ friend void protobuf_AssignDesc_mc_2eproto();
+ friend void protobuf_ShutdownFile_mc_2eproto();
+
+ void InitAsDefaultInstance();
+ static CloseSessionRequest* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class CloseSessionResponse : public ::google::protobuf::MessageLite {
+ public:
+ CloseSessionResponse();
+ virtual ~CloseSessionResponse();
+
+ CloseSessionResponse(const CloseSessionResponse& from);
+
+ inline CloseSessionResponse& operator=(const CloseSessionResponse& from) {
+ CopyFrom(from);
+ return *this;
+ }
+
+ inline const ::std::string& unknown_fields() const {
+ return _unknown_fields_;
+ }
+
+ inline ::std::string* mutable_unknown_fields() {
+ return &_unknown_fields_;
+ }
+
+ static const CloseSessionResponse& default_instance();
+
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ // Returns the internal default instance pointer. This function can
+ // return NULL thus should not be used by the user. This is intended
+ // for Protobuf internal code. Please use default_instance() declared
+ // above instead.
+ static inline const CloseSessionResponse* internal_default_instance() {
+ return default_instance_;
+ }
+ #endif
+
+ void Swap(CloseSessionResponse* other);
+
+ // implements Message ----------------------------------------------
+
+ CloseSessionResponse* New() const;
+ void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from);
+ void CopyFrom(const CloseSessionResponse& from);
+ void MergeFrom(const CloseSessionResponse& from);
+ void Clear();
+ bool IsInitialized() const;
+
+ int ByteSize() const;
+ bool MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input);
+ void SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const;
+ void DiscardUnknownFields();
+ int GetCachedSize() const { return _cached_size_; }
+ private:
+ void SharedCtor();
+ void SharedDtor();
+ void SetCachedSize(int size) const;
+ public:
+ ::std::string GetTypeName() const;
+
+ // nested types ----------------------------------------------------
+
+ // accessors -------------------------------------------------------
+
+ // @@protoc_insertion_point(class_scope:com.trustonic.tee_proxy.CloseSessionResponse)
+ private:
+
+ ::std::string _unknown_fields_;
+
+ ::google::protobuf::uint32 _has_bits_[1];
+ mutable int _cached_size_;
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ friend void protobuf_AddDesc_mc_2eproto_impl();
+ #else
+ friend void protobuf_AddDesc_mc_2eproto();
+ #endif
+ friend void protobuf_AssignDesc_mc_2eproto();
+ friend void protobuf_ShutdownFile_mc_2eproto();
+
+ void InitAsDefaultInstance();
+ static CloseSessionResponse* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class NotifyRequest_Buffers : public ::google::protobuf::MessageLite {
+ public:
+ NotifyRequest_Buffers();
+ virtual ~NotifyRequest_Buffers();
+
+ NotifyRequest_Buffers(const NotifyRequest_Buffers& from);
+
+ inline NotifyRequest_Buffers& operator=(const NotifyRequest_Buffers& from) {
+ CopyFrom(from);
+ return *this;
+ }
+
+ inline const ::std::string& unknown_fields() const {
+ return _unknown_fields_;
+ }
+
+ inline ::std::string* mutable_unknown_fields() {
+ return &_unknown_fields_;
+ }
+
+ static const NotifyRequest_Buffers& default_instance();
+
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ // Returns the internal default instance pointer. This function can
+ // return NULL thus should not be used by the user. This is intended
+ // for Protobuf internal code. Please use default_instance() declared
+ // above instead.
+ static inline const NotifyRequest_Buffers* internal_default_instance() {
+ return default_instance_;
+ }
+ #endif
+
+ void Swap(NotifyRequest_Buffers* other);
+
+ // implements Message ----------------------------------------------
+
+ NotifyRequest_Buffers* New() const;
+ void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from);
+ void CopyFrom(const NotifyRequest_Buffers& from);
+ void MergeFrom(const NotifyRequest_Buffers& from);
+ void Clear();
+ bool IsInitialized() const;
+
+ int ByteSize() const;
+ bool MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input);
+ void SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const;
+ void DiscardUnknownFields();
+ int GetCachedSize() const { return _cached_size_; }
+ private:
+ void SharedCtor();
+ void SharedDtor();
+ void SetCachedSize(int size) const;
+ public:
+ ::std::string GetTypeName() const;
+
+ // nested types ----------------------------------------------------
+
+ // accessors -------------------------------------------------------
+
+ // required uint64 sva = 1;
+ inline bool has_sva() const;
+ inline void clear_sva();
+ static const int kSvaFieldNumber = 1;
+ inline ::google::protobuf::uint64 sva() const;
+ inline void set_sva(::google::protobuf::uint64 value);
+
+ // required bytes data = 2;
+ inline bool has_data() const;
+ inline void clear_data();
+ static const int kDataFieldNumber = 2;
+ inline const ::std::string& data() const;
+ inline void set_data(const ::std::string& value);
+ inline void set_data(const char* value);
+ inline void set_data(const void* value, size_t size);
+ inline ::std::string* mutable_data();
+ inline ::std::string* release_data();
+ inline void set_allocated_data(::std::string* data);
+
+ // @@protoc_insertion_point(class_scope:com.trustonic.tee_proxy.NotifyRequest.Buffers)
+ private:
+ inline void set_has_sva();
+ inline void clear_has_sva();
+ inline void set_has_data();
+ inline void clear_has_data();
+
+ ::std::string _unknown_fields_;
+
+ ::google::protobuf::uint32 _has_bits_[1];
+ mutable int _cached_size_;
+ ::google::protobuf::uint64 sva_;
+ ::std::string* data_;
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ friend void protobuf_AddDesc_mc_2eproto_impl();
+ #else
+ friend void protobuf_AddDesc_mc_2eproto();
+ #endif
+ friend void protobuf_AssignDesc_mc_2eproto();
+ friend void protobuf_ShutdownFile_mc_2eproto();
+
+ void InitAsDefaultInstance();
+ static NotifyRequest_Buffers* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class NotifyRequest : public ::google::protobuf::MessageLite {
+ public:
+ NotifyRequest();
+ virtual ~NotifyRequest();
+
+ NotifyRequest(const NotifyRequest& from);
+
+ inline NotifyRequest& operator=(const NotifyRequest& from) {
+ CopyFrom(from);
+ return *this;
+ }
+
+ inline const ::std::string& unknown_fields() const {
+ return _unknown_fields_;
+ }
+
+ inline ::std::string* mutable_unknown_fields() {
+ return &_unknown_fields_;
+ }
+
+ static const NotifyRequest& default_instance();
+
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ // Returns the internal default instance pointer. This function can
+ // return NULL thus should not be used by the user. This is intended
+ // for Protobuf internal code. Please use default_instance() declared
+ // above instead.
+ static inline const NotifyRequest* internal_default_instance() {
+ return default_instance_;
+ }
+ #endif
+
+ void Swap(NotifyRequest* other);
+
+ // implements Message ----------------------------------------------
+
+ NotifyRequest* New() const;
+ void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from);
+ void CopyFrom(const NotifyRequest& from);
+ void MergeFrom(const NotifyRequest& from);
+ void Clear();
+ bool IsInitialized() const;
+
+ int ByteSize() const;
+ bool MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input);
+ void SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const;
+ void DiscardUnknownFields();
+ int GetCachedSize() const { return _cached_size_; }
+ private:
+ void SharedCtor();
+ void SharedDtor();
+ void SetCachedSize(int size) const;
+ public:
+ ::std::string GetTypeName() const;
+
+ // nested types ----------------------------------------------------
+
+ typedef NotifyRequest_Buffers Buffers;
+
+ // accessors -------------------------------------------------------
+
+ // required uint32 sid = 1;
+ inline bool has_sid() const;
+ inline void clear_sid();
+ static const int kSidFieldNumber = 1;
+ inline ::google::protobuf::uint32 sid() const;
+ inline void set_sid(::google::protobuf::uint32 value);
+
+ // optional bytes tci = 2;
+ inline bool has_tci() const;
+ inline void clear_tci();
+ static const int kTciFieldNumber = 2;
+ inline const ::std::string& tci() const;
+ inline void set_tci(const ::std::string& value);
+ inline void set_tci(const char* value);
+ inline void set_tci(const void* value, size_t size);
+ inline ::std::string* mutable_tci();
+ inline ::std::string* release_tci();
+ inline void set_allocated_tci(::std::string* tci);
+
+ // repeated .com.trustonic.tee_proxy.NotifyRequest.Buffers buffers = 3;
+ inline int buffers_size() const;
+ inline void clear_buffers();
+ static const int kBuffersFieldNumber = 3;
+ inline const ::com::trustonic::tee_proxy::NotifyRequest_Buffers& buffers(int index) const;
+ inline ::com::trustonic::tee_proxy::NotifyRequest_Buffers* mutable_buffers(int index);
+ inline ::com::trustonic::tee_proxy::NotifyRequest_Buffers* add_buffers();
+ inline const ::google::protobuf::RepeatedPtrField< ::com::trustonic::tee_proxy::NotifyRequest_Buffers >&
+ buffers() const;
+ inline ::google::protobuf::RepeatedPtrField< ::com::trustonic::tee_proxy::NotifyRequest_Buffers >*
+ mutable_buffers();
+
+ // @@protoc_insertion_point(class_scope:com.trustonic.tee_proxy.NotifyRequest)
+ private:
+ inline void set_has_sid();
+ inline void clear_has_sid();
+ inline void set_has_tci();
+ inline void clear_has_tci();
+
+ ::std::string _unknown_fields_;
+
+ ::google::protobuf::uint32 _has_bits_[1];
+ mutable int _cached_size_;
+ ::std::string* tci_;
+ ::google::protobuf::RepeatedPtrField< ::com::trustonic::tee_proxy::NotifyRequest_Buffers > buffers_;
+ ::google::protobuf::uint32 sid_;
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ friend void protobuf_AddDesc_mc_2eproto_impl();
+ #else
+ friend void protobuf_AddDesc_mc_2eproto();
+ #endif
+ friend void protobuf_AssignDesc_mc_2eproto();
+ friend void protobuf_ShutdownFile_mc_2eproto();
+
+ void InitAsDefaultInstance();
+ static NotifyRequest* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class NotifyResponse : public ::google::protobuf::MessageLite {
+ public:
+ NotifyResponse();
+ virtual ~NotifyResponse();
+
+ NotifyResponse(const NotifyResponse& from);
+
+ inline NotifyResponse& operator=(const NotifyResponse& from) {
+ CopyFrom(from);
+ return *this;
+ }
+
+ inline const ::std::string& unknown_fields() const {
+ return _unknown_fields_;
+ }
+
+ inline ::std::string* mutable_unknown_fields() {
+ return &_unknown_fields_;
+ }
+
+ static const NotifyResponse& default_instance();
+
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ // Returns the internal default instance pointer. This function can
+ // return NULL thus should not be used by the user. This is intended
+ // for Protobuf internal code. Please use default_instance() declared
+ // above instead.
+ static inline const NotifyResponse* internal_default_instance() {
+ return default_instance_;
+ }
+ #endif
+
+ void Swap(NotifyResponse* other);
+
+ // implements Message ----------------------------------------------
+
+ NotifyResponse* New() const;
+ void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from);
+ void CopyFrom(const NotifyResponse& from);
+ void MergeFrom(const NotifyResponse& from);
+ void Clear();
+ bool IsInitialized() const;
+
+ int ByteSize() const;
+ bool MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input);
+ void SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const;
+ void DiscardUnknownFields();
+ int GetCachedSize() const { return _cached_size_; }
+ private:
+ void SharedCtor();
+ void SharedDtor();
+ void SetCachedSize(int size) const;
+ public:
+ ::std::string GetTypeName() const;
+
+ // nested types ----------------------------------------------------
+
+ // accessors -------------------------------------------------------
+
+ // @@protoc_insertion_point(class_scope:com.trustonic.tee_proxy.NotifyResponse)
+ private:
+
+ ::std::string _unknown_fields_;
+
+ ::google::protobuf::uint32 _has_bits_[1];
+ mutable int _cached_size_;
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ friend void protobuf_AddDesc_mc_2eproto_impl();
+ #else
+ friend void protobuf_AddDesc_mc_2eproto();
+ #endif
+ friend void protobuf_AssignDesc_mc_2eproto();
+ friend void protobuf_ShutdownFile_mc_2eproto();
+
+ void InitAsDefaultInstance();
+ static NotifyResponse* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class WaitNotificationRequest : public ::google::protobuf::MessageLite {
+ public:
+ WaitNotificationRequest();
+ virtual ~WaitNotificationRequest();
+
+ WaitNotificationRequest(const WaitNotificationRequest& from);
+
+ inline WaitNotificationRequest& operator=(const WaitNotificationRequest& from) {
+ CopyFrom(from);
+ return *this;
+ }
+
+ inline const ::std::string& unknown_fields() const {
+ return _unknown_fields_;
+ }
+
+ inline ::std::string* mutable_unknown_fields() {
+ return &_unknown_fields_;
+ }
+
+ static const WaitNotificationRequest& default_instance();
+
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ // Returns the internal default instance pointer. This function can
+ // return NULL thus should not be used by the user. This is intended
+ // for Protobuf internal code. Please use default_instance() declared
+ // above instead.
+ static inline const WaitNotificationRequest* internal_default_instance() {
+ return default_instance_;
+ }
+ #endif
+
+ void Swap(WaitNotificationRequest* other);
+
+ // implements Message ----------------------------------------------
+
+ WaitNotificationRequest* New() const;
+ void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from);
+ void CopyFrom(const WaitNotificationRequest& from);
+ void MergeFrom(const WaitNotificationRequest& from);
+ void Clear();
+ bool IsInitialized() const;
+
+ int ByteSize() const;
+ bool MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input);
+ void SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const;
+ void DiscardUnknownFields();
+ int GetCachedSize() const { return _cached_size_; }
+ private:
+ void SharedCtor();
+ void SharedDtor();
+ void SetCachedSize(int size) const;
+ public:
+ ::std::string GetTypeName() const;
+
+ // nested types ----------------------------------------------------
+
+ // accessors -------------------------------------------------------
+
+ // required uint32 sid = 1;
+ inline bool has_sid() const;
+ inline void clear_sid();
+ static const int kSidFieldNumber = 1;
+ inline ::google::protobuf::uint32 sid() const;
+ inline void set_sid(::google::protobuf::uint32 value);
+
+ // required sint32 timeout = 2;
+ inline bool has_timeout() const;
+ inline void clear_timeout();
+ static const int kTimeoutFieldNumber = 2;
+ inline ::google::protobuf::int32 timeout() const;
+ inline void set_timeout(::google::protobuf::int32 value);
+
+ // required bool partial = 3;
+ inline bool has_partial() const;
+ inline void clear_partial();
+ static const int kPartialFieldNumber = 3;
+ inline bool partial() const;
+ inline void set_partial(bool value);
+
+ // @@protoc_insertion_point(class_scope:com.trustonic.tee_proxy.WaitNotificationRequest)
+ private:
+ inline void set_has_sid();
+ inline void clear_has_sid();
+ inline void set_has_timeout();
+ inline void clear_has_timeout();
+ inline void set_has_partial();
+ inline void clear_has_partial();
+
+ ::std::string _unknown_fields_;
+
+ ::google::protobuf::uint32 _has_bits_[1];
+ mutable int _cached_size_;
+ ::google::protobuf::uint32 sid_;
+ ::google::protobuf::int32 timeout_;
+ bool partial_;
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ friend void protobuf_AddDesc_mc_2eproto_impl();
+ #else
+ friend void protobuf_AddDesc_mc_2eproto();
+ #endif
+ friend void protobuf_AssignDesc_mc_2eproto();
+ friend void protobuf_ShutdownFile_mc_2eproto();
+
+ void InitAsDefaultInstance();
+ static WaitNotificationRequest* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class WaitNotificationResponse_Buffers : public ::google::protobuf::MessageLite {
+ public:
+ WaitNotificationResponse_Buffers();
+ virtual ~WaitNotificationResponse_Buffers();
+
+ WaitNotificationResponse_Buffers(const WaitNotificationResponse_Buffers& from);
+
+ inline WaitNotificationResponse_Buffers& operator=(const WaitNotificationResponse_Buffers& from) {
+ CopyFrom(from);
+ return *this;
+ }
+
+ inline const ::std::string& unknown_fields() const {
+ return _unknown_fields_;
+ }
+
+ inline ::std::string* mutable_unknown_fields() {
+ return &_unknown_fields_;
+ }
+
+ static const WaitNotificationResponse_Buffers& default_instance();
+
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ // Returns the internal default instance pointer. This function can
+ // return NULL thus should not be used by the user. This is intended
+ // for Protobuf internal code. Please use default_instance() declared
+ // above instead.
+ static inline const WaitNotificationResponse_Buffers* internal_default_instance() {
+ return default_instance_;
+ }
+ #endif
+
+ void Swap(WaitNotificationResponse_Buffers* other);
+
+ // implements Message ----------------------------------------------
+
+ WaitNotificationResponse_Buffers* New() const;
+ void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from);
+ void CopyFrom(const WaitNotificationResponse_Buffers& from);
+ void MergeFrom(const WaitNotificationResponse_Buffers& from);
+ void Clear();
+ bool IsInitialized() const;
+
+ int ByteSize() const;
+ bool MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input);
+ void SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const;
+ void DiscardUnknownFields();
+ int GetCachedSize() const { return _cached_size_; }
+ private:
+ void SharedCtor();
+ void SharedDtor();
+ void SetCachedSize(int size) const;
+ public:
+ ::std::string GetTypeName() const;
+
+ // nested types ----------------------------------------------------
+
+ // accessors -------------------------------------------------------
+
+ // required uint64 sva = 1;
+ inline bool has_sva() const;
+ inline void clear_sva();
+ static const int kSvaFieldNumber = 1;
+ inline ::google::protobuf::uint64 sva() const;
+ inline void set_sva(::google::protobuf::uint64 value);
+
+ // required bytes data = 2;
+ inline bool has_data() const;
+ inline void clear_data();
+ static const int kDataFieldNumber = 2;
+ inline const ::std::string& data() const;
+ inline void set_data(const ::std::string& value);
+ inline void set_data(const char* value);
+ inline void set_data(const void* value, size_t size);
+ inline ::std::string* mutable_data();
+ inline ::std::string* release_data();
+ inline void set_allocated_data(::std::string* data);
+
+ // @@protoc_insertion_point(class_scope:com.trustonic.tee_proxy.WaitNotificationResponse.Buffers)
+ private:
+ inline void set_has_sva();
+ inline void clear_has_sva();
+ inline void set_has_data();
+ inline void clear_has_data();
+
+ ::std::string _unknown_fields_;
+
+ ::google::protobuf::uint32 _has_bits_[1];
+ mutable int _cached_size_;
+ ::google::protobuf::uint64 sva_;
+ ::std::string* data_;
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ friend void protobuf_AddDesc_mc_2eproto_impl();
+ #else
+ friend void protobuf_AddDesc_mc_2eproto();
+ #endif
+ friend void protobuf_AssignDesc_mc_2eproto();
+ friend void protobuf_ShutdownFile_mc_2eproto();
+
+ void InitAsDefaultInstance();
+ static WaitNotificationResponse_Buffers* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class WaitNotificationResponse : public ::google::protobuf::MessageLite {
+ public:
+ WaitNotificationResponse();
+ virtual ~WaitNotificationResponse();
+
+ WaitNotificationResponse(const WaitNotificationResponse& from);
+
+ inline WaitNotificationResponse& operator=(const WaitNotificationResponse& from) {
+ CopyFrom(from);
+ return *this;
+ }
+
+ inline const ::std::string& unknown_fields() const {
+ return _unknown_fields_;
+ }
+
+ inline ::std::string* mutable_unknown_fields() {
+ return &_unknown_fields_;
+ }
+
+ static const WaitNotificationResponse& default_instance();
+
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ // Returns the internal default instance pointer. This function can
+ // return NULL thus should not be used by the user. This is intended
+ // for Protobuf internal code. Please use default_instance() declared
+ // above instead.
+ static inline const WaitNotificationResponse* internal_default_instance() {
+ return default_instance_;
+ }
+ #endif
+
+ void Swap(WaitNotificationResponse* other);
+
+ // implements Message ----------------------------------------------
+
+ WaitNotificationResponse* New() const;
+ void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from);
+ void CopyFrom(const WaitNotificationResponse& from);
+ void MergeFrom(const WaitNotificationResponse& from);
+ void Clear();
+ bool IsInitialized() const;
+
+ int ByteSize() const;
+ bool MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input);
+ void SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const;
+ void DiscardUnknownFields();
+ int GetCachedSize() const { return _cached_size_; }
+ private:
+ void SharedCtor();
+ void SharedDtor();
+ void SetCachedSize(int size) const;
+ public:
+ ::std::string GetTypeName() const;
+
+ // nested types ----------------------------------------------------
+
+ typedef WaitNotificationResponse_Buffers Buffers;
+
+ // accessors -------------------------------------------------------
+
+ // optional bytes tci = 1;
+ inline bool has_tci() const;
+ inline void clear_tci();
+ static const int kTciFieldNumber = 1;
+ inline const ::std::string& tci() const;
+ inline void set_tci(const ::std::string& value);
+ inline void set_tci(const char* value);
+ inline void set_tci(const void* value, size_t size);
+ inline ::std::string* mutable_tci();
+ inline ::std::string* release_tci();
+ inline void set_allocated_tci(::std::string* tci);
+
+ // repeated .com.trustonic.tee_proxy.WaitNotificationResponse.Buffers buffers = 2;
+ inline int buffers_size() const;
+ inline void clear_buffers();
+ static const int kBuffersFieldNumber = 2;
+ inline const ::com::trustonic::tee_proxy::WaitNotificationResponse_Buffers& buffers(int index) const;
+ inline ::com::trustonic::tee_proxy::WaitNotificationResponse_Buffers* mutable_buffers(int index);
+ inline ::com::trustonic::tee_proxy::WaitNotificationResponse_Buffers* add_buffers();
+ inline const ::google::protobuf::RepeatedPtrField< ::com::trustonic::tee_proxy::WaitNotificationResponse_Buffers >&
+ buffers() const;
+ inline ::google::protobuf::RepeatedPtrField< ::com::trustonic::tee_proxy::WaitNotificationResponse_Buffers >*
+ mutable_buffers();
+
+ // @@protoc_insertion_point(class_scope:com.trustonic.tee_proxy.WaitNotificationResponse)
+ private:
+ inline void set_has_tci();
+ inline void clear_has_tci();
+
+ ::std::string _unknown_fields_;
+
+ ::google::protobuf::uint32 _has_bits_[1];
+ mutable int _cached_size_;
+ ::std::string* tci_;
+ ::google::protobuf::RepeatedPtrField< ::com::trustonic::tee_proxy::WaitNotificationResponse_Buffers > buffers_;
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ friend void protobuf_AddDesc_mc_2eproto_impl();
+ #else
+ friend void protobuf_AddDesc_mc_2eproto();
+ #endif
+ friend void protobuf_AssignDesc_mc_2eproto();
+ friend void protobuf_ShutdownFile_mc_2eproto();
+
+ void InitAsDefaultInstance();
+ static WaitNotificationResponse* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class MapRequest_Buffers : public ::google::protobuf::MessageLite {
+ public:
+ MapRequest_Buffers();
+ virtual ~MapRequest_Buffers();
+
+ MapRequest_Buffers(const MapRequest_Buffers& from);
+
+ inline MapRequest_Buffers& operator=(const MapRequest_Buffers& from) {
+ CopyFrom(from);
+ return *this;
+ }
+
+ inline const ::std::string& unknown_fields() const {
+ return _unknown_fields_;
+ }
+
+ inline ::std::string* mutable_unknown_fields() {
+ return &_unknown_fields_;
+ }
+
+ static const MapRequest_Buffers& default_instance();
+
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ // Returns the internal default instance pointer. This function can
+ // return NULL thus should not be used by the user. This is intended
+ // for Protobuf internal code. Please use default_instance() declared
+ // above instead.
+ static inline const MapRequest_Buffers* internal_default_instance() {
+ return default_instance_;
+ }
+ #endif
+
+ void Swap(MapRequest_Buffers* other);
+
+ // implements Message ----------------------------------------------
+
+ MapRequest_Buffers* New() const;
+ void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from);
+ void CopyFrom(const MapRequest_Buffers& from);
+ void MergeFrom(const MapRequest_Buffers& from);
+ void Clear();
+ bool IsInitialized() const;
+
+ int ByteSize() const;
+ bool MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input);
+ void SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const;
+ void DiscardUnknownFields();
+ int GetCachedSize() const { return _cached_size_; }
+ private:
+ void SharedCtor();
+ void SharedDtor();
+ void SetCachedSize(int size) const;
+ public:
+ ::std::string GetTypeName() const;
+
+ // nested types ----------------------------------------------------
+
+ // accessors -------------------------------------------------------
+
+ // required uint32 len = 1;
+ inline bool has_len() const;
+ inline void clear_len();
+ static const int kLenFieldNumber = 1;
+ inline ::google::protobuf::uint32 len() const;
+ inline void set_len(::google::protobuf::uint32 value);
+
+ // required uint32 flags = 2;
+ inline bool has_flags() const;
+ inline void clear_flags();
+ static const int kFlagsFieldNumber = 2;
+ inline ::google::protobuf::uint32 flags() const;
+ inline void set_flags(::google::protobuf::uint32 value);
+
+ // @@protoc_insertion_point(class_scope:com.trustonic.tee_proxy.MapRequest.Buffers)
+ private:
+ inline void set_has_len();
+ inline void clear_has_len();
+ inline void set_has_flags();
+ inline void clear_has_flags();
+
+ ::std::string _unknown_fields_;
+
+ ::google::protobuf::uint32 _has_bits_[1];
+ mutable int _cached_size_;
+ ::google::protobuf::uint32 len_;
+ ::google::protobuf::uint32 flags_;
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ friend void protobuf_AddDesc_mc_2eproto_impl();
+ #else
+ friend void protobuf_AddDesc_mc_2eproto();
+ #endif
+ friend void protobuf_AssignDesc_mc_2eproto();
+ friend void protobuf_ShutdownFile_mc_2eproto();
+
+ void InitAsDefaultInstance();
+ static MapRequest_Buffers* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class MapRequest : public ::google::protobuf::MessageLite {
+ public:
+ MapRequest();
+ virtual ~MapRequest();
+
+ MapRequest(const MapRequest& from);
+
+ inline MapRequest& operator=(const MapRequest& from) {
+ CopyFrom(from);
+ return *this;
+ }
+
+ inline const ::std::string& unknown_fields() const {
+ return _unknown_fields_;
+ }
+
+ inline ::std::string* mutable_unknown_fields() {
+ return &_unknown_fields_;
+ }
+
+ static const MapRequest& default_instance();
+
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ // Returns the internal default instance pointer. This function can
+ // return NULL thus should not be used by the user. This is intended
+ // for Protobuf internal code. Please use default_instance() declared
+ // above instead.
+ static inline const MapRequest* internal_default_instance() {
+ return default_instance_;
+ }
+ #endif
+
+ void Swap(MapRequest* other);
+
+ // implements Message ----------------------------------------------
+
+ MapRequest* New() const;
+ void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from);
+ void CopyFrom(const MapRequest& from);
+ void MergeFrom(const MapRequest& from);
+ void Clear();
+ bool IsInitialized() const;
+
+ int ByteSize() const;
+ bool MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input);
+ void SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const;
+ void DiscardUnknownFields();
+ int GetCachedSize() const { return _cached_size_; }
+ private:
+ void SharedCtor();
+ void SharedDtor();
+ void SetCachedSize(int size) const;
+ public:
+ ::std::string GetTypeName() const;
+
+ // nested types ----------------------------------------------------
+
+ typedef MapRequest_Buffers Buffers;
+
+ // accessors -------------------------------------------------------
+
+ // required uint32 sid = 1;
+ inline bool has_sid() const;
+ inline void clear_sid();
+ static const int kSidFieldNumber = 1;
+ inline ::google::protobuf::uint32 sid() const;
+ inline void set_sid(::google::protobuf::uint32 value);
+
+ // repeated .com.trustonic.tee_proxy.MapRequest.Buffers buffers = 2;
+ inline int buffers_size() const;
+ inline void clear_buffers();
+ static const int kBuffersFieldNumber = 2;
+ inline const ::com::trustonic::tee_proxy::MapRequest_Buffers& buffers(int index) const;
+ inline ::com::trustonic::tee_proxy::MapRequest_Buffers* mutable_buffers(int index);
+ inline ::com::trustonic::tee_proxy::MapRequest_Buffers* add_buffers();
+ inline const ::google::protobuf::RepeatedPtrField< ::com::trustonic::tee_proxy::MapRequest_Buffers >&
+ buffers() const;
+ inline ::google::protobuf::RepeatedPtrField< ::com::trustonic::tee_proxy::MapRequest_Buffers >*
+ mutable_buffers();
+
+ // @@protoc_insertion_point(class_scope:com.trustonic.tee_proxy.MapRequest)
+ private:
+ inline void set_has_sid();
+ inline void clear_has_sid();
+
+ ::std::string _unknown_fields_;
+
+ ::google::protobuf::uint32 _has_bits_[1];
+ mutable int _cached_size_;
+ ::google::protobuf::RepeatedPtrField< ::com::trustonic::tee_proxy::MapRequest_Buffers > buffers_;
+ ::google::protobuf::uint32 sid_;
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ friend void protobuf_AddDesc_mc_2eproto_impl();
+ #else
+ friend void protobuf_AddDesc_mc_2eproto();
+ #endif
+ friend void protobuf_AssignDesc_mc_2eproto();
+ friend void protobuf_ShutdownFile_mc_2eproto();
+
+ void InitAsDefaultInstance();
+ static MapRequest* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class MapResponse_Buffers : public ::google::protobuf::MessageLite {
+ public:
+ MapResponse_Buffers();
+ virtual ~MapResponse_Buffers();
+
+ MapResponse_Buffers(const MapResponse_Buffers& from);
+
+ inline MapResponse_Buffers& operator=(const MapResponse_Buffers& from) {
+ CopyFrom(from);
+ return *this;
+ }
+
+ inline const ::std::string& unknown_fields() const {
+ return _unknown_fields_;
+ }
+
+ inline ::std::string* mutable_unknown_fields() {
+ return &_unknown_fields_;
+ }
+
+ static const MapResponse_Buffers& default_instance();
+
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ // Returns the internal default instance pointer. This function can
+ // return NULL thus should not be used by the user. This is intended
+ // for Protobuf internal code. Please use default_instance() declared
+ // above instead.
+ static inline const MapResponse_Buffers* internal_default_instance() {
+ return default_instance_;
+ }
+ #endif
+
+ void Swap(MapResponse_Buffers* other);
+
+ // implements Message ----------------------------------------------
+
+ MapResponse_Buffers* New() const;
+ void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from);
+ void CopyFrom(const MapResponse_Buffers& from);
+ void MergeFrom(const MapResponse_Buffers& from);
+ void Clear();
+ bool IsInitialized() const;
+
+ int ByteSize() const;
+ bool MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input);
+ void SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const;
+ void DiscardUnknownFields();
+ int GetCachedSize() const { return _cached_size_; }
+ private:
+ void SharedCtor();
+ void SharedDtor();
+ void SetCachedSize(int size) const;
+ public:
+ ::std::string GetTypeName() const;
+
+ // nested types ----------------------------------------------------
+
+ // accessors -------------------------------------------------------
+
+ // required uint64 sva = 1;
+ inline bool has_sva() const;
+ inline void clear_sva();
+ static const int kSvaFieldNumber = 1;
+ inline ::google::protobuf::uint64 sva() const;
+ inline void set_sva(::google::protobuf::uint64 value);
+
+ // @@protoc_insertion_point(class_scope:com.trustonic.tee_proxy.MapResponse.Buffers)
+ private:
+ inline void set_has_sva();
+ inline void clear_has_sva();
+
+ ::std::string _unknown_fields_;
+
+ ::google::protobuf::uint32 _has_bits_[1];
+ mutable int _cached_size_;
+ ::google::protobuf::uint64 sva_;
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ friend void protobuf_AddDesc_mc_2eproto_impl();
+ #else
+ friend void protobuf_AddDesc_mc_2eproto();
+ #endif
+ friend void protobuf_AssignDesc_mc_2eproto();
+ friend void protobuf_ShutdownFile_mc_2eproto();
+
+ void InitAsDefaultInstance();
+ static MapResponse_Buffers* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class MapResponse : public ::google::protobuf::MessageLite {
+ public:
+ MapResponse();
+ virtual ~MapResponse();
+
+ MapResponse(const MapResponse& from);
+
+ inline MapResponse& operator=(const MapResponse& from) {
+ CopyFrom(from);
+ return *this;
+ }
+
+ inline const ::std::string& unknown_fields() const {
+ return _unknown_fields_;
+ }
+
+ inline ::std::string* mutable_unknown_fields() {
+ return &_unknown_fields_;
+ }
+
+ static const MapResponse& default_instance();
+
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ // Returns the internal default instance pointer. This function can
+ // return NULL thus should not be used by the user. This is intended
+ // for Protobuf internal code. Please use default_instance() declared
+ // above instead.
+ static inline const MapResponse* internal_default_instance() {
+ return default_instance_;
+ }
+ #endif
+
+ void Swap(MapResponse* other);
+
+ // implements Message ----------------------------------------------
+
+ MapResponse* New() const;
+ void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from);
+ void CopyFrom(const MapResponse& from);
+ void MergeFrom(const MapResponse& from);
+ void Clear();
+ bool IsInitialized() const;
+
+ int ByteSize() const;
+ bool MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input);
+ void SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const;
+ void DiscardUnknownFields();
+ int GetCachedSize() const { return _cached_size_; }
+ private:
+ void SharedCtor();
+ void SharedDtor();
+ void SetCachedSize(int size) const;
+ public:
+ ::std::string GetTypeName() const;
+
+ // nested types ----------------------------------------------------
+
+ typedef MapResponse_Buffers Buffers;
+
+ // accessors -------------------------------------------------------
+
+ // repeated .com.trustonic.tee_proxy.MapResponse.Buffers buffers = 1;
+ inline int buffers_size() const;
+ inline void clear_buffers();
+ static const int kBuffersFieldNumber = 1;
+ inline const ::com::trustonic::tee_proxy::MapResponse_Buffers& buffers(int index) const;
+ inline ::com::trustonic::tee_proxy::MapResponse_Buffers* mutable_buffers(int index);
+ inline ::com::trustonic::tee_proxy::MapResponse_Buffers* add_buffers();
+ inline const ::google::protobuf::RepeatedPtrField< ::com::trustonic::tee_proxy::MapResponse_Buffers >&
+ buffers() const;
+ inline ::google::protobuf::RepeatedPtrField< ::com::trustonic::tee_proxy::MapResponse_Buffers >*
+ mutable_buffers();
+
+ // @@protoc_insertion_point(class_scope:com.trustonic.tee_proxy.MapResponse)
+ private:
+
+ ::std::string _unknown_fields_;
+
+ ::google::protobuf::uint32 _has_bits_[1];
+ mutable int _cached_size_;
+ ::google::protobuf::RepeatedPtrField< ::com::trustonic::tee_proxy::MapResponse_Buffers > buffers_;
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ friend void protobuf_AddDesc_mc_2eproto_impl();
+ #else
+ friend void protobuf_AddDesc_mc_2eproto();
+ #endif
+ friend void protobuf_AssignDesc_mc_2eproto();
+ friend void protobuf_ShutdownFile_mc_2eproto();
+
+ void InitAsDefaultInstance();
+ static MapResponse* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class UnmapRequest_Buffers : public ::google::protobuf::MessageLite {
+ public:
+ UnmapRequest_Buffers();
+ virtual ~UnmapRequest_Buffers();
+
+ UnmapRequest_Buffers(const UnmapRequest_Buffers& from);
+
+ inline UnmapRequest_Buffers& operator=(const UnmapRequest_Buffers& from) {
+ CopyFrom(from);
+ return *this;
+ }
+
+ inline const ::std::string& unknown_fields() const {
+ return _unknown_fields_;
+ }
+
+ inline ::std::string* mutable_unknown_fields() {
+ return &_unknown_fields_;
+ }
+
+ static const UnmapRequest_Buffers& default_instance();
+
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ // Returns the internal default instance pointer. This function can
+ // return NULL thus should not be used by the user. This is intended
+ // for Protobuf internal code. Please use default_instance() declared
+ // above instead.
+ static inline const UnmapRequest_Buffers* internal_default_instance() {
+ return default_instance_;
+ }
+ #endif
+
+ void Swap(UnmapRequest_Buffers* other);
+
+ // implements Message ----------------------------------------------
+
+ UnmapRequest_Buffers* New() const;
+ void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from);
+ void CopyFrom(const UnmapRequest_Buffers& from);
+ void MergeFrom(const UnmapRequest_Buffers& from);
+ void Clear();
+ bool IsInitialized() const;
+
+ int ByteSize() const;
+ bool MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input);
+ void SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const;
+ void DiscardUnknownFields();
+ int GetCachedSize() const { return _cached_size_; }
+ private:
+ void SharedCtor();
+ void SharedDtor();
+ void SetCachedSize(int size) const;
+ public:
+ ::std::string GetTypeName() const;
+
+ // nested types ----------------------------------------------------
+
+ // accessors -------------------------------------------------------
+
+ // required uint64 sva = 1;
+ inline bool has_sva() const;
+ inline void clear_sva();
+ static const int kSvaFieldNumber = 1;
+ inline ::google::protobuf::uint64 sva() const;
+ inline void set_sva(::google::protobuf::uint64 value);
+
+ // @@protoc_insertion_point(class_scope:com.trustonic.tee_proxy.UnmapRequest.Buffers)
+ private:
+ inline void set_has_sva();
+ inline void clear_has_sva();
+
+ ::std::string _unknown_fields_;
+
+ ::google::protobuf::uint32 _has_bits_[1];
+ mutable int _cached_size_;
+ ::google::protobuf::uint64 sva_;
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ friend void protobuf_AddDesc_mc_2eproto_impl();
+ #else
+ friend void protobuf_AddDesc_mc_2eproto();
+ #endif
+ friend void protobuf_AssignDesc_mc_2eproto();
+ friend void protobuf_ShutdownFile_mc_2eproto();
+
+ void InitAsDefaultInstance();
+ static UnmapRequest_Buffers* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class UnmapRequest : public ::google::protobuf::MessageLite {
+ public:
+ UnmapRequest();
+ virtual ~UnmapRequest();
+
+ UnmapRequest(const UnmapRequest& from);
+
+ inline UnmapRequest& operator=(const UnmapRequest& from) {
+ CopyFrom(from);
+ return *this;
+ }
+
+ inline const ::std::string& unknown_fields() const {
+ return _unknown_fields_;
+ }
+
+ inline ::std::string* mutable_unknown_fields() {
+ return &_unknown_fields_;
+ }
+
+ static const UnmapRequest& default_instance();
+
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ // Returns the internal default instance pointer. This function can
+ // return NULL thus should not be used by the user. This is intended
+ // for Protobuf internal code. Please use default_instance() declared
+ // above instead.
+ static inline const UnmapRequest* internal_default_instance() {
+ return default_instance_;
+ }
+ #endif
+
+ void Swap(UnmapRequest* other);
+
+ // implements Message ----------------------------------------------
+
+ UnmapRequest* New() const;
+ void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from);
+ void CopyFrom(const UnmapRequest& from);
+ void MergeFrom(const UnmapRequest& from);
+ void Clear();
+ bool IsInitialized() const;
+
+ int ByteSize() const;
+ bool MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input);
+ void SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const;
+ void DiscardUnknownFields();
+ int GetCachedSize() const { return _cached_size_; }
+ private:
+ void SharedCtor();
+ void SharedDtor();
+ void SetCachedSize(int size) const;
+ public:
+ ::std::string GetTypeName() const;
+
+ // nested types ----------------------------------------------------
+
+ typedef UnmapRequest_Buffers Buffers;
+
+ // accessors -------------------------------------------------------
+
+ // required uint32 sid = 1;
+ inline bool has_sid() const;
+ inline void clear_sid();
+ static const int kSidFieldNumber = 1;
+ inline ::google::protobuf::uint32 sid() const;
+ inline void set_sid(::google::protobuf::uint32 value);
+
+ // repeated .com.trustonic.tee_proxy.UnmapRequest.Buffers buffers = 2;
+ inline int buffers_size() const;
+ inline void clear_buffers();
+ static const int kBuffersFieldNumber = 2;
+ inline const ::com::trustonic::tee_proxy::UnmapRequest_Buffers& buffers(int index) const;
+ inline ::com::trustonic::tee_proxy::UnmapRequest_Buffers* mutable_buffers(int index);
+ inline ::com::trustonic::tee_proxy::UnmapRequest_Buffers* add_buffers();
+ inline const ::google::protobuf::RepeatedPtrField< ::com::trustonic::tee_proxy::UnmapRequest_Buffers >&
+ buffers() const;
+ inline ::google::protobuf::RepeatedPtrField< ::com::trustonic::tee_proxy::UnmapRequest_Buffers >*
+ mutable_buffers();
+
+ // @@protoc_insertion_point(class_scope:com.trustonic.tee_proxy.UnmapRequest)
+ private:
+ inline void set_has_sid();
+ inline void clear_has_sid();
+
+ ::std::string _unknown_fields_;
+
+ ::google::protobuf::uint32 _has_bits_[1];
+ mutable int _cached_size_;
+ ::google::protobuf::RepeatedPtrField< ::com::trustonic::tee_proxy::UnmapRequest_Buffers > buffers_;
+ ::google::protobuf::uint32 sid_;
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ friend void protobuf_AddDesc_mc_2eproto_impl();
+ #else
+ friend void protobuf_AddDesc_mc_2eproto();
+ #endif
+ friend void protobuf_AssignDesc_mc_2eproto();
+ friend void protobuf_ShutdownFile_mc_2eproto();
+
+ void InitAsDefaultInstance();
+ static UnmapRequest* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class UnmapResponse : public ::google::protobuf::MessageLite {
+ public:
+ UnmapResponse();
+ virtual ~UnmapResponse();
+
+ UnmapResponse(const UnmapResponse& from);
+
+ inline UnmapResponse& operator=(const UnmapResponse& from) {
+ CopyFrom(from);
+ return *this;
+ }
+
+ inline const ::std::string& unknown_fields() const {
+ return _unknown_fields_;
+ }
+
+ inline ::std::string* mutable_unknown_fields() {
+ return &_unknown_fields_;
+ }
+
+ static const UnmapResponse& default_instance();
+
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ // Returns the internal default instance pointer. This function can
+ // return NULL thus should not be used by the user. This is intended
+ // for Protobuf internal code. Please use default_instance() declared
+ // above instead.
+ static inline const UnmapResponse* internal_default_instance() {
+ return default_instance_;
+ }
+ #endif
+
+ void Swap(UnmapResponse* other);
+
+ // implements Message ----------------------------------------------
+
+ UnmapResponse* New() const;
+ void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from);
+ void CopyFrom(const UnmapResponse& from);
+ void MergeFrom(const UnmapResponse& from);
+ void Clear();
+ bool IsInitialized() const;
+
+ int ByteSize() const;
+ bool MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input);
+ void SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const;
+ void DiscardUnknownFields();
+ int GetCachedSize() const { return _cached_size_; }
+ private:
+ void SharedCtor();
+ void SharedDtor();
+ void SetCachedSize(int size) const;
+ public:
+ ::std::string GetTypeName() const;
+
+ // nested types ----------------------------------------------------
+
+ // accessors -------------------------------------------------------
+
+ // @@protoc_insertion_point(class_scope:com.trustonic.tee_proxy.UnmapResponse)
+ private:
+
+ ::std::string _unknown_fields_;
+
+ ::google::protobuf::uint32 _has_bits_[1];
+ mutable int _cached_size_;
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ friend void protobuf_AddDesc_mc_2eproto_impl();
+ #else
+ friend void protobuf_AddDesc_mc_2eproto();
+ #endif
+ friend void protobuf_AssignDesc_mc_2eproto();
+ friend void protobuf_ShutdownFile_mc_2eproto();
+
+ void InitAsDefaultInstance();
+ static UnmapResponse* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class GetErrorRequest : public ::google::protobuf::MessageLite {
+ public:
+ GetErrorRequest();
+ virtual ~GetErrorRequest();
+
+ GetErrorRequest(const GetErrorRequest& from);
+
+ inline GetErrorRequest& operator=(const GetErrorRequest& from) {
+ CopyFrom(from);
+ return *this;
+ }
+
+ inline const ::std::string& unknown_fields() const {
+ return _unknown_fields_;
+ }
+
+ inline ::std::string* mutable_unknown_fields() {
+ return &_unknown_fields_;
+ }
+
+ static const GetErrorRequest& default_instance();
+
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ // Returns the internal default instance pointer. This function can
+ // return NULL thus should not be used by the user. This is intended
+ // for Protobuf internal code. Please use default_instance() declared
+ // above instead.
+ static inline const GetErrorRequest* internal_default_instance() {
+ return default_instance_;
+ }
+ #endif
+
+ void Swap(GetErrorRequest* other);
+
+ // implements Message ----------------------------------------------
+
+ GetErrorRequest* New() const;
+ void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from);
+ void CopyFrom(const GetErrorRequest& from);
+ void MergeFrom(const GetErrorRequest& from);
+ void Clear();
+ bool IsInitialized() const;
+
+ int ByteSize() const;
+ bool MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input);
+ void SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const;
+ void DiscardUnknownFields();
+ int GetCachedSize() const { return _cached_size_; }
+ private:
+ void SharedCtor();
+ void SharedDtor();
+ void SetCachedSize(int size) const;
+ public:
+ ::std::string GetTypeName() const;
+
+ // nested types ----------------------------------------------------
+
+ // accessors -------------------------------------------------------
+
+ // required uint32 sid = 1;
+ inline bool has_sid() const;
+ inline void clear_sid();
+ static const int kSidFieldNumber = 1;
+ inline ::google::protobuf::uint32 sid() const;
+ inline void set_sid(::google::protobuf::uint32 value);
+
+ // @@protoc_insertion_point(class_scope:com.trustonic.tee_proxy.GetErrorRequest)
+ private:
+ inline void set_has_sid();
+ inline void clear_has_sid();
+
+ ::std::string _unknown_fields_;
+
+ ::google::protobuf::uint32 _has_bits_[1];
+ mutable int _cached_size_;
+ ::google::protobuf::uint32 sid_;
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ friend void protobuf_AddDesc_mc_2eproto_impl();
+ #else
+ friend void protobuf_AddDesc_mc_2eproto();
+ #endif
+ friend void protobuf_AssignDesc_mc_2eproto();
+ friend void protobuf_ShutdownFile_mc_2eproto();
+
+ void InitAsDefaultInstance();
+ static GetErrorRequest* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class GetErrorResponse : public ::google::protobuf::MessageLite {
+ public:
+ GetErrorResponse();
+ virtual ~GetErrorResponse();
+
+ GetErrorResponse(const GetErrorResponse& from);
+
+ inline GetErrorResponse& operator=(const GetErrorResponse& from) {
+ CopyFrom(from);
+ return *this;
+ }
+
+ inline const ::std::string& unknown_fields() const {
+ return _unknown_fields_;
+ }
+
+ inline ::std::string* mutable_unknown_fields() {
+ return &_unknown_fields_;
+ }
+
+ static const GetErrorResponse& default_instance();
+
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ // Returns the internal default instance pointer. This function can
+ // return NULL thus should not be used by the user. This is intended
+ // for Protobuf internal code. Please use default_instance() declared
+ // above instead.
+ static inline const GetErrorResponse* internal_default_instance() {
+ return default_instance_;
+ }
+ #endif
+
+ void Swap(GetErrorResponse* other);
+
+ // implements Message ----------------------------------------------
+
+ GetErrorResponse* New() const;
+ void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from);
+ void CopyFrom(const GetErrorResponse& from);
+ void MergeFrom(const GetErrorResponse& from);
+ void Clear();
+ bool IsInitialized() const;
+
+ int ByteSize() const;
+ bool MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input);
+ void SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const;
+ void DiscardUnknownFields();
+ int GetCachedSize() const { return _cached_size_; }
+ private:
+ void SharedCtor();
+ void SharedDtor();
+ void SetCachedSize(int size) const;
+ public:
+ ::std::string GetTypeName() const;
+
+ // nested types ----------------------------------------------------
+
+ // accessors -------------------------------------------------------
+
+ // required sint32 exit_code = 1;
+ inline bool has_exit_code() const;
+ inline void clear_exit_code();
+ static const int kExitCodeFieldNumber = 1;
+ inline ::google::protobuf::int32 exit_code() const;
+ inline void set_exit_code(::google::protobuf::int32 value);
+
+ // @@protoc_insertion_point(class_scope:com.trustonic.tee_proxy.GetErrorResponse)
+ private:
+ inline void set_has_exit_code();
+ inline void clear_has_exit_code();
+
+ ::std::string _unknown_fields_;
+
+ ::google::protobuf::uint32 _has_bits_[1];
+ mutable int _cached_size_;
+ ::google::protobuf::int32 exit_code_;
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ friend void protobuf_AddDesc_mc_2eproto_impl();
+ #else
+ friend void protobuf_AddDesc_mc_2eproto();
+ #endif
+ friend void protobuf_AssignDesc_mc_2eproto();
+ friend void protobuf_ShutdownFile_mc_2eproto();
+
+ void InitAsDefaultInstance();
+ static GetErrorResponse* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class GetVersionRequest : public ::google::protobuf::MessageLite {
+ public:
+ GetVersionRequest();
+ virtual ~GetVersionRequest();
+
+ GetVersionRequest(const GetVersionRequest& from);
+
+ inline GetVersionRequest& operator=(const GetVersionRequest& from) {
+ CopyFrom(from);
+ return *this;
+ }
+
+ inline const ::std::string& unknown_fields() const {
+ return _unknown_fields_;
+ }
+
+ inline ::std::string* mutable_unknown_fields() {
+ return &_unknown_fields_;
+ }
+
+ static const GetVersionRequest& default_instance();
+
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ // Returns the internal default instance pointer. This function can
+ // return NULL thus should not be used by the user. This is intended
+ // for Protobuf internal code. Please use default_instance() declared
+ // above instead.
+ static inline const GetVersionRequest* internal_default_instance() {
+ return default_instance_;
+ }
+ #endif
+
+ void Swap(GetVersionRequest* other);
+
+ // implements Message ----------------------------------------------
+
+ GetVersionRequest* New() const;
+ void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from);
+ void CopyFrom(const GetVersionRequest& from);
+ void MergeFrom(const GetVersionRequest& from);
+ void Clear();
+ bool IsInitialized() const;
+
+ int ByteSize() const;
+ bool MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input);
+ void SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const;
+ void DiscardUnknownFields();
+ int GetCachedSize() const { return _cached_size_; }
+ private:
+ void SharedCtor();
+ void SharedDtor();
+ void SetCachedSize(int size) const;
+ public:
+ ::std::string GetTypeName() const;
+
+ // nested types ----------------------------------------------------
+
+ // accessors -------------------------------------------------------
+
+ // @@protoc_insertion_point(class_scope:com.trustonic.tee_proxy.GetVersionRequest)
+ private:
+
+ ::std::string _unknown_fields_;
+
+ ::google::protobuf::uint32 _has_bits_[1];
+ mutable int _cached_size_;
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ friend void protobuf_AddDesc_mc_2eproto_impl();
+ #else
+ friend void protobuf_AddDesc_mc_2eproto();
+ #endif
+ friend void protobuf_AssignDesc_mc_2eproto();
+ friend void protobuf_ShutdownFile_mc_2eproto();
+
+ void InitAsDefaultInstance();
+ static GetVersionRequest* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class GetVersionResponse : public ::google::protobuf::MessageLite {
+ public:
+ GetVersionResponse();
+ virtual ~GetVersionResponse();
+
+ GetVersionResponse(const GetVersionResponse& from);
+
+ inline GetVersionResponse& operator=(const GetVersionResponse& from) {
+ CopyFrom(from);
+ return *this;
+ }
+
+ inline const ::std::string& unknown_fields() const {
+ return _unknown_fields_;
+ }
+
+ inline ::std::string* mutable_unknown_fields() {
+ return &_unknown_fields_;
+ }
+
+ static const GetVersionResponse& default_instance();
+
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ // Returns the internal default instance pointer. This function can
+ // return NULL thus should not be used by the user. This is intended
+ // for Protobuf internal code. Please use default_instance() declared
+ // above instead.
+ static inline const GetVersionResponse* internal_default_instance() {
+ return default_instance_;
+ }
+ #endif
+
+ void Swap(GetVersionResponse* other);
+
+ // implements Message ----------------------------------------------
+
+ GetVersionResponse* New() const;
+ void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from);
+ void CopyFrom(const GetVersionResponse& from);
+ void MergeFrom(const GetVersionResponse& from);
+ void Clear();
+ bool IsInitialized() const;
+
+ int ByteSize() const;
+ bool MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input);
+ void SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const;
+ void DiscardUnknownFields();
+ int GetCachedSize() const { return _cached_size_; }
+ private:
+ void SharedCtor();
+ void SharedDtor();
+ void SetCachedSize(int size) const;
+ public:
+ ::std::string GetTypeName() const;
+
+ // nested types ----------------------------------------------------
+
+ // accessors -------------------------------------------------------
+
+ // required string product_id = 1;
+ inline bool has_product_id() const;
+ inline void clear_product_id();
+ static const int kProductIdFieldNumber = 1;
+ inline const ::std::string& product_id() const;
+ inline void set_product_id(const ::std::string& value);
+ inline void set_product_id(const char* value);
+ inline void set_product_id(const char* value, size_t size);
+ inline ::std::string* mutable_product_id();
+ inline ::std::string* release_product_id();
+ inline void set_allocated_product_id(::std::string* product_id);
+
+ // required uint32 mci = 2;
+ inline bool has_mci() const;
+ inline void clear_mci();
+ static const int kMciFieldNumber = 2;
+ inline ::google::protobuf::uint32 mci() const;
+ inline void set_mci(::google::protobuf::uint32 value);
+
+ // required uint32 so = 3;
+ inline bool has_so() const;
+ inline void clear_so();
+ static const int kSoFieldNumber = 3;
+ inline ::google::protobuf::uint32 so() const;
+ inline void set_so(::google::protobuf::uint32 value);
+
+ // required uint32 mclf = 4;
+ inline bool has_mclf() const;
+ inline void clear_mclf();
+ static const int kMclfFieldNumber = 4;
+ inline ::google::protobuf::uint32 mclf() const;
+ inline void set_mclf(::google::protobuf::uint32 value);
+
+ // required uint32 container = 5;
+ inline bool has_container() const;
+ inline void clear_container();
+ static const int kContainerFieldNumber = 5;
+ inline ::google::protobuf::uint32 container() const;
+ inline void set_container(::google::protobuf::uint32 value);
+
+ // required uint32 mc_config = 6;
+ inline bool has_mc_config() const;
+ inline void clear_mc_config();
+ static const int kMcConfigFieldNumber = 6;
+ inline ::google::protobuf::uint32 mc_config() const;
+ inline void set_mc_config(::google::protobuf::uint32 value);
+
+ // required uint32 tl_api = 7;
+ inline bool has_tl_api() const;
+ inline void clear_tl_api();
+ static const int kTlApiFieldNumber = 7;
+ inline ::google::protobuf::uint32 tl_api() const;
+ inline void set_tl_api(::google::protobuf::uint32 value);
+
+ // required uint32 dr_api = 8;
+ inline bool has_dr_api() const;
+ inline void clear_dr_api();
+ static const int kDrApiFieldNumber = 8;
+ inline ::google::protobuf::uint32 dr_api() const;
+ inline void set_dr_api(::google::protobuf::uint32 value);
+
+ // required uint32 nwd = 9;
+ inline bool has_nwd() const;
+ inline void clear_nwd();
+ static const int kNwdFieldNumber = 9;
+ inline ::google::protobuf::uint32 nwd() const;
+ inline void set_nwd(::google::protobuf::uint32 value);
+
+ // @@protoc_insertion_point(class_scope:com.trustonic.tee_proxy.GetVersionResponse)
+ private:
+ inline void set_has_product_id();
+ inline void clear_has_product_id();
+ inline void set_has_mci();
+ inline void clear_has_mci();
+ inline void set_has_so();
+ inline void clear_has_so();
+ inline void set_has_mclf();
+ inline void clear_has_mclf();
+ inline void set_has_container();
+ inline void clear_has_container();
+ inline void set_has_mc_config();
+ inline void clear_has_mc_config();
+ inline void set_has_tl_api();
+ inline void clear_has_tl_api();
+ inline void set_has_dr_api();
+ inline void clear_has_dr_api();
+ inline void set_has_nwd();
+ inline void clear_has_nwd();
+
+ ::std::string _unknown_fields_;
+
+ ::google::protobuf::uint32 _has_bits_[1];
+ mutable int _cached_size_;
+ ::std::string* product_id_;
+ ::google::protobuf::uint32 mci_;
+ ::google::protobuf::uint32 so_;
+ ::google::protobuf::uint32 mclf_;
+ ::google::protobuf::uint32 container_;
+ ::google::protobuf::uint32 mc_config_;
+ ::google::protobuf::uint32 tl_api_;
+ ::google::protobuf::uint32 dr_api_;
+ ::google::protobuf::uint32 nwd_;
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ friend void protobuf_AddDesc_mc_2eproto_impl();
+ #else
+ friend void protobuf_AddDesc_mc_2eproto();
+ #endif
+ friend void protobuf_AssignDesc_mc_2eproto();
+ friend void protobuf_ShutdownFile_mc_2eproto();
+
+ void InitAsDefaultInstance();
+ static GetVersionResponse* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class GpRequestCancellationRequest : public ::google::protobuf::MessageLite {
+ public:
+ GpRequestCancellationRequest();
+ virtual ~GpRequestCancellationRequest();
+
+ GpRequestCancellationRequest(const GpRequestCancellationRequest& from);
+
+ inline GpRequestCancellationRequest& operator=(const GpRequestCancellationRequest& from) {
+ CopyFrom(from);
+ return *this;
+ }
+
+ inline const ::std::string& unknown_fields() const {
+ return _unknown_fields_;
+ }
+
+ inline ::std::string* mutable_unknown_fields() {
+ return &_unknown_fields_;
+ }
+
+ static const GpRequestCancellationRequest& default_instance();
+
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ // Returns the internal default instance pointer. This function can
+ // return NULL thus should not be used by the user. This is intended
+ // for Protobuf internal code. Please use default_instance() declared
+ // above instead.
+ static inline const GpRequestCancellationRequest* internal_default_instance() {
+ return default_instance_;
+ }
+ #endif
+
+ void Swap(GpRequestCancellationRequest* other);
+
+ // implements Message ----------------------------------------------
+
+ GpRequestCancellationRequest* New() const;
+ void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from);
+ void CopyFrom(const GpRequestCancellationRequest& from);
+ void MergeFrom(const GpRequestCancellationRequest& from);
+ void Clear();
+ bool IsInitialized() const;
+
+ int ByteSize() const;
+ bool MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input);
+ void SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const;
+ void DiscardUnknownFields();
+ int GetCachedSize() const { return _cached_size_; }
+ private:
+ void SharedCtor();
+ void SharedDtor();
+ void SetCachedSize(int size) const;
+ public:
+ ::std::string GetTypeName() const;
+
+ // nested types ----------------------------------------------------
+
+ // accessors -------------------------------------------------------
+
+ // required uint32 sid = 1;
+ inline bool has_sid() const;
+ inline void clear_sid();
+ static const int kSidFieldNumber = 1;
+ inline ::google::protobuf::uint32 sid() const;
+ inline void set_sid(::google::protobuf::uint32 value);
+
+ // @@protoc_insertion_point(class_scope:com.trustonic.tee_proxy.GpRequestCancellationRequest)
+ private:
+ inline void set_has_sid();
+ inline void clear_has_sid();
+
+ ::std::string _unknown_fields_;
+
+ ::google::protobuf::uint32 _has_bits_[1];
+ mutable int _cached_size_;
+ ::google::protobuf::uint32 sid_;
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ friend void protobuf_AddDesc_mc_2eproto_impl();
+ #else
+ friend void protobuf_AddDesc_mc_2eproto();
+ #endif
+ friend void protobuf_AssignDesc_mc_2eproto();
+ friend void protobuf_ShutdownFile_mc_2eproto();
+
+ void InitAsDefaultInstance();
+ static GpRequestCancellationRequest* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class GpRequestCancellationResponse : public ::google::protobuf::MessageLite {
+ public:
+ GpRequestCancellationResponse();
+ virtual ~GpRequestCancellationResponse();
+
+ GpRequestCancellationResponse(const GpRequestCancellationResponse& from);
+
+ inline GpRequestCancellationResponse& operator=(const GpRequestCancellationResponse& from) {
+ CopyFrom(from);
+ return *this;
+ }
+
+ inline const ::std::string& unknown_fields() const {
+ return _unknown_fields_;
+ }
+
+ inline ::std::string* mutable_unknown_fields() {
+ return &_unknown_fields_;
+ }
+
+ static const GpRequestCancellationResponse& default_instance();
+
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ // Returns the internal default instance pointer. This function can
+ // return NULL thus should not be used by the user. This is intended
+ // for Protobuf internal code. Please use default_instance() declared
+ // above instead.
+ static inline const GpRequestCancellationResponse* internal_default_instance() {
+ return default_instance_;
+ }
+ #endif
+
+ void Swap(GpRequestCancellationResponse* other);
+
+ // implements Message ----------------------------------------------
+
+ GpRequestCancellationResponse* New() const;
+ void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from);
+ void CopyFrom(const GpRequestCancellationResponse& from);
+ void MergeFrom(const GpRequestCancellationResponse& from);
+ void Clear();
+ bool IsInitialized() const;
+
+ int ByteSize() const;
+ bool MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input);
+ void SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const;
+ void DiscardUnknownFields();
+ int GetCachedSize() const { return _cached_size_; }
+ private:
+ void SharedCtor();
+ void SharedDtor();
+ void SetCachedSize(int size) const;
+ public:
+ ::std::string GetTypeName() const;
+
+ // nested types ----------------------------------------------------
+
+ // accessors -------------------------------------------------------
+
+ // @@protoc_insertion_point(class_scope:com.trustonic.tee_proxy.GpRequestCancellationResponse)
+ private:
+
+ ::std::string _unknown_fields_;
+
+ ::google::protobuf::uint32 _has_bits_[1];
+ mutable int _cached_size_;
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ friend void protobuf_AddDesc_mc_2eproto_impl();
+ #else
+ friend void protobuf_AddDesc_mc_2eproto();
+ #endif
+ friend void protobuf_AssignDesc_mc_2eproto();
+ friend void protobuf_ShutdownFile_mc_2eproto();
+
+ void InitAsDefaultInstance();
+ static GpRequestCancellationResponse* default_instance_;
+};
+// ===================================================================
+
+
+// ===================================================================
+
+// OpenSessionRequest
+
+// required bytes uuid = 1;
+inline bool OpenSessionRequest::has_uuid() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+inline void OpenSessionRequest::set_has_uuid() {
+ _has_bits_[0] |= 0x00000001u;
+}
+inline void OpenSessionRequest::clear_has_uuid() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+inline void OpenSessionRequest::clear_uuid() {
+ if (uuid_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ uuid_->clear();
+ }
+ clear_has_uuid();
+}
+inline const ::std::string& OpenSessionRequest::uuid() const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.OpenSessionRequest.uuid)
+ return *uuid_;
+}
+inline void OpenSessionRequest::set_uuid(const ::std::string& value) {
+ set_has_uuid();
+ if (uuid_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ uuid_ = new ::std::string;
+ }
+ uuid_->assign(value);
+ // @@protoc_insertion_point(field_set:com.trustonic.tee_proxy.OpenSessionRequest.uuid)
+}
+inline void OpenSessionRequest::set_uuid(const char* value) {
+ set_has_uuid();
+ if (uuid_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ uuid_ = new ::std::string;
+ }
+ uuid_->assign(value);
+ // @@protoc_insertion_point(field_set_char:com.trustonic.tee_proxy.OpenSessionRequest.uuid)
+}
+inline void OpenSessionRequest::set_uuid(const void* value, size_t size) {
+ set_has_uuid();
+ if (uuid_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ uuid_ = new ::std::string;
+ }
+ uuid_->assign(reinterpret_cast<const char*>(value), size);
+ // @@protoc_insertion_point(field_set_pointer:com.trustonic.tee_proxy.OpenSessionRequest.uuid)
+}
+inline ::std::string* OpenSessionRequest::mutable_uuid() {
+ set_has_uuid();
+ if (uuid_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ uuid_ = new ::std::string;
+ }
+ // @@protoc_insertion_point(field_mutable:com.trustonic.tee_proxy.OpenSessionRequest.uuid)
+ return uuid_;
+}
+inline ::std::string* OpenSessionRequest::release_uuid() {
+ clear_has_uuid();
+ if (uuid_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ return NULL;
+ } else {
+ ::std::string* temp = uuid_;
+ uuid_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ return temp;
+ }
+}
+inline void OpenSessionRequest::set_allocated_uuid(::std::string* uuid) {
+ if (uuid_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ delete uuid_;
+ }
+ if (uuid) {
+ set_has_uuid();
+ uuid_ = uuid;
+ } else {
+ clear_has_uuid();
+ uuid_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ }
+ // @@protoc_insertion_point(field_set_allocated:com.trustonic.tee_proxy.OpenSessionRequest.uuid)
+}
+
+// required bool is_gp_uuid = 2;
+inline bool OpenSessionRequest::has_is_gp_uuid() const {
+ return (_has_bits_[0] & 0x00000002u) != 0;
+}
+inline void OpenSessionRequest::set_has_is_gp_uuid() {
+ _has_bits_[0] |= 0x00000002u;
+}
+inline void OpenSessionRequest::clear_has_is_gp_uuid() {
+ _has_bits_[0] &= ~0x00000002u;
+}
+inline void OpenSessionRequest::clear_is_gp_uuid() {
+ is_gp_uuid_ = false;
+ clear_has_is_gp_uuid();
+}
+inline bool OpenSessionRequest::is_gp_uuid() const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.OpenSessionRequest.is_gp_uuid)
+ return is_gp_uuid_;
+}
+inline void OpenSessionRequest::set_is_gp_uuid(bool value) {
+ set_has_is_gp_uuid();
+ is_gp_uuid_ = value;
+ // @@protoc_insertion_point(field_set:com.trustonic.tee_proxy.OpenSessionRequest.is_gp_uuid)
+}
+
+// optional bytes tci = 3;
+inline bool OpenSessionRequest::has_tci() const {
+ return (_has_bits_[0] & 0x00000004u) != 0;
+}
+inline void OpenSessionRequest::set_has_tci() {
+ _has_bits_[0] |= 0x00000004u;
+}
+inline void OpenSessionRequest::clear_has_tci() {
+ _has_bits_[0] &= ~0x00000004u;
+}
+inline void OpenSessionRequest::clear_tci() {
+ if (tci_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ tci_->clear();
+ }
+ clear_has_tci();
+}
+inline const ::std::string& OpenSessionRequest::tci() const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.OpenSessionRequest.tci)
+ return *tci_;
+}
+inline void OpenSessionRequest::set_tci(const ::std::string& value) {
+ set_has_tci();
+ if (tci_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ tci_ = new ::std::string;
+ }
+ tci_->assign(value);
+ // @@protoc_insertion_point(field_set:com.trustonic.tee_proxy.OpenSessionRequest.tci)
+}
+inline void OpenSessionRequest::set_tci(const char* value) {
+ set_has_tci();
+ if (tci_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ tci_ = new ::std::string;
+ }
+ tci_->assign(value);
+ // @@protoc_insertion_point(field_set_char:com.trustonic.tee_proxy.OpenSessionRequest.tci)
+}
+inline void OpenSessionRequest::set_tci(const void* value, size_t size) {
+ set_has_tci();
+ if (tci_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ tci_ = new ::std::string;
+ }
+ tci_->assign(reinterpret_cast<const char*>(value), size);
+ // @@protoc_insertion_point(field_set_pointer:com.trustonic.tee_proxy.OpenSessionRequest.tci)
+}
+inline ::std::string* OpenSessionRequest::mutable_tci() {
+ set_has_tci();
+ if (tci_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ tci_ = new ::std::string;
+ }
+ // @@protoc_insertion_point(field_mutable:com.trustonic.tee_proxy.OpenSessionRequest.tci)
+ return tci_;
+}
+inline ::std::string* OpenSessionRequest::release_tci() {
+ clear_has_tci();
+ if (tci_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ return NULL;
+ } else {
+ ::std::string* temp = tci_;
+ tci_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ return temp;
+ }
+}
+inline void OpenSessionRequest::set_allocated_tci(::std::string* tci) {
+ if (tci_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ delete tci_;
+ }
+ if (tci) {
+ set_has_tci();
+ tci_ = tci;
+ } else {
+ clear_has_tci();
+ tci_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ }
+ // @@protoc_insertion_point(field_set_allocated:com.trustonic.tee_proxy.OpenSessionRequest.tci)
+}
+
+// required .com.trustonic.tee_proxy.LoginType login_type = 4;
+inline bool OpenSessionRequest::has_login_type() const {
+ return (_has_bits_[0] & 0x00000008u) != 0;
+}
+inline void OpenSessionRequest::set_has_login_type() {
+ _has_bits_[0] |= 0x00000008u;
+}
+inline void OpenSessionRequest::clear_has_login_type() {
+ _has_bits_[0] &= ~0x00000008u;
+}
+inline void OpenSessionRequest::clear_login_type() {
+ login_type_ = 0;
+ clear_has_login_type();
+}
+inline ::com::trustonic::tee_proxy::LoginType OpenSessionRequest::login_type() const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.OpenSessionRequest.login_type)
+ return static_cast< ::com::trustonic::tee_proxy::LoginType >(login_type_);
+}
+inline void OpenSessionRequest::set_login_type(::com::trustonic::tee_proxy::LoginType value) {
+ assert(::com::trustonic::tee_proxy::LoginType_IsValid(value));
+ set_has_login_type();
+ login_type_ = value;
+ // @@protoc_insertion_point(field_set:com.trustonic.tee_proxy.OpenSessionRequest.login_type)
+}
+
+// required bytes login_data = 5;
+inline bool OpenSessionRequest::has_login_data() const {
+ return (_has_bits_[0] & 0x00000010u) != 0;
+}
+inline void OpenSessionRequest::set_has_login_data() {
+ _has_bits_[0] |= 0x00000010u;
+}
+inline void OpenSessionRequest::clear_has_login_data() {
+ _has_bits_[0] &= ~0x00000010u;
+}
+inline void OpenSessionRequest::clear_login_data() {
+ if (login_data_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ login_data_->clear();
+ }
+ clear_has_login_data();
+}
+inline const ::std::string& OpenSessionRequest::login_data() const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.OpenSessionRequest.login_data)
+ return *login_data_;
+}
+inline void OpenSessionRequest::set_login_data(const ::std::string& value) {
+ set_has_login_data();
+ if (login_data_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ login_data_ = new ::std::string;
+ }
+ login_data_->assign(value);
+ // @@protoc_insertion_point(field_set:com.trustonic.tee_proxy.OpenSessionRequest.login_data)
+}
+inline void OpenSessionRequest::set_login_data(const char* value) {
+ set_has_login_data();
+ if (login_data_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ login_data_ = new ::std::string;
+ }
+ login_data_->assign(value);
+ // @@protoc_insertion_point(field_set_char:com.trustonic.tee_proxy.OpenSessionRequest.login_data)
+}
+inline void OpenSessionRequest::set_login_data(const void* value, size_t size) {
+ set_has_login_data();
+ if (login_data_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ login_data_ = new ::std::string;
+ }
+ login_data_->assign(reinterpret_cast<const char*>(value), size);
+ // @@protoc_insertion_point(field_set_pointer:com.trustonic.tee_proxy.OpenSessionRequest.login_data)
+}
+inline ::std::string* OpenSessionRequest::mutable_login_data() {
+ set_has_login_data();
+ if (login_data_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ login_data_ = new ::std::string;
+ }
+ // @@protoc_insertion_point(field_mutable:com.trustonic.tee_proxy.OpenSessionRequest.login_data)
+ return login_data_;
+}
+inline ::std::string* OpenSessionRequest::release_login_data() {
+ clear_has_login_data();
+ if (login_data_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ return NULL;
+ } else {
+ ::std::string* temp = login_data_;
+ login_data_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ return temp;
+ }
+}
+inline void OpenSessionRequest::set_allocated_login_data(::std::string* login_data) {
+ if (login_data_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ delete login_data_;
+ }
+ if (login_data) {
+ set_has_login_data();
+ login_data_ = login_data;
+ } else {
+ clear_has_login_data();
+ login_data_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ }
+ // @@protoc_insertion_point(field_set_allocated:com.trustonic.tee_proxy.OpenSessionRequest.login_data)
+}
+
+// -------------------------------------------------------------------
+
+// OpenSessionResponse
+
+// required uint32 id = 1;
+inline bool OpenSessionResponse::has_id() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+inline void OpenSessionResponse::set_has_id() {
+ _has_bits_[0] |= 0x00000001u;
+}
+inline void OpenSessionResponse::clear_has_id() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+inline void OpenSessionResponse::clear_id() {
+ id_ = 0u;
+ clear_has_id();
+}
+inline ::google::protobuf::uint32 OpenSessionResponse::id() const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.OpenSessionResponse.id)
+ return id_;
+}
+inline void OpenSessionResponse::set_id(::google::protobuf::uint32 value) {
+ set_has_id();
+ id_ = value;
+ // @@protoc_insertion_point(field_set:com.trustonic.tee_proxy.OpenSessionResponse.id)
+}
+
+// -------------------------------------------------------------------
+
+// OpenTrustletRequest
+
+// required uint32 spid = 1;
+inline bool OpenTrustletRequest::has_spid() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+inline void OpenTrustletRequest::set_has_spid() {
+ _has_bits_[0] |= 0x00000001u;
+}
+inline void OpenTrustletRequest::clear_has_spid() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+inline void OpenTrustletRequest::clear_spid() {
+ spid_ = 0u;
+ clear_has_spid();
+}
+inline ::google::protobuf::uint32 OpenTrustletRequest::spid() const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.OpenTrustletRequest.spid)
+ return spid_;
+}
+inline void OpenTrustletRequest::set_spid(::google::protobuf::uint32 value) {
+ set_has_spid();
+ spid_ = value;
+ // @@protoc_insertion_point(field_set:com.trustonic.tee_proxy.OpenTrustletRequest.spid)
+}
+
+// required bytes trustapp = 2;
+inline bool OpenTrustletRequest::has_trustapp() const {
+ return (_has_bits_[0] & 0x00000002u) != 0;
+}
+inline void OpenTrustletRequest::set_has_trustapp() {
+ _has_bits_[0] |= 0x00000002u;
+}
+inline void OpenTrustletRequest::clear_has_trustapp() {
+ _has_bits_[0] &= ~0x00000002u;
+}
+inline void OpenTrustletRequest::clear_trustapp() {
+ if (trustapp_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ trustapp_->clear();
+ }
+ clear_has_trustapp();
+}
+inline const ::std::string& OpenTrustletRequest::trustapp() const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.OpenTrustletRequest.trustapp)
+ return *trustapp_;
+}
+inline void OpenTrustletRequest::set_trustapp(const ::std::string& value) {
+ set_has_trustapp();
+ if (trustapp_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ trustapp_ = new ::std::string;
+ }
+ trustapp_->assign(value);
+ // @@protoc_insertion_point(field_set:com.trustonic.tee_proxy.OpenTrustletRequest.trustapp)
+}
+inline void OpenTrustletRequest::set_trustapp(const char* value) {
+ set_has_trustapp();
+ if (trustapp_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ trustapp_ = new ::std::string;
+ }
+ trustapp_->assign(value);
+ // @@protoc_insertion_point(field_set_char:com.trustonic.tee_proxy.OpenTrustletRequest.trustapp)
+}
+inline void OpenTrustletRequest::set_trustapp(const void* value, size_t size) {
+ set_has_trustapp();
+ if (trustapp_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ trustapp_ = new ::std::string;
+ }
+ trustapp_->assign(reinterpret_cast<const char*>(value), size);
+ // @@protoc_insertion_point(field_set_pointer:com.trustonic.tee_proxy.OpenTrustletRequest.trustapp)
+}
+inline ::std::string* OpenTrustletRequest::mutable_trustapp() {
+ set_has_trustapp();
+ if (trustapp_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ trustapp_ = new ::std::string;
+ }
+ // @@protoc_insertion_point(field_mutable:com.trustonic.tee_proxy.OpenTrustletRequest.trustapp)
+ return trustapp_;
+}
+inline ::std::string* OpenTrustletRequest::release_trustapp() {
+ clear_has_trustapp();
+ if (trustapp_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ return NULL;
+ } else {
+ ::std::string* temp = trustapp_;
+ trustapp_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ return temp;
+ }
+}
+inline void OpenTrustletRequest::set_allocated_trustapp(::std::string* trustapp) {
+ if (trustapp_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ delete trustapp_;
+ }
+ if (trustapp) {
+ set_has_trustapp();
+ trustapp_ = trustapp;
+ } else {
+ clear_has_trustapp();
+ trustapp_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ }
+ // @@protoc_insertion_point(field_set_allocated:com.trustonic.tee_proxy.OpenTrustletRequest.trustapp)
+}
+
+// optional bytes tci = 3;
+inline bool OpenTrustletRequest::has_tci() const {
+ return (_has_bits_[0] & 0x00000004u) != 0;
+}
+inline void OpenTrustletRequest::set_has_tci() {
+ _has_bits_[0] |= 0x00000004u;
+}
+inline void OpenTrustletRequest::clear_has_tci() {
+ _has_bits_[0] &= ~0x00000004u;
+}
+inline void OpenTrustletRequest::clear_tci() {
+ if (tci_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ tci_->clear();
+ }
+ clear_has_tci();
+}
+inline const ::std::string& OpenTrustletRequest::tci() const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.OpenTrustletRequest.tci)
+ return *tci_;
+}
+inline void OpenTrustletRequest::set_tci(const ::std::string& value) {
+ set_has_tci();
+ if (tci_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ tci_ = new ::std::string;
+ }
+ tci_->assign(value);
+ // @@protoc_insertion_point(field_set:com.trustonic.tee_proxy.OpenTrustletRequest.tci)
+}
+inline void OpenTrustletRequest::set_tci(const char* value) {
+ set_has_tci();
+ if (tci_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ tci_ = new ::std::string;
+ }
+ tci_->assign(value);
+ // @@protoc_insertion_point(field_set_char:com.trustonic.tee_proxy.OpenTrustletRequest.tci)
+}
+inline void OpenTrustletRequest::set_tci(const void* value, size_t size) {
+ set_has_tci();
+ if (tci_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ tci_ = new ::std::string;
+ }
+ tci_->assign(reinterpret_cast<const char*>(value), size);
+ // @@protoc_insertion_point(field_set_pointer:com.trustonic.tee_proxy.OpenTrustletRequest.tci)
+}
+inline ::std::string* OpenTrustletRequest::mutable_tci() {
+ set_has_tci();
+ if (tci_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ tci_ = new ::std::string;
+ }
+ // @@protoc_insertion_point(field_mutable:com.trustonic.tee_proxy.OpenTrustletRequest.tci)
+ return tci_;
+}
+inline ::std::string* OpenTrustletRequest::release_tci() {
+ clear_has_tci();
+ if (tci_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ return NULL;
+ } else {
+ ::std::string* temp = tci_;
+ tci_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ return temp;
+ }
+}
+inline void OpenTrustletRequest::set_allocated_tci(::std::string* tci) {
+ if (tci_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ delete tci_;
+ }
+ if (tci) {
+ set_has_tci();
+ tci_ = tci;
+ } else {
+ clear_has_tci();
+ tci_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ }
+ // @@protoc_insertion_point(field_set_allocated:com.trustonic.tee_proxy.OpenTrustletRequest.tci)
+}
+
+// -------------------------------------------------------------------
+
+// OpenTrustletResponse
+
+// required uint32 id = 1;
+inline bool OpenTrustletResponse::has_id() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+inline void OpenTrustletResponse::set_has_id() {
+ _has_bits_[0] |= 0x00000001u;
+}
+inline void OpenTrustletResponse::clear_has_id() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+inline void OpenTrustletResponse::clear_id() {
+ id_ = 0u;
+ clear_has_id();
+}
+inline ::google::protobuf::uint32 OpenTrustletResponse::id() const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.OpenTrustletResponse.id)
+ return id_;
+}
+inline void OpenTrustletResponse::set_id(::google::protobuf::uint32 value) {
+ set_has_id();
+ id_ = value;
+ // @@protoc_insertion_point(field_set:com.trustonic.tee_proxy.OpenTrustletResponse.id)
+}
+
+// -------------------------------------------------------------------
+
+// CloseSessionRequest
+
+// required uint32 id = 1;
+inline bool CloseSessionRequest::has_id() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+inline void CloseSessionRequest::set_has_id() {
+ _has_bits_[0] |= 0x00000001u;
+}
+inline void CloseSessionRequest::clear_has_id() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+inline void CloseSessionRequest::clear_id() {
+ id_ = 0u;
+ clear_has_id();
+}
+inline ::google::protobuf::uint32 CloseSessionRequest::id() const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.CloseSessionRequest.id)
+ return id_;
+}
+inline void CloseSessionRequest::set_id(::google::protobuf::uint32 value) {
+ set_has_id();
+ id_ = value;
+ // @@protoc_insertion_point(field_set:com.trustonic.tee_proxy.CloseSessionRequest.id)
+}
+
+// -------------------------------------------------------------------
+
+// CloseSessionResponse
+
+// -------------------------------------------------------------------
+
+// NotifyRequest_Buffers
+
+// required uint64 sva = 1;
+inline bool NotifyRequest_Buffers::has_sva() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+inline void NotifyRequest_Buffers::set_has_sva() {
+ _has_bits_[0] |= 0x00000001u;
+}
+inline void NotifyRequest_Buffers::clear_has_sva() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+inline void NotifyRequest_Buffers::clear_sva() {
+ sva_ = GOOGLE_ULONGLONG(0);
+ clear_has_sva();
+}
+inline ::google::protobuf::uint64 NotifyRequest_Buffers::sva() const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.NotifyRequest.Buffers.sva)
+ return sva_;
+}
+inline void NotifyRequest_Buffers::set_sva(::google::protobuf::uint64 value) {
+ set_has_sva();
+ sva_ = value;
+ // @@protoc_insertion_point(field_set:com.trustonic.tee_proxy.NotifyRequest.Buffers.sva)
+}
+
+// required bytes data = 2;
+inline bool NotifyRequest_Buffers::has_data() const {
+ return (_has_bits_[0] & 0x00000002u) != 0;
+}
+inline void NotifyRequest_Buffers::set_has_data() {
+ _has_bits_[0] |= 0x00000002u;
+}
+inline void NotifyRequest_Buffers::clear_has_data() {
+ _has_bits_[0] &= ~0x00000002u;
+}
+inline void NotifyRequest_Buffers::clear_data() {
+ if (data_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ data_->clear();
+ }
+ clear_has_data();
+}
+inline const ::std::string& NotifyRequest_Buffers::data() const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.NotifyRequest.Buffers.data)
+ return *data_;
+}
+inline void NotifyRequest_Buffers::set_data(const ::std::string& value) {
+ set_has_data();
+ if (data_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ data_ = new ::std::string;
+ }
+ data_->assign(value);
+ // @@protoc_insertion_point(field_set:com.trustonic.tee_proxy.NotifyRequest.Buffers.data)
+}
+inline void NotifyRequest_Buffers::set_data(const char* value) {
+ set_has_data();
+ if (data_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ data_ = new ::std::string;
+ }
+ data_->assign(value);
+ // @@protoc_insertion_point(field_set_char:com.trustonic.tee_proxy.NotifyRequest.Buffers.data)
+}
+inline void NotifyRequest_Buffers::set_data(const void* value, size_t size) {
+ set_has_data();
+ if (data_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ data_ = new ::std::string;
+ }
+ data_->assign(reinterpret_cast<const char*>(value), size);
+ // @@protoc_insertion_point(field_set_pointer:com.trustonic.tee_proxy.NotifyRequest.Buffers.data)
+}
+inline ::std::string* NotifyRequest_Buffers::mutable_data() {
+ set_has_data();
+ if (data_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ data_ = new ::std::string;
+ }
+ // @@protoc_insertion_point(field_mutable:com.trustonic.tee_proxy.NotifyRequest.Buffers.data)
+ return data_;
+}
+inline ::std::string* NotifyRequest_Buffers::release_data() {
+ clear_has_data();
+ if (data_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ return NULL;
+ } else {
+ ::std::string* temp = data_;
+ data_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ return temp;
+ }
+}
+inline void NotifyRequest_Buffers::set_allocated_data(::std::string* data) {
+ if (data_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ delete data_;
+ }
+ if (data) {
+ set_has_data();
+ data_ = data;
+ } else {
+ clear_has_data();
+ data_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ }
+ // @@protoc_insertion_point(field_set_allocated:com.trustonic.tee_proxy.NotifyRequest.Buffers.data)
+}
+
+// -------------------------------------------------------------------
+
+// NotifyRequest
+
+// required uint32 sid = 1;
+inline bool NotifyRequest::has_sid() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+inline void NotifyRequest::set_has_sid() {
+ _has_bits_[0] |= 0x00000001u;
+}
+inline void NotifyRequest::clear_has_sid() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+inline void NotifyRequest::clear_sid() {
+ sid_ = 0u;
+ clear_has_sid();
+}
+inline ::google::protobuf::uint32 NotifyRequest::sid() const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.NotifyRequest.sid)
+ return sid_;
+}
+inline void NotifyRequest::set_sid(::google::protobuf::uint32 value) {
+ set_has_sid();
+ sid_ = value;
+ // @@protoc_insertion_point(field_set:com.trustonic.tee_proxy.NotifyRequest.sid)
+}
+
+// optional bytes tci = 2;
+inline bool NotifyRequest::has_tci() const {
+ return (_has_bits_[0] & 0x00000002u) != 0;
+}
+inline void NotifyRequest::set_has_tci() {
+ _has_bits_[0] |= 0x00000002u;
+}
+inline void NotifyRequest::clear_has_tci() {
+ _has_bits_[0] &= ~0x00000002u;
+}
+inline void NotifyRequest::clear_tci() {
+ if (tci_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ tci_->clear();
+ }
+ clear_has_tci();
+}
+inline const ::std::string& NotifyRequest::tci() const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.NotifyRequest.tci)
+ return *tci_;
+}
+inline void NotifyRequest::set_tci(const ::std::string& value) {
+ set_has_tci();
+ if (tci_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ tci_ = new ::std::string;
+ }
+ tci_->assign(value);
+ // @@protoc_insertion_point(field_set:com.trustonic.tee_proxy.NotifyRequest.tci)
+}
+inline void NotifyRequest::set_tci(const char* value) {
+ set_has_tci();
+ if (tci_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ tci_ = new ::std::string;
+ }
+ tci_->assign(value);
+ // @@protoc_insertion_point(field_set_char:com.trustonic.tee_proxy.NotifyRequest.tci)
+}
+inline void NotifyRequest::set_tci(const void* value, size_t size) {
+ set_has_tci();
+ if (tci_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ tci_ = new ::std::string;
+ }
+ tci_->assign(reinterpret_cast<const char*>(value), size);
+ // @@protoc_insertion_point(field_set_pointer:com.trustonic.tee_proxy.NotifyRequest.tci)
+}
+inline ::std::string* NotifyRequest::mutable_tci() {
+ set_has_tci();
+ if (tci_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ tci_ = new ::std::string;
+ }
+ // @@protoc_insertion_point(field_mutable:com.trustonic.tee_proxy.NotifyRequest.tci)
+ return tci_;
+}
+inline ::std::string* NotifyRequest::release_tci() {
+ clear_has_tci();
+ if (tci_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ return NULL;
+ } else {
+ ::std::string* temp = tci_;
+ tci_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ return temp;
+ }
+}
+inline void NotifyRequest::set_allocated_tci(::std::string* tci) {
+ if (tci_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ delete tci_;
+ }
+ if (tci) {
+ set_has_tci();
+ tci_ = tci;
+ } else {
+ clear_has_tci();
+ tci_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ }
+ // @@protoc_insertion_point(field_set_allocated:com.trustonic.tee_proxy.NotifyRequest.tci)
+}
+
+// repeated .com.trustonic.tee_proxy.NotifyRequest.Buffers buffers = 3;
+inline int NotifyRequest::buffers_size() const {
+ return buffers_.size();
+}
+inline void NotifyRequest::clear_buffers() {
+ buffers_.Clear();
+}
+inline const ::com::trustonic::tee_proxy::NotifyRequest_Buffers& NotifyRequest::buffers(int index) const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.NotifyRequest.buffers)
+ return buffers_.Get(index);
+}
+inline ::com::trustonic::tee_proxy::NotifyRequest_Buffers* NotifyRequest::mutable_buffers(int index) {
+ // @@protoc_insertion_point(field_mutable:com.trustonic.tee_proxy.NotifyRequest.buffers)
+ return buffers_.Mutable(index);
+}
+inline ::com::trustonic::tee_proxy::NotifyRequest_Buffers* NotifyRequest::add_buffers() {
+ // @@protoc_insertion_point(field_add:com.trustonic.tee_proxy.NotifyRequest.buffers)
+ return buffers_.Add();
+}
+inline const ::google::protobuf::RepeatedPtrField< ::com::trustonic::tee_proxy::NotifyRequest_Buffers >&
+NotifyRequest::buffers() const {
+ // @@protoc_insertion_point(field_list:com.trustonic.tee_proxy.NotifyRequest.buffers)
+ return buffers_;
+}
+inline ::google::protobuf::RepeatedPtrField< ::com::trustonic::tee_proxy::NotifyRequest_Buffers >*
+NotifyRequest::mutable_buffers() {
+ // @@protoc_insertion_point(field_mutable_list:com.trustonic.tee_proxy.NotifyRequest.buffers)
+ return &buffers_;
+}
+
+// -------------------------------------------------------------------
+
+// NotifyResponse
+
+// -------------------------------------------------------------------
+
+// WaitNotificationRequest
+
+// required uint32 sid = 1;
+inline bool WaitNotificationRequest::has_sid() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+inline void WaitNotificationRequest::set_has_sid() {
+ _has_bits_[0] |= 0x00000001u;
+}
+inline void WaitNotificationRequest::clear_has_sid() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+inline void WaitNotificationRequest::clear_sid() {
+ sid_ = 0u;
+ clear_has_sid();
+}
+inline ::google::protobuf::uint32 WaitNotificationRequest::sid() const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.WaitNotificationRequest.sid)
+ return sid_;
+}
+inline void WaitNotificationRequest::set_sid(::google::protobuf::uint32 value) {
+ set_has_sid();
+ sid_ = value;
+ // @@protoc_insertion_point(field_set:com.trustonic.tee_proxy.WaitNotificationRequest.sid)
+}
+
+// required sint32 timeout = 2;
+inline bool WaitNotificationRequest::has_timeout() const {
+ return (_has_bits_[0] & 0x00000002u) != 0;
+}
+inline void WaitNotificationRequest::set_has_timeout() {
+ _has_bits_[0] |= 0x00000002u;
+}
+inline void WaitNotificationRequest::clear_has_timeout() {
+ _has_bits_[0] &= ~0x00000002u;
+}
+inline void WaitNotificationRequest::clear_timeout() {
+ timeout_ = 0;
+ clear_has_timeout();
+}
+inline ::google::protobuf::int32 WaitNotificationRequest::timeout() const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.WaitNotificationRequest.timeout)
+ return timeout_;
+}
+inline void WaitNotificationRequest::set_timeout(::google::protobuf::int32 value) {
+ set_has_timeout();
+ timeout_ = value;
+ // @@protoc_insertion_point(field_set:com.trustonic.tee_proxy.WaitNotificationRequest.timeout)
+}
+
+// required bool partial = 3;
+inline bool WaitNotificationRequest::has_partial() const {
+ return (_has_bits_[0] & 0x00000004u) != 0;
+}
+inline void WaitNotificationRequest::set_has_partial() {
+ _has_bits_[0] |= 0x00000004u;
+}
+inline void WaitNotificationRequest::clear_has_partial() {
+ _has_bits_[0] &= ~0x00000004u;
+}
+inline void WaitNotificationRequest::clear_partial() {
+ partial_ = false;
+ clear_has_partial();
+}
+inline bool WaitNotificationRequest::partial() const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.WaitNotificationRequest.partial)
+ return partial_;
+}
+inline void WaitNotificationRequest::set_partial(bool value) {
+ set_has_partial();
+ partial_ = value;
+ // @@protoc_insertion_point(field_set:com.trustonic.tee_proxy.WaitNotificationRequest.partial)
+}
+
+// -------------------------------------------------------------------
+
+// WaitNotificationResponse_Buffers
+
+// required uint64 sva = 1;
+inline bool WaitNotificationResponse_Buffers::has_sva() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+inline void WaitNotificationResponse_Buffers::set_has_sva() {
+ _has_bits_[0] |= 0x00000001u;
+}
+inline void WaitNotificationResponse_Buffers::clear_has_sva() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+inline void WaitNotificationResponse_Buffers::clear_sva() {
+ sva_ = GOOGLE_ULONGLONG(0);
+ clear_has_sva();
+}
+inline ::google::protobuf::uint64 WaitNotificationResponse_Buffers::sva() const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.WaitNotificationResponse.Buffers.sva)
+ return sva_;
+}
+inline void WaitNotificationResponse_Buffers::set_sva(::google::protobuf::uint64 value) {
+ set_has_sva();
+ sva_ = value;