summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
+ // @@protoc_insertion_point(field_set:com.trustonic.tee_proxy.WaitNotificationResponse.Buffers.sva)
+}
+
+// required bytes data = 2;
+inline bool WaitNotificationResponse_Buffers::has_data() const {
+ return (_has_bits_[0] & 0x00000002u) != 0;
+}
+inline void WaitNotificationResponse_Buffers::set_has_data() {
+ _has_bits_[0] |= 0x00000002u;
+}
+inline void WaitNotificationResponse_Buffers::clear_has_data() {
+ _has_bits_[0] &= ~0x00000002u;
+}
+inline void WaitNotificationResponse_Buffers::clear_data() {
+ if (data_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ data_->clear();
+ }
+ clear_has_data();
+}
+inline const ::std::string& WaitNotificationResponse_Buffers::data() const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.WaitNotificationResponse.Buffers.data)
+ return *data_;
+}
+inline void WaitNotificationResponse_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.WaitNotificationResponse.Buffers.data)
+}
+inline void WaitNotificationResponse_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.WaitNotificationResponse.Buffers.data)
+}
+inline void WaitNotificationResponse_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.WaitNotificationResponse.Buffers.data)
+}
+inline ::std::string* WaitNotificationResponse_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.WaitNotificationResponse.Buffers.data)
+ return data_;
+}
+inline ::std::string* WaitNotificationResponse_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 WaitNotificationResponse_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.WaitNotificationResponse.Buffers.data)
+}
+
+// -------------------------------------------------------------------
+
+// WaitNotificationResponse
+
+// optional bytes tci = 1;
+inline bool WaitNotificationResponse::has_tci() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+inline void WaitNotificationResponse::set_has_tci() {
+ _has_bits_[0] |= 0x00000001u;
+}
+inline void WaitNotificationResponse::clear_has_tci() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+inline void WaitNotificationResponse::clear_tci() {
+ if (tci_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ tci_->clear();
+ }
+ clear_has_tci();
+}
+inline const ::std::string& WaitNotificationResponse::tci() const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.WaitNotificationResponse.tci)
+ return *tci_;
+}
+inline void WaitNotificationResponse::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.WaitNotificationResponse.tci)
+}
+inline void WaitNotificationResponse::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.WaitNotificationResponse.tci)
+}
+inline void WaitNotificationResponse::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.WaitNotificationResponse.tci)
+}
+inline ::std::string* WaitNotificationResponse::mutable_tci() {
+ set_has_tci();
+ if (tci_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ tci_ = new ::std::string;
+ }
+ // @@protoc_insertion_point(field_mutable:com.trustonic.tee_proxy.WaitNotificationResponse.tci)
+ return tci_;
+}
+inline ::std::string* WaitNotificationResponse::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 WaitNotificationResponse::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.WaitNotificationResponse.tci)
+}
+
+// repeated .com.trustonic.tee_proxy.WaitNotificationResponse.Buffers buffers = 2;
+inline int WaitNotificationResponse::buffers_size() const {
+ return buffers_.size();
+}
+inline void WaitNotificationResponse::clear_buffers() {
+ buffers_.Clear();
+}
+inline const ::com::trustonic::tee_proxy::WaitNotificationResponse_Buffers& WaitNotificationResponse::buffers(int index) const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.WaitNotificationResponse.buffers)
+ return buffers_.Get(index);
+}
+inline ::com::trustonic::tee_proxy::WaitNotificationResponse_Buffers* WaitNotificationResponse::mutable_buffers(int index) {
+ // @@protoc_insertion_point(field_mutable:com.trustonic.tee_proxy.WaitNotificationResponse.buffers)
+ return buffers_.Mutable(index);
+}
+inline ::com::trustonic::tee_proxy::WaitNotificationResponse_Buffers* WaitNotificationResponse::add_buffers() {
+ // @@protoc_insertion_point(field_add:com.trustonic.tee_proxy.WaitNotificationResponse.buffers)
+ return buffers_.Add();
+}
+inline const ::google::protobuf::RepeatedPtrField< ::com::trustonic::tee_proxy::WaitNotificationResponse_Buffers >&
+WaitNotificationResponse::buffers() const {
+ // @@protoc_insertion_point(field_list:com.trustonic.tee_proxy.WaitNotificationResponse.buffers)
+ return buffers_;
+}
+inline ::google::protobuf::RepeatedPtrField< ::com::trustonic::tee_proxy::WaitNotificationResponse_Buffers >*
+WaitNotificationResponse::mutable_buffers() {
+ // @@protoc_insertion_point(field_mutable_list:com.trustonic.tee_proxy.WaitNotificationResponse.buffers)
+ return &buffers_;
+}
+
+// -------------------------------------------------------------------
+
+// MapRequest_Buffers
+
+// required uint32 len = 1;
+inline bool MapRequest_Buffers::has_len() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+inline void MapRequest_Buffers::set_has_len() {
+ _has_bits_[0] |= 0x00000001u;
+}
+inline void MapRequest_Buffers::clear_has_len() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+inline void MapRequest_Buffers::clear_len() {
+ len_ = 0u;
+ clear_has_len();
+}
+inline ::google::protobuf::uint32 MapRequest_Buffers::len() const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.MapRequest.Buffers.len)
+ return len_;
+}
+inline void MapRequest_Buffers::set_len(::google::protobuf::uint32 value) {
+ set_has_len();
+ len_ = value;
+ // @@protoc_insertion_point(field_set:com.trustonic.tee_proxy.MapRequest.Buffers.len)
+}
+
+// required uint32 flags = 2;
+inline bool MapRequest_Buffers::has_flags() const {
+ return (_has_bits_[0] & 0x00000002u) != 0;
+}
+inline void MapRequest_Buffers::set_has_flags() {
+ _has_bits_[0] |= 0x00000002u;
+}
+inline void MapRequest_Buffers::clear_has_flags() {
+ _has_bits_[0] &= ~0x00000002u;
+}
+inline void MapRequest_Buffers::clear_flags() {
+ flags_ = 0u;
+ clear_has_flags();
+}
+inline ::google::protobuf::uint32 MapRequest_Buffers::flags() const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.MapRequest.Buffers.flags)
+ return flags_;
+}
+inline void MapRequest_Buffers::set_flags(::google::protobuf::uint32 value) {
+ set_has_flags();
+ flags_ = value;
+ // @@protoc_insertion_point(field_set:com.trustonic.tee_proxy.MapRequest.Buffers.flags)
+}
+
+// -------------------------------------------------------------------
+
+// MapRequest
+
+// required uint32 sid = 1;
+inline bool MapRequest::has_sid() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+inline void MapRequest::set_has_sid() {
+ _has_bits_[0] |= 0x00000001u;
+}
+inline void MapRequest::clear_has_sid() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+inline void MapRequest::clear_sid() {
+ sid_ = 0u;
+ clear_has_sid();
+}
+inline ::google::protobuf::uint32 MapRequest::sid() const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.MapRequest.sid)
+ return sid_;
+}
+inline void MapRequest::set_sid(::google::protobuf::uint32 value) {
+ set_has_sid();
+ sid_ = value;
+ // @@protoc_insertion_point(field_set:com.trustonic.tee_proxy.MapRequest.sid)
+}
+
+// repeated .com.trustonic.tee_proxy.MapRequest.Buffers buffers = 2;
+inline int MapRequest::buffers_size() const {
+ return buffers_.size();
+}
+inline void MapRequest::clear_buffers() {
+ buffers_.Clear();
+}
+inline const ::com::trustonic::tee_proxy::MapRequest_Buffers& MapRequest::buffers(int index) const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.MapRequest.buffers)
+ return buffers_.Get(index);
+}
+inline ::com::trustonic::tee_proxy::MapRequest_Buffers* MapRequest::mutable_buffers(int index) {
+ // @@protoc_insertion_point(field_mutable:com.trustonic.tee_proxy.MapRequest.buffers)
+ return buffers_.Mutable(index);
+}
+inline ::com::trustonic::tee_proxy::MapRequest_Buffers* MapRequest::add_buffers() {
+ // @@protoc_insertion_point(field_add:com.trustonic.tee_proxy.MapRequest.buffers)
+ return buffers_.Add();
+}
+inline const ::google::protobuf::RepeatedPtrField< ::com::trustonic::tee_proxy::MapRequest_Buffers >&
+MapRequest::buffers() const {
+ // @@protoc_insertion_point(field_list:com.trustonic.tee_proxy.MapRequest.buffers)
+ return buffers_;
+}
+inline ::google::protobuf::RepeatedPtrField< ::com::trustonic::tee_proxy::MapRequest_Buffers >*
+MapRequest::mutable_buffers() {
+ // @@protoc_insertion_point(field_mutable_list:com.trustonic.tee_proxy.MapRequest.buffers)
+ return &buffers_;
+}
+
+// -------------------------------------------------------------------
+
+// MapResponse_Buffers
+
+// required uint64 sva = 1;
+inline bool MapResponse_Buffers::has_sva() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+inline void MapResponse_Buffers::set_has_sva() {
+ _has_bits_[0] |= 0x00000001u;
+}
+inline void MapResponse_Buffers::clear_has_sva() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+inline void MapResponse_Buffers::clear_sva() {
+ sva_ = GOOGLE_ULONGLONG(0);
+ clear_has_sva();
+}
+inline ::google::protobuf::uint64 MapResponse_Buffers::sva() const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.MapResponse.Buffers.sva)
+ return sva_;
+}
+inline void MapResponse_Buffers::set_sva(::google::protobuf::uint64 value) {
+ set_has_sva();
+ sva_ = value;
+ // @@protoc_insertion_point(field_set:com.trustonic.tee_proxy.MapResponse.Buffers.sva)
+}
+
+// -------------------------------------------------------------------
+
+// MapResponse
+
+// repeated .com.trustonic.tee_proxy.MapResponse.Buffers buffers = 1;
+inline int MapResponse::buffers_size() const {
+ return buffers_.size();
+}
+inline void MapResponse::clear_buffers() {
+ buffers_.Clear();
+}
+inline const ::com::trustonic::tee_proxy::MapResponse_Buffers& MapResponse::buffers(int index) const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.MapResponse.buffers)
+ return buffers_.Get(index);
+}
+inline ::com::trustonic::tee_proxy::MapResponse_Buffers* MapResponse::mutable_buffers(int index) {
+ // @@protoc_insertion_point(field_mutable:com.trustonic.tee_proxy.MapResponse.buffers)
+ return buffers_.Mutable(index);
+}
+inline ::com::trustonic::tee_proxy::MapResponse_Buffers* MapResponse::add_buffers() {
+ // @@protoc_insertion_point(field_add:com.trustonic.tee_proxy.MapResponse.buffers)
+ return buffers_.Add();
+}
+inline const ::google::protobuf::RepeatedPtrField< ::com::trustonic::tee_proxy::MapResponse_Buffers >&
+MapResponse::buffers() const {
+ // @@protoc_insertion_point(field_list:com.trustonic.tee_proxy.MapResponse.buffers)
+ return buffers_;
+}
+inline ::google::protobuf::RepeatedPtrField< ::com::trustonic::tee_proxy::MapResponse_Buffers >*
+MapResponse::mutable_buffers() {
+ // @@protoc_insertion_point(field_mutable_list:com.trustonic.tee_proxy.MapResponse.buffers)
+ return &buffers_;
+}
+
+// -------------------------------------------------------------------
+
+// UnmapRequest_Buffers
+
+// required uint64 sva = 1;
+inline bool UnmapRequest_Buffers::has_sva() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+inline void UnmapRequest_Buffers::set_has_sva() {
+ _has_bits_[0] |= 0x00000001u;
+}
+inline void UnmapRequest_Buffers::clear_has_sva() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+inline void UnmapRequest_Buffers::clear_sva() {
+ sva_ = GOOGLE_ULONGLONG(0);
+ clear_has_sva();
+}
+inline ::google::protobuf::uint64 UnmapRequest_Buffers::sva() const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.UnmapRequest.Buffers.sva)
+ return sva_;
+}
+inline void UnmapRequest_Buffers::set_sva(::google::protobuf::uint64 value) {
+ set_has_sva();
+ sva_ = value;
+ // @@protoc_insertion_point(field_set:com.trustonic.tee_proxy.UnmapRequest.Buffers.sva)
+}
+
+// -------------------------------------------------------------------
+
+// UnmapRequest
+
+// required uint32 sid = 1;
+inline bool UnmapRequest::has_sid() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+inline void UnmapRequest::set_has_sid() {
+ _has_bits_[0] |= 0x00000001u;
+}
+inline void UnmapRequest::clear_has_sid() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+inline void UnmapRequest::clear_sid() {
+ sid_ = 0u;
+ clear_has_sid();
+}
+inline ::google::protobuf::uint32 UnmapRequest::sid() const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.UnmapRequest.sid)
+ return sid_;
+}
+inline void UnmapRequest::set_sid(::google::protobuf::uint32 value) {
+ set_has_sid();
+ sid_ = value;
+ // @@protoc_insertion_point(field_set:com.trustonic.tee_proxy.UnmapRequest.sid)
+}
+
+// repeated .com.trustonic.tee_proxy.UnmapRequest.Buffers buffers = 2;
+inline int UnmapRequest::buffers_size() const {
+ return buffers_.size();
+}
+inline void UnmapRequest::clear_buffers() {
+ buffers_.Clear();
+}
+inline const ::com::trustonic::tee_proxy::UnmapRequest_Buffers& UnmapRequest::buffers(int index) const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.UnmapRequest.buffers)
+ return buffers_.Get(index);
+}
+inline ::com::trustonic::tee_proxy::UnmapRequest_Buffers* UnmapRequest::mutable_buffers(int index) {
+ // @@protoc_insertion_point(field_mutable:com.trustonic.tee_proxy.UnmapRequest.buffers)
+ return buffers_.Mutable(index);
+}
+inline ::com::trustonic::tee_proxy::UnmapRequest_Buffers* UnmapRequest::add_buffers() {
+ // @@protoc_insertion_point(field_add:com.trustonic.tee_proxy.UnmapRequest.buffers)
+ return buffers_.Add();
+}
+inline const ::google::protobuf::RepeatedPtrField< ::com::trustonic::tee_proxy::UnmapRequest_Buffers >&
+UnmapRequest::buffers() const {
+ // @@protoc_insertion_point(field_list:com.trustonic.tee_proxy.UnmapRequest.buffers)
+ return buffers_;
+}
+inline ::google::protobuf::RepeatedPtrField< ::com::trustonic::tee_proxy::UnmapRequest_Buffers >*
+UnmapRequest::mutable_buffers() {
+ // @@protoc_insertion_point(field_mutable_list:com.trustonic.tee_proxy.UnmapRequest.buffers)
+ return &buffers_;
+}
+
+// -------------------------------------------------------------------
+
+// UnmapResponse
+
+// -------------------------------------------------------------------
+
+// GetErrorRequest
+
+// required uint32 sid = 1;
+inline bool GetErrorRequest::has_sid() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+inline void GetErrorRequest::set_has_sid() {
+ _has_bits_[0] |= 0x00000001u;
+}
+inline void GetErrorRequest::clear_has_sid() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+inline void GetErrorRequest::clear_sid() {
+ sid_ = 0u;
+ clear_has_sid();
+}
+inline ::google::protobuf::uint32 GetErrorRequest::sid() const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.GetErrorRequest.sid)
+ return sid_;
+}
+inline void GetErrorRequest::set_sid(::google::protobuf::uint32 value) {
+ set_has_sid();
+ sid_ = value;
+ // @@protoc_insertion_point(field_set:com.trustonic.tee_proxy.GetErrorRequest.sid)
+}
+
+// -------------------------------------------------------------------
+
+// GetErrorResponse
+
+// required sint32 exit_code = 1;
+inline bool GetErrorResponse::has_exit_code() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+inline void GetErrorResponse::set_has_exit_code() {
+ _has_bits_[0] |= 0x00000001u;
+}
+inline void GetErrorResponse::clear_has_exit_code() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+inline void GetErrorResponse::clear_exit_code() {
+ exit_code_ = 0;
+ clear_has_exit_code();
+}
+inline ::google::protobuf::int32 GetErrorResponse::exit_code() const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.GetErrorResponse.exit_code)
+ return exit_code_;
+}
+inline void GetErrorResponse::set_exit_code(::google::protobuf::int32 value) {
+ set_has_exit_code();
+ exit_code_ = value;
+ // @@protoc_insertion_point(field_set:com.trustonic.tee_proxy.GetErrorResponse.exit_code)
+}
+
+// -------------------------------------------------------------------
+
+// GetVersionRequest
+
+// -------------------------------------------------------------------
+
+// GetVersionResponse
+
+// required string product_id = 1;
+inline bool GetVersionResponse::has_product_id() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+inline void GetVersionResponse::set_has_product_id() {
+ _has_bits_[0] |= 0x00000001u;
+}
+inline void GetVersionResponse::clear_has_product_id() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+inline void GetVersionResponse::clear_product_id() {
+ if (product_id_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ product_id_->clear();
+ }
+ clear_has_product_id();
+}
+inline const ::std::string& GetVersionResponse::product_id() const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.GetVersionResponse.product_id)
+ return *product_id_;
+}
+inline void GetVersionResponse::set_product_id(const ::std::string& value) {
+ set_has_product_id();
+ if (product_id_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ product_id_ = new ::std::string;
+ }
+ product_id_->assign(value);
+ // @@protoc_insertion_point(field_set:com.trustonic.tee_proxy.GetVersionResponse.product_id)
+}
+inline void GetVersionResponse::set_product_id(const char* value) {
+ set_has_product_id();
+ if (product_id_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ product_id_ = new ::std::string;
+ }
+ product_id_->assign(value);
+ // @@protoc_insertion_point(field_set_char:com.trustonic.tee_proxy.GetVersionResponse.product_id)
+}
+inline void GetVersionResponse::set_product_id(const char* value, size_t size) {
+ set_has_product_id();
+ if (product_id_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ product_id_ = new ::std::string;
+ }
+ product_id_->assign(reinterpret_cast<const char*>(value), size);
+ // @@protoc_insertion_point(field_set_pointer:com.trustonic.tee_proxy.GetVersionResponse.product_id)
+}
+inline ::std::string* GetVersionResponse::mutable_product_id() {
+ set_has_product_id();
+ if (product_id_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ product_id_ = new ::std::string;
+ }
+ // @@protoc_insertion_point(field_mutable:com.trustonic.tee_proxy.GetVersionResponse.product_id)
+ return product_id_;
+}
+inline ::std::string* GetVersionResponse::release_product_id() {
+ clear_has_product_id();
+ if (product_id_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ return NULL;
+ } else {
+ ::std::string* temp = product_id_;
+ product_id_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ return temp;
+ }
+}
+inline void GetVersionResponse::set_allocated_product_id(::std::string* product_id) {
+ if (product_id_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ delete product_id_;
+ }
+ if (product_id) {
+ set_has_product_id();
+ product_id_ = product_id;
+ } else {
+ clear_has_product_id();
+ product_id_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ }
+ // @@protoc_insertion_point(field_set_allocated:com.trustonic.tee_proxy.GetVersionResponse.product_id)
+}
+
+// required uint32 mci = 2;
+inline bool GetVersionResponse::has_mci() const {
+ return (_has_bits_[0] & 0x00000002u) != 0;
+}
+inline void GetVersionResponse::set_has_mci() {
+ _has_bits_[0] |= 0x00000002u;
+}
+inline void GetVersionResponse::clear_has_mci() {
+ _has_bits_[0] &= ~0x00000002u;
+}
+inline void GetVersionResponse::clear_mci() {
+ mci_ = 0u;
+ clear_has_mci();
+}
+inline ::google::protobuf::uint32 GetVersionResponse::mci() const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.GetVersionResponse.mci)
+ return mci_;
+}
+inline void GetVersionResponse::set_mci(::google::protobuf::uint32 value) {
+ set_has_mci();
+ mci_ = value;
+ // @@protoc_insertion_point(field_set:com.trustonic.tee_proxy.GetVersionResponse.mci)
+}
+
+// required uint32 so = 3;
+inline bool GetVersionResponse::has_so() const {
+ return (_has_bits_[0] & 0x00000004u) != 0;
+}
+inline void GetVersionResponse::set_has_so() {
+ _has_bits_[0] |= 0x00000004u;
+}
+inline void GetVersionResponse::clear_has_so() {
+ _has_bits_[0] &= ~0x00000004u;
+}
+inline void GetVersionResponse::clear_so() {
+ so_ = 0u;
+ clear_has_so();
+}
+inline ::google::protobuf::uint32 GetVersionResponse::so() const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.GetVersionResponse.so)
+ return so_;
+}
+inline void GetVersionResponse::set_so(::google::protobuf::uint32 value) {
+ set_has_so();
+ so_ = value;
+ // @@protoc_insertion_point(field_set:com.trustonic.tee_proxy.GetVersionResponse.so)
+}
+
+// required uint32 mclf = 4;
+inline bool GetVersionResponse::has_mclf() const {
+ return (_has_bits_[0] & 0x00000008u) != 0;
+}
+inline void GetVersionResponse::set_has_mclf() {
+ _has_bits_[0] |= 0x00000008u;
+}
+inline void GetVersionResponse::clear_has_mclf() {
+ _has_bits_[0] &= ~0x00000008u;
+}
+inline void GetVersionResponse::clear_mclf() {
+ mclf_ = 0u;
+ clear_has_mclf();
+}
+inline ::google::protobuf::uint32 GetVersionResponse::mclf() const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.GetVersionResponse.mclf)
+ return mclf_;
+}
+inline void GetVersionResponse::set_mclf(::google::protobuf::uint32 value) {
+ set_has_mclf();
+ mclf_ = value;
+ // @@protoc_insertion_point(field_set:com.trustonic.tee_proxy.GetVersionResponse.mclf)
+}
+
+// required uint32 container = 5;
+inline bool GetVersionResponse::has_container() const {
+ return (_has_bits_[0] & 0x00000010u) != 0;
+}
+inline void GetVersionResponse::set_has_container() {
+ _has_bits_[0] |= 0x00000010u;
+}
+inline void GetVersionResponse::clear_has_container() {
+ _has_bits_[0] &= ~0x00000010u;
+}
+inline void GetVersionResponse::clear_container() {
+ container_ = 0u;
+ clear_has_container();
+}
+inline ::google::protobuf::uint32 GetVersionResponse::container() const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.GetVersionResponse.container)
+ return container_;
+}
+inline void GetVersionResponse::set_container(::google::protobuf::uint32 value) {
+ set_has_container();
+ container_ = value;
+ // @@protoc_insertion_point(field_set:com.trustonic.tee_proxy.GetVersionResponse.container)
+}
+
+// required uint32 mc_config = 6;
+inline bool GetVersionResponse::has_mc_config() const {
+ return (_has_bits_[0] & 0x00000020u) != 0;
+}
+inline void GetVersionResponse::set_has_mc_config() {
+ _has_bits_[0] |= 0x00000020u;
+}
+inline void GetVersionResponse::clear_has_mc_config() {
+ _has_bits_[0] &= ~0x00000020u;
+}
+inline void GetVersionResponse::clear_mc_config() {
+ mc_config_ = 0u;
+ clear_has_mc_config();
+}
+inline ::google::protobuf::uint32 GetVersionResponse::mc_config() const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.GetVersionResponse.mc_config)
+ return mc_config_;
+}
+inline void GetVersionResponse::set_mc_config(::google::protobuf::uint32 value) {
+ set_has_mc_config();
+ mc_config_ = value;
+ // @@protoc_insertion_point(field_set:com.trustonic.tee_proxy.GetVersionResponse.mc_config)
+}
+
+// required uint32 tl_api = 7;
+inline bool GetVersionResponse::has_tl_api() const {
+ return (_has_bits_[0] & 0x00000040u) != 0;
+}
+inline void GetVersionResponse::set_has_tl_api() {
+ _has_bits_[0] |= 0x00000040u;
+}
+inline void GetVersionResponse::clear_has_tl_api() {
+ _has_bits_[0] &= ~0x00000040u;
+}
+inline void GetVersionResponse::clear_tl_api() {
+ tl_api_ = 0u;
+ clear_has_tl_api();
+}
+inline ::google::protobuf::uint32 GetVersionResponse::tl_api() const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.GetVersionResponse.tl_api)
+ return tl_api_;
+}
+inline void GetVersionResponse::set_tl_api(::google::protobuf::uint32 value) {
+ set_has_tl_api();
+ tl_api_ = value;
+ // @@protoc_insertion_point(field_set:com.trustonic.tee_proxy.GetVersionResponse.tl_api)
+}
+
+// required uint32 dr_api = 8;
+inline bool GetVersionResponse::has_dr_api() const {
+ return (_has_bits_[0] & 0x00000080u) != 0;
+}
+inline void GetVersionResponse::set_has_dr_api() {
+ _has_bits_[0] |= 0x00000080u;
+}
+inline void GetVersionResponse::clear_has_dr_api() {
+ _has_bits_[0] &= ~0x00000080u;
+}
+inline void GetVersionResponse::clear_dr_api() {
+ dr_api_ = 0u;
+ clear_has_dr_api();
+}
+inline ::google::protobuf::uint32 GetVersionResponse::dr_api() const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.GetVersionResponse.dr_api)
+ return dr_api_;
+}
+inline void GetVersionResponse::set_dr_api(::google::protobuf::uint32 value) {
+ set_has_dr_api();
+ dr_api_ = value;
+ // @@protoc_insertion_point(field_set:com.trustonic.tee_proxy.GetVersionResponse.dr_api)
+}
+
+// required uint32 nwd = 9;
+inline bool GetVersionResponse::has_nwd() const {
+ return (_has_bits_[0] & 0x00000100u) != 0;
+}
+inline void GetVersionResponse::set_has_nwd() {
+ _has_bits_[0] |= 0x00000100u;
+}
+inline void GetVersionResponse::clear_has_nwd() {
+ _has_bits_[0] &= ~0x00000100u;
+}
+inline void GetVersionResponse::clear_nwd() {
+ nwd_ = 0u;
+ clear_has_nwd();
+}
+inline ::google::protobuf::uint32 GetVersionResponse::nwd() const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.GetVersionResponse.nwd)
+ return nwd_;
+}
+inline void GetVersionResponse::set_nwd(::google::protobuf::uint32 value) {
+ set_has_nwd();
+ nwd_ = value;
+ // @@protoc_insertion_point(field_set:com.trustonic.tee_proxy.GetVersionResponse.nwd)
+}
+
+// -------------------------------------------------------------------
+
+// GpRequestCancellationRequest
+
+// required uint32 sid = 1;
+inline bool GpRequestCancellationRequest::has_sid() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+inline void GpRequestCancellationRequest::set_has_sid() {
+ _has_bits_[0] |= 0x00000001u;
+}
+inline void GpRequestCancellationRequest::clear_has_sid() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+inline void GpRequestCancellationRequest::clear_sid() {
+ sid_ = 0u;
+ clear_has_sid();
+}
+inline ::google::protobuf::uint32 GpRequestCancellationRequest::sid() const {
+ // @@protoc_insertion_point(field_get:com.trustonic.tee_proxy.GpRequestCancellationRequest.sid)
+ return sid_;
+}
+inline void GpRequestCancellationRequest::set_sid(::google::protobuf::uint32 value) {
+ set_has_sid();
+ sid_ = value;
+ // @@protoc_insertion_point(field_set:com.trustonic.tee_proxy.GpRequestCancellationRequest.sid)
+}
+
+// -------------------------------------------------------------------
+
+// GpRequestCancellationResponse
+
+
+// @@protoc_insertion_point(namespace_scope)
+
+} // namespace tee_proxy
+} // namespace trustonic
+} // namespace com
+
+// @@protoc_insertion_point(global_scope)
+
+#endif // PROTOBUF_mc_2eproto__INCLUDED
diff --git a/mobicore/MobiCoreDriverLib/ClientLib/public/GP/tee_client_api.h b/mobicore/MobiCoreDriverLib/ClientLib/public/GP/tee_client_api.h
index c6f2090..e5d94cd 100644
--- a/mobicore/MobiCoreDriverLib/ClientLib/public/GP/tee_client_api.h
+++ b/mobicore/MobiCoreDriverLib/ClientLib/public/GP/tee_client_api.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013 TRUSTONIC LIMITED
+ * Copyright (c) 2013-2015 TRUSTONIC LIMITED
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -40,8 +40,9 @@
#include "tee_error.h"
#if TBASE_API_LEVEL >= 3
+#include "tee_client_api_imp.h"
-#if (!defined(TEEC_EXPORT)) && __cplusplus
+#if (!defined(TEEC_EXPORT)) && defined(__cplusplus)
#define TEEC_EXPORT extern "C"
#else
#define TEEC_EXPORT
@@ -70,7 +71,6 @@ typedef struct {
} TEEC_Value;
-#include "tee_client_api_imp.h"
/* Type definitions */
typedef struct TEEC_Context {
@@ -142,6 +142,8 @@ typedef struct TEEC_Operation {
#define TEEC_LOGIN_USER_APPLICATION 0x00000005
#define TEEC_LOGIN_GROUP_APPLICATION 0x00000006
+#define TEEC_TIMEOUT_INFINITE 0xFFFFFFFF
+
#pragma GCC visibility push(default)
TEEC_EXPORT TEEC_Result TEEC_InitializeContext(
@@ -167,7 +169,7 @@ TEEC_EXPORT TEEC_Result TEEC_OpenSession (
TEEC_Session *session,
const TEEC_UUID *destination,
uint32_t connectionMethod,
- void *connectionData,
+ const void *connectionData,
TEEC_Operation *operation,
uint32_t *returnOrigin);
diff --git a/mobicore/MobiCoreDriverLib/ClientLib/public/GP/tee_client_api_imp.h b/mobicore/MobiCoreDriverLib/ClientLib/public/GP/tee_client_api_imp.h
index 75c01fe..10bcfca 100644
--- a/mobicore/MobiCoreDriverLib/ClientLib/public/GP/tee_client_api_imp.h
+++ b/mobicore/MobiCoreDriverLib/ClientLib/public/GP/tee_client_api_imp.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013 TRUSTONIC LIMITED
+ * Copyright (c) 2013-2015 TRUSTONIC LIMITED
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,34 +41,29 @@
#include <pthread.h>
-#include "tee_type.h"
-#include "tee_error.h"
-#include "MobiCoreDriverApi.h"
+#define TEEC_MEM_INOUT (TEEC_MEM_INPUT | TEEC_MEM_OUTPUT)
typedef struct {
uint32_t reserved;
-}
-TEEC_Context_IMP;
+} TEEC_Context_IMP;
typedef struct {
- mcSessionHandle_t handle;
+ uint32_t sessionId;
+ TEEC_Context_IMP context;
void *tci;
bool active;
pthread_mutex_t mutex_tci; //mutex to serialize CA requests
-}
-TEEC_Session_IMP;
+} TEEC_Session_IMP;
typedef struct {
bool implementation_allocated;
-}
-TEEC_SharedMemory_IMP;
+} TEEC_SharedMemory_IMP;
typedef struct {
TEEC_Session_IMP *session;
-}
-TEEC_Operation_IMP;
+} TEEC_Operation_IMP;
/* There is no natural, compile-time limit on the shared memory, but a specific
implementation may introduce a limit (in particular on TrustZone) */
diff --git a/mobicore/MobiCoreDriverLib/ClientLib/public/GP/tee_type.h b/mobicore/MobiCoreDriverLib/ClientLib/public/GP/tee_type.h
index f164dab..cd8a630 100644
--- a/mobicore/MobiCoreDriverLib/ClientLib/public/GP/tee_type.h
+++ b/mobicore/MobiCoreDriverLib/ClientLib/public/GP/tee_type.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013 TRUSTONIC LIMITED
+ * Copyright (c) 2013-2015 TRUSTONIC LIMITED
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -28,67 +28,16 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/**
- * Definition of the machine-specific integer types
- **/
+
+
#ifndef __TEE_TYPE_H__
#define __TEE_TYPE_H__
-/* C99 integer types */
-#if (!defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L) &&(!defined(ANDROID))
-
#include <limits.h>
-/* Figure out if a 64-bit integer types is available */
-#if \
- defined(_MSC_VER) || \
- defined(__SYMBIAN32__) || \
- defined(_WIN32_WCE) || \
- (defined(ULLONG_MAX) && ULLONG_MAX == 0xFFFFFFFFFFFFFFFFULL) || \
- (defined(ULONG_LONG_MAX) && ULONG_LONG_MAX == 0xFFFFFFFFFFFFFFFFULL)
-typedef unsigned long long uint64_t;
-typedef long long int64_t;
-#else
-#define __S_TYPE_INT64_UNDEFINED
-#endif
-
-#if UINT_MAX == 0xFFFFFFFF
-typedef unsigned int uint32_t;
-typedef int int32_t;
-#elif ULONG_MAX == 0xFFFFFFFF
-typedef unsigned long uint32_t;
-typedef long int32_t;
-#else
-#error This compiler is not supported.
-#endif
-
-#if USHRT_MAX == 0xFFFF
-typedef unsigned short uint16_t;
-typedef short int16_t;
-#else
-#error This compiler is not supported.
-#endif
-
-#if UCHAR_MAX == 0xFF
-typedef unsigned char uint8_t;
-typedef signed char int8_t;
-#else
-#error This compiler is not supported.
-#endif
-
-#if !defined(__cplusplus)
-typedef unsigned char bool;
-#define false ( (bool)0 )
-#define true ( (bool)1 )
-#endif
-
-#else /* !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L */
-
#include <stdbool.h>
#include <stdint.h>
-#endif /* !(!defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L) */
-
#include <stddef.h>
#ifndef NULL
@@ -113,4 +62,11 @@ typedef struct TEE_UUID {
} TEE_UUID;
typedef TEE_UUID TEEC_UUID;
-#endif /* __TEE_TYPE_H__ */
+/** Type definition for a TEE Identity */
+typedef struct TEE_Identity {
+ uint32_t login;
+ TEE_UUID uuid;
+} TEE_Identity;
+
+#endif /* __TEE_CLIENT_TYPES_H__ */
+
diff --git a/mobicore/MobiCoreDriverLib/ClientLib/public/proxy_server.h b/mobicore/MobiCoreDriverLib/ClientLib/public/proxy_server.h
new file mode 100644
index 0000000..6f1026d
--- /dev/null
+++ b/mobicore/MobiCoreDriverLib/ClientLib/public/proxy_server.h
@@ -0,0 +1,46 @@
+/*
+ * 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_SERVER_H__
+#define __PROXY_SERVER_H__
+
+class ProxyServer {
+ struct Impl;
+ Impl* const pimpl_;
+ void run();
+public:
+ ProxyServer();
+ ~ProxyServer();
+ int open();
+ int close();
+};
+
+#endif // __PROXY_SERVER_H__
diff --git a/mobicore/MobiCoreDriverLib/Common/CThread.cpp b/mobicore/MobiCoreDriverLib/Common/CThread.cpp
index 7c19fcd..ced7f5e 100644
--- a/mobicore/MobiCoreDriverLib/Common/CThread.cpp
+++ b/mobicore/MobiCoreDriverLib/Common/CThread.cpp
@@ -82,11 +82,11 @@ void CThread::setExiting(
//------------------------------------------------------------------------------
void CThread::exit(
- int32_t exitcode
+ void* exitcode
)
{
setExiting();
- pthread_exit((void*)(uintptr_t)exitcode);
+ pthread_exit(exitcode);
}
@@ -101,24 +101,21 @@ bool CThread::shouldTerminate(
//------------------------------------------------------------------------------
void CThread::start(
- void
+ const char* name
)
{
int ret;
ret = pthread_create(&m_thread, NULL, CThreadStartup, this);
- if (0 != ret)
+ if (0 != ret) {
LOG_E("pthread_create failed with error code %d", ret);
-}
-
-//------------------------------------------------------------------------------
-void CThread::start(
- const char* name
-)
-{
- start();
- int ret = pthread_setname_np(m_thread, name);
- if (0 != ret)
- LOG_E("pthread_setname_np failed with error code %d %s", ret, name);
+ return;
+ }
+ if (name) {
+ ret = pthread_setname_np(m_thread, name);
+ if (0 != ret) {
+ LOG_E("pthread_setname_np failed with error code %d %s", ret, name);
+ }
+ }
}
//------------------------------------------------------------------------------
diff --git a/mobicore/MobiCoreDriverLib/Common/CThread.h b/mobicore/MobiCoreDriverLib/Common/CThread.h
index 002c7ee..641c448 100644
--- a/mobicore/MobiCoreDriverLib/Common/CThread.h
+++ b/mobicore/MobiCoreDriverLib/Common/CThread.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013 TRUSTONIC LIMITED
+ * Copyright (c) 2013-2014 TRUSTONIC LIMITED
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -52,9 +52,8 @@ public:
virtual void run(void) = 0;
- void start(void);
-
- void start(const char* name);
+ // Derived classes must call this base class method internally if overriding
+ virtual void start(const char* name = NULL);
void join(void);
@@ -72,7 +71,7 @@ protected:
bool shouldTerminate(void);
- void exit(int32_t exitcode);
+ void exit(void* exitcode);
private:
diff --git a/mobicore/MobiCoreDriverLib/Common/Connection.cpp b/mobicore/MobiCoreDriverLib/Common/Connection.cpp
index 51520f8..597e3af 100644
--- a/mobicore/MobiCoreDriverLib/Common/Connection.cpp
+++ b/mobicore/MobiCoreDriverLib/Common/Connection.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
@@ -173,21 +173,30 @@ ssize_t Connection::readData(void *buffer, uint32_t len, int32_t timeout)
//------------------------------------------------------------------------------
-ssize_t Connection::writeData(void *buffer, uint32_t len)
+ssize_t Connection::writeData(const void *buffer, uint32_t len)
{
assert(socketDescriptor != -1);
- ssize_t ret = send(socketDescriptor, buffer, len, 0);
- if ((uint32_t)ret != len) {
- LOG_ERRNO("could not send all data, because send");
- LOG_E("ret = %d", (uint32_t)ret);
- ret = -1;
+ const char *cbuf = static_cast<const char*>(buffer);
+ uint32_t left = len;
+ while (left) {
+ ssize_t wlen = ::send(socketDescriptor, cbuf, left, 0);
+ if (wlen < 0) {
+ LOG_ERRNO("writeData");
+ return -1;
+ }
+ if (wlen == 0) {
+ LOG_E("Client closed the connection");
+ return -1;
+ }
+ left -= wlen;
+ cbuf += wlen;
}
-
- return ret;
+ return len;
}
+
//------------------------------------------------------------------------------
int Connection::waitData(int32_t timeout)
{
diff --git a/mobicore/MobiCoreDriverLib/Common/Connection.h b/mobicore/MobiCoreDriverLib/Common/Connection.h
index 243168c..1db85f5 100644
--- a/mobicore/MobiCoreDriverLib/Common/Connection.h
+++ b/mobicore/MobiCoreDriverLib/Common/Connection.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013 TRUSTONIC LIMITED
+ * Copyright (c) 2013-2015 TRUSTONIC LIMITED
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -95,7 +95,7 @@ public:
* @return Number of bytes written.
* @return -1 if written bytes not equal to len.
*/
- virtual ssize_t writeData(void *buffer, uint32_t len);
+ virtual ssize_t writeData(const void *buffer, uint32_t len);
/**
* Wait for data to be available.
diff --git a/mobicore/MobiCoreDriverLib/Common/NetlinkConnection.cpp b/mobicore/MobiCoreDriverLib/Common/NetlinkConnection.cpp
index 7a9347d..f3464d5 100644
--- a/mobicore/MobiCoreDriverLib/Common/NetlinkConnection.cpp
+++ b/mobicore/MobiCoreDriverLib/Common/NetlinkConnection.cpp
@@ -224,8 +224,8 @@ ssize_t NetlinkConnection::readData(
//------------------------------------------------------------------------------
ssize_t NetlinkConnection::writeData(
- void *buffer,
- uint32_t len
+ const void *buffer,
+ uint32_t len
)
{
ssize_t ret;
diff --git a/mobicore/MobiCoreDriverLib/Common/NetlinkConnection.h b/mobicore/MobiCoreDriverLib/Common/NetlinkConnection.h
index 45b3952..b86d873 100644
--- a/mobicore/MobiCoreDriverLib/Common/NetlinkConnection.h
+++ b/mobicore/MobiCoreDriverLib/Common/NetlinkConnection.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013 TRUSTONIC LIMITED
+ * Copyright (c) 2013-2015 TRUSTONIC LIMITED
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -191,7 +191,7 @@ public:
* @return Number of bytes written.
*/
virtual ssize_t writeData(
- void *buffer,
+ const void *buffer,
uint32_t len
);
diff --git a/mobicore/MobiCoreDriverLib/Daemon/Device/DeviceIrqHandler.cpp b/mobicore/MobiCoreDriverLib/Daemon/Device/DeviceIrqHandler.cpp
index 9eb5722..a50a152 100644
--- a/mobicore/MobiCoreDriverLib/Daemon/Device/DeviceIrqHandler.cpp
+++ b/mobicore/MobiCoreDriverLib/Daemon/Device/DeviceIrqHandler.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013 TRUSTONIC LIMITED
+ * Copyright (c) 2013-2014 TRUSTONIC LIMITED
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -37,6 +37,6 @@ void DeviceIrqHandler::run(
)
{
handleIrq();
- this->exit(-1);
+ this->exit((void*)-1);
}
diff --git a/mobicore/MobiCoreDriverLib/Daemon/Device/DeviceScheduler.cpp b/mobicore/MobiCoreDriverLib/Daemon/Device/DeviceScheduler.cpp
index 3e25598..075dde6 100644
--- a/mobicore/MobiCoreDriverLib/Daemon/Device/DeviceScheduler.cpp
+++ b/mobicore/MobiCoreDriverLib/Daemon/Device/DeviceScheduler.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013 TRUSTONIC LIMITED
+ * Copyright (c) 2013-2014 TRUSTONIC LIMITED
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -37,6 +37,6 @@ void DeviceScheduler::run(
)
{
schedule();
- exit(-1);
+ exit((void*)-1);
}
diff --git a/mobicore/MobiCoreDriverLib/Daemon/Device/MobiCoreDevice.cpp b/mobicore/MobiCoreDriverLib/Daemon/Device/MobiCoreDevice.cpp
index 3e86dcb..3ff8ec3 100644
--- a/mobicore/MobiCoreDriverLib/Daemon/Device/MobiCoreDevice.cpp
+++ b/mobicore/MobiCoreDriverLib/Daemon/Device/MobiCoreDevice.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
@@ -57,6 +57,8 @@ MobiCoreDevice::MobiCoreDevice()
mcFault = false;
mciReused = false;
mcpMessage = NULL;
+ notifySessionRemoved = false;
+
}
//------------------------------------------------------------------------------
@@ -68,6 +70,8 @@ MobiCoreDevice::~MobiCoreDevice()
mcVersionInfo = NULL;
mcFlags = NULL;
nq = NULL;
+ notifySessionRemoved = false;
+
}
//------------------------------------------------------------------------------
@@ -234,26 +238,31 @@ void MobiCoreDevice::close(
// make this a bit easier for everbody.
// Cannot lock list as we need to receive notifications, but it may change, so search under lock
- trustletSessionList_t sessions_list;
- mutex_tslist.lock();
- for (trustletSessionList_t::reverse_iterator revIt = trustletSessions.rbegin(); revIt != trustletSessions.rend(); revIt++)
- {
- if ((*revIt)->deviceConnection == connection) {
- LOG_I("MobiCoreDevice::close found a session %p", *revIt);
+ for (;;) {
+ TrustletSession *session = NULL;
- sessions_list.push_back(*revIt);
+ mutex_tslist.lock();
+ for (trustletSessionList_t::reverse_iterator revIt = trustletSessions.rbegin(); revIt != trustletSessions.rend(); revIt++)
+ {
+ if ((*revIt)->deviceConnection == connection) {
+ session = *revIt;
+ break;
+ }
+ }
+ mutex_tslist.unlock();
+ if (!session) {
break;
}
- }
- mutex_tslist.unlock();
-
- for (trustletSessionList_t::iterator it = sessions_list.begin(); it != sessions_list.end(); it++) {
- mcResult_t mcRet = closeSession(connection, (*it)->sessionId);
+ mcResult_t mcRet = closeSession(connection, session->sessionId);
if (mcRet != MC_MCP_RET_OK) {
- LOG_I("device closeSession failed for %p with %d", *it, mcRet);
+ LOG_I("device closeSession failed with %d", mcRet);
}
}
+ // After the trustlet is done make sure to tell the driver to cleanup
+ // all the orphaned drivers
+ cleanupWsmL2();
+
connection->connectionData = NULL;
// Leave critical section
@@ -261,6 +270,7 @@ void MobiCoreDevice::close(
}
+
//------------------------------------------------------------------------------
void MobiCoreDevice::start(void)
{
@@ -284,6 +294,7 @@ void MobiCoreDevice::start(void)
if (mciReused)
{
+ notifySessionRemoved = true;
// Remove all pending sessions. In <t-base-301, there is a maximum of 32 sessions.
// Few sessions in the start are reserved by the system.
#define LOG_SOURCE_TASK_SHIFT 8
@@ -291,6 +302,11 @@ void MobiCoreDevice::start(void)
int sessionId = ((sessionNumber<<LOG_SOURCE_TASK_SHIFT)+1);
LOG_I("invalidating session %03x", sessionId);
mcResult_t mcRet = sendSessionCloseCmd(sessionId);
+ if (mcRet==MC_DRV_ERR_DAEMON_MCI_ERROR) {
+ LOG_I("invalid MCP response for CLOSE_SESSION, try again");
+ mcRet = sendSessionCloseCmd(sessionId);
+ }
+
if (mcRet != MC_MCP_RET_OK) {
LOG_I("sendSessionCloseCmd error %d", mcRet);
}
@@ -340,46 +356,46 @@ bool MobiCoreDevice::waitMcpNotification(void)
mcFault = true;
return false;
}
- } // while(1)
-
- // Check healthiness state of the device
- if (DeviceIrqHandler::isExiting() ||
- DeviceScheduler::isExiting() ||
- TAExitHandler::isExiting())
- {
- LOG_I("waitMcpNotification(): Threads state:");
- LOG_I("Irq handler : %s", (DeviceIrqHandler::isExiting()==true)?"running":"exit");
- LOG_I("Scheduler : %s", (DeviceScheduler::isExiting()==true)?"running":"exit");
- LOG_I("Exit handler: %s", (TAExitHandler::isExiting()==true)?"running":"exit");
-
- //There is no CThread::wait() so no need to wake up
- LOG_I("waitMcpNotification(): IrqHandler thread should exit automatically");
-
- DeviceScheduler::terminate();
- //Cancel waiting just in case.
- DeviceScheduler::wakeup();
- LOG_I("waitMcpNotification(): terminate Scheduler thread");
-
- TAExitHandler::terminate();
- //Cancel waiting just in case.
- TAExitHandler::wakeup();
- LOG_I("waitMcpNotification(): terminate Exit handler thread");
-
- DeviceIrqHandler::join();
- LOG_I("waitMcpNotification(): IrqHandler joined");
- LOG_E("IrqHandler thread died!");
-
- DeviceScheduler::join();
- LOG_I("waitMcpNotification(): Scheduler Joined");
- LOG_E("Scheduler thread died!");
-
- TAExitHandler::join();
- LOG_I("waitMcpNotification(): Exit handler Joined");
- LOG_E("TAExitHandler thread died!");
-
- return false;
- }
- return true;
+ } // while(1)
+
+ // Check healthiness state of the device
+ if (DeviceIrqHandler::isExiting() ||
+ DeviceScheduler::isExiting() ||
+ TAExitHandler::isExiting())
+ {
+ LOG_I("waitMcpNotification(): Threads state:");
+ LOG_I("Irq handler : %s", (DeviceIrqHandler::isExiting()==true)?"running":"exit");
+ LOG_I("Scheduler : %s", (DeviceScheduler::isExiting()==true)?"running":"exit");
+ LOG_I("Exit handler: %s", (TAExitHandler::isExiting()==true)?"running":"exit");
+
+ //There is no CThread::wait() so no need to wake up
+ LOG_I("waitMcpNotification(): IrqHandler thread should exit automatically");
+
+ DeviceScheduler::terminate();
+ //Cancel waiting just in case.
+ DeviceScheduler::wakeup();
+ LOG_I("waitMcpNotification(): terminate Scheduler thread");
+
+ TAExitHandler::terminate();
+ //Cancel waiting just in case.
+ TAExitHandler::wakeup();
+ LOG_I("waitMcpNotification(): terminate Exit handler thread");
+
+ DeviceIrqHandler::join();
+ LOG_I("waitMcpNotification(): IrqHandler joined");
+ LOG_E("IrqHandler thread died!");
+
+ DeviceScheduler::join();
+ LOG_I("waitMcpNotification(): Scheduler Joined");
+ LOG_E("Scheduler thread died!");
+
+ TAExitHandler::join();
+ LOG_I("waitMcpNotification(): Exit handler Joined");
+ LOG_E("TAExitHandler thread died!");
+
+ return false;
+ }
+ return true;
}
@@ -537,6 +553,9 @@ mcResult_t MobiCoreDevice::checkLoad(
loadDataOpenSession_ptr pLoadDataOpenSession,
mcDrvRspOpenSessionPayload_ptr /*pRspOpenSessionPayload*/)
{
+ mcResult_t mcRet = MC_DRV_OK;
+ mutex_mcp.lock();
+
do {
// Write MCP open message to buffer
mcpMessage->cmdCheckLoad.cmdHeader.cmdId = MC_MCP_CMD_CHECK_LOAD_TA;
@@ -553,33 +572,34 @@ mcResult_t MobiCoreDevice::checkLoad(
// seen in openSession never happens elsewhere
notifications = std::queue<notification_t>();
- mcResult_t mcRet = mshNotifyAndWait();
+ mcRet = mshNotifyAndWait();
if (mcRet != MC_MCP_RET_OK)
{
LOG_E("mshNotifyAndWait failed for CHECK_LOAD_TA, code %d.", mcRet);
// Here Mobicore can be considered dead.
- return mcRet;
+ break;
}
// Check if the command response ID is correct
if ((MC_MCP_CMD_CHECK_LOAD_TA | FLAG_RESPONSE) != mcpMessage->rspHeader.rspId) {
- LOG_E("CMD_OPEN_SESSION got invalid MCP command response(0x%X)", mcpMessage->rspHeader.rspId);
+ LOG_E("CMD_CHECK_LOAD_TA got invalid MCP command response(0x%X)", mcpMessage->rspHeader.rspId);
// Something is messing with our MCI memory, we cannot know if the Trustlet was loaded.
// Had in been loaded, we are loosing track of it here.
- return MC_DRV_ERR_DAEMON_MCI_ERROR;
+ mcRet = MC_DRV_ERR_DAEMON_MCI_ERROR;
+ break;
}
mcRet = mcpMessage->rspCheckLoad.rspHeader.result;
-
if (mcRet != MC_MCP_RET_OK) {
LOG_E("MCP CHECK_LOAD returned code %d.", mcRet);
- return MAKE_MC_DRV_MCP_ERROR(mcRet);
+ mcRet = MAKE_MC_DRV_MCP_ERROR(mcRet);
+ break;
}
- return MC_DRV_OK;
-
} while (0);
- return MC_DRV_ERR_UNKNOWN;
+
+ mutex_mcp.unlock();
+ return mcRet;
}
@@ -635,7 +655,7 @@ mcResult_t MobiCoreDevice::closeSession(
Connection *deviceConnection,
uint32_t sessionId
) {
- TrustletSession *session = findSession(deviceConnection,sessionId);
+ TrustletSession *session = findSession(deviceConnection, sessionId);
if (session == NULL) {
LOG_E("cannot close session %03x", sessionId);
return MC_DRV_ERR_DAEMON_UNKNOWN_SESSION;
@@ -875,6 +895,9 @@ mcResult_t MobiCoreDevice::getMobiCoreVersion(
}
pRspGetMobiCoreVersionPayload->versionInfo = mcpMessage->rspGetMobiCoreVersion.versionInfo;
+ // The CMP version is meaningless in this case, and is replaced by the NWd version (1.5)
+ pRspGetMobiCoreVersionPayload->versionInfo.versionCmp = 0x00010005;
+
// Store MobiCore info for future reference.
mcVersionInfo = new mcVersionInfo_t();
diff --git a/mobicore/MobiCoreDriverLib/Daemon/Device/Platforms/Android.mk b/mobicore/MobiCoreDriverLib/Daemon/Device/Platforms/Android.mk
index 48dd98a..8c1d954 100644
--- a/mobicore/MobiCoreDriverLib/Daemon/Device/Platforms/Android.mk
+++ b/mobicore/MobiCoreDriverLib/Daemon/Device/Platforms/Android.mk
@@ -9,7 +9,3 @@ PLATFORMS_PATH := $(LOCAL_PATH)/Daemon/Device/Platforms
# Always include the Generic code
include $(PLATFORMS_PATH)/Generic/Android.mk
-ifneq ($(filter-out Generic,$(PLATFORM)),)
- $(info PLATFORM: $(PLATFORM))
- include $(PLATFORMS_PATH)/$(PLATFORM)/Android.mk
-endif
diff --git a/mobicore/MobiCoreDriverLib/Daemon/Device/Platforms/Generic/TrustZoneDevice.cpp b/mobicore/MobiCoreDriverLib/Daemon/Device/Platforms/Generic/TrustZoneDevice.cpp
index c1fc978..94cc0b6 100644
--- a/mobicore/MobiCoreDriverLib/Daemon/Device/Platforms/Generic/TrustZoneDevice.cpp
+++ b/mobicore/MobiCoreDriverLib/Daemon/Device/Platforms/Generic/TrustZoneDevice.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
@@ -636,24 +636,33 @@ void TrustZoneDevice::handleTaExit(void)
if (!ts) {
break;
}
-#ifndef NDEBUG
- uint32_t sessionId = ts->sessionId;
-#endif
- LOG_I("Cleaning up session %03x", sessionId);
+
+ LOG_I("Cleaning up session %03x", ts->sessionId);
// Tell t-base to close the session (list gets locked in handleIrq() when MCP replies)
mcResult_t mcRet = closeSessionInternal(ts);
// If ok, remove objects
if (mcRet == MC_DRV_OK) {
- freeSession(ts);
- LOG_I("TA session %03x finally closed", sessionId);
+ mutex_tslist.lock();
+ trustletSessions.remove(ts);
+ mutex_tslist.unlock();
+ LOG_I("TA session %03x finally closed", ts->sessionId);
+ delete ts;
} else {
- LOG_I("TA session %03x could not be closed yet.", sessionId);
+ LOG_I("TA session %03x could not be closed yet.", ts->sessionId);
}
}
mutex_mcp.unlock();
}
TAExitHandler::setExiting();
signalMcpNotification();
+
+ // In case there's no ongoing waitMcpNotification
+ ::sleep(1);
+ if (DeviceScheduler::shouldTerminate() == false) {
+ kill(getpid(), SIGTERM);
+ }
+
+
LOG_E("schedule loop terminated");
}
@@ -717,6 +726,11 @@ void TrustZoneDevice::handleIrq(
*/
LOG_W("Notification for unknown session ID");
queueUnknownNotification(*notification);
+ if (notifySessionRemoved) {
+ notify(notification->sessionId);
+ }
+ notifySessionRemoved = false;
+
} else {
mutex_connection.lock();
// Get the NQ connection for the session ID
@@ -753,5 +767,12 @@ void TrustZoneDevice::handleIrq(
// MSH thread MUST not block!
DeviceIrqHandler::setExiting();
signalMcpNotification();
+
+ // In case there's no ongoing waitMcpNotification
+ ::sleep(1);
+ if (DeviceScheduler::shouldTerminate() == false) {
+ kill(getpid(), SIGTERM);
+ }
+
}
diff --git a/mobicore/MobiCoreDriverLib/Daemon/Device/TAExitHandler.cpp b/mobicore/MobiCoreDriverLib/Daemon/Device/TAExitHandler.cpp
index 93c66e9..8958dc8 100644
--- a/mobicore/MobiCoreDriverLib/Daemon/Device/TAExitHandler.cpp
+++ b/mobicore/MobiCoreDriverLib/Daemon/Device/TAExitHandler.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013 TRUSTONIC LIMITED
+ * Copyright (c) 2013-2014 TRUSTONIC LIMITED
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -37,6 +37,6 @@ void TAExitHandler::run(
)
{
handleTaExit();
- this->exit(-1);
+ this->exit((void*)-1);
}
diff --git a/mobicore/MobiCoreDriverLib/Daemon/Device/public/MobiCoreDevice.h b/mobicore/MobiCoreDriverLib/Daemon/Device/public/MobiCoreDevice.h
index e7348b4..9068948 100644
--- a/mobicore/MobiCoreDriverLib/Daemon/Device/public/MobiCoreDevice.h
+++ b/mobicore/MobiCoreDriverLib/Daemon/Device/public/MobiCoreDevice.h
@@ -94,6 +94,8 @@ protected:
bool mcFault; /**< Signal RTM fault */
bool mciReused; /**< Signal restart of Daemon. */
CMutex mutex_connection; // Mutex to share session->notificationConnection for GP cases
+ bool notifySessionRemoved; /**< Signal sessions removed */
+
/* In a special case a Trustlet can create a race condition in the daemon.
diff --git a/mobicore/MobiCoreDriverLib/Daemon/FSD/FSD.cpp b/mobicore/MobiCoreDriverLib/Daemon/FSD/FSD.cpp
index 2cd26b1..5b0a5ce 100644
--- a/mobicore/MobiCoreDriverLib/Daemon/FSD/FSD.cpp
+++ b/mobicore/MobiCoreDriverLib/Daemon/FSD/FSD.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
@@ -43,6 +43,9 @@
//#define LOG_VERBOSE
#include "log.h"
+#include "PrivateRegistry.h"
+
+
/* The following definitions are not exported in the header files of the
client API. */
#define TEE_DATA_FLAG_EXCLUSIVE 0x00000400
diff --git a/mobicore/MobiCoreDriverLib/Daemon/MobiCoreDriverDaemon.cpp b/mobicore/MobiCoreDriverLib/Daemon/MobiCoreDriverDaemon.cpp
index 7cd6079..2f2d37c 100644
--- a/mobicore/MobiCoreDriverLib/Daemon/MobiCoreDriverDaemon.cpp
+++ b/mobicore/MobiCoreDriverLib/Daemon/MobiCoreDriverDaemon.cpp
@@ -155,11 +155,19 @@ void MobiCoreDriverDaemon::run(
for (i = 0; i < MAX_SERVERS; i++) {
servers[i]->start(i ? "McDaemon.Server" : "NetlinkServer");
}
+
+#ifndef WITHOUT_PROXY
+ proxy_server.open();
+#endif
// then wait for them to exit
for (i = 0; i < MAX_SERVERS; i++) {
servers[i]->join();
}
+
+#ifndef WITHOUT_PROXY
+ proxy_server.close();
+#endif
}
//------------------------------------------------------------------------------
@@ -354,12 +362,22 @@ bool MobiCoreDriverDaemon::loadDeviceDriver(
}
//------------------------------------------------------------------------------
-inline bool getData(Connection *con, void *buf, uint32_t len)
+inline bool getData(Connection *connection, void *buf, uint32_t len)
{
- uint32_t rlen = con->readData(buf, len);
- if (rlen < len || (int32_t)rlen < 0) {
- LOG_E("reading from Client failed");
- return false;
+ char *cbuf = (char*)buf;
+ uint32_t left = len;
+ while (left) {
+ ssize_t rlen = connection->readData(cbuf, left);
+ if (rlen < 0) {
+ LOG_ERRNO("reading from Client");
+ return false;
+ }
+ if (rlen == 0) {
+ LOG_E("Client closed the connection");
+ return false;
+ }
+ left -= rlen;
+ cbuf += rlen;
}
return true;
}
@@ -1103,16 +1121,7 @@ mcDrvResponseHeader_t rspRegistry = { responseId :
}
//------------------------------------------------------------------------------
-bool MobiCoreDriverDaemon::handleConnection(
- Connection *connection
-)
-{
- bool ret = false;
-
- // This is the big lock around everything the Daemon does, including socket and MCI access
- static CMutex reg_mutex;
- static CMutex siq_mutex;
-
+bool MobiCoreDriverDaemon::readCommand(Connection *connection, uint32_t *command_id) {
/* In case of RTM fault do not try to signal anything to MobiCore
* just answer NO to all incoming connections! */
if (mobiCoreDevice->getMcFault()) {
@@ -1120,145 +1129,175 @@ bool MobiCoreDriverDaemon::handleConnection(
return false;
}
- LOG_I("handleConnection()==== %p", connection);
- do {
- // Read header
- mcDrvCommandHeader_t mcDrvCommandHeader;
- ssize_t rlen = connection->readData(
- &(mcDrvCommandHeader),
- sizeof(mcDrvCommandHeader));
+ // Read header
+ LOG_I("%s()==== %p", __FUNCTION__, connection);
+ mcDrvCommandHeader_t mcDrvCommandHeader;
+ ssize_t rlen = connection->readData(&mcDrvCommandHeader, sizeof(mcDrvCommandHeader));
+ if (rlen == 0) {
+ LOG_I(" %s(): Connection closed.", __FUNCTION__);
+ return false;
+ }
+ if (rlen == -1) {
+ LOG_E("Socket error.");
+ return false;
+ }
+ if (rlen == -2) {
+ LOG_E("Timeout.");
+ return false;
+ }
- if (rlen == 0) {
- LOG_V(" handleConnection(): Connection closed.");
- break;
- }
- if (rlen == -1) {
- LOG_E("Socket error.");
- break;
- }
- if (rlen == -2) {
- LOG_E("Timeout.");
- break;
- }
- ret = true;
+ // Check command ID
+ switch (mcDrvCommandHeader.commandId) {
+ //-----------------------------------------
+ case MC_DRV_CMD_OPEN_DEVICE:
+ case MC_DRV_CMD_CLOSE_DEVICE:
+ case MC_DRV_CMD_OPEN_SESSION:
+ case MC_DRV_CMD_OPEN_TRUSTLET:
+ case MC_DRV_CMD_OPEN_TRUSTED_APP:
+ case MC_DRV_CMD_CLOSE_SESSION:
+ case MC_DRV_CMD_NQ_CONNECT:
+ case MC_DRV_CMD_NOTIFY:
+ case MC_DRV_CMD_MAP_BULK_BUF:
+ case MC_DRV_CMD_UNMAP_BULK_BUF:
+ case MC_DRV_CMD_GET_VERSION:
+ case MC_DRV_CMD_GET_MOBICORE_VERSION:
+ case MC_DRV_REG_STORE_AUTH_TOKEN:
+ case MC_DRV_REG_WRITE_ROOT_CONT:
+ case MC_DRV_REG_WRITE_SP_CONT:
+ case MC_DRV_REG_WRITE_TL_CONT:
+ case MC_DRV_REG_WRITE_SO_DATA:
+ case MC_DRV_REG_STORE_TA_BLOB:
+ case MC_DRV_REG_READ_AUTH_TOKEN:
+ case MC_DRV_REG_READ_ROOT_CONT:
+ case MC_DRV_REG_READ_SP_CONT:
+ case MC_DRV_REG_READ_TL_CONT:
+ case MC_DRV_REG_DELETE_AUTH_TOKEN:
+ case MC_DRV_REG_DELETE_ROOT_CONT:
+ case MC_DRV_REG_DELETE_SP_CONT:
+ case MC_DRV_REG_DELETE_TL_CONT:
+ break;
+ default:
+ LOG_E("Unknown command: %d=0x%x", mcDrvCommandHeader.commandId, mcDrvCommandHeader.commandId);
+ return false;
+ }
- switch (mcDrvCommandHeader.commandId) {
- //-----------------------------------------
- case MC_DRV_CMD_OPEN_DEVICE:
- mobiCoreDevice->mutex_mcp.lock();
- processOpenDevice(connection);
- mobiCoreDevice->mutex_mcp.unlock();
- break;
- //-----------------------------------------
- case MC_DRV_CMD_CLOSE_DEVICE:
- mobiCoreDevice->mutex_mcp.lock();
- processCloseDevice(connection);
- mobiCoreDevice->mutex_mcp.unlock();
- break;
- //-----------------------------------------
- case MC_DRV_CMD_OPEN_SESSION:
- mobiCoreDevice->mutex_mcp.lock();
- processOpenSession(connection, false);
- mobiCoreDevice->mutex_mcp.unlock();
- break;
- //-----------------------------------------
- case MC_DRV_CMD_OPEN_TRUSTLET:
- mobiCoreDevice->mutex_mcp.lock();
- processOpenTrustlet(connection);
- mobiCoreDevice->mutex_mcp.unlock();
- break;
- //-----------------------------------------
- case MC_DRV_CMD_OPEN_TRUSTED_APP:
- mobiCoreDevice->mutex_mcp.lock();
- processOpenSession(connection, true);
- mobiCoreDevice->mutex_mcp.unlock();
- break;
- //-----------------------------------------
- case MC_DRV_CMD_CLOSE_SESSION:
- mobiCoreDevice->mutex_mcp.lock();
- processCloseSession(connection);
- mobiCoreDevice->mutex_mcp.unlock();
- break;
- //-----------------------------------------
- case MC_DRV_CMD_NQ_CONNECT:
- siq_mutex.lock();
- processNqConnect(connection);
- siq_mutex.unlock();
- break;
- //-----------------------------------------
- case MC_DRV_CMD_NOTIFY:
- siq_mutex.lock();
- processNotify(connection);
- siq_mutex.unlock();
- break;
- //-----------------------------------------
- case MC_DRV_CMD_MAP_BULK_BUF:
- mobiCoreDevice->mutex_mcp.lock();
- processMapBulkBuf(connection);
- mobiCoreDevice->mutex_mcp.unlock();
- break;
- //-----------------------------------------
- case MC_DRV_CMD_UNMAP_BULK_BUF:
- mobiCoreDevice->mutex_mcp.lock();
- processUnmapBulkBuf(connection);
- mobiCoreDevice->mutex_mcp.unlock();
- break;
- //-----------------------------------------
- case MC_DRV_CMD_GET_VERSION:
- processGetVersion(connection);
- break;
- //-----------------------------------------
- case MC_DRV_CMD_GET_MOBICORE_VERSION:
- mobiCoreDevice->mutex_mcp.lock();
- processGetMobiCoreVersion(connection);
- mobiCoreDevice->mutex_mcp.unlock();
- break;
- //-----------------------------------------
- /* Registry functionality */
- // Write Registry Data
- case MC_DRV_REG_STORE_AUTH_TOKEN:
- case MC_DRV_REG_WRITE_ROOT_CONT:
- case MC_DRV_REG_WRITE_SP_CONT:
- case MC_DRV_REG_WRITE_TL_CONT:
- case MC_DRV_REG_WRITE_SO_DATA:
- case MC_DRV_REG_STORE_TA_BLOB:
- reg_mutex.lock();
- processRegistryWriteData(mcDrvCommandHeader.commandId, connection);
- reg_mutex.unlock();
- break;
- //-----------------------------------------
- // Read Registry Data
- case MC_DRV_REG_READ_AUTH_TOKEN:
- case MC_DRV_REG_READ_ROOT_CONT:
- case MC_DRV_REG_READ_SP_CONT:
- case MC_DRV_REG_READ_TL_CONT:
- reg_mutex.lock();
- processRegistryReadData(mcDrvCommandHeader.commandId, connection);
- reg_mutex.unlock();
- break;
- //-----------------------------------------
- // Delete registry data
- case MC_DRV_REG_DELETE_AUTH_TOKEN:
- case MC_DRV_REG_DELETE_ROOT_CONT:
- case MC_DRV_REG_DELETE_SP_CONT:
- case MC_DRV_REG_DELETE_TL_CONT:
- reg_mutex.lock();
- processRegistryDeleteData(mcDrvCommandHeader.commandId, connection);
- reg_mutex.unlock();
- break;
- //-----------------------------------------
- default:
- LOG_E("Unknown command: %d=0x%x",
- mcDrvCommandHeader.commandId,
- mcDrvCommandHeader.commandId);
- ret = false;
- break;
- }
- } while (0);
+ *command_id = mcDrvCommandHeader.commandId;
+ return true;
+}
- LOG_I("handleConnection()<-------");
+void MobiCoreDriverDaemon::handleCommand(Connection *connection, uint32_t command_id) {
+ // This is the big lock around everything the Daemon does, including socket and MCI access
+ static CMutex reg_mutex;
+ static CMutex siq_mutex;
- return ret;
+ LOG_I("%s()==== %p %d", __FUNCTION__, connection, command_id);
+ switch (command_id) {
+ //-----------------------------------------
+ case MC_DRV_CMD_OPEN_DEVICE:
+ mobiCoreDevice->mutex_mcp.lock();
+ processOpenDevice(connection);
+ mobiCoreDevice->mutex_mcp.unlock();
+ break;
+ //-----------------------------------------
+ case MC_DRV_CMD_CLOSE_DEVICE:
+ mobiCoreDevice->mutex_mcp.lock();
+ processCloseDevice(connection);
+ mobiCoreDevice->mutex_mcp.unlock();
+ break;
+ //-----------------------------------------
+ case MC_DRV_CMD_OPEN_SESSION:
+ mobiCoreDevice->mutex_mcp.lock();
+ processOpenSession(connection, false);
+ mobiCoreDevice->mutex_mcp.unlock();
+ break;
+ //-----------------------------------------
+ case MC_DRV_CMD_OPEN_TRUSTLET:
+ mobiCoreDevice->mutex_mcp.lock();
+ processOpenTrustlet(connection);
+ mobiCoreDevice->mutex_mcp.unlock();
+ break;
+ //-----------------------------------------
+ case MC_DRV_CMD_OPEN_TRUSTED_APP:
+ mobiCoreDevice->mutex_mcp.lock();
+ processOpenSession(connection, true);
+ mobiCoreDevice->mutex_mcp.unlock();
+ break;
+ //-----------------------------------------
+ case MC_DRV_CMD_CLOSE_SESSION:
+ mobiCoreDevice->mutex_mcp.lock();
+ processCloseSession(connection);
+ mobiCoreDevice->mutex_mcp.unlock();
+ break;
+ //-----------------------------------------
+ case MC_DRV_CMD_NQ_CONNECT:
+ siq_mutex.lock();
+ processNqConnect(connection);
+ siq_mutex.unlock();
+ break;
+ //-----------------------------------------
+ case MC_DRV_CMD_NOTIFY:
+ siq_mutex.lock();
+ processNotify(connection);
+ siq_mutex.unlock();
+ break;
+ //-----------------------------------------
+ case MC_DRV_CMD_MAP_BULK_BUF:
+ mobiCoreDevice->mutex_mcp.lock();
+ processMapBulkBuf(connection);
+ mobiCoreDevice->mutex_mcp.unlock();
+ break;
+ //-----------------------------------------
+ case MC_DRV_CMD_UNMAP_BULK_BUF:
+ mobiCoreDevice->mutex_mcp.lock();
+ processUnmapBulkBuf(connection);
+ mobiCoreDevice->mutex_mcp.unlock();
+ break;
+ //-----------------------------------------
+ case MC_DRV_CMD_GET_VERSION:
+ processGetVersion(connection);
+ break;
+ //-----------------------------------------
+ case MC_DRV_CMD_GET_MOBICORE_VERSION:
+ mobiCoreDevice->mutex_mcp.lock();
+ processGetMobiCoreVersion(connection);
+ mobiCoreDevice->mutex_mcp.unlock();
+ break;
+ //-----------------------------------------
+ /* Registry functionality */
+ // Write Registry Data
+ case MC_DRV_REG_STORE_AUTH_TOKEN:
+ case MC_DRV_REG_WRITE_ROOT_CONT:
+ case MC_DRV_REG_WRITE_SP_CONT:
+ case MC_DRV_REG_WRITE_TL_CONT:
+ case MC_DRV_REG_WRITE_SO_DATA:
+ case MC_DRV_REG_STORE_TA_BLOB:
+ reg_mutex.lock();
+ processRegistryWriteData(command_id, connection);
+ reg_mutex.unlock();
+ break;
+ //-----------------------------------------
+ // Read Registry Data
+ case MC_DRV_REG_READ_AUTH_TOKEN:
+ case MC_DRV_REG_READ_ROOT_CONT:
+ case MC_DRV_REG_READ_SP_CONT:
+ case MC_DRV_REG_READ_TL_CONT:
+ reg_mutex.lock();
+ processRegistryReadData(command_id, connection);
+ reg_mutex.unlock();
+ break;
+ //-----------------------------------------
+ // Delete registry data
+ case MC_DRV_REG_DELETE_AUTH_TOKEN:
+ case MC_DRV_REG_DELETE_ROOT_CONT:
+ case MC_DRV_REG_DELETE_SP_CONT:
+ case MC_DRV_REG_DELETE_TL_CONT:
+ reg_mutex.lock();
+ processRegistryDeleteData(command_id, connection);
+ reg_mutex.unlock();
+ break;
+ }
+
+ LOG_I("%s()<------- %p", __FUNCTION__, connection);
}
//------------------------------------------------------------------------------
@@ -1296,6 +1335,7 @@ void terminateDaemon(
)
{
LOG_E("Signal %d received\n", signum);
+ exit(EXIT_FAILURE);
}
//------------------------------------------------------------------------------
diff --git a/mobicore/MobiCoreDriverLib/Daemon/MobiCoreDriverDaemon.h b/mobicore/MobiCoreDriverLib/Daemon/MobiCoreDriverDaemon.h
index 2c4b807..7396067 100644
--- a/mobicore/MobiCoreDriverLib/Daemon/MobiCoreDriverDaemon.h
+++ b/mobicore/MobiCoreDriverLib/Daemon/MobiCoreDriverDaemon.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013 TRUSTONIC LIMITED
+ * Copyright (c) 2013-2014 TRUSTONIC LIMITED
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -37,6 +37,10 @@
#include "Server/public/ConnectionHandler.h"
#include "Server/public/Server.h"
+#ifndef WITHOUT_PROXY
+#include "proxy_server.h"
+#endif
+
#include "MobiCoreDevice.h"
#include <string>
@@ -85,22 +89,11 @@ public:
std::vector<std::string> drivers
);
- virtual ~MobiCoreDriverDaemon(
- void
- );
-
- void dropConnection(
- Connection *connection
- );
-
- bool handleConnection(
- Connection *connection
- );
-
- void run(
- void
- );
-
+ virtual ~MobiCoreDriverDaemon();
+ void dropConnection(Connection *connection);
+ virtual bool readCommand(Connection *connection, uint32_t *command_id);
+ virtual void handleCommand(Connection *connection, uint32_t command_id);
+ virtual void run();
private:
MobiCoreDevice *mobiCoreDevice;
/**< Flag to start/stop the scheduler */
@@ -112,6 +105,10 @@ private:
driverResourcesList_t driverResources;
/**< List of servers processing connections */
Server *servers[MAX_SERVERS];
+#ifndef WITHOUT_PROXY
+ ProxyServer proxy_server;
+#endif
+
bool checkPermission(Connection *connection);
diff --git a/mobicore/MobiCoreDriverLib/Daemon/Server/Client.h b/mobicore/MobiCoreDriverLib/Daemon/Server/Client.h
new file mode 100644
index 0000000..21c2ea3
--- /dev/null
+++ b/mobicore/MobiCoreDriverLib/Daemon/Server/Client.h
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 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.
+ */
+
+#ifndef CLIENT_H_
+#define CLIENT_H_
+
+#include "pthread.h"
+
+#include "Queue.h"
+#include "Connection.h"
+#include "MobiCoreDriverCmd.h"
+
+class Client: public CThread {
+ Queue<Client*>& queue_;
+ ConnectionHandler* handler_;
+ Connection* connection_;
+ pthread_mutex_t mutex_;
+ pthread_cond_t condition_;
+ uint32_t command_id_;
+ bool locked_;
+ bool dead_;
+public:
+ Client(ConnectionHandler* handler, int sock, struct sockaddr_un* sockaddr, Queue<Client*>& queue):
+ queue_(queue), handler_(handler), dead_(false) {
+ connection_ = new Connection(sock, sockaddr);
+ pthread_mutex_init(&mutex_, NULL);
+ pthread_cond_init(&condition_, NULL);
+ }
+ ~Client() {
+ delete connection_;
+ pthread_mutex_destroy(&mutex_);
+ pthread_cond_destroy(&condition_);
+ }
+ Connection* connection() {
+ return connection_;
+ }
+ uint32_t commandId() const {
+ return command_id_;
+ }
+ bool isDead() const {
+ return dead_;
+ }
+ // Safe because called on command MC_DRV_CMD_NQ_CONNECT so thread is locked
+ // waiting for command to be treated
+ void detachConnection() {
+ connection_ = NULL;
+ }
+ bool isDetached() const {
+ return connection_ == NULL;
+ }
+ void dropConnection() {
+ LOG_I("Client: %p shutting down due to error", this);
+ handler_->dropConnection(connection_);
+ }
+ void unlock() {
+ pthread_mutex_lock(&mutex_);
+ locked_ = false;
+ pthread_cond_signal(&condition_);
+ pthread_mutex_unlock(&mutex_);
+ }
+ void run() {
+ while (!dead_) {
+ if (!connection_ || !handler_->readCommand(connection_, &command_id_)) {
+ dead_ = true;
+ } else if (command_id_ == MC_DRV_CMD_NOTIFY) {
+ // Notification: send immediately
+ handler_->handleCommand(connection_, command_id_);
+ continue;
+ }
+ // Standard command or we need to stop: queue client to decide what
+ // to do in the main loop
+ pthread_mutex_lock(&mutex_);
+ queue_.push(this);
+ locked_ = true;
+ while (locked_) {
+ pthread_cond_wait(&condition_, &mutex_);
+ }
+ pthread_mutex_unlock(&mutex_);
+ }
+ }
+};
+
+#endif /* CLIENT_H_ */
+
diff --git a/mobicore/MobiCoreDriverLib/Daemon/Server/NetlinkServer.cpp b/mobicore/MobiCoreDriverLib/Daemon/Server/NetlinkServer.cpp
index 46561a7..06db051 100644
--- a/mobicore/MobiCoreDriverLib/Daemon/Server/NetlinkServer.cpp
+++ b/mobicore/MobiCoreDriverLib/Daemon/Server/NetlinkServer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013 TRUSTONIC LIMITED
+ * Copyright (c) 2013-2015 TRUSTONIC LIMITED
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -62,7 +62,7 @@ void NetlinkServer::run(
LOG_I("NetlinkServer: Starting to listen on netlink bus");
// Open a socket
- serverSock = socket(PF_NETLINK, SOCK_DGRAM, MC_DAEMON_NETLINK);
+ serverSock = ::socket(PF_NETLINK, SOCK_DGRAM, MC_DAEMON_NETLINK);
if (serverSock < 0) {
LOG_ERRNO("Opening socket");
break;
@@ -75,7 +75,7 @@ void NetlinkServer::run(
struct msghdr msg;
uint32_t len;
- memset(&src_addr, 0, sizeof(src_addr));
+ ::memset(&src_addr, 0, sizeof(src_addr));
src_addr.nl_family = AF_NETLINK;
src_addr.nl_pid = MC_DAEMON_PID; /* daemon pid */
src_addr.nl_groups = 0; /* not in mcast groups */
@@ -91,12 +91,12 @@ void NetlinkServer::run(
for (;;) {
// This buffer will be taken over by the connection it was routed to
- nlh = (struct nlmsghdr *)malloc(NLMSG_SPACE(MAX_PAYLOAD));
+ nlh = (struct nlmsghdr *)::malloc(NLMSG_SPACE(MAX_PAYLOAD));
if (nlh == NULL) {
LOG_E("Allocation failure");
break;
}
- memset(&msg, 0, sizeof(msg));
+ ::memset(&msg, 0, sizeof(msg));
iov.iov_base = (void *)nlh;
iov.iov_len = NLMSG_SPACE(MAX_PAYLOAD);
msg.msg_iov = &iov;
@@ -104,11 +104,11 @@ void NetlinkServer::run(
msg.msg_name = &src_addr;
msg.msg_namelen = sizeof(src_addr);
- memset(nlh, 0, NLMSG_SPACE(MAX_PAYLOAD));
+ ::memset(nlh, 0, NLMSG_SPACE(MAX_PAYLOAD));
// Read the incoming message and route it to the connection based
// on the incoming PID
- if ((int) (len = recvmsg(serverSock, &msg, 0)) < 0) {
+ if ((int) (len = ::recvmsg(serverSock, &msg, 0)) < 0) {
LOG_ERRNO("recvmsg");
break;
}
@@ -124,6 +124,8 @@ void NetlinkServer::run(
} while (false);
LOG_W("Could not open netlink socket. KernelAPI disabled");
+ kill(getpid(), SIGTERM);
+
}
//------------------------------------------------------------------------------
diff --git a/mobicore/MobiCoreDriverLib/Daemon/Server/Queue.h b/mobicore/MobiCoreDriverLib/Daemon/Server/Queue.h
new file mode 100644
index 0000000..a678645
--- /dev/null
+++ b/mobicore/MobiCoreDriverLib/Daemon/Server/Queue.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2014 TRUSTONIC LIMITED
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following condition_s are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of condition_s and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of condition_s 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 QUEUE_H_
+#define QUEUE_H_
+
+#include "pthread.h"
+
+template <class T>
+class Queue {
+ std::list<T> queue_;
+ pthread_mutex_t mutex_;
+ pthread_cond_t condition_;
+public:
+ Queue() {
+ pthread_mutex_init(&mutex_, NULL);
+ pthread_cond_init(&condition_, NULL);
+ }
+ ~Queue() {
+ pthread_mutex_destroy(&mutex_);
+ pthread_cond_destroy(&condition_);
+ }
+ void push(T data) {
+ pthread_mutex_lock(&mutex_);
+ queue_.push_back(data);
+ pthread_cond_signal(&condition_);
+ pthread_mutex_unlock(&mutex_);
+ }
+ T pop() {
+ pthread_mutex_lock(&mutex_);
+ while (queue_.empty()) {
+ pthread_cond_wait(&condition_, &mutex_);
+ }
+ T data = queue_.front();
+ queue_.pop_front();
+ pthread_mutex_unlock(&mutex_);
+ return data;
+ }
+};
+
+#endif /* QUEUE_H_ */
diff --git a/mobicore/MobiCoreDriverLib/Daemon/Server/Server.cpp b/mobicore/MobiCoreDriverLib/Daemon/Server/Server.cpp
index 418d8b0..dbd6240 100644
--- a/mobicore/MobiCoreDriverLib/Daemon/Server/Server.cpp
+++ b/mobicore/MobiCoreDriverLib/Daemon/Server/Server.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013 TRUSTONIC LIMITED
+ * Copyright (c) 2013-2014 TRUSTONIC LIMITED
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -37,32 +37,58 @@
#include <unistd.h>
#include <string.h>
#include <errno.h>
+#include <pthread.h>
//#define LOG_VERBOSE
#include "log.h"
#include "FSD.h"
+// Local headers
+#include "Queue.h"
+#include "Client.h"
+
+struct Server::Private : public CThread {
+ ConnectionHandler *connectionHandler;
+ std::list<Client*> clients;
+ pthread_mutex_t clients_mutex_;
+ Queue<Client*> queue;
+ Private(ConnectionHandler *ch): connectionHandler(ch) {
+ pthread_mutex_init(&clients_mutex_, NULL);
+ }
+ ~Private() {
+ pthread_mutex_destroy(&clients_mutex_);
+ }
+ void run() {
+ Client* client;
+ for (;;) {
+ client = queue.pop();
+ if (!client) {
+ break;
+ }
+ if (client->isDead()) {
+ if (!client->isDetached()) {
+ client->dropConnection();
+ }
+ client->setExiting();
+ } else {
+ connectionHandler->handleCommand(client->connection(), client->commandId());
+ }
+ client->unlock();
+ }
+ }
+};
//------------------------------------------------------------------------------
-Server::Server(
- ConnectionHandler *connectionHandler,
- const char *localAddr
-) : socketAddr(localAddr)
-{
- this->connectionHandler = connectionHandler;
- this->serverSock = -1;
-}
+Server::Server(ConnectionHandler *handler, const char *localAddr):
+ serverSock(-1), socketAddr(localAddr), connectionHandler(handler),
+ priv_(new Private(connectionHandler)) {}
//------------------------------------------------------------------------------
-void Server::run(
- void
-)
-{
+void Server::run() {
bool isFSDStarted=false;
FSD *FileStorageDaemon=NULL;
do {
-
LOG_I("Server: start listening on socket %s", socketAddr.c_str());
// Open a socket (a UNIX domain stream socket)
@@ -91,8 +117,7 @@ void Server::run(
}
LOG_I("\n********* successfully initialized Daemon *********\n");
-
-
+ priv_->start();
for (;;) {
fd_set fdReadSockets;
@@ -102,19 +127,6 @@ void Server::run(
// Select server socket descriptor
FD_SET(serverSock, &fdReadSockets);
- int maxSocketDescriptor = serverSock;
-
- // Select socket descriptor of all connections
- for (connectionIterator_t iterator = peerConnections.begin();
- iterator != peerConnections.end();
- ++iterator) {
- Connection *connection = (*iterator);
- int peerSocket = connection->socketDescriptor;
- FD_SET(peerSocket, &fdReadSockets);
- if (peerSocket > maxSocketDescriptor) {
- maxSocketDescriptor = peerSocket;
- }
- }
if (!isFSDStarted) {
// Create the <t-base File Storage Daemon
@@ -127,11 +139,8 @@ void Server::run(
// Wait for activities, select() returns the number of sockets
// which require processing
- LOG_V(" Server: waiting on sockets");
- int numSockets = select(
- maxSocketDescriptor + 1,
- &fdReadSockets,
- NULL, NULL, NULL);
+ LOG_V(" Server: waiting on server socket");
+ int numSockets = select(serverSock + 1, &fdReadSockets, NULL, NULL, NULL);
// Check if select failed
if (numSockets < 0) {
@@ -145,7 +154,7 @@ void Server::run(
continue;
}
- LOG_V(" Server: events on %d socket(s).", numSockets);
+ LOG_V(" Server: event on socket.");
// Check if a new client connected to the server socket
if (FD_ISSET(serverSock, &fdReadSockets)) {
@@ -165,9 +174,12 @@ void Server::run(
break;
}
- Connection *connection = new Connection(clientSock, &clientAddr);
- peerConnections.push_back(connection);
- LOG_I(" Server: new socket connection established and start listening.");
+ Client *client = new Client(connectionHandler, clientSock, &clientAddr, priv_->queue);
+ pthread_mutex_lock(&priv_->clients_mutex_);
+ priv_->clients.push_back(client);
+ pthread_mutex_unlock(&priv_->clients_mutex_);
+ client->start();
+ LOG_I(" Server: new socket client %p created and start listening.", client);
} while (false);
// we can ignore any errors from accepting a new connection.
@@ -175,87 +187,89 @@ void Server::run(
// and nothing has changed.
}
- // Handle traffic on existing client connections
- connectionIterator_t iterator = peerConnections.begin();
- while ( (iterator != peerConnections.end())
- && (numSockets > 0) ) {
- Connection *connection = (*iterator);
- int peerSocket = connection->socketDescriptor;
-
- if (!FD_ISSET(peerSocket, &fdReadSockets)) {
- ++iterator;
- continue;
+ // Take this opportunity to reap any dead clients
+ pthread_mutex_lock(&priv_->clients_mutex_);
+ std::list<Client*>::iterator it = priv_->clients.begin();
+ while (it != priv_->clients.end()) {
+ Client* client = *it;
+ if (client->isExiting()) {
+ it = priv_->clients.erase(it);
+ client->join();
+ delete client;
+ LOG_I(" Server: client %p destroyed.", client);
+ } else {
+ it++;
}
-
- numSockets--;
-
- // the connection will be terminated if command processing
- // fails
- if (!connectionHandler->handleConnection(connection)) {
- LOG_I(" Server: dropping connection.");
-
- //Inform the driver
- connectionHandler->dropConnection(connection);
-
- // Remove connection from list
- delete connection;
- iterator = peerConnections.erase(iterator);
- continue;
- }
-
- ++iterator;
}
+ pthread_mutex_unlock(&priv_->clients_mutex_);
}
+ // Exit worker thread
+ priv_->queue.push(NULL);
+ priv_->join();
} while (false);
+ // Change state to STOPPED, releases start() on failure
+ pthread_mutex_lock(&startup_mutex);
+ server_state = STOPPED;
+ pthread_cond_broadcast(&startup_cond);
+ pthread_mutex_unlock(&startup_mutex);
+
+
+
//Wait for File Storage Daemon to exit
if (FileStorageDaemon) {
- FileStorageDaemon->join();
- delete FileStorageDaemon;
+ FileStorageDaemon->join();
+ delete FileStorageDaemon;
}
LOG_ERRNO("Exiting Server, because");
+ kill(getpid(), SIGTERM);
+
}
//------------------------------------------------------------------------------
-void Server::detachConnection(
- Connection *connection
-)
-{
+void Server::detachConnection(Connection* connection) {
LOG_V(" Stopping to listen on notification socket.");
- for (connectionIterator_t iterator = peerConnections.begin();
- iterator != peerConnections.end();
- ++iterator) {
- Connection *tmpConnection = (*iterator);
- if (tmpConnection == connection) {
- peerConnections.erase(iterator);
+ pthread_mutex_lock(&priv_->clients_mutex_);
+ for (std::list<Client*>::iterator it = priv_->clients.begin(); it != priv_->clients.end(); it++) {
+ Client* client = *it;
+ if (client->connection() == connection) {
+ client->detachConnection();
LOG_I(" Stopped listening on notification socket.");
break;
}
}
+ pthread_mutex_unlock(&priv_->clients_mutex_);
}
//------------------------------------------------------------------------------
-Server::~Server(
- void
-)
-{
+Server::~Server() {
// Shut down the server socket
- if(serverSock != -1) {
+ if (serverSock != -1) {
close(serverSock);
- serverSock = -1;
}
-
// Destroy all client connections
- connectionIterator_t iterator = peerConnections.begin();
- while (iterator != peerConnections.end()) {
- Connection *tmpConnection = (*iterator);
- delete tmpConnection;
- iterator = peerConnections.erase(iterator);
+ for (std::list<Client*>::iterator it = priv_->clients.begin(); it != priv_->clients.end(); it++) {
+ Client* client = *it;
+ delete client;
+ }
+ delete priv_;
+}
+
+//------------------------------------------------------------------------------
+
+void Server::start(const char *name) {
+ server_state = STARTING;
+ CThread::start(name);
+ // Hang on till thread has started or stopped
+ pthread_mutex_lock(&startup_mutex);
+ while (server_state == STARTING) {
+ pthread_cond_wait(&startup_cond, &startup_mutex);
}
+ pthread_mutex_unlock(&startup_mutex);
}
diff --git a/mobicore/MobiCoreDriverLib/Daemon/Server/public/ConnectionHandler.h b/mobicore/MobiCoreDriverLib/Daemon/Server/public/ConnectionHandler.h
index 8c769e2..4143db7 100644
--- a/mobicore/MobiCoreDriverLib/Daemon/Server/public/ConnectionHandler.h
+++ b/mobicore/MobiCoreDriverLib/Daemon/Server/public/ConnectionHandler.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013 TRUSTONIC LIMITED
+ * Copyright (c) 2013-2014 TRUSTONIC LIMITED
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -42,6 +42,8 @@ class ConnectionHandler
public:
virtual ~ConnectionHandler() {};
+ virtual bool readCommand(Connection *connection, uint32_t *command_id) = 0;
+ virtual void handleCommand(Connection *connection, uint32_t command_id) = 0;
/**
* Handle connection activities.
@@ -49,9 +51,14 @@ public:
*
* @param [in] connection Reference to the connection which has data to process.
*/
- virtual bool handleConnection(
- Connection *connection
- ) = 0;
+ bool handleConnection(Connection *connection) {
+ uint32_t command_id;
+ if (!readCommand(connection, &command_id)) {
+ return false;
+ }
+ handleCommand(connection, command_id);
+ return true;
+ }
/**
* Connection has been closed.
@@ -60,9 +67,7 @@ public:
*
* @param [in] connection Reference to the connection which will be deleted.
*/
- virtual void dropConnection(
- Connection *connection
- ) = 0;
+ virtual void dropConnection(Connection *connection) = 0;
};
#endif /* CONNECTIONHANDLER_H_ */
diff --git a/mobicore/MobiCoreDriverLib/Daemon/Server/public/NetlinkServer.h b/mobicore/MobiCoreDriverLib/Daemon/Server/public/NetlinkServer.h
index f272368..f0e44aa 100644
--- a/mobicore/MobiCoreDriverLib/Daemon/Server/public/NetlinkServer.h
+++ b/mobicore/MobiCoreDriverLib/Daemon/Server/public/NetlinkServer.h
@@ -51,6 +51,14 @@
class NetlinkServer: public Server, public NetlinkConnectionManager
{
+ /**
+ * Listen for incoming connections.
+ * Implements the central socket server loop. Incoming connections will be stored.
+ */
+ virtual void run(
+ void
+ );
+
public:
/**
* Server contructor.
@@ -70,12 +78,15 @@ public:
);
/**
- * Start server and listen for incoming connections.
- * Implements the central socket server loop. Incoming connections will be stored.
+ * Start server thread.
+ * This function only returns once the server is indeed ready.
*/
- virtual void run(
- void
- );
+ virtual void start(
+ const char *name = NULL
+ ) {
+ // Avoid calling Server::start()
+ CThread::start(name);
+ }
/**
* Remove a connection object from the list of available connections.
diff --git a/mobicore/MobiCoreDriverLib/Daemon/Server/public/Server.h b/mobicore/MobiCoreDriverLib/Daemon/Server/public/Server.h
index 28b74cc..e68bc30 100644
--- a/mobicore/MobiCoreDriverLib/Daemon/Server/public/Server.h
+++ b/mobicore/MobiCoreDriverLib/Daemon/Server/public/Server.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013 TRUSTONIC LIMITED
+ * Copyright (c) 2013-2014 TRUSTONIC LIMITED
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -44,6 +44,7 @@
#include <string>
#include <cstdio>
#include <vector>
+#include <pthread.h>
#include "CThread.h"
#include "ConnectionHandler.h"
@@ -76,7 +77,15 @@ public:
);
/**
- * Start server and listen for incoming connections.
+ * Start server thread.
+ * This function only returns once the server is indeed ready.
+ */
+ virtual void start(
+ const char *name = NULL
+ );
+
+ /**
+ * Listen for incoming connections.
* Implements the central socket server loop. Incoming connections will be stored.
*/
virtual void run(
@@ -94,13 +103,23 @@ public:
Connection *connection
);
+ pthread_mutex_t startup_mutex;
+ pthread_cond_t startup_cond;
+
protected:
int serverSock;
string socketAddr;
ConnectionHandler *connectionHandler; /**< Connection handler registered to the server */
private:
- connectionList_t peerConnections; /**< Connections to devices */
+ struct Private;
+ Private *priv_;
+ // Startup
+ enum {
+ STOPPED,
+ STARTING,
+ STARTED,
+ } server_state;
};
diff --git a/mobicore/MobiCoreDriverLib/Daemon/public/MobiCoreDriverCmd.h b/mobicore/MobiCoreDriverLib/Daemon/public/MobiCoreDriverCmd.h
index 5b02c80..62732f1 100644
--- a/mobicore/MobiCoreDriverLib/Daemon/public/MobiCoreDriverCmd.h
+++ b/mobicore/MobiCoreDriverLib/Daemon/public/MobiCoreDriverCmd.h
@@ -140,6 +140,8 @@ struct MC_DRV_CMD_OPEN_TRUSTLET_struct {
uint32_t tci;
uint32_t handle;
uint32_t len;
+ // Followed by trustlet binary
+
};
typedef struct {
diff --git a/mobicore/MobiCoreDriverLib/Kernel/Platforms/Generic/CMcKMod.cpp b/mobicore/MobiCoreDriverLib/Kernel/Platforms/Generic/CMcKMod.cpp
index 392b193..4a0c2c7 100644
--- a/mobicore/MobiCoreDriverLib/Kernel/Platforms/Generic/CMcKMod.cpp
+++ b/mobicore/MobiCoreDriverLib/Kernel/Platforms/Generic/CMcKMod.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
@@ -65,7 +65,14 @@ mcResult_t CMcKMod::mapWsm(
}
// mapping response data is in the buffer
- struct mc_ioctl_map mapParams;
+ struct mc_ioctl_map mapParams = {
+ len: len,
+ handle: 0,
+ phys_addr: 0,
+ rfu: 0,
+ reused: 0,
+ };
+
mapParams.len = len;
ret = ioctl(fdKMod, MC_IO_MAP_WSM, &mapParams);
@@ -105,7 +112,14 @@ mcResult_t CMcKMod::mapMCI(
{
LOG_I("Mapping MCI: len=%d", len);
// mapping response data is in the buffer
- struct mc_ioctl_map mapParams;
+ struct mc_ioctl_map mapParams = {
+ len: len,
+ handle: 0,
+ phys_addr: 0,
+ rfu: 0,
+ reused: 0,
+ };
+
mapParams.len = len;
if (!isOpen()) {
@@ -211,7 +225,13 @@ int CMcKMod::fcInfo(uint32_t extInfoId, uint32_t *pState, uint32_t *pExtInfo)
}
// Init MC with NQ and MCP buffer addresses
- struct mc_ioctl_info fcInfoParams;
+ struct mc_ioctl_info fcInfoParams = {
+ ext_info_id: extInfoId,
+ state: 0,
+ ext_info: 0,
+ };
+
+
fcInfoParams.ext_info_id = extInfoId;
ret = ioctl(fdKMod, MC_IO_INFO, &fcInfoParams);
@@ -314,7 +334,14 @@ mcResult_t CMcKMod::registerWsmL2(
return MC_DRV_ERR_KMOD_NOT_OPEN;
}
- struct mc_ioctl_reg_wsm params;
+ struct mc_ioctl_reg_wsm params = {
+ buffer: (uintptr_t) buffer,
+ len: len,
+ pid: pid,
+ handle: 0,
+ table_phys: 0,
+ };
+
params.buffer = (uintptr_t)buffer;
params.len = len;
diff --git a/MobiCoreDriverLib/MODULE_LICENSE_BSD b/mobicore/MobiCoreDriverLib/MODULE_LICENSE_BSD
index e69de29..e69de29 100644
--- a/MobiCoreDriverLib/MODULE_LICENSE_BSD
+++ b/mobicore/MobiCoreDriverLib/MODULE_LICENSE_BSD
diff --git a/mobicore/MobiCoreDriverLib/Registry/PrivateRegistry.cpp b/mobicore/MobiCoreDriverLib/Registry/PrivateRegistry.cpp
index 1dfb4d7..3adfb74 100644
--- a/mobicore/MobiCoreDriverLib/Registry/PrivateRegistry.cpp
+++ b/mobicore/MobiCoreDriverLib/Registry/PrivateRegistry.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
@@ -54,7 +54,6 @@
#include "mcVersionHelper.h"
#include "PrivateRegistry.h"
-#include "MobiCoreRegistry.h"
#include "uuid_attestation.h"
@@ -307,7 +306,7 @@ mcResult_t mcRegistryReadAuthToken(mcSoAuthTokenCont_t *so)
//File is shorter than expected
if (feof(fs)) {
LOG_E("%s(): EOF reached: res is %d, size of mcSoAuthTokenCont_t is %zu", __func__, res,
- sizeof(mcSoAuthTokenCont_t));
+ sizeof(mcSoAuthTokenCont_t));
}
fclose(fs);
return MC_DRV_ERR_INVALID_PARAMETER;
@@ -1489,4 +1488,3 @@ regObject_t *mcRegistryGetDriverBlob(const char *filename)
return regobj;
}
-
diff --git a/mobicore/MobiCoreDriverLib/Registry/Registry.cpp b/mobicore/MobiCoreDriverLib/Registry/Registry.cpp
index 6c8bc62..bcb2923 100644
--- a/mobicore/MobiCoreDriverLib/Registry/Registry.cpp
+++ b/mobicore/MobiCoreDriverLib/Registry/Registry.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013 TRUSTONIC LIMITED
+ * Copyright (c) 2013-2015 TRUSTONIC LIMITED
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/mobicore/MobiCoreDriverLib/buildTag.h b/mobicore/MobiCoreDriverLib/buildTag.h
index e173604..5b5f640 100644
--- a/mobicore/MobiCoreDriverLib/buildTag.h
+++ b/mobicore/MobiCoreDriverLib/buildTag.h
@@ -28,6 +28,6 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/** Build tag created during build by /data/buildserver/jenkins/workspace/CustomerPackage-QC-MSM8916-Branch-rel_t-base-301B-V001_qc/dev/components/MobiCoreDriver/Linux/Daemon/../../../../../build/tools/Scripts/setBuildTag.sh. */
+/** Build tag created during build by /home/artcas01/svn/tbase/users/artcas01/t-base-301D_qc_dev/dev/components/MobiCoreDriver/Linux/Daemon/../../../../../build/tools/Scripts/setBuildTag.sh. */
#define MOBICORE_COMPONENT_BUILD_TAG \
- "t-base-QC-MSM8916-Android-301B-V003-37_37"
+ "Build by artcas01@artcas01-PC 11/30/15 10:06:36"
diff --git a/mobicore/common/LogWrapper/Android.mk b/mobicore/common/LogWrapper/Android.mk
index b869c2b..bc7d2cb 100644
--- a/mobicore/common/LogWrapper/Android.mk
+++ b/mobicore/common/LogWrapper/Android.mk
@@ -12,4 +12,4 @@ LOCAL_SHARED_LIBRARIES += liblog
# Enable logging to logcat per default
LOCAL_CFLAGS += -DLOG_ANDROID
-LOCAL_C_INCLUDES += $(call my-dir) \ No newline at end of file
+LOCAL_C_INCLUDES += $(call my-dir)
diff --git a/mobicore/common/MobiCore/inc/McLib/GpTci.h b/mobicore/common/MobiCore/inc/McLib/GpTci.h
index 47df0f2..c86a722 100644
--- a/mobicore/common/MobiCore/inc/McLib/GpTci.h
+++ b/mobicore/common/MobiCore/inc/McLib/GpTci.h
@@ -36,15 +36,10 @@ typedef struct {
uint32_t b;
} TEE_Value;
-#if defined (TRUSTEDAPP)
-typedef struct {
- void *sVirtualAddr; /**< The virtual address of the Bulk buffer regarding the address space of the Trustlet, already includes a possible offset! */
- uint32_t sVirtualLen; /**< Length of the mapped Bulk buffer */
-} mcBulkMap_t;
-#endif
typedef struct {
- mcBulkMap_t mapInfo;
+ uint32_t sVirtualAddr; /**< The virtual address of the Bulk buffer regarding the address space of the Trustlet, already includes a possible offset! */
+ uint32_t sVirtualLen;
uint32_t outputSize;
} _TEEC_MemoryReferenceInternal;
diff --git a/mobicore/common/MobiCore/inc/TlCm/2.0/cmp.h b/mobicore/common/MobiCore/inc/TlCm/2.0/cmp.h
index 33182ad..45bcb7a 100644
--- a/mobicore/common/MobiCore/inc/TlCm/2.0/cmp.h
+++ b/mobicore/common/MobiCore/inc/TlCm/2.0/cmp.h
@@ -1,3 +1,33 @@
+/*
+ * Copyright (c) 2013 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.
+ */
/** @addtogroup CMP_2_0
* Content Management Protocol 2.0 Definitions.
*
@@ -11,33 +41,6 @@
* CMP 2.0 global definitions.
* Various components need access to (sub-)structures defined and used by CMP
* 2.0. These common definitions are made available through this header file.
- *
- * Copyright © Trustonic Limited 2013.
- *
- * 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 CMP_H_
@@ -69,7 +72,7 @@ typedef struct {
mcSoAuthTokenCont_t soAuthTokenCont;
} cmpCmdBeginSocAuthentication_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_BEGIN_SOC_AUTHENTICATION_RSP Response_2_0
* @{ */
@@ -98,9 +101,9 @@ typedef struct {
cmpBeginSocAuthenticationRsp_t rsp;
} cmpRspBeginSocAuthentication_t;
-/** @} */
+/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_BEGIN_ROOT_AUTHENTICATION \
MC_CMP_2_0_CMD_BEGIN_ROOT_AUTHENTICATION
@@ -123,7 +126,7 @@ typedef struct {
mcSoRootCont_t soRootCont;
} cmpCmdBeginRootAuthentication_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_BEGIN_ROOT_AUTHENTICATION_RSP Response_2_0
* @{ */
@@ -152,9 +155,9 @@ typedef struct {
cmpBeginRootAuthenticationRsp_t rsp;
} cmpRspBeginRootAuthentication_t;
-/** @} */
+/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_BEGIN_SP_AUTHENTICATION \
MC_CMP_2_0_CMD_BEGIN_SP_AUTHENTICATION
@@ -220,7 +223,7 @@ typedef struct {
/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_AUTHENTICATE MC_CMP_2_0_CMD_AUTHENTICATE
* @{ */
@@ -256,7 +259,7 @@ typedef struct {
cmpCommandHeader_t cmdHeader;
/** Encrypted and padded data. */
cmpAuthCmdEd_t ed;
-} cmpAuthCmdSdata_t;
+} cmpAuthCmdSdata_t;
/** Authenticate signed command and signature. */
typedef struct {
@@ -272,7 +275,7 @@ typedef struct {
cmpAuthenticateCmd_t cmd;
} cmpCmdAuthenticate_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_AUTHENTICATE_RSP Response_2_0
* @{ */
@@ -321,9 +324,9 @@ typedef struct {
cmpAuthenticateRsp_t rsp;
} cmpRspAuthenticate_t;
-/** @} */
+/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_AUTHENTICATE_TERMINATE \
MC_CMP_2_0_CMD_AUTHENTICATE_TERMINATE
@@ -352,7 +355,7 @@ typedef struct {
cmpAuthenticateTerminateCmd_t cmd;
} cmpCmdAuthenticateTerminate_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_AUTHENTICATE_TERMINATE_RSP Response_2_0
* @{ */
@@ -426,7 +429,7 @@ typedef struct {
cmpRootContRegisterActivateCmd_t cmd;
} cmpCmdRootContRegisterActivate_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_ROOT_CONT_REGISTER_ACTIVATE_RSP Response_2_0
* @{ */
@@ -518,7 +521,7 @@ typedef struct {
cmpRootContUnregisterCmd_t cmd;
} cmpCmdRootContUnregister_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_ROOT_CONT_UNREGISTER_RSP Response_2_0
* @{ */
@@ -561,9 +564,9 @@ typedef struct {
mcSoAuthTokenCont_t soAuthTokenCont;
} cmpRspRootContUnregister_t;
-/** @} */
+/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_ROOT_CONT_LOCK_BY_ROOT \
MC_CMP_2_0_CMD_ROOT_CONT_LOCK_BY_ROOT
@@ -592,7 +595,7 @@ typedef struct {
cmpRootContLockByRootCmd_t cmd;
} cmpCmdRootContLockByRoot_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_ROOT_CONT_LOCK_BY_ROOT_RSP Response_2_0
* @{ */
@@ -635,9 +638,9 @@ typedef struct {
mcSoRootCont_t soRootCont;
} cmpRspRootContLockByRoot_t;
-/** @} */
+/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_ROOT_CONT_UNLOCK_BY_ROOT \
MC_CMP_2_0_CMD_ROOT_CONT_UNLOCK_BY_ROOT
@@ -666,7 +669,7 @@ typedef struct {
cmpRootContUnlockByRootCmd_t cmd;
} cmpCmdRootContUnlockByRoot_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_ROOT_CONT_UNLOCK_BY_ROOT_RSP Response_2_0
* @{ */
@@ -709,9 +712,9 @@ typedef struct {
mcSoRootCont_t soRootCont;
} cmpRspRootContUnlockByRoot_t;
-/** @} */
+/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_SP_CONT_REGISTER_ACTIVATE \
MC_CMP_2_0_CMD_SP_CONT_REGISTER_ACTIVATE
@@ -757,7 +760,7 @@ typedef struct {
cmpSpContRegisterActivateCmd_t cmd;
} cmpCmdSpContRegisterActivate_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_SP_CONT_REGISTER_ACTIVATE_RSP Response_2_0
* @{ */
@@ -837,7 +840,7 @@ typedef struct {
cmpSpContUnregisterCmd_t cmd;
} cmpCmdSpContUnregister_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_SP_CONT_UNREGISTER_RSP Response_2_0
* @{ */
@@ -880,9 +883,9 @@ typedef struct {
mcSoRootCont_t soRootCont;
} cmpRspSpContUnregister_t;
-/** @} */
+/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_SP_CONT_REGISTER \
MC_CMP_2_0_CMD_SP_CONT_REGISTER
@@ -929,7 +932,7 @@ typedef struct {
cmpSpContRegisterCmd_t cmd;
} cmpCmdSpContRegister_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_SP_CONT_REGISTER_RSP Response_2_0
* @{ */
@@ -975,9 +978,9 @@ typedef struct {
mcSoSpCont_t soSpCont;
} cmpRspSpContRegister_t;
-/** @} */
+/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_SP_CONT_LOCK_BY_ROOT \
MC_CMP_2_0_CMD_SP_CONT_LOCK_BY_ROOT
@@ -989,7 +992,7 @@ typedef struct {
/** SpContLockByRoot signed command. */
typedef struct {
/** Command header. */
- cmpCommandHeader_t cmdHeader;
+ cmpCommandHeader_t cmdHeader;
/** Spid. */
mcSpid_t spid;
} cmpSpLockByRootCmdSdata_t;
@@ -1010,7 +1013,7 @@ typedef struct {
mcSoSpCont_t soSpCont;
} cmpCmdSpContLockByRoot_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_SP_CONT_LOCK_BY_ROOT_RSP Response_2_0
* @{ */
@@ -1053,9 +1056,9 @@ typedef struct {
mcSoSpCont_t soSpCont;
} cmpRspSpContLockByRoot_t;
-/** @} */
+/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_SP_CONT_UNLOCK_BY_ROOT \
MC_CMP_2_0_CMD_SP_CONT_UNLOCK_BY_ROOT
@@ -1067,7 +1070,7 @@ typedef struct {
/** SpContUnlockByRoot signed command. */
typedef struct {
/** Command header. */
- cmpCommandHeader_t cmdHeader;
+ cmpCommandHeader_t cmdHeader;
/** Spid. */
mcSpid_t spid;
} cmpSpUnlockByRootCmdSdata_t;
@@ -1088,7 +1091,7 @@ typedef struct {
mcSoSpCont_t soSpCont;
} cmpCmdSpContUnlockByRoot_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_SP_CONT_UNLOCK_BY_ROOT_RSP Response_2_0
* @{ */
@@ -1131,9 +1134,9 @@ typedef struct {
mcSoSpCont_t soSpCont;
} cmpRspSpContUnlockByRoot_t;
-/** @} */
+/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_SP_CONT_ACTIVATE \
MC_CMP_2_0_CMD_SP_CONT_ACTIVATE
@@ -1180,7 +1183,7 @@ typedef struct {
cmpSpContActivateCmd_t cmd;
} cmpCmdSpContActivate_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_SP_CONT_ACTIVATE_RSP Response_2_0
* @{ */
@@ -1223,9 +1226,9 @@ typedef struct {
mcSoSpCont_t soSpCont;
} cmpRspSpContActivate_t;
-/** @} */
+/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_SP_CONT_LOCK_BY_SP \
MC_CMP_2_0_CMD_SP_CONT_LOCK_BY_SP
@@ -1237,7 +1240,7 @@ typedef struct {
/** SpContLockBySp signed command. */
typedef struct {
/** Command header. */
- cmpCommandHeader_t cmdHeader;
+ cmpCommandHeader_t cmdHeader;
/** Spid. */
mcSpid_t spid;
} cmpSpLockBySpCmdSdata_t;
@@ -1256,7 +1259,7 @@ typedef struct {
cmpSpContLockBySpCmd_t cmd;
} cmpCmdSpContLockBySp_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_SP_CONT_LOCK_BY_SP_RSP Response_2_0
* @{ */
@@ -1299,9 +1302,9 @@ typedef struct {
mcSoSpCont_t soSpCont;
} cmpRspSpContLockBySp_t;
-/** @} */
+/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_SP_CONT_UNLOCK_BY_SP \
MC_CMP_2_0_CMD_SP_CONT_UNLOCK_BY_SP
@@ -1313,7 +1316,7 @@ typedef struct {
/** SpContUnlockBySp signed command. */
typedef struct {
/** Command header. */
- cmpCommandHeader_t cmdHeader;
+ cmpCommandHeader_t cmdHeader;
/** Spid. */
mcSpid_t spid;
} cmpSpUnlockBySpCmdSdata_t;
@@ -1332,7 +1335,7 @@ typedef struct {
cmpSpContUnlockBySpCmd_t cmd;
} cmpCmdSpContUnlockBySp_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_SP_CONT_UNLOCK_BY_SP_RSP Response_2_0
* @{ */
@@ -1426,7 +1429,7 @@ typedef struct {
cmpTltContRegisterActivateCmd_t cmd;
} cmpCmdTltContRegisterActivate_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_TLT_CONT_REGISTER_ACTIVATE_RSP Response_2_0
* @{ */
@@ -1508,7 +1511,7 @@ typedef struct {
cmpTltContUnregisterCmd_t cmd;
} cmpCmdTltContUnregister_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_TLT_CONT_UNREGISTER_RSP Response_2_0
* @{ */
@@ -1551,9 +1554,9 @@ typedef struct {
mcSoSpCont_t soSpCont;
} cmpRspTltContUnregister_t;
-/** @} */
+/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_TLT_CONT_REGISTER \
MC_CMP_2_0_CMD_TLT_CONT_REGISTER
@@ -1602,7 +1605,7 @@ typedef struct {
cmpTltContRegisterCmd_t cmd;
} cmpCmdTltContRegister_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_TLT_CONT_REGISTER_RSP Response_2_0
* @{ */
@@ -1649,9 +1652,9 @@ typedef struct {
mcSoTltCont_2_0_t soTltCont;
} cmpRspTltContRegister_t;
-/** @} */
+/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_TLT_CONT_ACTIVATE \
MC_CMP_2_0_CMD_TLT_CONT_ACTIVATE
@@ -1686,7 +1689,7 @@ typedef struct {
mcSoTltCont_2_0_t soTltCont;
} cmpCmdTltContActivate_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_TLT_CONT_ACTIVATE_RSP Response_2_0
* @{ */
@@ -1729,9 +1732,9 @@ typedef struct {
mcSoTltCont_2_0_t soTltCont;
} cmpRspTltContActivate_t;
-/** @} */
+/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_TLT_CONT_LOCK_BY_SP \
MC_CMP_2_0_CMD_TLT_CONT_LOCK_BY_SP
@@ -1766,7 +1769,7 @@ typedef struct {
mcSoTltCont_2_0_t soTltCont;
} cmpCmdTltContLockBySp_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_TLT_CONT_LOCK_BY_SP_RSP Response_2_0
* @{ */
@@ -1809,9 +1812,9 @@ typedef struct {
mcSoTltCont_2_0_t soTltCont;
} cmpRspTltContLockBySp_t;
-/** @} */
+/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_TLT_CONT_UNLOCK_BY_SP \
MC_CMP_2_0_CMD_TLT_CONT_UNLOCK_BY_SP
@@ -1846,7 +1849,7 @@ typedef struct {
mcSoTltCont_2_0_t soTltCont;
} cmpCmdTltContUnlockBySp_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_TLT_CONT_UNLOCK_BY_SP_RSP Response_2_0
* @{ */
@@ -1891,7 +1894,7 @@ typedef struct {
/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_TLT_CONT_PERSONALIZE \
MC_CMP_2_0_CMD_TLT_CONT_PERSONALIZE
@@ -1946,7 +1949,7 @@ typedef struct {
mcSoTltCont_2_0_t soTltCont;
} cmpCmdTltContPersonalize_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_TLT_CONT_PERSONLIZE_RSP Response_2_0
* @{ */
diff --git a/mobicore/common/MobiCore/inc/TlCm/2.0/tlCmApi.h b/mobicore/common/MobiCore/inc/TlCm/2.0/tlCmApi.h
index d653145..df4217d 100644
--- a/mobicore/common/MobiCore/inc/TlCm/2.0/tlCmApi.h
+++ b/mobicore/common/MobiCore/inc/TlCm/2.0/tlCmApi.h
@@ -1,3 +1,33 @@
+/*
+ * Copyright (c) 2013 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.
+ */
/** @addtogroup CMP_2_0
* @{
* @file
@@ -6,33 +36,6 @@
* The TlCm is responsible for implementing content management protocol (CMP)
* 2.0 commands and generating approriate CMP 2.0 responses in the trustlet
* control interface (TCI).
- *
- * Copyright © Trustonic Limited 2013.
- *
- * 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 TL_CM_API_H_
diff --git a/mobicore/common/MobiCore/inc/TlCm/3.0/cmp.h b/mobicore/common/MobiCore/inc/TlCm/3.0/cmp.h
index 8454131..6abb747 100644
--- a/mobicore/common/MobiCore/inc/TlCm/3.0/cmp.h
+++ b/mobicore/common/MobiCore/inc/TlCm/3.0/cmp.h
@@ -1,3 +1,33 @@
+/*
+ * Copyright (c) 2013 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.
+ */
/** @addtogroup CMP
* Content Management Protocol Definitions.
*
@@ -11,33 +41,6 @@
* CMP TCI global definitions.
* Various components need access to (sub-)structures defined and used by CMP;
* these common definitions are made available through this header file.
- *
- * Copyright © Trustonic Limited 2013.
- *
- * 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 CMP_H_
@@ -48,9 +51,13 @@
/** Info of the whole mapped memory with NWd. */
typedef struct {
/** Address of the mapped memory. */
+#if ( __WORDSIZE == 64 )
+ uint32_t addr; /**< The virtual address of the Bulk buffer regarding the address space of the Trusted Application, already includes a possible offset! */
+#else
void* addr;
+#endif
/** Size of the mapped memory. */
- uint32_t len;
+ uint32_t len;
} cmpMapInfo_t;
/** Info of the mapped element from a CMP message with NWd. */
@@ -58,7 +65,7 @@ typedef struct {
/** Offset of the mapped element in the mapped memory. */
uint32_t offset;
/** Size of the mapped element. */
- uint32_t len;
+ uint32_t len;
} cmpMapOffsetInfo_t;
/** TCI CMP command header. */
@@ -81,7 +88,7 @@ typedef struct {
cmpResponseId_t responseId;
/** Required lenght (return 0 if lenght is enough) of the mapped memory
* with NWd. */
- uint32_t len;
+ uint32_t len;
} cmpResponseHeaderTci_t;
/** @defgroup MC_CMP_CMD_GET_VERSION_TCI \
@@ -145,7 +152,7 @@ typedef struct {
/** @} */
/** @defgroup MC_CMP_CMD_GENERATE_AUTH_TOKEN_TCI \
- MC_CMP_CMD_GENERATE_AUTH_TOKEN_TCI
+ MC_CMP_CMD_GENERATE_AUTH_TOKEN_TCI
* @{ */
/** @defgroup MC_CMP_CMD_GENERATE_AUTH_TOKEN_TCI_CMD Command
@@ -176,6 +183,38 @@ typedef struct {
/** @} */
+/** @defgroup MC_CMP_CMD_GENERATE_BINDING_KEY_TCI \
+ MC_CMP_CMD_GENERATE_BINDING_KEY_TCI
+ * @{ */
+
+/** @defgroup MC_CMP_CMD_GENERATE_BINDING_KEY_TCI_CMD Command
+ * @{ */
+
+/** GenBindingKey TCI command. */
+typedef struct {
+ /** Command header. */
+ cmpCommandHeaderTci_t cmdHeader;
+} cmpCmdGenBindingKeyTci_t;
+
+/** @} */
+
+/** @defgroup MC_CMP_CMD_GENERATE_BINDING_KEY_TCI_RSP Response
+ * @{ */
+
+/** GenAuthToken TCI response. */
+typedef struct {
+ /** Response header. */
+ cmpResponseHeaderTci_t rspHeaderTci;
+ /** Offset of the mapped CMP response with NWd. */
+ cmpMapOffsetInfo_t cmpRspMapOffsetInfo;
+ /** Offset of the mapped AuthTokenCont with NWd. */
+ cmpMapOffsetInfo_t cmpAuthTokenContMapOffsetInfo;
+} cmpRspGenBindingKeyTci_t;
+
+/** @} */
+
+/** @} */
+
/** @defgroup MC_CMP_CMD_BEGIN_SOC_AUTHENTICATION_TCI \
MC_CMP_CMD_BEGIN_SOC_AUTHENTICATION_TCI
* @{ */
@@ -191,7 +230,7 @@ typedef struct {
cmpMapOffsetInfo_t cmpAuthTokenContMapOffsetInfo;
} cmpCmdBeginSocAuthenticationTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_BEGIN_SOC_AUTHENTICATION_TCI_RSP Response
* @{ */
@@ -204,9 +243,9 @@ typedef struct {
cmpMapOffsetInfo_t cmpRspMapOffsetInfo;
} cmpRspBeginSocAuthenticationTci_t;
-/** @} */
+/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_BEGIN_ROOT_AUTHENTICATION_TCI \
MC_CMP_CMD_BEGIN_ROOT_AUTHENTICATION_TCI
@@ -223,7 +262,7 @@ typedef struct {
cmpMapOffsetInfo_t cmpRootContMapOffsetInfo;
} cmpCmdBeginRootAuthenticationTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_BEGIN_ROOT_AUTHENTICATION_TCI_RSP Response
* @{ */
@@ -236,7 +275,7 @@ typedef struct {
cmpMapOffsetInfo_t cmpRspMapOffsetInfo;
} cmpRspBeginRootAuthenticationTci_t;
-/** @} */
+/** @} */
/** @} */
@@ -257,7 +296,7 @@ typedef struct {
cmpMapOffsetInfo_t cmpSpContMapOffsetInfo;
} cmpCmdBeginSpAuthenticationTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_BEGIN_SP_AUTHENTICATION_TCI_RSP Response
* @{ */
@@ -270,9 +309,9 @@ typedef struct {
cmpMapOffsetInfo_t cmpRspMapOffsetInfo;
} cmpRspBeginSpAuthenticationTci_t;
-/** @} */
+/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_AUTHENTICATE_TCI \
MC_CMP_CMD_AUTHENTICATE_TCI
@@ -287,7 +326,7 @@ typedef struct {
cmpCommandHeaderTci_t cmdHeader;
} cmpCmdAuthenticateTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_AUTHENTICATE_TCI_RSP Response
* @{ */
@@ -300,9 +339,9 @@ typedef struct {
cmpMapOffsetInfo_t cmpRspMapOffsetInfo;
} cmpRspAuthenticateTci_t;
-/** @} */
+/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_AUTHENTICATE_TERMINATE_TCI \
MC_CMP_CMD_AUTHENTICATE_TERMINATE_TCI
@@ -317,7 +356,7 @@ typedef struct {
cmpCommandHeaderTci_t cmdHeader;
} cmpCmdAuthenticateTerminateTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_AUTHENTICATE_TERMINATE_TCI_RSP Response
* @{ */
@@ -330,9 +369,9 @@ typedef struct {
cmpMapOffsetInfo_t cmpRspMapOffsetInfo;
} cmpRspAuthenticateTerminateTci_t;
-/** @} */
+/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_ROOT_CONT_REGISTER_ACTIVATE_TCI \
MC_CMP_CMD_ROOT_CONT_REGISTER_ACTIVATE_TCI
@@ -347,7 +386,7 @@ typedef struct {
cmpCommandHeaderTci_t cmdHeader;
} cmpCmdRootContRegisterActivateTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_ROOT_CONT_REGISTER_ACTIVATE_TCI_RSP Response
* @{ */
@@ -379,7 +418,7 @@ typedef struct {
cmpCommandHeaderTci_t cmdHeader;
} cmpCmdRootContUnregisterTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_ROOT_CONT_UNREGISTER_TCI_RSP Response
* @{ */
@@ -392,9 +431,9 @@ typedef struct {
cmpMapOffsetInfo_t cmpRspMapOffsetInfo;
} cmpRspRootContUnregisterTci_t;
-/** @} */
+/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_ROOT_CONT_LOCK_BY_ROOT_TCI \
MC_CMP_CMD_ROOT_CONT_LOCK_BY_ROOT_TCI
@@ -409,7 +448,7 @@ typedef struct {
cmpCommandHeaderTci_t cmdHeader;
} cmpCmdRootContLockByRootTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_ROOT_CONT_LOCK_BY_ROOT_TCI_RSP Response
* @{ */
@@ -424,9 +463,9 @@ typedef struct {
cmpMapOffsetInfo_t cmpRootContMapOffsetInfo;
} cmpRspRootContLockByRootTci_t;
-/** @} */
+/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_ROOT_CONT_UNLOCK_BY_ROOT_TCI \
MC_CMP_CMD_ROOT_CONT_UNLOCK_BY_ROOT_TCI
@@ -441,7 +480,7 @@ typedef struct {
cmpCommandHeaderTci_t cmdHeader;
} cmpCmdRootContUnlockByRootTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_ROOT_CONT_UNLOCK_BY_ROOT_TCI_RSP Response
* @{ */
@@ -456,9 +495,9 @@ typedef struct {
cmpMapOffsetInfo_t cmpRootContMapOffsetInfo;
} cmpRspRootContUnlockByRootTci_t;
-/** @} */
+/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_REGISTER_ACTIVATE_TCI \
MC_CMP_CMD_SP_CONT_REGISTER_ACTIVATE_TCI
@@ -473,7 +512,7 @@ typedef struct {
cmpCommandHeaderTci_t cmdHeader;
} cmpCmdSpContRegisterActivateTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_REGISTER_ACTIVATE_TCI_RSP Response
* @{ */
@@ -490,9 +529,9 @@ typedef struct {
cmpMapOffsetInfo_t cmpSpContMapOffsetInfo;
} cmpRspSpContRegisterActivateTci_t;
-/** @} */
+/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_UNREGISTER_TCI \
MC_CMP_CMD_SP_CONT_UNREGISTER_TCI
@@ -507,7 +546,7 @@ typedef struct {
cmpCommandHeaderTci_t cmdHeader;
} cmpCmdSpContUnregisterTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_UNREGISTER_TCI_RSP Response
* @{ */
@@ -522,7 +561,7 @@ typedef struct {
cmpMapOffsetInfo_t cmpRootContMapOffsetInfo;
} cmpRspSpContUnregisterTci_t;
-/** @} */
+/** @} */
/** @} */
@@ -539,7 +578,7 @@ typedef struct {
cmpCommandHeaderTci_t cmdHeader;
} cmpCmdSpContRegisterTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_REGISTER_TCI_RSP Response
* @{ */
@@ -556,9 +595,9 @@ typedef struct {
cmpMapOffsetInfo_t cmpSpContMapOffsetInfo;
} cmpRspSpContRegisterTci_t;
-/** @} */
+/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_LOCK_BY_ROOT_TCI \
MC_CMP_CMD_SP_CONT_LOCK_BY_ROOT_TCI
@@ -575,7 +614,7 @@ typedef struct {
cmpMapOffsetInfo_t cmpSpContMapOffsetInfo;
} cmpCmdSpContLockByRootTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_LOCK_BY_ROOT_TCI_RSP Response
* @{ */
@@ -590,9 +629,9 @@ typedef struct {
cmpMapOffsetInfo_t cmpSpContMapOffsetInfo;
} cmpRspSpContLockByRootTci_t;
-/** @} */
+/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_UNLOCK_BY_ROOT_TCI \
MC_CMP_CMD_SP_CONT_UNLOCK_BY_ROOT_TCI
@@ -609,7 +648,7 @@ typedef struct {
cmpMapOffsetInfo_t cmpSpContMapOffsetInfo;
} cmpCmdSpContUnlockByRootTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_UNLOCK_BY_ROOT_TCI_RSP Response
* @{ */
@@ -624,9 +663,9 @@ typedef struct {
cmpMapOffsetInfo_t cmpSpContMapOffsetInfo;
} cmpRspSpContUnlockByRootTci_t;
-/** @} */
+/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_ACTIVATE_TCI \
MC_CMP_CMD_SP_CONT_ACTIVATE_TCI
@@ -641,7 +680,7 @@ typedef struct {
cmpCommandHeaderTci_t cmdHeader;
} cmpCmdSpContActivateTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_ACTIVATE_TCI_RSP Response
* @{ */
@@ -656,9 +695,9 @@ typedef struct {
cmpMapOffsetInfo_t cmpSpContMapOffsetInfo;
} cmpRspSpContActivateTci_t;
-/** @} */
+/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_LOCK_BY_SP_TCI \
MC_CMP_CMD_SP_CONT_LOCK_BY_SP_TCI
@@ -673,7 +712,7 @@ typedef struct {
cmpCommandHeaderTci_t cmdHeader;
} cmpCmdSpContLockBySpTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_LOCK_BY_SP_TCI_RSP Response
* @{ */
@@ -688,9 +727,9 @@ typedef struct {
cmpMapOffsetInfo_t cmpSpContMapOffsetInfo;
} cmpRspSpContLockBySpTci_t;
-/** @} */
+/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_UNLOCK_BY_SP_TCI \
MC_CMP_CMD_SP_CONT_UNLOCK_BY_SP_TCI
@@ -705,7 +744,7 @@ typedef struct {
cmpCommandHeaderTci_t cmdHeader;
} cmpCmdSpContUnlockBySpTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_UNLOCK_BY_SP_TCI_RSP Response
* @{ */
@@ -720,9 +759,9 @@ typedef struct {
cmpMapOffsetInfo_t cmpSpContMapOffsetInfo;
} cmpRspSpContUnlockBySpTci_t;
-/** @} */
+/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_TLT_CONT_REGISTER_ACTIVATE_TCI \
MC_CMP_CMD_TLT_CONT_REGISTER_ACTIVATE_TCI
@@ -737,7 +776,7 @@ typedef struct {
cmpCommandHeaderTci_t cmdHeader;
} cmpCmdTltContRegisterActivateTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_TLT_CONT_REGISTER_ACTIVATE_TCI_RSP Response
* @{ */
@@ -756,7 +795,7 @@ typedef struct {
/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_TLT_CONT_UNREGISTER_TCI \
MC_CMP_CMD_TLT_CONT_UNREGISTER_TCI
@@ -771,7 +810,7 @@ typedef struct {
cmpCommandHeaderTci_t cmdHeader;
} cmpCmdTltContUnregisterTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_TLT_CONT_UNREGISTER_TCI_RSP Response
* @{ */
@@ -803,7 +842,7 @@ typedef struct {
cmpCommandHeaderTci_t cmdHeader;
} cmpCmdTltContRegisterTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_TLT_CONT_REGISTER_TCI_RSP Response
* @{ */
@@ -820,7 +859,7 @@ typedef struct {
cmpMapOffsetInfo_t cmpTltContMapOffsetInfo;
} cmpRspTltContRegisterTci_t;
-/** @} */
+/** @} */
/** @} */
@@ -839,7 +878,7 @@ typedef struct {
cmpMapOffsetInfo_t cmpTltContMapOffsetInfo;
} cmpCmdTltContActivateTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_TLT_CONT_ACTIVATE_TCI_RSP Response
* @{ */
@@ -854,9 +893,9 @@ typedef struct {
cmpMapOffsetInfo_t cmpTltContMapOffsetInfo;
} cmpRspTltContActivateTci_t;
-/** @} */
+/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_TLT_CONT_LOCK_BY_SP_TCI \
MC_CMP_CMD_TLT_CONT_LOCK_BY_SP_TCI
@@ -873,7 +912,7 @@ typedef struct {
cmpMapOffsetInfo_t cmpTltContMapOffsetInfo;
} cmpCmdTltContLockBySpTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_TLT_CONT_LOCK_BY_SP_TCI_RSP Response
* @{ */
@@ -888,9 +927,9 @@ typedef struct {
cmpMapOffsetInfo_t cmpTltContMapOffsetInfo;
} cmpRspTltContLockBySpTci_t;
-/** @} */
+/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_TLT_CONT_UNLOCK_BY_SP_TCI \
MC_CMP_CMD_TLT_CONT_UNLOCK_BY_SP_TCI
@@ -907,7 +946,7 @@ typedef struct {
cmpMapOffsetInfo_t cmpTltContMapOffsetInfo;
} cmpCmdTltContUnlockBySpTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_TLT_CONT_UNLOCK_BY_SP_TCI_RSP Response
* @{ */
@@ -941,7 +980,7 @@ typedef struct {
cmpMapOffsetInfo_t cmpTltContMapOffsetInfo;
} cmpCmdTltContPersonalizeTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_TLT_CONT_PERSONALIZE_TCI_RSP Response
* @{ */
diff --git a/mobicore/common/MobiCore/inc/TlCm/3.0/cmpMap.h b/mobicore/common/MobiCore/inc/TlCm/3.0/cmpMap.h
index 05c3e7c..56d7fff 100644
--- a/mobicore/common/MobiCore/inc/TlCm/3.0/cmpMap.h
+++ b/mobicore/common/MobiCore/inc/TlCm/3.0/cmpMap.h
@@ -1,3 +1,33 @@
+/*
+ * Copyright (c) 2013 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.
+ */
/** @addtogroup CMP
* Content Management Protocol Definitions.
*
@@ -11,33 +41,6 @@
* CMP mapped global definitions.
* Various components need access to (sub-)structures defined and used by CMP;
* these common definitions are made available through this header file.
- *
- * Copyright © Trustonic Limited 2013.
- *
- * 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 CMP_MAP_H_
@@ -69,6 +72,14 @@ typedef union {
cmpRspGenAuthToken_t cmpRspGenAuthToken;
} cmpMapGenAuthToken_t;
+/** Map CMP GenBindingKey message. */
+typedef union {
+ /** Map CMP command. */
+ cmpCmdGenBindingKey_t cmpCmdGenBindingKey;
+ /** Map CMP response. */
+ cmpRspGenBindingKey_t cmpRspGenBindingKey;
+} cmpMapGenBindingKey_t;
+
/** Map CMP command header. */
typedef struct {
/** Command id. */
@@ -192,7 +203,7 @@ typedef struct {
cmpBeginRootAuthenticationCmd_t cmd;
} cmpCmdBeginRootAuthentication_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_BEGIN_ROOT_AUTHENTICATION_RSP Response
* @{ */
@@ -221,7 +232,7 @@ typedef struct {
cmpBeginRootAuthenticationRsp_t rsp;
} cmpRspBeginRootAuthentication_t;
-/** @} */
+/** @} */
/** Map CMP BeginRootAuthentication message. */
typedef union {
@@ -231,7 +242,7 @@ typedef union {
cmpRspBeginRootAuthentication_t cmpRspBeginRootAuthentication;
} cmpMapBeginRootAuthentication_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_BEGIN_SP_AUTHENTICATION \
MC_CMP_CMD_BEGIN_SP_AUTHENTICATION
@@ -285,7 +296,7 @@ typedef struct {
cmpBeginSpAuthenticationRsp_t rsp;
} cmpRspBeginSpAuthentication_t;
-/** @} */
+/** @} */
/** Map CMP BeginSpAuthentication message. */
typedef union {
@@ -295,7 +306,7 @@ typedef union {
cmpRspBeginSpAuthentication_t cmpRspBeginSpAuthentication;
} cmpMapBeginSpAuthentication_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_AUTHENTICATE MC_CMP_CMD_AUTHENTICATE
* @{ */
@@ -333,7 +344,7 @@ typedef struct {
uint32_t edLen;
/** Encrypted and padded data. */
cmpAuthCmdEd_t ed;
-} cmpAuthCmdSdata_t;
+} cmpAuthCmdSdata_t;
/** Authenticate signed command and signature. */
typedef struct {
@@ -349,7 +360,7 @@ typedef struct {
cmpAuthenticateCmd_t cmd;
} cmpCmdAuthenticate_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_AUTHENTICATE_RSP Response
* @{ */
@@ -410,7 +421,7 @@ typedef union {
cmpRspAuthenticate_t cmpRspAuthenticate;
} cmpMapAuthenticate_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_AUTHENTICATE_TERMINATE \
MC_CMP_CMD_AUTHENTICATE_TERMINATE
@@ -439,7 +450,7 @@ typedef struct {
cmpAuthenticateTerminateCmd_t cmd;
} cmpCmdAuthenticateTerminate_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_AUTHENTICATE_TERMINATE_RSP Response
* @{ */
@@ -474,7 +485,7 @@ typedef union {
cmpRspAuthenticateTerminate_t cmpRspAuthenticateTerminate;
} cmpMapAuthenticateTerminate_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_ROOT_CONT_REGISTER_ACTIVATE \
MC_CMP_CMD_ROOT_CONT_REGISTER_ACTIVATE
@@ -523,7 +534,7 @@ typedef struct {
cmpRootContRegisterActivateCmd_t cmd;
} cmpCmdRootContRegisterActivate_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_ROOT_CONT_REGISTER_ACTIVATE_RSP Response
* @{ */
@@ -609,7 +620,7 @@ typedef struct {
cmpRootContUnregisterCmd_t cmd;
} cmpCmdRootContUnregister_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_ROOT_CONT_UNREGISTER_RSP Response
* @{ */
@@ -652,7 +663,7 @@ typedef struct {
cmpRootContUnregisterRsp_t rsp;
} cmpRspRootContUnregister_t;
-/** @} */
+/** @} */
/** Map CMP RootContUnregister message. */
typedef union {
@@ -662,7 +673,7 @@ typedef union {
cmpRspRootContUnregister_t cmpRspRootContUnregister;
} cmpMapRootContUnregister_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_ROOT_CONT_LOCK_BY_ROOT \
MC_CMP_CMD_ROOT_CONT_LOCK_BY_ROOT
@@ -691,7 +702,7 @@ typedef struct {
cmpRootContLockByRootCmd_t cmd;
} cmpCmdRootContLockByRoot_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_ROOT_CONT_LOCK_BY_ROOT_RSP Response
* @{ */
@@ -719,7 +730,7 @@ typedef struct {
cmpRootContLockByRootRsp_t rsp;
} cmpRspRootContLockByRoot_t;
-/** @} */
+/** @} */
/** Map CMP RootContLockByRoot message. */
typedef union {
@@ -729,7 +740,7 @@ typedef union {
cmpRspRootContLockByRoot_t cmpRspRootContLockByRoot;
} cmpMapRootContLockByRoot_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_ROOT_CONT_UNLOCK_BY_ROOT \
MC_CMP_CMD_ROOT_CONT_UNLOCK_BY_ROOT
@@ -758,7 +769,7 @@ typedef struct {
cmpRootContUnlockByRootCmd_t cmd;
} cmpCmdRootContUnlockByRoot_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_ROOT_CONT_UNLOCK_BY_ROOT_RSP Response
* @{ */
@@ -787,7 +798,7 @@ typedef struct {
cmpRootContUnlockByRootRsp_t rsp;
} cmpRspRootContUnlockByRoot_t;
-/** @} */
+/** @} */
/** Map CMP RootContUnlockByRoot message. */
typedef union {
@@ -797,7 +808,7 @@ typedef union {
cmpRspRootContUnlockByRoot_t cmpRspRootContUnlockByRoot;
} cmpMapRootContUnlockByRoot_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_REGISTER_ACTIVATE \
MC_CMP_CMD_SP_CONT_REGISTER_ACTIVATE
@@ -846,7 +857,7 @@ typedef struct {
cmpSpContRegisterActivateCmd_t cmd;
} cmpCmdSpContRegisterActivate_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_REGISTER_ACTIVATE_RSP Response
* @{ */
@@ -879,7 +890,7 @@ typedef struct {
cmpSpContRegisterActivateRsp_t rsp;
} cmpRspSpContRegisterActivate_t;
-/** @} */
+/** @} */
/** Map CMP SpContRegisterActivate message. */
typedef union {
@@ -889,7 +900,7 @@ typedef union {
cmpRspSpContRegisterActivate_t cmpRspSpContRegisterActivate;
} cmpMapSpContRegisterActivate_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_UNREGISTER \
MC_CMP_CMD_SP_CONT_UNREGISTER
@@ -920,7 +931,7 @@ typedef struct {
cmpSpContUnregisterCmd_t cmd;
} cmpCmdSpContUnregister_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_UNREGISTER_RSP Response
* @{ */
@@ -949,7 +960,7 @@ typedef struct {
cmpSpContUnregisterRsp_t rsp;
} cmpRspSpContUnregister_t;
-/** @} */
+/** @} */
/** Map CMP SpContUnregister message. */
typedef union {
@@ -959,7 +970,7 @@ typedef union {
cmpRspSpContUnregister_t cmpRspSpContUnregister;
} cmpMapSpContUnregister_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_REGISTER \
MC_CMP_CMD_SP_CONT_REGISTER
@@ -1008,7 +1019,7 @@ typedef struct {
cmpSpContRegisterCmd_t cmd;
} cmpCmdSpContRegister_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_REGISTER_RSP Response
* @{ */
@@ -1041,7 +1052,7 @@ typedef struct {
cmpSpContRegisterRsp_t rsp;
} cmpRspSpContRegister_t;
-/** @} */
+/** @} */
/** Map CMP SpContRegister message. */
typedef union {
@@ -1051,7 +1062,7 @@ typedef union {
cmpRspSpContRegister_t cmpRspSpContRegister;
} cmpMapSpContRegister_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_LOCK_BY_ROOT \
MC_CMP_CMD_SP_CONT_LOCK_BY_ROOT
@@ -1063,7 +1074,7 @@ typedef union {
/** SpContLockByRoot signed command. */
typedef struct {
/** Command header. */
- cmpCommandHeaderMap_t cmdHeader;
+ cmpCommandHeaderMap_t cmdHeader;
/** Spid. */
mcSpid_t spid;
} cmpSpLockByRootCmdSdata_t;
@@ -1082,7 +1093,7 @@ typedef struct {
cmpSpContLockByRootCmd_t cmd;
} cmpCmdSpContLockByRoot_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_LOCK_BY_ROOT_RSP Response
* @{ */
@@ -1111,7 +1122,7 @@ typedef struct {
cmpSpContLockByRootRsp_t rsp;
} cmpRspSpContLockByRoot_t;
-/** @} */
+/** @} */
/** Map CMP SpContLockByRoot message. */
typedef union {
@@ -1121,7 +1132,7 @@ typedef union {
cmpRspSpContLockByRoot_t cmpRspSpContLockByRoot;
} cmpMapSpContLockByRoot_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_UNLOCK_BY_ROOT \
MC_CMP_CMD_SP_CONT_UNLOCK_BY_ROOT
@@ -1133,7 +1144,7 @@ typedef union {
/** SpContUnlockByRoot signed command. */
typedef struct {
/** Command header. */
- cmpCommandHeaderMap_t cmdHeader;
+ cmpCommandHeaderMap_t cmdHeader;
/** Spid. */
mcSpid_t spid;
} cmpSpUnlockByRootCmdSdata_t;
@@ -1152,7 +1163,7 @@ typedef struct {
cmpSpContUnlockByRootCmd_t cmd;
} cmpCmdSpContUnlockByRoot_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_UNLOCK_BY_ROOT_RSP Response
* @{ */
@@ -1181,7 +1192,7 @@ typedef struct {
cmpSpContUnlockByRootRsp_t rsp;
} cmpRspSpContUnlockByRoot_t;
-/** @} */
+/** @} */
/** Map CMP SpContUnlockByRoot message. */
typedef union {
@@ -1191,7 +1202,7 @@ typedef union {
cmpRspSpContUnlockByRoot_t cmpRspSpContUnlockByRoot;
} cmpMapSpContUnlockByRoot_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_ACTIVATE \
MC_CMP_CMD_SP_CONT_ACTIVATE
@@ -1240,7 +1251,7 @@ typedef struct {
cmpSpContActivateCmd_t cmd;
} cmpCmdSpContActivate_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_ACTIVATE_RSP Response
* @{ */
@@ -1269,7 +1280,7 @@ typedef struct {
cmpSpContActivateRsp_t rsp;
} cmpRspSpContActivate_t;
-/** @} */
+/** @} */
/** Map CMP SpContActivate message. */
typedef union {
@@ -1279,7 +1290,7 @@ typedef union {
cmpRspSpContActivate_t cmpRspSpContActivate;
} cmpMapSpContActivate_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_LOCK_BY_SP \
MC_CMP_CMD_SP_CONT_LOCK_BY_SP
@@ -1291,7 +1302,7 @@ typedef union {
/** SpContLockBySp signed command. */
typedef struct {
/** Command header. */
- cmpCommandHeaderMap_t cmdHeader;
+ cmpCommandHeaderMap_t cmdHeader;
/** Spid. */
mcSpid_t spid;
} cmpSpLockBySpCmdSdata_t;
@@ -1310,7 +1321,7 @@ typedef struct {
cmpSpContLockBySpCmd_t cmd;
} cmpCmdSpContLockBySp_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_LOCK_BY_SP_RSP Response
* @{ */
@@ -1339,7 +1350,7 @@ typedef struct {
cmpSpContLockBySpRsp_t rsp;
} cmpRspSpContLockBySp_t;
-/** @} */
+/** @} */
/** Map CMP SpContLockBySp message. */
typedef union {
@@ -1349,7 +1360,7 @@ typedef union {
cmpRspSpContLockBySp_t cmpRspSpContLockBySp;
} cmpMapSpContLockBySp_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_UNLOCK_BY_SP \
MC_CMP_CMD_SP_CONT_UNLOCK_BY_SP
@@ -1361,7 +1372,7 @@ typedef union {
/** SpContUnlockBySp signed command. */
typedef struct {
/** Command header. */
- cmpCommandHeaderMap_t cmdHeader;
+ cmpCommandHeaderMap_t cmdHeader;
/** Spid. */
mcSpid_t spid;
} cmpSpUnlockBySpCmdSdata_t;
@@ -1380,7 +1391,7 @@ typedef struct {
cmpSpContUnlockBySpCmd_t cmd;
} cmpCmdSpContUnlockBySp_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_UNLOCK_BY_SP_RSP Response
* @{ */
@@ -1409,7 +1420,7 @@ typedef struct {
cmpSpContUnlockBySpRsp_t rsp;
} cmpRspSpContUnlockBySp_t;
-/** @} */
+/** @} */
/** Map CMP SpContUnlockBySp message. */
typedef union {
@@ -1419,7 +1430,7 @@ typedef union {
cmpRspSpContUnlockBySp_t cmpRspSpContUnlockBySp;
} cmpMapSpContUnlockBySp_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_TLT_CONT_REGISTER_ACTIVATE \
MC_CMP_CMD_TLT_CONT_REGISTER_ACTIVATE
@@ -1451,7 +1462,7 @@ typedef struct {
/** Uuid. */
mcUuid_t uuid;
/** Trustlet public key hash. */
- mcSha256_t skSpTltEnc;
+ mcSha256_t skSpTltEnc;
/** Minimum trustlet version supported. */
mcContVersion_t tltVersion;
/** Encrypted and padded data size. */
@@ -1474,7 +1485,7 @@ typedef struct {
cmpTltContRegisterActivateCmd_t cmd;
} cmpCmdTltContRegisterActivate_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_TLT_CONT_REGISTER_ACTIVATE_RSP Response
* @{ */
@@ -1505,7 +1516,7 @@ typedef struct {
cmpTltContRegisterActivateRsp_t rsp;
} cmpRspTltContRegisterActivate_t;
-/** @} */
+/** @} */
/** Map CMP TltContRegisterActivate message. */
typedef union {
@@ -1548,7 +1559,7 @@ typedef struct {
cmpTltContUnregisterCmd_t cmd;
} cmpCmdTltContUnregister_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_TLT_CONT_UNREGISTER_RSP Response
* @{ */
@@ -1577,7 +1588,7 @@ typedef struct {
cmpTltContUnregisterRsp_t rsp;
} cmpRspTltContUnregister_t;
-/** @} */
+/** @} */
/** Map CMP TltContUnregister message. */
typedef union {
@@ -1619,7 +1630,7 @@ typedef struct {
/** Uuid. */
mcUuid_t uuid;
/** Trustlet public key hash. */
- mcSha256_t skSpTltEnc;
+ mcSha256_t skSpTltEnc;
/** Minimum trustlet version supported. */
mcContVersion_t tltVersion;
/** Encrypted and padded data size. */
@@ -1642,7 +1653,7 @@ typedef struct {
cmpTltContRegisterCmd_t cmd;
} cmpCmdTltContRegister_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_TLT_CONT_REGISTER_RSP Response
* @{ */
@@ -1675,7 +1686,7 @@ typedef struct {
cmpTltContRegisterRsp_t rsp;
} cmpRspTltContRegister_t;
-/** @} */
+/** @} */
/** Map CMP TltContRegister message. */
typedef union {
@@ -1685,7 +1696,7 @@ typedef union {
cmpRspTltContRegister_t cmpRspTltContRegister;
} cmpMapTltContRegister_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_TLT_CONT_ACTIVATE \
MC_CMP_CMD_TLT_CONT_ACTIVATE
@@ -1718,7 +1729,7 @@ typedef struct {
cmpTltContActivateCmd_t cmd;
} cmpCmdTltContActivate_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_TLT_CONT_ACTIVATE_RSP Response
* @{ */
@@ -1747,7 +1758,7 @@ typedef struct {
cmpTltContActivateRsp_t rsp;
} cmpRspTltContActivate_t;
-/** @} */
+/** @} */
/** Map CMP TltContActivate message. */
typedef union {
@@ -1757,7 +1768,7 @@ typedef union {
cmpRspTltContActivate_t cmpRspTltContActivate;
} cmpMapTltContActivate_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_TLT_CONT_LOCK_BY_SP \
MC_CMP_CMD_TLT_CONT_LOCK_BY_SP
@@ -1790,7 +1801,7 @@ typedef struct {
cmpTltContLockBySpCmd_t cmd;
} cmpCmdTltContLockBySp_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_TLT_CONT_LOCK_BY_SP_RSP Response
* @{ */
@@ -1819,7 +1830,7 @@ typedef struct {
cmpTltContLockBySpRsp_t rsp;
} cmpRspTltContLockBySp_t;
-/** @} */
+/** @} */
/** Map CMP TltContLockBySp message. */
typedef union {
@@ -1829,7 +1840,7 @@ typedef union {
cmpRspTltContLockBySp_t cmpRspTltContLockBySp;
} cmpMapTltContLockBySp_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_TLT_CONT_UNLOCK_BY_SP \
MC_CMP_CMD_TLT_CONT_UNLOCK_BY_SP
@@ -1862,7 +1873,7 @@ typedef struct {
cmpTltContUnlockBySpCmd_t cmd;
} cmpCmdTltContUnlockBySp_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_TLT_CONT_UNLOCK_BY_SP_RSP Response
* @{ */
@@ -1901,7 +1912,7 @@ typedef union {
cmpRspTltContUnlockBySp_t cmpRspTltContUnlockBySp;
} cmpMapTltContUnlockBySp_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_TLT_CONT_PERSONALIZE \
MC_CMP_CMD_TLT_CONT_PERSONALIZE
@@ -1953,7 +1964,7 @@ typedef struct {
cmpTltContPersonalizeCmd_t cmd;
} cmpCmdTltContPersonalize_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_TLT_CONT_PERSONALIZE_RSP Response
* @{ */
@@ -2013,6 +2024,10 @@ typedef union {
cmpCmdGenAuthToken_t cmpCmdGenAuthToken;
/** Backward compatible system response GenAuthToken. */
cmpRspGenAuthToken_t cmpRspGenAuthToken;
+ /** Backward compatible system command GenBindingKey. */
+ cmpCmdGenBindingKey_t cmpCmdGenBindingKey;
+ /** Backward compatible system response GenBindingKey. */
+ cmpRspGenBindingKey_t cmpRspGenBindingKey;
/** Command header. */
cmpCommandHeaderMap_t cmdHeader;
diff --git a/mobicore/common/MobiCore/inc/TlCm/3.0/tlCmApi.h b/mobicore/common/MobiCore/inc/TlCm/3.0/tlCmApi.h
index c66ab5a..e04429d 100644
--- a/mobicore/common/MobiCore/inc/TlCm/3.0/tlCmApi.h
+++ b/mobicore/common/MobiCore/inc/TlCm/3.0/tlCmApi.h
@@ -1,3 +1,33 @@
+/*
+ * Copyright (c) 2013 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.
+ */
/** @addtogroup CMP
* @{
* @file
@@ -6,33 +36,6 @@
* The TlCm is responsible for implementing content management protocol (CMP)
* commands and generating approriate CMP responses in the trustlet control
* interface (TCI).
- *
- * Copyright © Trustonic Limited 2013.
- *
- * 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 TL_CM_API_H_
@@ -61,6 +64,10 @@ typedef union {
cmpCmdGenAuthTokenTci_t cmpCmdGenAuthTokenTci;
/** System response GenAuthToken. */
cmpRspGenAuthTokenTci_t cmpRspGenAuthTokenTci;
+ /** System command GenBindingKey. */
+ cmpCmdGenBindingKeyTci_t cmpCmdGenBindingKeyTci;
+ /** System response GenBindingKey. */
+ cmpRspGenBindingKeyTci_t cmpRspGenBindingKeyTci;
/** Authentication command BeginSocAuthentication. */
cmpCmdBeginSocAuthenticationTci_t cmpCmdBeginSocAuthenticationTci;
@@ -150,7 +157,7 @@ typedef union {
/** Sp administrative command TltContActivate. */
cmpRspTltContActivateTci_t cmpRspTltContActivateTci;
/** Sp administrative command TltContLockBySp. */
- cmpCmdTltContLockBySpTci_t cmpCmdTltContLockBySpTci;
+ cmpCmdTltContLockBySpTci_t cmpCmdTltContLockBySpTci;
/** Sp administrative response TltContLockBySp. */
cmpRspTltContLockBySpTci_t cmpRspTltContLockBySpTci;
/** Sp administrative command TltContUnlockBySp. */
diff --git a/mobicore/common/MobiCore/inc/TlCm/cmpCommon.h b/mobicore/common/MobiCore/inc/TlCm/cmpCommon.h
index 7c460ea..23f8fcc 100644
--- a/mobicore/common/MobiCore/inc/TlCm/cmpCommon.h
+++ b/mobicore/common/MobiCore/inc/TlCm/cmpCommon.h
@@ -1,3 +1,33 @@
+/*
+ * Copyright (c) 2013 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.
+ */
/** @addtogroup CMP_COMMON
* Common definitions of content management protocols (CMP) supported by the
* content management trustlet (TlCm).
@@ -8,33 +38,6 @@
* Common CMP global definitions.
* Various components need access to (sub-)structures defined and used by CMP.
* These common definitions are made available through this header file.
- *
- * Copyright © Trustonic Limited 2013.
- *
- * 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 CMP_COMMON_H_
@@ -69,7 +72,7 @@ typedef uint32_t cmpReturnCode_t;
/** CMP command header. */
typedef struct {
/** Command id. */
- cmpCommandId_t commandId;
+ cmpCommandId_t commandId;
} cmpCommandHeader_t;
/** CMP response header. */
@@ -141,7 +144,7 @@ typedef struct {
cmpCommandHeader_t cmdHeader;
} cmpCmdGetVersion_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_GET_VERSION_RSP Response
* @{ */
@@ -158,7 +161,7 @@ typedef struct {
/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_GET_SUID MC_CMP_CMD_GET_SUID
* @{ */
@@ -172,7 +175,7 @@ typedef struct {
cmpCommandHeader_t cmdHeader;
} cmpCmdGetSuid_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_GET_SUID_RSP Response
* @{ */
@@ -187,7 +190,7 @@ typedef struct {
/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_GENERATE_AUTH_TOKEN MC_CMP_CMD_GENERATE_AUTH_TOKEN
* @{ */
@@ -229,7 +232,7 @@ typedef struct {
cmpGenAuthTokenCmd_t cmd;
} cmpCmdGenAuthToken_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_GENERATE_AUTH_TOKEN_RSP Response
* @{ */
@@ -247,7 +250,82 @@ typedef struct {
mcSoAuthTokenCont_t soAuthCont;
} cmpRspGenAuthToken_t;
-/** @} */
+/** @} */
+
+/** @} */
+
+/** @defgroup MC_CMP_CMD_GENERATE_BINDING_KEY MC_CMP_CMD_GENERATE_BINDING_KEY
+ * @{ */
+
+/** Total number of bytes used for PSS signature in GENERATE BINDING KEY command. */
+#define CMP_GEN_BINDING_KEY_PSS_SIZE 256
+
+/** Total number of bytes used for receipt data in GENERATE BINDING KEY response. */
+#define CMP_GEN_BINDING_RECEIPT_ENC_PART_SIZE 256
+
+/** Maximum Length in bytes for the entropy input */
+#define CMP_GEN_BINDING_KEY_ENTROPY_SIZE_MAX (56)
+
+/** @defgroup MC_CMP_CMD_GENERATE_BINDING_KEY_CMD Command
+ * @{ */
+
+typedef struct {
+ /** Command header. */
+ cmpCommandHeader_t cmdHeader;
+ /** Key id. */
+ uint32_t kid;
+} cmpGenBindingKeyCmdSdata_t;
+
+typedef struct {
+ /** Signed data. */
+ cmpGenBindingKeyCmdSdata_t sdata;
+ /** Signature. */
+ uint8_t pssSignature[CMP_GEN_BINDING_KEY_PSS_SIZE];
+ /** Production Station Serial Number. */
+ uint64_t serialNumber;
+ /** Timestamp (seconds since epoch). */
+ uint64_t timestamp;
+ /** Additional entropy length in bytes. */
+ uint16_t entropyLen;
+ /** Additional entropy for K.SoC.Auth generation */
+ uint8_t entropy[CMP_GEN_BINDING_KEY_ENTROPY_SIZE_MAX];
+} cmpCmdGenBindingKeyCmd_t;
+
+/** GenBindingKey command. */
+typedef struct {
+ /** Command. */
+ cmpCmdGenBindingKeyCmd_t cmd;
+} cmpCmdGenBindingKey_t;
+
+/** @} */
+
+/** @defgroup MC_CMP_CMD_GENERATE_BINDING_KEY_RSP Response
+ * @{ */
+
+/** Receipt Data. */
+typedef struct {
+ uint8_t dataPart1[CMP_GEN_BINDING_RECEIPT_ENC_PART_SIZE];
+ uint8_t dataPart2[CMP_GEN_BINDING_RECEIPT_ENC_PART_SIZE];
+} receipt_t;
+
+typedef struct {
+ /** Response header. */
+ cmpResponseHeader_t rspHeader;
+ /** Suid. */
+ mcSuid_t suid;
+ /**Receipt data. */
+ receipt_t receipt;
+} cmpGenBindingKeyRsp_t;
+
+/** GenBindingKey response. */
+typedef struct {
+ /** Response. */
+ cmpGenBindingKeyRsp_t rsp;
+ /** AuthToken container. */
+ mcSoAuthTokenCont_t soAuthCont;
+} cmpRspGenBindingKey_t;
+
+/** @} */
/** @} */
diff --git a/mobicore/common/MobiCore/inc/TlCm/tlCmApiCommon.h b/mobicore/common/MobiCore/inc/TlCm/tlCmApiCommon.h
index b526edd..b9912cb 100644
--- a/mobicore/common/MobiCore/inc/TlCm/tlCmApiCommon.h
+++ b/mobicore/common/MobiCore/inc/TlCm/tlCmApiCommon.h
@@ -1,3 +1,33 @@
+/*
+ * Copyright (c) 2013 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.
+ */
/** @addtogroup CMP_COMMON
* @{
* @file
@@ -5,33 +35,6 @@
*
* The TlCm is responsible for implementing content management protocol (CMP)
* commands and generating approriate CMP responses.
- *
- * Copyright © Trustonic Limited 2013.
- *
- * 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 TL_CM_API_COMMON_H_
@@ -47,9 +50,10 @@ typedef enum cmpCommands_t {
MC_CMP_CMD_AUTHENTICATE = 0,
MC_CMP_CMD_BEGIN_ROOT_AUTHENTICATION = 1,
MC_CMP_CMD_BEGIN_SOC_AUTHENTICATION = 2,
- MC_CMP_CMD_BEGIN_SP_AUTHENTICATION = 3,
+ MC_CMP_CMD_BEGIN_SP_AUTHENTICATION = 3,
MC_CMP_CMD_GENERATE_AUTH_TOKEN = 4,
MC_CMP_CMD_GET_VERSION = 5,
+ MC_CMP_CMD_GENERATE_BINDING_KEY = 0x30,
//MC_CMP_CMD_ROOT_CONT_ACTIVATE = 6,
MC_CMP_CMD_ROOT_CONT_LOCK_BY_ROOT = 7,
//MC_CMP_CMD_ROOT_CONT_REGISTER = 8,
@@ -73,7 +77,7 @@ typedef enum cmpCommands_t {
MC_CMP_CMD_TLT_CONT_UNREGISTER = 26,
MC_CMP_CMD_GET_SUID = 27,
MC_CMP_CMD_AUTHENTICATE_TERMINATE = 28,
- MC_CMP_CMD_LAST_ = MC_CMP_CMD_AUTHENTICATE_TERMINATE,
+ MC_CMP_CMD_LAST_ = MC_CMP_CMD_GENERATE_BINDING_KEY,
} cmpCommands_t;
/** TlCm exit code: TlCm exited with error. */
diff --git a/mobicore/common/MobiCore/inc/TlCm/tlCmError.h b/mobicore/common/MobiCore/inc/TlCm/tlCmError.h
index 90d9ba9..3896b7b 100644
--- a/mobicore/common/MobiCore/inc/TlCm/tlCmError.h
+++ b/mobicore/common/MobiCore/inc/TlCm/tlCmError.h
@@ -1,36 +1,39 @@
-/** @addtogroup CMP_COMMON
- * @{
- *
- * @file
- * Content management trustlet (TlCm) error return code definitions.
- * Definition of all possible TlCm error return codes.
- *
- * Copyright © Trustonic Limited 2013.
- *
+/*
+ * Copyright (c) 2013 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.
+ * 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.
+ */
+/** @addtogroup CMP_COMMON
+ * @{
+ *
+ * @file
+ * Content management trustlet (TlCm) error return code definitions.
+ * Definition of all possible TlCm error return codes.
*/
#ifndef TL_CM_ERROR_H_
diff --git a/mobicore/common/MobiCore/inc/TlCm/tlCmUuid.h b/mobicore/common/MobiCore/inc/TlCm/tlCmUuid.h
index 5ce25c1..c433756 100644
--- a/mobicore/common/MobiCore/inc/TlCm/tlCmUuid.h
+++ b/mobicore/common/MobiCore/inc/TlCm/tlCmUuid.h
@@ -1,34 +1,37 @@
-/** @addtogroup CMP_COMMON
- * @{
- * @file
- * Content management trustlet (TlCm) Uuid definition.
- *
- * Copyright © Trustonic Limited 2013.
- *
+/*
+ * Copyright (c) 2013 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.
+ * 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.
+ */
+/** @addtogroup CMP_COMMON
+ * @{
+ * @file
+ * Content management trustlet (TlCm) Uuid definition.
*/
#ifndef TL_CM_UUID_H
diff --git a/mobicore/common/MobiCore/inc/TlCm/version.h b/mobicore/common/MobiCore/inc/TlCm/version.h
index 00f3841..c91b71c 100644
--- a/mobicore/common/MobiCore/inc/TlCm/version.h
+++ b/mobicore/common/MobiCore/inc/TlCm/version.h
@@ -1,34 +1,37 @@
-/** @addtogroup CMP_COMMON
- * @{
- * @file
- * Content management trustlet (TlCm) version definition.
- *
- * Copyright © Trustonic Limited 2013.
- *
+/*
+ * Copyright (c) 2013 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.
+ * 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.
+ */
+/** @addtogroup CMP_COMMON
+ * @{
+ * @file
+ * Content management trustlet (TlCm) version definition.
*/
#ifndef CMP_VERSION_H_
diff --git a/mobicore/rootpa/Android.mk b/mobicore/rootpa/Android.mk
new file mode 100644
index 0000000..ad0a56f
--- /dev/null
+++ b/mobicore/rootpa/Android.mk
@@ -0,0 +1,7 @@
+LOCAL_ROOT_PATH := $(call my-dir)
+
+MOBICORE_DIR_INC := $(LOCAL_ROOT_PATH)/../curl/include
+include $(LOCAL_ROOT_PATH)/Code/Common/Android.mk
+include $(LOCAL_ROOT_PATH)/Code/Android/app/jni/Android.mk
+include $(LOCAL_ROOT_PATH)/Code/Android/lib/Android.mk
+include $(LOCAL_ROOT_PATH)/Code/Android/app/Android.mk \ No newline at end of file
diff --git a/mobicore/rootpa/Code/Android/app/Android.mk b/mobicore/rootpa/Code/Android/app/Android.mk
index cac6938..850b070 100644
--- a/mobicore/rootpa/Code/Android/app/Android.mk
+++ b/mobicore/rootpa/Code/Android/app/Android.mk
@@ -15,8 +15,11 @@ LOCAL_CERTIFICATE := platform
LOCAL_PROGUARD_FLAGS := -include $(LOCAL_PATH)/proguard-project.txt
+APP_PIE := true
LOCAL_32_BIT_ONLY := true
+LOCAL_DEX_PREOPT := false
include $(BUILD_PACKAGE)
include $(CLEAR_VARS)
+
diff --git a/mobicore/rootpa/Code/Android/app/jni/Android.mk b/mobicore/rootpa/Code/Android/app/jni/Android.mk
index dc9de57..16e2a11 100644
--- a/mobicore/rootpa/Code/Android/app/jni/Android.mk
+++ b/mobicore/rootpa/Code/Android/app/jni/Android.mk
@@ -39,6 +39,7 @@
# (including RootPA/Common) checked out in order to sucessfully
# complete te build
#
+APP_PIE := true
LOCAL_32_BIT_ONLY := true
include $(call all-subdir-makefiles)
diff --git a/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/Android.mk b/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/Android.mk
index 137e9e2..82e67c6 100644
--- a/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/Android.mk
+++ b/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/Android.mk
@@ -65,9 +65,9 @@ ifeq ($(ROOTPA_MODULE_TEST), 1)
LOCAL_STATIC_LIBRARIES += McStub
else
LOCAL_STATIC_LIBRARIES += provisioningagent
-
- LOCAL_SHARED_LIBRARIES += libMcClient
- LOCAL_SHARED_LIBRARIES += libMcRegistry
+ LOCAL_STATIC_LIBRARIES += MobiCoreTlcm
+ LOCAL_SHARED_LIBRARIES += libMcClient
+ LOCAL_SHARED_LIBRARIES += libMcRegistry
endif
#LOCAL_LDLIBS += -L$(SYSROOT)/usr/lib
@@ -80,6 +80,7 @@ LOCAL_SHARED_LIBRARIES += libcurl
LOCAL_STATIC_LIBRARIES += libxml2
LOCAL_SHARED_LIBRARIES += libicuuc
+APP_PIE := true
LOCAL_32_BIT_ONLY := true
include $(BUILD_SHARED_LIBRARY)
diff --git a/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/CmpBase.cpp b/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/CmpBase.cpp
index 4a0b3e3..4aece60 100644
--- a/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/CmpBase.cpp
+++ b/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/CmpBase.cpp
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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 "logging.h"
#include "CmpBase.h"
@@ -39,11 +39,11 @@ Public methods
*/
CmpBase::CmpBase(JNIEnv* env, jobject msgs): env_(env),
- msgs_(msgs),
- cls_(NULL),
- broken_(false),
+ msgs_(msgs),
+ cls_(NULL),
objectCls_(NULL),
- numberOfElements_(0)
+ numberOfElements_(0),
+ broken_(false)
{
if((env_ != NULL) && (msgs_ != NULL))
{
@@ -52,7 +52,7 @@ CmpBase::CmpBase(JNIEnv* env, jobject msgs): env_(env),
{
LOGE("can not get object class");
broken_=true;
- }
+ }
}
else
{
@@ -85,7 +85,7 @@ int CmpBase::numberOfElements()
jmethodID mid = env_->GetMethodID(cls_, "size", "()I");
if(mid !=0)
{
- numberOfElements_ = (int) env_->CallIntMethod(msgs_, mid);
+ numberOfElements_ = (int) env_->CallIntMethod(msgs_, mid);
}
else
{
diff --git a/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/CmpBase.h b/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/CmpBase.h
index 8e7b1b3..7a9e5f8 100644
--- a/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/CmpBase.h
+++ b/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/CmpBase.h
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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 CMPBASE_H
#define CMPBASE_H
@@ -41,12 +41,12 @@ class CmpBase
CmpBase(JNIEnv* env, jobject msgs);
virtual ~CmpBase();
int numberOfElements();
- private:
+ private:
CmpBase();
CmpBase(CmpBase&);
protected:
JNIEnv* env_;
- jobject msgs_;
+ jobject msgs_;
jclass cls_;
jclass objectCls_;
int numberOfElements_;
diff --git a/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/CmpCommands.cpp b/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/CmpCommands.cpp
index 09fdd3c..01263d5 100644
--- a/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/CmpCommands.cpp
+++ b/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/CmpCommands.cpp
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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 "logging.h"
#include "CmpCommands.h"
#include "JniHelpers.h"
@@ -35,7 +35,7 @@ CmpCommands::CmpCommands(JNIEnv* env, jobject commands): CmpBase(env, commands),
{
if(!broken_)
{
- createObjectArray();
+ createObjectArray();
}
}
@@ -54,22 +54,22 @@ bool CmpCommands::getCommands(CmpMessage* objectArray)
{
if(NULL==objectCls_)
{
- objectCls_ = env_->FindClass("com/gd/mobicore/pa/ifc/CmpCommand"); // element in array
+ objectCls_ = env_->FindClass("com/gd/mobicore/pa/ifc/CmpCommand"); // element in array
}
if(objectCls_ != NULL)
{
jmethodID midToByteArray=env_->GetMethodID(objectCls_, "toByteArray", "()[B");
if(NULL==midToByteArray){
- LOGE("<<CmpCommands::getCommands returning false, method toByteArray not found");
+ LOGE("<<CmpCommands::getCommands returning false, method toByteArray not found");
return false;
}
jmethodID midIgnoreError=env_->GetMethodID(objectCls_, "ignoreError", "()Z");
if(NULL==midIgnoreError){
- LOGE("<<CmpCommands::getCommands returning false, method ignoreError not found");
+ LOGE("<<CmpCommands::getCommands returning false, method ignoreError not found");
return false;
}
-
- jbyteArray jba=NULL;
+
+ jbyteArray jba=NULL;
jobject arrayElement=NULL;
for(int i=0; i<numberOfElements(); i++)
{
@@ -77,7 +77,7 @@ bool CmpCommands::getCommands(CmpMessage* objectArray)
jba = (jbyteArray) env_->CallObjectMethod(arrayElement, midToByteArray);
JniHelpers helper(env_);
- objectArray[i].contentP=helper.jByteArrayToCByteArray(jba, &(objectArray[i].length));
+ objectArray[i].contentP=helper.jByteArrayToCByteArray(jba, &(objectArray[i].length));
objectArray[i].hdr.ignoreError=(JNI_TRUE==env_->CallBooleanMethod(arrayElement, midIgnoreError));
env_->DeleteLocalRef(jba);
env_->DeleteLocalRef(arrayElement);
@@ -92,21 +92,21 @@ bool CmpCommands::getCommands(CmpMessage* objectArray)
/*
*/
-void CmpCommands::createObjectArray()
+void CmpCommands::createObjectArray()
{
if(broken_) return;
jmethodID mid = env_->GetMethodID(cls_, "toArray", "()[Ljava/lang/Object;");
- if (mid != 0)
+ if (mid != 0)
{
jObjectArray_ = (jobjectArray) env_->CallObjectMethod(msgs_, mid);
if(NULL==jObjectArray_)
{
LOGE("error in getting jObjectArray_");
- broken_= true;
+ broken_= true;
}
- }
- else
+ }
+ else
{
LOGE("Sorry, but the method toArray()[Ljava/lang/Object cannot be found!");
broken_= true;
diff --git a/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/CmpCommands.h b/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/CmpCommands.h
index 26fb0a7..494b184 100644
--- a/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/CmpCommands.h
+++ b/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/CmpCommands.h
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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 CMPCOMMANDS_H
#define CMPCOMMANDS_H
@@ -43,12 +43,12 @@ class CmpCommands : public CmpBase
this trusts that the caller has reserved long enough array
*/
bool getCommands(CmpMessage* objectArray);
- private:
+ private:
CmpCommands();
CmpCommands(CmpMessage&);
void createObjectArray();
private:
- jobjectArray jObjectArray_;
+ jobjectArray jObjectArray_;
};
#endif // CMPCOMMANDS_H
diff --git a/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/CmpResponses.cpp b/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/CmpResponses.cpp
index 4ab2557..dc87184 100644
--- a/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/CmpResponses.cpp
+++ b/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/CmpResponses.cpp
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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 "JniHelpers.h"
#include "CmpResponses.h"
@@ -56,16 +56,16 @@ CmpResponses::~CmpResponses()
int CmpResponses::update(CmpMessage* responses, int numberOfResponses)
{
- int ret=ROOTPA_OK;
+ int ret=ROOTPA_OK;
if(broken_) return ROOTPA_ERROR_INTERNAL;
- jmethodID mid=env_->GetMethodID(cls_, "add", "(Ljava/lang/Object;)Z");
+ jmethodID mid=env_->GetMethodID(cls_, "add", "(Ljava/lang/Object;)Z");
if(NULL==mid)
{
LOGE("do not find add(Ljava/lang/Object)Z from List");
return ROOTPA_ERROR_INTERNAL;
}
-
+
jobject responseObject=NULL;
bool result;
for(int i=0; i<numberOfResponses; i++)
@@ -76,15 +76,15 @@ int CmpResponses::update(CmpMessage* responses, int numberOfResponses)
if((result=(bool) env_->CallBooleanMethod(msgs_, mid, responseObject))==false)
{
ret=ROOTPA_ERROR_INTERNAL;
- LOGE("adding cmp response object %d failed", i);
+ LOGE("adding cmp response object %d failed", i);
}
env_->DeleteLocalRef(responseObject);
}
else
{
ret=ROOTPA_ERROR_INTERNAL;
- LOGE("creating cmp response object failed");
- }
+ LOGE("creating cmp response object failed");
+ }
}
return ret;
}
@@ -101,17 +101,17 @@ jobject CmpResponses::createCmpResponseObject(CmpMessage msg)
{
jmethodID constructor=NULL;
JniHelpers helper(env_);
- jbyteArray rsp = helper.byteArrayToJByteArray(msg.contentP, msg.length);
+ jbyteArray rsp = helper.byteArrayToJByteArray(msg.contentP, msg.length);
if(rsp != NULL)
{
- constructor = env_->GetMethodID(objectCls_, "<init>", "([B)V");
+ constructor = env_->GetMethodID(objectCls_, "<init>", "([B)V");
}
else
{
constructor = env_->GetMethodID(objectCls_, "<init>", "()V");
LOGE("CmpResponses::createCmpResponseObject no response received, using empty response object");
}
-
+
if(constructor != NULL)
{
@@ -126,27 +126,27 @@ jobject CmpResponses::createCmpResponseObject(CmpMessage msg)
if(NULL==newObject)
{
- LOGE("CmpResponses::createCmpResponseObject creating new object failed %d %d", objectCls_, constructor);
+ LOGE("CmpResponses::createCmpResponseObject creating new object failed %p %p", objectCls_, constructor);
}
}
else
{
- LOGE("CmpResponses::createCmpResponseObject creating constructor failed");
+ LOGE("CmpResponses::createCmpResponseObject creating constructor failed");
}
-
+
if(rsp != NULL)
{
env_->DeleteLocalRef(rsp);
}
-
+
}
else
{
LOGE("CmpResponses::createCmpResponseObject did not find java side class /com/gd/mobicore/pa/ifc/CmpResponse");
}
}
-
+
if(objectCls_!=NULL)
{
env_->DeleteLocalRef(objectCls_);
diff --git a/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/CmpResponses.h b/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/CmpResponses.h
index 9b24444..c3cc44d 100644
--- a/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/CmpResponses.h
+++ b/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/CmpResponses.h
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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 CMPRESPONSES_H
#define CMPRESPONSES_H
@@ -40,10 +40,10 @@ class CmpResponses : public CmpBase
CmpResponses(JNIEnv* env, jobject responses);
virtual ~CmpResponses();
int update(CmpMessage* responses, int numberOfResponses);
- private:
+ private:
CmpResponses();
CmpResponses(CmpResponses&);
- jobject createCmpResponseObject(CmpMessage msg);
+ jobject createCmpResponseObject(CmpMessage msg);
};
#endif // CMPRESPONSES_H
diff --git a/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/JniHelpers.cpp b/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/JniHelpers.cpp
index 4180907..ba6d815 100644
--- a/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/JniHelpers.cpp
+++ b/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/JniHelpers.cpp
@@ -1,40 +1,38 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
-
+ * Copyright (c) 2013 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 <string.h>
-
#include "JniHelpers.h"
#include "rootpaErrors.h"
-JniHelpers::JniHelpers(JNIEnv* envP):broken_(false),
+JniHelpers::JniHelpers(JNIEnv* envP):broken_(false),
envP_(envP),
keysP_(NULL),
valuesP_(NULL),
@@ -45,7 +43,7 @@ JniHelpers::JniHelpers(JNIEnv* envP):broken_(false),
stringConstructur_(NULL),
intConstructor_(NULL),
listAdd_(NULL)
-{}
+{}
JniHelpers::~JniHelpers()
{
@@ -53,20 +51,20 @@ JniHelpers::~JniHelpers()
{
envP_->DeleteLocalRef(listCls_);
}
-
+
if(intCls_!=NULL)
{
envP_->DeleteLocalRef(intCls_);
- }
-
+ }
+
if(stringCls_!=NULL)
{
envP_->DeleteLocalRef(stringCls_);
- }
+ }
}
-JniHelpers::JniHelpers(JNIEnv* envP,jobject* keysP, jobject* valuesP, jbyteArray* productIdP):broken_(false),
+JniHelpers::JniHelpers(JNIEnv* envP,jobject* keysP, jobject* valuesP, jbyteArray* productIdP):broken_(false),
envP_(envP),
keysP_(keysP),
valuesP_(valuesP),
@@ -81,15 +79,15 @@ JniHelpers::JniHelpers(JNIEnv* envP,jobject* keysP, jobject* valuesP, jbyteArray
listCls_=envP_->FindClass("java/util/List");
if(NULL == listCls_)
{
- LOGE("JniHelpers::JniHelpers no listCls_");
+ LOGE("JniHelpers::JniHelpers no listCls_");
broken_=true;
return;
}
- listAdd_=envP_->GetMethodID(listCls_, "add", "(Ljava/lang/Object;)Z");
+ listAdd_=envP_->GetMethodID(listCls_, "add", "(Ljava/lang/Object;)Z");
if(NULL == listAdd_)
{
- LOGE("JniHelpers::JniHelpers no listAdd_");
+ LOGE("JniHelpers::JniHelpers no listAdd_");
broken_=true;
return;
}
@@ -102,18 +100,18 @@ JniHelpers::JniHelpers(JNIEnv* envP,jobject* keysP, jobject* valuesP, jbyteArray
return;
}
- intConstructor_=envP_->GetMethodID(intCls_, "<init>", "(I)V");
+ intConstructor_=envP_->GetMethodID(intCls_, "<init>", "(I)V");
if(NULL == intConstructor_)
{
- LOGE("JniHelpers::JniHelpers no intConstructor_");
+ LOGE("JniHelpers::JniHelpers no intConstructor_");
broken_=true;
return;
}
-
+
stringCls_=envP_->FindClass("java/lang/String");
if(NULL == stringCls_)
{
- LOGE("JniHelpers::JniHelpers no stringCls_");
+ LOGE("JniHelpers::JniHelpers no stringCls_");
broken_=true;
return;
}
@@ -121,7 +119,7 @@ JniHelpers::JniHelpers(JNIEnv* envP,jobject* keysP, jobject* valuesP, jbyteArray
stringConstructur_=envP_->GetMethodID(stringCls_, "<init>", "([B)V");
if(NULL == stringConstructur_)
{
- LOGE("JniHelpers::JniHelpers no stringConstructur_");
+ LOGE("JniHelpers::JniHelpers no stringConstructur_");
broken_=true;
return;
}
@@ -138,11 +136,11 @@ int JniHelpers::setVersion(char* fieldName, int version)
broken_=true;
return ROOTPA_ERROR_INTERNAL;
}
-
+
jobject newStringObject = envP_->NewObject(stringCls_, stringConstructur_, fName);
if(NULL == newStringObject)
{
- LOGE("JniHelpers::setVersion no newStringObject");
+ LOGE("JniHelpers::setVersion no newStringObject");
broken_=true;
envP_->DeleteLocalRef(fName);
return ROOTPA_ERROR_INTERNAL;
@@ -151,31 +149,31 @@ int JniHelpers::setVersion(char* fieldName, int version)
if(envP_->CallBooleanMethod(*keysP_, listAdd_, newStringObject)==JNI_FALSE)
{
- LOGE("JniHelpers::setVersion can not add key");
+ LOGE("JniHelpers::setVersion can not add key");
broken_=true;
envP_->DeleteLocalRef(newStringObject);
- return ROOTPA_ERROR_INTERNAL;
+ return ROOTPA_ERROR_INTERNAL;
}
envP_->DeleteLocalRef(newStringObject);
jobject newIntObject = envP_->NewObject(intCls_, intConstructor_, version);
if(NULL == newIntObject)
{
- LOGE("JniHelpers::setVersion no newIntObject");
+ LOGE("JniHelpers::setVersion no newIntObject");
broken_=true;
return ROOTPA_ERROR_INTERNAL;
- }
-
+ }
+
if(envP_->CallBooleanMethod(*valuesP_, listAdd_, newIntObject)==JNI_FALSE)
{
- LOGE("JniHelpers::setVersion can not add value");
+ LOGE("JniHelpers::setVersion can not add value");
broken_=true;
envP_->DeleteLocalRef(newIntObject);
- return ROOTPA_ERROR_INTERNAL;
+ return ROOTPA_ERROR_INTERNAL;
}
envP_->DeleteLocalRef(newIntObject);
-
- return ROOTPA_OK;
+
+ return ROOTPA_OK;
}
int JniHelpers::setProductId(char* productId)
@@ -210,20 +208,20 @@ int JniHelpers::setIntToArray(jintArray* targetArrayP, int index, int source)
return ROOTPA_OK;
}
-jbyteArray JniHelpers::byteArrayToJByteArray(uint8_t* dataP, uint32_t length)
+jbyteArray JniHelpers::byteArrayToJByteArray(uint8_t* dataP, uint32_t length)
{
jbyteArray jbArray = NULL;
- if (envP_->EnsureLocalCapacity(1) == JNI_OK)
+ if (envP_->EnsureLocalCapacity(1) == JNI_OK)
{
-
- if ((length > 0) && (dataP != NULL))
+
+ if ((length > 0) && (dataP != NULL))
{
jbArray = envP_->NewByteArray(length);
- if (jbArray != NULL)
+ if (jbArray != NULL)
{
envP_->SetByteArrayRegion(jbArray, 0, length, (jbyte*) dataP);
}
- }
+ }
}
return jbArray;
@@ -235,7 +233,7 @@ jbyteArray JniHelpers::byteArrayToJByteArray(uint8_t* dataP, uint32_t length)
* @param outLength* (OUT PARAMETER) length of the returned uint8_t* byte array
* @return uint8_t* byte array. Needs to be freed with delete[] afterwards.
*/
-uint8_t* JniHelpers::jByteArrayToCByteArray(jbyteArray jBytes, uint32_t* outLength)
+uint8_t* JniHelpers::jByteArrayToCByteArray(jbyteArray jBytes, uint32_t* outLength)
{
*outLength=0;
uint8_t* cBytes = NULL;
@@ -244,14 +242,14 @@ uint8_t* JniHelpers::jByteArrayToCByteArray(jbyteArray jBytes, uint32_t* outLeng
*outLength = envP_->GetArrayLength(jBytes);
cBytes = new uint8_t[*outLength];
jbyte* p_jcResult = envP_->GetByteArrayElements(jBytes, JNI_FALSE);
- for (unsigned int i = 0; i < *outLength; i++)
+ for (unsigned int i = 0; i < *outLength; i++)
{
cBytes[i] = (uint8_t) p_jcResult[i] & (0x00ff);
}
envP_->ReleaseByteArrayElements(jBytes, p_jcResult, JNI_FALSE);
}
- else
+ else
{
LOGE("jByteArrayToCByteArray: Input is NULL or something else is broken. Cannot return byte array");
}
diff --git a/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/JniHelpers.h b/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/JniHelpers.h
index 2a93d80..df3b02e 100644
--- a/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/JniHelpers.h
+++ b/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/JniHelpers.h
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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 JNIHELPERS_H
#define JNIHELPERS_H
@@ -63,10 +63,10 @@ class JniHelpers
jclass listCls_;
jclass intCls_;
- jclass stringCls_;
+ jclass stringCls_;
jmethodID stringConstructur_;
jmethodID intConstructor_;
- jmethodID listAdd_;
+ jmethodID listAdd_;
};
diff --git a/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/com_gd_mobicore_pa_jni_CommonPAWrapper.h b/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/com_gd_mobicore_pa_jni_CommonPAWrapper.h
index c3aa05d..d74074c 100644
--- a/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/com_gd_mobicore_pa_jni_CommonPAWrapper.h
+++ b/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/com_gd_mobicore_pa_jni_CommonPAWrapper.h
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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.
+ */
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
diff --git a/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/commonwrapper.cpp b/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/commonwrapper.cpp
index 3fe592a..f265c1e 100644
--- a/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/commonwrapper.cpp
+++ b/mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/commonwrapper.cpp
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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 <string.h>
#include "com_gd_mobicore_pa_jni_CommonPAWrapper.h"
@@ -45,8 +45,8 @@ OF THE POSSIBILITY OF SUCH DAMAGE.
JavaVM* jvmP_ = NULL;
const jint VERSION=JNI_VERSION_1_2;
-
-JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* jvm, void* reserved)
+/* Original params list : (JavaVM* jvm, void* reserved)*/
+JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* jvm, void*)
{
// remember JVM pointer:
jvmP_ = jvm;
@@ -56,7 +56,7 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* jvm, void* reserved)
JNIEXPORT jint JNICALL Java_com_gd_mobicore_pa_jni_CommonPAWrapper_openSession(JNIEnv *, jobject)
{
- return (jint) openSessionToCmtl();
+ return (jint) openSessionToCmtl();
}
JNIEXPORT void JNICALL Java_com_gd_mobicore_pa_jni_CommonPAWrapper_closeSession(JNIEnv *, jobject)
@@ -64,8 +64,9 @@ JNIEXPORT void JNICALL Java_com_gd_mobicore_pa_jni_CommonPAWrapper_closeSession(
closeSessionToCmtl();
}
+/* Original params list : (JNIEnv* env, jobject, jint uid, jobject inCommands, jobject outResults)*/
JNIEXPORT jint JNICALL Java_com_gd_mobicore_pa_jni_CommonPAWrapper_executeCmpCommands
- (JNIEnv* env, jobject, jint uid, jobject inCommands, jobject outResults)
+ (JNIEnv* env, jobject, jint, jobject inCommands, jobject outResults)
{
LOGD(">>Java_com_gd_mobicore_pa_jni_CommonPAWrapper_executeCmpCommands\n");
int ret=ROOTPA_OK;
@@ -75,22 +76,22 @@ JNIEXPORT jint JNICALL Java_com_gd_mobicore_pa_jni_CommonPAWrapper_executeCmpCom
int numberOfCommands=inCmd.numberOfElements();
if(0==numberOfCommands){
- LOGD("No commands received, returning ROOTPA_COMMAND_NOT_SUPPORTED\n");
+ LOGD("No commands received, returning ROOTPA_COMMAND_NOT_SUPPORTED\n");
return ROOTPA_COMMAND_NOT_SUPPORTED;
}
CmpMessage* commands = new CmpMessage[numberOfCommands];
if(NULL==commands) return ROOTPA_ERROR_OUT_OF_MEMORY;
- memset(commands, 0, numberOfCommands*sizeof(CmpMessage));
+ memset(commands, 0, numberOfCommands*sizeof(CmpMessage));
CmpMessage* responses = new CmpMessage[numberOfCommands];
if(NULL==responses)
- {
+ {
delete [] commands;
return ROOTPA_ERROR_OUT_OF_MEMORY;
}
memset(responses, 0, numberOfCommands*sizeof(CmpMessage));
-
+
if(inCmd.getCommands(commands)==false)
{
LOGE("getting commands on C side of the wrapper failed\n");
@@ -99,7 +100,7 @@ JNIEXPORT jint JNICALL Java_com_gd_mobicore_pa_jni_CommonPAWrapper_executeCmpCom
else
{
ret=executeCmpCommands(numberOfCommands, commands, responses, &internalError);
- CmpResponses outRsp(env, outResults);
+ CmpResponses outRsp(env, outResults);
if(ret!=ROOTPA_OK)
{
LOGE("call to executeCmpCommands failed %d %d\n", ret, internalError);
@@ -144,7 +145,7 @@ JNIEXPORT jint JNICALL Java_com_gd_mobicore_pa_jni_CommonPAWrapper_getVersion
int ret=ROOTPA_OK;
int tag=0;
mcVersionInfo_t version;
-
+
ret=getVersion(&tag, &version);
if(ROOTPA_OK == ret)
{
@@ -177,7 +178,7 @@ JNIEXPORT jint JNICALL Java_com_gd_mobicore_pa_jni_CommonPAWrapper_getVersion
}
}
}
- LOGD("<<Java_com_gd_mobicore_pa_jni_CommonPAWrapper_getVersion %x %x %x\n", productId, keys, values);
+ LOGD("<<Java_com_gd_mobicore_pa_jni_CommonPAWrapper_getVersion %x %x %x\n", productId, keys, values);
return ret;
}
@@ -186,14 +187,14 @@ JNIEXPORT jint JNICALL Java_com_gd_mobicore_pa_jni_CommonPAWrapper_getSuid
{
int ret=ROOTPA_OK;
mcSuid_t mySuid;
-
+
ret=getSuid(&mySuid);
if(ROOTPA_OK == ret)
{
JniHelpers jniHelp(env);
ret=jniHelp.setByteArray(&suid, (uint8_t*)&mySuid, sizeof(mySuid));
}
- return ret;
+ return ret;
}
JNIEXPORT jint JNICALL Java_com_gd_mobicore_pa_jni_CommonPAWrapper_isRootContainerRegistered
@@ -201,14 +202,14 @@ JNIEXPORT jint JNICALL Java_com_gd_mobicore_pa_jni_CommonPAWrapper_isRootContain
{
int ret=ROOTPA_OK;
bool isRegistered;
-
+
ret=isRootContainerRegistered(&isRegistered);
if(ROOTPA_OK == ret)
{
JniHelpers jniHelp(envP);
ret=jniHelp.setBooleanToArray(&result, isRegistered);
}
- return ret;
+ return ret;
}
JNIEXPORT jint JNICALL Java_com_gd_mobicore_pa_jni_CommonPAWrapper_isSpContainerRegistered
@@ -223,7 +224,7 @@ JNIEXPORT jint JNICALL Java_com_gd_mobicore_pa_jni_CommonPAWrapper_isSpContainer
JniHelpers jniHelp(envP);
ret=jniHelp.setBooleanToArray(&result, isRegistered);
}
- return ret;
+ return ret;
}
JNIEXPORT jint JNICALL Java_com_gd_mobicore_pa_jni_CommonPAWrapper_getSPContainerState
@@ -240,11 +241,11 @@ JNIEXPORT jint JNICALL Java_com_gd_mobicore_pa_jni_CommonPAWrapper_getSPContaine
ret=jniHelp.setIntToArray(&stateArray, 0, state);
}
LOGD("<<Java_com_gd_mobicore_pa_jni_CommonPAWrapper_getSpContainerState\n");
- return ret;
+ return ret;
}
const int CONTAINER_STATE_IDX=0;
-const int NUMBER_OF_TLTS_IDX=1;
+const int NUMBER_OF_TLTS_IDX=1;
const int NUMBER_OF_ELEMENTS=2;
JNIEXPORT jint JNICALL Java_com_gd_mobicore_pa_jni_CommonPAWrapper_getSPContainerStructure
@@ -255,7 +256,7 @@ JNIEXPORT jint JNICALL Java_com_gd_mobicore_pa_jni_CommonPAWrapper_getSPContaine
int state;
SpContainerStructure spContainerStructure;
-
+
ret=getSpContainerStructure((mcSpid_t) spid, &spContainerStructure);
if(ROOTPA_OK == ret)
{
@@ -285,7 +286,7 @@ JNIEXPORT jint JNICALL Java_com_gd_mobicore_pa_jni_CommonPAWrapper_getSPContaine
spContainerStructure.tltContainers[i].uuid.value[13],
spContainerStructure.tltContainers[i].uuid.value[14],
spContainerStructure.tltContainers[i].uuid.value[15]);
-
+
ret=jniHelp.setIntToArray(&trustletStates, i, spContainerStructure.tltContainers[i].state);
jbyteArray uuid = jniHelp.byteArrayToJByteArray(spContainerStructure.tltContainers[i].uuid.value, UUID_LENGTH);
envP->SetObjectArrayElement(uuidArray, i, (jobject) uuid);
@@ -304,12 +305,12 @@ JNIEXPORT jint JNICALL Java_com_gd_mobicore_pa_jni_CommonPAWrapper_getSPContaine
}
else
{
- LOGE("..._jni_CommonPAWrapper_getSPContainerStructure getSpContainerStructure failed\n");
+ LOGE("..._jni_CommonPAWrapper_getSPContainerStructure getSpContainerStructure failed\n");
}
-
-
+
+
LOGD("<<Java_com_gd_mobicore_pa_jni_CommonPAWrapper_getSPContainerStructure %d\n", ret);
- return ret;
+ return ret;
}
jmethodID provisioningStateCallback_=NULL;
@@ -323,7 +324,7 @@ void stateUpdateCallback(ProvisioningState state, rootpaerror_t error, tltInfo_t
JNIEnv* envP=NULL;
- // it is enough to call this only once for each thread but since this is
+ // it is enough to call this only once for each thread but since this is
// the best place to call it we call it every time
jint res = jvmP_->AttachCurrentThread(&envP, NULL);
@@ -331,7 +332,7 @@ void stateUpdateCallback(ProvisioningState state, rootpaerror_t error, tltInfo_t
if(NULL==obj_ ||NULL==provisioningStateCallback_ || NULL== envP || res != JNI_OK)
{
LOGE("obj=%ld, provisioningStateCallback==%ld, envP==%ld res==%d", (long int) obj_, (long int) provisioningStateCallback_, (long int) envP, res);
- }
+ }
else if(PROVISIONING_STATE_INSTALL_TRUSTLET == state)
{
if(tltInfoP)
@@ -348,7 +349,7 @@ void stateUpdateCallback(ProvisioningState state, rootpaerror_t error, tltInfo_t
}
else
{
- envP->CallVoidMethod(obj_, provisioningStateCallback_, state, error);
+ envP->CallVoidMethod(obj_, provisioningStateCallback_, state, error);
}
if( obj_!=NULL && (PROVISIONING_STATE_THREAD_EXITING == state) )
@@ -358,20 +359,20 @@ void stateUpdateCallback(ProvisioningState state, rootpaerror_t error, tltInfo_t
obj_=NULL;
}
- // doing this in every round in order to make sure what is attached will be detached and that
- // envP is correctly updated at every round (it seems to work also inside the above if statement,
- // but calling AttachCurrentThread to already attached thread is is supposed to be no-op. It seems
+ // doing this in every round in order to make sure what is attached will be detached and that
+ // envP is correctly updated at every round (it seems to work also inside the above if statement,
+ // but calling AttachCurrentThread to already attached thread is is supposed to be no-op. It seems
// to update the envP though.)
// If the thread is not detached there will be a crash when the thread exists
jvmP_->DetachCurrentThread();
-
+
LOGD("<<stateUpdateCallback\n");
}
void storeCallbackMethodIds(JNIEnv* envP)
{
- LOGD(">>storeCallbackMethodIds\n");
-
+ LOGD(">>storeCallbackMethodIds\n");
+
jclass cls = envP->GetObjectClass(obj_);
if(NULL==cls)
{
@@ -382,37 +383,37 @@ void storeCallbackMethodIds(JNIEnv* envP)
if(NULL==provisioningStateCallback_)
{
LOGE("storeCallbackMethodIds provisioningStateCallback_==NULL");
- }
+ }
getSystemInfoCallback_ = envP->GetMethodID(cls, "getSystemInfo","()[Ljava/lang/String;");
if(NULL==getSystemInfoCallback_)
{
LOGE("storeCallbackMethodIds getSystemInfoCallback_==NULL");
- }
+ }
trustletInstallCallback_ = envP->GetMethodID(cls, "trustletInstallCallback","([B)V");
if(NULL==trustletInstallCallback_)
{
LOGE("storeCallbackMethodIds trustletInstallCallback_==NULL");
- }
+ }
if(cls!=NULL)
{
envP->DeleteLocalRef(cls);
}
-
+
LOGD("<<storeCallbackMethodIds\n");
}
/*
-This function has to be called before any communication with SE is done (or actually,
+This function has to be called before any communication with SE is done (or actually,
before any xml parsing is done.
*/
void setFilesPath(JNIEnv* envP, jobject obj)
{
LOGD(">>setFilesPath\n");
-
+
jclass cls = envP->GetObjectClass(obj);
if(NULL==cls)
{
@@ -422,14 +423,14 @@ void setFilesPath(JNIEnv* envP, jobject obj)
jmethodID getFilesDirPath = envP->GetMethodID(cls, "getFilesDirPath","()Ljava/lang/String;");
if(NULL==getFilesDirPath)
{
- setPaths(HARDCODED_STORAGEPATH, CERT_PATH);
+ setPaths(HARDCODED_STORAGEPATH, CERT_PATH);
LOGE("<<setFilesPath getFilesDirPath==NULL, used hardcoded paths");
return;
}
-
- jobject jpath = envP->CallObjectMethod(obj, getFilesDirPath);
+
+ jobject jpath = envP->CallObjectMethod(obj, getFilesDirPath);
if(jpath!=NULL)
- {
+ {
const char* pathP = envP->GetStringUTFChars((jstring)jpath, NULL);
setPaths(pathP, CERT_PATH);
if(NULL == pathP)
@@ -443,19 +444,19 @@ void setFilesPath(JNIEnv* envP, jobject obj)
else
{
LOGE("setFilesPath jpath==NULL, using hardcoded paths");
- setPaths(HARDCODED_STORAGEPATH, CERT_PATH);
- }
+ setPaths(HARDCODED_STORAGEPATH, CERT_PATH);
+ }
if(cls!=NULL)
{
envP->DeleteLocalRef(cls);
- }
-
+ }
+
LOGD("<<setFilesPath\n");
}
const int IMEI_ESN_INDEX=com_gd_mobicore_pa_jni_CommonPAWrapper_IMEI_ESN_INDEX;
-const int MNO_INDEX=com_gd_mobicore_pa_jni_CommonPAWrapper_MNO_INDEX;
+const int MNO_INDEX=com_gd_mobicore_pa_jni_CommonPAWrapper_MNO_INDEX;
const int BRAND_INDEX=com_gd_mobicore_pa_jni_CommonPAWrapper_BRAND_INDEX;
const int MANUFACTURER_INDEX=com_gd_mobicore_pa_jni_CommonPAWrapper_MANUFACTURER_INDEX;
const int HARDWARE_INDEX=com_gd_mobicore_pa_jni_CommonPAWrapper_HARDWARE_INDEX;
@@ -476,7 +477,7 @@ void copyElement(JNIEnv* envP, char** target, jstring source)
}
else
{
- *target=NULL;
+ *target=NULL;
}
}
@@ -486,9 +487,9 @@ rootpaerror_t getSystemInfoCallback(osInfo_t* osSpecificInfoP)
rootpaerror_t ret=ROOTPA_OK;
if(NULL==osSpecificInfoP) return ROOTPA_ERROR_INTERNAL;
-
+
memset(osSpecificInfoP, 0, sizeof(osInfo_t));
-
+
JNIEnv* envP=NULL;
jint res = jvmP_->AttachCurrentThread(&envP, NULL);
@@ -497,12 +498,12 @@ rootpaerror_t getSystemInfoCallback(osInfo_t* osSpecificInfoP)
{
ret=ROOTPA_ERROR_INTERNAL;
LOGE("obj=%ld, getSystemInfoCallback_==%ld, envP==%ld res==%d", (long int) obj_, (long int) getSystemInfoCallback_, (long int) envP, res);
- }
+ }
else
{
- jobjectArray systemInfo = (jobjectArray) envP->CallObjectMethod(obj_, getSystemInfoCallback_);
+ jobjectArray systemInfo = (jobjectArray) envP->CallObjectMethod(obj_, getSystemInfoCallback_);
if(systemInfo!=NULL)
- {
+ {
jstring imeiEsn=(jstring) envP->GetObjectArrayElement(systemInfo, IMEI_ESN_INDEX);
jstring mno=(jstring) envP->GetObjectArrayElement(systemInfo, MNO_INDEX);
jstring brand=(jstring) envP->GetObjectArrayElement(systemInfo, BRAND_INDEX);
@@ -510,7 +511,7 @@ rootpaerror_t getSystemInfoCallback(osInfo_t* osSpecificInfoP)
jstring hw=(jstring) envP->GetObjectArrayElement(systemInfo, HARDWARE_INDEX);
jstring model=(jstring) envP->GetObjectArrayElement(systemInfo, MODEL_INDEX);
jstring version=(jstring) envP->GetObjectArrayElement(systemInfo, VERSION_INDEX);
-
+
copyElement(envP, &osSpecificInfoP->imeiEsnP, imeiEsn);
copyElement(envP, &osSpecificInfoP->mnoP, mno);
copyElement(envP, &osSpecificInfoP->brandP, brand);
@@ -526,12 +527,12 @@ rootpaerror_t getSystemInfoCallback(osInfo_t* osSpecificInfoP)
if(manufacturer!=NULL) envP->DeleteLocalRef(manufacturer);
if(hw!=NULL) envP->DeleteLocalRef(hw);
if(model!=NULL) envP->DeleteLocalRef(model);
- if(version!=NULL) envP->DeleteLocalRef(version);
- }
+ if(version!=NULL) envP->DeleteLocalRef(version);
+ }
}
- // doing this in every round in order to make sure what is attached will be detached and that
- // envP is correctly updated at every round (it seems to work also inside the above if, but
+ // doing this in every round in order to make sure what is attached will be detached and that
+ // envP is correctly updated at every round (it seems to work also inside the above if, but
// calling AttachCurrentThread to already attched thread is is supposed to be no-op. It seems to
// update the envP though.)
// If the thread is not detached there will be a crash when the thread exists
@@ -541,20 +542,21 @@ rootpaerror_t getSystemInfoCallback(osInfo_t* osSpecificInfoP)
return ret;
}
+/* Original params list : (JNIEnv* envP, jobject obj, jint uid, jint spid, jbyteArray seAddress)*/
JNIEXPORT jint JNICALL Java_com_gd_mobicore_pa_jni_CommonPAWrapper_doProvisioning
- (JNIEnv* envP, jobject obj, jint uid, jint spid, jbyteArray seAddress)
+ (JNIEnv* envP, jobject obj, jint, jint spid, jbyteArray seAddress)
{
LOGD(">>Java_com_gd_mobicore_pa_jni_CommonPAWrapper_doProvisioning %ld %ld\n", (long int) stateUpdateCallback, (long int) getSystemInfoCallback);
setFilesPath(envP, obj);
int ret=ROOTPA_OK;
-
+
if(seAddress)
{
uint32_t length=0;
JniHelpers jniHelp(envP);
char* addrP=(char*)jniHelp.jByteArrayToCByteArray(seAddress, &length);
ret=setSeAddress(addrP, length);
- delete[] addrP;
+ delete[] addrP;
}
if(ROOTPA_OK==ret)
@@ -569,36 +571,36 @@ JNIEXPORT jint JNICALL Java_com_gd_mobicore_pa_jni_CommonPAWrapper_doProvisionin
JNIEXPORT jint JNICALL Java_com_gd_mobicore_pa_jni_CommonPAWrapper_installTrustlet
-(JNIEnv* envP, jobject obj,
-jint spid,
-jbyteArray uuid,
-jint requestDataType,
-jbyteArray tltOrKeyData,
+(JNIEnv* envP, jobject obj,
+jint spid,
+jbyteArray uuid,
+jint requestDataType,
+jbyteArray tltOrKeyData,
jint minTltVersion,
jbyteArray tltPukHash,
-jint memoryType,
-jint numberOfInstances,
-jint flags,
+jint memoryType,
+jint numberOfInstances,
+jint flags,
jbyteArray seAddress)
{
LOGD(">>Java_com_gd_mobicore_pa_jni_CommonPAWrapper_installTrustlet %ld %ld\n", (long int) stateUpdateCallback, (long int) getSystemInfoCallback);
setFilesPath(envP, obj);
int ret=ROOTPA_OK;
- JniHelpers jniHelp(envP);
-
+ JniHelpers jniHelp(envP);
+
if(seAddress)
{
uint32_t length=0;
char* addrP=(char*)jniHelp.jByteArrayToCByteArray(seAddress, &length);
ret=setSeAddress(addrP, length);
- delete[] addrP;
+ delete[] addrP;
}
if(ROOTPA_OK==ret)
{
obj_= envP->NewGlobalRef(obj);
storeCallbackMethodIds(envP);
- trustletInstallationData_t tltData;
+ trustletInstallationData_t tltData;
tltData.dataP=(uint8_t*) jniHelp.jByteArrayToCByteArray(tltOrKeyData, &tltData.dataLength);
tltData.dataType=(TltInstallationRequestDataType) requestDataType;
tltData.minTltVersion=minTltVersion;
@@ -606,7 +608,7 @@ jbyteArray seAddress)
tltData.memoryType=memoryType;
tltData.numberOfInstances=numberOfInstances;
tltData.flags=flags;
-
+
uint32_t uuidLength=0;
uint8_t* uuidP=(uint8_t*) jniHelp.jByteArrayToCByteArray(uuid, &uuidLength);
if(UUID_LENGTH != uuidLength){
@@ -636,11 +638,11 @@ JNIEXPORT jint JNICALL Java_com_gd_mobicore_pa_jni_CommonPAWrapper_unregisterRoo
uint32_t length=0;
char* addrP=(char*)jniHelp.jByteArrayToCByteArray(seAddress, &length);
ret=setSeAddress(addrP, length);
- delete[] addrP;
+ delete[] addrP;
}
if(ROOTPA_OK==ret)
- {
+ {
obj_= envP->NewGlobalRef(obj);
storeCallbackMethodIds(envP);
ret=unregisterRootContainer(stateUpdateCallback, getSystemInfoCallback);
@@ -659,19 +661,20 @@ char* addTrailingZero(uint8_t* vP, uint32_t length)
memcpy(newVP, vP, length);
newVP[length]=0;
}
- delete [] vP;
+ delete [] vP;
return newVP;
}
-JNIEXPORT void JNICALL Java_com_gd_mobicore_pa_jni_CommonPAWrapper_setEnvironmentVariable(JNIEnv* envP, jobject obj, jbyteArray variable_name, jbyteArray value)
+/* Original params list : (JNIEnv* envP, jobject obj, jbyteArray variable_name, jbyteArray value)*/
+JNIEXPORT void JNICALL Java_com_gd_mobicore_pa_jni_CommonPAWrapper_setEnvironmentVariable(JNIEnv* envP, jobject, jbyteArray variable_name, jbyteArray value)
{
LOGD(">>Java_com_gd_mobicore_pa_jni_CommonPAWrapper_setEnvironmentVariable");
JniHelpers jniHelp(envP);
- uint32_t length=0;
+ uint32_t length=0;
char* envVarP=NULL;
char* envValP=NULL;
uint8_t* vP=jniHelp.jByteArrayToCByteArray(variable_name, &length);
-
+
if(NULL==vP)
{
LOGE("Java_com_gd_mobicore_pa_jni_CommonPAWrapper_setEnvironmentVariable, FAILURE: can not get variable\n");
@@ -681,7 +684,7 @@ JNIEXPORT void JNICALL Java_com_gd_mobicore_pa_jni_CommonPAWrapper_setEnvironmen
envVarP = addTrailingZero(vP, length);
if(value!=NULL)
{
- vP=jniHelp.jByteArrayToCByteArray(value, &length);
+ vP=jniHelp.jByteArrayToCByteArray(value, &length);
if(NULL!=vP)
{
envValP = addTrailingZero(vP, length);
@@ -701,7 +704,7 @@ JNIEXPORT void JNICALL Java_com_gd_mobicore_pa_jni_CommonPAWrapper_setEnvironmen
}
else
{
- LOGD("unsetting environment variable, %s", envVarP);
+ LOGD("unsetting environment variable, %s", envVarP);
if(unsetenv(envVarP)!=0)
{
LOGE("Java_com_gd_mobicore_pa_jni_CommonPAWrapper_setEnvironmentVariable, unsetenv %s FAILURE\n", envVarP);
@@ -713,7 +716,8 @@ JNIEXPORT void JNICALL Java_com_gd_mobicore_pa_jni_CommonPAWrapper_setEnvironmen
LOGD("<<Java_com_gd_mobicore_pa_jni_CommonPAWrapper_setEnvironmentVariable");
}
-JNIEXPORT jint JNICALL Java_com_gd_mobicore_pa_jni_CommonPAWrapper_storeTA(JNIEnv* envP, jobject obj, jint spid, jbyteArray uuid, jbyteArray taBin)
+/* Original params list : (JNIEnv* envP, jobject obj, jint spid, jbyteArray uuid, jbyteArray taBin)*/
+JNIEXPORT jint JNICALL Java_com_gd_mobicore_pa_jni_CommonPAWrapper_storeTA(JNIEnv* envP, jobject, jint spid, jbyteArray uuid, jbyteArray taBin)
{
LOGD(">>Java_com_gd_mobicore_pa_jni_CommonPAWrapper_storeTA");
int ret=ROOTPA_OK;
@@ -721,7 +725,7 @@ JNIEXPORT jint JNICALL Java_com_gd_mobicore_pa_jni_CommonPAWrapper_storeTA(JNIEn
uint32_t uuidLength=0;
uint8_t* uuidP=(uint8_t*) jniHelp.jByteArrayToCByteArray(uuid, &uuidLength);
-
+
if(UUID_LENGTH != uuidLength){
LOGD("<<Java_com_gd_mobicore_pa_jni_CommonPAWrapper_storeTA, wrong uuidLength %d, not installing\n", uuidLength);
free(uuidP);
@@ -729,8 +733,8 @@ JNIEXPORT jint JNICALL Java_com_gd_mobicore_pa_jni_CommonPAWrapper_storeTA(JNIEn
}
mcUuid_t mcUuid;
memcpy(mcUuid.value, uuidP, UUID_LENGTH);
- free(uuidP);
-
+ free(uuidP);
+
uint32_t taBinLength=0;
uint8_t* taBinP=(uint8_t*) jniHelp.jByteArrayToCByteArray(taBin, &taBinLength);
if(0==taBinLength){
diff --git a/mobicore/rootpa/Code/Android/app/jni/McStub/Android.mk b/mobicore/rootpa/Code/Android/app/jni/McStub/Android.mk
index 307dc07..4cfc9df 100644
--- a/mobicore/rootpa/Code/Android/app/jni/McStub/Android.mk
+++ b/mobicore/rootpa/Code/Android/app/jni/McStub/Android.mk
@@ -49,7 +49,7 @@ ifeq ($(ROOTPA_MODULE_TEST), 1)
LOCAL_C_INCLUDES += $(MOBICORE_DIR_INC)/TlCm
LOCAL_C_INCLUDES += $(MOBICOREDRIVER_DIR_INC)
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../../Common/include
-
+ APP_PIE := true
LOCAL_32_BIT_ONLY := true
include $(BUILD_STATIC_LIBRARY)
diff --git a/mobicore/rootpa/Code/Android/app/src/com/gd/mobicore/pa/jni/CommonPAWrapper.java b/mobicore/rootpa/Code/Android/app/src/com/gd/mobicore/pa/jni/CommonPAWrapper.java
index febaac9..87d546e 100644
--- a/mobicore/rootpa/Code/Android/app/src/com/gd/mobicore/pa/jni/CommonPAWrapper.java
+++ b/mobicore/rootpa/Code/Android/app/src/com/gd/mobicore/pa/jni/CommonPAWrapper.java
@@ -1,37 +1,37 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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.
+ */
//
-// Wrapper class for common C part of the Root Provisioning Agent, the C
-// files under Android/jni
+// Wrapper class for common C part of the Root Provisioning Agent, the C
+// files under Android/jni
//
package com.gd.mobicore.pa.jni;
@@ -50,7 +50,7 @@ import com.gd.mobicore.pa.ifc.CmpResponse;
public class CommonPAWrapper {
private static final String TAG = "RootPA-J";
private BaseService service_;
-
+
public CommonPAWrapper(BaseService service){
service_=service;
Log.d(TAG,"CommonPAWrapper.java: constructor");
@@ -66,19 +66,19 @@ public class CommonPAWrapper {
public native int getSPContainerState(int spid, int[] state);
public native int getSPContainerStructure(int spid, int[] ints, byte[][] uuidArray, int[] trustletStates);
public native int doProvisioning(int uid, int spid, byte[] seAddress);
- public native int installTrustlet(int spid,
- byte[] uuid,
- int dataType,
+ public native int installTrustlet(int spid,
+ byte[] uuid,
+ int dataType,
byte[] tltOrKeyData,
int minTltVersion,
byte[] tltPukHash,
- int memoryType,
- int numberOfInstances,
- int flags,
+ int memoryType,
+ int numberOfInstances,
+ int flags,
byte[] seAddress);
public native int unregisterRootContainer(byte[] seAddress);
public native int storeTA(int spid, byte[] uuid, byte[] taBinary);
- public native void setEnvironmentVariable(byte[] variable, byte[] value);
+ public native void setEnvironmentVariable(byte[] variable, byte[] value);
static{
Log.d(TAG,"CommonPAWrapper.java: static");
@@ -103,14 +103,14 @@ public class CommonPAWrapper {
}
private static final int IMEI_ESN_INDEX=0;
- private static final int MNO_INDEX=1;
+ private static final int MNO_INDEX=1;
private static final int BRAND_INDEX=2;
private static final int MANUFACTURER_INDEX=3;
private static final int HARDWARE_INDEX=4;
- private static final int MODEL_INDEX=5;
+ private static final int MODEL_INDEX=5;
private static final int VERSION_INDEX=6;
private static final int RESPONSE_ARRAY_SIZE=7;
-
+
public String[] getSystemInfo(){
Log.d(TAG,">>CommonPAWrapper.getSystemInfo");
String[] response= new String[RESPONSE_ARRAY_SIZE];
@@ -128,11 +128,11 @@ public class CommonPAWrapper {
Log.d(TAG,"<<CommonPAWrapper.getSystemInfo "+response[IMEI_ESN_INDEX]+" "+response[MANUFACTURER_INDEX]+" "+response[VERSION_INDEX]);
return response;
}
-
-
+
+
public void trustletInstallCallback(byte[] trustlet){
Log.d(TAG,">>CommonPAWrapper.trustletInstallCallback "+trustlet.length);
service_.trustletInstallCallback(trustlet);
- Log.d(TAG,"<<CommonPAWrapper.trustletInstallCallback");
+ Log.d(TAG,"<<CommonPAWrapper.trustletInstallCallback");
}
}
diff --git a/mobicore/rootpa/Code/Android/app/src/com/gd/mobicore/pa/service/BaseService.java b/mobicore/rootpa/Code/Android/app/src/com/gd/mobicore/pa/service/BaseService.java
index 536a6b8..8c8bb2a 100644
--- a/mobicore/rootpa/Code/Android/app/src/com/gd/mobicore/pa/service/BaseService.java
+++ b/mobicore/rootpa/Code/Android/app/src/com/gd/mobicore/pa/service/BaseService.java
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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.
+ */
package com.gd.mobicore.pa.service;
@@ -39,11 +39,11 @@ import android.content.Context;
import android.net.NetworkInfo;
import android.net.ConnectivityManager;
+import java.io.File;
import java.net.URI;
import java.net.Proxy;
import java.net.Proxy.Type;
import java.net.ProxySelector;
-
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
@@ -54,21 +54,21 @@ import com.gd.mobicore.pa.ifc.RootPAProvisioningIntents;
import com.gd.mobicore.pa.ifc.CommandResult;
public abstract class BaseService extends Service {
- protected static final String TAG = "RootPA-J";
+ protected static final String TAG = "RootPA-J";
/*
- being statically linked library, the Common C implementation does not handle locks,
+ being statically linked library, the Common C implementation does not handle locks,
they must be handled in the using implementation, in this case here.
*/
private static final int LOCK_FREE=0;
private static final AtomicInteger lock_= new AtomicInteger(LOCK_FREE);
- private static final int LOCK_TIMEOUT_MS=60000;
+ private static final int LOCK_TIMEOUT_MS=300000; //5 mins in ms
private TimerTask timerTask_=null;
private Timer timer_=null;
protected int doProvisioningLockSuid_=0;
- protected byte[] se_ = null;
-
+ protected byte[] se_ = null;
+
private static final int C_CONNECTING_SERVICE_ENABLER=1;
private static final int C_AUTHENTICATING_SOC=2;
private static final int C_CREATING_ROOT_CONTAINER=3;
@@ -81,15 +81,15 @@ public abstract class BaseService extends Service {
protected final CommonPAWrapper commonPaWrapper_=new CommonPAWrapper(this);
private boolean sessionOpened_=false;
-
+
protected CommonPAWrapper commonPAWrapper(){
return commonPaWrapper_;
}
-
+
protected synchronized CommandResult acquireLock(int uid, boolean openSession){
Log.d(TAG,">>BaseService.acquireLock "+uid+" "+lock_.get()+" "+timer_);
if(uid==LOCK_FREE){
- return new CommandResult(CommandResult.ROOTPA_ERROR_ILLEGAL_ARGUMENT);
+ return new CommandResult(CommandResult.ROOTPA_ERROR_ILLEGAL_ARGUMENT);
}
boolean result=lock_.compareAndSet(LOCK_FREE, uid);
if(result==true || lock_.get() == uid){
@@ -111,7 +111,7 @@ public abstract class BaseService extends Service {
Log.i(TAG,"Timer expired, releasing lock");
lock_.set(LOCK_FREE);
if(sessionOpened_==true){
- Log.d(TAG,"BaseService.Timer.run, closingSession");
+ Log.d(TAG,"BaseService.Timer.run, closingSession");
commonPAWrapper().closeSession();
sessionOpened_=false;
}
@@ -123,13 +123,13 @@ public abstract class BaseService extends Service {
}
return new CommandResult(CommandResult.ROOTPA_ERROR_LOCK);
}
-
+
// this is public for the ProvisioningService to call it
protected synchronized CommandResult releaseLock(int uid, boolean closeSession){
Log.d(TAG,"BaseService.releaseLock "+uid+" "+lock_.get()+" "+timer_);
-
+
if(uid==LOCK_FREE){
- return new CommandResult(CommandResult.ROOTPA_ERROR_ILLEGAL_ARGUMENT);
+ return new CommandResult(CommandResult.ROOTPA_ERROR_ILLEGAL_ARGUMENT);
}
if((lock_.get()==LOCK_FREE) || (lock_.compareAndSet(uid, LOCK_FREE)==true)){
@@ -158,7 +158,7 @@ public abstract class BaseService extends Service {
BroadcastReceiver networkChangeReceiver_=null;
protected void setupProxy()
- {
+ {
byte[] proxyAddress=null;
ProxySelector defaultProxySelector = ProxySelector.getDefault();
@@ -169,15 +169,15 @@ public abstract class BaseService extends Service {
if(se_==null){
uri=new URI("https://se.cgbe.trustonic.com"); // the URI here does not matter a lot, as long as one exists. We try to use as real one as is easily possible
}else{
- uri=new URI(new String(se_));
+ uri=new URI(new String(se_));
}
proxyList = defaultProxySelector.select(uri);
if (proxyList.size() > 0)
{
Proxy proxy = proxyList.get(0);
- Log.d(TAG,"BaseService.setupProxy proxy "+proxy); // there should be only one element in the list in the current Android versions, it is for the current connection
+ Log.d(TAG,"BaseService.setupProxy proxy "+proxy); // there should be only one element in the list in the current Android versions, it is for the current connection
if(proxy != Proxy.NO_PROXY){
- Log.d(TAG,"BaseService.setupProxy proxy.type "+proxy.type());
+ Log.d(TAG,"BaseService.setupProxy proxy.type "+proxy.type());
if(proxy.type()==Proxy.Type.HTTP){
// TODO-future there is currently no way for the user to store proxy user name and password in Android,
// so they need to be asked at connection time. There is not any kind of user/password support for proxies in RootPA.
@@ -187,14 +187,14 @@ public abstract class BaseService extends Service {
}
}
}
-
+
}catch(Exception e){
Log.e(TAG,"BaseService.setupProxy FAILURE in getting the proxy: "+e.toString());
}
}
commonPAWrapper().setEnvironmentVariable("http_proxy".getBytes(), proxyAddress);
- commonPAWrapper().setEnvironmentVariable("https_proxy".getBytes(), proxyAddress);
+ commonPAWrapper().setEnvironmentVariable("https_proxy".getBytes(), proxyAddress);
Log.d(TAG,"BaseService.setupProxy just set the proxy to: "+(proxyAddress==null?proxyAddress:new String(proxyAddress)));
// start listening to intents on network changes if not doing it already
@@ -209,7 +209,7 @@ public abstract class BaseService extends Service {
Log.d(TAG,"BaseService: Network "+ni.getTypeName()+" connected");
setupProxy();
}else{
- if(ni!=null){
+ if(ni!=null){
Log.d(TAG, "BaseService: network state "+ni.getState());
}else{
Log.d(TAG, "BaseService: no network info");
@@ -223,14 +223,14 @@ public abstract class BaseService extends Service {
IntentFilter filter=new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE");
registerReceiver(networkChangeReceiver_, filter);
}
- }
-
+ }
+
protected synchronized boolean locked(int uid){
return(lock_.get() != uid && uid != LOCK_FREE);
}
-
+
/**
- This method is called from the C code to send the trustlet binary to the client
+ This method is called from the C code to send the trustlet binary to the client
(trustlet connector/"sp.pa" for develope trustlet) that then can store it where desired.
*/
public void trustletInstallCallback(byte[] trustlet){
@@ -238,29 +238,34 @@ public abstract class BaseService extends Service {
Intent intent=new Intent(RootPAProvisioningIntents.INSTALL_TRUSTLET);
intent.putExtra(RootPAProvisioningIntents.TRUSTLET, trustlet);
sendBroadcast(intent);
- Log.d(TAG,"<<BaseService.trustletInstallCallback");
+ Log.d(TAG,"<<BaseService.trustletInstallCallback");
}
-
+
/**
This method is called from the C code to get the path for files directory
*/
public String getFilesDirPath(){
- return this.getFilesDir().getAbsolutePath();
+ File file = this.getFilesDir();
+ if (null != file){
+ return file.getAbsolutePath();
+ } else {
+ return null;
+ }
}
/**
This method is called from the C code to send the intents while executing doProvisioning
*/
public void provisioningStateCallback(int state, int ret){
- Log.d(TAG,">>provisioningStateCallback "+state+" "+ret);
+ Log.d(TAG,">>provisioningStateCallback "+state+" "+ret);
// since sommunication with SE may take consirderable amount of time, we refresh the Lock timer
- // by calling acquireLock every time a state notification callback is called. This way the lock
+ // by calling acquireLock every time a state notification callback is called. This way the lock
// will not timeout before the communication with SE is complete.
try{
CommandResult res=acquireLock(doProvisioningLockSuid_, false);
if(!res.isOk()){
- Log.e(TAG,"provisioningStateCallback re-acquiring lock failed, res: "+res.result());
+ Log.e(TAG,"provisioningStateCallback re-acquiring lock failed, res: "+res.result());
}
}catch(Exception e){
Log.e(TAG,"provisioningStateCallback re-acquiring lock failed: "+e);
@@ -291,7 +296,7 @@ public abstract class BaseService extends Service {
break;
case C_ERROR:
intent=new Intent(RootPAProvisioningIntents.PROVISIONING_ERROR);
-
+
intent.putExtra(RootPAProvisioningIntents.ERROR, ret);
break;
@@ -299,9 +304,9 @@ public abstract class BaseService extends Service {
try{
CommandResult res=releaseLock(doProvisioningLockSuid_, false);
if(!res.isOk()){
- Log.e(TAG,"provisioningStateCallback releasing lock failed, res: "+res.result());
+ Log.e(TAG,"provisioningStateCallback releasing lock failed, res: "+res.result());
}
- doProvisioningLockSuid_=0;
+ doProvisioningLockSuid_=0;
intent=null; // no intent sent in this case
}catch(Exception e){
Log.e(TAG,"provisioningStateCallback releasing lock failed: "+e);
@@ -310,7 +315,7 @@ public abstract class BaseService extends Service {
unregisterReceiver(networkChangeReceiver_);
networkChangeReceiver_=null;
}
- sendBroadcast(new Intent(RootPAProvisioningIntents.FINISHED_ROOT_PROVISIONING));
+ sendBroadcast(new Intent(RootPAProvisioningIntents.FINISHED_ROOT_PROVISIONING));
break;
default:
Log.e(TAG,"unknown state: "+state);
@@ -327,8 +332,8 @@ public abstract class BaseService extends Service {
public void onConfigurationChanged(android.content.res.Configuration newConfig){
super.onConfigurationChanged(newConfig);
Log.d(TAG,"BaseService.onConfigurationChanged");
- }
-
+ }
+
public void onCreate(){
super.onCreate();
Log.d(TAG,"BaseService.onCreate");
@@ -339,45 +344,45 @@ public abstract class BaseService extends Service {
unregisterReceiver(networkChangeReceiver_);
networkChangeReceiver_=null;
}
- Log.d(TAG,"BaseService.onDestroy");
+ Log.d(TAG,"BaseService.onDestroy");
}
-
+
public void onLowMemory(){
super.onLowMemory();
Log.d(TAG,"BaseService.onLowMemory");
}
-
+
public void onRebind(Intent intent){
super.onRebind(intent);
Log.d(TAG,"BaseService.onRebind");
- }
-
+ }
+
public void onStart(Intent intent, int startId){
super.onStart(intent, startId);
Log.d(TAG,"BaseService.onStart");
- }
+ }
public int onStartCommand(Intent intent, int flags, int startId){
int res=super.onStartCommand(intent, flags, startId);
Log.d(TAG,"BaseService.onStartCommand");
- return res;
- }
-
+ return res;
+ }
+
public void onTaskRemoved(Intent intent){
super.onTaskRemoved(intent);
Log.d(TAG,"BaseService.onTaskRemoved");
- }
-
-
+ }
+
+
public void onTrimMemory(int level){
super.onTrimMemory(level);
Log.d(TAG,"BaseService.onTrimMemory");
}
-
+
public boolean onUnbind(Intent intent){
boolean res=super.onUnbind(intent);
Log.d(TAG,"BaseService.onUnbind");
return res;
- }
-
-} \ No newline at end of file
+ }
+
+}
diff --git a/mobicore/rootpa/Code/Android/app/src/com/gd/mobicore/pa/service/DeveloperService.java b/mobicore/rootpa/Code/Android/app/src/com/gd/mobicore/pa/service/DeveloperService.java
index 718734f..b595469 100644
--- a/mobicore/rootpa/Code/Android/app/src/com/gd/mobicore/pa/service/DeveloperService.java
+++ b/mobicore/rootpa/Code/Android/app/src/com/gd/mobicore/pa/service/DeveloperService.java
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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.
+ */
package com.gd.mobicore.pa.service;
@@ -54,7 +54,7 @@ public class DeveloperService extends BaseService {
private static final int EXTERNAL_MEMORY=2;
private static final int DEFAULT_MEMORY_TYPE=EXTERNAL_MEMORY;
private static final int DEFAULT_NUMBER_OF_INSTANCES=1;
- private static final int DEFAULT_FLAGS=0;
+ private static final int DEFAULT_FLAGS=0;
private static final byte[] DEFAULT_PUKHASH={0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0};
@@ -65,7 +65,7 @@ public class DeveloperService extends BaseService {
// note that these values have to be in line with TltInstallationRequestDataType in rootpa.h
public static final int REQUEST_DATA_TLT=1;
- public static final int REQUEST_DATA_KEY=2;
+ public static final int REQUEST_DATA_KEY=2;
private CommonPAWrapper commonPAWrapper(){
@@ -80,18 +80,18 @@ public class DeveloperService extends BaseService {
Log.d(TAG,"DeveloperService.Stub.uuidOk OK");
return true;
}
-
+
public CommandResult installTrustletOrKey(int spid, byte[] uuid, byte[] trustletBinary, byte[] key, int minTltVersion, byte[] tltPukHash){
- Log.d(TAG,">>DeveloperService.Stub.installTrustletOrKey");
+ Log.d(TAG,">>DeveloperService.Stub.installTrustletOrKey");
if(tltPukHash==null){
tltPukHash=DEFAULT_PUKHASH;
}
-
+
if((trustletBinary == null && key == null) || (trustletBinary != null && key != null) || 0==spid || !uuidOk(uuid) ){
return new CommandResult(CommandResult.ROOTPA_ERROR_ILLEGAL_ARGUMENT);
}
- int tmpSuid=DEVELOPER_UID_FOR_LOCK+new Random().nextInt();
+ int tmpSuid=DEVELOPER_UID_FOR_LOCK+new Random().nextInt();
if(!DeveloperService.this.acquireLock(tmpSuid, false).isOk()){
return new CommandResult(CommandResult.ROOTPA_ERROR_LOCK);
@@ -99,7 +99,7 @@ public class DeveloperService extends BaseService {
doProvisioningLockSuid_=tmpSuid;
int err=0;
byte[] data=null;
- int dataType;
+ int dataType;
try{
if(trustletBinary != null){
data=trustletBinary;
@@ -108,16 +108,16 @@ public class DeveloperService extends BaseService {
data=key;
dataType=REQUEST_DATA_KEY;
}
- setupProxy();
- err=commonPAWrapper().installTrustlet(spid,
- uuid,
- dataType,
- data,
- minTltVersion,
- tltPukHash,
- DEFAULT_MEMORY_TYPE,
- DEFAULT_NUMBER_OF_INSTANCES,
- DEFAULT_FLAGS,
+ setupProxy();
+ err=commonPAWrapper().installTrustlet(spid,
+ uuid,
+ dataType,
+ data,
+ minTltVersion,
+ tltPukHash,
+ DEFAULT_MEMORY_TYPE,
+ DEFAULT_NUMBER_OF_INSTANCES,
+ DEFAULT_FLAGS,
se_);
}catch(Exception e){
Log.e(TAG,"CommonPAWrapper().installTrustletOrKey exception: ", e);
@@ -127,26 +127,26 @@ public class DeveloperService extends BaseService {
Log.d(TAG,"<<DeveloperService.Stub.installTrustletOrKey");
return new CommandResult(err);
}
-
- public CommandResult installTrustlet(int spid,
- byte[] uuid,
- byte[] trustletBinary,
- int minTltVersion,
- byte[] tltPukHash,
- int memoryType,
- int numberOfInstances,
+
+ public CommandResult installTrustlet(int spid,
+ byte[] uuid,
+ byte[] trustletBinary,
+ int minTltVersion,
+ byte[] tltPukHash,
+ int memoryType,
+ int numberOfInstances,
int flags){
- Log.d(TAG,">>DeveloperService.Stub.installTrustlet");
+ Log.d(TAG,">>DeveloperService.Stub.installTrustlet");
if(tltPukHash==null){
tltPukHash=DEFAULT_PUKHASH;
}
-
+
if(trustletBinary == null || 0==spid || !uuidOk(uuid) || memoryType > EXTERNAL_MEMORY){
return new CommandResult(CommandResult.ROOTPA_ERROR_ILLEGAL_ARGUMENT);
}
- int tmpSuid=DEVELOPER_UID_FOR_LOCK+new Random().nextInt();
+ int tmpSuid=DEVELOPER_UID_FOR_LOCK+new Random().nextInt();
if(!DeveloperService.this.acquireLock(tmpSuid, false).isOk()){
return new CommandResult(CommandResult.ROOTPA_ERROR_LOCK);
@@ -154,16 +154,16 @@ public class DeveloperService extends BaseService {
doProvisioningLockSuid_=tmpSuid;
int err=0;
try{
- setupProxy();
- err=commonPAWrapper().installTrustlet(spid,
- uuid,
- REQUEST_DATA_TLT,
- trustletBinary,
- minTltVersion,
+ setupProxy();
+ err=commonPAWrapper().installTrustlet(spid,
+ uuid,
+ REQUEST_DATA_TLT,
+ trustletBinary,
+ minTltVersion,
tltPukHash,
- memoryType,
- numberOfInstances,
- flags,
+ memoryType,
+ numberOfInstances,
+ flags,
se_);
}catch(Exception e){
Log.e(TAG,"CommonPAWrapper().installTrustlet exception: ", e);
@@ -172,9 +172,9 @@ public class DeveloperService extends BaseService {
Log.d(TAG,"<<DeveloperService.Stub.installTrustlet");
return new CommandResult(err);
- }
+ }
}
-
+
@Override
public void onCreate() {
Log.d(TAG,"Hello, DeveloperService onCreate");
@@ -184,14 +184,14 @@ public class DeveloperService extends BaseService {
@Override
public void onLowMemory() {
Log.d(TAG,"DeveloperService onLowMemory");
- super.onLowMemory();
+ super.onLowMemory();
}
public void onDestroy(){
super.onDestroy();
Log.d(TAG,"DeveloperService being destroyed");
}
-
+
@Override
public IBinder onBind(Intent intent){
try{
@@ -200,7 +200,7 @@ public class DeveloperService extends BaseService {
Log.i(TAG,"DeveloperService something wrong in the given ip "+e );
}
- try{
+ try{
Log.setLoggingLevel(intent.getIntExtra("LOG",0));
}catch(Exception e){
Log.i(TAG,"DeveloperService something wrong in the given logging level "+e );
@@ -214,8 +214,8 @@ public class DeveloperService extends BaseService {
@Override
public int onStartCommand(Intent i, int flags, int startid){
Log.d(TAG,"DeveloperService starting");
- return START_STICKY;
- }
+ return START_STICKY;
+ }
}
diff --git a/mobicore/rootpa/Code/Android/app/src/com/gd/mobicore/pa/service/Log.java b/mobicore/rootpa/Code/Android/app/src/com/gd/mobicore/pa/service/Log.java
index 688fefe..2697d32 100644
--- a/mobicore/rootpa/Code/Android/app/src/com/gd/mobicore/pa/service/Log.java
+++ b/mobicore/rootpa/Code/Android/app/src/com/gd/mobicore/pa/service/Log.java
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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.
+ */
package com.gd.mobicore.pa.service;
@@ -36,8 +36,8 @@ import java.lang.Throwable;
public class Log {
- private static int level_=android.util.Log.INFO;
-
+ private static int level_=android.util.Log.INFO;
+
/**
Set level of logging
*/
@@ -51,45 +51,45 @@ public class Log {
level_=level;
}
}
-
+
/**
Send a DEBUG log message.
*/
public static int d(String tag, String msg){
if(level_<=android.util.Log.DEBUG) return android.util.Log.d(tag, msg);
return 0;
- }
+ }
/**
Send a DEBUG log message and log the exception.
*/
public static int d(String tag, String msg, Throwable tr){
if(level_<=android.util.Log.DEBUG) return android.util.Log.d(tag, msg, tr);
- return 0;
- }
+ return 0;
+ }
/**
Send an ERROR log message.
*/
public static int e(String tag, String msg){
if(level_<=android.util.Log.ERROR) return android.util.Log.e(tag, msg);
- return 0;
+ return 0;
}
/**
Send a ERROR log message and log the exception.
- */
+ */
public static int e(String tag, String msg, Throwable tr){
if(level_<=android.util.Log.ERROR) return android.util.Log.e(tag, msg, tr);
- return 0;
+ return 0;
}
/**
- Send an INFO log message.
- */
+ Send an INFO log message.
+ */
public static int i(String tag, String msg){
if(level_<=android.util.Log.INFO) return android.util.Log.i(tag, msg);
- return 0;
+ return 0;
}
/**
@@ -97,7 +97,7 @@ public class Log {
*/
public static int i(String tag, String msg, Throwable tr){
if(level_<=android.util.Log.INFO) return android.util.Log.i(tag, msg, tr);
- return 0;
+ return 0;
}
/**
@@ -106,7 +106,7 @@ public class Log {
public static String getStackTraceString(Throwable tr){
return android.util.Log.getStackTraceString(tr);
}
-
+
/**
Checks to see whether or not a log for the specified tag is loggable at the specified level.
*/
@@ -114,7 +114,7 @@ public class Log {
return android.util.Log.isLoggable(tag, level);
}
- /**
+ /**
Low-level logging call.
*/
public static int println(int priority, String tag, String msg){
@@ -126,7 +126,7 @@ public class Log {
*/
public static int v(String tag, String msg){
if(level_<=android.util.Log.VERBOSE) return android.util.Log.v(tag, msg);
- return 0;
+ return 0;
}
/**
@@ -134,7 +134,7 @@ public class Log {
*/
public static int v(String tag, String msg, Throwable tr){
if(level_<=android.util.Log.VERBOSE) return android.util.Log.v(tag, msg, tr);
- return 0;
+ return 0;
}
/**
@@ -143,7 +143,7 @@ public class Log {
public static int w(String tag, Throwable tr){
if(level_>=android.util.Log.WARN) return android.util.Log.w(tag, tr);
- return 0;
+ return 0;
}
/**
@@ -151,7 +151,7 @@ public class Log {
*/
public static int w(String tag, String msg, Throwable tr){
if(level_<=android.util.Log.WARN) return android.util.Log.w(tag, msg, tr);
- return 0;
+ return 0;
}
/**
@@ -159,7 +159,7 @@ public class Log {
*/
public static int w(String tag, String msg){
if(level_<=android.util.Log.WARN) return android.util.Log.w(tag, msg);
- return 0;
+ return 0;
}
/**
diff --git a/mobicore/rootpa/Code/Android/app/src/com/gd/mobicore/pa/service/OemService.java b/mobicore/rootpa/Code/Android/app/src/com/gd/mobicore/pa/service/OemService.java
index 70ec091..730e85b 100644
--- a/mobicore/rootpa/Code/Android/app/src/com/gd/mobicore/pa/service/OemService.java
+++ b/mobicore/rootpa/Code/Android/app/src/com/gd/mobicore/pa/service/OemService.java
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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.
+ */
package com.gd.mobicore.pa.service;
@@ -52,7 +52,7 @@ public class OemService extends BaseService {
private final RootPAOemIfc.Stub mBinder = new ServiceIfc();
private static final int OEM_UID_FOR_LOCK=0x33330000;
-
+
private class ServiceIfc extends RootPAOemIfc.Stub {
public ServiceIfc(){
super();
@@ -61,19 +61,19 @@ public class OemService extends BaseService {
private CommonPAWrapper commonPAWrapper(){
return OemService.this.commonPAWrapper();
}
-
+
public CommandResult unregisterRootContainer(){
- Log.d(TAG,">>RootPAServiceIfc.Stub.unregisterRootContainer");
+ Log.d(TAG,">>RootPAServiceIfc.Stub.unregisterRootContainer");
int tmpSuid=OEM_UID_FOR_LOCK+new Random().nextInt(); // this may override the uid used in lock, which means it will not be
-
+
if(!OemService.this.acquireLock(tmpSuid, false).isOk()){
return new CommandResult(CommandResult.ROOTPA_ERROR_LOCK);
}
doProvisioningLockSuid_=tmpSuid;
Log.d(TAG,"RootPAServiceIfc.Stub.unregisterRootContainer calling JNI");
-
+
int ret=CommandResult.ROOTPA_OK;
try{
@@ -83,21 +83,21 @@ public class OemService extends BaseService {
Log.e(TAG,"CommonPAWrapper().unregisterRootContainer exception: ", e);
ret=CommandResult.ROOTPA_ERROR_INTERNAL;
}
-
+
CommandResult res=OemService.this.releaseLock(doProvisioningLockSuid_, false);
if(!res.isOk()){
Log.e(TAG,"releasing lock failed, res: "+res.result());
// this return code is not returned to the client since
// the command may have succeeded and there is just something wrong with the lock
// we leave it the the next command if the problem remains
- }
-
- Log.d(TAG,"<<RootPAServiceIfc.Stub.unregisterRootContainer");
+ }
+
+ Log.d(TAG,"<<RootPAServiceIfc.Stub.unregisterRootContainer");
return new CommandResult(ret);
}
-
+
}
-
+
@Override
public void onCreate() {
Log.d(TAG,"Hello, OemService onCreate");
@@ -107,14 +107,14 @@ public class OemService extends BaseService {
@Override
public void onLowMemory() {
Log.d(TAG,"OemService onLowMemory");
- super.onLowMemory();
+ super.onLowMemory();
}
public void onDestroy(){
- super.onDestroy();
+ super.onDestroy();
Log.d(TAG,"OemService being destroyed");
}
-
+
@Override
public IBinder onBind(Intent intent){
try{
@@ -123,7 +123,7 @@ public class OemService extends BaseService {
Log.i(TAG,"OemService something wrong in the given ip "+e );
}
- try{
+ try{
Log.setLoggingLevel(intent.getIntExtra("LOG",0));
}catch(Exception e){
Log.i(TAG,"OemService something wrong in the given logging level "+e );
@@ -136,8 +136,8 @@ public class OemService extends BaseService {
@Override
public int onStartCommand(Intent i, int flags, int startid){
Log.d(TAG,"OemService starting");
- return START_STICKY;
- }
+ return START_STICKY;
+ }
}
diff --git a/mobicore/rootpa/Code/Android/app/src/com/gd/mobicore/pa/service/ProvisioningService.java b/mobicore/rootpa/Code/Android/app/src/com/gd/mobicore/pa/service/ProvisioningService.java
index 0fa9cca..6a9dd28 100644
--- a/mobicore/rootpa/Code/Android/app/src/com/gd/mobicore/pa/service/ProvisioningService.java
+++ b/mobicore/rootpa/Code/Android/app/src/com/gd/mobicore/pa/service/ProvisioningService.java
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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.
+ */
package com.gd.mobicore.pa.service;
@@ -65,32 +65,32 @@ public class ProvisioningService extends BaseService {
private static final int PROVISIONING_UID_FOR_LOCK=0x11110000;
private static final int LONG_SIZE=8;
- private final RootPAServiceIfc.Stub mBinder = new ServiceIfc();
-
- // using this instead of anonymous inner class in order to allow call to some of the private methods we define here
+ private final RootPAServiceIfc.Stub mBinder = new ServiceIfc();
+
+ // using this instead of anonymous inner class in order to allow call to some of the private methods we define here
private class ServiceIfc extends RootPAServiceIfc.Stub {
public ServiceIfc(){
super();
}
-
+
private CommonPAWrapper commonPAWrapper(){
return ProvisioningService.this.commonPAWrapper();
}
-
+
public CommandResult executeCmpCommands(int uid, List<CmpCommand> commands, List<CmpResponse> responses){
- Log.d(TAG,">>RootPAServiceIfc.Stub.executeCmpCommands "+commands+" "+responses);
+ Log.d(TAG,">>RootPAServiceIfc.Stub.executeCmpCommands "+commands+" "+responses);
if(commands==null||responses==null){ // having null out variable leads to null pointer exception in the client, however we still want to do checking so that there is not unncessary execution of the following code
- Log.d(TAG,"RootPAServiceIfc.Stub.executeCmpCommands, illegal argument");
+ Log.d(TAG,"RootPAServiceIfc.Stub.executeCmpCommands, illegal argument");
return new CommandResult(CommandResult.ROOTPA_ERROR_ILLEGAL_ARGUMENT);
- }
-
+ }
+
if(locked(uid)){
return new CommandResult(CommandResult.ROOTPA_ERROR_LOCK);
}
-
+
int ret=CommandResult.ROOTPA_OK;
try{
ret=commonPAWrapper().executeCmpCommands(uid, commands, responses);
@@ -102,17 +102,17 @@ public class ProvisioningService extends BaseService {
Log.d(TAG,"<<RootPAServiceIfc.Stub.executeCmpCommands");
return new CommandResult(ret);
}
-
+
public CommandResult isRootContainerRegistered(BooleanResult result){
- Log.d(TAG,">>RootPAServiceIfc.Stub.isRootContainerRegistered");
+ Log.d(TAG,">>RootPAServiceIfc.Stub.isRootContainerRegistered");
if(result==null){ // having null out variable leads to null pointer exception in the client, however we stll want to do checking so that there is not unncessary execution of the following code
Log.d(TAG,"RootPAServiceIfc.Stub.isRootContainerRegistered result null");
return new CommandResult(CommandResult.ROOTPA_ERROR_ILLEGAL_ARGUMENT);
- }
-
+ }
+
int internalUidForLock=new Random().nextInt();
-
+
if(!ProvisioningService.this.acquireLock(internalUidForLock, false).isOk())
{
return new CommandResult(CommandResult.ROOTPA_ERROR_LOCK);
@@ -126,7 +126,7 @@ public class ProvisioningService extends BaseService {
Log.e(TAG,"CommonPAWrapper().isRootContainerRegistered exception: ", e);
ret=CommandResult.ROOTPA_ERROR_INTERNAL;
}
- result.setResult(isRegistered[0]);
+ result.setResult(isRegistered[0]);
CommandResult res=ProvisioningService.this.releaseLock(internalUidForLock, false);
if(!res.isOk()){
@@ -134,14 +134,14 @@ public class ProvisioningService extends BaseService {
// this return code is not returned to the client since
// the command may have succeeded and there is just something wrong with the lock
// we leave it the the next command if the problem remains
- }
+ }
- Log.d(TAG,"<<RootPAServiceIfc.Stub.isRootContainerRegistered");
+ Log.d(TAG,"<<RootPAServiceIfc.Stub.isRootContainerRegistered");
return new CommandResult(ret);
}
public CommandResult isSPContainerRegistered(SPID spid, BooleanResult result){
- Log.d(TAG,">>RootPAServiceIfc.Stub.isSPContainerRegistered");
+ Log.d(TAG,">>RootPAServiceIfc.Stub.isSPContainerRegistered");
if(spid==null || result==null){ // having null out variable leads to null pointer exception in the client, however we still want to do checking so that there is not unncessary execution of the following code
Log.d(TAG,"RootPAServiceIfc.Stub.isSPContainerRegistered spid "+spid+" result "+result);
@@ -171,15 +171,15 @@ public class ProvisioningService extends BaseService {
// this return code is not returned to the client since
// the command may have succeeded and there is just something wrong with the lock
// we leave it the the next command if the problem remains
- }
+ }
- Log.d(TAG,"<<RootPAServiceIfc.Stub.isSPContainerRegistered ");
+ Log.d(TAG,"<<RootPAServiceIfc.Stub.isSPContainerRegistered ");
return new CommandResult(ret);
}
public CommandResult getVersion(Version version){
- Log.d(TAG,">>RootPAServiceIfc.Stub.getVersion");
+ Log.d(TAG,">>RootPAServiceIfc.Stub.getVersion");
int internalUidForLock=new Random().nextInt();
if(!ProvisioningService.this.acquireLock(internalUidForLock, false).isOk())
@@ -196,7 +196,7 @@ public class ProvisioningService extends BaseService {
try{
ret=commonPAWrapper().getVersion(productId, keys, values);
if(ret == CommandResult.ROOTPA_OK && (keys.size() != values.size())){
- ret=CommandResult.ROOTPA_ERROR_INTERNAL;
+ ret=CommandResult.ROOTPA_ERROR_INTERNAL;
}
}catch(Exception e){
Log.e(TAG,"CommonPAWrapper().getVersion exception: ", e);
@@ -219,15 +219,15 @@ public class ProvisioningService extends BaseService {
// this return code is not returned to the client since
// the command may have succeeded and there is just something wrong with the lock
// we leave it the the next command if the problem remains
- }
+ }
- Log.d(TAG,"<<RootPAServiceIfc.Stub.getVersion "+ret);
+ Log.d(TAG,"<<RootPAServiceIfc.Stub.getVersion "+ret);
return new CommandResult(ret);
}
public CommandResult getDeviceId(SUID suid){
- Log.d(TAG,">>RootPAServiceIfc.Stub.getDeviceId");
+ Log.d(TAG,">>RootPAServiceIfc.Stub.getDeviceId");
int internalUidForLock=new Random().nextInt();
if(!ProvisioningService.this.acquireLock(internalUidForLock, false).isOk())
@@ -251,40 +251,40 @@ public class ProvisioningService extends BaseService {
// this return code is not returned to the client since
// the command may have succeeded and there is just something wrong with the lock
// we leave it the the next command if the problem remains
- }
+ }
- Log.d(TAG,"<<RootPAServiceIfc.Stub.getDeviceId");
+ Log.d(TAG,"<<RootPAServiceIfc.Stub.getDeviceId");
return new CommandResult(ret);
}
public CommandResult acquireLock(int uid){
return ProvisioningService.this.acquireLock(uid, true);
}
-
+
public CommandResult releaseLock(int uid){
return ProvisioningService.this.releaseLock(uid, true);
}
-
+
public CommandResult doProvisioning(int uid, SPID spid){
- Log.d(TAG,">>RootPAServiceIfc.Stub.doProvisioning");
+ Log.d(TAG,">>RootPAServiceIfc.Stub.doProvisioning");
int ret=CommandResult.ROOTPA_OK;
if(spid==null){ // having null out variable leads to null pointer exception in the client, however we still want to do checking so that there is not unncessary execution of the following code
Log.d(TAG,"RootPAServiceIfc.Stub.doProvisioning spid==null");
return new CommandResult(CommandResult.ROOTPA_ERROR_ILLEGAL_ARGUMENT);
- }
-
- // we do not use uid here since we do not want to let the client to released the lock, it is done
- // internally at CommonPAWrapper.java when sending Intents.
-
+ }
+
+ // we do not use uid here since we do not want to let the client to released the lock, it is done
+ // internally at CommonPAWrapper.java when sending Intents.
+
int tmpSuid=uid+PROVISIONING_UID_FOR_LOCK+new Random().nextInt();
if(!ProvisioningService.this.acquireLock(tmpSuid, false).isOk()){
return new CommandResult(CommandResult.ROOTPA_ERROR_LOCK);
}
doProvisioningLockSuid_=tmpSuid;
-
+
try{
setupProxy();
ret=commonPAWrapper().doProvisioning(uid, spid.spid(), se_);
@@ -292,12 +292,12 @@ public class ProvisioningService extends BaseService {
Log.d(TAG,"CommonPAWrapper()).doProvisioning failed "+e);
ret=CommandResult.ROOTPA_ERROR_INTERNAL;
}
-
- Log.d(TAG,"CommonPAWrapper()).doProvisioning returned "+ret);
+
+ Log.d(TAG,"CommonPAWrapper()).doProvisioning returned "+ret);
if(ret!=CommandResult.ROOTPA_OK){
if(!ProvisioningService.this.releaseLock(doProvisioningLockSuid_, false).isOk()){
Log.e(TAG,"releasing lock failed after doProvisioning returned an error");
- }
+ }
doProvisioningLockSuid_=0;
}
@@ -306,26 +306,26 @@ public class ProvisioningService extends BaseService {
}
public CommandResult getSPContainerStructure(SPID spid, SPContainerStructure cs){
- Log.d(TAG,">>RootPAServiceIfc.Stub.getSPContainerStructure");
+ Log.d(TAG,">>RootPAServiceIfc.Stub.getSPContainerStructure");
if(spid==null||cs==null){ // having null out variable leads to null pointer exception in the client, however we still want to do checking so that there is not unncessary execution of the following code
return new CommandResult(CommandResult.ROOTPA_ERROR_ILLEGAL_ARGUMENT);
- }
-
+ }
+
int internalUidForLock=new Random().nextInt();
if(!ProvisioningService.this.acquireLock(internalUidForLock, false).isOk())
{
return new CommandResult(CommandResult.ROOTPA_ERROR_LOCK);
}
-
+
int ret=CommandResult.ROOTPA_OK;
final int CONTAINER_STATE_IDX=0;
- final int NUMBER_OF_TLTS_IDX=1;
+ final int NUMBER_OF_TLTS_IDX=1;
final int NUMBER_OF_ELEMENTS=2;
final int MAX_NUMBER_OF_TRUSTLETS=16;
final int UUID_LENGTH=16;
-
+
int[] ints = new int[NUMBER_OF_ELEMENTS];
int[] trustletStates = new int[MAX_NUMBER_OF_TRUSTLETS];
byte[][] uuidArray = new byte[MAX_NUMBER_OF_TRUSTLETS][];
@@ -338,15 +338,15 @@ public class ProvisioningService extends BaseService {
}
if(ret==CommandResult.ROOTPA_OK){
-
+
SPContainerState s=mapSpContainerState(ints[CONTAINER_STATE_IDX]);
cs.setState(s);
if (s == SPContainerState.UNDEFINED){
- ret=CommandResult.ROOTPA_ERROR_INTERNAL;
+ ret=CommandResult.ROOTPA_ERROR_INTERNAL;
}
-
+
for(int i=0; i<ints[NUMBER_OF_TLTS_IDX]; i++){
- byte[] msBytes=new byte[LONG_SIZE];
+ byte[] msBytes=new byte[LONG_SIZE];
System.arraycopy(uuidArray[i], 0, msBytes, 0, LONG_SIZE);
BigInteger mostSignificant=new BigInteger(msBytes);
@@ -355,16 +355,16 @@ public class ProvisioningService extends BaseService {
BigInteger leastSignificant=new BigInteger(lsBytes);
Log.d(TAG,"UUID: ls ms"+leastSignificant+" "+mostSignificant);
-
+
TrustletContainerState ts=mapTltContainerState(trustletStates[i]);
if (ts == TrustletContainerState.UNDEFINED){
- ret=CommandResult.ROOTPA_ERROR_INTERNAL;
+ ret=CommandResult.ROOTPA_ERROR_INTERNAL;
}
cs.add(new TrustletContainer(new UUID(mostSignificant.longValue(), leastSignificant.longValue()), ts));
}
-
+
}else if (ret==CommandResult.ROOTPA_ERROR_INTERNAL_NO_CONTAINER){
- cs.setState(SPContainerState.DOES_NOT_EXIST);
+ cs.setState(SPContainerState.DOES_NOT_EXIST);
ret=CommandResult.ROOTPA_OK;
}
@@ -374,16 +374,16 @@ public class ProvisioningService extends BaseService {
// this return code is not returned to the client since
// the command may have succeeded and there is just something wrong with the lock
// we leave it the the next command if the problem remains
- }
+ }
- Log.d(TAG,"<<RootPAServiceIfc.Stub.getSPContainerStructure");
- return new CommandResult(ret);
+ Log.d(TAG,"<<RootPAServiceIfc.Stub.getSPContainerStructure");
+ return new CommandResult(ret);
}
-
+
public CommandResult getSPContainerState(SPID spid, SPContainerStateParcel state){
- Log.d(TAG,">>RootPAServiceIfc.Stub.getSPContainerState");
+ Log.d(TAG,">>RootPAServiceIfc.Stub.getSPContainerState");
if(spid==null||state==null){ // having null out variable leads to null pointer exception in the client, however we still want to do checking so that there is not unncessary execution of the following code
return new CommandResult(CommandResult.ROOTPA_ERROR_ILLEGAL_ARGUMENT);
@@ -405,14 +405,14 @@ public class ProvisioningService extends BaseService {
ret=CommandResult.ROOTPA_ERROR_INTERNAL;
}
- Log.d(TAG,"RootPAServiceIfc.Stub.getSPContainerState received " + containerState[0] + " "+ ret);
-
+ Log.d(TAG,"RootPAServiceIfc.Stub.getSPContainerState received " + containerState[0] + " "+ ret);
+
if(ret==CommandResult.ROOTPA_OK){
-
+
SPContainerState s=mapSpContainerState(containerState[0]);
state.setEnumeratedValue(s);
if (s == SPContainerState.UNDEFINED){
- ret=CommandResult.ROOTPA_ERROR_INTERNAL;
+ ret=CommandResult.ROOTPA_ERROR_INTERNAL;
}
}else if (ret==CommandResult.ROOTPA_ERROR_INTERNAL_NO_CONTAINER){
state.setEnumeratedValue(SPContainerState.DOES_NOT_EXIST);
@@ -425,10 +425,10 @@ public class ProvisioningService extends BaseService {
// this return code is not returned to the client since
// the command may have succeeded and there is just something wrong with the lock
// we leave it the the next command if the problem remains
- }
+ }
- Log.d(TAG,"<<RootPAServiceIfc.Stub.getSPContainerState");
+ Log.d(TAG,"<<RootPAServiceIfc.Stub.getSPContainerState");
return new CommandResult(ret);
}
@@ -437,7 +437,7 @@ public class ProvisioningService extends BaseService {
if(spid==null||uuid==null||taBinary==null|| taBinary.length == 0 || spid.spid()==0){ // having null out variable leads to null pointer exception in the client, however we still want to do checking so that there is not unncessary execution of the following code
return new CommandResult(CommandResult.ROOTPA_ERROR_ILLEGAL_ARGUMENT);
}
-
+
int ret=CommandResult.ROOTPA_OK;
try{
ret=commonPAWrapper().storeTA(spid.spid(), uuid, taBinary);
@@ -445,10 +445,10 @@ public class ProvisioningService extends BaseService {
Log.e(TAG,"CommonPAWrapper().storeTA exception: ", e);
ret=CommandResult.ROOTPA_ERROR_INTERNAL;
}
-
+
Log.d(TAG,"<<RootPAServiceIfc.Stub.storeTA");
- return new CommandResult(ret);
- }
+ return new CommandResult(ret);
+ }
private final static int MC_CONT_STATE_UNREGISTERED=0;
private final static int MC_CONT_STATE_REGISTERED=1;
@@ -473,7 +473,7 @@ public class ProvisioningService extends BaseService {
Log.e(TAG,"mapTltContainerState returning undefined: "+ containerState);
state=TrustletContainerState.UNDEFINED;
break;
- }
+ }
return state;
}
@@ -520,10 +520,10 @@ public class ProvisioningService extends BaseService {
}
public void onDestroy(){
- super.onDestroy();
+ super.onDestroy();
Log.d(TAG,"ProvisioningService being destroyed");
}
-
+
@Override
public IBinder onBind(Intent intent){
try{
@@ -532,7 +532,7 @@ public class ProvisioningService extends BaseService {
Log.i(TAG,"ProvisioningService something wrong in the given ip "+e );
}
- try{
+ try{
Log.setLoggingLevel(intent.getIntExtra("LOG",0));
}catch(Exception e){
Log.i(TAG,"ProvisioningService something wrong in the given logging level "+e );
@@ -545,6 +545,6 @@ public class ProvisioningService extends BaseService {
@Override
public int onStartCommand(Intent i, int flags, int startid){
Log.d(TAG,"ProvisioningService starting");
- return START_STICKY;
+ return START_STICKY;
}
}
diff --git a/mobicore/rootpa/Code/Android/lib/Android.mk b/mobicore/rootpa/Code/Android/lib/Android.mk
index fb893e9..ffdc0f0 100644
--- a/mobicore/rootpa/Code/Android/lib/Android.mk
+++ b/mobicore/rootpa/Code/Android/lib/Android.mk
@@ -14,6 +14,7 @@ LOCAL_SRC_FILES += src/com/gd/mobicore/pa/ifc/RootPAServiceIfc.aidl \
LOCAL_MODULE := rootpa_interface
LOCAL_MODULE_TAGS := debug eng optional
+APP_PIE := true
LOCAL_32_BIT_ONLY := true
include $(BUILD_STATIC_JAVA_LIBRARY) \ No newline at end of file
diff --git a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/AbstractEnumParcel.java b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/AbstractEnumParcel.java
index 33cfa5b..5641cc1 100644
--- a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/AbstractEnumParcel.java
+++ b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/AbstractEnumParcel.java
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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.
+ */
package com.gd.mobicore.pa.ifc;
diff --git a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/BooleanResult.aidl b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/BooleanResult.aidl
index 9238689..381b6b4 100644
--- a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/BooleanResult.aidl
+++ b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/BooleanResult.aidl
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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.
+ */
package com.gd.mobicore.pa.ifc;
diff --git a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/BooleanResult.java b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/BooleanResult.java
index d1b9c65..f2db83f 100644
--- a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/BooleanResult.java
+++ b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/BooleanResult.java
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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.
+ */
package com.gd.mobicore.pa.ifc;
diff --git a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/CmpCommand.aidl b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/CmpCommand.aidl
index 08f5ce3..72cd33f 100644
--- a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/CmpCommand.aidl
+++ b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/CmpCommand.aidl
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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.
+ */
package com.gd.mobicore.pa.ifc;
diff --git a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/CmpCommand.java b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/CmpCommand.java
index e01f4b7..13de3cd 100644
--- a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/CmpCommand.java
+++ b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/CmpCommand.java
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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.
+ */
package com.gd.mobicore.pa.ifc;
@@ -36,16 +36,16 @@ import android.os.Parcelable;
/**
Class that contains content management protocol command. The class inherits is parcelable.
- @see CmpMsg
- @see CmpResponse
+ @see CmpMsg
+ @see CmpResponse
*/
public class CmpCommand extends CmpMsg{
public static final int COMMAND_LENGTH_IDX=4;
private static final int COMMAND_RESERVED_IDX=8;
/**
- This is not directly tied to the content of the command but to execution of
- multiple commands. If ignoreError is set, the execution continues even if
+ This is not directly tied to the content of the command but to execution of
+ multiple commands. If ignoreError is set, the execution continues even if
this command returns an error. By default ignoreError is false.
@return boolean value telling whether the error should be ignored
*/
@@ -54,8 +54,8 @@ public class CmpCommand extends CmpMsg{
}
/**
- This is not directly tied to the content of the command but to execution of
- multiple commands. If ignoreError is set, the execution continues even if
+ This is not directly tied to the content of the command but to execution of
+ multiple commands. If ignoreError is set, the execution continues even if
this command returns an error. By default ignoreError is false.
@param ignore boolean value telling whether the error should be ignored
*/
@@ -81,7 +81,7 @@ public class CmpCommand extends CmpMsg{
public void setLength(int length)
{
// MC_CMP_CMD_GET_VERSION, MC_CMP_CMD_GENERATE_AUTH_TOKEN and MC_CMP_CMD_GET_SUID do not have length field for legacy reasons
- if(msgId()!=MC_CMP_CMD_GET_VERSION
+ if(msgId()!=MC_CMP_CMD_GET_VERSION
&& msgId()!=MC_CMP_CMD_GENERATE_AUTH_TOKEN
&& msgId()!=MC_CMP_CMD_GET_SUID
&& length > 4) // not setting length for messages that only have id
@@ -92,7 +92,7 @@ public class CmpCommand extends CmpMsg{
/**
Constructor
- @param commandId see possible values from CmpMsg
+ @param commandId see possible values from CmpMsg
*/
public CmpCommand(int commandId){
super();
@@ -109,19 +109,19 @@ public class CmpCommand extends CmpMsg{
public CmpCommand(Parcel in){
super(in);
}
-
+
public static final Parcelable.Creator<CmpCommand> CREATOR = new Parcelable.Creator<CmpCommand>(){
public CmpCommand createFromParcel(Parcel in){
return new CmpCommand(in);
}
-
+
public CmpCommand[] newArray(int size){
return null;
}
};
- @Override
+ @Override
public void writeToParcel(Parcel out, int flags){
out.writeByte((byte)((ignoreError_==true)?1:0));
super.writeToParcel(out, flags);
@@ -131,5 +131,5 @@ public class CmpCommand extends CmpMsg{
ignoreError_=(in.readByte()==1);
super.readFromParcel(in);
}
-
+
}
diff --git a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/CmpMsg.java b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/CmpMsg.java
index 1aa61f2..d3467e5 100644
--- a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/CmpMsg.java
+++ b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/CmpMsg.java
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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.
+ */
package com.gd.mobicore.pa.ifc;
import android.os.Parcel;
@@ -36,18 +36,18 @@ import android.os.Parcelable;
/**
Base class for content management protocol commands and responses
@see CmpCommand
- @see CmpResponse
+ @see CmpResponse
*/
public abstract class CmpMsg implements Parcelable{
-// CMP message ID's
+// CMP message ID's
public static final int MC_CMP_CMD_AUTHENTICATE=0;
public static final int MC_CMP_CMD_BEGIN_ROOT_AUTHENTICATION=1;
public static final int MC_CMP_CMD_BEGIN_SOC_AUTHENTICATION=2;
public static final int MC_CMP_CMD_BEGIN_SP_AUTHENTICATION=3;
public static final int MC_CMP_CMD_GENERATE_AUTH_TOKEN=4;
public static final int MC_CMP_CMD_GET_VERSION=5;
-
+
public static final int MC_CMP_CMD_ROOT_CONT_LOCK_BY_ROOT=7;
public static final int MC_CMP_CMD_ROOT_CONT_REGISTER_ACTIVATE=9;
@@ -73,7 +73,7 @@ public abstract class CmpMsg implements Parcelable{
// indices and masks
public static final int MSG_ID_IDX=0;
- public static final int INT_LENGTH=4;
+ public static final int INT_LENGTH=4;
public static final int RSP_ID_MASK=(1 << 31);
/**
@@ -137,12 +137,12 @@ public abstract class CmpMsg implements Parcelable{
return content_;
}
-
+
protected int msgId()
{
return getInt(MSG_ID_IDX);
}
-
+
protected void setMsgId(int id)
{
setInt(MSG_ID_IDX, id);
@@ -153,10 +153,10 @@ public abstract class CmpMsg implements Parcelable{
private void createEmptyContentIfNeeded(int index, int size){
if(content_==null){
- content_=new byte[size];
+ content_=new byte[size];
setLength(content_.length); // we keep the length field automatically up to date
}else if(content_.length<(index+size)){
- byte[] newarray=new byte[index+size];
+ byte[] newarray=new byte[index+size];
System.arraycopy(content_, 0, newarray, 0, content_.length);
content_=newarray;
setLength(content_.length); // we keep the length field automatically up to date
@@ -172,9 +172,9 @@ public abstract class CmpMsg implements Parcelable{
{
createEmptyContentIfNeeded(index, INT_LENGTH);
content_[index+0]=(byte) (value & 0xFF);
- content_[index+1]=(byte)((value >> 8) & 0xFF);
- content_[index+2]=(byte) ((value >> 16) & 0xFF);
- content_[index+3]=(byte) ((value >> 24) & 0xFF);
+ content_[index+1]=(byte)((value >> 8) & 0xFF);
+ content_[index+2]=(byte) ((value >> 16) & 0xFF);
+ content_[index+3]=(byte) ((value >> 24) & 0xFF);
}
@@ -200,9 +200,9 @@ public abstract class CmpMsg implements Parcelable{
*/
public int getInt(int index) throws ArrayIndexOutOfBoundsException
{
- return (content_[index] & 0xFF) +
- ((content_[index+1] & 0xFF) << 8) +
- ((content_[index+2] & 0xFF) << 16) +
+ return (content_[index] & 0xFF) +
+ ((content_[index+1] & 0xFF) << 8) +
+ ((content_[index+2] & 0xFF) << 16) +
((content_[index+3] & 0xFF) << 24);
}
@@ -215,9 +215,9 @@ public abstract class CmpMsg implements Parcelable{
*/
public byte[] getByteArray(int index, int length) throws ArrayIndexOutOfBoundsException
{
- byte[] newarray=new byte[length];
+ byte[] newarray=new byte[length];
System.arraycopy(content_, index, newarray, 0, length);
- return newarray;
+ return newarray;
}
@@ -236,10 +236,10 @@ public abstract class CmpMsg implements Parcelable{
// data ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
private byte[] content_;
- boolean ignoreError_=false; // this is moved from CmpCommand since
- // for some reason it is always false
- // if CmpCommand.ignoreError() called
- // with JNI CallBooleanMethod but if
+ boolean ignoreError_=false; // this is moved from CmpCommand since
+ // for some reason it is always false
+ // if CmpCommand.ignoreError() called
+ // with JNI CallBooleanMethod but if
// this is here it works
// stuff related to parcelable ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@@ -252,11 +252,11 @@ public abstract class CmpMsg implements Parcelable{
}
@Override
- public int describeContents() {
- return 0;
- }
+ public int describeContents() {
+ return 0;
+ }
- @Override
+ @Override
public void writeToParcel(Parcel out, int flags){
out.writeByteArray(content_);
}
diff --git a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/CmpResponse.aidl b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/CmpResponse.aidl
index b889e3d..eda484c 100644
--- a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/CmpResponse.aidl
+++ b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/CmpResponse.aidl
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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.
+ */
package com.gd.mobicore.pa.ifc;
parcelable CmpResponse;
diff --git a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/CmpResponse.java b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/CmpResponse.java
index 5f9bb95..aa5d9f5 100644
--- a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/CmpResponse.java
+++ b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/CmpResponse.java
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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.
+ */
package com.gd.mobicore.pa.ifc;
import android.os.Parcel;
@@ -35,8 +35,8 @@ import android.os.Parcelable;
/**
Class that contains content management protocol response. The class inherits parcelable.
- @see CmpMsg
- @see CmpCommand
+ @see CmpMsg
+ @see CmpCommand
*/
public class CmpResponse extends CmpMsg{
private static final int RETURN_CODE_IDX=4;
@@ -49,7 +49,7 @@ public class CmpResponse extends CmpMsg{
public int responseId(){
return msgId();
}
-
+
/**
@param id respose id of the message
*/
@@ -59,14 +59,14 @@ public class CmpResponse extends CmpMsg{
/**
@return returnCode
- */
+ */
public int returnCode(){
return getInt(RETURN_CODE_IDX);
}
-
+
/**
@param ret return code for the message
- */
+ */
public void setReturnCode(int ret){
setInt(RETURN_CODE_IDX, ret);
}
@@ -74,7 +74,7 @@ public class CmpResponse extends CmpMsg{
public void setLength(int length)
{
// MC_CMP_CMD_GET_VERSION and MC_CMP_CMD_GET_SUID do not have length field for legacy reasons
- if(responseId()!=responseIdToCommandId(MC_CMP_CMD_GET_VERSION)
+ if(responseId()!=responseIdToCommandId(MC_CMP_CMD_GET_VERSION)
&& responseId()!=responseIdToCommandId(MC_CMP_CMD_GENERATE_AUTH_TOKEN)
&& responseId()!=responseIdToCommandId(MC_CMP_CMD_GET_SUID)
& length > 0) // not setting length for messages that only have id
@@ -83,10 +83,10 @@ public class CmpResponse extends CmpMsg{
}
}
-
+
/**
Default constructor
- */
+ */
public CmpResponse(){
super();
}
@@ -98,10 +98,10 @@ public class CmpResponse extends CmpMsg{
public CmpResponse(byte[] content){
super(content);
}
-
+
/**
Constructor required by parcelable
- */
+ */
public CmpResponse(Parcel in){
super(in);
}
@@ -110,7 +110,7 @@ public class CmpResponse extends CmpMsg{
public CmpResponse createFromParcel(Parcel in){
return new CmpResponse(in);
}
-
+
public CmpResponse[] newArray(int size){
return null;
}
diff --git a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/CommandResult.aidl b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/CommandResult.aidl
index f995e0c..fb46cdd 100644
--- a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/CommandResult.aidl
+++ b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/CommandResult.aidl
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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.
+ */
package com.gd.mobicore.pa.ifc;
parcelable CommandResult;
diff --git a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/CommandResult.java b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/CommandResult.java
index 34d4e8e..156fa11 100644
--- a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/CommandResult.java
+++ b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/CommandResult.java
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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.
+ */
package com.gd.mobicore.pa.ifc;
@@ -44,7 +44,7 @@ public class CommandResult implements Parcelable{
*/
/**
- No errors detected, successful execution
+ No errors detected, successful execution
*/
public static final int ROOTPA_OK=0x00000000;
@@ -54,7 +54,7 @@ public class CommandResult implements Parcelable{
*/
public static final int ROOTPA_COMMAND_NOT_SUPPORTED=0x00000001;
- /**
+ /**
Either rootpa is locked by another client, or the client requests lock or unlock when it is not allowed to do that.
Possible steps to recover: wait until the lock is released
*/
@@ -65,7 +65,7 @@ public class CommandResult implements Parcelable{
*/
public static final int ROOTPA_ERROR_COMMAND_EXECUTION=0x00000003;
- /**
+ /**
Registry returned an error when trying to write a container. mcDaemon could be dead or something seriously wrong in the file system.
Possible steps to recover: rebooting the device may help
*/
@@ -77,53 +77,53 @@ public class CommandResult implements Parcelable{
*/
public static final int ROOTPA_ERROR_MOBICORE_CONNECTION=0x00000005;
- /**
+ /**
Either Nwd or Swd software is out of memory.
Possible steps to recover: release memory
*/
public static final int ROOTPA_ERROR_OUT_OF_MEMORY=0x00000006;
- /**
+ /**
Rootpa internal error. This error is returned in various situations when something unexpected went wrong e.g. message from CMTL can‘t be interpreted, SE returned an error indicating invalid data, bad request or similar or base64 decoding failed
Possible steps to recover: rebooting or updating the device may help
*/
public static final int ROOTPA_ERROR_INTERNAL=0x00000007;
- /**
+ /**
Given argument is not allowed (in many cases it is NULL) or e.g. the format of xml is unsupported.
Possible steps to recover: give correct argument
*/
public static final int ROOTPA_ERROR_ILLEGAL_ARGUMENT=0x00000008;
- /**
+ /**
Error in network connection or use of networking library.
Possible steps to recover: create working network connection (avoid firewalls and proxies that require password)
*/
public static final int ROOTPA_ERROR_NETWORK=0x00000009;
- /**
+ /**
Error returned by XML library. Problems in parsing received XML command or creating new XML response.
*/
public static final int ROOTPA_ERROR_XML=0x0000000A;
- /**
+ /**
Registry returned an error when trying to read a container. Most likely the container does not exist.
*/
public static final int ROOTPA_ERROR_REGISTRY_OBJECT_NOT_AVAILABLE=0x0000000B;
- /**
+ /**
CMP version of the device is not supported by SE.
Possible steps to recover: use CMP version supported by SE (>=3.0)
*/
public static final int ROOTPA_ERROR_SE_CMP_VERSION=0x0000000C;
- /**
- Precoditions for SP container installation are not met in SE.
+ /**
+ Precoditions for SP container installation are not met in SE.
Possible steps to recover: register used SPID to SE
*/
public static final int ROOTPA_ERROR_SE_PRECONDITION_NOT_MET=0x0000000D;
- /**
+ /**
Requested SP container does not exist. This is not always considered an error but is used as an informative return code. As this is internal return code, user of RootPA services should never see this.
Possible steps to recover: add SP container or request container with different SPID
*/
@@ -131,21 +131,21 @@ public class CommandResult implements Parcelable{
private int result_;
-
+
public static final Parcelable.Creator<CommandResult> CREATOR = new Parcelable.Creator<CommandResult>(){
public CommandResult createFromParcel(Parcel in){
return new CommandResult(in);
}
-
+
public CommandResult[] newArray(int size){
return null;
}
};
-
+
/**
- Constructor
+ Constructor
@param result of the command
- */
+ */
public CommandResult(int result){
result_=result;
}
@@ -156,7 +156,7 @@ public class CommandResult implements Parcelable{
/**
Constructor required by parcelable
- */
+ */
public CommandResult(Parcel in){
readFromParcel(in);
}
@@ -167,31 +167,31 @@ public class CommandResult implements Parcelable{
public void setValue(int value){
result_=value;
- }
-
+ }
+
public boolean isOk(){
return (result_==ROOTPA_OK);
}
- @Override
- public String toString() {
+ @Override
+ public String toString() {
String ret=new Integer(result_).toString();
switch(result_){
case ROOTPA_OK:
ret+=": ROOTPA_OK";
- break;
+ break;
case ROOTPA_COMMAND_NOT_SUPPORTED:
ret+=": ROOTPA_COMMAND_NOT_SUPPORTED";
- break;
+ break;
case ROOTPA_ERROR_INTERNAL:
ret+=": ROOTPA_ERROR_INTERNAL";
- break;
+ break;
case ROOTPA_ERROR_LOCK:
ret+=": ROOTPA_ERROR_LOCK";
- break;
+ break;
case ROOTPA_ERROR_ILLEGAL_ARGUMENT:
ret+=": ROOTPA_ERROR_ILLEGAL_ARGUMENT";
- break;
+ break;
case ROOTPA_ERROR_INTERNAL_NO_CONTAINER:
ret+=": ROOTPA_ERROR_INTERNAL_NO_CONTAINER";
break;
@@ -212,7 +212,7 @@ public class CommandResult implements Parcelable{
break;
case ROOTPA_ERROR_XML:
ret+=": ROOTPA_ERROR_XML";
- break;
+ break;
case ROOTPA_ERROR_REGISTRY_OBJECT_NOT_AVAILABLE:
ret+=": ROOTPA_ERROR_REGISTRY_OBJECT_NOT_AVAILABLE";
break;
@@ -225,16 +225,16 @@ public class CommandResult implements Parcelable{
default:
break;
}
-
+
return ret;
- }
+ }
- @Override
- public int describeContents() {
- return 0;
- }
+ @Override
+ public int describeContents() {
+ return 0;
+ }
- @Override
+ @Override
public void writeToParcel(Parcel out, int flags){
out.writeInt(result_);
}
diff --git a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/IfcVersion.java b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/IfcVersion.java
index 0ee6c6e..c66c9f9 100644
--- a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/IfcVersion.java
+++ b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/IfcVersion.java
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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.
+ */
/** @addtogroup ROOTPA
*/
diff --git a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/RootPADeveloperIfc.aidl b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/RootPADeveloperIfc.aidl
index fd6a955..0889f57 100644
--- a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/RootPADeveloperIfc.aidl
+++ b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/RootPADeveloperIfc.aidl
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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.
+ */
/** \addtogroup ROOTPA AIDL Interfaces
* @{
@@ -39,94 +39,94 @@ import com.gd.mobicore.pa.ifc.CommandResult;
/**
- * This API contains method(s) that are intended to be used for developer
+ * This API contains method(s) that are intended to be used for developer
* TA installation. Note that this API may be removed in the future when the
- * developer TA installation is handled by a service manager and installation of
+ * developer TA installation is handled by a service manager and installation of
* all trutlets follow the same architecture for RootPA point of view.
*
- * The service is started by sending intent com.gd.mobicore.pa.service.DEVELOPER_SERVICE in binding.
- * The service is protected by permission com.gd.mobicore.pa.permission.DEVELOPER_PERMISSION with
+ * The service is started by sending intent com.gd.mobicore.pa.service.DEVELOPER_SERVICE in binding.
+ * The service is protected by permission com.gd.mobicore.pa.permission.DEVELOPER_PERMISSION with
* protectionLevel "normal"
*/
interface RootPADeveloperIfc{
/**
- * This method can be used for installing "developer TA" that is not tied to any
- * service provider and/or service manager. It contacts Service Enabler and asks it to
+ * This method can be used for installing "developer TA" that is not tied to any
+ * service provider and/or service manager. It contacts Service Enabler and asks it to
* perform the tasks, so the device has to be connected to network in order for this to
- * succeed.
+ * succeed.
*
- * The service progress is informed with the same Intents as is progress of the
- * @ref RootPAServiceIfc#doProvisioning, however there is an additional
- * Intent com.gd.mobicore.pa.service.INSTALL_TRUSTLET for returning the encrypted
- * TA binary (in case of dynamic installation where taBinary is given
+ * The service progress is informed with the same Intents as is progress of the
+ * @ref RootPAServiceIfc#doProvisioning, however there is an additional
+ * Intent com.gd.mobicore.pa.service.INSTALL_TRUSTLET for returning the encrypted
+ * TA binary (in case of dynamic installation where taBinary is given
* as a parameter).
*
* There are constants related to the intents in @ref RootPAProvisioningIntents
*
* @param spid service provider id
* @param uuid uuid of the TA in hex, without dashes. Needs to be correct length.
- * @param taBinary TA binary to be encrypted with and returned back.
- * If the binary is already encrypted, this array must be empty. The binary
- * has to be encrypted for transfer. Note that only either taBinary
- * or key can be given. There are sperate instructions on how the binary is to
- * be encrypted and packaged. Key and taBinary are exclusive, only one of
- * them can be given. This methods uses default values for memoryType (2),
+ * @param taBinary TA binary to be encrypted with and returned back.
+ * If the binary is already encrypted, this array must be empty. The binary
+ * has to be encrypted for transfer. Note that only either taBinary
+ * or key can be given. There are sperate instructions on how the binary is to
+ * be encrypted and packaged. Key and taBinary are exclusive, only one of
+ * them can be given. This methods uses default values for memoryType (2),
* numberOfInstances (1) and flags (0) when TA binary is installed.
- * @param key a key that has been used to encrypt the TA binary in case when
- * the TA binary is not given as a parameter. This key has to be
- * encrypted for transfer. There are sperate instructions on how the key is to
- * be encrypted and packaged. Key and taBinary are exclusive, only one of
+ * @param key a key that has been used to encrypt the TA binary in case when
+ * the TA binary is not given as a parameter. This key has to be
+ * encrypted for transfer. There are sperate instructions on how the key is to
+ * be encrypted and packaged. Key and taBinary are exclusive, only one of
* them can be given.
* @param minTltVersion minimum version of the TA
* @param tltPukHash this field is not used at the moment, null is fine here.
*
* @return indication of successful start of provisioning thread (ROOTPA_OK) or an error code
*/
- CommandResult installTrustletOrKey(in int spid,
- in byte[] uuid,
- in byte[] taBinary,
- in byte[] key,
- in int minTltVersion,
+ CommandResult installTrustletOrKey(in int spid,
+ in byte[] uuid,
+ in byte[] taBinary,
+ in byte[] key,
+ in int minTltVersion,
in byte[] tltPukHash);
-
+
/**
- * This method can be used for installing "developer TA" that is not tied to any
- * service provider and/or service manager. It contacts Service Enabler and asks it to
+ * This method can be used for installing "developer TA" that is not tied to any
+ * service provider and/or service manager. It contacts Service Enabler and asks it to
* perform the tasks, so the device has to be connected to network in order for this to
* succeed.
*
- * The service progress is informed with the same Intents as is progress of the
- * @ref RootPAServiceIfc#doProvisioning, however there is an additional
- * Intent com.gd.mobicore.pa.service.INSTALL_TRUSTLET for returning the encrypted
+ * The service progress is informed with the same Intents as is progress of the
+ * @ref RootPAServiceIfc#doProvisioning, however there is an additional
+ * Intent com.gd.mobicore.pa.service.INSTALL_TRUSTLET for returning the encrypted
* TA binary.
*
* There are constants related to the intents in @ref RootPAProvisioningIntents
*
* @param spid service provider id
* @param uuid uuid of the TA in hex, without dashes. Needs to be correct length.
- * @param taBinary TA binary to be encrypted with and returned back.
- * If the binary is already encrypted, this array must be empty. The binary
- * has to be encrypted for transfer. Note that only either taBinary
- * or key can be given. There are sperate instructions on how the binary is to
+ * @param taBinary TA binary to be encrypted with and returned back.
+ * If the binary is already encrypted, this array must be empty. The binary
+ * has to be encrypted for transfer. Note that only either taBinary
+ * or key can be given. There are sperate instructions on how the binary is to
* be encrypted and packaged.
* @param minTltVersion minimum version of the TA
* @param tltPukHash this field is not used at the moment, null is fine here.
- * @param memoryType memory where the TA is to be loaded and executed: 0 - if enough space is available,
- load the TA into the internal memory, otherwise into the external memory, 1 - internal memory,
+ * @param memoryType memory where the TA is to be loaded and executed: 0 - if enough space is available,
+ load the TA into the internal memory, otherwise into the external memory, 1 - internal memory,
2 - external memory
* @param numberOfInstances indicates how many instances of a TA can be installed (run) in parallel
* @param flags current flags are: 1 - permanent, 2 - service has no WSW control interface, 4 - debuggable
*
* @return indication of successful start of provisioning thread (ROOTPA_OK) or an error code
*/
- CommandResult installTrustlet(in int spid,
- in byte[] uuid,
- in byte[] taBinary,
- in int minTltVersion,
- in byte[] tltPukHash,
- in int memoryType,
- in int numberOfInstances,
+ CommandResult installTrustlet(in int spid,
+ in byte[] uuid,
+ in byte[] taBinary,
+ in int minTltVersion,
+ in byte[] tltPukHash,
+ in int memoryType,
+ in int numberOfInstances,
in int flags);
}
diff --git a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/RootPAOemIfc.aidl b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/RootPAOemIfc.aidl
index afb45cf..973801c 100644
--- a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/RootPAOemIfc.aidl
+++ b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/RootPAOemIfc.aidl
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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.
+ */
/** \addtogroup ROOTPA AIDL Interfaces
* @{
@@ -37,18 +37,18 @@ package com.gd.mobicore.pa.ifc;
import com.gd.mobicore.pa.ifc.CommandResult;
-/**
+/**
* RootPAOemIfc is intended to be used by OEM only. It provides means to initiate unregistering root container.
*
-* The service is started by sending intent com.gd.mobicore.pa.service.OEM_SERVICE in binding. The service is
+* The service is started by sending intent com.gd.mobicore.pa.service.OEM_SERVICE in binding. The service is
* protected by permission com.gd.mobicore.pa.permission.OEM_PERMISSION with protectionLevel "signatureOrSystem"
*/
interface RootPAOemIfc{
/**
- * For OEM testing purposes only. Contacts Service Enabler and requests it to unregister the root container,
- * so the device has to be connected to network for the call to succeed. The command returns almost immediately
- * and executes in a separate thread, the same status Intents and values as are returned with
+ * For OEM testing purposes only. Contacts Service Enabler and requests it to unregister the root container,
+ * so the device has to be connected to network for the call to succeed. The command returns almost immediately
+ * and executes in a separate thread, the same status Intents and values as are returned with
* @ref RootPAServiceIfc#doProvisioning can be returned when calling this methods. With the addition of value:
* <ul>
* <li>UNREGISTERING_ROOT_CONTAINER (id 3000)</li>
diff --git a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/RootPAProvisioningIntents.java b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/RootPAProvisioningIntents.java
index a3463d5..8295599 100644
--- a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/RootPAProvisioningIntents.java
+++ b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/RootPAProvisioningIntents.java
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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.
+ */
package com.gd.mobicore.pa.ifc;
@@ -36,18 +36,18 @@ package com.gd.mobicore.pa.ifc;
*/
public class RootPAProvisioningIntents {
-//
+//
/** Intents for starting up and connecting to services */
//
public static final String PROVISIONING_SERVICE="com.gd.mobicore.pa.service.PROVISIONING_SERVICE";
public static final String DEVELOPER_SERVICE="com.gd.mobicore.pa.service.DEVELOPER_SERVICE";
public static final String OEM_SERVICE="com.gd.mobicore.pa.service.OEM_SERVICE";
-
-//
+
+//
/** Execution status reporting Intents */
//
-
+
/** Provisioning is ongoing. The intent contained additional data in the integer field pointed by STATUS */
public static final String PROVISIONING_PROGRESS_UPDATE = "com.gd.mobicore.pa.service.PROVISIONING_PROGRESS_UPDATE";
/** root provisioning was attempted but failed - the intent will contain an error code */
@@ -55,10 +55,10 @@ public class RootPAProvisioningIntents {
/** root provisioning has completed, root and SP containers are available for use */
public static final String FINISHED_ROOT_PROVISIONING = "com.gd.mobicore.pa.service.PROVISIONING_FINISHED";
-
+
/** this intent contains developer trustlet in it's extra data. The trustlet has been signed by SE */
public static final String INSTALL_TRUSTLET = "com.gd.mobicore.pa.service.INSTALL_TRUSTLET";
-
+
//
/** Names of extra data field's for intents */
//
@@ -69,7 +69,7 @@ public class RootPAProvisioningIntents {
public static final String ERROR ="com.gd.mobicore.pa.ifc.Error";
/** Error code field in INSTALL_TRUSTLET intent */
public static final String TRUSTLET ="com.gd.mobicore.pa.ifc.Trustlet";
-
+
//
/** possible values for STATE field */
//
diff --git a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/RootPAServiceIfc.aidl b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/RootPAServiceIfc.aidl
index 9db4557..1efc03d 100644
--- a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/RootPAServiceIfc.aidl
+++ b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/RootPAServiceIfc.aidl
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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.
+ */
/** \addtogroup ROOTPA AIDL Interfaces
* @{
@@ -45,7 +45,7 @@ import com.gd.mobicore.pa.ifc.SUID;
import com.gd.mobicore.pa.ifc.SPContainerStructure;
import com.gd.mobicore.pa.ifc.SPContainerStateParcel;
-/**
+/**
* RootPAServiceIfc is intended for SP.PA use at the time of installing new TA. It provides means
* to communicate with content management TA (using CMP version 3), request SE to perform provisioning
* of root container and TA container and means to obtain some information on the MobiCore and its registry.
@@ -56,7 +56,7 @@ interface RootPAServiceIfc {
/**
* Checks if a root container is registered.
- * Lock must not be acquired before executing this method and it can not be
+ * Lock must not be acquired before executing this method and it can not be
* acquired while this method runs.
*
* @param result true if root container exists.
@@ -66,7 +66,7 @@ interface RootPAServiceIfc {
/**
* Checks if a specific SP container is registered.
- * Lock must not be acquired before executing this method and it can not be
+ * Lock must not be acquired before executing this method and it can not be
* acquired while this method runs.
*
* @param spid SPID of the Service Provider
@@ -77,7 +77,7 @@ interface RootPAServiceIfc {
/**
* Returns the version of various components of the MobiCore OS and surrounding components.
- * Lock must not be acquired before executing this method and it can not be
+ * Lock must not be acquired before executing this method and it can not be
* acquired while this method runs.
*
* @param version the result code of the call is saved in this parameter.
@@ -87,7 +87,7 @@ interface RootPAServiceIfc {
/**
* Returns the SUID of the device.
- * Lock must not be acquired before executing this method and it can not be
+ * Lock must not be acquired before executing this method and it can not be
* acquired while this method runs.
*
* @param suid the result of the SUID is saved in this parameter.
@@ -120,9 +120,9 @@ interface RootPAServiceIfc {
* If one of the commands result in an error then the following commands are
* not executed anymore, unless the command object has "ignoreError" set true.
* A lock is required to execute this method.
- *
- * Note that this causes only excution of the CMP command(s) and reads/stores the
- * secure objects when needed. It does not initiate any discussion with Servce Enabler
+ *
+ * Note that this causes only excution of the CMP command(s) and reads/stores the
+ * secure objects when needed. It does not initiate any discussion with Servce Enabler
* or any other network component with any of CMP commands.
*
* @param uid the user id of the process which is accessing.
@@ -134,14 +134,14 @@ interface RootPAServiceIfc {
/**
* Starts provisioning. What actually happens after calling this depends on the state of the system and the commands SE sends.
- * In normal situation, SE sends commands to create root container and SP container (indicated by spid) if they do not already
+ * In normal situation, SE sends commands to create root container and SP container (indicated by spid) if they do not already
* exist. If given spid is 0, only root container is created (if it does not already exist).
* Tasks are performed asynchronously. Method returns immediately.
* Intents are broadcast to indicate the progress of the provisioning. The result is also
* sent via broadcast.
*
- * Cannot be executed if the acquireLock is called. Release any lock before calling this
- * method. Also, this command acquires lock internally before executing and releases lock
+ * Cannot be executed if the acquireLock is called. Release any lock before calling this
+ * method. Also, this command acquires lock internally before executing and releases lock
* when error occurs or provisioning is finished (just before sending FINISHED_ROOT_PROVISIONING intent) or after 1 minute timeout.
*
* The following intents are broadcast after calling doProvisioning:
@@ -159,12 +159,12 @@ interface RootPAServiceIfc {
* <li>com.gd.mobicore.pa.service.FINISHED_ROOT_PROVISIONING: Sent when the provisioning is finished.</li>
* <li>com.gd.mobicore.pa.service.PROVISIONING_ERROR: Sent when an error has occured, also contains an error code.</li>
* </ul>
- * Note that depending on the nature of th errors it is possible that more than one PROVISIONING_ERROR intents are sent
+ * Note that depending on the nature of th errors it is possible that more than one PROVISIONING_ERROR intents are sent
* before the excution of provisioning is fully stopped. This depends a lot on whether SE can still continue execution.
*
* There are constants related to the intents in @ref RootPAProvisioningIntents
- *
- * Service Enabler is contacted and asked to perform the tasks, so the device has to be connected to network
+ *
+ * Service Enabler is contacted and asked to perform the tasks, so the device has to be connected to network
* in order for this to succeed.
*
* @param uid the user id of the process which is accessing.
@@ -176,7 +176,7 @@ interface RootPAServiceIfc {
/**
* Interrogates the SP container structure.
- * Lock must not be acquired before executing this method and it can not be
+ * Lock must not be acquired before executing this method and it can not be
* acquired while this method runs.
*
* @param spid provides [in] the id of the SP (SPCont)
@@ -187,7 +187,7 @@ interface RootPAServiceIfc {
/**
* Interrogates the state of an SP container.
- * Lock must not be acquired before executing this method and it can not be
+ * Lock must not be acquired before executing this method and it can not be
* acquired while this method runs.
*
* @param spid [in] service provider id to query
diff --git a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SPContainerState.java b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SPContainerState.java
index 8216027..6a06034 100644
--- a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SPContainerState.java
+++ b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SPContainerState.java
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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.
+ */
package com.gd.mobicore.pa.ifc;
diff --git a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SPContainerStateParcel.aidl b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SPContainerStateParcel.aidl
index 4df4f01..43278e0 100644
--- a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SPContainerStateParcel.aidl
+++ b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SPContainerStateParcel.aidl
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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.
+ */
package com.gd.mobicore.pa.ifc;
diff --git a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SPContainerStateParcel.java b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SPContainerStateParcel.java
index a1a1d87..bf072f4 100644
--- a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SPContainerStateParcel.java
+++ b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SPContainerStateParcel.java
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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.
+ */
package com.gd.mobicore.pa.ifc;
diff --git a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SPContainerStructure.aidl b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SPContainerStructure.aidl
index 6ef941f..4a9fb01 100644
--- a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SPContainerStructure.aidl
+++ b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SPContainerStructure.aidl
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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.
+ */
package com.gd.mobicore.pa.ifc;
diff --git a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SPContainerStructure.java b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SPContainerStructure.java
index 0631680..aff5891 100644
--- a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SPContainerStructure.java
+++ b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SPContainerStructure.java
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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.
+ */
package com.gd.mobicore.pa.ifc;
diff --git a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SPID.aidl b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SPID.aidl
index 48a8705..09180e8 100644
--- a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SPID.aidl
+++ b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SPID.aidl
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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.
+ */
package com.gd.mobicore.pa.ifc;
diff --git a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SPID.java b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SPID.java
index 74c8cae..11de0ed 100644
--- a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SPID.java
+++ b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SPID.java
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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.
+ */
package com.gd.mobicore.pa.ifc;
diff --git a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SUID.aidl b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SUID.aidl
index 5cdd9ad..7a9d59f 100644
--- a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SUID.aidl
+++ b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SUID.aidl
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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.
+ */
package com.gd.mobicore.pa.ifc;
diff --git a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SUID.java b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SUID.java
index 8f872a1..a9c1ab9 100644
--- a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SUID.java
+++ b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/SUID.java
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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.
+ */
package com.gd.mobicore.pa.ifc;
diff --git a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/TrustletContainer.aidl b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/TrustletContainer.aidl
index a92e50e..1ed4159 100644
--- a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/TrustletContainer.aidl
+++ b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/TrustletContainer.aidl
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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.
+ */
package com.gd.mobicore.pa.ifc;
diff --git a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/TrustletContainer.java b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/TrustletContainer.java
index 6dbc168..d466c25 100644
--- a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/TrustletContainer.java
+++ b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/TrustletContainer.java
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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.
+ */
package com.gd.mobicore.pa.ifc;
diff --git a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/TrustletContainerState.java b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/TrustletContainerState.java
index d4dca91..de23707 100644
--- a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/TrustletContainerState.java
+++ b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/TrustletContainerState.java
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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.
+ */
package com.gd.mobicore.pa.ifc;
diff --git a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/TrustletContainerStateParcel.aidl b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/TrustletContainerStateParcel.aidl
index 8d5114a..8e448dd 100644
--- a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/TrustletContainerStateParcel.aidl
+++ b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/TrustletContainerStateParcel.aidl
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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.
+ */
package com.gd.mobicore.pa.ifc;
diff --git a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/TrustletContainerStateParcel.java b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/TrustletContainerStateParcel.java
index 9e6ad0f..cbb7f2e 100644
--- a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/TrustletContainerStateParcel.java
+++ b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/TrustletContainerStateParcel.java
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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.
+ */
package com.gd.mobicore.pa.ifc;
diff --git a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/Version.aidl b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/Version.aidl
index 17ea0b4..e556ea6 100644
--- a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/Version.aidl
+++ b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/Version.aidl
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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.
+ */
package com.gd.mobicore.pa.ifc;
diff --git a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/Version.java b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/Version.java
index ac03271..74c542c 100644
--- a/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/Version.java
+++ b/mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/Version.java
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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.
+ */
package com.gd.mobicore.pa.ifc;
@@ -58,7 +58,7 @@ public class Version implements Parcelable {
public Version() {
}
-
+
public Version(String productId, Bundle version) {
setVersion(version);
setProductId(productId);
diff --git a/mobicore/rootpa/Code/CMakeLists.txt b/mobicore/rootpa/Code/CMakeLists.txt
new file mode 100644
index 0000000..68941ba
--- /dev/null
+++ b/mobicore/rootpa/Code/CMakeLists.txt
@@ -0,0 +1,43 @@
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(LIBDIR "${PREFIX}/lib")
+SET(RESOURCEDIR "${CMAKE_CURRENT_SOURCE_DIR}/resource")
+
+set(CMAKE_VERBOSE_MAKEFILE ON)
+
+pkg_check_modules(rpkgs REQUIRED libxml2)
+pkg_check_modules(rpkgs REQUIRED libxml2-devel)
+pkg_check_modules(rpkgs REQUIRED libwbxml2)
+pkg_check_modules(rpkgs REQUIRED libcurl-devel)
+pkg_check_modules(rpkgs REQUIRED openssl-devel)
+add_definitions(${rpkgs_CFLAGS})
+
+SET(SRCS
+ Common/base64.c
+ Common/commandhandler.c
+ Common/contentmanager.c
+ Common/pacmp3.c
+ Common/pacmtl.c
+ Common/provisioningengine.c
+ Common/registry.c
+ Common/seclient.c
+ Common/trustletchannel.c
+ Common/xmlmessagehandler.c
+)
+
+INCLUDE_DIRECTORIES(Common/include)
+INCLUDE_DIRECTORIES(Common)
+INCLUDE_DIRECTORIES(/usr/include/libxml2)
+
+FOREACH(flag ${pkgs_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag} -Wconversion-null -Werror=strict-aliasing")
+ENDFOREACH(flag)
+
+ADD_DEFINITIONS("-DLINUX -DARM -D_32BIT -DANDROID_ARM=1 -DTIZEN")
+
+# Rules for LIBPROVISIONINGAGENT
+SET(LIBPROVISIONINGAGENT_SO "provisioningagent")
+ADD_LIBRARY(${LIBPROVISIONINGAGENT_SO} SHARED ${SRCS})
+TARGET_LINK_LIBRARIES(${LIBPROVISIONINGAGENT_SO} ${rpkgs_LDFLAGS} ${LIBCLIENT_SO} ${LIBREGISTRY_SO} -lssl -lcrypto -lz -lxml2 -lcurl)
+
+INSTALL(TARGETS ${LIBPROVISIONINGAGENT_SO} DESTINATION ${LIBDIR})
+INSTALL(DIRECTORY Common/include/ DESTINATION /usr/include FILES_MATCHING PATTERN "*.h")
diff --git a/mobicore/rootpa/Code/Common/Android.mk b/mobicore/rootpa/Code/Common/Android.mk
index ac71006..031e1dd 100644
--- a/mobicore/rootpa/Code/Common/Android.mk
+++ b/mobicore/rootpa/Code/Common/Android.mk
@@ -63,13 +63,10 @@ LOCAL_SRC_FILES += commandhandler.c
LOCAL_C_INCLUDES += $(MOBICORE_DIR_INC)
-LOCAL_C_INCLUDES += $(MOBICORE_DIR_INC)/TlCm
-LOCAL_C_INCLUDES += $(MOBICOREDRIVER_DIR_INC)
-LOCAL_C_INCLUDES += $(MOBICOREDRIVER_DIR_INC2)
LOCAL_C_INCLUDES += external/curl/include
-LOCAL_C_INCLUDES += external/libxml2/include
LOCAL_C_INCLUDES += external/icu/icu4c/source/common
LOCAL_C_INCLUDES += external/icu4c/common
+LOCAL_C_INCLUDES += external/libxml2/include
LOCAL_C_INCLUDES += .
LOCAL_C_INCLUDES += $(LOCAL_PATH)/include
@@ -82,7 +79,9 @@ endif
LOCAL_MODULE_TAGS := debug eng optional
-LOCAL_32_BIT_ONLY := true
-LOCAL_STATIC_LIBRARIES += libxml2
+LOCAL_STATIC_LIBRARIES = MobiCoreTlcm
+LOCAL_SHARED_LIBRARIES = libMcClient libMcRegistry
+APP_PIE := true
+LOCAL_32_BIT_ONLY := true
include $(BUILD_STATIC_LIBRARY)
diff --git a/mobicore/rootpa/Code/Common/base64.c b/mobicore/rootpa/Code/Common/base64.c
index 9535e8a..23685c8 100644
--- a/mobicore/rootpa/Code/Common/base64.c
+++ b/mobicore/rootpa/Code/Common/base64.c
@@ -1,35 +1,35 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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.
+ */
/*
-The content of this file is copied from b64.c (http://base64.sourceforge.net)
+The content of this file is copied from b64.c (http://base64.sourceforge.net)
and modified to work with memory buffers instead of files.
The linebreak addition has been removed from the encoding part
@@ -70,7 +70,7 @@ static const char* cd64="|$$$}rstuvwxyz{$$$$$$$>?@ABCDEFGHIJKLMNOPQRSTUVW$$$$$$X
static void decodeblock( unsigned char *in, unsigned char *out )
-{
+{
out[ 0 ] = (unsigned char ) (in[0] << 2 | in[1] >> 4);
out[ 1 ] = (unsigned char ) (in[1] << 4 | in[2] >> 2);
out[ 2 ] = (unsigned char ) (((in[2] << 6) & 0xc0) | in[3]);
@@ -98,46 +98,46 @@ size_t base64DecodeStringRemoveEndZero(const char* toBeDecoded, char** resultP)
{
size_t inSize;
size_t outSize;
-
+
unsigned char in[ENCODEDSIZE];
unsigned char out[PLAINSIZE];
int v;
int i, len;
- int inIndex=0;
+ size_t inIndex=0;
int outIndex=0;
LOGD(">> base64DecodeStringRemoveEndZero");
if(NULL==toBeDecoded) return 0;
- inSize=strlen(toBeDecoded);
+ inSize=strlen(toBeDecoded);
outSize=((inSize*PLAINSIZE)/ENCODEDSIZE)+((inSize*PLAINSIZE)%ENCODEDSIZE);
*resultP=(char *)malloc(outSize);
if((*resultP)==NULL) return 0;
-
+
LOGD("in %d out %d", (int) inSize, (int) outSize);
*in = (unsigned char) 0;
*out = (unsigned char) 0;
-
- while( inIndex < inSize )
+
+ while( inIndex < inSize )
{
- for( len = 0, i = 0; i < ENCODEDSIZE && inIndex < inSize; i++ )
+ for( len = 0, i = 0; i < ENCODEDSIZE && inIndex < inSize; i++ )
{
v = 0;
// skip characters that do not belong to decoded base64 and set v
- while( inIndex < inSize && 0 == v )
+ while( inIndex < inSize && 0 == v )
{
v = toBeDecoded[ inIndex++ ];
v = ((v < FIRSTB64ASCII || v > LASTB64ASCII) ? 0 : (int) cd64[ v - FIRSTB64ASCII ]);
- if( v != 0 )
+ if( v != 0 )
{
v = ((v == (int)'$') ? 0 : v - 61);
}
}
-
+
// set the character to in buffer, but only if it is not 0 (last character in toBeDecoded illegal)
if( inIndex <= inSize )
{
@@ -153,10 +153,10 @@ size_t base64DecodeStringRemoveEndZero(const char* toBeDecoded, char** resultP)
}
}
- if( len > 0 )
+ if( len > 0 )
{
decodeblock( in, out );
- for( i = 0; i < (len - 1); i++ )
+ for( i = 0; i < (len - 1); i++ )
{
(*resultP)[outIndex++]=out[i];
}
@@ -176,7 +176,7 @@ static void encodeblock( unsigned char *in, unsigned char *out, int len )
}
/**
-base64encode data to a NULL terminated string.
+base64encode data to a NULL terminated string.
@param toBeEncoded the buffer to be encoded
@param length length of the buffer to be encoded
@@ -186,11 +186,11 @@ char* base64EncodeAddEndZero(const char* toBeEncoded, size_t length)
{
size_t outSize;
char* resultP;
-
+
unsigned char in[PLAINSIZE];
unsigned char out[ENCODEDSIZE];
int i, len;
- int inIndex=0;
+ size_t inIndex=0;
int outIndex=0;
LOGD(">> base64EncodeAddEndZero %d %s", (int) length, ((toBeEncoded!=NULL)?"ptr ok":"NULL"));
@@ -206,31 +206,31 @@ char* base64EncodeAddEndZero(const char* toBeEncoded, size_t length)
resultP[outSize-1]=0;
LOGD("in %d out %d", (int) length, (int) outSize);
-
+
*in = (unsigned char) 0;
*out = (unsigned char) 0;
- while( inIndex < length )
+ while( inIndex < length )
{
len = 0;
- for( i = 0; i < PLAINSIZE; i++ )
+ for( i = 0; i < PLAINSIZE; i++ )
{
- if( inIndex < length )
+ if( inIndex < length )
{
in[i] = toBeEncoded[inIndex];
len++;
}
- else
+ else
{
in[i] = (unsigned char) 0;
}
inIndex++;
}
-
- if( len > 0 )
+
+ if( len > 0 )
{
encodeblock( in, out, len );
- for( i = 0; i < ENCODEDSIZE; i++ )
+ for( i = 0; i < ENCODEDSIZE; i++ )
{
resultP[outIndex++]=out[i];
}
diff --git a/mobicore/rootpa/Code/Common/base64.h b/mobicore/rootpa/Code/Common/base64.h
index b17216c..c739641 100644
--- a/mobicore/rootpa/Code/Common/base64.h
+++ b/mobicore/rootpa/Code/Common/base64.h
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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 BASE64_H
#define BASE64_H
diff --git a/mobicore/rootpa/Code/Common/cacerts.h b/mobicore/rootpa/Code/Common/cacerts.h
index 6769a5d..4a1d9d4 100644
--- a/mobicore/rootpa/Code/Common/cacerts.h
+++ b/mobicore/rootpa/Code/Common/cacerts.h
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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 CACERTS_H
#define CACERTS_H
@@ -56,25 +56,48 @@ hISypnUvXAN/BZXIwQXSAOqajTGEv3X/wLyasm3nkEX29IgDvknLBoqnTS9rD2LQ\n\
4BnqNQubr5XROBOlwdkrHTveN4Y9pA==\n\
-----END CERTIFICATE-----\n\
\n\
-Self signed certificate for 10.0.2.2 for RootPA testing purposes\n\
+Apache2 vHost CA\n\
================================================================\n\
-----BEGIN CERTIFICATE-----\n\
-MIICyTCCAbGgAwIBAgIJAPJnq4Q6g6GlMA0GCSqGSIb3DQEBBQUAMBQxEjAQBgNV\n\
-BAMTCXRlcm9ua29uZTAeFw0xMzAyMjAwODM4MzBaFw0yMzAyMTgwODM4MzBaMBQx\n\
-EjAQBgNVBAMTCXRlcm9ua29uZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC\n\
-ggEBANTqu+e+gvW7fzoq59DlM2z4kWLYfGKY0DKs8dB15uo1p3tAEn/SWxTE5s8t\n\
-HxW7ui7fs5JL8AC/94jCAbeN/xPJBf4nVdjnlg19fWiylcq4Ib+FxhCar6bu/a2W\n\
-uUvI8IuM42Z8uyybBRVv8Q1Sqn+O4YiPfvVi+7oAu0pE1vemlXZ7SyXecBBtqBpy\n\
-sWfW2lV4ixeLqSay9o/ZgHRdUdkZorv/eDpLlVIwo7zmQsLb0jbGMlfRATsNkYI8\n\
-IEOxPdJSIUjnY+tZcMYQniCc0CnxWIMAxWJxMgQchyCQPkNAStwEsO0Ty3NJKGfr\n\
-mMHIzc58x999i+MeZ80AWbLjjX0CAwEAAaMeMBwwCQYDVR0TBAIwADAPBgNVHREE\n\
-CDAGhwQKAAICMA0GCSqGSIb3DQEBBQUAA4IBAQACnClBnUXBUf+GmFlq2F+8k4m1\n\
-0A9q+7Krk56JgqzdBMy8SO7FHnsyd2azWoqXzSuJyVsTMfCD0xfWXKSdzJJPJvUR\n\
-SYNQxYNUWbVKfXjXQnALltR7D+IvHWCukeohBx3nPjnFzfb68xyr2809RTEdYFyq\n\
-3olggSjYDRiX+n1XP8ryx/l10X8M9cKkLXsa9o8bSyYrpxPuYPCM6bD9g2xriAO+\n\
-1irwp3fWWFcm1oedSSNv8E9AiZuevuliT5+0BtoXY11NE+ipPKDtJUVuo2gHRcqo\n\
-/92iZY4T5y0ERhZ2jnRB5k6xdb94EdL2aSBmz6XXbr7thAE29HUwkprKYaAt\n\
+MIIHGzCCBQOgAwIBAgIJAOoMGzaC8DnTMA0GCSqGSIb3DQEBBQUAMIGiMQswCQYD\n\
+VQQGEwJGSTEQMA4GA1UECBMHRmlubGFuZDERMA8GA1UEBxMISGVsc2lua2kxEjAQ\n\
+BgNVBAoTCVRydXN0b25pYzEWMBQGA1UECxMNVHJ1c3RvbmljIFBLSTEaMBgGA1UE\n\
+AxMRVHJ1c3RvbmljIFJvb3QgQ0ExJjAkBgkqhkiG9w0BCQEWF3dlYm1hc3RlckB0\n\
+cnVzdG9uaWMuY29tMB4XDTEzMDIwNzA5MjgxM1oXDTMzMDIwMjA5MjgxM1owgaIx\n\
+CzAJBgNVBAYTAkZJMRAwDgYDVQQIEwdGaW5sYW5kMREwDwYDVQQHEwhIZWxzaW5r\n\
+aTESMBAGA1UEChMJVHJ1c3RvbmljMRYwFAYDVQQLEw1UcnVzdG9uaWMgUEtJMRow\n\
+GAYDVQQDExFUcnVzdG9uaWMgUm9vdCBDQTEmMCQGCSqGSIb3DQEJARYXd2VibWFz\n\
+dGVyQHRydXN0b25pYy5jb20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC\n\
+AQDVo+0b8pUmMQZtCMs23qQJFGMAGoeeDw0h7YL/IQsXdWVldyMi+dJKibQY+sK0\n\
+7kg/1EyqAzSm0XQd1WPoPrbz11jHjfNXCXn3UVrVaccO/SUznC7BQ7BGLQC5A/ll\n\
+hJ65Eg2V+N/nAqfdN2Dto+3Eq9Kveqoxl6+hDrGtg44NyKI1bByTy32ZeQ9SL64E\n\
+MJmN6FTAdfW9ngiQ+lijooQ1Rv+Z/bgIw2Pz1wqUHDic7HPuVt1DO2aBmfXH9/Wr\n\
+sVCZu2+lXOaveU7zGcI/tSQijWTIAqE9EvvIl30TUt4AnyFShApyoVYTxNtkDoMz\n\
+XyrIXTsKIEVWSkpmQin8Q17R8URrluWOIN7Fr6JS64Rs6ZuBFi1/Ly3a1JleXV72\n\
+y4gM5AaAA216ntppX7B9cvjbjuW20bcmwJJ7nTikaA0D90J9kHGBCmOKNxI+baiy\n\
+IUPH4l9TaGykuqQ6GCLNMjpeKpo5pnRYZQxIzKmvWWAo96wRYZ+5P3ViUhSfNn6f\n\
+5AhAOwyAiAIiC/3Vuc2dDS4cE/IaWLTfva9IxSdW5fW6oURTsft9dLPGM9vkFTjO\n\
+ODs00hM4Q6a6WsmeIoaH/WgVD+MVlIO3o8+fUhdiQJyZIgtt/cquAlkr4/xBaARZ\n\
+0NMMKOZmiQJ27xqO8F0YoGmIks5wsN9AMV7BwlDs+rVffwIDAQABo4IBUDCCAUww\n\
+MAYJYIZIAYb4QgENBCMWIVtSb290IGNlcnRpZmljYXRpb24gYXV0aG9yaXR5XSBD\n\
+QTAdBgNVHQ4EFgQUWE1tsuTxDUQ4e+C8KJR6Y1Icn30wgdcGA1UdIwSBzzCBzIAU\n\
+WE1tsuTxDUQ4e+C8KJR6Y1Icn32hgaikgaUwgaIxCzAJBgNVBAYTAkZJMRAwDgYD\n\
+VQQIEwdGaW5sYW5kMREwDwYDVQQHEwhIZWxzaW5raTESMBAGA1UEChMJVHJ1c3Rv\n\
+bmljMRYwFAYDVQQLEw1UcnVzdG9uaWMgUEtJMRowGAYDVQQDExFUcnVzdG9uaWMg\n\
+Um9vdCBDQTEmMCQGCSqGSIb3DQEJARYXd2VibWFzdGVyQHRydXN0b25pYy5jb22C\n\
+CQDqDBs2gvA50zASBgNVHRMBAf8ECDAGAQH/AgEAMAsGA1UdDwQEAwIBBjANBgkq\n\
+hkiG9w0BAQUFAAOCAgEAJfOt6/wv8CMV5eP6191m68N3Ig0FypzqQlsYbLmKlOmj\n\
+80lVydHqp2nJGaqnCwmwzf8G+TkhvGqF9V+sABkoh+d1vOZAz486gmZNtx4yTIXm\n\
+0/n/RmrDf6jRx1RP7nNa+vNHjhGAdcXnWkYSbD/vWqSU9ujRPRWghAczOX35zfF1\n\
+JwCSzwNHXkQ98YitO9vB00yUCnoczSA9Dn2ffJtHzeWU0gbouN5Lbb65yB0F+SFY\n\
+zmDXXk2RiBKOF5NJZMX2XfxubgeU+CVE9Upe/mt8aoYzovO/IEx6SgJw2pvEGvXS\n\
+nt7I1oI0xa4TSe4eGnqEwrvESpE4lBDHRtxZ6wtD4iYj30oMXbmg1OrLE9ZypVRa\n\
+7SJTiOCABTy4RxVU9A+jFDDvMjpgH3YTahGoctjJ/8LZwElYDS0eursyBtv/PwXH\n\
+V+P1fBz9s4tBeAzUGt7N4EbL82oB4nna8uc2r60+TOeRGQtVSyatPBZ6755WVS8U\n\
+msd5TjlPsNhZzA30D84Ww9qEXUa+5yNZNYyOZ5bnxa/3Wusmn27SKB7Pa6SijWdl\n\
+IbToFKVSPR5Ehzr2Z1Qw24tLJkVgJUPiu/O1T5WVwgIC36+dXrdUGtVJr7YX3NgI\n\
+2I+wG6EdzBYoWSWa7vkx1YqhLF2zY1SRECGGljUhXJhlziwAQFgzLGwAQ8RMsoU=\n\
-----END CERTIFICATE-----\n"
#endif
-//CACERTS_H \ No newline at end of file
+//CACERTS_H
diff --git a/mobicore/rootpa/Code/Common/commandhandler.c b/mobicore/rootpa/Code/Common/commandhandler.c
index 44da5bc..d7f0f7d 100644
--- a/mobicore/rootpa/Code/Common/commandhandler.c
+++ b/mobicore/rootpa/Code/Common/commandhandler.c
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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 <string.h>
#include <stdlib.h>
@@ -43,7 +43,7 @@ OF THE POSSIBILITY OF SUCH DAMAGE.
#include "rootpaErrors.h"
#include "logging.h"
-#include "provisioningagent.h"
+#include "provisioningagent.h"
#include "registry.h"
#include "contentmanager.h"
#include "provisioningengine.h"
@@ -58,7 +58,7 @@ OF THE POSSIBILITY OF SUCH DAMAGE.
See provisioningagent.h for description of this function.
*/
rootpaerror_t executeCmpCommands(int numberOfCommands, CmpMessage* commandsP, CmpMessage* responsesP, uint32_t* internalError)
-{
+{
LOGD("executeCmpCommands");
return executeContentManagementCommands(numberOfCommands, commandsP, responsesP, internalError);
}
@@ -76,31 +76,31 @@ void closeSessionToCmtl()
rootpaerror_t getVersion(int* tag, mcVersionInfo_t* versionP)
{
rootpaerror_t ret=ROOTPA_OK;
- uint32_t internalError=0;
- CmpMessage command;
+ uint32_t internalError=0;
+ CmpMessage command;
CmpMessage response;
LOGD(">>getVersion");
memset(&command,0,sizeof(CmpMessage));
memset(&response,0,sizeof(CmpMessage));
-
+
command.length=GET_VERSION_COMMAND_LENGTH;
command.contentP=(uint8_t*)malloc(GET_VERSION_COMMAND_LENGTH);
if(!command.contentP)
{
return ROOTPA_ERROR_OUT_OF_MEMORY;
}
-
+
*((uint32_t*)command.contentP)=MC_CMP_CMD_GET_VERSION;
command.hdr.ignoreError=false;
-
+
ret=executeContentManagementCommands(1, &command, &response, &internalError);
if(ROOTPA_OK==ret && 0 == internalError)
{
if(response.length != sizeof(cmpRspGetVersion_t))
{
- ret=ROOTPA_ERROR_INTERNAL;
+ ret=ROOTPA_ERROR_INTERNAL;
}
else
{
@@ -119,7 +119,7 @@ rootpaerror_t getVersion(int* tag, mcVersionInfo_t* versionP)
}
else
{
- LOGE("getVersion, ERROR %d %d", ret, internalError);
+ LOGE("getVersion, ERROR %d %d", ret, internalError);
}
free(response.contentP);
free(command.contentP);
@@ -130,31 +130,31 @@ rootpaerror_t getVersion(int* tag, mcVersionInfo_t* versionP)
rootpaerror_t getSuid(mcSuid_t* suidP)
{
rootpaerror_t ret=ROOTPA_OK;
- uint32_t internalError=0;
- CmpMessage command;
+ uint32_t internalError=0;
+ CmpMessage command;
CmpMessage response;
-
+
LOGD(">>getSuid");
memset(&command,0,sizeof(CmpMessage));
memset(&response,0,sizeof(CmpMessage));
-
+
command.length=GET_SUID_COMMAND_LENGTH;
command.contentP=(uint8_t*)malloc(GET_SUID_COMMAND_LENGTH);
if(!command.contentP)
{
return ROOTPA_ERROR_OUT_OF_MEMORY;
}
-
+
*((uint32_t*)command.contentP)=MC_CMP_CMD_GET_SUID;
command.hdr.ignoreError=false;
-
+
ret=executeContentManagementCommands(1, &command, &response, &internalError);
if(ROOTPA_OK==ret && 0 == internalError)
{
if(response.length != sizeof(cmpRspGetSuid_t))
{
- ret=ROOTPA_ERROR_INTERNAL;
+ ret=ROOTPA_ERROR_INTERNAL;
}
else
{
@@ -175,30 +175,30 @@ rootpaerror_t isRootContainerRegistered(bool* isRegisteredP)
mcResult_t result;
LOGD(">>isRootContainerRegistered");
if(NULL==isRegisteredP) return ROOTPA_ERROR_ILLEGAL_ARGUMENT;
-
- result=regReadRoot(&rootContP, &rootContSize);
+
+ result=regReadRoot(&rootContP, &rootContSize);
if(MC_DRV_OK == result)
{
if(rootContP->cont.attribs.state != MC_CONT_STATE_UNREGISTERED)
{
*isRegisteredP=true;
- }
+ }
else
{
- *isRegisteredP=false;
+ *isRegisteredP=false;
}
-
+
}
else if(MC_DRV_ERR_INVALID_DEVICE_FILE == result)
{
- *isRegisteredP=false;
+ *isRegisteredP=false;
}
else
{
ret=ROOTPA_ERROR_REGISTRY;
}
-
+
free(rootContP);
LOGD("<<isRootContainerRegistered %d", *isRegisteredP);
@@ -214,7 +214,7 @@ rootpaerror_t isSpContainerRegistered(mcSpid_t spid, bool* isRegisteredP)
if(NULL==isRegisteredP) return ROOTPA_ERROR_ILLEGAL_ARGUMENT;
ret=getSpContainerState(spid, (mcContainerState_t*)&state);
-
+
if(ROOTPA_OK == ret)
{
if(state != MC_CONT_STATE_UNREGISTERED)
@@ -223,7 +223,7 @@ rootpaerror_t isSpContainerRegistered(mcSpid_t spid, bool* isRegisteredP)
}
else
{
- *isRegisteredP=false;
+ *isRegisteredP=false;
}
}
else if(ROOTPA_ERROR_INTERNAL_NO_CONTAINER == ret)
@@ -231,7 +231,7 @@ rootpaerror_t isSpContainerRegistered(mcSpid_t spid, bool* isRegisteredP)
*isRegisteredP=false;
ret=ROOTPA_OK;
}
-
+
LOGD("<<isSpContainerRegistered %d", *isRegisteredP);
return ret;
}
@@ -246,7 +246,7 @@ rootpaerror_t getSpContainerState(mcSpid_t spid, mcContainerState_t* stateP)
if(NULL==stateP) return ROOTPA_ERROR_ILLEGAL_ARGUMENT;
result=regGetSpState(spid, stateP);
-
+
if(MC_DRV_ERR_INVALID_DEVICE_FILE == result)
{
ret=ROOTPA_ERROR_INTERNAL_NO_CONTAINER; // using this since it is changed to ROOTPA_OK and state NO_CONTAINER in the wrapper.
@@ -268,19 +268,19 @@ bool containerExists(mcUuid_t uuid)
rootpaerror_t getSpContainerStructure(mcSpid_t spid, SpContainerStructure* spContainerStructure)
{
rootpaerror_t ret=ROOTPA_OK;
- SPCONTAINERP spP=NULL;
+ SPCONTAINERP spP=NULL;
uint32_t spContSize=0;
mcResult_t result;
int i;
TLTCONTAINERP tltP=NULL;
LOGD(">>getSpContainerStructure");
-
+
if(NULL==spContainerStructure) return ROOTPA_ERROR_ILLEGAL_ARGUMENT;
memset(spContainerStructure, 0xFF, sizeof(SpContainerStructure));
- spContainerStructure->nbrOfTlts=0;
+ spContainerStructure->nbrOfTlts=0;
result=regReadSp(spid, &spP, &spContSize);
-
+
if(MC_DRV_OK == result)
{
spContainerStructure->state=spP->cont.attribs.state;
@@ -315,11 +315,11 @@ rootpaerror_t getSpContainerStructure(mcSpid_t spid, SpContainerStructure* spCo
{
ret=ROOTPA_ERROR_INTERNAL_NO_CONTAINER; // using this since it is changed to ROOTPA_OK and state NO_CONTAINER in the wrapper.
}
- else
+ else
{
ret=ROOTPA_ERROR_REGISTRY;
}
-
+
free(spP);
LOGD("<<getSpContainerStructure nr: %d st: %d ret: %d",spContainerStructure->nbrOfTlts, spContainerStructure->state, ret );
return ret;
@@ -330,7 +330,7 @@ rootpaerror_t storeTA(mcSpid_t spid, const mcUuid_t* uuidP, const uint8_t* taBin
rootpaerror_t ret=ROOTPA_OK;
mcResult_t result=0;
mcContainerState_t state;
-
+
result=regGetTaState(spid, uuidP, &state);
LOGD("storeTA, TA state %d, result 0x%x", state, result);
if(MC_DRV_ERR_INVALID_DEVICE_FILE == result)
@@ -344,14 +344,14 @@ rootpaerror_t storeTA(mcSpid_t spid, const mcUuid_t* uuidP, const uint8_t* taBin
ret=ROOTPA_ERROR_REGISTRY;
}
else
- {
+ {
result =regStoreTA(spid, uuidP, taBinP, taBinLength);
-
+
if(result != MC_DRV_OK)
{
LOGE("storeTA, storing TA failed, result from registry 0x%x", result);
ret=ROOTPA_ERROR_REGISTRY;
- }
+ }
}
return ret;
@@ -359,13 +359,16 @@ rootpaerror_t storeTA(mcSpid_t spid, const mcUuid_t* uuidP, const uint8_t* taBin
void dummyCallback(ProvisioningState state, rootpaerror_t error, tltInfo_t* tltInfoP)
{
+ (void) state;
+ (void) error;
+ (void) tltInfoP;
LOGD("dummy callback %d %d %ld", state, error, (long int) tltInfoP);
}
rootpaerror_t dummySysInfoCallback(osInfo_t* osSpecificInfoP)
{
LOGD("dummy sysinfo callback %ld", (long int) osSpecificInfoP);
- if(NULL==osSpecificInfoP) return ROOTPA_ERROR_INTERNAL;
+ if(NULL==osSpecificInfoP) return ROOTPA_ERROR_INTERNAL;
memset(osSpecificInfoP, 0, sizeof(osInfo_t));
return ROOTPA_OK;
}
@@ -388,9 +391,9 @@ typedef struct{
LOGD(">>provisioningThreadFunction %ld", (long int)((provisioningparams_t*)paramsP)->callbackP);
if((ret=openCmtlSession())==ROOTPA_OK)
{
- doProvisioningWithSe(((provisioningparams_t*)paramsP)->spid,
- ((provisioningparams_t*)paramsP)->suid,
- ((provisioningparams_t*)paramsP)->callbackP,
+ doProvisioningWithSe(((provisioningparams_t*)paramsP)->spid,
+ ((provisioningparams_t*)paramsP)->suid,
+ ((provisioningparams_t*)paramsP)->callbackP,
((provisioningparams_t*)paramsP)->sysInfoCallbackP,
getVersion,
((provisioningparams_t*)paramsP)->initialRel,
@@ -410,14 +413,13 @@ typedef struct{
free((char*)((provisioningparams_t*)paramsP)->tltInstallationDataP->tltPukHashP);
free(((provisioningparams_t*)paramsP)->tltInstallationDataP);
}
- free(paramsP); // Coverity complains that paramsP allocated in "provisioning" is not freed. It is done here.
-
+
LOGD("<<provisioningThreadFunction");
#ifdef WIN32
ExitThread(NULL);
#else
pthread_exit(NULL);
-#endif
+#endif
return NULL; // this is required by some compilers with some settings in order to avoid errors.
}
@@ -436,9 +438,9 @@ rootpaerror_t provision(mcSpid_t spid, CallbackFunctionP callbackP, SystemInfoCa
paramsP=(provisioningparams_t*)malloc(sizeof(provisioningparams_t));
if(!paramsP) return ROOTPA_ERROR_OUT_OF_MEMORY;
-
+
memset(paramsP,0,sizeof(provisioningparams_t)); // initialize in order to satisfy valgrind
-
+
paramsP->callbackP=callbackP;
paramsP->sysInfoCallbackP=systemInfoCallbackP;
paramsP->spid=spid;
@@ -449,21 +451,23 @@ rootpaerror_t provision(mcSpid_t spid, CallbackFunctionP callbackP, SystemInfoCa
if(!paramsP->tltInstallationDataP)
{
free(paramsP);
+ paramsP = NULL;
return ROOTPA_ERROR_OUT_OF_MEMORY;
}
// copy the whole struct
-
+
memset(paramsP->tltInstallationDataP,0,sizeof(trustletInstallationData_t)); // initialize in order to satisfy valgrind
memcpy(paramsP->tltInstallationDataP, tltDataP, sizeof(trustletInstallationData_t));
// malloc and copy data from/to the pointers
-
+
paramsP->tltInstallationDataP->dataP=(const uint8_t *)malloc(tltDataP->dataLength);
if(!paramsP->tltInstallationDataP->dataP)
{
free(paramsP->tltInstallationDataP);
free(paramsP);
+ paramsP = NULL;
return ROOTPA_ERROR_OUT_OF_MEMORY;
}
memset((char*)paramsP->tltInstallationDataP->dataP,0,tltDataP->dataLength); // initialize in order to satisfy valgrind
@@ -475,18 +479,19 @@ rootpaerror_t provision(mcSpid_t spid, CallbackFunctionP callbackP, SystemInfoCa
free((void*) paramsP->tltInstallationDataP->dataP);
free((void*) paramsP->tltInstallationDataP);
free(paramsP);
+ paramsP = NULL;
return ROOTPA_ERROR_OUT_OF_MEMORY;
- }
+ }
memset((char*)paramsP->tltInstallationDataP->tltPukHashP,0,tltDataP->tltPukHashLength); // initialize in order to satisfy valgrind
memcpy((char*)paramsP->tltInstallationDataP->tltPukHashP, tltDataP->tltPukHashP, tltDataP->tltPukHashLength);
}
else
{
- paramsP->tltInstallationDataP=NULL;
+ paramsP->tltInstallationDataP=NULL;
}
paramsP->initialRel = initialRel;
-
+
ret=ROOTPA_OK;
ret=getSuid(&paramsP->suid);
@@ -512,18 +517,19 @@ rootpaerror_t provision(mcSpid_t spid, CallbackFunctionP callbackP, SystemInfoCa
ret=ROOTPA_ERROR_INTERNAL;
}
else
- {
+ {
r=pthread_attr_setdetachstate(&attributes, PTHREAD_CREATE_DETACHED);
if(r)
{
LOGE("unable to set detached state, trying with defaults %d",r);
}
-
- r=pthread_create(&provisioningThread, &attributes, provisioningThreadFunction, (void*) paramsP);
+
+ r=pthread_create(&provisioningThread, &attributes, provisioningThreadFunction, (void*) paramsP);
if(r)
{
LOGE("unable to create thread %d",r);
free(paramsP);
+ paramsP = NULL;
ret=ROOTPA_ERROR_INTERNAL;
}
pthread_attr_destroy(&attributes);
@@ -532,9 +538,10 @@ rootpaerror_t provision(mcSpid_t spid, CallbackFunctionP callbackP, SystemInfoCa
}
else
{
- LOGE("provisioning can not get suid: %d",ret );
+ LOGE("provisioning can not get suid: %d",ret );
}
LOGD("<<provision ret: %d",ret );
+
return ret;
}
@@ -546,7 +553,7 @@ rootpaerror_t doProvisioning(mcSpid_t spid, CallbackFunctionP callbackP, SystemI
rootpaerror_t installTrustlet(mcSpid_t spid, CallbackFunctionP callbackP, SystemInfoCallbackFunctionP systemInfoCallbackP, trustletInstallationData_t* tltDataP)
{
- if(NULL == tltDataP || NULL == tltDataP->dataP || 0 == tltDataP->dataLength||
+ if(NULL == tltDataP || NULL == tltDataP->dataP || 0 == tltDataP->dataLength||
(REQUEST_DATA_TLT != tltDataP->dataType && REQUEST_DATA_KEY != tltDataP->dataType)) return ROOTPA_ERROR_ILLEGAL_ARGUMENT;
LOGD("installTrustlet");
return provision(spid, callbackP, systemInfoCallbackP, tltDataP, initialRel_POST);
diff --git a/mobicore/rootpa/Code/Common/contentmanager.c b/mobicore/rootpa/Code/Common/contentmanager.c
index 2f3c029..6a2ffeb 100644
--- a/mobicore/rootpa/Code/Common/contentmanager.c
+++ b/mobicore/rootpa/Code/Common/contentmanager.c
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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 <string.h>
#include <stdlib.h>
@@ -58,7 +58,7 @@ rootpaerror_t openCmtlSession()
{
closeCmtlSession();
}
-
+
handle_=tltChannelOpen(sizeOfCmp(), &error);
if(NULL==handle_)
{
@@ -70,20 +70,20 @@ rootpaerror_t openCmtlSession()
{
ret=ROOTPA_ERROR_MOBICORE_CONNECTION;
}
- }
+ }
return ret;
}
rootpaerror_t executeOneCmpCommand(CMTHANDLE handle, CmpMessage* commandP, CmpMessage* responseP);
rootpaerror_t executeContentManagementCommands(int numberOfCommands, CmpMessage* commandsP, CmpMessage* responsesP, uint32_t* internalError)
-{
+{
rootpaerror_t ret=ROOTPA_OK ;
rootpaerror_t iRet=ROOTPA_OK ;
bool selfOpened=false;
CMTHANDLE handle;
LOGD(">>executeContentManagementCommands");
-
+
*internalError=0;
if(handle_==NULL)
@@ -94,8 +94,8 @@ rootpaerror_t executeContentManagementCommands(int numberOfCommands, CmpMessage*
ret=openCmtlSession();
selfOpened=true;
}
- handle=handle_;
-
+ handle=handle_;
+
if (handle)
{
int i;
@@ -103,7 +103,7 @@ rootpaerror_t executeContentManagementCommands(int numberOfCommands, CmpMessage*
{
responsesP[i].hdr.id=commandsP[i].hdr.id; // match the id;
responsesP[i].hdr.ignoreError=commandsP[i].hdr.ignoreError;
-
+
if(commandsP[i].length>0)
{
if(((iRet=executeOneCmpCommand(handle, &commandsP[i], &responsesP[i]))!=ROOTPA_OK))
@@ -114,7 +114,7 @@ rootpaerror_t executeContentManagementCommands(int numberOfCommands, CmpMessage*
{
responsesP[i].hdr.ret=ret;
}
-
+
if(commandsP[i].hdr.ignoreError==false)
{
LOGE("executeContentManagementCommands, ignoreError==false, returning %d", ret);
@@ -125,7 +125,7 @@ rootpaerror_t executeContentManagementCommands(int numberOfCommands, CmpMessage*
else
{
LOGE("executeContentManagementCommands, empty command");
- }
+ }
}
if(ret!=ROOTPA_OK)
@@ -164,7 +164,7 @@ rootpaerror_t executeOneCmpCommand(CMTHANDLE handle, CmpMessage* commandP, CmpMe
rootpaerror_t ret;
uint32_t neededBytes;
LOGD(">>executeOneCmpCommand");
- if (unlikely( bad_write_ptr(handle,sizeof(CMTSTRUCT))))
+ if (unlikely( bad_write_ptr(handle,sizeof(CMTSTRUCT))))
{
return ROOTPA_ERROR_INTERNAL;
}
@@ -175,7 +175,7 @@ rootpaerror_t executeOneCmpCommand(CMTHANDLE handle, CmpMessage* commandP, CmpMe
mcRet=MC_DRV_OK;
commandId=getCmpCommandId(commandP->contentP);
-
+
handle->mappedSize=getTotalMappedBufferSize(commandP);
if(0==handle->mappedSize)
{
@@ -184,7 +184,7 @@ rootpaerror_t executeOneCmpCommand(CMTHANDLE handle, CmpMessage* commandP, CmpMe
}
ret=ROOTPA_OK;
- while(true)
+ while(true)
{
handle->mappedP=(uint8_t*)malloc((size_t) handle->mappedSize);
if(NULL==handle->mappedP)
@@ -224,15 +224,15 @@ rootpaerror_t executeOneCmpCommand(CMTHANDLE handle, CmpMessage* commandP, CmpMe
break;
}
- if(-1==neededBytes)
+ if((uint32_t)-1==neededBytes)
{
- ret=ROOTPA_ERROR_MOBICORE_CONNECTION;
+ ret=ROOTPA_ERROR_MOBICORE_CONNECTION;
break;
}
if(neededBytes <= handle->mappedSize)
{
- LOGE("executeOneCmpCommand, there is something wrong. CMTL is requesting smaller buffer than we originally had. Command: %d, original %d requested %d",
+ LOGE("executeOneCmpCommand, there is something wrong. CMTL is requesting smaller buffer than we originally had. Command: %d, original %d requested %d",
commandId, handle->mappedSize, neededBytes);
ret=ROOTPA_ERROR_MOBICORE_CONNECTION;
break;
@@ -270,10 +270,10 @@ rootpaerror_t executeOneCmpCommand(CMTHANDLE handle, CmpMessage* commandP, CmpMe
LOGE("executeOneCmpCommand not able to free mapped memory %d", mcRet);
ret=ROOTPA_ERROR_MOBICORE_CONNECTION;
}
- LOGD("freeing mapped memory %ld", (long int) handle->mappedP);
- free(handle->mappedP);
+ LOGD("freeing mapped memory %ld", (long int) handle->mappedP);
+ free(handle->mappedP);
if(commandP->hdr.ret==ROOTPA_OK) commandP->hdr.ret=ret;
- if(responseP->hdr.ret==ROOTPA_OK) responseP->hdr.ret=ret;
+ if(responseP->hdr.ret==ROOTPA_OK) responseP->hdr.ret=ret;
LOGD("<<executeOneCmpCommand %d %d",commandId, ret);
return ret;
}
diff --git a/mobicore/rootpa/Code/Common/contentmanager.h b/mobicore/rootpa/Code/Common/contentmanager.h
index 57b4d66..165e8f1 100644
--- a/mobicore/rootpa/Code/Common/contentmanager.h
+++ b/mobicore/rootpa/Code/Common/contentmanager.h
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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 CONTENTMANAGER_H
#define CONTENTMANAGER_H
diff --git a/mobicore/rootpa/Code/Common/enrollmentservicexmlschema.h b/mobicore/rootpa/Code/Common/enrollmentservicexmlschema.h
index 943f8ed..4f326b4 100644
--- a/mobicore/rootpa/Code/Common/enrollmentservicexmlschema.h
+++ b/mobicore/rootpa/Code/Common/enrollmentservicexmlschema.h
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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 ENROLLMENTSERVICEXMLSCHEMA_H
#define ENROLLMENTSERVICEXMLSCHEMA_H
diff --git a/mobicore/rootpa/Code/Common/include/logging.h b/mobicore/rootpa/Code/Common/include/logging.h
index 35f51e3..034bfd7 100644
--- a/mobicore/rootpa/Code/Common/include/logging.h
+++ b/mobicore/rootpa/Code/Common/include/logging.h
@@ -1,49 +1,51 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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 LOGGING_H
#define LOGGING_H
+#ifndef LOG_TAG
#define LOG_TAG "RootPA-C"
+#endif
#ifdef ANDROID
#include <android/log.h>
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
#define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__))
#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__))
- #ifdef __DEBUG
+ #ifdef __DEBUG
#define LOGD(...) ((void)__android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__))
#else
#define LOGD(scite ...)
- #endif
+ #endif
#else
#ifdef WIN32
#include <stdio.h>
@@ -56,8 +58,8 @@ OF THE POSSIBILITY OF SUCH DAMAGE.
extern "C" void MyOutputFunctionC(const char *str, ...);
- #define LOGE(fmt, ...) MyOutputFunction(fmt "\n", ##__VA_ARGS__)
- #define LOGW(fmt, ...) MyOutputFunction(fmt "\n", ##__VA_ARGS__)
+ #define LOGE(fmt, ...) MyOutputFunction(fmt "\n", ##__VA_ARGS__)
+ #define LOGW(fmt, ...) MyOutputFunction(fmt "\n", ##__VA_ARGS__)
#define LOGI(fmt, ...) MyOutputFunction(fmt "\n", ##__VA_ARGS__)
#ifdef __DEBUG
@@ -67,8 +69,8 @@ OF THE POSSIBILITY OF SUCH DAMAGE.
#endif
#else
- #define LOGE(fmt, ...) MyOutputFunctionC(fmt "\n", ##__VA_ARGS__)
- #define LOGW(fmt, ...) MyOutputFunctionC(fmt "\n", ##__VA_ARGS__)
+ #define LOGE(fmt, ...) MyOutputFunctionC(fmt "\n", ##__VA_ARGS__)
+ #define LOGW(fmt, ...) MyOutputFunctionC(fmt "\n", ##__VA_ARGS__)
#define LOGI(fmt, ...) MyOutputFunctionC(fmt "\n", ##__VA_ARGS__)
#ifdef __DEBUG
@@ -80,14 +82,21 @@ OF THE POSSIBILITY OF SUCH DAMAGE.
#endif
#else
- #define LOGE(fmt, ...) printf(fmt "\n", ##__VA_ARGS__)
- #define LOGW(fmt, ...) printf(fmt "\n", ##__VA_ARGS__)
+#ifdef TIZEN
+ #include <stdio.h>
+#endif /*Tizen*/
+ #define LOGE(fmt, ...) printf(fmt "\n", ##__VA_ARGS__)
+ #define LOGW(fmt, ...) printf(fmt "\n", ##__VA_ARGS__)
#define LOGI(fmt, ...) printf(fmt "\n", ##__VA_ARGS__)
#ifdef __DEBUG
#define LOGD(fmt, ...) printf(fmt "\n", ##__VA_ARGS__)
#else
+#ifdef TIZEN
+ #define LOGD(fmt, ...) do { } while(0)
+#else
#define LOGD(fmt, ...)
- #endif
+#endif/*Tizen*/
+ #endif
#endif // WIN32
#endif // ANDROID
#endif // LOGGING_H
diff --git a/mobicore/rootpa/Code/Common/include/provisioningagent.h b/mobicore/rootpa/Code/Common/include/provisioningagent.h
index 97553bd..bf47bcb 100644
--- a/mobicore/rootpa/Code/Common/include/provisioningagent.h
+++ b/mobicore/rootpa/Code/Common/include/provisioningagent.h
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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 PROVISIONINGAGENT_H
#define PROVISIONINGAGENT_H
@@ -44,9 +44,9 @@ extern "C" {
#include "rootpa.h"
/**
-since the CMP commands that require authentication need to be executed during
-the same session the actual authentication, the client needs to handle opening
-and closing the session before
+since the CMP commands that require authentication need to be executed during
+the same session the actual authentication, the client needs to handle opening
+and closing the session before
*/
rootpaerror_t openSessionToCmtl();
void closeSessionToCmtl();
@@ -54,21 +54,21 @@ void closeSessionToCmtl();
/**
Executes all given content management protocol commands in the order they are given and returns response to all of them.
-The calling operating system specific part has to take care that no other calls are executed before
+The calling operating system specific part has to take care that no other calls are executed before
executeCmpCommands has exited.
-@param numberOfCommands number of commands given in this request. The array of
- commands and responses must be allocated with the same
+@param numberOfCommands number of commands given in this request. The array of
+ commands and responses must be allocated with the same
number of CmpMessage structs.
@param commandsP an array of commands to be executed. The commands will be executed in the given order.
-@param responsesP an array of responses that have to be empty when the call is made.
- Memory for the responses need to be freed (with free) by the caller,
+@param responsesP an array of responses that have to be empty when the call is made.
+ Memory for the responses need to be freed (with free) by the caller,
after the call.
@param internalError if returning an error, rootPA copies here error code it received from Cmtl or MC.
-@return one of the return values defined in rootpaErrors.h ROOTPA_OK in case the call is successful.
- Note that when ROOTPA_ERROR_COMMAND_EXECUTION is returned, execution of some of the commands
- may have been successful. The status of individual commands can be checked from the actual
- content of the individual response.
+@return one of the return values defined in rootpaErrors.h ROOTPA_OK in case the call is successful.
+ Note that when ROOTPA_ERROR_COMMAND_EXECUTION is returned, execution of some of the commands
+ may have been successful. The status of individual commands can be checked from the actual
+ content of the individual response.
*/
rootpaerror_t executeCmpCommands(int numberOfCommands, CmpMessage* commandsP, CmpMessage* responsesP, uint32_t* internalError);
@@ -76,14 +76,14 @@ rootpaerror_t executeCmpCommands(int numberOfCommands, CmpMessage* commandsP, Cm
/**
Obtains and returns version information from CMTL
-The calling operating system specific part has to take care that no other calls are executed before
+The calling operating system specific part has to take care that no other calls are executed before
the command has exited.
@param tag version of the version. See mcVersionInfo_t for more information.
-@param versionP version information. In case version info tag is 1, the version
+@param versionP version information. In case version info tag is 1, the version
is written in the first four bytes of mcVersionInfo_t.productId
-@return one of the return values defined in rootpaErrors.h ROOTPA_OK in case the call is successful.
+@return one of the return values defined in rootpaErrors.h ROOTPA_OK in case the call is successful.
*/
rootpaerror_t getVersion(int* tag, mcVersionInfo_t* versionP);
@@ -91,11 +91,11 @@ rootpaerror_t getVersion(int* tag, mcVersionInfo_t* versionP);
/**
Returns SUID
-The calling operating system specific part has to take care that no other calls are executed before
+The calling operating system specific part has to take care that no other calls are executed before
the command has exited.
@param suidP pointer to the emory area where the suid is copied to
-@return one of the return values defined in rootpaErrors.h ROOTPA_OK in case the call is successful.
+@return one of the return values defined in rootpaErrors.h ROOTPA_OK in case the call is successful.
*/
rootpaerror_t getSuid(mcSuid_t* suidP);
@@ -103,7 +103,7 @@ rootpaerror_t getSuid(mcSuid_t* suidP);
/**
@param isRegisteredP writes here true if the container is registered, false otherwise
-@return one of the return values defined in rootpaErrors.h ROOTPA_OK in case the call is successful.
+@return one of the return values defined in rootpaErrors.h ROOTPA_OK in case the call is successful.
*/
rootpaerror_t isRootContainerRegistered(bool* isRegisteredP);
@@ -113,7 +113,7 @@ rootpaerror_t isRootContainerRegistered(bool* isRegisteredP);
@param spid service provider id
@param isRegisteredP writes here true if the container is registered, false otherwise
-@return one of the return values defined in rootpaErrors.h ROOTPA_OK in case the call is successful.
+@return one of the return values defined in rootpaErrors.h ROOTPA_OK in case the call is successful.
*/
rootpaerror_t isSpContainerRegistered(mcSpid_t spid, bool* isRegisteredP);
@@ -124,7 +124,7 @@ rootpaerror_t isSpContainerRegistered(mcSpid_t spid, bool* isRegisteredP);
@param spid service provider id
@param stateP writes here the state of the container
@return one of the return values defined in rootpaErrors.h ROOTPA_OK in case the call is successful,
- ROOTPA_ERROR_INTERNAL_NO_CONTAINER if the container does not exist.
+ ROOTPA_ERROR_INTERNAL_NO_CONTAINER if the container does not exist.
*/
rootpaerror_t getSpContainerState(mcSpid_t spid, mcContainerState_t* stateP);
@@ -135,62 +135,62 @@ rootpaerror_t getSpContainerState(mcSpid_t spid, mcContainerState_t* stateP);
@param spid service provider id
@param spContainerStructureP writes here the structure of the container. The structure must be allocated before the call.
@return one of the return values defined in rootpaErrors.h ROOTPA_OK in case the call is successful,
- ROOTPA_ERROR_INTERNAL_NO_CONTAINER if the container does not exist.
+ ROOTPA_ERROR_INTERNAL_NO_CONTAINER if the container does not exist.
*/
rootpaerror_t getSpContainerStructure(mcSpid_t spid, SpContainerStructure* spContainerStructureP);
/**
-Creates a thread and returns, the thread contacts SE and executes the commands received from SE.
+Creates a thread and returns, the thread contacts SE and executes the commands received from SE.
-The state of the execution is informed in the calls to callback. The last callback, just before
+The state of the execution is informed in the calls to callback. The last callback, just before
the thread exits contains always state PROVISIONING_STATE_THREAD_EXITING.
-The calling operating system specific part has to take care that no other calls are executed before
+The calling operating system specific part has to take care that no other calls are executed before
doProvisioning and the actual provisioining thread have exited.
@param spid service provider id
-@param callbackP callback function that handles information delivery to operating system specific client.
- This is called at different states of provisioining (see type ProvisioningState to find out more
- about the states). Since doProvisioining executes it's own thread the callback function has to be
+@param callbackP callback function that handles information delivery to operating system specific client.
+ This is called at different states of provisioining (see type ProvisioningState to find out more
+ about the states). Since doProvisioining executes it's own thread the callback function has to be
thread safe.
-@param systemInfoCallbackP pointer to a function that can provide RootPA system information
- that is only available in the operting system specific part. Since doProvisioining executes it's own thread the
+@param systemInfoCallbackP pointer to a function that can provide RootPA system information
+ that is only available in the operting system specific part. Since doProvisioining executes it's own thread the
callback function has to be thread safe.
-@return ROOTPA_OK on success and and error code if thread creation fails. The results of actual execution of
+@return ROOTPA_OK on success and and error code if thread creation fails. The results of actual execution of
the provisioining are returned in the callback functions.
*/
rootpaerror_t doProvisioning(mcSpid_t spid, CallbackFunctionP callbackP, SystemInfoCallbackFunctionP systemInfoCallbackP);
/**
-Creates a thread and returns, the thread contacts SE and executes the commands received from SE.
+Creates a thread and returns, the thread contacts SE and executes the commands received from SE.
This is similar to do provisioning but takes in information on trustlet to be installed and asks SE
to "install the trustlet". This is used for testing and developer trustlet installation.
-The state of the execution is informed in the calls to callback. The last callback, just before
+The state of the execution is informed in the calls to callback. The last callback, just before
the thread exits contains always state PROVISIONING_STATE_THREAD_EXITING.
-The calling operating system specific part has to take care that no other calls are executed before
+The calling operating system specific part has to take care that no other calls are executed before
doProvisioning and the actual provisioining thread have exited.
@param spid service provider id
-@param callbackP callback function that handles information delivery to operating system specific client.
- This is called at different states of provisioining (see type ProvisioningState to find out more
- about the states). Since doProvisioining executes it's own thread the callback function has to be
+@param callbackP callback function that handles information delivery to operating system specific client.
+ This is called at different states of provisioining (see type ProvisioningState to find out more
+ about the states). Since doProvisioining executes it's own thread the callback function has to be
thread safe.
-@param systemInfoCallbackP pointer to a function that can provide RootPA system information
- that is only available in the operting system specific part. Since doProvisioining executes it's own thread the
+@param systemInfoCallbackP pointer to a function that can provide RootPA system information
+ that is only available in the operting system specific part. Since doProvisioining executes it's own thread the
callback function has to be thread safe.
@param dataP pointer to the data needed in trutlet installation
-@return ROOTPA_OK on success and and error code if thread creation fails. ROOTPA_ERROR_ILLEGAL_ARGUMENT if dataP is NULL.
+@return ROOTPA_OK on success and and error code if thread creation fails. ROOTPA_ERROR_ILLEGAL_ARGUMENT if dataP is NULL.
The results of actual execution of the provisioining are returned in the callback functions.
*/
rootpaerror_t installTrustlet(mcSpid_t spid, CallbackFunctionP callbackP, SystemInfoCallbackFunctionP systemInfoCallbackP, trustletInstallationData_t* dataP);
@@ -226,7 +226,7 @@ Store's the GP TA binary to the registry. The corresponding TA container has to
rootpaerror_t storeTA(mcSpid_t spid, const mcUuid_t* uuidP, const uint8_t* taBinP, uint32_t taBinLength);
/**
-This is helper function for the platform dependent part to inform the platform independent part
+This is helper function for the platform dependent part to inform the platform independent part
on the file storage location
@param storageDirP NULL terminated char array containing the path to the storage location
@@ -237,9 +237,9 @@ on the file storage location
void setPaths(const char* storageDirP, const char* certDirP);
/**
-This is helper function for setting SE address.
+This is helper function for setting SE address.
-@param addrP pointer to the address, it can but does not need to be null terminated. The address needs
+@param addrP pointer to the address, it can but does not need to be null terminated. The address needs
to begin with "http(s)://" and end with "/".
@param length length of the address
@return ROOTPA_OK is setting succeeded, an error code otherwise
@@ -247,7 +247,7 @@ This is helper function for setting SE address.
rootpaerror_t setSeAddress(const char* addrP, uint32_t length);
#ifdef __cplusplus
-}
+}
#endif
#endif // PROVISIONINGAGENT_H
diff --git a/mobicore/rootpa/Code/Common/include/rootpa.h b/mobicore/rootpa/Code/Common/include/rootpa.h
index ce293e5..b694b92 100644
--- a/mobicore/rootpa/Code/Common/include/rootpa.h
+++ b/mobicore/rootpa/Code/Common/include/rootpa.h
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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 ROOTPA_H
#define ROOTPA_H
@@ -56,9 +56,9 @@ typedef enum {
PROVISIONING_STATE_THREAD_EXITING=0xDEAD
} ProvisioningState;
-typedef struct
+typedef struct
{
- char* imeiEsnP; // IMEI or ESN (CDMA) code
+ char* imeiEsnP; // IMEI or ESN (CDMA) code
char* mnoP; // network operator (based on the SIM card, not current network)
char* brandP;
char* manufacturerP;
@@ -74,15 +74,15 @@ typedef struct
} tltInfo_t;
/**
- callback function that has to be imlemented in the os specific wrapper. RootPA calls this at various stages of
- provisioning, depending on the messages sent by SE. Note that PROVISIONING_STATE_THREAD_EXITING is always the
+ callback function that has to be imlemented in the os specific wrapper. RootPA calls this at various stages of
+ provisioning, depending on the messages sent by SE. Note that PROVISIONING_STATE_THREAD_EXITING is always the
last state, even if errors are retrned beforehand. This alows the wrapper to perform necessary cleanup actions
just before the provisioning thread exists
@param st state of the provisioning
@param err in case the state is ERROR, this field contains error code, otherwise the value is indetermined
- @param tltInfo, in case the state is PROVISIONING_STATE_INSTALL_TRUSTLET this field contains information on
- the trustlet to be installed. The callback function has to copy the trustlet before it returns.
+ @param tltInfo, in case the state is PROVISIONING_STATE_INSTALL_TRUSTLET this field contains information on
+ the trustlet to be installed. The callback function has to copy the trustlet before it returns.
In other states the field is NULL.
*/
typedef void (*CallbackFunctionP)(ProvisioningState st, rootpaerror_t err, tltInfo_t* tltInfo);
@@ -90,7 +90,7 @@ typedef void (*CallbackFunctionP)(ProvisioningState st, rootpaerror_t err, tltIn
/**
callback function for RootPA to get information on the device. The os specific part needs to reserve the memory
to the pointers of osInfo_t with malloc, RootPA the frees it when it does not need it anymore. Possible memory
- allocation and relase for the actual osInfo_t struct is in the hands of the wrapper.
+ allocation and relase for the actual osInfo_t struct is in the hands of the wrapper.
*/
typedef rootpaerror_t (*SystemInfoCallbackFunctionP)(osInfo_t* );
@@ -144,35 +144,35 @@ typedef struct
{
/**
UUID of the trustlet container
- */
+ */
mcUuid_t uuid;
/**
state of the trustlet container
- */
- int state;
+ */
+ int state;
} TltContainerData;
typedef struct
{
/**
state of the servce provider container
- */
+ */
int state;
/**
number of trustlets in the container
- */
+ */
int nbrOfTlts;
/**
array of trustlet containers in the service provider container. Only the number of elements indicated in nbrOfTlts are set.
- */
+ */
TltContainerData tltContainers[MC_CONT_CHILDREN_COUNT];
} SpContainerStructure;
typedef enum {
- REQUEST_DATA_NO_DATA=0,
+ REQUEST_DATA_NO_DATA=0,
REQUEST_DATA_TLT=1,
REQUEST_DATA_KEY=2
}TltInstallationRequestDataType;
@@ -181,7 +181,7 @@ typedef struct {
/**
pointer to either the trustlet binary or encryption key, depending on the request type
*/
- const uint8_t* dataP;
+ const uint8_t* dataP;
/**
length of the data pointed by the pointer
*/
@@ -194,7 +194,7 @@ typedef struct {
uuid of the trustlet
*/
mcUuid_t uuid;
-
+
/**
minimum version of the trustlet
*/
@@ -211,9 +211,9 @@ typedef struct {
uint32_t tltPukHashLength;
/**
- memory where the trustlet is to be loaded and executed:
- 0 - if enough space is available, load the Trustlet into the internal memory, otherwise into the external memory,
- 1 - internal memory,
+ memory where the trustlet is to be loaded and executed:
+ 0 - if enough space is available, load the Trustlet into the internal memory, otherwise into the external memory,
+ 1 - internal memory,
2 - external memory
*/
uint32_t memoryType;
@@ -222,16 +222,16 @@ typedef struct {
indicates how many instances of a trustlet can be installed (run) in parallel
*/
uint32_t numberOfInstances;
-
+
/**
current flags are: 1 - permanent, 2 - service has no WSW control interface, 4 - debuggable
*/
uint32_t flags;
-
+
}trustletInstallationData_t;
#ifdef __cplusplus
-}
+}
#endif
#endif // ROOTPA_H
diff --git a/mobicore/rootpa/Code/Common/include/rootpaErrors.h b/mobicore/rootpa/Code/Common/include/rootpaErrors.h
index 7d98755..1419ef8 100644
--- a/mobicore/rootpa/Code/Common/include/rootpaErrors.h
+++ b/mobicore/rootpa/Code/Common/include/rootpaErrors.h
@@ -1,38 +1,38 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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 ROOTPAERRORS_H
#define ROOTPAERRORS_H
-#include<stdint.h>
+#include<stdint.h>
typedef uint32_t rootpaerror_t;
@@ -53,7 +53,7 @@ NOTE to the maintainer. These values and documentation needs to be in line with
#define ROOTPA_COMMAND_NOT_SUPPORTED 0x00000001
#define STRING_ROOTPA_COMMAND_NOT_SUPPORTED "COMMAND_NOT_SUPPORTED_ERROR"
-/**
+/**
Either rootpa is locked by another client, or the client requests lock or unlock when it is not allowed to do that.
Possible steps to recover: wait until the lock is released
*/
@@ -66,11 +66,11 @@ Possible steps to recover: wait until the lock is released
#define ROOTPA_ERROR_COMMAND_EXECUTION 0x00000003
#define STRING_ROOTPA_ERROR_COMMAND_EXECUTION "COMMAND_EXECUTION_ERROR"
-/**
+/**
Registry returned an error when trying to write a container. mcDaemon could be dead or something seriously wrong in the file system.
Possible steps to recover: rebooting the device may help
*/
-#define ROOTPA_ERROR_REGISTRY 0x00000004
+#define ROOTPA_ERROR_REGISTRY 0x00000004
#define STRING_ROOTPA_ERROR_REGISTRY "REGISTRY_ERROR"
/**
@@ -80,59 +80,59 @@ Possible steps to recover: rebooting the device may help
#define ROOTPA_ERROR_MOBICORE_CONNECTION 0x00000005
#define STRING_ROOTPA_ERROR_MOBICORE_CONNECTION "MOBICORE_CONNECTION_ERROR"
-/**
+/**
Either Nwd or Swd software is out of memory.
Possible steps to recover: release memory
*/
#define ROOTPA_ERROR_OUT_OF_MEMORY 0x00000006
#define STRING_ROOTPA_ERROR_OUT_OF_MEMORY "OUT_OF_MEMORY_ERROR"
-/**
+/**
Rootpa internal error. This error is returned in various situations when something unexpected went wrong e.g. message from CMTL can‘t be interpreted, SE returned an error indicating invalid data, bad request or similar or base64 decoding failed
Possible steps to recover: rebooting or updating the device may help
*/
#define ROOTPA_ERROR_INTERNAL 0x00000007
#define STRING_ROOTPA_ERROR_INTERNAL "INTERNAL_ERROR"
-/**
+/**
Given argument is not allowed (in many cases it is NULL) or e.g. the format of xml is unsupported.
Possible steps to recover: give correct argument
*/
#define ROOTPA_ERROR_ILLEGAL_ARGUMENT 0x00000008
-/**
+/**
Error in network connection or use of networking library.
Possible steps to recover: create working network connection (avoid firewalls and proxies that require password)
*/
#define ROOTPA_ERROR_NETWORK 0x00000009
-/**
+/**
Error returned by XML library. Problems in parsing received XML command or creating new XML response.
*/
#define ROOTPA_ERROR_XML 0x0000000A
#define STRING_ROOTPA_ERROR_XML "XML_ERROR"
-/**
+/**
Registry returned an error when trying to read a container. Most likely the container does not exist.
*/
#define ROOTPA_ERROR_REGISTRY_OBJECT_NOT_AVAILABLE 0x0000000B
#define STRING_ROOTPA_ERROR_REGISTRY_OBJECT_NOT_AVAILABLE "REGISTRY_OBJECT_NOT_AVAILABLE"
-/**
+/**
CMP version of the device is not supported by SE.
Possible steps to recover: use CMP version supported by SE (>=3.0)
*/
#define ROOTPA_ERROR_SE_CMP_VERSION 0x0000000C
-/**
-Precoditions for SP container installation are not met in SE.
+/**
+Precoditions for SP container installation are not met in SE.
Possible steps to recover: register used SPID to SE
*/
#define ROOTPA_ERROR_SE_PRECONDITION_NOT_MET 0x0000000D
-/**
+/**
Requested SP container does not exist. This is not always considered an error but is used as an informative return code. As this is internal return code, user of RootPA services should never see this.
Possible steps to recover: add SP container or request container with different SPID
*/
diff --git a/mobicore/rootpa/Code/Common/include/version.h b/mobicore/rootpa/Code/Common/include/version.h
index fb5d2a8..bed8f80 100644
--- a/mobicore/rootpa/Code/Common/include/version.h
+++ b/mobicore/rootpa/Code/Common/include/version.h
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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.
+ */
/** @addtogroup ROOTPA
*/
@@ -35,6 +35,6 @@ OF THE POSSIBILITY OF SUCH DAMAGE.
#define ROOTPA_VERSION_H_
#define ROOTPA_VERSION_MAJOR 3
-#define ROOTPA_VERSION_MINOR 79
+#define ROOTPA_VERSION_MINOR 89
#endif /** ROOTPA_VERSION_H_ */
diff --git a/mobicore/rootpa/Code/Common/include/wrapper.h b/mobicore/rootpa/Code/Common/include/wrapper.h
index baaada4..5490c61 100644
--- a/mobicore/rootpa/Code/Common/include/wrapper.h
+++ b/mobicore/rootpa/Code/Common/include/wrapper.h
@@ -1,3 +1,33 @@
+/*
+ * Copyright (c) 2013 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 WRAPPER_H_
#define WRAPPER_H_
diff --git a/mobicore/rootpa/Code/Common/pacmp3.c b/mobicore/rootpa/Code/Common/pacmp3.c
index 874683d..b931566 100644
--- a/mobicore/rootpa/Code/Common/pacmp3.c
+++ b/mobicore/rootpa/Code/Common/pacmp3.c
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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 <string.h>
#include <stdlib.h>
@@ -38,9 +38,9 @@ OF THE POSSIBILITY OF SUCH DAMAGE.
#include "tools.h"
#include "logging.h"
#include "rootpaErrors.h"
-#include "pacmtl.h"
-#include "pacmp3.h"
-#include "registry.h"
+#include "pacmtl.h"
+#include "pacmp3.h"
+#include "registry.h"
static mcSpid_t spid_;
static mcUuid_t tltUuid_;
@@ -51,7 +51,7 @@ void setCallbackP(CallbackFunctionP callbackP)
callbackP_=callbackP;
}
-// recovery from factory reset
+// recovery from factory reset
bool factoryResetAssumed()
{
uint32_t contSize=0;
@@ -71,7 +71,7 @@ bool factoryResetAssumed()
return false;
}
- // if neither root container, nor auth token container exists, we assume that factory reset has been performed.
+ // if neither root container, nor auth token container exists, we assume that factory reset has been performed.
if(MC_DRV_ERR_INVALID_DEVICE_FILE==result1 && MC_DRV_ERR_INVALID_DEVICE_FILE==result2)
{
LOGD("factoryResetAssumed returning true");
@@ -80,7 +80,7 @@ bool factoryResetAssumed()
return false;
}
-// recovery from factory reset
+// recovery from factory reset
/*
*/
@@ -126,7 +126,7 @@ bool ensureMappedBufferSize(CMTHANDLE handle, uint32_t neededSize)
LOGE("ensureMappedBufferSize, unable to allocate more memory %d", neededSize);
return false;
}
- handle->mappedP = newMappedP;
+ handle->mappedP = newMappedP;
}
return true;
}
@@ -135,7 +135,7 @@ rootpaerror_t addAuthTokenContainer(uint32_t* indexP, uint32_t* offsetP, CMTHAND
{
rootpaerror_t ret=ROOTPA_ERROR_OUT_OF_MEMORY;
AUTHTOKENCONTAINERP authTokenP = NULL;
- uint32_t contSize=0;
+ uint32_t contSize=0;
if((*mcRetP=regReadAuthToken(&authTokenP, &contSize))==MC_DRV_OK)
{
@@ -162,7 +162,7 @@ rootpaerror_t addRootContainer(uint32_t* indexP, uint32_t* offsetP, CMTHANDLE ha
{
rootpaerror_t ret=ROOTPA_ERROR_OUT_OF_MEMORY;
ROOTCONTAINERP rootP = NULL;
- uint32_t contSize=0;
+ uint32_t contSize=0;
if((*mcRetP=regReadRoot(&rootP, &contSize))==MC_DRV_OK)
{
@@ -189,7 +189,7 @@ rootpaerror_t addSpContainer(uint32_t* indexP, uint32_t* offsetP, mcSpid_t spid,
{
rootpaerror_t ret=ROOTPA_ERROR_OUT_OF_MEMORY;
SPCONTAINERP spP = NULL;
- uint32_t contSize=0;
+ uint32_t contSize=0;
if((*mcRetP=regReadSp(spid, &spP, &contSize))==MC_DRV_OK)
{
@@ -199,7 +199,7 @@ rootpaerror_t addSpContainer(uint32_t* indexP, uint32_t* offsetP, mcSpid_t spid,
setCmdElementInfo(indexP, handle->wsmP, offsetP, contSize);
ret=ROOTPA_OK;
}
- }
+ }
else if (MC_DRV_ERR_INVALID_DEVICE_FILE==*mcRetP)
{
ret=ROOTPA_ERROR_REGISTRY_OBJECT_NOT_AVAILABLE;
@@ -218,11 +218,11 @@ rootpaerror_t addTltContainer(uint32_t* indexP, uint32_t* offsetP, const mcUuid_
rootpaerror_t ret=ROOTPA_ERROR_OUT_OF_MEMORY;
TLTCONTAINERP tltP = NULL;
uint32_t contSize=0;
-
+
if((*mcRetP=regReadTlt(uuidP, &tltP, &contSize, spid))==MC_DRV_OK)
{
if(ensureMappedBufferSize(handle, (*offsetP) + contSize))
- {
+ {
memcpy(handle->mappedP+(*offsetP),tltP,contSize);
setCmdElementInfo(indexP, handle->wsmP, offsetP, contSize);
ret=ROOTPA_OK;
@@ -251,14 +251,14 @@ rootpaerror_t prepareCommand(cmpCommandId_t commandId, CmpMessage* inCommandP,
rootpaerror_t ret=ROOTPA_OK;
mcResult_t mcRet=MC_DRV_OK;
LOGI("prepareCommand command id %d length %d", commandId, inCommandP->length); // this is LOGI level on purpose to indicate that CMP command has reached RootPA
-
+
memset(handle->wsmP,0,sizeOfCmp());
setCmdMapInfo(handle->wsmP, &handle->mapInfo);
setCmdCmpVersionAndCmdId(handle->wsmP, commandId);
setCmdElementInfo(&elementIndex, handle->wsmP, &offset, inCommandP->length);
if(ensureMappedBufferSize(handle, inCommandP->length))
- {
+ {
memcpy(handle->mappedP, inCommandP->contentP, inCommandP->length);
}
else
@@ -270,36 +270,36 @@ rootpaerror_t prepareCommand(cmpCommandId_t commandId, CmpMessage* inCommandP,
{
case MC_CMP_CMD_BEGIN_SOC_AUTHENTICATION:
if (callbackP_) callbackP_(AUTHENTICATING_SOC, ROOTPA_OK, NULL);
- ret=addAuthTokenContainer(&elementIndex, &offset, handle, &mcRet);
+ ret=addAuthTokenContainer(&elementIndex, &offset, handle, &mcRet);
break;
case MC_CMP_CMD_BEGIN_ROOT_AUTHENTICATION:
if (callbackP_) callbackP_(AUTHENTICATING_ROOT, ROOTPA_OK, NULL);
- ret=addRootContainer(&elementIndex, &offset, handle, &mcRet);
- break;
-
+ ret=addRootContainer(&elementIndex, &offset, handle, &mcRet);
+ break;
+
case MC_CMP_CMD_BEGIN_SP_AUTHENTICATION:
ret=addRootContainer(&elementIndex, &offset, handle, &mcRet);
if(ROOTPA_OK==ret)
{
mcSpid_t spid=((cmpCmdBeginSpAuthentication_t*)outCommandP)->cmd.spid;
- ret=addSpContainer(&elementIndex, &offset, spid, handle, &mcRet);
+ ret=addSpContainer(&elementIndex, &offset, spid, handle, &mcRet);
}
break;
case MC_CMP_CMD_ROOT_CONT_REGISTER_ACTIVATE:
if (callbackP_) callbackP_(CREATING_ROOT_CONTAINER, ROOTPA_OK, NULL);
break;
-
+
case MC_CMP_CMD_ROOT_CONT_UNREGISTER:
if (callbackP_) callbackP_(UNREGISTERING_ROOT_CONTAINER, ROOTPA_OK, NULL);
- break;
-
+ break;
+
case MC_CMP_CMD_SP_CONT_ACTIVATE:
spid_=((cmpCmdSpContActivate_t*)outCommandP)->cmd.sdata.spid;
break;
case MC_CMP_CMD_SP_CONT_LOCK_BY_ROOT:
spid_=((cmpCmdSpContLockByRoot_t*)outCommandP)->cmd.sdata.spid;
- ret=addSpContainer(&elementIndex, &offset, spid_, handle, &mcRet);
+ ret=addSpContainer(&elementIndex, &offset, spid_, handle, &mcRet);
break;
case MC_CMP_CMD_SP_CONT_LOCK_BY_SP :
spid_=((cmpCmdSpContLockBySp_t*)outCommandP)->cmd.sdata.spid;
@@ -314,7 +314,7 @@ rootpaerror_t prepareCommand(cmpCommandId_t commandId, CmpMessage* inCommandP,
break;
case MC_CMP_CMD_SP_CONT_UNLOCK_BY_ROOT:
spid_=((cmpCmdSpContUnlockByRoot_t*)outCommandP)->cmd.sdata.spid;
- ret=addSpContainer(&elementIndex, &offset, spid_, handle, &mcRet);
+ ret=addSpContainer(&elementIndex, &offset, spid_, handle, &mcRet);
break;
case MC_CMP_CMD_SP_CONT_UNLOCK_BY_SP :
spid_=((cmpCmdSpContUnlockBySp_t*)outCommandP)->cmd.sdata.spid;
@@ -325,7 +325,7 @@ rootpaerror_t prepareCommand(cmpCommandId_t commandId, CmpMessage* inCommandP,
case MC_CMP_CMD_TLT_CONT_ACTIVATE:
spid_=((cmpCmdTltContActivate_t*)outCommandP)->cmd.sdata.spid;
memcpy(&tltUuid_,&((cmpCmdTltContActivate_t*)outCommandP)->cmd.sdata.uuid, sizeof(mcUuid_t));
- ret=addTltContainer(&elementIndex, &offset, &tltUuid_, spid_, handle, &mcRet);
+ ret=addTltContainer(&elementIndex, &offset, &tltUuid_, spid_, handle, &mcRet);
break;
case MC_CMP_CMD_TLT_CONT_LOCK_BY_SP:
spid_=((cmpCmdTltContLockBySp_t*)outCommandP)->cmd.sdata.spid;
@@ -333,14 +333,14 @@ rootpaerror_t prepareCommand(cmpCommandId_t commandId, CmpMessage* inCommandP,
ret=addTltContainer(&elementIndex, &offset, &tltUuid_, spid_, handle, &mcRet);
break;
case MC_CMP_CMD_TLT_CONT_PERSONALIZE:
- ret=addTltContainer(&elementIndex, &offset, &((cmpCmdTltContPersonalize_t*)outCommandP)->cmd.sdata.uuid,
+ ret=addTltContainer(&elementIndex, &offset, &((cmpCmdTltContPersonalize_t*)outCommandP)->cmd.sdata.uuid,
((cmpCmdTltContPersonalize_t*)outCommandP)->cmd.sdata.spid,
handle, &mcRet);
break;
case MC_CMP_CMD_TLT_CONT_REGISTER:
spid_=((cmpCmdTltContRegister_t*)outCommandP)->cmd.sdata.spid;
memcpy(&tltUuid_,&((cmpCmdTltContRegister_t*)outCommandP)->cmd.sdata.uuid, sizeof(mcUuid_t));
- break;
+ break;
case MC_CMP_CMD_TLT_CONT_REGISTER_ACTIVATE:
spid_=((cmpCmdTltContRegisterActivate_t*)outCommandP)->cmd.sdata.spid;
memcpy(&tltUuid_,&((cmpCmdTltContRegisterActivate_t*)outCommandP)->cmd.sdata.uuid, sizeof(mcUuid_t));
@@ -357,7 +357,7 @@ rootpaerror_t prepareCommand(cmpCommandId_t commandId, CmpMessage* inCommandP,
default:
// nothing extra to do, just return ret at the end of function
break;
-
+
}
responseP->hdr.ret=ret;
responseP->hdr.intRet=mcRet;
@@ -370,7 +370,7 @@ mcResult_t storeContainers(cmpCommandId_t commandId, CMTHANDLE handle, uint32_t
mcResult_t mcRet=MC_DRV_OK;
uint32_t length=0;
LOGD(">>pacmp3 storeContainers for %d element %d offset %d", commandId, elementIndex, offset);
-
+
// store the containers when needed
switch(commandId)
{
@@ -394,12 +394,12 @@ mcResult_t storeContainers(cmpCommandId_t commandId, CMTHANDLE handle, uint32_t
{
mcRet=-1;
}
-
+
if(MC_DRV_OK==mcRet)
{
mcSoAuthTokenCont_t* authTokenP=NULL;
uint32_t authTokenSize=0;
-
+
mcRet=regReadAuthToken(&authTokenP, &authTokenSize);
if(mcRet!=MC_DRV_OK)
{
@@ -423,7 +423,7 @@ mcResult_t storeContainers(cmpCommandId_t commandId, CMTHANDLE handle, uint32_t
}
else
{
- LOGE("pacmp3 storeContainers for %d regWriteRoot failed %d", commandId, mcRet);
+ LOGE("pacmp3 storeContainers for %d regWriteRoot failed %d", commandId, mcRet);
}
break;
@@ -441,7 +441,7 @@ mcResult_t storeContainers(cmpCommandId_t commandId, CMTHANDLE handle, uint32_t
break;
- case MC_CMP_CMD_ROOT_CONT_UNREGISTER:
+ case MC_CMP_CMD_ROOT_CONT_UNREGISTER:
mcRet=regCleanupRoot();
break;
@@ -458,14 +458,14 @@ mcResult_t storeContainers(cmpCommandId_t commandId, CMTHANDLE handle, uint32_t
{
mcRet=-1;
}
-
+
break;
case MC_CMP_CMD_SP_CONT_REGISTER:
case MC_CMP_CMD_SP_CONT_REGISTER_ACTIVATE:
{
// Root container is in the buffer first, that is why we read it first
- // we write it last since if SP container writing fails we do not want
+ // we write it last since if SP container writing fails we do not want
// to write root container
uint32_t rootLength=0;
ROOTCONTAINERP rootP=NULL;
@@ -476,7 +476,7 @@ mcResult_t storeContainers(cmpCommandId_t commandId, CMTHANDLE handle, uint32_t
{
mcRet=regWriteSp(spid_, (SPCONTAINERP) (handle->mappedP+offset), length);
}
- else
+ else
{
mcRet=-1;
}
@@ -492,26 +492,26 @@ mcResult_t storeContainers(cmpCommandId_t commandId, CMTHANDLE handle, uint32_t
}
else
{
- LOGE("pacmp3 storeContainers for %d regWriteSp failed %d", commandId, mcRet);
+ LOGE("pacmp3 storeContainers for %d regWriteSp failed %d", commandId, mcRet);
}
break;
}
case MC_CMP_CMD_SP_CONT_UNREGISTER:
- mcRet=regCleanupSp(spid_);
+ mcRet=regCleanupSp(spid_);
if(MC_DRV_OK!=mcRet)
{
- LOGE("pacmp3 storeContainers for %d regCleanupSp failed %d, , still attempting storing root", commandId, mcRet);
+ LOGE("pacmp3 storeContainers for %d regCleanupSp failed %d, , still attempting storing root", commandId, mcRet);
}
if(getRspElementInfo(&elementIndex, handle, &offset, &length))
{
mcRet=regWriteRoot((ROOTCONTAINERP) (handle->mappedP+offset), length);
}
- else
+ else
{
mcRet=-1;
- }
+ }
break;
@@ -520,7 +520,7 @@ mcResult_t storeContainers(cmpCommandId_t commandId, CMTHANDLE handle, uint32_t
case MC_CMP_CMD_TLT_CONT_REGISTER_ACTIVATE:
{
// SP container is in the buffer first, that is why we read it first
- // we write it last since if TLT container writing fails we do not want
+ // we write it last since if TLT container writing fails we do not want
// to write SP container
uint32_t spLength=0;
SPCONTAINERP spP=NULL;
@@ -531,28 +531,28 @@ mcResult_t storeContainers(cmpCommandId_t commandId, CMTHANDLE handle, uint32_t
{
mcRet=regWriteTlt(&tltUuid_,(TLTCONTAINERP) (handle->mappedP+offset), length, spid_);
}
- else
+ else
{
mcRet=-1;
}
}
- else
+ else
{
mcRet=-1;
}
-
+
if(MC_DRV_OK==mcRet)
{
mcRet=regWriteSp(spid_, spP, spLength);
if(MC_DRV_OK!=mcRet)
{
- LOGE("pacmp3 storeContainers for %d regWriteSp failed %d", commandId, mcRet);
+ LOGE("pacmp3 storeContainers for %d regWriteSp failed %d", commandId, mcRet);
regCleanupTlt(&tltUuid_, spid_);
}
}
else
{
- LOGE("pacmp3 storeContainers for %d regWriteTlt failed %d", commandId, mcRet);
+ LOGE("pacmp3 storeContainers for %d regWriteTlt failed %d", commandId, mcRet);
}
break;
@@ -564,18 +564,18 @@ mcResult_t storeContainers(cmpCommandId_t commandId, CMTHANDLE handle, uint32_t
{
mcRet=regWriteTlt(&tltUuid_,(TLTCONTAINERP) (handle->mappedP+offset), length, spid_);
}
- else
+ else
{
mcRet=-1;
}
-
+
break;
case MC_CMP_CMD_TLT_CONT_UNREGISTER:
mcRet=regCleanupTlt(&tltUuid_, spid_);
if(MC_DRV_OK!=mcRet)
{
- LOGE("pacmp3 storeContainers for %d regCleanupTlt failed %d, still attempting storing sp", commandId, mcRet);
+ LOGE("pacmp3 storeContainers for %d regCleanupTlt failed %d, still attempting storing sp", commandId, mcRet);
}
if(getRspElementInfo(&elementIndex, handle, &offset, &length))
@@ -583,27 +583,27 @@ mcResult_t storeContainers(cmpCommandId_t commandId, CMTHANDLE handle, uint32_t
mcRet=regWriteSp(spid_, (SPCONTAINERP) (handle->mappedP+offset), length);
if(MC_DRV_OK!=mcRet)
{
- LOGE("pacmp3 storeContainers for %d regWriteSp failed %d", commandId, mcRet);
- }
+ LOGE("pacmp3 storeContainers for %d regWriteSp failed %d", commandId, mcRet);
+ }
}
- else
+ else
{
mcRet=-1;
}
-
+
break;
- default:
- LOGD("pacmp3 storeContainers nothing to store");
+ default:
+ LOGD("pacmp3 storeContainers nothing to store");
// nothing to do
- break;
+ break;
}
LOGD("<<pacmp3 storeContainers %d %d", commandId, mcRet);
return mcRet;
}
/**
-handleResponse stores the container received in response and copies the response to the buffer to be returned
-to the client Note that the container is not store id cmtl returned an error, but the content of the response is
+handleResponse stores the container received in response and copies the response to the buffer to be returned
+to the client Note that the container is not store id cmtl returned an error, but the content of the response is
returned to the client.
*/
rootpaerror_t handleResponse(cmpCommandId_t commandId, CmpMessage* outResponseP, CMTHANDLE handle)
@@ -613,7 +613,7 @@ rootpaerror_t handleResponse(cmpCommandId_t commandId, CmpMessage* outResponseP,
uint32_t elementIndex=1;
uint32_t offset=0;
uint32_t length=0;
-
+
LOGD(">>handleResponse for command %d ", commandId);
if(isValidResponseTo(commandId, handle->wsmP)==false)
@@ -651,11 +651,11 @@ rootpaerror_t handleResponse(cmpCommandId_t commandId, CmpMessage* outResponseP,
}
mcRet=storeContainers(commandId, handle, elementIndex, offset);
-
+
if(mcRet != MC_DRV_OK)
{
- LOGE("pacmp3 handleResponse for %d registry failed %d", commandId, mcRet);
- if(-1==mcRet)
+ LOGE("pacmp3 handleResponse for %d registry failed %d", commandId, mcRet);
+ if((mcResult_t)-1==mcRet)
{
ret = ROOTPA_ERROR_INTERNAL;
}
@@ -667,8 +667,8 @@ rootpaerror_t handleResponse(cmpCommandId_t commandId, CmpMessage* outResponseP,
{
outResponseP->hdr.intRet=mcRet;
}
- outResponseP->hdr.ret=ret;
+ outResponseP->hdr.ret=ret;
}
- LOGD("<<handleResponse returning %d ", ret);
+ LOGD("<<handleResponse returning %d ", ret);
return ret;
}
diff --git a/mobicore/rootpa/Code/Common/pacmp3.h b/mobicore/rootpa/Code/Common/pacmp3.h
index b5936c6..293b30a 100644
--- a/mobicore/rootpa/Code/Common/pacmp3.h
+++ b/mobicore/rootpa/Code/Common/pacmp3.h
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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 PACMP3_H
#define PACMP3_H
@@ -40,9 +40,9 @@ OF THE POSSIBILITY OF SUCH DAMAGE.
uint32_t sizeOfCmp();
-// recovery from factory reset
+// recovery from factory reset
bool factoryResetAssumed();
-// recovery from factory reset
+// recovery from factory reset
cmpCommandId_t getCmpCommandId(const uint8_t* commandP);
diff --git a/mobicore/rootpa/Code/Common/pacmtl.c b/mobicore/rootpa/Code/Common/pacmtl.c
index ff97723..3e9792c 100644
--- a/mobicore/rootpa/Code/Common/pacmtl.c
+++ b/mobicore/rootpa/Code/Common/pacmtl.c
@@ -1,39 +1,39 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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 <string.h>
#include "logging.h"
#include "pacmp3.h"
-#include "registry.h"
+#include "registry.h"
#include "pacmtl.h"
#define ILLEGAL_ELEMENT 0
@@ -68,7 +68,7 @@ void setCmdElementInfo(uint32_t* elementNbrP, uint8_t* wsmP, uint32_t* elementOf
void setCmdMapInfo(uint8_t* wsmP, const mcBulkMap_t* mapInfoP)
{
// mapInfo and *mapinfoP are of different type, thats why assignment instead of memcpy.
-
+
((cmpCommandHeaderTci_t*)wsmP)->mapInfo.addr=mapInfoP->sVirtualAddr;
((cmpCommandHeaderTci_t*)wsmP)->mapInfo.len=mapInfoP->sVirtualLen;
}
@@ -76,26 +76,26 @@ void setCmdMapInfo(uint8_t* wsmP, const mcBulkMap_t* mapInfoP)
void setCmdCmpVersionAndCmdId(uint8_t* wsmP, cmpCommandId_t commandId)
{
((cmpCommandHeaderTci_t*)wsmP)->version=CMP_VERSION;
- ((cmpCommandHeaderTci_t*)wsmP)->commandId=commandId;
+ ((cmpCommandHeaderTci_t*)wsmP)->commandId=commandId;
}
bool getRspElementInfo(uint32_t* elementNbrP, CMTHANDLE handle, uint32_t* elementOffsetP, uint32_t* elementLengthP)
{
uint8_t* wsmP=NULL;
cmpMapOffsetInfo_t* elementP=NULL;
-
+
if(NULL==handle)
{
LOGE("pacmtl setCmdElementInfo ho handle");
- *elementLengthP=0;
+ *elementLengthP=0;
return false;
}
wsmP=handle->wsmP;
- LOGD(">>pacmtl getRspElementInfo %x %x %d %d %d %d", ((cmpResponseHeaderTci_t*)wsmP)->version,
- ((cmpResponseHeaderTci_t*)wsmP)->responseId,
- ((cmpResponseHeaderTci_t*)wsmP)->len,
- *((uint32_t*)(wsmP+12)),
- *((uint32_t*)(wsmP+16)),
+ LOGD(">>pacmtl getRspElementInfo %x %x %d %d %d %d", ((cmpResponseHeaderTci_t*)wsmP)->version,
+ ((cmpResponseHeaderTci_t*)wsmP)->responseId,
+ ((cmpResponseHeaderTci_t*)wsmP)->len,
+ *((uint32_t*)(wsmP+12)),
+ *((uint32_t*)(wsmP+16)),
*((uint32_t*)(wsmP+20)));
if(NULL==elementNbrP || NULL == elementOffsetP || NULL == elementLengthP || NULL == handle->wsmP)
{
@@ -110,7 +110,7 @@ bool getRspElementInfo(uint32_t* elementNbrP, CMTHANDLE handle, uint32_t* elemen
*elementLengthP=0;
return false;
}
-
+
elementP=(cmpMapOffsetInfo_t*)(wsmP+sizeof(cmpResponseHeaderTci_t));
elementP+=((*elementNbrP)-1);
@@ -120,7 +120,7 @@ bool getRspElementInfo(uint32_t* elementNbrP, CMTHANDLE handle, uint32_t* elemen
*elementLengthP=0;
return false;
}
-
+
*elementOffsetP=elementP->offset;
*elementLengthP=elementP->len;
LOGD("<<pacmtl getRspElementInfo element %d offset %d length %d", *elementNbrP, *elementOffsetP, *elementLengthP);
@@ -148,11 +148,11 @@ bool isValidResponse(const uint8_t* wsmP)
return false;
}
if(getRspCmpVersion(wsmP) != CMP_VERSION )
- {
+ {
LOGE("pacmtl isValidResponse returning false due to cmpVersion 0x%x", getRspCmpVersion(wsmP));
return false;
}
-
+
if(IS_RSP(getRspCmpId(wsmP)))
{
return true;
@@ -189,10 +189,10 @@ typedef struct {
uint32_t cmdId;
uint32_t cmdRspSize;
uint32_t cmdContainerSize;
- uint32_t rspContainerSize;
+ uint32_t rspContainerSize;
} cmpSizes_t;
//
-// note that the container sizes are
+// note that the container sizes are
//
static const cmpSizes_t sizeTable_[] = {
{
@@ -200,13 +200,13 @@ static const cmpSizes_t sizeTable_[] = {
sizeof(cmpMapAuthenticate_t),
0,
0
- },
+ },
{
- MC_CMP_CMD_BEGIN_ROOT_AUTHENTICATION,
+ MC_CMP_CMD_BEGIN_ROOT_AUTHENTICATION,
sizeof(cmpMapBeginRootAuthentication_t),
SIZEOFROOTCONTAINER,
0
- },
+ },
{
MC_CMP_CMD_BEGIN_SOC_AUTHENTICATION,
sizeof(cmpMapBeginSocAuthentication_t),
@@ -218,158 +218,158 @@ static const cmpSizes_t sizeTable_[] = {
sizeof(cmpMapBeginSpAuthentication_t),
SIZEOFROOTCONTAINER+SIZEOFSPCONTAINER,
0
- },
+ },
{
MC_CMP_CMD_GENERATE_AUTH_TOKEN,
sizeof(cmpMapGenAuthToken_t),
0,
0 //SIZEOFAUTHTOKENCONTAINER
- },
+ },
{
MC_CMP_CMD_GET_VERSION,
sizeof(cmpMapGetVersion_t),
0,
0
- },
+ },
{
MC_CMP_CMD_ROOT_CONT_LOCK_BY_ROOT,
sizeof(cmpMapRootContLockByRoot_t),
0,
- SIZEOFROOTCONTAINER
- },
+ SIZEOFROOTCONTAINER
+ },
{
MC_CMP_CMD_ROOT_CONT_REGISTER_ACTIVATE,
sizeof(cmpMapRootContRegisterActivate_t),
0,
SIZEOFROOTCONTAINER
- },
+ },
{
MC_CMP_CMD_ROOT_CONT_UNLOCK_BY_ROOT,
sizeof(cmpMapRootContUnlockByRoot_t),
0,
SIZEOFROOTCONTAINER
- },
+ },
{
MC_CMP_CMD_ROOT_CONT_UNREGISTER,
sizeof(cmpMapRootContUnregister_t),
0,
0
- },
+ },
{
MC_CMP_CMD_SP_CONT_ACTIVATE,
sizeof(cmpMapSpContActivate_t),
0,
- SIZEOFSPCONTAINER
- },
+ SIZEOFSPCONTAINER
+ },
{
MC_CMP_CMD_SP_CONT_LOCK_BY_ROOT,
sizeof(cmpMapSpContLockByRoot_t),
SIZEOFSPCONTAINER,
SIZEOFSPCONTAINER
- },
+ },
{
MC_CMP_CMD_SP_CONT_LOCK_BY_SP,
sizeof(cmpMapSpContLockBySp_t),
0,
- SIZEOFSPCONTAINER
- },
+ SIZEOFSPCONTAINER
+ },
{
MC_CMP_CMD_SP_CONT_REGISTER,
sizeof(cmpMapSpContRegister_t),
0,
SIZEOFROOTCONTAINER+SIZEOFSPCONTAINER
- },
+ },
{
MC_CMP_CMD_SP_CONT_REGISTER_ACTIVATE,
sizeof(cmpMapSpContRegisterActivate_t),
0,
SIZEOFROOTCONTAINER+SIZEOFSPCONTAINER
- },
+ },
{
MC_CMP_CMD_SP_CONT_UNLOCK_BY_ROOT,
sizeof(cmpMapSpContUnlockByRoot_t),
SIZEOFSPCONTAINER,
- SIZEOFSPCONTAINER
- },
+ SIZEOFSPCONTAINER
+ },
{
MC_CMP_CMD_SP_CONT_UNLOCK_BY_SP,
sizeof(cmpMapSpContUnlockBySp_t),
0,
SIZEOFSPCONTAINER
- },
+ },
{
MC_CMP_CMD_SP_CONT_UNREGISTER,
sizeof(cmpMapSpContUnregister_t),
0,
SIZEOFROOTCONTAINER
- },
+ },
{
MC_CMP_CMD_TLT_CONT_ACTIVATE,
sizeof(cmpMapTltContActivate_t),
SIZEOFTLTCONTAINER,
SIZEOFTLTCONTAINER
- },
+ },
{
MC_CMP_CMD_TLT_CONT_LOCK_BY_SP,
sizeof(cmpMapTltContLockBySp_t),
SIZEOFTLTCONTAINER,
- SIZEOFTLTCONTAINER
- },
+ SIZEOFTLTCONTAINER
+ },
{
MC_CMP_CMD_TLT_CONT_PERSONALIZE,
sizeof(cmpMapTltContPersonalize_t),
SIZEOFTLTCONTAINER,
0
- },
+ },
{
MC_CMP_CMD_TLT_CONT_REGISTER,
sizeof(cmpMapTltContRegister_t),
0,
SIZEOFSPCONTAINER+SIZEOFTLTCONTAINER
- },
+ },
{
MC_CMP_CMD_TLT_CONT_REGISTER_ACTIVATE,
sizeof(cmpMapTltContRegisterActivate_t),
0,
SIZEOFSPCONTAINER+SIZEOFTLTCONTAINER
- },
+ },
{
MC_CMP_CMD_TLT_CONT_UNLOCK_BY_SP,
sizeof(cmpMapTltContUnlockBySp_t),
SIZEOFTLTCONTAINER,
SIZEOFTLTCONTAINER
- },
+ },
{
MC_CMP_CMD_TLT_CONT_UNREGISTER,
sizeof(cmpMapTltContUnregister_t),
0,
SIZEOFSPCONTAINER
- },
+ },
{
MC_CMP_CMD_GET_SUID,
sizeof(cmpMapGetSuid_t),
0,
- 0
- },
+ 0
+ },
{
MC_CMP_CMD_AUTHENTICATE_TERMINATE,
sizeof(cmpMapAuthenticateTerminate_t),
0,
0
- }
+ }
};
const cmpSizes_t* getCmpSizeInfo(uint32_t cmdId)
{
- int i = 0;
- for ( i = 0; i < sizeof(sizeTable_)/sizeof(cmpSizes_t); i++)
+ size_t i = 0;
+ for ( i = 0; i < sizeof(sizeTable_)/sizeof(cmpSizes_t); i++)
{
- if (cmdId == sizeTable_[i].cmdId)
+ if (cmdId == sizeTable_[i].cmdId)
{
return &sizeTable_[i];
}
}
- LOGE("getCmpSizeInfo command %d not supported", cmdId);
+ LOGE("getCmpSizeInfo command %d not supported", cmdId);
return NULL;
}
@@ -386,8 +386,8 @@ uint32_t getTotalMappedBufferSize(CmpMessage* commandP)
if(NULL==sizesP) return 0;
commandSize=bigger(sizesP->cmdRspSize, commandP->length);
containerSize=bigger(sizesP->cmdContainerSize, sizesP->rspContainerSize);
- LOGD("pacmtl getTotalMappedBufferSize %d returning %d (%d (%d %d) %d (%d %d))", sizesP->cmdId, commandSize+containerSize,
- commandSize, sizesP->cmdRspSize, commandP->length,
+ LOGD("pacmtl getTotalMappedBufferSize %d returning %d (%d (%d %d) %d (%d %d))", sizesP->cmdId, commandSize+containerSize,
+ commandSize, sizesP->cmdRspSize, commandP->length,
containerSize, sizesP->cmdContainerSize, sizesP->rspContainerSize);
return (commandSize+containerSize);
}
diff --git a/mobicore/rootpa/Code/Common/pacmtl.h b/mobicore/rootpa/Code/Common/pacmtl.h
index 877c185..538d9ce 100644
--- a/mobicore/rootpa/Code/Common/pacmtl.h
+++ b/mobicore/rootpa/Code/Common/pacmtl.h
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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 PACMTL_H
#define PACMTL_H
diff --git a/mobicore/rootpa/Code/Common/provisioningengine.c b/mobicore/rootpa/Code/Common/provisioningengine.c
index ddcc777..9168952 100644
--- a/mobicore/rootpa/Code/Common/provisioningengine.c
+++ b/mobicore/rootpa/Code/Common/provisioningengine.c
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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 <stdio.h>
@@ -53,11 +53,11 @@ static const char* const RELATION_NEXT = "relation/next";
static const uint8_t* const SLASH= (uint8_t*)"/";
static const char* const RELATION_INITIAL_POST="initial_post"; // this will make us to send HTTP GET, which
- // is the right thing to do since we do not
+ // is the right thing to do since we do not
// have any data to send to SE, this will need to be different in RootPA initiated trustet installation
static const char* const RELATION_INITIAL_DELETE="initial_delete"; // this will make us to send HTTP DELETE
-#define INT_STRING_LENGTH 12 // (32 bit <= 10 decimal numbers) + "/" + trailing zero.
+#define INT_STRING_LENGTH 12 // (32 bit <= 10 decimal numbers) + "/" + trailing zero.
#define INITIAL_URL_BUFFER_LENGTH 255
static char initialUrl_[INITIAL_URL_BUFFER_LENGTH];
@@ -69,7 +69,7 @@ void addSlashToUri(char* uriP)
LOGD(">>addSlashToUri");
uriidx=strlen(uriP);
uriP[uriidx]='/';
- LOGD("<<addSlashToUri %s", uriP);
+ LOGD("<<addSlashToUri %s", uriP);
}
void addBytesToUri(char* uriP, uint8_t* bytes, uint32_t length, bool uuid )
@@ -102,27 +102,27 @@ void addIntToUri(char* uriP, uint32_t addThis)
// using signed integer since this is how SE wants it
snprintf(intInString, INT_STRING_LENGTH, "/%d", addThis);
strncpy((uriP+strlen(uriP)), intInString, INT_STRING_LENGTH); // we have earlier made sure there is enough room in uriP, using strncpy here instead strcpy is just to avoid static analysis comments
- LOGD("add int to URI %s %d", uriP, addThis);
+ LOGD("add int to URI %s %d", uriP, addThis);
}
void cleanup(char** linkP, char** relP, char** commandP)
{
if(commandP!=NULL)
- {
+ {
free(*commandP);
*commandP=NULL;
}
if(relP!=NULL)
- {
+ {
if((*relP!=RELATION_INITIAL_POST) &&
(*relP!=RELATION_INITIAL_DELETE)) free(*relP);
*relP=NULL;
}
if(linkP!=NULL)
- {
- free(*linkP);
+ {
+ free(*linkP);
*linkP=NULL;
}
}
@@ -136,7 +136,7 @@ rootpaerror_t setInitialAddress(const char* addrP, uint32_t length)
if(INITIAL_URL_BUFFER_LENGTH < (length + 1))
{
- return ROOTPA_ERROR_ILLEGAL_ARGUMENT;
+ return ROOTPA_ERROR_ILLEGAL_ARGUMENT;
}
memset(initialUrl_, 0, INITIAL_URL_BUFFER_LENGTH);
memcpy(initialUrl_, addrP, length);
@@ -152,7 +152,7 @@ char* createBasicLink(mcSuid_t suid)
{
char* tmpLinkP=NULL;
size_t urlLength=0;
-
+
urlLength=strlen(initialUrl_) + (sizeof(mcSuid_t)*2) + (sizeof(mcSpid_t)*2) + (sizeof(mcUuid_t)*2)+6; //possible slash and end zero and four dashes
tmpLinkP=(char*)malloc(urlLength);
if(tmpLinkP != NULL)
@@ -163,17 +163,17 @@ char* createBasicLink(mcSuid_t suid)
}
else
{
- LOGE("createBasicLink, out of memory");
+ LOGE("createBasicLink, out of memory");
}
return tmpLinkP;
}
void doProvisioningWithSe(
- mcSpid_t spid,
- mcSuid_t suid,
- CallbackFunctionP callbackP,
- SystemInfoCallbackFunctionP getSysInfoP,
+ mcSpid_t spid,
+ mcSuid_t suid,
+ CallbackFunctionP callbackP,
+ SystemInfoCallbackFunctionP getSysInfoP,
GetVersionFunctionP getVersionP,
initialRel_t initialRel,
trustletInstallationData_t* tltDataP)
@@ -194,12 +194,12 @@ void doProvisioningWithSe(
LOGD(">>doProvisioningWithSe");
- callbackP_=callbackP;
+ callbackP_=callbackP;
if(empty(initialUrl_))
{
memset(initialUrl_, 0, INITIAL_URL_BUFFER_LENGTH);
- strncpy(initialUrl_, SE_URL, strlen(SE_URL));
+ strncpy(initialUrl_, SE_URL, strlen(SE_URL));
}
linkP=createBasicLink(suid);
@@ -235,13 +235,13 @@ void doProvisioningWithSe(
callbackP(ERROR_STATE, ret, NULL);
workToDo=false;
}
-
+
if(tltDataP != NULL) // we are installing trustlet
{
ret=buildXmlTrustletInstallationRequest(&responseP, *tltDataP );
if(ROOTPA_OK!=ret || NULL==responseP)
{
- if(ROOTPA_OK==ret) ret=ROOTPA_ERROR_XML;
+ if(ROOTPA_OK==ret) ret=ROOTPA_ERROR_XML;
callbackP(ERROR_STATE, ret, NULL);
workToDo=false;
}
@@ -252,7 +252,7 @@ void doProvisioningWithSe(
}
}
-// begin recovery from factory reset 1
+// begin recovery from factory reset 1
if(factoryResetAssumed() && relP != RELATION_INITIAL_DELETE && workToDo == true)
{
pendingLinkP=linkP;
@@ -260,18 +260,18 @@ void doProvisioningWithSe(
relP=RELATION_INITIAL_DELETE;
linkP=createBasicLink(suid);
}
-// end recovery from factory reset 1
-
+// end recovery from factory reset 1
+
while(workToDo)
{
- LOGD("in loop link: %s\nrel: %s\ncommand: %s\nresponse: %s\n", (linkP==NULL)?"null":linkP,
- (relP==NULL)?"null":relP,
- (commandP==NULL)?"null":commandP,
+ LOGD("in loop link: %s\nrel: %s\ncommand: %s\nresponse: %s\n", (linkP==NULL)?"null":linkP,
+ (relP==NULL)?"null":relP,
+ (commandP==NULL)?"null":commandP,
(responseP==NULL)?"null":responseP);
-
+
if(NULL==relP)
{
-// begin recovery from factory reset 2
+// begin recovery from factory reset 2
if(pendingLinkP!=NULL && pendingRelP!=NULL)
{
free((void*)linkP);
@@ -283,12 +283,12 @@ void doProvisioningWithSe(
continue;
}
// end recovery from factory reset 2
-
-
- callbackP(FINISHED_PROVISIONING, ROOTPA_OK, NULL); // this is the only place where we can be sure
+
+
+ callbackP(FINISHED_PROVISIONING, ROOTPA_OK, NULL); // this is the only place where we can be sure
// SE does not want to send any more data to us
- // the other option would be to keep track on the
- // commands received from SE but since we want
+ // the other option would be to keep track on the
+ // commands received from SE but since we want
// SE to have option to execute also other commands
// and also allow modification in provisioning sequence
// without modifying RootPA we use this simpler way.
@@ -311,9 +311,9 @@ void doProvisioningWithSe(
usedLinkP=linkP; // originally linkP
usedRelP=relP; // originally NULL
usedCommandP=commandP; // originally NULL
-
+
if(strstr(relP, RELATION_SYSTEMINFO))
- {
+ {
osInfo_t osSpecificInfo;
int mcVersionTag=0;
mcVersionInfo_t mcVersion;
@@ -330,11 +330,11 @@ void doProvisioningWithSe(
osSpecificInfo.versionP = (char*)calloc(64, sizeof(char));
#endif
tmpRet=getSysInfoP(&osSpecificInfo);
- if(tmpRet!=ROOTPA_OK) ret=tmpRet;
+ if(tmpRet!=ROOTPA_OK) ret=tmpRet;
tmpRet=getVersionP(&mcVersionTag, &mcVersion);
if(tmpRet!=ROOTPA_OK) ret=tmpRet;
-
+
tmpRet=buildXmlSystemInfo(&responseP, mcVersionTag, &mcVersion, &osSpecificInfo);
if(tmpRet!=ROOTPA_OK) ret=tmpRet;
@@ -356,7 +356,7 @@ void doProvisioningWithSe(
workToDo=false;
ret=ROOTPA_ERROR_OUT_OF_MEMORY;
}
-
+
if(ret!=ROOTPA_OK)
{
LOGE("getSysInfoP, getVersionP or buildXmlSystemInfo or httpPutAndReceiveCommand returned an error %d", ret);
@@ -367,7 +367,7 @@ void doProvisioningWithSe(
else if(strstr(relP, RELATION_INITIAL_DELETE))
{
ret=httpDeleteAndReceiveCommand(&linkP, &relP, &commandP);
-
+
if(ret!=ROOTPA_OK)
{
LOGE("httpDeleteAndReceiveCommand returned an error %d", ret);
@@ -379,7 +379,7 @@ void doProvisioningWithSe(
{
// response may be NULL or trustlet installation request
ret=httpPostAndReceiveCommand(responseP, &linkP, &relP, &commandP);
-
+
if(ret!=ROOTPA_OK)
{
LOGE("httpPostAndReceiveCommand returned an error %d", ret);
@@ -395,7 +395,7 @@ void doProvisioningWithSe(
if(NULL==responseP)
{
- if(ROOTPA_OK==ret) ret=ROOTPA_ERROR_XML;
+ if(ROOTPA_OK==ret) ret=ROOTPA_ERROR_XML;
// have to set these to NULL since we are not even trying to get them from SE now
linkP=NULL;
relP=NULL;
@@ -404,18 +404,18 @@ void doProvisioningWithSe(
}
else
{
- // attempting to return response to SE even if there was something wrong in handleXmlMessage
+ // attempting to return response to SE even if there was something wrong in handleXmlMessage
tmpRet=httpPostAndReceiveCommand(responseP, &linkP, &relP, &commandP);
if(tmpRet!=ROOTPA_OK) ret=tmpRet;
}
-
- if(ret!=ROOTPA_OK && ret!=ROOTPA_ERROR_REGISTRY_OBJECT_NOT_AVAILABLE) // if container is not found, not sending error intent to SP.PA since it is possible that SE can recover.
+
+ if(ret!=ROOTPA_OK && ret!=ROOTPA_ERROR_REGISTRY_OBJECT_NOT_AVAILABLE) // if container is not found, not sending error intent to SP.PA since it is possible that SE can recover.
{ // If it can not, it will return an error code anyway.
LOGE("httpPostAndReceiveCommand or handleXmlMessage returned an error %d %d", ret, tmpRet);
callbackP(ERROR_STATE, ret, NULL);
if(tmpRet!=ROOTPA_OK) workToDo=false; // if sending response succeeded, we rely on "relP" to tell whether we should continue or not
}
-
+
}
else if(strstr(relP, RELATION_NEXT))
{
@@ -424,7 +424,7 @@ void doProvisioningWithSe(
{
LOGE("httpGetAndReceiveCommand returned an error %d", ret);
callbackP(ERROR_STATE, ret, NULL);
- workToDo=false;
+ workToDo=false;
}
}
else
@@ -436,20 +436,20 @@ void doProvisioningWithSe(
}
LOGD("end of provisioning loop work to do: %d, responseP %ld", workToDo, (long int) responseP);
- }
+ }
// last round cleaning in order to make sure both original and user pointers are released, but only once
if(!workToDo)
{
- LOGD("no more work to do %ld - %ld %ld - %ld %ld - %ld", (long int) linkP, (long int) usedLinkP,
- (long int) relP, (long int) usedRelP,
- (long int) commandP, (long int) usedCommandP);
+ LOGD("no more work to do %ld - %ld %ld - %ld %ld - %ld", (long int) linkP, (long int) usedLinkP,
+ (long int) relP, (long int) usedRelP,
+ (long int) commandP, (long int) usedCommandP);
// final cleanup
// ensure that we do not clean up twice in case used pointers opint to the original one
if(linkP==usedLinkP) usedLinkP=NULL;
- if(relP==usedRelP) usedRelP=NULL;
+ if(relP==usedRelP) usedRelP=NULL;
if(commandP==usedCommandP) usedCommandP=NULL;
cleanup((char**) &linkP, (char**) &relP, (char**) &commandP);
@@ -458,23 +458,32 @@ void doProvisioningWithSe(
// free the used pointers since all the necessary pointers point to new direction.
// when relation is self we need to give the previous command again and so we keep the
// data
-
- if(relP==NULL || strstr(relP, RELATION_SELF)==NULL)
+
+ if(relP==NULL || strstr(relP, RELATION_SELF)==NULL)
{
cleanup((char**) &usedLinkP, (char**) &usedRelP, (char**) &usedCommandP);
- }
+ }
// responseP can be freed at every round
free((void*)responseP);
responseP=NULL;
-
+
} // while
closeSeClientAndCleanup();
- if(responseP!=NULL) free((void*)responseP);
- if(linkP!=NULL) free((void*)linkP);
+ if(responseP!=NULL) {
+ free((void*)responseP);
+ responseP = NULL;
+ }
+
+ if(linkP!=NULL){
+ free((void*)linkP);
+ linkP = NULL;
+ }
+
if(ROOTPA_OK != ret) LOGE("doProvisioningWithSe had some problems: %d",ret );
LOGD("<<doProvisioningWithSe ");
+
return;
}
diff --git a/mobicore/rootpa/Code/Common/provisioningengine.h b/mobicore/rootpa/Code/Common/provisioningengine.h
index 0fdae26..a91f96c 100644
--- a/mobicore/rootpa/Code/Common/provisioningengine.h
+++ b/mobicore/rootpa/Code/Common/provisioningengine.h
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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 PROVISIONINGENGINE_H
#define PROVISIONINGENGINE_H
diff --git a/mobicore/rootpa/Code/Common/registry.c b/mobicore/rootpa/Code/Common/registry.c
index 062bcb3..4889e40 100644
--- a/mobicore/rootpa/Code/Common/registry.c
+++ b/mobicore/rootpa/Code/Common/registry.c
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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 <MobiCoreRegistry.h>
@@ -41,7 +41,7 @@ int regWriteAuthToken(const AUTHTOKENCONTAINERP atP, uint32_t containerSize)
int regReadAuthToken(AUTHTOKENCONTAINERP* atP, uint32_t* containerSize)
{
- *containerSize = CONTAINER_BUFFER_SIZE; // this will be updated to actual size with the registry call
+ *containerSize = CONTAINER_BUFFER_SIZE; // this will be updated to actual size with the registry call
*atP=(AUTHTOKENCONTAINERP)malloc(CONTAINER_BUFFER_SIZE);
if(NULL==*atP) return MC_DRV_ERR_NO_FREE_MEMORY;
return mcRegistryReadAuthToken(*atP, containerSize);
@@ -78,9 +78,9 @@ int regCleanupRoot(void)
int regReadSp(mcSpid_t spid, SPCONTAINERP* spP, uint32_t* containerSize)
{
- *containerSize = CONTAINER_BUFFER_SIZE; // this will be updated to actual size with the registry call
+ *containerSize = CONTAINER_BUFFER_SIZE; // this will be updated to actual size with the registry call
*spP= (SPCONTAINERP)malloc(CONTAINER_BUFFER_SIZE);
- if(NULL==*spP) return MC_DRV_ERR_NO_FREE_MEMORY;
+ if(NULL==*spP) return MC_DRV_ERR_NO_FREE_MEMORY;
return mcRegistryReadSp(spid, *spP, containerSize);
}
@@ -91,7 +91,7 @@ int regWriteSp(mcSpid_t spid, const SPCONTAINERP spP, uint32_t containerSize)
int regCleanupSp(mcSpid_t spid)
{
- return mcRegistryCleanupSp(spid);
+ return mcRegistryCleanupSp(spid);
}
@@ -100,7 +100,7 @@ int regGetSpState(mcSpid_t spid, mcContainerState_t* stateP)
int ret;
SPCONTAINERP spP=NULL;
uint32_t containerSize=0;
- containerSize = CONTAINER_BUFFER_SIZE; // this will be updated to actual size with the registry call
+ containerSize = CONTAINER_BUFFER_SIZE; // this will be updated to actual size with the registry call
ret=regReadSp(spid, &spP, &containerSize);
if(MC_DRV_OK==ret)
{
@@ -115,7 +115,7 @@ int regGetSpState(mcSpid_t spid, mcContainerState_t* stateP)
int regReadTlt(const mcUuid_t* uuidP, TLTCONTAINERP* tltP, uint32_t* containerSize, mcSpid_t spid)
{
- *containerSize = CONTAINER_BUFFER_SIZE; // this will be update to actual size with the registry call
+ *containerSize = CONTAINER_BUFFER_SIZE; // this will be update to actual size with the registry call
*tltP=(TLTCONTAINERP)malloc(CONTAINER_BUFFER_SIZE);
if(NULL==*tltP) return MC_DRV_ERR_NO_FREE_MEMORY;
return mcRegistryReadTrustletCon(uuidP, spid, *tltP, containerSize);
@@ -133,6 +133,7 @@ int regCleanupTlt(const mcUuid_t* uuidP, mcSpid_t spid)
int regStoreTA(mcSpid_t spid, const mcUuid_t* uuidP, const uint8_t* taBinary, uint32_t taBinLength)
{
+ (void) uuidP;
#ifdef WIN32
return MC_DRV_ERR_INVALID_OPERATION; // TODO-fix Currently the Windows version of mcRegistry does not support mcRegistryStoreTABlob
#else
@@ -144,7 +145,7 @@ int regGetTaState(mcSpid_t spid, const mcUuid_t* uuidP, mcContainerState_t* stat
{
TLTCONTAINERP taP=NULL;
uint32_t containerSize=0;
- containerSize = CONTAINER_BUFFER_SIZE; // this will be updated to actual size with the registry call
+ containerSize = CONTAINER_BUFFER_SIZE; // this will be updated to actual size with the registry call
int ret=regReadTlt(uuidP, &taP, &containerSize, spid);
if(MC_DRV_OK==ret)
{
diff --git a/mobicore/rootpa/Code/Common/registry.h b/mobicore/rootpa/Code/Common/registry.h
index f81ff28..546a830 100644
--- a/mobicore/rootpa/Code/Common/registry.h
+++ b/mobicore/rootpa/Code/Common/registry.h
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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 <mcContainer.h>
diff --git a/mobicore/rootpa/Code/Common/seclient.c b/mobicore/rootpa/Code/Common/seclient.c
index e08a7c7..619e584 100644
--- a/mobicore/rootpa/Code/Common/seclient.c
+++ b/mobicore/rootpa/Code/Common/seclient.c
@@ -1,39 +1,42 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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 <string.h>
#include <stdlib.h>
#include <wrapper.h>
#include <time.h>
#include <math.h>
+#ifdef TIZEN
+#include <string.h>
+#endif
#include <curl/curl.h>
@@ -60,7 +63,7 @@ OF THE POSSIBILITY OF SUCH DAMAGE.
#define HTTP_CODE_HTTP_VERSION 505
#ifdef __DEBUG
-#define NONEXISTENT_TEST_URL "http://10.255.255.8:9/"
+#define NONEXISTENT_TEST_URL "http://10.255.255.253/"
#endif
#define CERT_PATH_MAX_LEN 256
@@ -70,7 +73,7 @@ static char certificateFilePath_[CERT_PATH_MAX_LEN];
static long int SE_CONNECTION_DEFAULT_TIMEOUT=58L; // timeout after 58 seconds
static int MAX_ATTEMPTS=30; //30x0.3 = 9 seconds
#ifdef WIN32
- static const DWORD SLEEPTIME_MS=300; // 0.3 seconds
+ static const DWORD SLEEPTIME_MS=300; // 0.3 seconds
#else
static const struct timespec SLEEPTIME={0,300*1000*1000}; // 0.3 seconds
#endif
@@ -78,24 +81,119 @@ static int MAX_ATTEMPTS=30; //30x0.3 = 9 seconds
rootpaerror_t httpCommunicate(const char* const inputP, const char** linkP, const char** relP, const char** commandP, httpMethod_t method);
#ifdef WIN32
-
- char* strcasestr(char const *s, char const *find)
- {
+
+ char* strcasestr(char const *s, char const *find)
+ {
char* pos;
char* ret;
- char* ls=_strdup(s);
- char* lfind=_strdup(find);
-
- ls=_strlwr(ls);
- lfind=_strlwr(lfind);
- pos = strstr(ls, lfind);
- ret = pos == NULL ? NULL : (char *)(s + (pos-ls));
- free(ls);
- free(lfind);
- return ret;
- }
-
-
+ char* ls=_strdup(s);
+ char* lfind=_strdup(find);
+
+ ls=_strlwr(ls);
+ lfind=_strlwr(lfind);
+ pos = strstr(ls, lfind);
+ ret = pos == NULL ? NULL : (char *)(s + (pos-ls));
+ free(ls);
+ free(lfind);
+ return ret;
+ }
+
+
+#endif
+
+#ifdef TIZEN
+#include <sys/types.h>
+#include <string.h>
+#include <ctype.h>
+/*
+ * Find the first occurrence of find in s, ignore case.
+ */
+char *
+strcasestr(s, find)
+ const char *s, *find;
+{
+ char c, sc;
+ size_t len;
+
+ if ((c = *find++) != 0) {
+ c = tolower((unsigned char)c);
+ len = strlen(find);
+ do {
+ do {
+ if ((sc = *s++) == 0)
+ return (NULL);
+ } while ((char)tolower((unsigned char)sc) != c);
+ } while (strncasecmp(s, find, len) != 0);
+ s--;
+ }
+ return ((char *)s);
+}
+
+/*
+ * Appends src to string dst of size siz (unlike strncat, siz is the
+ * full size of dst, not space left). At most siz-1 characters
+ * will be copied. Always NUL terminates (unless siz <= strlen(dst)).
+ * Returns strlen(src) + MIN(siz, strlen(initial dst)).
+ * If retval >= siz, truncation occurred.
+ */
+size_t
+strlcat(char *dst, const char *src, size_t siz)
+{
+ register char *d = dst;
+ register const char *s = src;
+ register size_t n = siz;
+ size_t dlen;
+
+ /* Find the end of dst and adjust bytes left but don't go past end */
+ while (n-- != 0 && *d != '\0')
+ d++;
+ dlen = d - dst;
+ n = siz - dlen;
+
+ if (n == 0)
+ return(dlen + strlen(s));
+ while (*s != '\0') {
+ if (n != 1) {
+ *d++ = *s;
+ n--;
+ }
+ s++;
+ }
+ *d = '\0';
+
+ return(dlen + (s - src)); /* count does not include NUL */
+}
+
+/*
+ * Copy src to string dst of size siz. At most siz-1 characters
+ * will be copied. Always NUL terminates (unless siz == 0).
+ * Returns strlen(src); if retval >= siz, truncation occurred.
+ */
+size_t
+strlcpy(char *dst, const char *src, size_t siz)
+{
+ register char *d = dst;
+ register const char *s = src;
+ register size_t n = siz;
+
+ /* Copy as many bytes as will fit */
+ if (n != 0 && --n != 0) {
+ do {
+ if ((*d++ = *s++) == 0)
+ break;
+ } while (--n != 0);
+ }
+
+ /* Not enough room in dst, add NUL and traverse rest of src */
+ if (n == 0) {
+ if (siz != 0)
+ *d = '\0'; /* NUL-terminate dst */
+ while (*s++)
+ ;
+ }
+
+ return(s - src - 1); /* count does not include NUL */
+}
#endif
rootpaerror_t httpPostAndReceiveCommand(const char* const inputP, const char** linkP, const char** relP, const char** commandP)
@@ -129,14 +227,14 @@ rootpaerror_t httpDeleteAndReceiveCommand(const char** linkP, const char** relP,
}
-typedef struct
+typedef struct
{
char* memoryP;
size_t size;
} MemoryStruct;
-
-typedef struct
+
+typedef struct
{
char* linkP;
size_t linkSize;
@@ -144,7 +242,7 @@ typedef struct
size_t relSize;
} HeaderStruct;
-typedef struct
+typedef struct
{
const char* responseP;
size_t size;
@@ -160,7 +258,7 @@ static size_t readResponseCallback(void *ptr, size_t size, size_t nmemb, void *u
LOGD(">>readResponseCallback %d %d %d\n", (int) totalSize, (int) rspP->size, rspP->offset);
if(rspP->offset>=rspP->size) return 0;
-
+
if(totalSize<((rspP->size)))
{
readSize=totalSize;
@@ -177,25 +275,25 @@ static size_t readResponseCallback(void *ptr, size_t size, size_t nmemb, void *u
LOGD("<<readResponseCallback %d %d %d\n", (int) readSize, (int) rspP->size, rspP->offset);
return readSize;
}
-
+
static size_t writeMemoryCallback(void *contents, size_t size, size_t nmemb, void *userp)
{
size_t realsize = size * nmemb;
MemoryStruct* mem = (MemoryStruct *)userp;
mem->memoryP = (char*)realloc(mem->memoryP, mem->size + realsize + 1);
if (mem->memoryP == NULL) {
- /* out of memory! */
+ /* out of memory! */
LOGE("not enough memory (realloc returned NULL)\n");
return 0; // returning anything different from what was passed to this function indicates an error
}
-
+
memcpy(&(mem->memoryP[mem->size]), contents, realsize);
mem->size += realsize;
mem->memoryP[mem->size] = 0;
-
+
return realsize;
}
-
+
#ifdef __DEBUG
int debug_function (CURL * curl_handle, curl_infotype info, char* debugMessageP, size_t debugMessageSize, void * extrabufferP)
{
@@ -220,18 +318,18 @@ bool copyHeader(void *contents, size_t length, char** headerP)
{
*headerP = (char *)malloc(length + 1);
if (*headerP == NULL) {
- /* out of memory! */
+ /* out of memory! */
LOGE("not enough memory (malloc returned NULL)\n");
return false;
}
-
+
memcpy(*headerP , contents, length);
- (*headerP)[length] = 0;
+ (*headerP)[length] = 0;
return true;
}
//
-// The header format is as follow
+// The header format is as follow
// Link <https://se.cgbe.trustonic.com:8443/activity/00000000-4455-6677-8899-aabbccddeeff>;rel="http://10.0.2.2/relation/system_info"
// parse out uri's specified in Link and rel
//
@@ -244,11 +342,11 @@ bool updateLinkAndRel(HeaderStruct* memP, void* ptr)
startP=strcasestr((char*) ptr, "Link");
if(NULL==startP) return false;
-
+
startP=strstr(startP,"<");
if(NULL==startP) return false;
startP++;
-
+
endP=strstr(startP,">");
if(NULL==endP) return false;
@@ -264,14 +362,14 @@ bool updateLinkAndRel(HeaderStruct* memP, void* ptr)
if(NULL==startP)
{
return true;
- }
+ }
startP+=5; // sizeof "rel="
-
+
endP=strstr(startP,"\"");
if(NULL==endP)
{
- return true;
- }
+ return true;
+ }
memP->relSize=endP-startP;
if(copyHeader(startP, memP->relSize, &(memP->relP))==false)
{
@@ -306,18 +404,31 @@ void setCertPath(const char* localPathP, const char* certPathP)
{
memset(certificatePath_, 0, CERT_PATH_MAX_LEN);
memset(certificateFilePath_, 0, CERT_PATH_MAX_LEN);
-
- if (certPathP!=NULL && (strlen(certPathP)+1)<CERT_PATH_MAX_LEN)
+
+ if (certPathP!=NULL && (strlen(certPathP)+1)<CERT_PATH_MAX_LEN)
{
+#ifdef TIZEN
strlcpy(certificatePath_, certPathP, sizeof(certificatePath_));
+#else
+ strncpy(certificatePath_, certPathP, sizeof(certificatePath_));
+#endif
}
-
- if (localPathP!=NULL && (strlen(localPathP)+1+sizeof(CECERT_FILENAME))<CERT_PATH_MAX_LEN)
+
+ if (localPathP!=NULL && (strlen(localPathP)+1+sizeof(CECERT_FILENAME))<CERT_PATH_MAX_LEN)
{
+#ifdef TIZEN
strlcpy(certificateFilePath_, localPathP,sizeof(certificateFilePath_));
strlcat(certificateFilePath_, "/",sizeof(certificateFilePath_));
+#else
+ strncpy(certificateFilePath_, localPathP,sizeof(certificateFilePath_));
+ strncat(certificateFilePath_, "/",sizeof(certificateFilePath_));
+#endif
}
+#ifdef TIZEN
strlcat(certificateFilePath_, CECERT_FILENAME,sizeof(certificateFilePath_));
+#else
+ strncat(certificateFilePath_, CECERT_FILENAME,sizeof(certificateFilePath_));
+#endif
}
//
// TODO-refactor: saveCertFile is duplicate from saveFile in xmlMessageHandler.c, move these to common place
@@ -326,7 +437,7 @@ void saveCertFile(char* filePath, char* fileContent)
{
FILE* fh;
LOGD(">>saveCertFile %s", filePath);
- if ((fh = fopen(filePath, "w")) != NULL) // recreating the file every time, this is not the most efficient way, but ensures
+ if ((fh = fopen(filePath, "w")) != NULL) // recreating the file every time, this is not the most efficient way, but ensures
{ // the file is updated in case rootpa and the required content is updated
fprintf(fh, "%s", fileContent);
fclose(fh);
@@ -341,20 +452,20 @@ void saveCertFile(char* filePath, char* fileContent)
bool setBasicOpt(CURL* curl_handle, MemoryStruct* chunkP, HeaderStruct* headerChunkP, const char* linkP, struct curl_slist* headerListP)
{
long int se_connection_timeout=SE_CONNECTION_DEFAULT_TIMEOUT;
-
+
if(curl_easy_setopt(curl_handle, CURLOPT_URL, linkP)!=CURLE_OK)
{
LOGE("curl_easy_setopt CURLOPT_URL failed");
return false;
}
-
+
/* reading response to memory instead of file */
if(curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, writeMemoryCallback)!=CURLE_OK)
{
LOGE("curl_easy_setopt CURLOPT_WRITEFUNCTION failed");
return false;
}
-
+
if(curl_easy_setopt(curl_handle, CURLOPT_HEADERFUNCTION, writeHeaderCallback)!=CURLE_OK)
{
LOGE("curl_easy_setopt CURLOPT_HEADERFUNCTION failed");
@@ -379,9 +490,9 @@ bool setBasicOpt(CURL* curl_handle, MemoryStruct* chunkP, HeaderStruct* headerCh
LOGE("curl_easy_setopt CURLOPT_HTTPHEADER failed");
return false;
}
-
+
/* some servers don't like requests that are made without a user-agent
- field, so we provide one */
+ field, so we provide one */
if(curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "rpa/1.0")!=CURLE_OK)
{
LOGE("curl_easy_setopt CURLOPT_USERAGENT failed");
@@ -396,7 +507,7 @@ bool setBasicOpt(CURL* curl_handle, MemoryStruct* chunkP, HeaderStruct* headerCh
saveCertFile(certificateFilePath_, CA_CERTIFICATES);
-
+
LOGD("curl_easy_setopt CURLOPT_CAINFO %s", certificateFilePath_);
if(curl_easy_setopt(curl_handle, CURLOPT_CAINFO, certificateFilePath_)!=CURLE_OK)
{
@@ -409,18 +520,18 @@ bool setBasicOpt(CURL* curl_handle, MemoryStruct* chunkP, HeaderStruct* headerCh
{
LOGE("curl_easy_setopt CURLOPT_CAPATH failed");
return false;
- }
+ }
#ifdef __DEBUG
curl_easy_setopt(curl_handle, CURLOPT_VERBOSE, 1L);
- curl_easy_setopt(curl_handle, CURLOPT_DEBUGFUNCTION, debug_function);
-
+ curl_easy_setopt(curl_handle, CURLOPT_DEBUGFUNCTION, debug_function);
+
if(strncmp(linkP, NONEXISTENT_TEST_URL, shorter(strlen(NONEXISTENT_TEST_URL), strlen(linkP)))==0)
{
se_connection_timeout=3L; // reducing the connection timeout for testing purposes
MAX_ATTEMPTS=1; // this is for testint code, we are using nonexitent url here so no unncessary attempts
LOGD("setBasicOpt timeout set to %ld", se_connection_timeout);
- }
+ }
#endif
if(curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, se_connection_timeout)!=CURLE_OK)
@@ -430,7 +541,7 @@ bool setBasicOpt(CURL* curl_handle, MemoryStruct* chunkP, HeaderStruct* headerCh
}
/** libcurl uses the http_proxy and https_proxy environment variables for proxy settings.
- That variable is set in the OS specific wrapper. These are left here in order to make
+ That variable is set in the OS specific wrapper. These are left here in order to make
this comment earier to be found in searches.
curl_easy_setopt(curl_handle,CURLOPT_PROXY, "http://proxyaddress");
@@ -438,7 +549,7 @@ bool setBasicOpt(CURL* curl_handle, MemoryStruct* chunkP, HeaderStruct* headerCh
curl_easy_setopt(curl_handle,CURLOPT_PROXYUSERNAME, "read_proxy_username");
curl_easy_setopt(curl_handle,CURLOPT_PROXYPASSWORD, "read_proxy_password");
*/
-
+
return true;
}
@@ -478,7 +589,7 @@ bool setPutOpt(CURL* curl_handle, ResponseStruct* responseChunk)
LOGE("curl_easy_setopt CURLOPT_INFILESIZE_LARGE failed");
return false;
}
-
+
LOGD("<<setPutOpt");
return true;
}
@@ -486,14 +597,14 @@ bool setPutOpt(CURL* curl_handle, ResponseStruct* responseChunk)
bool setPostOpt(CURL* curl_handle, const char* inputP)
{
LOGD(">>setPostOpt %ld %d", (long int) inputP, inputP?(int)strlen(inputP):0);
-
+
if (curl_easy_setopt(curl_handle, CURLOPT_POST, 1L)!=CURLE_OK)
{
LOGE("curl_easy_setopt CURLOPT_POST failed");
return false;
}
- if(NULL==inputP)
+ if(NULL==inputP)
{
if (curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDSIZE, 0L)!=CURLE_OK)
{
@@ -501,7 +612,7 @@ bool setPostOpt(CURL* curl_handle, const char* inputP)
return false;
}
}
-
+
if (curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDS, (void*) inputP)!=CURLE_OK)
{
LOGE("curl_easy_setopt CURLOPT_POSTFIELDS failed");
@@ -514,6 +625,7 @@ bool setPostOpt(CURL* curl_handle, const char* inputP)
bool setDeleteOpt(CURL* curl_handle, const char* inputP)
{
+ (void) inputP;
LOGD(">>setDeleteOpt %s", inputP);
if (curl_easy_setopt(curl_handle, CURLOPT_CUSTOMREQUEST, "DELETE")!=CURLE_OK)
{
@@ -568,12 +680,12 @@ rootpaerror_t httpCommunicate(const char * const inputP, const char** linkP, con
ResponseStruct responseChunk;
MemoryStruct chunk;
- HeaderStruct headerChunk;
+ HeaderStruct headerChunk;
headerChunk.linkSize = 0;
headerChunk.relSize = 0;
headerChunk.linkP = NULL;
headerChunk.relP = NULL;
-
+
LOGD(">>httpCommunicate");
if(NULL==linkP || NULL==relP || NULL==commandP || NULL==*linkP)
{
@@ -583,8 +695,8 @@ rootpaerror_t httpCommunicate(const char * const inputP, const char** linkP, con
*commandP=NULL;
*relP=NULL;
- chunk.size = 0; /* no data at this point */
- chunk.memoryP = (char *)malloc(1); /* will be grown as needed by the realloc above */
+ chunk.size = 0; /* no data at this point */
+ chunk.memoryP = (char *)malloc(1); /* will be grown as needed by the realloc above */
if(NULL==chunk.memoryP)
{
return ROOTPA_ERROR_OUT_OF_MEMORY;
@@ -592,7 +704,7 @@ rootpaerror_t httpCommunicate(const char * const inputP, const char** linkP, con
chunk.memoryP[0]=0;
LOGD("HTTP method %d", method);
-
+
//Process HTTP methods
if(method == httpMethod_PUT)
{
@@ -635,18 +747,18 @@ rootpaerror_t httpCommunicate(const char * const inputP, const char** linkP, con
}
}
- /* disable Expect: 100-continue since it creates problems with some proxies, it is only related to post but we do it here for simplicity */
+ /* disable Expect: 100-continue since it creates problems with some proxies, it is only related to post but we do it here for simplicity */
httpHeaderP = curl_slist_append(httpHeaderP, "Expect:");
httpHeaderP = curl_slist_append(httpHeaderP, "Content-Type: application/vnd.mcorecm+xml;v=1.0");
- httpHeaderP = curl_slist_append(httpHeaderP, "Accept: application/vnd.mcorecm+xml;v=1.0");
+ httpHeaderP = curl_slist_append(httpHeaderP, "Accept: application/vnd.mcorecm+xml;v=1.0");
if(setBasicOpt(curl_handle_, &chunk, &headerChunk, *linkP, httpHeaderP)==false)
{
LOGE("setBasicOpt failed");
free(chunk.memoryP);
- return ROOTPA_ERROR_NETWORK;
+ return ROOTPA_ERROR_NETWORK;
}
- begintime=time(NULL);
+ begintime=time(NULL);
while(curlRet!=CURLE_OK && attempts++ < MAX_ATTEMPTS)
{
curlRet=curl_easy_perform(curl_handle_);
@@ -668,37 +780,37 @@ rootpaerror_t httpCommunicate(const char * const inputP, const char** linkP, con
}
curl_easy_getinfo (curl_handle_, CURLINFO_RESPONSE_CODE, &http_code);
- if(curlRet!=CURLE_OK)
+ if(curlRet!=CURLE_OK)
{
LOGE("curl_easy_perform failed %ld", curlRet);
free(chunk.memoryP);
free(headerChunk.linkP);
free(headerChunk.relP);
- curl_easy_reset(curl_handle_);
+ curl_easy_reset(curl_handle_);
return ROOTPA_ERROR_NETWORK;
}
-
+
LOGD("http return code from SE %ld", (long int) http_code);
- if ((200 <= http_code && http_code < 300))
+ if ((200 <= http_code && http_code < 300))
{
- ret=ROOTPA_OK;
+ ret=ROOTPA_OK;
}
- else if (HTTP_CODE_BAD_REQUEST == http_code ||
- HTTP_CODE_METHOD_NOT_ALLOWED == http_code ||
- HTTP_CODE_NOT_ACCEPTABLE == http_code ||
- HTTP_CODE_CONFLICT == http_code ||
+ else if (HTTP_CODE_BAD_REQUEST == http_code ||
+ HTTP_CODE_METHOD_NOT_ALLOWED == http_code ||
+ HTTP_CODE_NOT_ACCEPTABLE == http_code ||
+ HTTP_CODE_CONFLICT == http_code ||
HTTP_CODE_LENGTH_REQUIRED == http_code ||
HTTP_CODE_TOO_LONG == http_code ||
HTTP_CODE_UNSUPPORTED_MEDIA == http_code ||
HTTP_CODE_INVALID_DATA == http_code ||
- HTTP_CODE_INTERNAL_ERROR == http_code ||
+ HTTP_CODE_INTERNAL_ERROR == http_code ||
HTTP_CODE_HTTP_VERSION == http_code)
{
LOGE("SE returned http error %ld", (long int) http_code);
ret=ROOTPA_ERROR_INTERNAL;
}
else if(HTTP_CODE_MOVED == http_code || // new URL would be in Location: header but RootPA does not support in currently (unless libcurl supports it transparently)
- HTTP_CODE_REQUEST_TIMEOUT == http_code ||
+ HTTP_CODE_REQUEST_TIMEOUT == http_code ||
HTTP_CODE_SERVICE_UNAVAILABLE == http_code)
{
LOGE("SE returned http error %ld", (long int) http_code);
@@ -708,7 +820,7 @@ rootpaerror_t httpCommunicate(const char * const inputP, const char** linkP, con
{
LOGE("SE returned http error %ld", (long int) http_code);
ret=ROOTPA_ERROR_SE_CMP_VERSION;
- }
+ }
else if (HTTP_CODE_FAILED_DEPENDENCY == http_code)
{
LOGE("SE returned http error %ld", (long int) http_code);
@@ -717,27 +829,27 @@ rootpaerror_t httpCommunicate(const char * const inputP, const char** linkP, con
else if (HTTP_CODE_NOT_FOUND == http_code)
{
LOGE("SE returned http error %ld", (long int) http_code);
- ret=ROOTPA_ERROR_ILLEGAL_ARGUMENT; // since the arguments (spid, in some cases uuid) for the URL are received from the client,
- // this can be returned. It is also possible that suid is wrong (corrupted in device or info
+ ret=ROOTPA_ERROR_ILLEGAL_ARGUMENT; // since the arguments (spid, in some cases uuid) for the URL are received from the client,
+ // this can be returned. It is also possible that suid is wrong (corrupted in device or info
// from device binding missing from SE, but we can not detect that easily.
}
else
{
LOGE("unexpected http return code from SE %ld", (long int)http_code);
- ret=ROOTPA_ERROR_NETWORK;
+ ret=ROOTPA_ERROR_NETWORK;
}
-
- /* cleanup curl stuff */
-
+
+ /* cleanup curl stuff */
+
*commandP=chunk.memoryP; // this needs to be freed by client
*linkP=headerChunk.linkP; // this needs to be freed by client
*relP=headerChunk.relP; // this needs to be freed by client
- if (httpHeaderP) curl_slist_free_all(httpHeaderP); // since we disabled some headers
+ if (httpHeaderP) curl_slist_free_all(httpHeaderP); // since we disabled some headers
curl_easy_reset(curl_handle_);
LOGD("%lu bytes retrieved\n", (long)chunk.size);
-
- LOGD("<<httpCommunicate %d %ld %ld", (int) ret, (long int) http_code, (long int) curlRet);
+
+ LOGD("<<httpCommunicate %d %ld %ld", (int) ret, (long int) http_code, (long int) curlRet);
return ret;
}
diff --git a/mobicore/rootpa/Code/Common/seclient.h b/mobicore/rootpa/Code/Common/seclient.h
index b590891..88e0ab5 100644
--- a/mobicore/rootpa/Code/Common/seclient.h
+++ b/mobicore/rootpa/Code/Common/seclient.h
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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 SECLIENT_H
#define SECLIENT_H
@@ -45,8 +45,8 @@ typedef enum
@param linkP note that client has to free the memory from *linkP after using it
@param relP note that client has to free he memory from *relP after using it
@param commandP note that client has to free he memory from *commandP after using it
-
- @return ROOTPA_OK on success. In case of an error *relP and *commandP are set to NULL;
+
+ @return ROOTPA_OK on success. In case of an error *relP and *commandP are set to NULL;
linkP is not change but the original link remains.
*/
diff --git a/mobicore/rootpa/Code/Common/tools.h b/mobicore/rootpa/Code/Common/tools.h
index 46dd0d9..8452850 100644
--- a/mobicore/rootpa/Code/Common/tools.h
+++ b/mobicore/rootpa/Code/Common/tools.h
@@ -1,44 +1,44 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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 OWNTOOLS_H
#define OWNTOOLS_H
-#ifdef WIN32
-
-#include <windows.h>
-
-#define likely(cond) cond
+#ifdef WIN32
+
+#include <windows.h>
+
+#define likely(cond) cond
#define unlikely(cond) cond
-#define bad_read_ptr(_p,_c) IsBadReadPtr((const void *)(_p),(UINT_PTR)(_c))
+#define bad_read_ptr(_p,_c) IsBadReadPtr((const void *)(_p),(UINT_PTR)(_c))
#define bad_write_ptr(_p,_c) IsBadWritePtr((void *)(_p),(UINT_PTR)(_c))
#else
diff --git a/mobicore/rootpa/Code/Common/trustletchannel.c b/mobicore/rootpa/Code/Common/trustletchannel.c
index 37ca308..1d1e60f 100644
--- a/mobicore/rootpa/Code/Common/trustletchannel.c
+++ b/mobicore/rootpa/Code/Common/trustletchannel.c
@@ -1,38 +1,38 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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 <string.h>
#ifdef WIN32
#include <cstring>
- #include <sys/stat.h>
+ #include <sys/stat.h>
#endif
#include <wrapper.h>
#include <stdlib.h>
@@ -60,16 +60,16 @@ mcResult_t OpenSysTaFromRegistry(
uint8_t * tci,
uint32_t tciLen)
{
-
-
+
+
size_t taSize;
int result;
struct stat fstat;
mcResult_t status = MC_DRV_ERR_UNKNOWN;
uint8_t * taBlob;
int lastErr;
-
-
+
+
// get registry path
// TODO-2013-07-17-jearig01 import registry from global variable
@@ -86,7 +86,7 @@ mcResult_t OpenSysTaFromRegistry(
printf("app path--> %s\n",trustedAppPath);
printf("registryPath path--> %s\n",registryPath);
printf("hx--> %s\n",hx);
-
+
//check file
result = stat(trustedAppPath, &fstat);
if (result!=0) return MC_DRV_ERR_TRUSTLET_NOT_FOUND;
@@ -96,13 +96,13 @@ mcResult_t OpenSysTaFromRegistry(
FILE *infile = fopen(trustedAppPath, "rb");
if (infile == NULL) return MC_DRV_ERR_TRUSTLET_NOT_FOUND;
-
+
taBlob = (uint8_t *) malloc(taSize);
if (taBlob == NULL)
- {
+ {
fclose(infile);
- return MC_DRV_ERR_NO_FREE_MEMORY;
- }
+ return MC_DRV_ERR_NO_FREE_MEMORY;
+ }
result = fread (taBlob, 1, taSize, infile);
@@ -111,13 +111,13 @@ mcResult_t OpenSysTaFromRegistry(
{
// Call OpenTrustlet
printf("app path--> %d - %d\n",tciLen, taSize);
- status = mcOpenTrustlet(session, 0, taBlob, taSize, tci, tciLen);
+ status = mcOpenTrustlet(session, 0, taBlob, taSize, tci, tciLen);
}
-
+
// free blobs, necessary data are supposed to have been sent to SWd and are now useless in NWd
fclose(infile);
free(taBlob);
-
+
return status;
}
#endif
@@ -148,7 +148,7 @@ CMTHANDLE taChannelOpen(int sizeOfWsmBuffer, mcResult_t* result, const mcUuid_t
*result = mcOpenDevice(tltChannelDeviceId);
- if (MC_DRV_OK != *result)
+ if (MC_DRV_OK != *result)
{
LOGE("taChannelOpen: Unable to open device, error: %d", *result);
free(handle);
@@ -158,7 +158,7 @@ CMTHANDLE taChannelOpen(int sizeOfWsmBuffer, mcResult_t* result, const mcUuid_t
*result = mcMallocWsm(tltChannelDeviceId, 0, sizeOfWsmBuffer, &handle->wsmP, 0);
- if (MC_DRV_OK != *result)
+ if (MC_DRV_OK != *result)
{
LOGE("taChannelOpen: Allocation of CMP WSM failed, error: %d", *result);
mcCloseDevice(tltChannelDeviceId);
@@ -178,7 +178,7 @@ CMTHANDLE taChannelOpen(int sizeOfWsmBuffer, mcResult_t* result, const mcUuid_t
*result = mcOpenSession(&handle->session,uuidP, handle->wsmP,(uint32_t)sizeOfWsmBuffer);
#endif
}
-
+
if (MC_DRV_OK != *result)
{
LOGE("taChannelOpen: Open session failed, error: %d", *result);
@@ -200,7 +200,7 @@ void tltChannelClose(CMTHANDLE handle){
if (!bad_read_ptr(handle,sizeof(CMTSTRUCT)))
{
result = mcCloseSession(&handle->session);
- if (MC_DRV_OK != result)
+ if (MC_DRV_OK != result)
{
LOGE("tltChannelClose: Closing session failed:, error: %d", result);
}
@@ -208,7 +208,7 @@ void tltChannelClose(CMTHANDLE handle){
if (NULL!=handle->wsmP) mcFreeWsm(tltChannelDeviceId, handle->wsmP);
result = mcCloseDevice(tltChannelDeviceId);
- if (MC_DRV_OK != result)
+ if (MC_DRV_OK != result)
{
LOGE("tltChannelClose: Closing MobiCore device failed, error: %d", result);
}
@@ -217,7 +217,7 @@ void tltChannelClose(CMTHANDLE handle){
}
/*
-Initiate transfer of the data between NWD and SWD. The actual data needs to be copied to wsmP beforehand
+Initiate transfer of the data between NWD and SWD. The actual data needs to be copied to wsmP beforehand
(and from it afterwards in case of response)
*/
bool tltChannelTransmit(CMTHANDLE handle, int timeout){
@@ -237,7 +237,7 @@ bool tltChannelTransmit(CMTHANDLE handle, int timeout){
handle->lasterror = mcWaitNotification(&handle->session, timeout);
- if (unlikely( MC_DRV_OK!=handle->lasterror ))
+ if (unlikely( MC_DRV_OK!=handle->lasterror ))
{
LOGE("tltChannelTransmit: Wait for response notification failed, error: %d", handle->lasterror);
return false;
diff --git a/mobicore/rootpa/Code/Common/trustletchannel.h b/mobicore/rootpa/Code/Common/trustletchannel.h
index 9840075..e1c5333 100644
--- a/mobicore/rootpa/Code/Common/trustletchannel.h
+++ b/mobicore/rootpa/Code/Common/trustletchannel.h
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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 TRUSTLETCHANNEL_H
#define TRUSTLETCHANNEL_H
@@ -56,7 +56,7 @@ Open session to content management trustlet and allocate enough memory for commu
CMTHANDLE tltChannelOpen(int sizeOfWsmBuffer, mcResult_t* result);
/**
-Open session to TA and allocate enough memory for communication. There are two way to do this, give TA uuid or TA binary, binary length and spid.
+Open session to TA and allocate enough memory for communication. There are two way to do this, give TA uuid or TA binary, binary length and spid.
The former works with system TA's the latter with SP TA's.
*/
CMTHANDLE taChannelOpen(int sizeOfWsmBuffer, mcResult_t* result, const mcUuid_t* uuidP, uint8_t* taBinaryP, uint32_t taLength, mcSpid_t spid);
diff --git a/mobicore/rootpa/Code/Common/xmlmessagehandler.c b/mobicore/rootpa/Code/Common/xmlmessagehandler.c
index 4383d02..072c1e0 100644
--- a/mobicore/rootpa/Code/Common/xmlmessagehandler.c
+++ b/mobicore/rootpa/Code/Common/xmlmessagehandler.c
@@ -1,43 +1,50 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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 <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <wrapper.h>
#include <stdint.h>
+#ifdef TIZEN
+#include <stdarg.h>
+extern int asprintf (char **result, const char *format, ...)
+ __attribute__ ((__format__ (__printf__, 2, 3)));
+extern int vasprintf (char **result, const char *format, va_list args)
+ __attribute__ ((__format__ (__printf__, 2, 0)));
+#endif
-#include <libxml/parser.h>
-#include <libxml/valid.h>
-#include <libxml/xmlschemas.h>
+#include <libxml/parser.h>
+#include <libxml/valid.h>
+#include <libxml/xmlschemas.h>
#include <mcVersionInfo.h>
@@ -48,13 +55,13 @@ OF THE POSSIBILITY OF SUCH DAMAGE.
#include "provisioningengine.h"
#include "base64.h"
-#define ENROLLMENT_SERVICE_NS_PREFIX 0 // "mces"
+#define ENROLLMENT_SERVICE_NS_PREFIX 0 // "mces"
#define ENROLLMENT_SERVICE_NAMESPACE "http://www.mcore.gi-de.com/2012/04/schema/EnrollmentService"
-#define PLATFORM_TYPES_NS_PREFIX "mcpt"
+#define PLATFORM_TYPES_NS_PREFIX "mcpt"
#define PLATFORM_TYPES_NAMESPACE "http://www.mcore.gi-de.com/2012/02/schema/MCPlatformTypes"
-#define XSD_PATH_MAX_LEN 256
+#define XSD_PATH_MAX_LEN 1024
#define INT_BUFFER_LENGTH 11
#define UNKNOWN_ID 0xFFFFFFFF
@@ -79,8 +86,8 @@ static xmlNsPtr typesNameSpace_=NULL;
xmlDocPtr createXmlResponse()
{
- xmlDocPtr docP = NULL;
- xmlNodePtr root_node = NULL;
+ xmlDocPtr docP = NULL;
+ xmlNodePtr root_node = NULL;
docP = xmlNewDoc(BAD_CAST "1.0");
root_node = xmlNewNode(nameSpace_, BAD_CAST "ContentManagementResponse");
@@ -103,7 +110,7 @@ bool addTrustletData(xmlNodePtr rootNode, bool tltBin, char* contentP)
{
element="tltBin";
}
-
+
if(xmlNewChild(trustletDataNode, nameSpace_, BAD_CAST element, BAD_CAST contentP)==NULL ) return false;
return true;
}
@@ -111,52 +118,63 @@ bool addTrustletData(xmlNodePtr rootNode, bool tltBin, char* contentP)
char* errorCodeToString(rootpaerror_t errorCode)
{
+ char* returnErrorCode = STRING_ROOTPA_ERROR_INTERNAL;
+
switch(errorCode)
{
case ROOTPA_COMMAND_NOT_SUPPORTED:
- return STRING_ROOTPA_COMMAND_NOT_SUPPORTED;
+ returnErrorCode = STRING_ROOTPA_COMMAND_NOT_SUPPORTED;
+ break;
case ROOTPA_ERROR_LOCK:
- return STRING_ROOTPA_ERROR_LOCK;
+ returnErrorCode = STRING_ROOTPA_ERROR_LOCK;
+ break;
//
// this is not currently understood by SE
//
// case ROOTPA_ERROR_COMMAND_EXECUTION:
-// return STRING_ROOTPA_ERROR_COMMAND_EXECUTION;
+// returnErrorCode = STRING_ROOTPA_ERROR_COMMAND_EXECUTION;
+// break;
case ROOTPA_ERROR_REGISTRY:
- return STRING_ROOTPA_ERROR_REGISTRY;
-
+ returnErrorCode = STRING_ROOTPA_ERROR_REGISTRY;
+ break;
+
case ROOTPA_ERROR_MOBICORE_CONNECTION:
- return STRING_ROOTPA_ERROR_MOBICORE_CONNECTION;
+ returnErrorCode = STRING_ROOTPA_ERROR_MOBICORE_CONNECTION;
+ break;
case ROOTPA_ERROR_OUT_OF_MEMORY:
- return STRING_ROOTPA_ERROR_OUT_OF_MEMORY;
+ returnErrorCode = STRING_ROOTPA_ERROR_OUT_OF_MEMORY;
+ break;
case ROOTPA_ERROR_INTERNAL:
- return STRING_ROOTPA_ERROR_INTERNAL;
+ returnErrorCode = STRING_ROOTPA_ERROR_INTERNAL;
+ break;
case ROOTPA_ERROR_XML:
- return STRING_ROOTPA_ERROR_XML;
+ returnErrorCode = STRING_ROOTPA_ERROR_XML;
+ break;
case ROOTPA_ERROR_REGISTRY_OBJECT_NOT_AVAILABLE:
- return STRING_ROOTPA_ERROR_REGISTRY_OBJECT_NOT_AVAILABLE;
-
+ returnErrorCode = STRING_ROOTPA_ERROR_REGISTRY_OBJECT_NOT_AVAILABLE;
+ break;
}
LOGD("errorCodeToString: unknown error code %d", errorCode);
- return STRING_ROOTPA_ERROR_INTERNAL;
+
+ return returnErrorCode;
}
bool addCommandResultData(xmlNodePtr resultListNode, int id, char* commandResultP, rootpaerror_t errorCode, uint32_t errorDetail )
{
bool retValue;
char intBuffer[INT_BUFFER_LENGTH];
-
+
xmlNodePtr commandResultNode=xmlNewChild(resultListNode, nameSpace_, BAD_CAST "commandResult", NULL);
if(NULL==commandResultNode) return false;
- retValue=true;
+ retValue=true;
snprintf(intBuffer,INT_BUFFER_LENGTH,"%u",(uint32_t) id);
if(xmlNewProp(commandResultNode, BAD_CAST "id", BAD_CAST intBuffer)==NULL) return false;
@@ -166,14 +184,14 @@ bool addCommandResultData(xmlNodePtr resultListNode, int id, char* commandResul
if( NULL==errorNode ) return false; // CommandExecutionError
if(xmlNewProp(errorNode, BAD_CAST "errorCode", BAD_CAST errorCodeToString(errorCode))==NULL)
- {
+ {
retValue=false;
- }
+ }
else if(errorDetail!=0)
{
snprintf(intBuffer,INT_BUFFER_LENGTH,"%u",errorDetail);
if(xmlNewProp(errorNode, BAD_CAST "errorDetail", BAD_CAST intBuffer)==NULL)
- {
+ {
retValue=false;
}
}
@@ -181,7 +199,7 @@ bool addCommandResultData(xmlNodePtr resultListNode, int id, char* commandResul
else
{
if(xmlNewChild(commandResultNode, nameSpace_, BAD_CAST "resultValue", BAD_CAST commandResultP)==NULL )
- {
+ {
retValue=false;
}
}
@@ -193,19 +211,19 @@ xmlNodePtr findFirstCommandNode(xmlDocPtr xmlDocP)
{
xmlNodePtr commandsNodeP;
xmlNodePtr rootElementP;
-
+
rootElementP = xmlDocGetRootElement(xmlDocP);
if(NULL==rootElementP) return NULL;
commandsNodeP=rootElementP->children;
- for (; commandsNodeP; commandsNodeP = commandsNodeP->next)
+ for (; commandsNodeP; commandsNodeP = commandsNodeP->next)
{
- if (commandsNodeP->type == XML_ELEMENT_NODE && strcmp((char*)commandsNodeP->name, "commands")==0)
+ if (commandsNodeP->type == XML_ELEMENT_NODE && strcmp((char*)commandsNodeP->name, "commands")==0)
{
break;
}
}
- if(NULL==commandsNodeP) return NULL;
+ if(NULL==commandsNodeP) return NULL;
return commandsNodeP->children;
}
@@ -223,9 +241,9 @@ xmlNodePtr getNextCommand(xmlDocPtr xmlDocP, xmlNodePtr prevNode)
firstNode=prevNode->next;
}
- for (commandNode = firstNode; commandNode; commandNode = commandNode->next)
+ for (commandNode = firstNode; commandNode; commandNode = commandNode->next)
{
- if (commandNode->type == XML_ELEMENT_NODE && strcmp((char*)commandNode->name, "command")==0)
+ if (commandNode->type == XML_ELEMENT_NODE && strcmp((char*)commandNode->name, "command")==0)
{
break;
}
@@ -265,7 +283,7 @@ commandtype_t getCommandType(xmlNodePtr commandNode)
}
else
{
- LOGE("type property does not exist");
+ LOGE("type property does not exist");
}
return type;
}
@@ -277,15 +295,15 @@ char* getCommandValue(xmlNodePtr commandNode)
{
xmlNodePtr commandValueNodeP=commandNode->children;
- for (; commandValueNodeP; commandValueNodeP = commandValueNodeP->next)
+ for (; commandValueNodeP; commandValueNodeP = commandValueNodeP->next)
{
- if (commandValueNodeP->type == XML_ELEMENT_NODE && strcmp((char*)commandValueNodeP->name, "commandValue")==0)
+ if (commandValueNodeP->type == XML_ELEMENT_NODE && strcmp((char*)commandValueNodeP->name, "commandValue")==0)
{
break;
}
}
- if(NULL==commandValueNodeP) return NULL;
-
+ if(NULL==commandValueNodeP) return NULL;
+
return (char*) xmlNodeGetContent(commandValueNodeP);
}
@@ -303,13 +321,13 @@ bool getCommandIgnoreError(xmlNodePtr commandNode)
xmlFree(attribute);
}
- return ignoreError;
+ return ignoreError;
}
void getValues(xmlNodePtr commandNodeP, commandtype_t* commandTypeP, uint32_t* idP, char** commandValueP, bool* ignoreErrorP)
{
*commandTypeP=getCommandType(commandNodeP);
- *idP=getCommandId(commandNodeP);
+ *idP=getCommandId(commandNodeP);
*commandValueP=(char*) getCommandValue(commandNodeP);
*ignoreErrorP=getCommandIgnoreError(commandNodeP);
}
@@ -322,12 +340,12 @@ uint32_t extractCmpCommand(CmpMessage** cmpCommandsP, uint32_t numberOfCmpComman
if(tmpCommandsP!=NULL)
{
localCommandsP=tmpCommandsP;
- *cmpCommandsP=localCommandsP;
-
+ *cmpCommandsP=localCommandsP;
+
memset(&(localCommandsP[numberOfCmpCommands]), 0,sizeof(CmpMessage));
if(commandValueP)
{
- localCommandsP[numberOfCmpCommands].length= base64DecodeStringRemoveEndZero(commandValueP,
+ localCommandsP[numberOfCmpCommands].length= base64DecodeStringRemoveEndZero(commandValueP,
(char**) &(localCommandsP[numberOfCmpCommands].contentP));
if(0==localCommandsP[numberOfCmpCommands].length)
{
@@ -340,12 +358,12 @@ uint32_t extractCmpCommand(CmpMessage** cmpCommandsP, uint32_t numberOfCmpComman
else
{
localCommandsP[numberOfCmpCommands].hdr.ret=ROOTPA_ERROR_XML;
- }
+ }
}
else
{
LOGE("handleCmpCommand: was not able to realloc");
- // In this case we can not return an error to SE unless we set some of the earlier errors.
+ // In this case we can not return an error to SE unless we set some of the earlier errors.
if(!ignoreError)
{
free(*cmpCommandsP);
@@ -368,14 +386,14 @@ rootpaerror_t handleCmpResponses(uint32_t maxNumberOfCmpResponses, CmpMessage* c
{
LOGE("maxNumberOfCmpResponses %d while pointer is NULL", maxNumberOfCmpResponses);
return ROOTPA_ERROR_INTERNAL;
- }
+ }
return ROOTPA_OK;
- }
+ }
for(i=0; (i<maxNumberOfCmpResponses) && (ROOTPA_OK==ret); i++)
{
char* encodedResponseP=NULL;
- if((ROOTPA_ERROR_COMMAND_EXECUTION==cmpResponsesP[i].hdr.ret ||
+ if((ROOTPA_ERROR_COMMAND_EXECUTION==cmpResponsesP[i].hdr.ret ||
ROOTPA_OK==cmpResponsesP[i].hdr.ret) && cmpResponsesP[i].contentP!=NULL)
{
encodedResponseP=base64EncodeAddEndZero((char*) cmpResponsesP[i].contentP, cmpResponsesP[i].length);
@@ -403,11 +421,11 @@ rootpaerror_t handleCmpResponses(uint32_t maxNumberOfCmpResponses, CmpMessage* c
return ret;
}
-uint32_t handleUploadCommand(commandtype_t commandType,
- CommonMessage** uploadCommandsP,
- uint32_t numberOfUploadCommands,
- uint32_t id,
- char* commandValueP,
+uint32_t handleUploadCommand(commandtype_t commandType,
+ CommonMessage** uploadCommandsP,
+ uint32_t numberOfUploadCommands,
+ uint32_t id,
+ char* commandValueP,
bool ignoreError)
{
uint8_t* containerDataP = NULL;
@@ -425,13 +443,13 @@ uint32_t handleUploadCommand(commandtype_t commandType,
numberOfUploadCommands=0;
}
return numberOfUploadCommands;
- // In this case we can not return an error to SE unless we set some of the earlier errors.
+ // In this case we can not return an error to SE unless we set some of the earlier errors.
}
-
+
localCommandsP=tmpCommandsP;
*uploadCommandsP=localCommandsP;
memset(&(localCommandsP[numberOfUploadCommands]), 0,sizeof(CommonMessage));
-
+
if(NULL == commandValueP)
{
localCommandsP[numberOfUploadCommands++].ret=ROOTPA_ERROR_XML;
@@ -447,21 +465,21 @@ uint32_t handleUploadCommand(commandtype_t commandType,
LOGE("handleUploadCommand: base64 decoding failed");
localCommandsP[numberOfUploadCommands].ret=ROOTPA_ERROR_INTERNAL;
}
-
+
if(TLT_UPLOAD == commandType)
{
localCommandsP[numberOfUploadCommands].ret = uploadTrustlet(containerDataP, containerLength);
}
else if (SO_UPLOAD == commandType)
- {
- localCommandsP[numberOfUploadCommands].ret = uploadSo(containerDataP,
- containerLength,
+ {
+ localCommandsP[numberOfUploadCommands].ret = uploadSo(containerDataP,
+ containerLength,
&localCommandsP[numberOfUploadCommands].intRet);
}
else
{
LOGE("handleUploadCommand: unknown command type %d this should not have happened", commandType);
- localCommandsP[numberOfUploadCommands].ret=ROOTPA_ERROR_INTERNAL;
+ localCommandsP[numberOfUploadCommands].ret=ROOTPA_ERROR_INTERNAL;
}
free(containerDataP);
localCommandsP[numberOfUploadCommands].id=id;
@@ -494,17 +512,17 @@ rootpaerror_t handleUploadResponses(uint32_t numberOfUploadResponses, CommonMess
char* encodedResponseP=NULL;
if(ROOTPA_OK == uploadResponsesP[i].ret)
{
- // in success case TLT_UPLOAD and SO_UPLOAD return "0" (encoded) in the resultValue
+ // in success case TLT_UPLOAD and SO_UPLOAD return "0" (encoded) in the resultValue
// field (discussed and agreed with Dimi Jan 10, 2013)
encodedResponseP=base64EncodeAddEndZero(&zero, 1);
}
-
+
if( addCommandResultData(rspResultElementP, uploadResponsesP[i].id, encodedResponseP, uploadResponsesP[i].ret, uploadResponsesP[i].intRet )==false)
{
ret=ROOTPA_ERROR_XML;
}
free(encodedResponseP);
-
+
LOGD("handleUploadResponses, in loop idx %d ret %d ignore %d", i, uploadResponsesP[i].ret , uploadResponsesP[i].ignoreError);
if(uploadResponsesP[i].ret != ROOTPA_OK && false == uploadResponsesP[i].ignoreError)
{
@@ -521,7 +539,7 @@ rootpaerror_t handleCommandAndFillResponse(xmlDocPtr xmlCommandP, xmlDocPtr xmlR
rootpaerror_t ret=ROOTPA_OK;
rootpaerror_t tmpRet=ROOTPA_OK;
xmlNodePtr rspRootElementP;
-
+
CmpMessage* cmpCommandsP=NULL;
CommonMessage* uploadCommandsP=NULL;
@@ -535,25 +553,25 @@ rootpaerror_t handleCommandAndFillResponse(xmlDocPtr xmlCommandP, xmlDocPtr xmlR
bool ignoreError=0;
xmlNodePtr commandNode=NULL;
int i;
-
+
LOGD(">>handleCommandAndFillResponse");
-
- rspRootElementP = xmlDocGetRootElement(xmlResponseP);
+
+ rspRootElementP = xmlDocGetRootElement(xmlResponseP);
if(NULL==rspRootElementP) return ROOTPA_ERROR_XML;
// parse command data out of xml, upload commands will also be executed
-
+
while((commandNode=getNextCommand(xmlCommandP, commandNode))!=NULL)
{
getValues(commandNode, &commandType, &id, &commandValueP, &ignoreError);
switch(commandType)
{
case CMP:
- {
+ {
numberOfCmpCommands=extractCmpCommand(&cmpCommandsP, numberOfCmpCommands, id, commandValueP, ignoreError);
if(0==numberOfCmpCommands)
{
- ret=ROOTPA_ERROR_OUT_OF_MEMORY;
+ ret=ROOTPA_ERROR_OUT_OF_MEMORY;
}
break;
}
@@ -564,9 +582,9 @@ rootpaerror_t handleCommandAndFillResponse(xmlDocPtr xmlCommandP, xmlDocPtr xmlR
if(0==numberOfUploadCommands)
{
ret=ROOTPA_ERROR_OUT_OF_MEMORY;
- }
+ }
break;
- default:
+ default:
LOGE("handleCommandAndFillResponse: received unknown command");
// we will still work with the other commands in case there are any
break;
@@ -574,9 +592,9 @@ rootpaerror_t handleCommandAndFillResponse(xmlDocPtr xmlCommandP, xmlDocPtr xmlR
xmlFree(commandValueP);
if(ROOTPA_ERROR_OUT_OF_MEMORY == ret) break;
-
- if(commandType != CMP &&
- false == ignoreError &&
+
+ if(commandType != CMP &&
+ false == ignoreError &&
uploadCommandsP &&
uploadCommandsP[numberOfUploadCommands-1].ret != ROOTPA_OK) break; // since upload commands are already executed in this loop
}
@@ -593,40 +611,40 @@ rootpaerror_t handleCommandAndFillResponse(xmlDocPtr xmlCommandP, xmlDocPtr xmlR
}
else
{
- memset(cmpResponsesP, 0, sizeof(CmpMessage)*numberOfCmpCommands);
+ memset(cmpResponsesP, 0, sizeof(CmpMessage)*numberOfCmpCommands);
tmpRet=executeContentManagementCommands(numberOfCmpCommands, cmpCommandsP, cmpResponsesP, &internalError);
if(ROOTPA_OK!=tmpRet)
{
LOGE("call to executeContentManagementCommands failed with %d, continuing anyway", tmpRet);
// return code from executeContentManagementCommands is here more informative than anything else
- // even in an error case we need to return response to SE, the errors are also included in the
+ // even in an error case we need to return response to SE, the errors are also included in the
// actual CMP messages.
ret=tmpRet;
}
}
}
-
+
// fill response
if (ret!=ROOTPA_ERROR_OUT_OF_MEMORY)
{
xmlNodePtr resultListNodeP=xmlNewChild(rspRootElementP, nameSpace_, BAD_CAST "commandResultList", NULL);
- tmpRet=handleCmpResponses(numberOfCmpCommands, cmpResponsesP, resultListNodeP);
+ tmpRet=handleCmpResponses(numberOfCmpCommands, cmpResponsesP, resultListNodeP);
if(ROOTPA_OK!=tmpRet)
{
LOGE("handleCommandAndFillResponse: not able to handle all Cmp responses, still continuing with UploadResponses %d", tmpRet);
ret=tmpRet;
- }
+ }
tmpRet=handleUploadResponses(numberOfUploadCommands, uploadCommandsP, resultListNodeP);
if(ROOTPA_OK!=tmpRet)
{
LOGE("handleCommandAndFillResponse: not able to handle all Upload responses %d", tmpRet);
ret=tmpRet;
- }
+ }
}
// cleanup what has not yet been cleaned
for(i=0; i<numberOfCmpCommands; i++)
- {
+ {
if(cmpCommandsP) free(cmpCommandsP[i].contentP);
if(cmpResponsesP) free(cmpResponsesP[i].contentP);
}
@@ -638,39 +656,40 @@ rootpaerror_t handleCommandAndFillResponse(xmlDocPtr xmlCommandP, xmlDocPtr xmlR
return ret;
}
-void handleError(void* ctx, const char *format, ...)
-{
+void handleError(void* ctx, const char *format, ...)
+{
+ (void) ctx;
#ifdef WIN32
#define ERROR_LOG_LENGTH 256
char errMsg[ERROR_LOG_LENGTH];
- va_list args;
- va_start(args, format);
- vsnprintf(errMsg, ERROR_LOG_LENGTH, format, args);
+ va_list args;
+ va_start(args, format);
+ vsnprintf(errMsg, ERROR_LOG_LENGTH, format, args);
va_end(args);
LOGW("From libxml2: %s", errMsg);
#else
- char *errMsg;
+ char *errMsg;
- va_list args;
- va_start(args, format);
- vasprintf(&errMsg, format, args);
- va_end(args);
+ va_list args;
+ va_start(args, format);
+ vasprintf(&errMsg, format, args);
+ va_end(args);
LOGW("From libxml2: %s", errMsg);
free(errMsg);
#endif
-}
+}
/*
-This is for saving the required xml schema files so that the libxml2 code can read it,
+This is for saving the required xml schema files so that the libxml2 code can read it,
to be called only if the files do not exist of can not be parsed
*/
void saveFile(char* filePath, char* fileContent)
{
-
+
FILE* fh;
LOGD(">>saveFile %s", filePath);
if ((fh = fopen(filePath, "w")) != NULL)
@@ -687,57 +706,57 @@ void saveFile(char* filePath, char* fileContent)
bool validXmlMessage(xmlDocPtr xmlDocP)
-{
-
+{
+
int result=-2;
-#ifdef LIBXML_SCHEMAS_ENABLED
-
- xmlSchemaParserCtxtPtr parserCtxtP = NULL;
- xmlSchemaPtr schemaP = NULL;
- xmlSchemaValidCtxtPtr validCtxtP = NULL;
+#ifdef LIBXML_SCHEMAS_ENABLED
+
+ xmlSchemaParserCtxtPtr parserCtxtP = NULL;
+ xmlSchemaPtr schemaP = NULL;
+ xmlSchemaValidCtxtPtr validCtxtP = NULL;
LOGD(">>validXmlMessage %s", enrollmentServiceFullPath_);
// Here we store the schemas if they are not already on "disk". It seems
// xmlSchemaNewParserCtxt succeeds even if the file does not exists and it is
-// xmlSchemaParse that requires the file to exists. That is why the files are
-// created if schemaP==NULL. Since we are using static library, this can be
+// xmlSchemaParse that requires the file to exists. That is why the files are
+// created if schemaP==NULL. Since we are using static library, this can be
// easily controlled even if there are changes in the behavior
parserCtxtP = xmlSchemaNewParserCtxt(enrollmentServiceFullPath_);
- schemaP = xmlSchemaParse(parserCtxtP);
+ schemaP = xmlSchemaParse(parserCtxtP);
if (!schemaP)
{
LOGW("validXmlMessage, no schema ctxt, attempting to save xsd files");
saveFile(platformTypesFullPath_, PLATFORM_TYPES_XSD);
saveFile(enrollmentServiceFullPath_, ENROLLMENT_SERVICE_XSD);
- schemaP = xmlSchemaParse(parserCtxtP);
- if (!schemaP){
+ schemaP = xmlSchemaParse(parserCtxtP);
+ if (!schemaP){
LOGE("validXmlMessage, was not able to save xsd files");
- goto cleanup;
+ goto cleanup;
}
- }
+ }
- validCtxtP = xmlSchemaNewValidCtxt(schemaP);
- if (!validCtxtP){
+ validCtxtP = xmlSchemaNewValidCtxt(schemaP);
+ if (!validCtxtP){
LOGE("validXmlMessage, no validCtxtP");
goto cleanup;
}
- result=xmlSchemaValidateDoc(validCtxtP, xmlDocP);
+ result=xmlSchemaValidateDoc(validCtxtP, xmlDocP);
cleanup:
-
+
if (parserCtxtP) xmlSchemaFreeParserCtxt(parserCtxtP);
- if (schemaP) xmlSchemaFree(schemaP);
+ if (schemaP) xmlSchemaFree(schemaP);
if (validCtxtP) xmlSchemaFreeValidCtxt(validCtxtP);
-
- LOGD("<<validXmlMessage %d", result);
+
+ LOGD("<<validXmlMessage %d", result);
return ((0==result)?true:false);
-
- #else // !LIBXML_SCHEMAS_ENABLED
+
+ #else // !LIBXML_SCHEMAS_ENABLED
LOGD("<<validXmlMessage");
return true;
- #endif // LIBXML_SCHEMAS_ENABLED
+ #endif // LIBXML_SCHEMAS_ENABLED
}
uint8_t* validateDumpAndFree(xmlDocPtr xmlResponseP)
@@ -754,8 +773,8 @@ uint8_t* validateDumpAndFree(xmlDocPtr xmlResponseP)
if(dumpP!=NULL)
{
// doing this copy only because libxml2 documentation tells to
- // release the memory with xmlFree, not free and we want to keep
- // libxml use strictly in this file. It is likely that xmlFree is
+ // release the memory with xmlFree, not free and we want to keep
+ // libxml use strictly in this file. It is likely that xmlFree is
// compatible with free but since I have not verified it, this is to
// be on the safe side
@@ -773,20 +792,20 @@ uint8_t* validateDumpAndFree(xmlDocPtr xmlResponseP)
// functions used from outside of this file
-/**
+/**
in case an error is returned *responseP is set to NULL
*/
rootpaerror_t handleXmlMessage(const char* messageP, const char** responseP)
{
-
+
rootpaerror_t ret=ROOTPA_OK;
- rootpaerror_t tmpRet=ROOTPA_OK;
+ rootpaerror_t tmpRet=ROOTPA_OK;
xmlDocPtr xmlDocP;
xmlDocPtr xmlResponseP;
*responseP=NULL;
- LOGD(">>handleXmlMessage");
-
+ LOGD(">>handleXmlMessage");
+
if (NULL==messageP)
{
LOGE("handleXmlMessage, no messageP");
@@ -807,13 +826,13 @@ rootpaerror_t handleXmlMessage(const char* messageP, const char** responseP)
if(!validXmlMessage(xmlDocP))
{
- LOGE("handleXmlMessage, invalid message %s", messageP);
+ LOGE("handleXmlMessage, invalid message %s", messageP);
ret=ROOTPA_ERROR_XML;
// attempting to parse the message anyway.
}
xmlResponseP=createXmlResponse();
-
+
// parse received command
if(xmlResponseP)
@@ -825,14 +844,14 @@ rootpaerror_t handleXmlMessage(const char* messageP, const char** responseP)
{
ret=ROOTPA_ERROR_XML;
}
-
+
if(xmlResponseP && xmlResponseP->children) // if there is something to return to SE, return it.
- {
+ {
*responseP = (char*)validateDumpAndFree(xmlResponseP);
}
else
{
- if(xmlResponseP) xmlFreeDoc(xmlResponseP);
+ if(xmlResponseP) xmlFreeDoc(xmlResponseP);
}
if(xmlDocP) xmlFreeDoc(xmlDocP);
@@ -850,31 +869,31 @@ rootpaerror_t fillSystemInfo(xmlNodePtr systemInfoNode, const osInfo_t* osSpecif
LOGD("imei %s", osSpecificInfoP->imeiEsnP);
if(xmlNewProp(systemInfoNode, BAD_CAST "imei", BAD_CAST osSpecificInfoP->imeiEsnP)==NULL) return ROOTPA_ERROR_XML;
}
-
+
if(osSpecificInfoP->mnoP)
{
LOGD("mno %s", osSpecificInfoP->mnoP);
if(xmlNewProp(systemInfoNode, BAD_CAST "mno", BAD_CAST osSpecificInfoP->mnoP)==NULL) return ROOTPA_ERROR_XML;
}
-
+
if(osSpecificInfoP->brandP)
{
LOGD("brand %s", osSpecificInfoP->brandP);
if(xmlNewProp(systemInfoNode, BAD_CAST "brand", BAD_CAST osSpecificInfoP->brandP)==NULL) return ROOTPA_ERROR_XML;
}
-
+
if(osSpecificInfoP->manufacturerP)
{
LOGD("manufacturer %s", osSpecificInfoP->manufacturerP);
if(xmlNewProp(systemInfoNode, BAD_CAST "manufacturer", BAD_CAST osSpecificInfoP->manufacturerP)==NULL) return ROOTPA_ERROR_XML;
}
-
+
if(osSpecificInfoP->hardwareP)
{
LOGD("hardware %s", osSpecificInfoP->hardwareP);
if(xmlNewProp(systemInfoNode, BAD_CAST "hardware", BAD_CAST osSpecificInfoP->hardwareP)==NULL) return ROOTPA_ERROR_XML;
}
-
+
if(osSpecificInfoP->modelP)
{
LOGD("model %s", osSpecificInfoP->modelP);
@@ -893,38 +912,39 @@ rootpaerror_t fillSystemInfo(xmlNodePtr systemInfoNode, const osInfo_t* osSpecif
rootpaerror_t fillMcVersion(xmlNodePtr mcVersionNode, int mcVersionTag, const mcVersionInfo_t* mcVersionP)
{
+ (void) mcVersionTag;
char intBuffer[INT_BUFFER_LENGTH];
LOGD(">>fillMcVersion");
xmlSetStructuredErrorFunc(NULL, NULL);
xmlSetGenericErrorFunc(NULL, handleError);
xmlThrDefSetStructuredErrorFunc(NULL, NULL);
- xmlThrDefSetGenericErrorFunc(NULL, handleError);
-
+ xmlThrDefSetGenericErrorFunc(NULL, handleError);
+
if(xmlNewProp(mcVersionNode, BAD_CAST "productId", BAD_CAST mcVersionP->productId)==NULL) return ROOTPA_ERROR_XML;
snprintf(intBuffer,INT_BUFFER_LENGTH,"%u",mcVersionP->versionMci);
if(xmlNewProp(mcVersionNode, BAD_CAST "versionMci", BAD_CAST intBuffer)==NULL) return ROOTPA_ERROR_XML;
snprintf(intBuffer,INT_BUFFER_LENGTH,"%u",mcVersionP->versionSo);
- if(xmlNewProp(mcVersionNode, BAD_CAST "versionSo", BAD_CAST intBuffer)==NULL) return ROOTPA_ERROR_XML;
+ if(xmlNewProp(mcVersionNode, BAD_CAST "versionSo", BAD_CAST intBuffer)==NULL) return ROOTPA_ERROR_XML;
snprintf(intBuffer,INT_BUFFER_LENGTH,"%u",mcVersionP->versionMclf);
- if(xmlNewProp(mcVersionNode, BAD_CAST "versionMclf", BAD_CAST intBuffer)==NULL) return ROOTPA_ERROR_XML;
+ if(xmlNewProp(mcVersionNode, BAD_CAST "versionMclf", BAD_CAST intBuffer)==NULL) return ROOTPA_ERROR_XML;
snprintf(intBuffer,INT_BUFFER_LENGTH,"%u",mcVersionP->versionContainer);
- if(xmlNewProp(mcVersionNode, BAD_CAST "versionContainer", BAD_CAST intBuffer)==NULL) return ROOTPA_ERROR_XML;
+ if(xmlNewProp(mcVersionNode, BAD_CAST "versionContainer", BAD_CAST intBuffer)==NULL) return ROOTPA_ERROR_XML;
snprintf(intBuffer,INT_BUFFER_LENGTH,"%u",mcVersionP->versionMcConfig);
- if(xmlNewProp(mcVersionNode, BAD_CAST "versionMcConfig", BAD_CAST intBuffer)==NULL) return ROOTPA_ERROR_XML;
+ if(xmlNewProp(mcVersionNode, BAD_CAST "versionMcConfig", BAD_CAST intBuffer)==NULL) return ROOTPA_ERROR_XML;
snprintf(intBuffer,INT_BUFFER_LENGTH,"%u",mcVersionP->versionTlApi);
- if(xmlNewProp(mcVersionNode, BAD_CAST "versionTlApi", BAD_CAST intBuffer)==NULL) return ROOTPA_ERROR_XML;
+ if(xmlNewProp(mcVersionNode, BAD_CAST "versionTlApi", BAD_CAST intBuffer)==NULL) return ROOTPA_ERROR_XML;
snprintf(intBuffer,INT_BUFFER_LENGTH,"%u",mcVersionP->versionDrApi);
- if(xmlNewProp(mcVersionNode, BAD_CAST "versionDrApi", BAD_CAST intBuffer)==NULL) return ROOTPA_ERROR_XML;
+ if(xmlNewProp(mcVersionNode, BAD_CAST "versionDrApi", BAD_CAST intBuffer)==NULL) return ROOTPA_ERROR_XML;
snprintf(intBuffer,INT_BUFFER_LENGTH,"%u",mcVersionP->versionCmp);
- if(xmlNewProp(mcVersionNode, BAD_CAST "versionCmp", BAD_CAST intBuffer)==NULL) return ROOTPA_ERROR_XML;
+ if(xmlNewProp(mcVersionNode, BAD_CAST "versionCmp", BAD_CAST intBuffer)==NULL) return ROOTPA_ERROR_XML;
LOGD("<<fillMcVersion");
return ROOTPA_OK;
@@ -943,10 +963,10 @@ rootpaerror_t buildXmlTrustletInstallationRequest(const char** responseP, trustl
LOGD(">>buildXmlTrustletInstallationRequest %ld (%ld %d %d)", (long int) responseP, (long int) data.dataP, data.dataLength, data.dataType);
if(NULL == responseP) return ROOTPA_ERROR_ILLEGAL_ARGUMENT; // data content checked earlier in commandhandler.c
- xmlResponseDocP=createXmlResponse();
- rspRootElementP = xmlDocGetRootElement(xmlResponseDocP);
+ xmlResponseDocP=createXmlResponse();
+ rspRootElementP = xmlDocGetRootElement(xmlResponseDocP);
if(NULL==rspRootElementP) return ROOTPA_ERROR_XML;
-
+
systemInfoNode=xmlNewChild(rspRootElementP, nameSpace_, BAD_CAST "tltInstallationRequest", NULL);
if(NULL==systemInfoNode) return ROOTPA_ERROR_XML;
@@ -956,7 +976,7 @@ rootpaerror_t buildXmlTrustletInstallationRequest(const char** responseP, trustl
LOGE("buildXmlTrustletInstallationRequest: base64 encoding of data failed");
return ROOTPA_ERROR_INTERNAL;
}
-
+
if(data.dataType == REQUEST_DATA_TLT)
{
mcDataNode = xmlNewChild(systemInfoNode, nameSpace_, BAD_CAST "trustletAxf", BAD_CAST encodedDataP);
@@ -982,7 +1002,7 @@ rootpaerror_t buildXmlTrustletInstallationRequest(const char** responseP, trustl
if(data.flags != DEFAULT_FLAGS)
{
- snprintf(intBuffer,INT_BUFFER_LENGTH,"%d",data.flags);
+ snprintf(intBuffer,INT_BUFFER_LENGTH,"%d",data.flags);
if(xmlNewProp(mcDataNode, BAD_CAST "flags", BAD_CAST intBuffer)==NULL)
{
free(encodedDataP);
@@ -992,51 +1012,51 @@ rootpaerror_t buildXmlTrustletInstallationRequest(const char** responseP, trustl
}
else
{
- mcDataNode = xmlNewChild(systemInfoNode, nameSpace_, BAD_CAST "trustletEncryptionKey", BAD_CAST encodedDataP);
+ mcDataNode = xmlNewChild(systemInfoNode, nameSpace_, BAD_CAST "trustletEncryptionKey", BAD_CAST encodedDataP);
}
-
+
snprintf(intBuffer,INT_BUFFER_LENGTH,"%d",data.minTltVersion);
if(xmlNewProp(mcDataNode, BAD_CAST "minTltVersion", BAD_CAST intBuffer)==NULL)
{
free(encodedDataP);
return ROOTPA_ERROR_XML;
}
-
+
pukHashStringP=base64EncodeAddEndZero((char*) data.tltPukHashP, data.tltPukHashLength);
if(NULL==pukHashStringP)
{
LOGE("buildXmlTrustletInstallationRequest: base64 encoding of PukHash failed");
- free(encodedDataP);
+ free(encodedDataP);
return ROOTPA_ERROR_INTERNAL;
}
if(xmlNewProp(mcDataNode, BAD_CAST "tltPukHash", BAD_CAST pukHashStringP)==NULL)
- {
- LOGE("buildXmlTrustletInstallationRequest: xmlNewProp failed");
+ {
+ LOGE("buildXmlTrustletInstallationRequest: xmlNewProp failed");
free(pukHashStringP);
- free(encodedDataP);
+ free(encodedDataP);
return ROOTPA_ERROR_XML;
}
free(pukHashStringP);
free(encodedDataP);
if(NULL==mcDataNode) return ROOTPA_ERROR_XML;
-
+
if(ROOTPA_OK==ret)
- {
+ {
*responseP=(char*)validateDumpAndFree(xmlResponseDocP);
}
xmlCleanupParser();
return ret;
- LOGD("<<buildXmlTrustletInstallationRequest");
+ LOGD("<<buildXmlTrustletInstallationRequest");
}
-/**
+/**
in case an error is returned *responseP is set to NULL
*/
rootpaerror_t buildXmlSystemInfo(const char** responseP, int mcVersionTag, const mcVersionInfo_t* mcVersionP, const osInfo_t* osSpecificInfoP)
{
-
+
rootpaerror_t ret=ROOTPA_OK;
xmlDocPtr xmlResponseDocP;
xmlNodePtr rspRootElementP;
@@ -1044,16 +1064,16 @@ rootpaerror_t buildXmlSystemInfo(const char** responseP, int mcVersionTag, const
xmlNodePtr mcVersionNode;
if(NULL == responseP || NULL == mcVersionP || NULL == osSpecificInfoP) return ROOTPA_ERROR_INTERNAL;
LOGD(">>buildXmlSystemInfo %ld %ld %ld", ( long int ) responseP, ( long int ) mcVersionP, ( long int ) osSpecificInfoP);
-
+
xmlSetStructuredErrorFunc(NULL, NULL);
xmlSetGenericErrorFunc(NULL, handleError);
xmlThrDefSetStructuredErrorFunc(NULL, NULL);
- xmlThrDefSetGenericErrorFunc(NULL, handleError);
-
- xmlResponseDocP=createXmlResponse();
- rspRootElementP= xmlDocGetRootElement(xmlResponseDocP);
+ xmlThrDefSetGenericErrorFunc(NULL, handleError);
+
+ xmlResponseDocP=createXmlResponse();
+ rspRootElementP= xmlDocGetRootElement(xmlResponseDocP);
if(NULL==rspRootElementP) return ROOTPA_ERROR_XML;
-
+
systemInfoNode=xmlNewChild(rspRootElementP, nameSpace_, BAD_CAST "systemInformation", NULL);
if(NULL==systemInfoNode) return ROOTPA_ERROR_XML;
@@ -1072,19 +1092,19 @@ rootpaerror_t buildXmlSystemInfo(const char** responseP, int mcVersionTag, const
LOGE("buildXmlSystemInfo: could not fill Mc version %d, continuing anyway", ret);
}
-
+
if(ROOTPA_OK==ret)
- {
+ {
*responseP=(char*)validateDumpAndFree(xmlResponseDocP);
}
xmlCleanupParser();
return ret;
- LOGD("<<buildXmlSystemInfo");
+ LOGD("<<buildXmlSystemInfo");
}
/**
-set the path where to look for and store the xsd files
+set the path where to look for and store the xsd files
*/
void setXsdPaths(const char* xsdpathP)
{
diff --git a/mobicore/rootpa/Code/Common/xmlmessagehandler.h b/mobicore/rootpa/Code/Common/xmlmessagehandler.h
index 6db9e2d..aac5806 100644
--- a/mobicore/rootpa/Code/Common/xmlmessagehandler.h
+++ b/mobicore/rootpa/Code/Common/xmlmessagehandler.h
@@ -1,33 +1,33 @@
/*
-Copyright © Trustonic Limited 2013
-
-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.
-*/
+ * Copyright (c) 2013 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 XMLMESSAGEHANDLER_H
#define XMLMESSAGEHANDLER_H
@@ -36,48 +36,48 @@ OF THE POSSIBILITY OF SUCH DAMAGE.
/**
@param xmlMessageP received xml message to be handled
- @param xmlResponseP response to the received message in xml format. The caller is
+ @param xmlResponseP response to the received message in xml format. The caller is
responsible on freeing the memory the pointer points to.
- @return ROOTPA_OK on success, ROOTPA_ERROR_ILLEGAL_ARGUMENT if
+ @return ROOTPA_OK on success, ROOTPA_ERROR_ILLEGAL_ARGUMENT if
xmlMessageP is NULL or if the message is not valid xml
- If error is returned, the error is also included in xmlResponse
- (unless there is problem in allocating memory) and the response
+ If error is returned, the error is also included in xmlResponse
+ (unless there is problem in allocating memory) and the response
should still be returned to SE.
-
+
*/
rootpaerror_t handleXmlMessage(const char* xmlMessageP, const char** xmlResponseP);
/**
From the given system info creates a xml string that can be returned to SE.
-@param responseP pointer to a char pointer where the response to the received message in xml
+@param responseP pointer to a char pointer where the response to the received message in xml
format is to be copied. The caller is responsible on freeing the memory the pointer points to.
@param mcVersionTag version of Mobicore version info
@param mcVersionP pointer to the mobicore version struct
@param osSpecificInfoP pointer to struct containing operating system specific information
-@return ROOTPA_OK on success, ROOTPA_ERROR_INTERNAL if
+@return ROOTPA_OK on success, ROOTPA_ERROR_INTERNAL if
xmlMessageP is NULL or if the message is not valid xml
- If error is returned, the error is also included in xmlResponse
- (unless there is problem in allocating memory) and the response
+ If error is returned, the error is also included in xmlResponse
+ (unless there is problem in allocating memory) and the response
should still be returned to SE.
-
+
*/
rootpaerror_t buildXmlSystemInfo(const char** responseP, int mcVersionTag, const mcVersionInfo_t* mcVersionP, const osInfo_t* osSpecificInfoP);
/**
Builds request for trustlet installation
-@param responseP pointer to a char pointer where the response to the received message in xml
+@param responseP pointer to a char pointer where the response to the received message in xml
format is to be copied. The caller is responsible on freeing the memory the pointer points to.
@param data, information needed for trustlet installation
-@return ROOTPA_OK on success, ROOTPA_ERROR_ILLEGAL_ARGUMENT if data.dataP is NULL, responseP is NULL or if data.dataType
+@return ROOTPA_OK on success, ROOTPA_ERROR_ILLEGAL_ARGUMENT if data.dataP is NULL, responseP is NULL or if data.dataType
has something else than the values in the type.
-
+
*/
rootpaerror_t buildXmlTrustletInstallationRequest(const char** responseP, trustletInstallationData_t data );
diff --git a/mobicore/tlcm/Android.mk b/mobicore/tlcm/Android.mk
new file mode 100644
index 0000000..8a28ebe
--- /dev/null
+++ b/mobicore/tlcm/Android.mk
@@ -0,0 +1,12 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := MobiCoreTlcm
+LOCAL_MODULE_TAGS := eng
+
+LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_EXPORT_C_INCLUDES)
+
+include $(BUILD_STATIC_LIBRARY)
+