summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2017-02-12 18:21:59 +0100
committerAndreas Schneider <asn@cryptomilk.org>2017-02-12 19:24:39 +0100
commita520935803cb0c7c0cd55990f7644f8f1d62e182 (patch)
treea591de528029a824cd20e315d873ed1a50071e3e
parentf82658c34beb6882e142dfae503f195d634d4fd0 (diff)
downloadandroid_hardware_samsung_slsi_exynos5430-a520935803cb0c7c0cd55990f7644f8f1d62e182.tar.gz
android_hardware_samsung_slsi_exynos5430-a520935803cb0c7c0cd55990f7644f8f1d62e182.tar.xz
android_hardware_samsung_slsi_exynos5430-a520935803cb0c7c0cd55990f7644f8f1d62e182.zip
mobicore: Update to t-base-301B Daemon and RootPA
This is compatible to Anroid L.
-rw-r--r--mobicore/Android.mk23
-rw-r--r--mobicore/CleanSpec.mk61
-rw-r--r--mobicore/MODULE_LICENSE_BSD0
-rw-r--r--mobicore/MobiCoreDriverLib/Android.mk (renamed from mobicore/daemon/Android.mk)80
-rw-r--r--mobicore/MobiCoreDriverLib/Application.mk (renamed from mobicore/daemon/Application.mk)7
-rw-r--r--mobicore/MobiCoreDriverLib/ClientLib/Android.mk (renamed from mobicore/daemon/ClientLib/Android.mk)0
-rw-r--r--mobicore/MobiCoreDriverLib/ClientLib/ClientLib.cpp (renamed from mobicore/daemon/ClientLib/ClientLib.cpp)116
-rw-r--r--mobicore/MobiCoreDriverLib/ClientLib/Device.cpp (renamed from mobicore/daemon/ClientLib/Device.cpp)34
-rw-r--r--mobicore/MobiCoreDriverLib/ClientLib/Device.h (renamed from mobicore/daemon/ClientLib/Device.h)17
-rw-r--r--mobicore/MobiCoreDriverLib/ClientLib/GP/tee_client_api.cpp (renamed from mobicore/daemon/ClientLib/GP/tee_client_api.cpp)91
-rw-r--r--mobicore/MobiCoreDriverLib/ClientLib/Session.cpp (renamed from mobicore/daemon/ClientLib/Session.cpp)15
-rw-r--r--mobicore/MobiCoreDriverLib/ClientLib/Session.h (renamed from mobicore/daemon/ClientLib/Session.h)13
-rw-r--r--mobicore/MobiCoreDriverLib/ClientLib/public/GP/tee_client_api.h (renamed from mobicore/daemon/ClientLib/public/GP/tee_client_api.h)0
-rw-r--r--mobicore/MobiCoreDriverLib/ClientLib/public/GP/tee_client_api_imp.h (renamed from mobicore/daemon/ClientLib/public/GP/tee_client_api_imp.h)0
-rw-r--r--mobicore/MobiCoreDriverLib/ClientLib/public/GP/tee_error.h131
-rw-r--r--mobicore/MobiCoreDriverLib/ClientLib/public/GP/tee_type.h (renamed from mobicore/daemon/ClientLib/public/GP/tee_type.h)83
-rw-r--r--mobicore/MobiCoreDriverLib/ClientLib/public/GP/uuid_attestation.h (renamed from mobicore/daemon/ClientLib/public/GP/uuid_attestation.h)36
-rw-r--r--mobicore/MobiCoreDriverLib/ClientLib/public/MobiCoreDriverApi.h (renamed from mobicore/daemon/ClientLib/public/MobiCoreDriverApi.h)105
-rw-r--r--mobicore/MobiCoreDriverLib/Common/Android.mk (renamed from mobicore/daemon/Common/Android.mk)8
-rw-r--r--mobicore/MobiCoreDriverLib/Common/CMutex.cpp (renamed from mobicore/daemon/Common/CMutex.cpp)11
-rw-r--r--mobicore/MobiCoreDriverLib/Common/CMutex.h (renamed from mobicore/daemon/Common/CMutex.h)11
-rw-r--r--mobicore/MobiCoreDriverLib/Common/CSemaphore.cpp (renamed from mobicore/daemon/Common/CSemaphore.cpp)11
-rw-r--r--mobicore/MobiCoreDriverLib/Common/CSemaphore.h (renamed from mobicore/daemon/Common/CSemaphore.h)11
-rw-r--r--mobicore/MobiCoreDriverLib/Common/CThread.cpp (renamed from mobicore/daemon/Common/CThread.cpp)15
-rw-r--r--mobicore/MobiCoreDriverLib/Common/CThread.h (renamed from mobicore/daemon/Common/CThread.h)11
-rw-r--r--mobicore/MobiCoreDriverLib/Common/CWsm.h (renamed from mobicore/daemon/Common/CWsm.h)15
-rw-r--r--mobicore/MobiCoreDriverLib/Common/Connection.cpp (renamed from mobicore/daemon/Common/Connection.cpp)44
-rw-r--r--mobicore/MobiCoreDriverLib/Common/Connection.h (renamed from mobicore/daemon/Common/Connection.h)17
-rw-r--r--mobicore/MobiCoreDriverLib/Common/McTypes.h (renamed from mobicore/daemon/Common/McTypes.h)11
-rw-r--r--mobicore/MobiCoreDriverLib/Common/NOTICE30
-rw-r--r--mobicore/MobiCoreDriverLib/Common/NetlinkConnection.cpp (renamed from mobicore/daemon/Common/NetlinkConnection.cpp)34
-rw-r--r--mobicore/MobiCoreDriverLib/Common/NetlinkConnection.h (renamed from mobicore/daemon/Common/NetlinkConnection.h)17
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/Android.mk (renamed from mobicore/daemon/Daemon/Android.mk)0
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/Device/Android.mk (renamed from mobicore/daemon/Daemon/Device/Android.mk)2
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/Device/DeviceIrqHandler.cpp (renamed from mobicore/daemon/Daemon/Device/DeviceIrqHandler.cpp)8
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/Device/DeviceIrqHandler.h (renamed from mobicore/daemon/Daemon/Device/DeviceIrqHandler.h)11
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/Device/DeviceScheduler.cpp (renamed from mobicore/daemon/Daemon/Device/DeviceScheduler.cpp)8
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/Device/DeviceScheduler.h (renamed from mobicore/daemon/Daemon/Device/DeviceScheduler.h)12
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/Device/MobiCoreDevice.cpp (renamed from mobicore/daemon/Daemon/Device/MobiCoreDevice.cpp)205
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/Device/NotificationQueue.cpp (renamed from mobicore/daemon/Daemon/Device/NotificationQueue.cpp)7
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/Device/NotificationQueue.h (renamed from mobicore/daemon/Daemon/Device/NotificationQueue.h)11
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/Device/Platforms/Android.mk (renamed from mobicore/daemon/Daemon/Device/Platforms/Android.mk)0
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/Device/Platforms/Generic/Android.mk (renamed from mobicore/daemon/Daemon/Device/Platforms/Generic/Android.mk)0
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/Device/Platforms/Generic/TrustZoneDevice.cpp (renamed from mobicore/daemon/Daemon/Device/Platforms/Generic/TrustZoneDevice.cpp)195
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/Device/Platforms/Generic/TrustZoneDevice.h (renamed from mobicore/daemon/Daemon/Device/Platforms/Generic/TrustZoneDevice.h)20
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/Device/TAExitHandler.cpp (renamed from mobicore/daemon/Daemon/Device/TAExitHandler.cpp)8
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/Device/TAExitHandler.h (renamed from mobicore/daemon/Daemon/Device/TAExitHandler.h)13
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/Device/TrustletSession.cpp (renamed from mobicore/daemon/Daemon/Device/TrustletSession.cpp)9
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/Device/TrustletSession.h (renamed from mobicore/daemon/Daemon/Device/TrustletSession.h)6
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/Device/public/MobiCoreDevice.h (renamed from mobicore/daemon/Daemon/Device/public/MobiCoreDevice.h)26
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/FSD/Android.mk (renamed from mobicore/daemon/Daemon/FSD/Android.mk)4
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/FSD/FSD.cpp (renamed from mobicore/daemon/Daemon/FSD/FSD.cpp)426
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/FSD/public/FSD.h (renamed from mobicore/daemon/Daemon/FSD/public/FSD.h)16
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/FSD/public/dci.h77
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/FSD/public/drSecureStorage_Api.h (renamed from mobicore/common/DrSecureStorage/drSecureStorage_Api.h)36
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/MobiCoreDriverDaemon.cpp (renamed from mobicore/daemon/Daemon/MobiCoreDriverDaemon.cpp)301
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/MobiCoreDriverDaemon.h (renamed from mobicore/daemon/Daemon/MobiCoreDriverDaemon.h)21
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/Server/Android.mk (renamed from mobicore/daemon/Daemon/Server/Android.mk)0
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/Server/NetlinkServer.cpp (renamed from mobicore/daemon/Daemon/Server/NetlinkServer.cpp)16
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/Server/Server.cpp (renamed from mobicore/daemon/Daemon/Server/Server.cpp)40
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/Server/public/ConnectionHandler.h (renamed from mobicore/daemon/Daemon/Server/public/ConnectionHandler.h)12
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/Server/public/NetlinkServer.h (renamed from mobicore/daemon/Daemon/Server/public/NetlinkServer.h)20
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/Server/public/Server.h (renamed from mobicore/daemon/Daemon/Server/public/Server.h)20
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/public/MobiCoreDriverCmd.h (renamed from mobicore/daemon/Daemon/public/MobiCoreDriverCmd.h)7
-rw-r--r--mobicore/MobiCoreDriverLib/Daemon/public/mcVersion.h (renamed from mobicore/daemon/Daemon/public/mcVersion.h)3
-rw-r--r--mobicore/MobiCoreDriverLib/Kernel/Android.mk (renamed from mobicore/daemon/Kernel/Android.mk)0
-rw-r--r--mobicore/MobiCoreDriverLib/Kernel/CKMod.cpp (renamed from mobicore/daemon/Kernel/CKMod.cpp)13
-rw-r--r--mobicore/MobiCoreDriverLib/Kernel/CKMod.h (renamed from mobicore/daemon/Kernel/CKMod.h)11
-rw-r--r--mobicore/MobiCoreDriverLib/Kernel/Platforms/Generic/Android.mk (renamed from mobicore/daemon/Kernel/Platforms/Generic/Android.mk)0
-rw-r--r--mobicore/MobiCoreDriverLib/Kernel/Platforms/Generic/CMcKMod.cpp (renamed from mobicore/daemon/Kernel/Platforms/Generic/CMcKMod.cpp)66
-rw-r--r--mobicore/MobiCoreDriverLib/Kernel/Platforms/Generic/CMcKMod.h (renamed from mobicore/daemon/Kernel/Platforms/Generic/CMcKMod.h)28
-rw-r--r--mobicore/MobiCoreDriverLib/NOTICE30
-rw-r--r--mobicore/MobiCoreDriverLib/Registry/Android.mk (renamed from mobicore/daemon/Registry/Android.mk)0
-rw-r--r--mobicore/MobiCoreDriverLib/Registry/PrivateRegistry.cpp (renamed from mobicore/daemon/Registry/PrivateRegistry.cpp)503
-rw-r--r--mobicore/MobiCoreDriverLib/Registry/PrivateRegistry.h (renamed from mobicore/daemon/Registry/PrivateRegistry.h)19
-rw-r--r--mobicore/MobiCoreDriverLib/Registry/Public/MobiCoreRegistry.h (renamed from mobicore/daemon/Registry/Public/MobiCoreRegistry.h)10
-rw-r--r--mobicore/MobiCoreDriverLib/Registry/Registry.cpp (renamed from mobicore/daemon/Registry/Registry.cpp)24
-rw-r--r--mobicore/MobiCoreDriverLib/build.sh (renamed from mobicore/daemon/build.sh)0
-rw-r--r--mobicore/MobiCoreDriverLib/buildTag.h33
-rw-r--r--mobicore/NOTICE25
-rw-r--r--mobicore/common/DrSecureStorage/dci.h57
-rw-r--r--mobicore/common/DrSecureStorage/drError.h34
-rw-r--r--mobicore/common/DrSecureStorage/tee_internal_api.h1109
-rw-r--r--mobicore/common/DrSecureStorage/tlDriverApi.h96
-rw-r--r--mobicore/common/LogWrapper/Android.mk15
-rw-r--r--mobicore/common/LogWrapper/log.h77
-rw-r--r--mobicore/common/MobiCore/inc/DrApi/DrApi.h28
-rw-r--r--mobicore/common/MobiCore/inc/DrApi/DrApiCommon.h84
-rw-r--r--mobicore/common/MobiCore/inc/DrApi/DrApiError.h67
-rw-r--r--mobicore/common/MobiCore/inc/DrApi/DrApiFastCall.h117
-rw-r--r--mobicore/common/MobiCore/inc/DrApi/DrApiHeap.h78
-rw-r--r--mobicore/common/MobiCore/inc/DrApi/DrApiIpcMsg.h280
-rw-r--r--mobicore/common/MobiCore/inc/DrApi/DrApiLogging.h71
-rw-r--r--mobicore/common/MobiCore/inc/DrApi/DrApiMcSystem.h49
-rw-r--r--mobicore/common/MobiCore/inc/DrApi/DrApiMm.h305
-rw-r--r--mobicore/common/MobiCore/inc/DrApi/DrApiThread.h265
-rw-r--r--mobicore/common/MobiCore/inc/DrApi/version.h17
-rw-r--r--mobicore/common/MobiCore/inc/FwDrv/DrApiFastCall.h117
-rw-r--r--mobicore/common/MobiCore/inc/GP/tee_type.h143
-rw-r--r--mobicore/common/MobiCore/inc/GP/uuid_attestation.h60
-rw-r--r--mobicore/common/MobiCore/inc/McLib/GpTci.h6
-rw-r--r--mobicore/common/MobiCore/inc/McLib/TlApiCryptoMarshal.h388
-rw-r--r--mobicore/common/MobiCore/inc/McLib/TlApiStorageMarshal.h88
-rw-r--r--mobicore/common/MobiCore/inc/McLib/TlApiTuiMarshal.h64
-rw-r--r--mobicore/common/MobiCore/inc/McLib/mcLibWB.h16
-rw-r--r--mobicore/common/MobiCore/inc/McLib/mclib_size.h18
-rw-r--r--mobicore/common/MobiCore/inc/McLib/tplay_marshal.h72
-rw-r--r--mobicore/common/MobiCore/inc/Mci/mci.h48
-rw-r--r--mobicore/common/MobiCore/inc/Mci/mcifc.h92
-rw-r--r--mobicore/common/MobiCore/inc/Mci/mcifcfunc.h193
-rw-r--r--mobicore/common/MobiCore/inc/Mci/mcimcp.h43
-rw-r--r--mobicore/common/MobiCore/inc/Mci/mcinq.h42
-rw-r--r--mobicore/common/MobiCore/inc/Mci/version.h40
-rw-r--r--mobicore/common/MobiCore/inc/TlCm/2.0/cmp.h126
-rw-r--r--mobicore/common/MobiCore/inc/TlCm/2.0/tlCmApi.h2
-rw-r--r--mobicore/common/MobiCore/inc/TlCm/3.0/cmp.h130
-rw-r--r--mobicore/common/MobiCore/inc/TlCm/3.0/cmpMap.h134
-rw-r--r--mobicore/common/MobiCore/inc/TlCm/3.0/tlCmApi.h4
-rw-r--r--mobicore/common/MobiCore/inc/TlCm/cmpCommon.h18
-rw-r--r--mobicore/common/MobiCore/inc/TlCm/tlCmApiCommon.h4
-rw-r--r--mobicore/common/MobiCore/inc/TlCm/tlCmError.h2
-rw-r--r--mobicore/common/MobiCore/inc/TlCm/tlCmUuid.h2
-rw-r--r--mobicore/common/MobiCore/inc/TlCm/version.h2
-rw-r--r--mobicore/common/MobiCore/inc/mcContainer.h60
-rw-r--r--mobicore/common/MobiCore/inc/mcDriverId.h37
-rw-r--r--mobicore/common/MobiCore/inc/mcLoadFormat.h68
-rw-r--r--mobicore/common/MobiCore/inc/mcRootid.h38
-rw-r--r--mobicore/common/MobiCore/inc/mcSo.h47
-rw-r--r--mobicore/common/MobiCore/inc/mcSpid.h41
-rw-r--r--mobicore/common/MobiCore/inc/mcSuid.h38
-rw-r--r--mobicore/common/MobiCore/inc/mcUuid.h44
-rw-r--r--mobicore/common/MobiCore/inc/mcVersionHelper.h63
-rw-r--r--mobicore/common/MobiCore/inc/mcVersionInfo.h38
-rw-r--r--mobicore/common/MobiCore/inc/version.md51
-rw-r--r--mobicore/daemon/CleanSpec.mk61
-rw-r--r--mobicore/daemon/ClientLib/public/GP/tee_error.h177
-rw-r--r--mobicore/daemon/ClientLib/public/GP/tee_internal_api_impl.h35
-rw-r--r--mobicore/daemon/ClientLib/public/Windows/t-base_client_api.def25
-rw-r--r--mobicore/daemon/ClientLib/public/Windows/t-base_client_api.sln20
-rw-r--r--mobicore/daemon/ClientLib/public/Windows/t-base_client_api.vcxproj109
-rw-r--r--mobicore/daemon/Daemon/Device/public/ExcDevice.h72
-rw-r--r--mobicore/daemon/Daemon/FSD/public/dci.h57
-rw-r--r--mobicore/daemon/Daemon/FSD/public/drSecureStorage_Api.h101
-rw-r--r--mobicore/daemon/MODULE_LICENSE_BSD0
-rw-r--r--mobicore/daemon/NOTICE25
-rw-r--r--mobicore/daemon/README.android64
-rw-r--r--mobicore/daemon/buildTag.h28
-rw-r--r--mobicore/include/Public/mc_linux.h80
-rw-r--r--mobicore/include/Public/version.h42
-rw-r--r--mobicore/provlib/Android.mk16
-rw-r--r--mobicore/provlib/Application.mk23
-rw-r--r--mobicore/provlib/buildTag.h28
-rw-r--r--mobicore/provlib/inc_private/gdmcdevicebinding.h101
-rw-r--r--mobicore/provlib/inc_private/gdmcinstance.h28
-rw-r--r--mobicore/provlib/inc_private/gdmcprovprotocol.h127
-rw-r--r--mobicore/provlib/inc_private/mobicore.h174
-rw-r--r--mobicore/provlib/inc_public/gdmcprovlib.h424
-rw-r--r--mobicore/provlib/jni/Android.mk35
-rw-r--r--mobicore/provlib/src/crc32.c49
-rw-r--r--mobicore/provlib/src/gdmcdevicebinding.cpp533
-rw-r--r--mobicore/provlib/src/gdmcprovlib.cpp408
-rw-r--r--mobicore/provlib/src/mobicore.c294
-rw-r--r--mobicore/rootpa/Code/Android/app/Android.mk2
-rw-r--r--mobicore/rootpa/Code/Android/app/NOTICE30
-rw-r--r--mobicore/rootpa/Code/Android/app/ant.properties7
-rw-r--r--mobicore/rootpa/Code/Android/app/build.xml52
-rw-r--r--mobicore/rootpa/Code/Android/app/jni/Android.mk2
-rw-r--r--mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/Android.mk36
-rw-r--r--mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/CmpBase.cpp45
-rw-r--r--mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/CmpResponses.cpp60
-rw-r--r--mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/JniHelpers.cpp102
-rw-r--r--mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/JniHelpers.h34
-rw-r--r--mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/NOTICE30
-rw-r--r--mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/com_gd_mobicore_pa_jni_CommonPAWrapper.h35
-rw-r--r--mobicore/rootpa/Code/Android/app/jni/CommonPAWrapper/commonwrapper.cpp229
-rw-r--r--mobicore/rootpa/Code/Android/app/jni/McStub/Android.mk2
-rw-r--r--mobicore/rootpa/Code/Android/app/jni/McStub/NOTICE30
-rw-r--r--mobicore/rootpa/Code/Android/app/res/values/version.xml4
-rw-r--r--mobicore/rootpa/Code/Android/app/src/com/gd/mobicore/pa/jni/CommonPAWrapper.java67
-rw-r--r--mobicore/rootpa/Code/Android/app/src/com/gd/mobicore/pa/service/BaseService.java126
-rw-r--r--mobicore/rootpa/Code/Android/app/src/com/gd/mobicore/pa/service/DeveloperService.java120
-rw-r--r--mobicore/rootpa/Code/Android/app/src/com/gd/mobicore/pa/service/OemService.java68
-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.mk4
-rw-r--r--mobicore/rootpa/Code/Android/lib/NOTICE30
-rw-r--r--mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/AbstractEnumParcel.java148
-rw-r--r--mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/BooleanResult.aidl66
-rw-r--r--mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/BooleanResult.java188
-rw-r--r--mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/CommandResult.java102
-rw-r--r--mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/IfcVersion.java35
-rw-r--r--mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/README.txt28
-rw-r--r--mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/RootPADeveloperIfc.aidl136
-rw-r--r--mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/RootPAProvisioningIntents.java180
-rw-r--r--mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/RootPAServiceIfc.aidl80
-rw-r--r--mobicore/rootpa/Code/Android/lib/src/com/gd/mobicore/pa/ifc/Version.java238
-rw-r--r--mobicore/rootpa/Code/Common/Android.mk (renamed from mobicore/rootpa/Code/Android/app/jni/Common/Android.mk)66
-rw-r--r--mobicore/rootpa/Code/Common/NOTICE30
-rw-r--r--mobicore/rootpa/Code/Common/base64.c43
-rw-r--r--mobicore/rootpa/Code/Common/commandhandler.c257
-rw-r--r--mobicore/rootpa/Code/Common/contentmanager.c21
-rw-r--r--mobicore/rootpa/Code/Common/enrollmentservicexmlschema.h32
-rw-r--r--mobicore/rootpa/Code/Common/include/logging.h43
-rw-r--r--mobicore/rootpa/Code/Common/include/provisioningagent.h131
-rw-r--r--mobicore/rootpa/Code/Common/include/rootpa.h78
-rw-r--r--mobicore/rootpa/Code/Common/include/rootpaErrors.h58
-rw-r--r--mobicore/rootpa/Code/Common/include/version.h34
-rw-r--r--mobicore/rootpa/Code/Common/include/wrapper.h30
-rw-r--r--mobicore/rootpa/Code/Common/pacmp3.c180
-rw-r--r--mobicore/rootpa/Code/Common/pacmp3.h34
-rw-r--r--mobicore/rootpa/Code/Common/pacmtl.c148
-rw-r--r--mobicore/rootpa/Code/Common/provisioningengine.c216
-rw-r--r--mobicore/rootpa/Code/Common/registry.c76
-rw-r--r--mobicore/rootpa/Code/Common/registry.h33
-rw-r--r--mobicore/rootpa/Code/Common/seclient.c245
-rw-r--r--mobicore/rootpa/Code/Common/tools.h13
-rw-r--r--mobicore/rootpa/Code/Common/trustletchannel.c160
-rw-r--r--mobicore/rootpa/Code/Common/trustletchannel.h38
-rw-r--r--mobicore/rootpa/Code/Common/xmlmessagehandler.c480
218 files changed, 5479 insertions, 11063 deletions
diff --git a/mobicore/Android.mk b/mobicore/Android.mk
index 7ac9806..85fb67c 100644
--- a/mobicore/Android.mk
+++ b/mobicore/Android.mk
@@ -5,6 +5,7 @@
# =============================================================================
MOBICORE_PROJECT_PATH := $(call my-dir)
# Setup common variables
+LOG_WRAPPER := $(MOBICORE_PROJECT_PATH)/common/LogWrapper
COMP_PATH_MobiCore := $(MOBICORE_PROJECT_PATH)/common/MobiCore
COMP_PATH_MobiCoreDriverMod := $(MOBICORE_PROJECT_PATH)/include
@@ -14,34 +15,24 @@ GLOBAL_INCLUDES := bionic \
external/stlport/stlport \
$(COMP_PATH_MobiCore)/inc \
$(COMP_PATH_MobiCoreDriverMod)/Public \
- $(COMP_PATH_MobiCore)/inc/TlCm \
- $(COMP_PATH_MobiCore)/inc/GP \
- $(MOBICORE_PROJECT_PATH)/common/DrSecureStorage
+ $(COMP_PATH_MobiCore)/inc/TlCm
GLOBAL_LIBRARIES := libstlport
# Include the Daemon
-include $(MOBICORE_PROJECT_PATH)/daemon/Android.mk
+include $(MOBICORE_PROJECT_PATH)/MobiCoreDriverLib/Android.mk
-MC_INCLUDE_DIR := \
- $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include \
- $(COMP_PATH_MobiCore)/inc \
- $(COMP_PATH_MobiCore)/inc/GP \
+MC_INCLUDE_DIR := $(COMP_PATH_MobiCore)/inc \
$(COMP_PATH_MobiCore)/inc/TlCm \
$(COMP_PATH_MobiCore)/inc/TlCm/2.0 \
- $(MOBICORE_PROJECT_PATH)/daemon/ClientLib/public \
- $(MOBICORE_PROJECT_PATH)/daemon/Registry/Public
-
+ $(MOBICORE_PROJECT_PATH)/MobiCoreDriverLib/ClientLib/public \
+ $(MOBICORE_PROJECT_PATH)/MobiCoreDriverLib/Registry/Public
MC_DEBUG := _DEBUG
SYSTEM_LIB_DIR=/system/lib
GDM_PROVLIB_SHARED_LIBS=libMcClient
-# Include the provisioning lib
-include $(MOBICORE_PROJECT_PATH)/provlib/Android.mk
-
-LOCAL_ADDITIONAL_DEPENDENCIES += \
- $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
MOBICORE_DIR_INC := $(MC_INCLUDE_DIR)
+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
diff --git a/mobicore/CleanSpec.mk b/mobicore/CleanSpec.mk
deleted file mode 100644
index 7dd6f6c..0000000
--- a/mobicore/CleanSpec.mk
+++ /dev/null
@@ -1,61 +0,0 @@
-# Copyright (C) 2007 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-# If you don't need to do a full clean build but would like to touch
-# a file or delete some intermediate files, add a clean step to the end
-# of the list. These steps will only be run once, if they haven't been
-# run before.
-#
-# E.g.:
-# $(call add-clean-step, touch -c external/sqlite/sqlite3.h)
-# $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates)
-#
-# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with
-# files that are missing or have been moved.
-#
-# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory.
-# Use $(OUT_DIR) to refer to the "out" directory.
-#
-# If you need to re-do something that's already mentioned, just copy
-# the command and add it to the bottom of the list. E.g., if a change
-# that you made last week required touching a file and a change you
-# made today requires touching the same file, just copy the old
-# touch step and add it to the end of the list.
-#
-# ************************************************
-# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
-# ************************************************
-
-# For example:
-#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates)
-#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates)
-#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f)
-#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)
-#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/EXECUTABLES/openssl_intermediates)
-#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/EXECUTABLES/openssl_intermediates)
-#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libcrypto_intermediates $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libssl_intermediates $(PRODUCT_OUT)/obj/EXECUTABLES/openssl_intermediates $(PRODUCT_OUT)/obj/EXECUTABLES/ssltest_intermediates)
-#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libcrypto_intermediates $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libssl_intermediates $(PRODUCT_OUT)/obj/EXECUTABLES/openssl_intermediates $(PRODUCT_OUT)/obj/EXECUTABLES/ssltest_intermediates)
-#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libcrypto_intermediates $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libssl_intermediates $(PRODUCT_OUT)/obj/EXECUTABLES/openssl_intermediates $(PRODUCT_OUT)/obj/EXECUTABLES/ssltest_intermediates)
-#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libcrypto_intermediates $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libssl_intermediates $(PRODUCT_OUT)/obj/EXECUTABLES/openssl_intermediates $(PRODUCT_OUT)/obj/EXECUTABLES/ssltest_intermediates)
-#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libcrypto_intermediates $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libssl_intermediates $(PRODUCT_OUT)/obj/EXECUTABLES/openssl_intermediates $(PRODUCT_OUT)/obj/EXECUTABLES/ssltest_intermediates)
-#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libssl_intermediates)
-#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libcrypto_intermediates)
-#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libssl_static_intermediates)
-#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libcrypto_static_intermediates)
-#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/EXECUTABLES/*ssl*_intermediates $(PRODUCT_OUT)/obj/*/libssl_*intermediates $(PRODUCT_OUT)/obj/*/libcrypto_*intermediates)
-
-# ************************************************
-# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
-# ************************************************
diff --git a/mobicore/MODULE_LICENSE_BSD b/mobicore/MODULE_LICENSE_BSD
deleted file mode 100644
index e69de29..0000000
--- a/mobicore/MODULE_LICENSE_BSD
+++ /dev/null
diff --git a/mobicore/daemon/Android.mk b/mobicore/MobiCoreDriverLib/Android.mk
index fe884ff..fb8da31 100644
--- a/mobicore/daemon/Android.mk
+++ b/mobicore/MobiCoreDriverLib/Android.mk
@@ -12,36 +12,39 @@ include $(CLEAR_VARS)
LOCAL_MODULE := libMcClient
LOCAL_MODULE_TAGS := debug eng optional
LOCAL_C_INCLUDES += $(GLOBAL_INCLUDES)
-LOCAL_SHARED_LIBRARIES += $(GLOBAL_LIBRARIES) liblog
+LOCAL_SHARED_LIBRARIES += $(GLOBAL_LIBRARIES)
LOCAL_CFLAGS := -fvisibility=hidden -fvisibility-inlines-hidden
+LOCAL_CFLAGS += -Wno-missing-field-initializers
LOCAL_CFLAGS += -include buildTag.h
LOCAL_CFLAGS += -DLOG_TAG=\"McClient\"
LOCAL_CFLAGS += -DTBASE_API_LEVEL=3
# Add new source files here
LOCAL_SRC_FILES += \
- ClientLib/Device.cpp \
- ClientLib/ClientLib.cpp \
- ClientLib/Session.cpp \
- Common/CMutex.cpp \
- Common/Connection.cpp \
- ClientLib/GP/tee_client_api.cpp
+ 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 \
- $(LOCAL_PATH)/../common/LogWrapper \
- $(COMP_PATH_MobiCore)/inc/McLib
+ $(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
-
-LOCAL_CFLAGS += -DLOG_ANDROID
+ $(COMP_PATH_MobiCore)/inc \
+ $(LOCAL_PATH)/ClientLib/public
include $(LOCAL_PATH)/Kernel/Android.mk
+# Import logwrapper
+include $(LOG_WRAPPER)/Android.mk
include $(BUILD_SHARED_LIBRARY)
@@ -54,34 +57,40 @@ LOCAL_MODULE_TAGS := debug eng optional
LOCAL_CFLAGS += -include buildTag.h
LOCAL_CFLAGS += -DLOG_TAG=\"McDaemon\"
LOCAL_CFLAGS += -DTBASE_API_LEVEL=3
+#remove some warnings
+LOCAL_CFLAGS += -Wno-missing-field-initializers -Wno-format
LOCAL_C_INCLUDES += $(GLOBAL_INCLUDES)
-LOCAL_SHARED_LIBRARIES += $(GLOBAL_LIBRARIES) libMcClient liblog
+LOCAL_SHARED_LIBRARIES += $(GLOBAL_LIBRARIES) libMcClient
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
+ Common/Connection.cpp \
+ Common/NetlinkConnection.cpp \
+ Common/CSemaphore.cpp \
+ Common/CThread.cpp
# Includes required for the Daemon
LOCAL_C_INCLUDES +=\
- $(LOCAL_PATH)/ClientLib/public \
- $(LOCAL_PATH)/Common \
- $(LOCAL_PATH)/../common/LogWrapper
-
+ $(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_PATH)/Registry
+
LOCAL_SRC_FILES += Registry/PrivateRegistry.cpp
# Common components
include $(LOCAL_PATH)/Kernel/Android.mk
-
-LOCAL_CFLAGS += -DLOG_ANDROID
+# Logwrapper
+include $(LOG_WRAPPER)/Android.mk
include $(BUILD_EXECUTABLE)
@@ -93,23 +102,22 @@ LOCAL_MODULE := libMcRegistry
LOCAL_MODULE_TAGS := debug eng optional
LOCAL_CFLAGS += -DLOG_TAG=\"McRegistry\"
LOCAL_C_INCLUDES += $(GLOBAL_INCLUDES)
-LOCAL_SHARED_LIBRARIES += $(GLOBAL_LIBRARIES) liblog
+LOCAL_SHARED_LIBRARIES += $(GLOBAL_LIBRARIES)
LOCAL_C_INCLUDES += $(LOCAL_PATH)/Common \
- $(LOCAL_PATH)/Daemon/public \
- $(LOCAL_PATH)/ClientLib/public \
- $(LOCAL_PATH)/../common/LogWrapper
+ $(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 \
-# Common/CThread.cpp
+ Common/Connection.cpp \
+ Common/CSemaphore.cpp
#LOCAL_LDLIBS := -lthread_db
include $(LOCAL_PATH)/Registry/Android.mk
-LOCAL_CFLAGS += -DLOG_ANDROID
+# Import logwrapper
+include $(LOG_WRAPPER)/Android.mk
include $(BUILD_SHARED_LIBRARY)
diff --git a/mobicore/daemon/Application.mk b/mobicore/MobiCoreDriverLib/Application.mk
index dda3298..fddc817 100644
--- a/mobicore/daemon/Application.mk
+++ b/mobicore/MobiCoreDriverLib/Application.mk
@@ -7,7 +7,6 @@
# Don't remove this - mandatory
APP_PROJECT_PATH := $(abspath $(call my-dir))
-# The only STL implementation currently working with exceptions
APP_STL := stlport_static
# Don't optimize for better debugging
@@ -16,6 +15,7 @@ APP_OPTIM := debug
# Application wide Cflags
GLOBAL_INCLUDES := \
$(COMP_PATH_MobiCoreDriverMod)/Public \
+ $(COMP_PATH_TlSdk)/Public/MobiCore/inc \
$(COMP_PATH_MobiCore)/inc \
$(COMP_PATH_TlCm)/Public \
$(COMP_PATH_TlCm)/Public/TlCm
@@ -23,4 +23,9 @@ GLOBAL_INCLUDES := \
# Show all warnings
APP_CFLAGS += -Wall
+LOG_WRAPPER := $(COMP_PATH_Logwrapper)
+
APP_PLATFORM := android-9
+
+# Position Independent Executable
+APP_PIE := true
diff --git a/mobicore/daemon/ClientLib/Android.mk b/mobicore/MobiCoreDriverLib/ClientLib/Android.mk
index 8081935..8081935 100644
--- a/mobicore/daemon/ClientLib/Android.mk
+++ b/mobicore/MobiCoreDriverLib/ClientLib/Android.mk
diff --git a/mobicore/daemon/ClientLib/ClientLib.cpp b/mobicore/MobiCoreDriverLib/ClientLib/ClientLib.cpp
index 20b08db..8776486 100644
--- a/mobicore/daemon/ClientLib/ClientLib.cpp
+++ b/mobicore/MobiCoreDriverLib/ClientLib/ClientLib.cpp
@@ -1,14 +1,5 @@
-/** @addtogroup MCD_IMPL_LIB
- * @{
- * @file
- *
- * <t-base Driver API.
- *
- * Functions for accessing <t-base functionality from the normal world.
- * Handles sessions and notifications via MCI buffer.
- *
- *
- * 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,10 +28,17 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ * <t-base Driver API.
+ *
+ * Functions for accessing <t-base functionality from the normal world.
+ * Handles sessions and notifications via MCI buffer.
+ */
#include <stdint.h>
#ifndef WIN32
#include <stdbool.h>
#include <list>
+#include <errno.h>
#include "assert.h"
#endif
@@ -151,7 +149,7 @@ bool removeDevice(uint32_t deviceId)
#define CHECK_SESSION(S,SID) \
if (NULL == S) \
{ \
- LOG_E("Session %i not found", SID); \
+ LOG_E("Session %03x not found", SID); \
mcResult = MC_DRV_ERR_UNKNOWN_SESSION; \
break; \
}
@@ -205,7 +203,8 @@ __MC_CLIENT_LIB_API mcResult_t mcOpenDevice(uint32_t deviceId)
Device *device = resolveDeviceId(deviceId);
if (device != NULL) {
LOG_E("Device %d already opened", deviceId);
- mcResult = MC_DRV_ERR_DEVICE_ALREADY_OPEN;
+ mcResult = MC_DRV_OK;
+ device->openCount++;
break;
}
@@ -259,6 +258,7 @@ __MC_CLIENT_LIB_API mcResult_t mcOpenDevice(uint32_t deviceId)
}
addDevice(device);
+ device->openCount++;
} while (false);
@@ -288,11 +288,15 @@ __MC_CLIENT_LIB_API mcResult_t mcCloseDevice(
LOG_I("===%s(%i)===", __FUNCTION__, deviceId);
do {
Device *device = resolveDeviceId(deviceId);
- // CHECK_DEVICE(device);
CHECK_DEVICE_CLOSED(device, deviceId);
Connection *devCon = device->connection;
+ if (device->openCount != 1) {
+ device->openCount--;
+ break;
+ }
+
// Check if daemon is still alive
if (!devCon->isConnectionAlive()) {
removeDevice(deviceId);
@@ -392,8 +396,8 @@ __MC_CLIENT_LIB_API mcResult_t mcOpenSession(
SEND_TO_DAEMON(devCon, MC_DRV_CMD_OPEN_SESSION,
session->deviceId,
*uuid,
- (uint32_t)(tci) & 0xFFF,
- (uint32_t)handle,
+ (uint32_t)((uintptr_t)tci & 0xFFF),
+ handle,
len);
// Read command response
@@ -493,7 +497,7 @@ __MC_CLIENT_LIB_API mcResult_t mcOpenSession(
if (bulkBuf)
sessionObj->addBulkBuf(bulkBuf);
- LOG_I(" Successfully opened session %d.", session->sessionId);
+ LOG_I(" Successfully opened session %03x.", session->sessionId);
} while (false);
@@ -574,8 +578,8 @@ __MC_CLIENT_LIB_API mcResult_t mcOpenTrustlet(
session->deviceId,
spid,
(uint32_t)tlen,
- (uint32_t)(tci) & 0xFFF,
- (uint32_t)handle,
+ (uint32_t)((uintptr_t)tci & 0xFFF),
+ handle,
len);
// Send the full trustlet data
@@ -686,7 +690,7 @@ __MC_CLIENT_LIB_API mcResult_t mcOpenTrustlet(
if (bulkBuf)
sessionObj->addBulkBuf(bulkBuf);
- LOG_I(" Successfully opened session %d.", session->sessionId);
+ LOG_I(" Successfully opened session %03x.", session->sessionId);
} while (false);
@@ -769,8 +773,8 @@ __MC_CLIENT_LIB_API mcResult_t mcOpenGPTA(
SEND_TO_DAEMON(devCon, MC_DRV_CMD_OPEN_TRUSTED_APP,
session->deviceId,
*uuid,
- (uint32_t)(tci) & 0xFFF,
- (uint32_t)handle,
+ (uint32_t)((uintptr_t)tci & 0xFFF),
+ handle,
len);
// Read command response
@@ -870,7 +874,7 @@ __MC_CLIENT_LIB_API mcResult_t mcOpenGPTA(
if (bulkBuf)
sessionObj->addBulkBuf(bulkBuf);
- LOG_I(" Successfully opened session %d.", session->sessionId);
+ LOG_I(" Successfully opened session %03x.", session->sessionId);
} while (false);
@@ -900,7 +904,7 @@ __MC_CLIENT_LIB_API mcResult_t mcCloseSession(mcSessionHandle_t *session)
devMutex.lock();
do {
CHECK_NOT_NULL(session);
- LOG_I(" Closing session %d.", session->sessionId);
+ LOG_I(" Closing session %03x.", session->sessionId);
Device *device = resolveDeviceId(session->deviceId);
CHECK_DEVICE(device);
@@ -923,7 +927,7 @@ __MC_CLIENT_LIB_API mcResult_t mcCloseSession(mcSessionHandle_t *session)
}
bool r = device->removeSession(session->sessionId);
- if (!r)
+ if (!r)
{
LOG_E("removeSession failed");
assert(0);
@@ -958,7 +962,7 @@ __MC_CLIENT_LIB_API mcResult_t mcNotify(
do {
CHECK_NOT_NULL(session);
- LOG_I(" Notifying session %d.", session->sessionId);
+ LOG_I(" Notifying session %03x.", session->sessionId);
Device *device = resolveDeviceId(session->deviceId);
CHECK_DEVICE(device);
@@ -1003,7 +1007,7 @@ __MC_CLIENT_LIB_API mcResult_t mcWaitNotification(
do {
CHECK_NOT_NULL(session);
- LOG_I(" Waiting for notification of session %d.", session->sessionId);
+ LOG_I(" Waiting for notification of session %03x.", session->sessionId);
Device *device = resolveDeviceId(session->deviceId);
CHECK_DEVICE(device);
@@ -1021,6 +1025,15 @@ __MC_CLIENT_LIB_API mcResult_t mcWaitNotification(
&notification,
sizeof(notification_t),
timeout);
+ // Check for interrupted system call and loop, but only if timeout is infinite
+ if ((numRead == -1) && (errno == EINTR)) {
+ if (timeout == MC_INFINITE_TIMEOUT) {
+ continue;
+ } else if (timeout == MC_INFINITE_TIMEOUT_INTERRUPTIBLE) {
+ mcResult = MC_DRV_ERR_INTERRUPTED_BY_SIGNAL;
+ break;
+ }
+ }
//Exit on timeout in first run
//Later runs have timeout set to 0. -2 means, there is no more data.
if (count == 0 && numRead == -2 ) {
@@ -1053,7 +1066,7 @@ __MC_CLIENT_LIB_API mcResult_t mcWaitNotification(
}
count++;
- LOG_I(" Received notification %d for session %d, payload=%d",
+ LOG_I(" Received notification %d for session %03x, payload=%d",
count, notification.sessionId, notification.payload);
if (notification.payload != 0) {
@@ -1205,7 +1218,7 @@ __MC_CLIENT_LIB_API mcResult_t mcMap(
Session *session = device->resolveSessionId(sessionHandle->sessionId);
CHECK_SESSION(session, sessionHandle->sessionId);
- LOG_I(" Mapping %p to session %d.", buf, sessionHandle->sessionId);
+ LOG_I(" Mapping %p to session %03x.", buf, sessionHandle->sessionId);
// Register mapped bulk buffer to Kernel Module and keep mapped bulk buffer in mind
BulkBufferDescriptor *bulkBuf;
@@ -1217,9 +1230,9 @@ __MC_CLIENT_LIB_API mcResult_t mcMap(
SEND_TO_DAEMON(devCon, MC_DRV_CMD_MAP_BULK_BUF,
session->sessionId,
- (uint32_t)bulkBuf->handle,
- (uint32_t)0,
- (uint32_t)(bulkBuf->virtAddr) & 0xFFF,
+ bulkBuf->handle,
+ 0,
+ (uint32_t)((uintptr_t)bulkBuf->virtAddr & 0xFFF),
bulkBuf->len);
// Read command response
@@ -1243,9 +1256,12 @@ __MC_CLIENT_LIB_API mcResult_t mcMap(
RECV_FROM_DAEMON(devCon, &rspMapBulkMemPayload);
// Set mapping info for internal structures
- bulkBuf->sVirtualAddr = (void *)rspMapBulkMemPayload.secureVirtualAdr;
+ bulkBuf->sVirtualAddr = (uint32_t)rspMapBulkMemPayload.secureVirtualAdr;
// Set mapping info for Trustlet
- mapInfo->sVirtualAddr = bulkBuf->sVirtualAddr;
+ // NOTE: The "nice" piece of code is needed because sVirtualAddr has 2 different
+ // types to accomodate backward compatibility but also keep the length to 32bits
+ // so on 32 bit systems it's void* but on 64 bit systems it's uint32_t
+ *(uint32_t*)&mapInfo->sVirtualAddr = bulkBuf->sVirtualAddr;
mapInfo->sVirtualLen = bufLen;
mcResult = MC_DRV_OK;
@@ -1282,8 +1298,12 @@ __MC_CLIENT_LIB_API mcResult_t mcUnmap(
do {
CHECK_NOT_NULL(sessionHandle);
CHECK_NOT_NULL(mapInfo);
- CHECK_NOT_NULL(mapInfo->sVirtualAddr);
CHECK_NOT_NULL(buf);
+ if (mapInfo->sVirtualAddr == 0) {
+ LOG_E("Invalid secure virtual address %u.", (uintptr_t)mapInfo->sVirtualAddr);
+ mcResult = MC_DRV_ERR_NULL_POINTER;
+ break;
+ }
// Determine device the session belongs to
Device *device = resolveDeviceId(sessionHandle->deviceId);
@@ -1299,19 +1319,19 @@ __MC_CLIENT_LIB_API mcResult_t mcUnmap(
Session *session = device->resolveSessionId(sessionHandle->sessionId);
CHECK_SESSION(session, sessionHandle->sessionId);
- uint32_t handle = session->getBufHandle(mapInfo->sVirtualAddr, mapInfo->sVirtualLen);
+ uint32_t handle = session->getBufHandle((uint32_t)mapInfo->sVirtualAddr, mapInfo->sVirtualLen);
if (handle == 0) {
- LOG_E("Unable to find internal handle for buffer %p.", mapInfo->sVirtualAddr);
+ LOG_E("Unable to find internal handle for buffer %u.", (uintptr_t)mapInfo->sVirtualAddr);
mcResult = MC_DRV_ERR_BLK_BUFF_NOT_FOUND;
break;
}
- LOG_I(" Unmapping %p(handle=%u) from session %d.", buf, handle, sessionHandle->sessionId);
+ LOG_I(" Unmapping %p(handle=%u) from session %03x.", buf, handle, sessionHandle->sessionId);
SEND_TO_DAEMON(devCon, MC_DRV_CMD_UNMAP_BULK_BUF,
session->sessionId,
handle,
- (uint32_t)(mapInfo->sVirtualAddr),
+ (uint32_t)mapInfo->sVirtualAddr,
mapInfo->sVirtualLen);
RECV_FROM_DAEMON(devCon, &mcResult);
@@ -1387,21 +1407,6 @@ __MC_CLIENT_LIB_API mcResult_t mcGetSessionErrorCode(
}
//------------------------------------------------------------------------------
-__MC_CLIENT_LIB_API mcResult_t mcDriverCtrl(
- mcDriverCtrl_t param,
- uint8_t *data,
- uint32_t len
-)
-{
-#ifndef WIN32
-
- LOG_W("mcDriverCtrl(): not implemented");
-
-#endif /* WIN32 */
- return MC_DRV_ERR_NOT_IMPLEMENTED;
-}
-
-//------------------------------------------------------------------------------
__MC_CLIENT_LIB_API mcResult_t mcGetMobiCoreVersion(
uint32_t deviceId,
mcVersionInfo_t *versionInfo
@@ -1459,8 +1464,6 @@ __MC_CLIENT_LIB_API mcResult_t mcGetMobiCoreVersion(
// Must be taken with devMutex locked.
uint32_t getDaemonVersion(Connection *devCon, uint32_t *version)
{
- assert(devCon != NULL);
- assert(version != NULL);
mcResult_t mcResult = MC_DRV_OK;
uint32_t v = 0;
@@ -1489,4 +1492,3 @@ uint32_t getDaemonVersion(Connection *devCon, uint32_t *version)
}
#endif /* WIN32 */
-/** @} */
diff --git a/mobicore/daemon/ClientLib/Device.cpp b/mobicore/MobiCoreDriverLib/ClientLib/Device.cpp
index 2141f99..703f28d 100644
--- a/mobicore/daemon/ClientLib/Device.cpp
+++ b/mobicore/MobiCoreDriverLib/ClientLib/Device.cpp
@@ -1,13 +1,5 @@
-/** @addtogroup MCD_IMPL_LIB
- * @{
- * @file
- *
- * Client library device management.
- *
- * Device and Trustlet Session management Funtions.
- *
- *
- * 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
@@ -36,6 +28,11 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ * Client library device management.
+ *
+ * Device and Trustlet Session management Funtions.
+ */
#include <stdint.h>
#include <vector>
@@ -51,6 +48,7 @@ Device::Device(uint32_t deviceId, Connection *connection)
{
this->deviceId = deviceId;
this->connection = connection;
+ this->openCount = 0;
pMcKMod = new CMcKMod();
}
@@ -156,26 +154,23 @@ Session *Device::resolveSessionId(uint32_t sessionId)
mcResult_t Device::allocateContiguousWsm(uint32_t len, CWsm **wsm)
{
// Allocate shared memory
- addr_t virtAddr;
- uint32_t handle;
- uint64_t physAddr;
+ addr_t virtAddr = NULL;
+ uint32_t handle = 0;
mcResult_t ret;
- assert(wsm != NULL);
-
if (!len) {
return MC_DRV_ERR_INVALID_LENGTH;
}
- ret = pMcKMod->mapWsm(len, &handle, &virtAddr, &physAddr);
+ ret = pMcKMod->mapWsm(len, &handle, &virtAddr);
if (ret) {
return ret;
}
- LOG_I(" mapped handle %d to %p, phys=%#llx ", handle, virtAddr, physAddr);
+ LOG_I(" mapped handle %d to %p", handle, virtAddr);
// Register (vaddr,paddr) with device
- *wsm = new CWsm(virtAddr, len, handle, physAddr);
+ *wsm = new CWsm(virtAddr, len, handle, 0);
wsmL2List.push_back(*wsm);
@@ -242,7 +237,7 @@ CWsm_ptr Device::findContiguousWsm(addr_t virtAddr)
mcResult_t Device::mapBulkBuf(addr_t buf, uint32_t len, BulkBufferDescriptor **blkBuf)
{
uint64_t PhysWsmL2;
- uint32_t handle;
+ uint32_t handle = 0;
*blkBuf = NULL;
@@ -261,4 +256,3 @@ mcResult_t Device::mapBulkBuf(addr_t buf, uint32_t len, BulkBufferDescriptor **b
return MC_DRV_OK;
}
-/** @} */
diff --git a/mobicore/daemon/ClientLib/Device.h b/mobicore/MobiCoreDriverLib/ClientLib/Device.h
index 767f20e..2be2e97 100644
--- a/mobicore/daemon/ClientLib/Device.h
+++ b/mobicore/MobiCoreDriverLib/ClientLib/Device.h
@@ -1,12 +1,4 @@
-/** @addtogroup MCD_IMPL_LIB
- * @{
- * @file
- *
- * Client library device management.
- *
- * Device and Trustlet Session management Functions.
- *
- *
+/*
* Copyright (c) 2013 TRUSTONIC LIMITED
* All rights reserved.
*
@@ -36,6 +28,11 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ * Client library device management.
+ *
+ * Device and Trustlet Session management Functions.
+ */
#ifndef DEVICE_H_
#define DEVICE_H_
@@ -59,6 +56,7 @@ public:
uint32_t deviceId; /**< Device identifier */
Connection *connection; /**< The device connection */
CMcKMod_ptr pMcKMod;
+ uint32_t openCount;
Device(
uint32_t deviceId,
@@ -170,4 +168,3 @@ public:
#endif /* DEVICE_H_ */
-/** @} */
diff --git a/mobicore/daemon/ClientLib/GP/tee_client_api.cpp b/mobicore/MobiCoreDriverLib/ClientLib/GP/tee_client_api.cpp
index e036453..45c5adf 100644
--- a/mobicore/daemon/ClientLib/GP/tee_client_api.cpp
+++ b/mobicore/MobiCoreDriverLib/ClientLib/GP/tee_client_api.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
@@ -30,24 +30,18 @@
*/
#undef LOG_TAG
#define LOG_TAG "GpClient"
-
-#include <stdlib.h>
-#include <string.h>
-
#include "tee_client_api.h"
#include "log.h"
#include "MobiCoreDriverApi.h"
#include "Mci/mcinq.h"
#include <sys/mman.h>
#include "GpTci.h"
+#include "../Session.h"
//------------------------------------------------------------------------------
// Macros
#define _TEEC_GET_PARAM_TYPE(t, i) (((t) >> (4*i)) & 0xF)
-// Max. session number
-#define _TEEC_SESSION_NUMBER 50
-
//Parameter number
#define _TEEC_PARAMETER_NUMBER 4
@@ -72,11 +66,6 @@ static TEEC_Result _TEEC_SetupOperation(
TEEC_Operation *operation,
uint32_t *returnOrigin);
-static TEEC_Result _TEEC_CallTA(
- TEEC_Session *session,
- TEEC_Operation *operation,
- uint32_t *returnOrigin);
-
//------------------------------------------------------------------------------
static void _libUuidToArray(
const TEEC_UUID *uuid,
@@ -116,25 +105,29 @@ static TEEC_Result _TEEC_SetupOperation(
mcResult_t mcRet = MC_DRV_OK;
TEEC_Result teecResult = TEEC_SUCCESS;
- //operation can be NULL
+ LOG_I(" %s()", __func__);
+
tci->operation.isCancelled = false;
+ tci->operation.paramTypes = 0;
+
+ //operation can be NULL
if (operation != NULL) {
- LOG_I(" %s()", __func__);
- tci->operation.paramTypes = operation->paramTypes;
operation->started = 1;
- //TODO: This design allows a non-NULL buffer with a size of 0 bytes to allow trivial integration with any
+ //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 (_TEEC_GET_PARAM_TYPE(operation->paramTypes, 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);
@@ -176,6 +169,9 @@ static TEEC_Result _TEEC_SetupOperation(
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:
@@ -184,15 +180,17 @@ static TEEC_Result _TEEC_SetupOperation(
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) &&
- (_TEEC_GET_PARAM_TYPE(operation->paramTypes, i) == TEEC_MEMREF_PARTIAL_OUTPUT)) ||
+ (paramType == TEEC_MEMREF_PARTIAL_OUTPUT)) ||
(((ext->memref.parent->flags & (TEEC_MEM_INPUT | TEEC_MEM_OUTPUT)) == TEEC_MEM_OUTPUT) &&
- (_TEEC_GET_PARAM_TYPE(operation->paramTypes, i) == TEEC_MEMREF_PARTIAL_INPUT))) {
+ (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");
@@ -219,6 +217,7 @@ static TEEC_Result _TEEC_SetupOperation(
i = _TEEC_PARAMETER_NUMBER;
break;
}
+ tci->operation.paramTypes |= (paramType<<i*4);
}
if (tci->operation.isCancelled) {
@@ -231,18 +230,17 @@ static TEEC_Result _TEEC_SetupOperation(
uint32_t retOrigIgnored;
_TEEC_UnwindOperation(tci, handle, operation, false, &retOrigIgnored);
//Zeroing out tci->operation
- memset(&tci->operation, 0, sizeof(TEEC_Operation));
+ memset(&tci->operation, 0, sizeof(tci->operation));
if (teecResult != TEEC_SUCCESS) return teecResult;
return TEEC_ERROR_GENERIC;
}
}
//Copy version indicator field
- strcpy(tci->header, "TCIGP000");
+ memcpy(tci->header, "TCIGP000", sizeof(tci->header));
// Fill in invalid values for secure world to overwrite
- tci->returnStatus = 0;
- tci->returnStatus = TEE_ERROR_BAD_STATE;
+ tci->returnStatus = TEEC_ERROR_BAD_STATE;
// Signal completion of request writing
tci->ready = 1;
@@ -261,8 +259,6 @@ static TEEC_Result _TEEC_UnwindOperation(
uint32_t i;
_TEEC_ParameterInternal *imp;
TEEC_Parameter *ext;
- //mcResult_t mcRet = MC_DRV_OK;
- //bool doUnmap = false;
uint8_t *buffer;
//operation can be NULL
@@ -295,7 +291,7 @@ static TEEC_Result _TEEC_UnwindOperation(
break;
case TEEC_VALUE_OUTPUT:
case TEEC_VALUE_INOUT: {
- LOG_I(" cycle %d, TEEC_VALUE_OUT*", i);
+ LOG_I(" cycle %d, TEEC_VALUE_*OUT", i);
if (copyValues) {
ext->value.a = imp->value.a;
ext->value.b = imp->value.b;
@@ -309,14 +305,14 @@ static TEEC_Result _TEEC_UnwindOperation(
if ((copyValues) && (_TEEC_GET_PARAM_TYPE(operation->paramTypes, i) != TEEC_MEMREF_TEMP_INPUT)) {
ext->tmpref.size = imp->memref.outputSize;
}
- //doUnmap = true;
buffer = (uint8_t *)ext->tmpref.buffer;
break;
}
case TEEC_MEMREF_WHOLE: {
LOG_I(" cycle %d, TEEC_MEMREF_WHOLE", i);
- if (copyValues) ext->memref.size = imp->memref.outputSize;
- //doUnmap = true;
+ if ((copyValues) && (ext->memref.parent->flags != TEEC_MEM_INPUT)) {
+ ext->memref.size = imp->memref.outputSize;
+ }
buffer = (uint8_t *)ext->memref.parent->buffer;
break;
}
@@ -338,7 +334,7 @@ static TEEC_Result _TEEC_UnwindOperation(
if ((buffer != NULL) && (imp->memref.mapInfo.sVirtualLen != 0)) {
// This function assumes that we cannot handle error of mcUnmap
- mcUnmap(handle, buffer, &imp->memref.mapInfo);
+ (void)mcUnmap(handle, buffer, &imp->memref.mapInfo);
}
}
@@ -360,8 +356,6 @@ TEEC_Result TEEC_InitializeContext(
switch (mcOpenDevice(MC_DEVICE_ID_DEFAULT)) {
case MC_DRV_OK:
return TEEC_SUCCESS;
- case MC_DRV_ERR_INVALID_OPERATION:
- return TEEC_ERROR_BAD_STATE;
case MC_DRV_ERR_DAEMON_UNREACHABLE:
return TEEC_ERROR_COMMUNICATION;
case MC_DRV_ERR_UNKNOWN_DEVICE:
@@ -433,12 +427,10 @@ static TEEC_Result _TEEC_CallTA(
// Wait for the Trusted App response
mcRet = mcWaitNotification(&session->imp.handle, MC_INFINITE_TIMEOUT);
if (mcRet != MC_DRV_OK) {
- LOG_E("mcWaitNotification failed (%08x)", mcRet);
teecError = TEEC_ERROR_COMMUNICATION;
if (mcRet == MC_DRV_INFO_NOTIFICATION) {
- int32_t lastErr;
+ int32_t lastErr = SESSION_ERR_NO;
mcGetSessionErrorCode(&session->imp.handle, &lastErr);
- LOG_E("mcGetSessionErrorCode returned %d", 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;
@@ -446,7 +438,10 @@ static TEEC_Result _TEEC_CallTA(
LOG_E("Target is DEAD");
*returnOrigin = TEEC_ORIGIN_TEE;
- teecError = TEE_ERROR_TARGET_DEAD;
+ teecError = TEEC_ERROR_TARGET_DEAD;
+ } else {
+ LOG_E("mcWaitNotification failed (%08x)", mcRet);
+ LOG_E("mcGetSessionErrorCode returned %d", lastErr);
}
}
}
@@ -537,7 +532,7 @@ TEEC_Result TEEC_OpenSession (
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 filed on tci buffer allocation");
+ LOG_E("mmap failed on tci buffer allocation");
if (returnOrigin != NULL) *returnOrigin = TEEC_ORIGIN_API;
return TEEC_ERROR_OUT_OF_MEMORY;
}
@@ -559,7 +554,7 @@ TEEC_Result TEEC_OpenSession (
(uint8_t *)session->imp.tci,
sizeof(_TEEC_TCI));
if (mcRet != MC_DRV_OK) {
- LOG_E("mcOpenTrustlet failed (%08x)", mcRet);
+ 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;
@@ -741,6 +736,14 @@ TEEC_Result TEEC_RegisterSharedMemory(
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;
@@ -765,6 +768,14 @@ TEEC_Result TEEC_AllocateSharedMemory(
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) {
diff --git a/mobicore/daemon/ClientLib/Session.cpp b/mobicore/MobiCoreDriverLib/ClientLib/Session.cpp
index 3f8dc77..7144d36 100644
--- a/mobicore/daemon/ClientLib/Session.cpp
+++ b/mobicore/MobiCoreDriverLib/ClientLib/Session.cpp
@@ -1,7 +1,5 @@
-/** @addtogroup MCD_IMPL_LIB
- * @{
- * @file
- * 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
@@ -109,7 +107,7 @@ int32_t Session::getLastErr(
mcResult_t Session::addBulkBuf(addr_t buf, uint32_t len, BulkBufferDescriptor **blkBuf)
{
uint64_t pPhysWsmL2;
- uint32_t handle;
+ uint32_t handle = 0;
assert(blkBuf != NULL);
@@ -152,9 +150,9 @@ void Session::addBulkBuf(BulkBufferDescriptor *blkBuf)
}
//------------------------------------------------------------------------------
-uint32_t Session::getBufHandle(addr_t sVirtAddr, uint32_t sVirtualLen)
+uint32_t Session::getBufHandle(uint32_t sVirtAddr, uint32_t sVirtualLen)
{
- LOG_V("getBufHandle(): Secure Virtual Address = 0x%X", (unsigned int) sVirtAddr);
+ LOG_V("getBufHandle(): Virtual Address = 0x%X", sVirtAddr);
// Search and remove bulk buffer descriptor
for ( bulkBufferDescrIterator_t iterator = bulkBufferDescriptors.begin();
@@ -188,7 +186,7 @@ mcResult_t Session::removeBulkBuf(addr_t virtAddr)
}
if (pBlkBufDescr == NULL) {
- LOG_E("%p not registered in session %d.", virtAddr, sessionId);
+ LOG_E("%p not registered in session %03x.", virtAddr, sessionId);
return MC_DRV_ERR_BLK_BUFF_NOT_FOUND;
}
LOG_V("removeBulkBuf():handle=%u", pBlkBufDescr->handle);
@@ -205,4 +203,3 @@ mcResult_t Session::removeBulkBuf(addr_t virtAddr)
return MC_DRV_OK;
}
-/** @} */
diff --git a/mobicore/daemon/ClientLib/Session.h b/mobicore/MobiCoreDriverLib/ClientLib/Session.h
index 5fc1e94..1f3529e 100644
--- a/mobicore/daemon/ClientLib/Session.h
+++ b/mobicore/MobiCoreDriverLib/ClientLib/Session.h
@@ -1,7 +1,5 @@
-/** @addtogroup MCD_IMPL_LIB
- * @{
- * @file
- * 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
@@ -46,13 +44,13 @@ class BulkBufferDescriptor
{
public:
addr_t virtAddr; /**< The virtual address of the Bulk buffer*/
- addr_t sVirtualAddr; /**< The secure virtual address of the Bulk buffer*/
+ uint32_t sVirtualAddr; /**< The secure virtual address of the Bulk buffer*/
uint32_t len; /**< Length of the Bulk buffer*/
uint32_t handle;
BulkBufferDescriptor(
addr_t virtAddr,
- addr_t sVirtAddr,
+ uint32_t sVirtAddr,
uint32_t len,
uint32_t handle
) :
@@ -146,7 +144,7 @@ public:
*
* @return the Handle or 0 for failure
*/
- uint32_t getBufHandle(addr_t sVirtAddr, uint32_t sVirtualLen);
+ uint32_t getBufHandle(uint32_t sVirtAddr, uint32_t sVirtualLen);
/**
* Set additional error information of the last error that occured.
@@ -184,4 +182,3 @@ typedef sessionList_t::iterator sessionIterator_t;
#endif /* SESSION_H_ */
-/** @} */
diff --git a/mobicore/daemon/ClientLib/public/GP/tee_client_api.h b/mobicore/MobiCoreDriverLib/ClientLib/public/GP/tee_client_api.h
index c6f2090..c6f2090 100644
--- a/mobicore/daemon/ClientLib/public/GP/tee_client_api.h
+++ b/mobicore/MobiCoreDriverLib/ClientLib/public/GP/tee_client_api.h
diff --git a/mobicore/daemon/ClientLib/public/GP/tee_client_api_imp.h b/mobicore/MobiCoreDriverLib/ClientLib/public/GP/tee_client_api_imp.h
index 75c01fe..75c01fe 100644
--- a/mobicore/daemon/ClientLib/public/GP/tee_client_api_imp.h
+++ b/mobicore/MobiCoreDriverLib/ClientLib/public/GP/tee_client_api_imp.h
diff --git a/mobicore/MobiCoreDriverLib/ClientLib/public/GP/tee_error.h b/mobicore/MobiCoreDriverLib/ClientLib/public/GP/tee_error.h
new file mode 100644
index 0000000..e90786a
--- /dev/null
+++ b/mobicore/MobiCoreDriverLib/ClientLib/public/GP/tee_error.h
@@ -0,0 +1,131 @@
+/*
+ * 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 __TEE_ERROR_H__
+#define __TEE_ERROR_H__
+
+#define TEEC_SUCCESS ((TEEC_Result)0x00000000)
+
+/**
+ * Generic error code : Generic error
+ **/
+#define TEEC_ERROR_GENERIC ((TEEC_Result)0xFFFF0000)
+
+/**
+ * Generic error code : The underlying security system denies the access to the
+ * object
+ **/
+#define TEEC_ERROR_ACCESS_DENIED ((TEEC_Result)0xFFFF0001)
+
+/**
+ * Generic error code : The pending operation is cancelled.
+ **/
+#define TEEC_ERROR_CANCEL ((TEEC_Result)0xFFFF0002)
+
+/**
+ * Generic error code : The underlying system detects a conflict
+ **/
+#define TEEC_ERROR_ACCESS_CONFLICT ((TEEC_Result)0xFFFF0003)
+
+/**
+ * Generic error code : Too much data for the operation or some data remain
+ * unprocessed by the operation.
+ **/
+#define TEEC_ERROR_EXCESS_DATA ((TEEC_Result)0xFFFF0004)
+
+/**
+ * Generic error code : Error of data format
+ **/
+#define TEEC_ERROR_BAD_FORMAT ((TEEC_Result)0xFFFF0005)
+
+/**
+ * Generic error code : The specified parameters are invalid
+ **/
+#define TEEC_ERROR_BAD_PARAMETERS ((TEEC_Result)0xFFFF0006)
+
+/**
+ * Generic error code : Illegal state for the operation.
+ **/
+#define TEEC_ERROR_BAD_STATE ((TEEC_Result)0xFFFF0007)
+
+/**
+ * Generic error code : The item is not found
+ **/
+#define TEEC_ERROR_ITEM_NOT_FOUND ((TEEC_Result)0xFFFF0008)
+
+/**
+ * Generic error code : The specified operation is not implemented
+ **/
+#define TEEC_ERROR_NOT_IMPLEMENTED ((TEEC_Result)0xFFFF0009)
+
+/**
+ * Generic error code : The specified operation is not supported
+ **/
+#define TEEC_ERROR_NOT_SUPPORTED ((TEEC_Result)0xFFFF000A)
+
+/**
+ * Generic error code : Insufficient data is available for the operation.
+ **/
+#define TEEC_ERROR_NO_DATA ((TEEC_Result)0xFFFF000B)
+
+/**
+ * Generic error code : Not enough memory to perform the operation
+ **/
+#define TEEC_ERROR_OUT_OF_MEMORY ((TEEC_Result)0xFFFF000C)
+
+/**
+ * Generic error code : The service is currently unable to handle the request;
+ * try later
+ **/
+#define TEEC_ERROR_BUSY ((TEEC_Result)0xFFFF000D)
+
+/**
+ * Generic communication error
+ **/
+#define TEEC_ERROR_COMMUNICATION ((TEEC_Result)0xFFFF000E)
+
+/**
+ * Generic error code : security violation
+ **/
+#define TEEC_ERROR_SECURITY ((TEEC_Result)0xFFFF000F)
+
+/**
+ * Generic error code : the buffer is too short
+ **/
+#define TEEC_ERROR_SHORT_BUFFER ((TEEC_Result)0xFFFF0010)
+
+/**
+ * Error of communication: The target of the connection is dead
+ **/
+#define TEEC_ERROR_TARGET_DEAD ((TEEC_Result)0xFFFF3024)
+
+#endif /* __TEE_ERROR_H__ */
+
diff --git a/mobicore/daemon/ClientLib/public/GP/tee_type.h b/mobicore/MobiCoreDriverLib/ClientLib/public/GP/tee_type.h
index 8cf5898..f164dab 100644
--- a/mobicore/daemon/ClientLib/public/GP/tee_type.h
+++ b/mobicore/MobiCoreDriverLib/ClientLib/public/GP/tee_type.h
@@ -1,14 +1,33 @@
-/**
+/*
* Copyright (c) 2013 TRUSTONIC LIMITED
- * All rights reserved
+ * 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.
*
- * The present software is the confidential and proprietary information of
- * TRUSTONIC LIMITED. You shall not disclose the present software and shall
- * use it only in accordance with the terms of the license agreement you
- * entered into with TRUSTONIC LIMITED. This software may be subject to
- * export or import laws in certain countries.
+ * 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.
*/
-
/**
* Definition of the machine-specific integer types
**/
@@ -83,15 +102,7 @@ typedef unsigned char bool;
#define IN
#define OUT
-/*
- * Definition of other common types
- */
-
-// to delete when all completed
-typedef uint32_t TEE_Result;
-typedef TEE_Result TEEC_Result;
-
-typedef uint32_t TEE_HANDLE;
+typedef uint32_t TEEC_Result;
/** Definition of an UUID (from RFC 4122 http://www.ietf.org/rfc/rfc4122.txt) */
typedef struct TEE_UUID {
@@ -102,42 +113,4 @@ typedef struct TEE_UUID {
} TEE_UUID;
typedef TEE_UUID TEEC_UUID;
-/** Type definition for a TEE Identity */
-typedef struct TEE_Identity {
- uint32_t login;
- TEE_UUID uuid;
-} TEE_Identity;
-
-typedef struct __TEE_PropSetHandle {
- unsigned char reserved;
-} __TEE_PropSetHandle;
-
-typedef struct __TEE_PropSetHandle* TEE_PropSetHandle;
-
-/* Property Sets Pseudo Handles */
-#define TEE_PROPSET_CURRENT_TA (TEE_PropSetHandle)0xFFFFFFFF
-#define TEE_PROPSET_CURRENT_CLIENT (TEE_PropSetHandle)0xFFFFFFFE
-#define TEE_PROPSET_TEE_IMPLEMENTATION (TEE_PropSetHandle)0xFFFFFFFD
-
-
-/* DLL Import/Export directives */
-
-#if defined(WIN32) || defined(__ARMCC_VERSION) || defined(__WINSCW__) || defined(_WIN32_WCE)
-# define S_DLL_EXPORT __declspec(dllexport)
-# define S_DLL_IMPORT __declspec(dllimport)
-# define S_NO_RETURN __declspec(noreturn)
-#elif defined(__GNUC__)
-# define S_DLL_EXPORT __attribute__ ((visibility ("default")))
-# define S_DLL_IMPORT __attribute__ ((visibility ("default")))
-# define S_NO_RETURN __attribute__ ((noreturn))
-#else
-# define S_DLL_EXPORT
-# define S_DLL_IMPORT
-# define S_NO_RETURN
-#endif
-
-#if defined(_MSC_VER)
-#define __func__ __FUNCTION__
-#endif
-
#endif /* __TEE_TYPE_H__ */
diff --git a/mobicore/daemon/ClientLib/public/GP/uuid_attestation.h b/mobicore/MobiCoreDriverLib/ClientLib/public/GP/uuid_attestation.h
index dd48fc2..c16f666 100644
--- a/mobicore/daemon/ClientLib/public/GP/uuid_attestation.h
+++ b/mobicore/MobiCoreDriverLib/ClientLib/public/GP/uuid_attestation.h
@@ -1,12 +1,32 @@
-/**
+/*
* Copyright (c) 2013 TRUSTONIC LIMITED
- * All rights reserved
+ * All rights reserved.
*
- * The present software is the confidential and proprietary information of
- * TRUSTONIC LIMITED. You shall not disclose the present software and shall
- * use it only in accordance with the terms of the license agreement you
- * entered into with TRUSTONIC LIMITED. This software may be subject to
- * export or import laws in certain countries.
+ * 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 __TEE_UUID_ATTESTATION_H__
@@ -42,7 +62,7 @@ const char TAG[AT_TAG_SIZE]="Trusted Application";
// Public key structure
typedef struct uuid_public_key {
- uint32_t type; // TEE TYPE RSA KEYPAIR: 0xa0000030
+ uint32_t type; // TEE_TYPE_RSA_PUBLIC_KEY: 0xA0000030
uint16_t modulus_bytes; // Length of the modulus in bytes
uint16_t exponent_bytes; // Length of the exponent in bytes
uint8_t data[]; // Key material
diff --git a/mobicore/daemon/ClientLib/public/MobiCoreDriverApi.h b/mobicore/MobiCoreDriverLib/ClientLib/public/MobiCoreDriverApi.h
index 425f5e5..2e78520 100644
--- a/mobicore/daemon/ClientLib/public/MobiCoreDriverApi.h
+++ b/mobicore/MobiCoreDriverLib/ClientLib/public/MobiCoreDriverApi.h
@@ -1,44 +1,37 @@
-/**
- * @defgroup MCD_API MobiCore Driver API
- * @addtogroup MCD_API
- * @{
- *
- * @if DOXYGEN_MCDRV_API
- * @mainpage MobiCore Driver API.
- * @endif
- *
- * MobiCore Driver API.
+/*
+ * Copyright (c) 2013-2014 TRUSTONIC LIMITED
+ * All rights reserved.
*
- * The MobiCore (MC) Driver API provides access functions to the t-base trusted execution environment and the contained Trusted Applications.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
*
- * @image html DoxyOverviewDrvApi500x.png
- * @image latex DoxyOverviewDrvApi500x.png "t-base Overview" width=12cm
- */
-/* <!-- Copyright Trustonic 2013-2014 -->
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
*
- * 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. The name of the author may not be used to endorse or promote
- * products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *
+ * 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 MCDRIVER_H_
#define MCDRIVER_H_
@@ -145,17 +138,11 @@ typedef uint32_t mcResult_t;
#define MC_DRV_ERR_TA_ATTESTATION_ERROR 0x00000022 /**< TA blob attestation is incorrect. */
#endif /* TBASE_API_LEVEL */
+#define MC_DRV_ERR_INTERRUPTED_BY_SIGNAL 0x00000023 /**< Interrupted system call. */
+
#define MAKE_MC_DRV_MCP_ERROR(mcpCode) (MC_DRV_ERR_MCP_ERROR | ((mcpCode&0x000FFFFF)<<8))
#define MAKE_MC_DRV_KMOD_WITH_ERRNO(theErrno) (MC_DRV_ERR_KERNEL_MODULE| (((theErrno)&0x0000FFFF)<<16))
-/**
- * Driver control command.
- */
-typedef enum {
- MC_CTRL_DUMMY = 1 /**< Dummy. */
-} mcDriverCtrl_t;
-
-
/** Structure of Session Handle, includes the Session ID and the Device ID the Session belongs to.
* The session handle will be used for session-based t-base communication.
* It will be passed to calls which address a communication end point in the t-base environment.
@@ -170,14 +157,21 @@ typedef struct {
* In order to use the memory within a Trusted Application the Client Application has to inform the Trusted Application with
* the content of this structure via the TCI.
*/
+
typedef struct {
- void *sVirtualAddr; /**< The virtual address of the Bulk buffer regarding the address space of the Trusted Application, already includes a possible offset! */
+#if ( __WORDSIZE == 64 )
+ uint32_t sVirtualAddr; /**< The virtual address of the Bulk buffer regarding the address space of the Trusted Application, already includes a possible offset! */
+#else
+ void *sVirtualAddr;
+#endif
uint32_t sVirtualLen; /**< Length of the mapped Bulk buffer */
} mcBulkMap_t;
+
#define MC_DEVICE_ID_DEFAULT 0 /**< The default device ID */
#define MC_INFINITE_TIMEOUT ((int32_t)(-1)) /**< Wait infinite for a response of the MC. */
+#define MC_INFINITE_TIMEOUT_INTERRUPTIBLE ((int32_t)(-2)) /**< Wait infinite for a response of the MC, exit on signal. */
#define MC_NO_TIMEOUT 0 /**< Do not wait for a response of the MC. */
#define MC_MAX_TCI_LEN 0x100000 /**< TCI/DCI must not exceed 1MiB */
@@ -330,7 +324,7 @@ __MC_CLIENT_LIB_API mcResult_t mcNotify(
* 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 infinitely)
+ * @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.
@@ -454,26 +448,6 @@ __MC_CLIENT_LIB_API mcResult_t mcUnmap(
mcBulkMap_t *mapInfo
);
-
-/**
- * @attention: Not implemented.
- * Execute driver specific command.
- * mcDriverCtrl() can be used to execute driver specific commands.
- * Besides the control command MC_CTRL_GET_VERSION commands are implementation specific.
- * Please refer to the corresponding specification of the driver manufacturer.
- *
- * @param [in] param Command ID of the command to be executed.
- * @param [in, out] data Command data and response depending on command.
- * @param [in] len Length of the data block.
- *
- * @return MC_DRV_ERR_NOT_IMPLEMENTED.
- */
-__MC_CLIENT_LIB_API mcResult_t mcDriverCtrl(
- mcDriverCtrl_t param,
- uint8_t *data,
- uint32_t len
-);
-
/**
* Get additional error information of the last error that occurred on a session.
* After the request the stored error code will be deleted.
@@ -512,4 +486,3 @@ __MC_CLIENT_LIB_API mcResult_t mcGetMobiCoreVersion(
#endif
#endif /** MCDRIVER_H_ */
-/** @} */
diff --git a/mobicore/daemon/Common/Android.mk b/mobicore/MobiCoreDriverLib/Common/Android.mk
index 55747b7..39f050e 100644
--- a/mobicore/daemon/Common/Android.mk
+++ b/mobicore/MobiCoreDriverLib/Common/Android.mk
@@ -21,11 +21,7 @@ LOCAL_MODULE := Common
# Header files required by components including this module
LOCAL_EXPORT_C_INCLUDES += $(LOCAL_PATH)
-# Enable logging
-# LOCAL_SHARED_LIBRARIES += liblog
-#
-# LOCAL_CFLAGS += -DLOG_ANDROID
-#
-# LOCAL_C_INCLUDES += $(LOCAL_PATH)/../common/LogWrapper
+# Import logwrapper
+#include $(COMP_PATH_Logwrapper)/Android.mk
include $(BUILD_STATIC_LIBRARY)
diff --git a/mobicore/daemon/Common/CMutex.cpp b/mobicore/MobiCoreDriverLib/Common/CMutex.cpp
index dc9e24f..c64a5e9 100644
--- a/mobicore/daemon/Common/CMutex.cpp
+++ b/mobicore/MobiCoreDriverLib/Common/CMutex.cpp
@@ -1,9 +1,4 @@
-/** @addtogroup MCD_MCDIMPL_DAEMON_SRV
- * @{
- * @file
- *
- * Mutex implementation (pthread wrapper).
- *
+/*
* Copyright (c) 2013 TRUSTONIC LIMITED
* All rights reserved.
*
@@ -33,6 +28,9 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ * Mutex implementation (pthread wrapper).
+ */
#include "CMutex.h"
#include "log.h"
@@ -83,4 +81,3 @@ int32_t CMutex::unlock(
return pthread_mutex_unlock(&m_mutex);
}
-/** @} */
diff --git a/mobicore/daemon/Common/CMutex.h b/mobicore/MobiCoreDriverLib/Common/CMutex.h
index 22beacb..f79f3b3 100644
--- a/mobicore/daemon/Common/CMutex.h
+++ b/mobicore/MobiCoreDriverLib/Common/CMutex.h
@@ -1,9 +1,4 @@
-/** @addtogroup MCD_MCDIMPL_DAEMON_SRV
- * @{
- * @file
- *
- * Mutex implementation (pthread wrapper).
- *
+/*
* Copyright (c) 2013 TRUSTONIC LIMITED
* All rights reserved.
*
@@ -33,6 +28,9 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ * Mutex implementation (pthread wrapper).
+ */
#ifndef CMUTEX_H_
#define CMUTEX_H_
@@ -64,4 +62,3 @@ private:
#endif /* CMUTEX_H_ */
-/** @} */
diff --git a/mobicore/daemon/Common/CSemaphore.cpp b/mobicore/MobiCoreDriverLib/Common/CSemaphore.cpp
index efa06c4..23ef649 100644
--- a/mobicore/daemon/Common/CSemaphore.cpp
+++ b/mobicore/MobiCoreDriverLib/Common/CSemaphore.cpp
@@ -1,9 +1,4 @@
-/** @addtogroup MCD_MCDIMPL_DAEMON_SRV
- * @{
- * @file
- *
- * Semaphore implementation (pthread wrapper).
- *
+/*
* Copyright (c) 2013 TRUSTONIC LIMITED
* All rights reserved.
*
@@ -33,6 +28,9 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ * Semaphore implementation (pthread wrapper).
+ */
#include <time.h>
#include <limits.h>
#include "CSemaphore.h"
@@ -113,4 +111,3 @@ void CSemaphore::signal()
pthread_mutex_unlock(&m_mutex);
}
-/** @} */
diff --git a/mobicore/daemon/Common/CSemaphore.h b/mobicore/MobiCoreDriverLib/Common/CSemaphore.h
index fa08b70..02057b6 100644
--- a/mobicore/daemon/Common/CSemaphore.h
+++ b/mobicore/MobiCoreDriverLib/Common/CSemaphore.h
@@ -1,9 +1,4 @@
-/** @addtogroup MCD_MCDIMPL_DAEMON_SRV
- * @{
- * @file
- *
- * Semaphore implementation (pthread wrapper).
- *
+/*
* Copyright (c) 2013 TRUSTONIC LIMITED
* All rights reserved.
*
@@ -33,6 +28,9 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ * Semaphore implementation (pthread wrapper).
+ */
#ifndef CSEMAPHORE_H_
#define CSEMAPHORE_H_
@@ -71,4 +69,3 @@ private:
#endif /*CSEMAPHORE_H_*/
-/** @} */
diff --git a/mobicore/daemon/Common/CThread.cpp b/mobicore/MobiCoreDriverLib/Common/CThread.cpp
index 566dafd..7c19fcd 100644
--- a/mobicore/daemon/Common/CThread.cpp
+++ b/mobicore/MobiCoreDriverLib/Common/CThread.cpp
@@ -1,10 +1,5 @@
-/** @addtogroup MCD_MCDIMPL_DAEMON_SRV
- * @{
- * @file
- *
- * Thread implementation (pthread abstraction).
- *
- * 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
@@ -33,6 +28,9 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ * Thread implementation (pthread abstraction).
+ */
#include "CThread.h"
#include "log.h"
@@ -88,7 +86,7 @@ void CThread::exit(
)
{
setExiting();
- pthread_exit((void *)exitcode);
+ pthread_exit((void*)(uintptr_t)exitcode);
}
@@ -163,4 +161,3 @@ void *CThreadStartup(
return NULL;
}
-/** @} */
diff --git a/mobicore/daemon/Common/CThread.h b/mobicore/MobiCoreDriverLib/Common/CThread.h
index ad2e4e7..002c7ee 100644
--- a/mobicore/daemon/Common/CThread.h
+++ b/mobicore/MobiCoreDriverLib/Common/CThread.h
@@ -1,9 +1,4 @@
-/** @addtogroup MCD_MCDIMPL_DAEMON_SRV
- * @{
- * @file
- *
- * Thread implementation (pthread abstraction).
- *
+/*
* Copyright (c) 2013 TRUSTONIC LIMITED
* All rights reserved.
*
@@ -33,6 +28,9 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ * Thread implementation (pthread abstraction).
+ */
#ifndef CTHREAD_H_
#define CTHREAD_H_
@@ -89,4 +87,3 @@ extern "C" void *CThreadStartup(void *);
#endif /*CTHREAD_H_*/
-/** @} */
diff --git a/mobicore/daemon/Common/CWsm.h b/mobicore/MobiCoreDriverLib/Common/CWsm.h
index 33d82ab..bc92baf 100644
--- a/mobicore/daemon/Common/CWsm.h
+++ b/mobicore/MobiCoreDriverLib/Common/CWsm.h
@@ -1,10 +1,5 @@
-/** @addtogroup MCD_MCDIMPL_DAEMON_SRV
- * @{
- * @file
- *
- * World shared memory definitions.
- *
- * 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
@@ -33,6 +28,9 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ * World shared memory definitions.
+ */
#ifndef CWSM_H_
#define CWSM_H_
@@ -53,7 +51,7 @@ public:
uint32_t len,
uint32_t handle,
// this may be unknown, so is can be omitted.
- uint64_t physAddr = NULL) :
+ uint64_t physAddr = 0x0) :
virtAddr(virtAddr),
len(len),
handle(handle),
@@ -68,4 +66,3 @@ typedef wsmList_t::iterator wsmIterator_t;
#endif /* CWSM_H_ */
-/** @} */
diff --git a/mobicore/daemon/Common/Connection.cpp b/mobicore/MobiCoreDriverLib/Common/Connection.cpp
index 7613a6b..51520f8 100644
--- a/mobicore/daemon/Common/Connection.cpp
+++ b/mobicore/MobiCoreDriverLib/Common/Connection.cpp
@@ -1,10 +1,5 @@
-/** @addtogroup MCD_MCDIMPL_DAEMON_SRV
- * @{
- * @file
- *
- * Connection data.
- *
- * 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
@@ -33,6 +28,9 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ * Connection data.
+ */
#include <unistd.h>
#include <assert.h>
#include <cstring>
@@ -64,12 +62,12 @@ Connection::Connection(void)
//------------------------------------------------------------------------------
Connection::Connection(int socketDescriptor, sockaddr_un *remote)
{
- assert(NULL != remote);
assert(-1 != socketDescriptor);
this->socketDescriptor = socketDescriptor;
this->remote = *remote;
connectionData = NULL;
+ detached = false;
}
@@ -92,7 +90,6 @@ bool Connection::connect(const char *dest)
{
int32_t len;
- assert(NULL != dest);
if (sizeof(remote.sun_path) - 1 < strlen(dest)) {
LOG_E("Invalid destination socket %s", dest);
return false;
@@ -118,21 +115,21 @@ bool Connection::connect(const char *dest)
//------------------------------------------------------------------------------
-size_t Connection::readData(void *buffer, uint32_t len)
+ssize_t Connection::readData(void *buffer, uint32_t len)
{
return readData(buffer, len, -1);
}
//------------------------------------------------------------------------------
-size_t Connection::readData(void *buffer, uint32_t len, int32_t timeout)
+ssize_t Connection::readData(void *buffer, uint32_t len, int32_t timeout)
{
- size_t ret = 0;
+ int ret_s;
+ ssize_t ret = 0;
struct timeval tv;
struct timeval *ptv = NULL;
fd_set readfds;
- assert(NULL != buffer);
assert(socketDescriptor != -1);
if (timeout >= 0) {
@@ -144,16 +141,16 @@ size_t Connection::readData(void *buffer, uint32_t len, int32_t timeout)
FD_ZERO(&readfds);
FD_SET(socketDescriptor, &readfds);
- ret = select(socketDescriptor + 1, &readfds, NULL, NULL, ptv);
+ ret_s = select(socketDescriptor + 1, &readfds, NULL, NULL, ptv);
// check for read error
- if ((int)ret == -1) {
+ if (ret_s == -1) {
LOG_ERRNO("select");
return -1;
}
// Handle case of no descriptor ready
- if (ret == 0) {
+ if (ret_s == 0) {
LOG_W(" Timeout during select() / No more notifications.");
return -2;
}
@@ -163,7 +160,7 @@ size_t Connection::readData(void *buffer, uint32_t len, int32_t timeout)
// finally check if fd has been selected -> must socketDescriptor
if (!FD_ISSET(socketDescriptor, &readfds)) {
LOG_ERRNO("no fd is set, select");
- return ret;
+ return ret_s;
}
ret = recv(socketDescriptor, buffer, len, MSG_DONTWAIT);
@@ -176,15 +173,14 @@ size_t Connection::readData(void *buffer, uint32_t len, int32_t timeout)
//------------------------------------------------------------------------------
-size_t Connection::writeData(void *buffer, uint32_t len)
+ssize_t Connection::writeData(void *buffer, uint32_t len)
{
- assert(buffer != NULL);
assert(socketDescriptor != -1);
- size_t ret = send(socketDescriptor, buffer, len, 0);
- if (ret != len) {
+ 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", ret);
+ LOG_E("ret = %d", (uint32_t)ret);
ret = -1;
}
@@ -246,7 +242,7 @@ bool Connection::isConnectionAlive(void)
bool Connection::getPeerCredentials(struct ucred &cr)
{
struct ucred cred;
- int len = sizeof (cred);
+ socklen_t len = sizeof (cred);
assert(socketDescriptor != -1);
int ret = getsockopt(socketDescriptor, SOL_SOCKET, SO_PEERCRED, &cred,
&len);
@@ -260,4 +256,4 @@ bool Connection::getPeerCredentials(struct ucred &cr)
}
return false;
}
-/** @} */
+
diff --git a/mobicore/daemon/Common/Connection.h b/mobicore/MobiCoreDriverLib/Common/Connection.h
index 89bc585..243168c 100644
--- a/mobicore/daemon/Common/Connection.h
+++ b/mobicore/MobiCoreDriverLib/Common/Connection.h
@@ -1,9 +1,4 @@
-/** @addtogroup MCD_MCDIMPL_DAEMON_SRV
- * @{
- * @file
- *
- * Connection data.
- *
+/*
* Copyright (c) 2013 TRUSTONIC LIMITED
* All rights reserved.
*
@@ -33,6 +28,9 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ * Connection data.
+ */
#ifndef CONNECTION_H_
#define CONNECTION_H_
@@ -78,7 +76,7 @@ public:
* @return -1 if select() failed (returned -1)
* @return -2 if no data available, i.e. timeout
*/
- virtual size_t readData(void *buffer, uint32_t len, int32_t timeout);
+ virtual ssize_t readData(void *buffer, uint32_t len, int32_t timeout);
/**
* Read bytes from the connection.
@@ -87,7 +85,7 @@ public:
* @param len Number of bytes to read.
* @return Number of bytes read.
*/
- virtual size_t readData(void *buffer, uint32_t len);
+ virtual ssize_t readData(void *buffer, uint32_t len);
/**
* Write bytes to the connection.
@@ -97,7 +95,7 @@ public:
* @return Number of bytes written.
* @return -1 if written bytes not equal to len.
*/
- virtual size_t writeData(void *buffer, uint32_t len);
+ virtual ssize_t writeData(void *buffer, uint32_t len);
/**
* Wait for data to be available.
@@ -130,4 +128,3 @@ typedef connectionList_t::iterator connectionIterator_t;
#endif /* CONNECTION_H_ */
-/** @} */
diff --git a/mobicore/daemon/Common/McTypes.h b/mobicore/MobiCoreDriverLib/Common/McTypes.h
index 6e8989e..743174a 100644
--- a/mobicore/daemon/Common/McTypes.h
+++ b/mobicore/MobiCoreDriverLib/Common/McTypes.h
@@ -1,9 +1,4 @@
-/** @addtogroup MCD_MCDIMPL_DAEMON_SRV
- * @{
- * @file
- *
- * MobiCore types redefinition.
- *
+/*
* Copyright (c) 2013 TRUSTONIC LIMITED
* All rights reserved.
*
@@ -33,6 +28,9 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ * MobiCore types redefinition.
+ */
#ifndef MCTYPES_H_
#define MCTYPES_H_
@@ -40,4 +38,3 @@ typedef void *addr_t;
#endif /* MCTYPES_H_ */
-/** @} */
diff --git a/mobicore/MobiCoreDriverLib/Common/NOTICE b/mobicore/MobiCoreDriverLib/Common/NOTICE
new file mode 100644
index 0000000..627167a
--- /dev/null
+++ b/mobicore/MobiCoreDriverLib/Common/NOTICE
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
diff --git a/mobicore/daemon/Common/NetlinkConnection.cpp b/mobicore/MobiCoreDriverLib/Common/NetlinkConnection.cpp
index f91d4e9..3e911d4 100644
--- a/mobicore/daemon/Common/NetlinkConnection.cpp
+++ b/mobicore/MobiCoreDriverLib/Common/NetlinkConnection.cpp
@@ -1,10 +1,5 @@
-/** @addtogroup MCD_MCDIMPL_DAEMON_SRV
- * @{
- * @file
- *
- * Connection data.
- *
- * 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
@@ -33,6 +28,9 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ * Connection data.
+ */
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
@@ -168,7 +166,7 @@ void NetlinkConnection::handleMessage(
}
//------------------------------------------------------------------------------
-size_t NetlinkConnection::readData(
+ssize_t NetlinkConnection::readData(
void *buffer,
uint32_t len
)
@@ -178,14 +176,13 @@ size_t NetlinkConnection::readData(
//------------------------------------------------------------------------------
-size_t NetlinkConnection::readData(
+ssize_t NetlinkConnection::readData(
void *buffer,
uint32_t len,
int32_t timeout
)
{
- size_t ret = -1;
- assert(NULL != buffer);
+ ssize_t ret = -1;
if (!dataLeft.wait(timeout)) {
return -2;
@@ -200,15 +197,14 @@ size_t NetlinkConnection::readData(
//LOG_I("%s: reading connection data %u, connection data left %u",
// __FUNCTION__, len, dataLen);
- assert(dataStart != NULL);
// trying to read more than the left data
if (len > dataLen) {
- ret = dataLen;
+ ret = (ssize_t)dataLen;
memcpy(buffer, dataStart, dataLen);
dataLen = 0;
} else {
- ret = len;
+ ret = (ssize_t)len;
memcpy(buffer, dataStart, len);
dataLen -= len;
dataStart += len;
@@ -229,18 +225,17 @@ size_t NetlinkConnection::readData(
}
//------------------------------------------------------------------------------
-size_t NetlinkConnection::writeData(
+ssize_t NetlinkConnection::writeData(
void *buffer,
uint32_t len
)
{
- size_t ret;
+ ssize_t ret;
struct sockaddr_nl dest_addr;
struct nlmsghdr *nlh = NULL;
struct iovec iov;
struct msghdr msg;
- assert(NULL != buffer);
assert(-1 != socketDescriptor);
//LOG_I("%s: send data %u to PID %u", __FUNCTION__, len, sequenceMagic);
@@ -279,12 +274,12 @@ size_t NetlinkConnection::writeData(
ret = sendmsg(socketDescriptor, &msg, 0);
if (ret != NLMSG_SPACE(len)) {
LOG_E( "%s: could no send all data, ret=%d, errno: %d(%s)",
- __FUNCTION__, ret, errno, strerror(errno));
+ __FUNCTION__, (uint32_t)ret, errno, strerror(errno));
ret = -1;
} else {
/* The whole message sent also includes the header, so make sure to
* return only the number of payload data sent, not everything */
- ret = len;
+ ret = (ssize_t)len;
}
free(nlh);
@@ -292,4 +287,3 @@ size_t NetlinkConnection::writeData(
return ret;
}
-/** @} */
diff --git a/mobicore/daemon/Common/NetlinkConnection.h b/mobicore/MobiCoreDriverLib/Common/NetlinkConnection.h
index 5be3f30..45b3952 100644
--- a/mobicore/daemon/Common/NetlinkConnection.h
+++ b/mobicore/MobiCoreDriverLib/Common/NetlinkConnection.h
@@ -1,9 +1,4 @@
-/** @addtogroup MCD_MCDIMPL_DAEMON_SRV
- * @{
- * @file
- *
- * Connection data.
- *
+/*
* Copyright (c) 2013 TRUSTONIC LIMITED
* All rights reserved.
*
@@ -33,6 +28,9 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ * Connection data.
+ */
#ifndef NETLINKCONNECTION_H_
#define NETLINKCONNECTION_H_
@@ -167,7 +165,7 @@ public:
* @return -1 if select() failed (returned -1)
* @return -2 if no data available, i.e. timeout
*/
- virtual size_t readData(
+ virtual ssize_t readData(
void *buffer,
uint32_t len,
int32_t timeout
@@ -180,7 +178,7 @@ public:
* @param len Number of bytes to read.
* @return Number of bytes read.
*/
- virtual size_t readData(
+ virtual ssize_t readData(
void *buffer,
uint32_t len
);
@@ -192,7 +190,7 @@ public:
* @param len Number of bytes to read.
* @return Number of bytes written.
*/
- virtual size_t writeData(
+ virtual ssize_t writeData(
void *buffer,
uint32_t len
);
@@ -220,4 +218,3 @@ typedef std::map<uint64_t, NetlinkConnection *> connectionMap_t;
#endif /* NETLINKCONNECTION_H_ */
-/** @} */
diff --git a/mobicore/daemon/Daemon/Android.mk b/mobicore/MobiCoreDriverLib/Daemon/Android.mk
index e9873bd..e9873bd 100644
--- a/mobicore/daemon/Daemon/Android.mk
+++ b/mobicore/MobiCoreDriverLib/Daemon/Android.mk
diff --git a/mobicore/daemon/Daemon/Device/Android.mk b/mobicore/MobiCoreDriverLib/Daemon/Device/Android.mk
index 6a22222..e830526 100644
--- a/mobicore/daemon/Daemon/Device/Android.mk
+++ b/mobicore/MobiCoreDriverLib/Daemon/Device/Android.mk
@@ -22,4 +22,4 @@ LOCAL_SRC_FILES += $(DEVICE_PATH)/DeviceIrqHandler.cpp \
$(DEVICE_PATH)/TAExitHandler.cpp \
$(DEVICE_PATH)/MobiCoreDevice.cpp \
$(DEVICE_PATH)/NotificationQueue.cpp \
- $(DEVICE_PATH)/TrustletSession.cpp
+ $(DEVICE_PATH)/TrustletSession.cpp \
diff --git a/mobicore/daemon/Daemon/Device/DeviceIrqHandler.cpp b/mobicore/MobiCoreDriverLib/Daemon/Device/DeviceIrqHandler.cpp
index 877e2da..9eb5722 100644
--- a/mobicore/daemon/Daemon/Device/DeviceIrqHandler.cpp
+++ b/mobicore/MobiCoreDriverLib/Daemon/Device/DeviceIrqHandler.cpp
@@ -1,8 +1,4 @@
-/** @addtogroup MCD_MCDIMPL_DAEMON_DEV
- * @{
- * @file
- *
- *
+/*
* Copyright (c) 2013 TRUSTONIC LIMITED
* All rights reserved.
*
@@ -32,7 +28,6 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-
#include "DeviceIrqHandler.h"
#include "log.h"
@@ -45,4 +40,3 @@ void DeviceIrqHandler::run(
this->exit(-1);
}
-/** @} */
diff --git a/mobicore/daemon/Daemon/Device/DeviceIrqHandler.h b/mobicore/MobiCoreDriverLib/Daemon/Device/DeviceIrqHandler.h
index 449e2af..b6c5eab 100644
--- a/mobicore/daemon/Daemon/Device/DeviceIrqHandler.h
+++ b/mobicore/MobiCoreDriverLib/Daemon/Device/DeviceIrqHandler.h
@@ -1,9 +1,4 @@
-/** @addtogroup MCD_MCDIMPL_DAEMON_DEV
- * @{
- * @file
- *
- * IRQ handler thread.
- *
+/*
* Copyright (c) 2013 TRUSTONIC LIMITED
* All rights reserved.
*
@@ -33,6 +28,9 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ * IRQ handler thread.
+ */
#ifndef DEVICEIRQHANDLER_H_
#define DEVICEIRQHANDLER_H_
@@ -52,4 +50,3 @@ public:
#endif /* DEVICEIRQHANDLER_H_ */
-/** @} */
diff --git a/mobicore/daemon/Daemon/Device/DeviceScheduler.cpp b/mobicore/MobiCoreDriverLib/Daemon/Device/DeviceScheduler.cpp
index 1481c3c..3e25598 100644
--- a/mobicore/daemon/Daemon/Device/DeviceScheduler.cpp
+++ b/mobicore/MobiCoreDriverLib/Daemon/Device/DeviceScheduler.cpp
@@ -1,8 +1,4 @@
-/** @addtogroup MCD_MCDIMPL_DAEMON_DEV
- * @{
- * @file
- *
- *
+/*
* Copyright (c) 2013 TRUSTONIC LIMITED
* All rights reserved.
*
@@ -32,7 +28,6 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-
#include "DeviceScheduler.h"
@@ -45,4 +40,3 @@ void DeviceScheduler::run(
exit(-1);
}
-/** @} */
diff --git a/mobicore/daemon/Daemon/Device/DeviceScheduler.h b/mobicore/MobiCoreDriverLib/Daemon/Device/DeviceScheduler.h
index 3b818bf..9b76c66 100644
--- a/mobicore/daemon/Daemon/Device/DeviceScheduler.h
+++ b/mobicore/MobiCoreDriverLib/Daemon/Device/DeviceScheduler.h
@@ -1,9 +1,4 @@
-/** @addtogroup MCD_MCDIMPL_DAEMON_DEV
- * @{
- * @file
- *
- * Scheduler thread
- *
+/*
* Copyright (c) 2013 TRUSTONIC LIMITED
* All rights reserved.
*
@@ -33,7 +28,9 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-
+/**
+ * Scheduler thread
+ */
#ifndef DEVICESCHEDULER_H_
#define DEVICESCHEDULER_H_
@@ -53,4 +50,3 @@ public:
#endif /* DEVICESCHEDULER_H_ */
-/** @} */
diff --git a/mobicore/daemon/Daemon/Device/MobiCoreDevice.cpp b/mobicore/MobiCoreDriverLib/Daemon/Device/MobiCoreDevice.cpp
index 72cf665..503496e 100644
--- a/mobicore/daemon/Daemon/Device/MobiCoreDevice.cpp
+++ b/mobicore/MobiCoreDriverLib/Daemon/Device/MobiCoreDevice.cpp
@@ -1,10 +1,5 @@
-/** @addtogroup MCD_MCDIMPL_DAEMON_DEV
- * @{
- * @file
- */
-
/*
- * 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
@@ -33,7 +28,6 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-
#include <cstdlib>
#include <pthread.h>
#include <assert.h>
@@ -41,7 +35,6 @@
#include "DeviceScheduler.h"
#include "DeviceIrqHandler.h"
-#include "ExcDevice.h"
#include "Connection.h"
#include "TrustletSession.h"
@@ -95,24 +88,26 @@ TrustletSession *MobiCoreDevice::getTrustletSession(
//------------------------------------------------------------------------------
-Connection *MobiCoreDevice::getSessionConnection(
- uint32_t sessionId,
- notification_t *notification
-) {
- Connection *con = NULL;
-
- TrustletSession *session = getTrustletSession(sessionId);
- if (session != NULL)
- {
- con = session->notificationConnection;
- if (con == NULL)
- {
- session->queueNotification(notification);
- }
- }
-
- return con;
-}
+//Connection *MobiCoreDevice::getSessionConnection(
+// uint32_t sessionId,
+// notification_t *notification
+//) {
+// Connection *con = NULL;
+//
+// mutex_tslist.lock();
+// TrustletSession *session = getTrustletSession(sessionId);
+// if (session != NULL)
+// {
+// con = session->notificationConnection;
+// if (con == NULL)
+// {
+// session->queueNotification(notification);
+// }
+// }
+// mutex_tslist.unlock();
+//
+// return con;
+//}
//------------------------------------------------------------------------------
@@ -120,20 +115,22 @@ TrustletSession* MobiCoreDevice::findSession(
Connection *deviceConnection,
uint32_t sessionId
) {
+ mutex_tslist.lock();
TrustletSession *session = getTrustletSession(sessionId);
if (session == NULL)
{
- LOG_E("no session found with id=%d", sessionId);
+ LOG_E("no session found with id %03x", sessionId);
}
else
{
// check is connection own this session
if (session->deviceConnection != deviceConnection)
{
- LOG_E("connection does not own session id=%d", sessionId);
+ LOG_E("connection does not own session id %03x", sessionId);
session = NULL;
}
}
+ mutex_tslist.unlock();
return session;
}
@@ -184,14 +181,19 @@ mcResult_t MobiCoreDevice::sendSessionCloseCmd(
mcResult_t MobiCoreDevice::closeSessionInternal(
TrustletSession *session
) {
- LOG_I("closing session with id=%d", session->sessionId);
+ LOG_I("closing session %03x", session->sessionId);
mcResult_t mcRet = sendSessionCloseCmd(session->sessionId);
- if (mcRet != MC_MCP_RET_OK) {
- LOG_E("sendSessionCloseCmd error %d", mcRet);
- return MAKE_MC_DRV_MCP_ERROR(mcRet);
+ switch(mcRet){
+ case MC_MCP_RET_OK:
+ return mcRet;
+ case MC_MCP_RET_ERR_CLOSE_TASK_FAILED:
+ LOG_I("sendSessionCloseCmd failed");
+ break;
+ default:
+ LOG_E("sendSessionCloseCmd error %d", mcRet);
+ break;
}
-
// // clean session WSM
// LOG_I("unlocking session buffers!");
// CWsm_ptr pWsm = session->popBulkBuff();
@@ -202,7 +204,7 @@ mcResult_t MobiCoreDevice::closeSessionInternal(
// pWsm = session->popBulkBuff();
// }
- return MC_DRV_OK;
+ return MAKE_MC_DRV_MCP_ERROR(mcRet);
}
//------------------------------------------------------------------------------
@@ -272,7 +274,7 @@ void MobiCoreDevice::close(
// After the trustlet is done make sure to tell the driver to cleanup
// all the orphaned drivers
- cleanupWsmL2();
+ //cleanupWsmL2();
@@ -306,11 +308,12 @@ void MobiCoreDevice::start(void)
if (mciReused)
{
- // remove all pending sessions. 20 is as good a any other number, we-
- // actually should ass a MCP message that tells SWd to invalidate all-
- // session that are there besides the MSH session.
- for (int sessionId = 2; sessionId<20; sessionId++) {
- LOG_I("invalidating session %d",sessionId);
+ // 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
+ for (int sessionNumber = 3; sessionNumber<32; sessionNumber++) {
+ int sessionId = ((sessionNumber<<LOG_SOURCE_TASK_SHIFT)+1);
+ LOG_I("invalidating session %03x", sessionId);
mcResult_t mcRet = sendSessionCloseCmd(sessionId);
if (mcRet != MC_MCP_RET_OK) {
LOG_I("sendSessionCloseCmd error %d", mcRet);
@@ -361,33 +364,46 @@ bool MobiCoreDevice::waitMcpNotification(void)
mcFault = true;
return false;
}
- } // while(1)
-
- // Check healthiness state of the device
- if (DeviceIrqHandler::isExiting()) {
- LOG_I("waitMcpNotification(): IrqHandler thread died! Joining");
- DeviceIrqHandler::join();
- LOG_I("waitMcpNotification(): Joined");
- LOG_E("IrqHandler thread died!");
- return false;
- }
-
- if (DeviceScheduler::isExiting()) {
- LOG_I("waitMcpNotification(): Scheduler thread died! Joining");
- DeviceScheduler::join();
- LOG_I("waitMcpNotification(): Joined");
- LOG_E("Scheduler thread died!");
- return false;
- }
-
- if (TAExitHandler::isExiting()) {
- LOG_I("waitMcpNotification(): TAExitHandler thread died! Joining");
- TAExitHandler::join();
- LOG_I("waitMcpNotification(): 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;
}
@@ -512,18 +528,22 @@ mcResult_t MobiCoreDevice::openSession(
deviceConnection,
mcpMessage->rspOpen.sessionId);
+ // Security TODO: device connection peer has to match the NQ connection peer
+ // The check here is not 100% correct
pRspOpenSessionPayload->sessionId = trustletSession->sessionId;
- pRspOpenSessionPayload->deviceSessionId = (uint32_t)trustletSession;
+ pRspOpenSessionPayload->deviceSessionId = (uint32_t)((uintptr_t)trustletSession & UINT_MAX);
pRspOpenSessionPayload->sessionMagic = trustletSession->sessionMagic;
trustletSession->gp_level=((mclfHeaderV24_ptr)&pLoadDataOpenSession->tlHeader->mclfHeaderV2)->gp_level;
LOG_I(" Trusted App has gp_level %d",trustletSession->gp_level);
trustletSession->sessionState = TrustletSession::TS_TA_RUNNING;
+ mutex_tslist.lock();
trustletSessions.push_back(trustletSession);
+ mutex_tslist.unlock();
if (tciHandle != 0 && tciLen != 0) {
- trustletSession->addBulkBuff(new CWsm((void *)pLoadDataOpenSession->offs, pLoadDataOpenSession->len, tciHandle, 0));
+ trustletSession->addBulkBuff(new CWsm(NULL, pLoadDataOpenSession->len, tciHandle, 0));
}
// We have some queued notifications and we need to send them to them
@@ -594,19 +614,20 @@ TrustletSession *MobiCoreDevice::registerTrustletConnection(
MC_DRV_CMD_NQ_CONNECT_struct *cmdNqConnect
)
{
- LOG_I(" Registering notification socket with Service session %d.",
+ LOG_I(" Registering notification socket with Service session %03x.",
cmdNqConnect->sessionId);
- LOG_V(" Searching sessionId %d with sessionMagic %d",
+ LOG_V(" Searching sessionId %03x with sessionMagic %d",
cmdNqConnect->sessionId,
cmdNqConnect->sessionMagic);
+
for (trustletSessionIterator_t iterator = trustletSessions.begin();
iterator != trustletSessions.end();
++iterator)
{
TrustletSession *session = *iterator;
- if (session != (TrustletSession *) (cmdNqConnect->deviceSessionId)) {
+ if (((uintptr_t)session & UINT_MAX) != cmdNqConnect->deviceSessionId) {
continue;
}
@@ -619,9 +640,11 @@ TrustletSession *MobiCoreDevice::registerTrustletConnection(
LOG_I(" Found Service session, registered connection.");
+
return session;
}
+
LOG_I("registerTrustletConnection(): search failed");
return NULL;
}
@@ -638,7 +661,7 @@ mcResult_t MobiCoreDevice::closeSession(
) {
TrustletSession *session = findSession(deviceConnection,sessionId);
if (session == NULL) {
- LOG_E("cannot close session with id=%d", sessionId);
+ LOG_E("cannot close session %03x", sessionId);
return MC_DRV_ERR_DAEMON_UNKNOWN_SESSION;
}
@@ -678,7 +701,15 @@ mcResult_t MobiCoreDevice::closeSession(
return MAKE_MC_DRV_MCP_ERROR(mcRet);
}
+ freeSession(session);
+
+ return MC_MCP_RET_OK;
+}
+
+void MobiCoreDevice::freeSession(
+ TrustletSession *session
+) {
// clean session WSM
LOG_I("unlocking session buffers!");
CWsm_ptr pWsm = session->popBulkBuff();
@@ -689,20 +720,11 @@ mcResult_t MobiCoreDevice::closeSession(
pWsm = session->popBulkBuff();
}
- // remove sesson from list.
- for (trustletSessionIterator_t iterator = trustletSessions.begin();
- iterator != trustletSessions.end();
- ++iterator)
- {
- if (session == *iterator)
- {
- trustletSessions.erase(iterator);
- delete session;
- break;
- }
- }
-
- return MC_MCP_RET_OK;
+ // remove session from list.
+ mutex_tslist.lock();
+ trustletSessions.remove(session);
+ mutex_tslist.unlock();
+ delete session;
}
@@ -721,7 +743,7 @@ mcResult_t MobiCoreDevice::notify(
TrustletSession *session = findSession(deviceConnection,sessionId);
if (session == NULL)
{
- LOG_E("cannot notify session with id=%d", sessionId);
+ LOG_E("cannot notify session %03x", sessionId);
return MC_DRV_ERR_DAEMON_UNKNOWN_SESSION;
}
@@ -742,14 +764,14 @@ mcResult_t MobiCoreDevice::mapBulk(
) {
TrustletSession *session = findSession(deviceConnection,sessionId);
if (session == NULL) {
- LOG_E("cannot mapBulk on session with id=%d", sessionId);
+ LOG_E("cannot mapBulk on session %03x", sessionId);
return MC_DRV_ERR_DAEMON_UNKNOWN_SESSION;
}
// TODO-2012-09-06-haenellu: considernot ignoring the error case, ClientLib
// does not allow this.
session->addBulkBuff(
- new CWsm((void *)offsetPayload,
+ new CWsm(NULL,
lenBulkMem,
handle,
pAddrL2));
@@ -797,7 +819,7 @@ mcResult_t MobiCoreDevice::unmapBulk(
) {
TrustletSession *session = findSession(deviceConnection,sessionId);
if (session == NULL) {
- LOG_E("cannot unmapBulk on session with id=%d", sessionId);
+ LOG_E("cannot unmapBulk on session %03x", sessionId);
return MC_DRV_ERR_DAEMON_UNKNOWN_SESSION;
}
@@ -928,4 +950,3 @@ mcResult_t MobiCoreDevice::loadToken(Connection *deviceConnection,
return MC_DRV_OK;
}
-/** @} */
diff --git a/mobicore/daemon/Daemon/Device/NotificationQueue.cpp b/mobicore/MobiCoreDriverLib/Daemon/Device/NotificationQueue.cpp
index a034c4c..5b4d872 100644
--- a/mobicore/daemon/Daemon/Device/NotificationQueue.cpp
+++ b/mobicore/MobiCoreDriverLib/Daemon/Device/NotificationQueue.cpp
@@ -1,8 +1,4 @@
-/** @addtogroup MCD_MCDIMPL_DAEMON_DEV
- * @{
- * @file
- *
- *
+/*
* Copyright (c) 2013 TRUSTONIC LIMITED
* All rights reserved.
*
@@ -79,4 +75,3 @@ notification_t *NotificationQueue::getNotification(
return ret;
}
-/** @} */
diff --git a/mobicore/daemon/Daemon/Device/NotificationQueue.h b/mobicore/MobiCoreDriverLib/Daemon/Device/NotificationQueue.h
index cd004bb..0f4aee8 100644
--- a/mobicore/daemon/Daemon/Device/NotificationQueue.h
+++ b/mobicore/MobiCoreDriverLib/Daemon/Device/NotificationQueue.h
@@ -1,9 +1,4 @@
-/** @addtogroup MCD_MCDIMPL_DAEMON_DEV
- * @{
- * @file
- *
- * MobiCore Notification Queue handling.
- *
+/*
* Copyright (c) 2013 TRUSTONIC LIMITED
* All rights reserved.
*
@@ -33,6 +28,9 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ * MobiCore Notification Queue handling.
+ */
#ifndef NOTIFICATIONQUEUE_H_
#define NOTIFICATIONQUEUE_H_
@@ -87,4 +85,3 @@ private:
#endif /* NOTIFICATIONQUEUE_H_ */
-/** @} */
diff --git a/mobicore/daemon/Daemon/Device/Platforms/Android.mk b/mobicore/MobiCoreDriverLib/Daemon/Device/Platforms/Android.mk
index 48dd98a..48dd98a 100644
--- a/mobicore/daemon/Daemon/Device/Platforms/Android.mk
+++ b/mobicore/MobiCoreDriverLib/Daemon/Device/Platforms/Android.mk
diff --git a/mobicore/daemon/Daemon/Device/Platforms/Generic/Android.mk b/mobicore/MobiCoreDriverLib/Daemon/Device/Platforms/Generic/Android.mk
index a6607de..a6607de 100644
--- a/mobicore/daemon/Daemon/Device/Platforms/Generic/Android.mk
+++ b/mobicore/MobiCoreDriverLib/Daemon/Device/Platforms/Generic/Android.mk
diff --git a/mobicore/daemon/Daemon/Device/Platforms/Generic/TrustZoneDevice.cpp b/mobicore/MobiCoreDriverLib/Daemon/Device/Platforms/Generic/TrustZoneDevice.cpp
index 1f8359a..c1fc978 100644
--- a/mobicore/daemon/Daemon/Device/Platforms/Generic/TrustZoneDevice.cpp
+++ b/mobicore/MobiCoreDriverLib/Daemon/Device/Platforms/Generic/TrustZoneDevice.cpp
@@ -1,10 +1,5 @@
-/** @addtogroup MCD_MCDIMPL_DAEMON_DEV
- * @{
- * @file
- */
-
/*
- * 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
@@ -33,7 +28,6 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-
#include <cstdlib>
#include <stdio.h>
#include <inttypes.h>
@@ -61,6 +55,12 @@
#define MCI_BUFFER_SIZE (NQ_BUFFER_SIZE + MCP_BUFFER_SIZE)
//------------------------------------------------------------------------------
+MC_CHECK_VERSION(MCI, 0, 2);
+
+//------------------------------------------------------------------------------
+#define LOG_I_RELEASE(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
+
+//------------------------------------------------------------------------------
__attribute__ ((weak)) MobiCoreDevice *getDeviceInstance(
void
)
@@ -128,6 +128,12 @@ bool TrustZoneDevice::initDevice(
}
mciBuffer = pWsmMcp->virtAddr;
+ if (!checkMciVersion())
+ {
+ LOG_E("checkMciVersion failed");
+ return false;
+ }
+
// Only do a fastcall if MCI has not been reused (MC already initialized)
if (!mciReused)
{
@@ -257,7 +263,7 @@ bool TrustZoneDevice::nsiq(
return false;
}
// now we have to wake the scheduler, so <t-base gets CPU time.
- schedSync.signal();
+ DeviceScheduler::wakeup();
return true;
}
@@ -269,14 +275,13 @@ void TrustZoneDevice::notify(
{
// Check if it is MCP session - handle openSession() command
if (sessionId != SID_MCP) {
- // Check if session ID exists to avoid flooding of nq by clients
- TrustletSession *ts = getTrustletSession(sessionId);
- if (ts == NULL) {
- LOG_E("no session with id=%d", sessionId);
- return;
- }
-
- LOG_I(" Sending notification for session %d to <t-base", sessionId);
+// // Check if session ID exists to avoid flooding of nq by clients
+// TrustletSession *ts = getTrustletSession(sessionId);
+// if (ts == NULL) {
+// LOG_E("no session with id %03x", sessionId);
+// return;
+// }
+ LOG_I(" Sending notification for session %03x to <t-base", sessionId);
} else {
LOG_I(" Sending MCP notification to <t-base");
}
@@ -290,13 +295,13 @@ void TrustZoneDevice::notify(
//where it was handled, some server(sock or Netlink). In that case
//the server would just die but never actually signaled to the client
//any error condition
- nsiq();
+ (void)nsiq();
}
//------------------------------------------------------------------------------
uint32_t TrustZoneDevice::getMobicoreStatus(void)
{
- uint32_t status;
+ uint32_t status = MC_STATUS_NOT_INITIALIZED;
//IMPROVEMENT-2012-03-07-maneaval Can fcInfo ever fail? Before it threw an
//exception but the handler depended on the context.
pMcKMod->fcInfo(0, &status, NULL);
@@ -305,53 +310,76 @@ uint32_t TrustZoneDevice::getMobicoreStatus(void)
}
//------------------------------------------------------------------------------
+bool TrustZoneDevice::checkMciVersion(void)
+{
+ uint32_t version = 0;
+ int ret;
+ char *errmsg;
+
+ ret = pMcKMod->fcInfo(MC_EXT_INFO_ID_MCI_VERSION, NULL, &version);
+ if (ret != 0) {
+ LOG_E("pMcKMod->fcInfo() failed with %d", ret);
+ return false;
+ }
+
+ // Run-time check.
+ if (!checkVersionOkMCI(version, &errmsg)) {
+ LOG_E("%s", errmsg);
+ return false;
+ }
+ LOG_I("%s", errmsg);
+ return true;
+}
+
+//------------------------------------------------------------------------------
void TrustZoneDevice::dumpMobicoreStatus(
void
) {
- uint32_t status, info;
+ uint32_t status = MC_STATUS_NOT_INITIALIZED;
+ uint32_t info = 0;
// read additional info about exception-point and print
LOG_E("<t-base halted. Status dump:");
pMcKMod->fcInfo(1, &status, &info);
- LOG_W(" flags = 0x%08x", info);
+ LOG_I_RELEASE(" flags = 0x%08x", info);
pMcKMod->fcInfo(2, &status, &info);
- LOG_W(" haltCode = 0x%08x", info);
+ LOG_I_RELEASE(" haltCode = 0x%08x", info);
pMcKMod->fcInfo(3, &status, &info);
- LOG_W(" haltIp = 0x%08x", info);
+ LOG_I_RELEASE(" haltIp = 0x%08x", info);
pMcKMod->fcInfo(4, &status, &info);
- LOG_W(" faultRec.cnt = 0x%08x", info);
+ LOG_I_RELEASE(" faultRec.cnt = 0x%08x", info);
pMcKMod->fcInfo(5, &status, &info);
- LOG_W(" faultRec.cause = 0x%08x", info);
+ LOG_I_RELEASE(" faultRec.cause = 0x%08x", info);
pMcKMod->fcInfo(6, &status, &info);
- LOG_W(" faultRec.meta = 0x%08x", info);
+ LOG_I_RELEASE(" faultRec.meta = 0x%08x", info);
pMcKMod->fcInfo(7, &status, &info);
- LOG_W(" faultRec.thread = 0x%08x", info);
+ LOG_I_RELEASE(" faultRec.thread = 0x%08x", info);
pMcKMod->fcInfo(8, &status, &info);
- LOG_W(" faultRec.ip = 0x%08x", info);
+ LOG_I_RELEASE(" faultRec.ip = 0x%08x", info);
pMcKMod->fcInfo(9, &status, &info);
- LOG_W(" faultRec.sp = 0x%08x", info);
+ LOG_I_RELEASE(" faultRec.sp = 0x%08x", info);
pMcKMod->fcInfo(10, &status, &info);
- LOG_W(" faultRec.arch.dfsr = 0x%08x", info);
+ LOG_I_RELEASE(" faultRec.arch.dfsr = 0x%08x", info);
pMcKMod->fcInfo(11, &status, &info);
- LOG_W(" faultRec.arch.adfsr = 0x%08x", info);
+ LOG_I_RELEASE(" faultRec.arch.adfsr = 0x%08x", info);
pMcKMod->fcInfo(12, &status, &info);
- LOG_W(" faultRec.arch.dfar = 0x%08x", info);
+ LOG_I_RELEASE(" faultRec.arch.dfar = 0x%08x", info);
pMcKMod->fcInfo(13, &status, &info);
- LOG_W(" faultRec.arch.ifsr = 0x%08x", info);
+ LOG_I_RELEASE(" faultRec.arch.ifsr = 0x%08x", info);
pMcKMod->fcInfo(14, &status, &info);
- LOG_W(" faultRec.arch.aifsr = 0x%08x", info);
+ LOG_I_RELEASE(" faultRec.arch.aifsr = 0x%08x", info);
pMcKMod->fcInfo(15, &status, &info);
- LOG_W(" faultRec.arch.ifar = 0x%08x", info);
+ LOG_I_RELEASE(" faultRec.arch.ifar = 0x%08x", info);
pMcKMod->fcInfo(16, &status, &info);
- LOG_W(" mcData.flags = 0x%08x", info);
+ LOG_I_RELEASE(" mcData.flags = 0x%08x", info);
pMcKMod->fcInfo(19, &status, &info);
- LOG_W(" mcExcep.partner = 0x%08x", info);
+ LOG_I_RELEASE(" mcExcep.partner = 0x%08x", info);
pMcKMod->fcInfo(20, &status, &info);
- LOG_W(" mcExcep.peer = 0x%08x", info);
+ LOG_I_RELEASE(" mcExcep.peer = 0x%08x", info);
pMcKMod->fcInfo(21, &status, &info);
- LOG_W(" mcExcep.message = 0x%08x", info);
+ LOG_I_RELEASE(" mcExcep.cause = 0x%08x", info);
pMcKMod->fcInfo(22, &status, &info);
- LOG_W(" mcExcep.data = 0x%08x", info);
+ LOG_I_RELEASE(" mcExcep.meta = 0x%08x", info);
}
//------------------------------------------------------------------------------
@@ -370,22 +398,20 @@ bool TrustZoneDevice::waitSsiq(void)
//------------------------------------------------------------------------------
bool TrustZoneDevice::getMciInstance(uint32_t len, CWsm_ptr *mci, bool *reused)
{
- addr_t virtAddr;
- uint32_t handle;
- uint64_t physAddr;
+ addr_t virtAddr = NULL;
bool isReused = true;
if (len == 0) {
LOG_E("allocateWsm() length is 0");
return false;
}
- mcResult_t ret = pMcKMod->mapMCI(len, &handle, &virtAddr, &physAddr, &isReused);
+ mcResult_t ret = pMcKMod->mapMCI(len, &virtAddr, &isReused);
if (ret != MC_DRV_OK) {
LOG_E("pMcKMod->mmap() failed: %x", ret);
return false;
}
- *mci = new CWsm(virtAddr, len, handle, physAddr);
+ *mci = new CWsm(virtAddr, len, 0, 0);
*reused = isReused;
return true;
}
@@ -407,8 +433,8 @@ bool TrustZoneDevice::getMciInstance(uint32_t len, CWsm_ptr *mci, bool *reused)
//------------------------------------------------------------------------------
CWsm_ptr TrustZoneDevice::registerWsmL2(addr_t buffer, uint32_t len, uint32_t pid)
{
- uint64_t physAddr;
- uint32_t handle;
+ uint64_t physAddr = 0;
+ uint32_t handle = 0;
int ret = pMcKMod->registerWsmL2(
buffer,
@@ -430,18 +456,17 @@ CWsm_ptr TrustZoneDevice::allocateContiguousPersistentWsm(uint32_t len)
{
CWsm_ptr pWsm = NULL;
// Allocate shared memory
- addr_t virtAddr;
- uint32_t handle;
- uint64_t physAddr;
+ addr_t virtAddr = NULL;
+ uint32_t handle = 0;
if (len == 0 )
return NULL;
- if (pMcKMod->mapWsm(len, &handle, &virtAddr, &physAddr))
+ if (pMcKMod->mapWsm(len, &handle, &virtAddr))
return NULL;
// Register (vaddr,paddr) with device
- pWsm = new CWsm(virtAddr, len, handle, physAddr);
+ pWsm = new CWsm(virtAddr, len, handle, 0);
// Return pointer to the allocated memory
return pWsm;
@@ -452,12 +477,13 @@ CWsm_ptr TrustZoneDevice::allocateContiguousPersistentWsm(uint32_t len)
bool TrustZoneDevice::unregisterWsmL2(CWsm_ptr pWsm)
{
int ret = pMcKMod->unregisterWsmL2(pWsm->handle);
+ /* Free pWsm in all the cases */
+ delete pWsm;
+
if (ret != 0) {
LOG_E("pMcKMod->unregisterWsmL2 failed: %d", ret);
- //IMPROVEMENT-2012-03-07 maneaval Make sure we don't leak objects
return false;
}
- delete pWsm;
return true;
}
@@ -549,7 +575,9 @@ void TrustZoneDevice::schedule(void)
{
// <t-base is IDLE. Prevent unnecessary consumption of CPU cycles
// and wait for S-SIQ
- schedSync.wait(); // check return code?
+ DeviceScheduler::sleep();
+ if (DeviceScheduler::shouldTerminate())
+ break;
continue;
}
@@ -585,7 +613,9 @@ void TrustZoneDevice::handleTaExit(void)
LOG_I("Starting Trusted Application Exit handler...");
for (;;) {
// Wait until we get a notification without CA
- taExitNotification.wait();
+ TAExitHandler::sleep();
+ if (TAExitHandler::shouldTerminate())
+ break;
// Wait until socket server frees MCP
// Make sure we don't interfere with handleConnection/dropConnection
@@ -593,29 +623,32 @@ void TrustZoneDevice::handleTaExit(void)
// Check all sessions
// Socket server might have closed already and removed the session we were waken up for
- for (trustletSessionIterator_t iterator = trustletSessions.begin();
- iterator != trustletSessions.end();
- )
- {
- TrustletSession *ts = *iterator;
-
- if (ts->sessionState == TrustletSession::TS_TA_DEAD) {
- LOG_I("Cleaning up session %i", ts->sessionId);
-
- // Tell t-base to close the session
- mcResult_t mcRet = closeSessionInternal(ts);
-
- // If ok, remove objects
- if (mcRet == MC_DRV_OK) {
- iterator = trustletSessions.erase(iterator);
- LOG_I("TA session %i finally closed", ts->sessionId);
- delete ts;
- continue;
- } else {
- LOG_I("TA session %i could not be closed yet.", ts->sessionId);
+ for (;;) {
+ mutex_tslist.lock();
+ TrustletSession* ts = NULL;
+ for (trustletSessionList_t::iterator it = trustletSessions.begin(); it != trustletSessions.end(); it++) {
+ if ((*it)->sessionState == TrustletSession::TS_TA_DEAD) {
+ ts = *it;
+ break;
}
}
- ++iterator;
+ mutex_tslist.unlock();
+ if (!ts) {
+ break;
+ }
+#ifndef NDEBUG
+ uint32_t sessionId = ts->sessionId;
+#endif
+ LOG_I("Cleaning up session %03x", 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);
+ } else {
+ LOG_I("TA session %03x could not be closed yet.", sessionId);
+ }
}
mutex_mcp.unlock();
}
@@ -667,12 +700,13 @@ void TrustZoneDevice::handleIrq(
continue;
}
- LOG_I(" Notification for session %d, payload=%d",
+ LOG_I(" Notification for session %03x, payload=%d",
notification->sessionId, notification->payload);
// Get the Trustlet session for the session ID
TrustletSession *ts = NULL;
+ mutex_tslist.lock();
ts = getTrustletSession(notification->sessionId);
if (ts == NULL) {
/* Couldn't find the session for this notifications
@@ -691,7 +725,7 @@ void TrustZoneDevice::handleIrq(
ts->queueNotification(notification);
if (ts->deviceConnection == NULL) {
LOG_I(" Notification for disconnected client, scheduling cleanup of sessions.");
- taExitNotification.signal();
+ TAExitHandler::wakeup();
}
} else {
LOG_I(" Forward notification to McClient.");
@@ -702,13 +736,14 @@ void TrustZoneDevice::handleIrq(
}
mutex_connection.unlock();
}
+ mutex_tslist.unlock();
} // for (;;) over notifiction queue
// finished processing notifications. It does not matter if there were
// any notification or not. S-SIQs can also be triggered by an SWd
// driver which was waiting for a FIQ. In this case the S-SIQ tells
// NWd that SWd is no longer idle an will need scheduling again
- schedSync.signal();
+ DeviceScheduler::wakeup();
} //for (;;)
@@ -719,4 +754,4 @@ void TrustZoneDevice::handleIrq(
DeviceIrqHandler::setExiting();
signalMcpNotification();
}
-/** @} */
+
diff --git a/mobicore/daemon/Daemon/Device/Platforms/Generic/TrustZoneDevice.h b/mobicore/MobiCoreDriverLib/Daemon/Device/Platforms/Generic/TrustZoneDevice.h
index a895fa2..36c5e37 100644
--- a/mobicore/daemon/Daemon/Device/Platforms/Generic/TrustZoneDevice.h
+++ b/mobicore/MobiCoreDriverLib/Daemon/Device/Platforms/Generic/TrustZoneDevice.h
@@ -1,12 +1,5 @@
-/** @addtogroup MCD_MCDIMPL_DAEMON_DEV
- * @{
- * @file
- *
- * Class for TrustZone Devices.
- * TrustZone device implements communication functions needed for
- * accessing MobiCore located in an TrustZone environment.
- *
- * 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
@@ -35,6 +28,11 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ * Class for TrustZone Devices.
+ * TrustZone device implements communication functions needed for
+ * accessing MobiCore located in an TrustZone environment.
+ */
#ifndef TRUSTZONEDEVICE_H_
#define TRUSTZONEDEVICE_H_
@@ -47,7 +45,6 @@
#include "CMcKMod.h"
#include "CWsm.h"
-#include "ExcDevice.h"
#include "MobiCoreDevice.h"
@@ -58,7 +55,6 @@ class TrustZoneDevice : public MobiCoreDevice
protected:
bool schedulerEnabled; /**< NQ IRQ Scheduler enabling */
- CSemaphore schedSync; /**< Semaphore to synchronize S-SIQs with scheduler thread */
CMcKMod_ptr pMcKMod; /**< kernel module */
CWsm_ptr pWsmMcp; /**< WSM use for MCP */
CWsm_ptr mobicoreInDDR; /**< WSM used for Mobicore binary */
@@ -112,6 +108,7 @@ public:
CWsm_ptr registerWsmL2(addr_t buffer, uint32_t len, uint32_t pid);
+ /* pWsm is freed even in case of error */
bool unregisterWsmL2(CWsm_ptr pWsm);
bool lockWsmL2(uint32_t handle);
@@ -145,4 +142,3 @@ public:
#endif /* TRUSTZONEDEVICE_H_ */
-/** @} */
diff --git a/mobicore/daemon/Daemon/Device/TAExitHandler.cpp b/mobicore/MobiCoreDriverLib/Daemon/Device/TAExitHandler.cpp
index cf60b04..93c66e9 100644
--- a/mobicore/daemon/Daemon/Device/TAExitHandler.cpp
+++ b/mobicore/MobiCoreDriverLib/Daemon/Device/TAExitHandler.cpp
@@ -1,8 +1,4 @@
-/** @addtogroup MCD_MCDIMPL_DAEMON_DEV
- * @{
- * @file
- *
- *
+/*
* Copyright (c) 2013 TRUSTONIC LIMITED
* All rights reserved.
*
@@ -32,7 +28,6 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-
#include "TAExitHandler.h"
#include "log.h"
@@ -45,4 +40,3 @@ void TAExitHandler::run(
this->exit(-1);
}
-/** @} */
diff --git a/mobicore/daemon/Daemon/Device/TAExitHandler.h b/mobicore/MobiCoreDriverLib/Daemon/Device/TAExitHandler.h
index 037cd12..ac69a5c 100644
--- a/mobicore/daemon/Daemon/Device/TAExitHandler.h
+++ b/mobicore/MobiCoreDriverLib/Daemon/Device/TAExitHandler.h
@@ -1,10 +1,5 @@
-/** @addtogroup MCD_MCDIMPL_DAEMON_DEV
- * @{
- * @file
- *
- * Trusted Application exit handler thread.
- *
- * 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
@@ -33,7 +28,6 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-
#ifndef _TAEXITHANDLER_H_
#define _TAEXITHANDLER_H_
@@ -45,8 +39,6 @@
class TAExitHandler: public CThread
{
public:
- CSemaphore taExitNotification;
-
virtual void handleTaExit() = 0;
void run();
@@ -54,4 +46,3 @@ public:
#endif /* TAEXITHANDLER_H_ */
-/** @} */
diff --git a/mobicore/daemon/Daemon/Device/TrustletSession.cpp b/mobicore/MobiCoreDriverLib/Daemon/Device/TrustletSession.cpp
index d0bd1e0..1d05645 100644
--- a/mobicore/daemon/Daemon/Device/TrustletSession.cpp
+++ b/mobicore/MobiCoreDriverLib/Daemon/Device/TrustletSession.cpp
@@ -1,7 +1,4 @@
-/** @addtogroup MCD_MCDIMPL_DAEMON_DEV
- * @{
- * @file
- *
+/*
* Copyright (c) 2013 TRUSTONIC LIMITED
* All rights reserved.
*
@@ -31,7 +28,6 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-
#include "TrustletSession.h"
#include <cstdlib>
@@ -73,7 +69,7 @@ void TrustletSession::queueNotification(notification_t *notification)
return;
}
if ((gp_level == 1) && (notification->payload != 0)) {
- LOG_I(" Mark session %i dead", sessionId);
+ LOG_I(" Mark session %03x dead", sessionId);
sessionState = TS_TA_DEAD;
}
// Note this is a very subtle synchronization requirement:
@@ -158,4 +154,3 @@ CWsm_ptr TrustletSession::popBulkBuff()
return pWsm;
}
-/** @} */
diff --git a/mobicore/daemon/Daemon/Device/TrustletSession.h b/mobicore/MobiCoreDriverLib/Daemon/Device/TrustletSession.h
index 76deba1..1555660 100644
--- a/mobicore/daemon/Daemon/Device/TrustletSession.h
+++ b/mobicore/MobiCoreDriverLib/Daemon/Device/TrustletSession.h
@@ -1,7 +1,4 @@
-/** @addtogroup MCD_MCDIMPL_DAEMON_DEV
- * @{
- * @file
- *
+/*
* Copyright (c) 2013 TRUSTONIC LIMITED
* All rights reserved.
*
@@ -83,4 +80,3 @@ typedef trustletSessionList_t::iterator trustletSessionIterator_t;
#endif /* TRUSTLETSESSION_H_ */
-/** @} */
diff --git a/mobicore/daemon/Daemon/Device/public/MobiCoreDevice.h b/mobicore/MobiCoreDriverLib/Daemon/Device/public/MobiCoreDevice.h
index 5d05028..e7348b4 100644
--- a/mobicore/daemon/Daemon/Device/public/MobiCoreDevice.h
+++ b/mobicore/MobiCoreDriverLib/Daemon/Device/public/MobiCoreDevice.h
@@ -1,12 +1,4 @@
-/** @addtogroup MCD_MCDIMPL_DAEMON_DEV
- * @{
- * @file
- *
- * MobiCore device.
- * The MobiCore device class handles the MCP processing within the driver.
- * Concrete devices implementing the communication behavior for the platforms have to be derived
- * from this.
- *
+/*
* Copyright (c) 2013 TRUSTONIC LIMITED
* All rights reserved.
*
@@ -36,6 +28,12 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ * MobiCore device.
+ * The MobiCore device class handles the MCP processing within the driver.
+ * Concrete devices implementing the communication behavior for the platforms have to be derived
+ * from this.
+ */
#ifndef MOBICOREDEVICE_H_
#define MOBICOREDEVICE_H_
@@ -52,7 +50,6 @@
#include "Connection.h"
#include "CWsm.h"
-#include "ExcDevice.h"
#include "DeviceScheduler.h"
#include "DeviceIrqHandler.h"
#include "TAExitHandler.h"
@@ -98,6 +95,7 @@ protected:
bool mciReused; /**< Signal restart of Daemon. */
CMutex mutex_connection; // Mutex to share session->notificationConnection for GP cases
+
/* In a special case a Trustlet can create a race condition in the daemon.
* If at Trustlet start it detects an error of some sort and calls the
* exit function before waiting for any notifications from NWD then the daemon
@@ -141,11 +139,12 @@ private:
virtual bool waitSsiq(void) = 0;
public:
- CMutex mutex_mcp; // This mutex should be taken before any access to below functions
+ CMutex mutex_mcp; // This mutex should be taken before any access to below functions
+ CMutex mutex_tslist; // Mutex to share Trustlet session list ==> WARNING, do not CI, temporary fix.
virtual ~MobiCoreDevice();
- Connection *getSessionConnection(uint32_t sessionId, notification_t *notification);
+ //Connection *getSessionConnection(uint32_t sessionId, notification_t *notification);
bool open(Connection *connection);
@@ -166,6 +165,8 @@ public:
MC_DRV_CMD_NQ_CONNECT_struct *cmdNqConnect);
+ void freeSession(TrustletSession *session);
+
mcResult_t closeSession(Connection *deviceConnection, uint32_t sessionId);
virtual mcResult_t notify(Connection *deviceConnection, uint32_t sessionId);
@@ -250,4 +251,3 @@ public:
#endif /* MOBICOREDEVICE_H_ */
-/** @} */
diff --git a/mobicore/daemon/Daemon/FSD/Android.mk b/mobicore/MobiCoreDriverLib/Daemon/FSD/Android.mk
index 8c8f578..144d141 100644
--- a/mobicore/daemon/Daemon/FSD/Android.mk
+++ b/mobicore/MobiCoreDriverLib/Daemon/FSD/Android.mk
@@ -11,7 +11,7 @@ FSD_PATH := Daemon/FSD
# Add new folders with header files here
LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(FSD_PATH)/public \
- $(MOBICORE_PROJECT_PATH)/include/GPD_TEE_Internal_API
+ $(LOCAL_PATH)/ClientLib/public/GP \
# Add new source files here
-LOCAL_SRC_FILES += $(FSD_PATH)/FSD.cpp \ No newline at end of file
+LOCAL_SRC_FILES += $(FSD_PATH)/FSD.cpp \ \ No newline at end of file
diff --git a/mobicore/daemon/Daemon/FSD/FSD.cpp b/mobicore/MobiCoreDriverLib/Daemon/FSD/FSD.cpp
index 31821ae..046b98e 100644
--- a/mobicore/daemon/Daemon/FSD/FSD.cpp
+++ b/mobicore/MobiCoreDriverLib/Daemon/FSD/FSD.cpp
@@ -1,12 +1,5 @@
-/** @addtogroup MCD_MCDIMPL_DAEMON_SRV
- * @{
- * @file
- *
- * FSD server.
- *
- * Handles incoming storage requests from TA through STH
- */
-/* 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
@@ -35,28 +28,35 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ * FSD server.
+ *
+ * Handles incoming storage requests from TA through STH
+ */
#include "public/FSD.h"
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <cstdlib>
#include <stdio.h>
-
+#include <assert.h>
//#define LOG_VERBOSE
#include "log.h"
-extern string getRegistryPath();
+/* The following definitions are not exported in the header files of the
+ client API. */
+#define TEE_DATA_FLAG_EXCLUSIVE 0x00000400
+#define TEE_ERROR_STORAGE_NO_SPACE ((TEEC_Result)0xFFFF3041)
+#define TEE_ERROR_CORRUPT_OBJECT ((TEEC_Result)0xF0100001)
-extern pthread_mutex_t syncMutex;
-extern pthread_cond_t syncCondition;
-extern bool Th_sync;
+extern string getTbStoragePath();
//------------------------------------------------------------------------------
FSD::FSD(
void
)
{
- sessionHandle = {0,0};
+ memset(&sessionHandle, 0, sizeof(mcSessionHandle_t));
dci = NULL;
}
@@ -74,27 +74,19 @@ void FSD::run(
{
struct stat st = {0};
mcResult_t ret;
- string storage = getRegistryPath()+"/TbStorage";
+ string storage = getTbStoragePath();
const char* tbstpath = storage.c_str();
/*Create Tbase storage directory*/
if (stat(tbstpath, &st) == -1) {
- LOG_I("%s: Create <t-base storage folder %s", TAG_LOG, tbstpath);
- if(mkdir(tbstpath, 0600)==-1)
+ LOG_I("%s: Creating <t-base storage Folder %s\n",TAG_LOG,tbstpath);
+ if(mkdir(tbstpath, 0700)==-1)
{
- LOG_ERRNO("Failed to create storage folder");
+ LOG_E("%s: failed creating storage folder\n",TAG_LOG);
}
}
do{
- pthread_mutex_lock(&syncMutex);
- pthread_cond_wait(&syncCondition, &syncMutex);
- if (Th_sync==true)
- {
- LOG_I("%s: starting File Storage Daemon", TAG_LOG);
-
- }
- pthread_mutex_unlock(&syncMutex);
-
+ LOG_I("%s: starting File Storage Daemon", TAG_LOG);
ret = FSD_Open();
if (ret != MC_DRV_OK)
break;
@@ -248,37 +240,90 @@ void FSD::FSD_listenDci(void){
}
}
+// Output FileName is guaranteed to be 0 ended.
void FSD_HexFileName(
unsigned char* fn,
char* FileName,
- uint32_t elems
+ uint32_t fnSize,
+ uint32_t FileNameSize
){
-
- char tmp[elems * 2 + 1];
+ assert (FileNameSize == fnSize *2 +1);
+ char tmp[fnSize * 2 + 1];
uint32_t i=0;
- for (i = 0; i < elems; i++) {
- sprintf(&tmp[i * 2], "%02x", fn[i]);
+ // tmp is size-variabled array, have to init it with memset
+ memset(tmp, 0, fnSize * 2 + 1);
+ for (i = 0; i < fnSize; i++) {
+ // the implementation of snprintf counts also the trailing "\0"
+ snprintf(&tmp[i * 2], 2 + sizeof("\0"), "%02x", fn[i]);
}
- strcpy(FileName,tmp);
+ tmp[fnSize * 2 + 1] = '\0';
+ strncpy(FileName,tmp,FileNameSize);
}
-void FSD_CreateTaDirName(
+// Output DirName is guaranteed to be 0 ended.
+static void FSD_CreateTaDirName(
TEE_UUID* ta_uuid,
char* DirName,
- uint32_t elems
+ uint32_t DirNameSize
){
- char tmp[elems * 2 + 1];
- unsigned char* fn;
+ assert (DirNameSize == sizeof(TEE_UUID) *2 +1);
+ char tmp[sizeof(TEE_UUID) * 2 + 1];
+ unsigned char* fn;
uint32_t i=0;
+ memset(tmp, 0, sizeof(tmp));
fn = (unsigned char*)ta_uuid;
- for (i = 0; i < elems; i++) {
- sprintf(&tmp[i * 2], "%02x", fn[i]);
+ for (i = 0; i < sizeof(TEE_UUID); i++) {
+ // the implementation of snprintf counts also the trailing "\0"
+ snprintf(&tmp[i * 2], 2 + sizeof("\0"), "%02x", fn[i]);
}
- strcat(DirName,tmp);
+ strncpy(DirName,tmp,DirNameSize);
+}
+
+void FSD_CreateTaDirPath(
+ string storage,
+ STH_FSD_message_t *sth_request,
+ char *TAdirpath,
+ size_t TAdirpathSize //sizeof(TAdirpathSize)
+){
+ const char* tbstpath = storage.c_str();
+ size_t tbstpathSize = storage.length();
+ char tadirname[TEE_UUID_STRING_SIZE+1] = {0};
+ assert (TAdirpathSize == tbstpathSize+1+TEE_UUID_STRING_SIZE+1);
+
+ FSD_CreateTaDirName(&sth_request->uuid,tadirname,sizeof(tadirname));
+
+ strncpy(TAdirpath, tbstpath, tbstpathSize);
+ strncat(TAdirpath, "/", strlen(("/")));
+ strncat(TAdirpath, tadirname, strlen(tadirname));
+
+ LOG_I("%s: Storage %s\n", __func__, tbstpath);
+ LOG_I("%s: TA dirname %s\n", __func__, tadirname);
+
+}
+
+void FSD_CreateFilePath(
+ STH_FSD_message_t *sth_request,
+ char *Filepath,
+ size_t FilepathSize, // sizeof(FilepathSize)
+ char *TAdirpath,
+ size_t TAdirpathSize // sizeof(TAdirpath)
+
+){
+ char filename[2*FILENAMESIZE+1] = {0};
+ assert (FilepathSize == TAdirpathSize + 2*FILENAMESIZE+1);
+ FSD_HexFileName(sth_request->filename,filename,FILENAMESIZE,sizeof(filename));
+
+ strncpy(Filepath, TAdirpath, TAdirpathSize-1);
+ strncat(Filepath, "/", strlen("/"));
+ strncat(Filepath, filename, strlen(filename));
+
+ LOG_I("%s: filename %s\n", __func__, filename);
+ LOG_I("%s: fullpath %s\n", __func__, Filepath);
+
}
//------------------------------------------------------------------------------
@@ -325,94 +370,106 @@ mcResult_t FSD::FSD_ExecuteCommand(void){
mcResult_t FSD::FSD_LookFile(void){
FILE * pFile=NULL;
STH_FSD_message_t* sth_request=NULL;
- uint32_t res=0;
- string storage = getRegistryPath()+"/TbStorage";
- const char* tbstpath = storage.c_str();
- char tadirname[TEE_UUID_STRING_SIZE+1];
- char filename[2*FILENAMESIZE+1];
- char TAdirpath[strlen(tbstpath)+1+TEE_UUID_STRING_SIZE+1];
- char Filepath[strlen(tbstpath)+1+TEE_UUID_STRING_SIZE+1+2*FILENAMESIZE+1];
+ size_t res;
+ string storage = getTbStoragePath();
+ char TAdirpath[storage.length()+1+TEE_UUID_STRING_SIZE+1];
+ char Filepath[storage.length()+1+TEE_UUID_STRING_SIZE+1+2*FILENAMESIZE+1];
+ memset(TAdirpath, 0, storage.length()+1+TEE_UUID_STRING_SIZE+1);
+ memset(Filepath, 0, storage.length()+1+TEE_UUID_STRING_SIZE+1+2*FILENAMESIZE+1);
sth_request= &dci->sth_request;
- //create TA folder name from TA UUID
- FSD_CreateTaDirName(&sth_request->uuid,tadirname,sizeof(TEE_UUID));
- FSD_HexFileName(sth_request->filename,filename,FILENAMESIZE);
-
- //Create path to TA folder and test if does exist
- strcpy(TAdirpath,tbstpath);
- strcat(TAdirpath, "/");
- strcat(TAdirpath, tadirname);
-
- strcpy(Filepath, TAdirpath);
- strcat(Filepath, "/");
- strcat(Filepath, filename);
- LOG_I("%s: Storage %s\n", __func__, tbstpath);
- LOG_I("%s: TA dirname %s\n", __func__, tadirname);
- LOG_I("%s: filename %s\n", __func__, filename);
- LOG_I("%s: fullpath %s\n", __func__, Filepath);
+ FSD_CreateTaDirPath(
+ storage,
+ sth_request,
+ TAdirpath,
+ sizeof(TAdirpath));
+
+ FSD_CreateFilePath(
+ sth_request,
+ Filepath,
+ sizeof(Filepath),
+ TAdirpath,
+ sizeof(TAdirpath));
pFile = fopen(Filepath, "r");
if (pFile==NULL)
{
- LOG_E("%s: Error looking for file 0x%.8x\n",__func__,TEE_ERROR_ITEM_NOT_FOUND);
- return TEE_ERROR_ITEM_NOT_FOUND;
+ LOG_E("%s: Error looking for file 0x%.8x\n",__func__,TEEC_ERROR_ITEM_NOT_FOUND);
+ return TEEC_ERROR_ITEM_NOT_FOUND;
}
res = fread(sth_request->payload,sizeof(char),sth_request->payloadLen,pFile);
- fclose(pFile);
- if (res != sth_request->payloadLen)
+ if (ferror(pFile))
{
LOG_E("%s: Error reading file res is %d and errno is %s\n",__func__,res,strerror(errno));
- return TEE_ERROR_ITEM_NOT_FOUND;
+ fclose(pFile);
+ return TEEC_ERROR_ITEM_NOT_FOUND;
}
- return TEE_SUCCESS;
+
+ if (res < sth_request->payloadLen)
+ {
+ //File is shorter than expected
+ if (feof(pFile)) {
+ LOG_I("%s: EOF reached: res is %d, payloadLen is %d\n",__func__,res, sth_request->payloadLen);
+ }
+ }
+
+ fclose(pFile);
+
+ return TEEC_SUCCESS;
}
mcResult_t FSD::FSD_ReadFile(void){
FILE * pFile=NULL;
STH_FSD_message_t* sth_request=NULL;
- uint32_t res=0;
- string storage = getRegistryPath()+"/TbStorage";
- const char* tbstpath = storage.c_str();
- char tadirname[TEE_UUID_STRING_SIZE+1];
- char filename[2*FILENAMESIZE+1];
- char TAdirpath[strlen(tbstpath)+1+TEE_UUID_STRING_SIZE+1];
- char Filepath[strlen(tbstpath)+1+TEE_UUID_STRING_SIZE+1+2*FILENAMESIZE+1];
+ size_t res;
+ string storage = getTbStoragePath();
+ char TAdirpath[storage.length()+1+TEE_UUID_STRING_SIZE+1];
+ char Filepath[storage.length()+1+TEE_UUID_STRING_SIZE+1+2*FILENAMESIZE+1];
+ memset(TAdirpath, 0, storage.length()+1+TEE_UUID_STRING_SIZE+1);
+ memset(Filepath, 0, storage.length()+1+TEE_UUID_STRING_SIZE+1+2*FILENAMESIZE+1);
sth_request= &dci->sth_request;
- //create TA folder name from TA UUID
- FSD_CreateTaDirName(&sth_request->uuid,tadirname,sizeof(TEE_UUID));
- FSD_HexFileName(sth_request->filename,filename,FILENAMESIZE);
-
- //Create path to TA folder and test if does exist
- strcpy(TAdirpath,tbstpath);
- strcat(TAdirpath, "/");
- strcat(TAdirpath, tadirname);
-
- strcpy(Filepath, TAdirpath);
- strcat(Filepath, "/");
- strcat(Filepath, filename);
- LOG_I("%s: Storage %s\n", __func__, tbstpath);
- LOG_I("%s: TA dirname %s\n", __func__, tadirname);
- LOG_I("%s: filename %s\n", __func__, filename);
- LOG_I("%s: fullpath %s\n", __func__, Filepath);
+ FSD_CreateTaDirPath(
+ storage,
+ sth_request,
+ TAdirpath,
+ sizeof(TAdirpath));
+
+ FSD_CreateFilePath(
+ sth_request,
+ Filepath,
+ sizeof(Filepath),
+ TAdirpath,
+ sizeof(TAdirpath));
+
pFile = fopen(Filepath, "r");
if (pFile==NULL)
{
- LOG_E("%s: Error looking for file 0x%.8x\n", __func__,TEE_ERROR_ITEM_NOT_FOUND);
- return TEE_ERROR_ITEM_NOT_FOUND;
+ LOG_E("%s: Error looking for file 0x%.8x\n", __func__,TEEC_ERROR_ITEM_NOT_FOUND);
+ return TEEC_ERROR_ITEM_NOT_FOUND;
}
res = fread(sth_request->payload,sizeof(char),sth_request->payloadLen,pFile);
- fclose(pFile);
-
- if (res != sth_request->payloadLen)
+ if (ferror(pFile))
{
LOG_E("%s: Error reading file res is %d and errno is %s\n",__func__,res,strerror(errno));
- return TEE_ERROR_ITEM_NOT_FOUND;
+ fclose(pFile);
+ return TEE_ERROR_CORRUPT_OBJECT;
}
- return TEE_SUCCESS;
+
+ if (res < sth_request->payloadLen)
+ {
+ //File is shorter than expected
+ if (feof(pFile)) {
+ LOG_I("%s: EOF reached: res is %d, payloadLen is %d\n",__func__,res, sth_request->payloadLen);
+ }
+ }
+
+ fclose(pFile);
+
+ return TEEC_SUCCESS;
}
@@ -420,51 +477,48 @@ mcResult_t FSD::FSD_WriteFile(void){
FILE * pFile=NULL;
int fd=0;
STH_FSD_message_t* sth_request=NULL;
- uint32_t res=0;
+ size_t res=0;
int stat=0;
- string storage = getRegistryPath()+"/TbStorage";
- const char* tbstpath = storage.c_str();
- char tadirname[TEE_UUID_STRING_SIZE+1];
- char filename[2*FILENAMESIZE+1];
- char TAdirpath[strlen(tbstpath)+1+TEE_UUID_STRING_SIZE+1];
- char Filepath[strlen(tbstpath)+1+TEE_UUID_STRING_SIZE+1+2*FILENAMESIZE+1];
- char Filepath_new[strlen(tbstpath)+TEE_UUID_STRING_SIZE+2*FILENAMESIZE+strlen(NEW_EXT)+1];
-
+ string storage = getTbStoragePath();
+ char TAdirpath[storage.length()+1+TEE_UUID_STRING_SIZE+1];
+ char Filepath[storage.length()+1+TEE_UUID_STRING_SIZE+1+2*FILENAMESIZE+1];
+ char Filepath_new[storage.length()+TEE_UUID_STRING_SIZE+2*FILENAMESIZE+strlen(NEW_EXT)+1];
+
+ memset(TAdirpath, 0, storage.length()+1+TEE_UUID_STRING_SIZE+1);
+ memset(Filepath, 0, storage.length()+1+TEE_UUID_STRING_SIZE+1+2*FILENAMESIZE+1);
+ memset(Filepath_new, 0, storage.length()+TEE_UUID_STRING_SIZE+2*FILENAMESIZE+strlen(NEW_EXT)+1);
sth_request= &dci->sth_request;
+ FSD_CreateTaDirPath(
+ storage,
+ sth_request,
+ TAdirpath,
+ sizeof(TAdirpath));
- FSD_CreateTaDirName(&sth_request->uuid,tadirname,sizeof(TEE_UUID));
- FSD_HexFileName(sth_request->filename,filename,FILENAMESIZE);
-
- strcpy(TAdirpath,tbstpath);
- strcat(TAdirpath, "/");
- strcat(TAdirpath, tadirname);
-
- stat = mkdir(TAdirpath, 0700);
+ stat = mkdir(TAdirpath, 0700);
if((stat==-1) && (errno!=EEXIST))
{
- LOG_I("%s: error when creating TA dir: %s (%s)\n",__func__,TAdirpath,strerror(errno));
+ LOG_E("%s: error when creating TA dir: %s (%s)\n",__func__,TAdirpath,strerror(errno));
return TEE_ERROR_STORAGE_NO_SPACE;
}
/* Directory exists. */
- strcpy(Filepath, TAdirpath);
- strcat(Filepath, "/");
- strcat(Filepath, filename);
- strcpy(Filepath_new,Filepath);
- strcat(Filepath_new, NEW_EXT);
- LOG_I("%s: Storage %s\n", __func__, tbstpath);
- LOG_I("%s: TA dirname %s\n", __func__, tadirname);
- LOG_I("%s: filename %s\n", __func__, filename);
- LOG_I("%s: fullpath %s\n", __func__, Filepath);
+ FSD_CreateFilePath(
+ sth_request,
+ Filepath,
+ sizeof(Filepath),
+ TAdirpath,
+ sizeof(TAdirpath));
+ strncpy(Filepath_new,Filepath,sizeof(Filepath) - 1);
+ strncat(Filepath_new,NEW_EXT,strlen(NEW_EXT));
LOG_I("%s: filename.new %s\n", __func__, Filepath_new);
if(sth_request->flags == TEE_DATA_FLAG_EXCLUSIVE)
{
LOG_I("%s: opening file in exclusive mode\n",__func__);
- fd = open (Filepath, O_WRONLY | O_CREAT | O_EXCL, S_IWUSR);
+ fd = open(Filepath, O_WRONLY | O_CREAT | O_EXCL, S_IWUSR);
if (fd == -1)
{
- LOG_I("%s: error creating file: %s (%s)\n",__func__,Filepath,strerror(errno));
- return TEE_ERROR_ACCESS_CONFLICT;
+ LOG_E("%s: error creating file: %s \n",__func__,strerror(errno));
+ return TEE_ERROR_CORRUPT_OBJECT;
}
else
{
@@ -475,110 +529,118 @@ mcResult_t FSD::FSD_WriteFile(void){
LOG_I("%s: opening file for writing\n",__func__);
if(pFile==NULL)
{
- remove(Filepath);
+ if(remove(Filepath)==-1)
+ {
+ LOG_E("%s: remove failed: %s\n",__func__, strerror(errno));
+ }
return TEE_ERROR_STORAGE_NO_SPACE;
}
res = fwrite(sth_request->payload,sizeof(char),sth_request->payloadLen,pFile);
-
- if (res != sth_request->payloadLen)
+ if (ferror(pFile))
{
LOG_E("%s: Error writing file res is %d and errno is %s\n",__func__,res,strerror(errno));
fclose(pFile);
- remove(Filepath);
- remove(Filepath_new);
- return TEE_ERROR_ITEM_NOT_FOUND;
+ if(remove(Filepath)==-1)
+ {
+ LOG_E("%s: remove failed: %s\n",__func__, strerror(errno));
+ }
+ if(remove(Filepath_new)==-1)
+ {
+ LOG_E("%s: remove failed: %s\n",__func__, strerror(errno));
+ }
+ return TEE_ERROR_STORAGE_NO_SPACE;
}
else
{
res = fclose(pFile);
- if (res < 0)
+ if ((int32_t) res < 0)
{
LOG_E("%s: Error closing file res is %d and errno is %s\n",__func__,res,strerror(errno));
- remove(Filepath);
- remove(Filepath_new);
+ if(remove(Filepath)==-1)
+ {
+ LOG_E("%s: remove failed: %s\n",__func__, strerror(errno));
+ }
+ if(remove(Filepath_new)==-1)
+ {
+ LOG_E("%s: remove failed: %s\n",__func__, strerror(errno));
+ }
return TEE_ERROR_STORAGE_NO_SPACE;
}
res = rename(Filepath_new,Filepath);
- if (res < 0)
+ if ((int32_t) res < 0)
{
- LOG_E("%s: Error renaming %s: %s\n",__func__,Filepath_new,strerror(errno));
- remove(Filepath);
- remove(Filepath_new);
+ LOG_E("%s: Error renaming: %s\n",__func__,strerror(errno));
+ if(remove(Filepath)==-1)
+ {
+ LOG_E("%s: remove failed: %s\n",__func__, strerror(errno));
+ }
+ if(remove(Filepath_new)==-1)
+ {
+ LOG_E("%s: remove failed: %s\n",__func__, strerror(errno));
+ }
return TEE_ERROR_STORAGE_NO_SPACE;
}
}
- return TEE_SUCCESS;
+ return TEEC_SUCCESS;
}
mcResult_t FSD::FSD_DeleteFile(void){
FILE * pFile=NULL;
- uint32_t res=0;
+ mcResult_t ret;
+ size_t res;
STH_FSD_message_t* sth_request=NULL;
- string storage = getRegistryPath()+"/TbStorage";
- const char* tbstpath = storage.c_str();
- char tadirname[TEE_UUID_STRING_SIZE+1];
- char filename[2*FILENAMESIZE+1];
- char TAdirpath[strlen(tbstpath)+1+TEE_UUID_STRING_SIZE+1];
- char Filepath[strlen(tbstpath)+1+TEE_UUID_STRING_SIZE+1+2*FILENAMESIZE+1];
+ string storage = getTbStoragePath();
+ char TAdirpath[storage.length()+1+TEE_UUID_STRING_SIZE+1];
+ char Filepath[storage.length()+1+TEE_UUID_STRING_SIZE+1+2*FILENAMESIZE+1];
+ memset(TAdirpath, 0, storage.length()+1+TEE_UUID_STRING_SIZE+1);
+ memset(Filepath, 0, storage.length()+1+TEE_UUID_STRING_SIZE+1+2*FILENAMESIZE+1);
sth_request= &dci->sth_request;
-
- //create TA folder name from TA UUID
- FSD_CreateTaDirName(&sth_request->uuid,tadirname,sizeof(TEE_UUID));
- FSD_HexFileName(sth_request->filename,filename,FILENAMESIZE);
-
- //Create path to TA folder and test if does exist
- strcpy(TAdirpath,tbstpath);
- strcat(TAdirpath, "/");
- strcat(TAdirpath, tadirname);
-
- /* Directory exists. */
- strcpy(Filepath, TAdirpath);
- strcat(Filepath, "/");
- strcat(Filepath, filename);
- LOG_I("%s: Storage %s\n", __func__, tbstpath);
- LOG_I("%s: TA dirname %s\n", __func__, tadirname);
- LOG_I("%s: filename %s\n", __func__, filename);
- LOG_I("%s: fullpath %s\n", __func__, Filepath);
+ FSD_CreateTaDirPath(
+ storage,
+ sth_request,
+ TAdirpath,
+ sizeof(TAdirpath));
+
+ FSD_CreateFilePath(
+ sth_request,
+ Filepath,
+ sizeof(Filepath),
+ TAdirpath,
+ sizeof(TAdirpath));
pFile = fopen(Filepath, "r");
if (pFile==NULL)
{
LOG_I("%s: file not found: %s (%s)\n",__func__, Filepath, strerror(errno));
- res = TEE_SUCCESS;
+ ret = TEEC_SUCCESS;
}
else
{
fclose(pFile);
if(remove(Filepath)==-1)
{
- res = TEE_ERROR_STORAGE_NO_SPACE;
+ ret = TEE_ERROR_STORAGE_NO_SPACE;
}
}
- LOG_I("%s: before rmdir res %d errno %d (%s)\n",__func__,res, errno,strerror(errno));
-
res = rmdir(TAdirpath);
-
- LOG_I("%s: after rmdir res %d errno %d (%s)\n",__func__,res, errno,strerror(errno));
-
- if ((res < 0) && (errno != ENOTEMPTY) && (errno != EEXIST) && (errno != ENOENT))
+ if (((int32_t) res < 0) && (errno != ENOTEMPTY) && (errno != EEXIST) && (errno != ENOENT))
{
- res = TEE_ERROR_STORAGE_NO_SPACE;
- LOG_I("%s: rmdir failed: %s (%s)\n",__func__, TAdirpath, strerror(errno));
+ ret = TEE_ERROR_STORAGE_NO_SPACE;
+ LOG_E("%s: rmdir failed: %s (%s)\n",__func__, TAdirpath, strerror(errno));
}
else
{
- res = TEE_SUCCESS;
+ ret = TEEC_SUCCESS;
}
- return res;
+ return ret;
}
//------------------------------------------------------------------------------
-/** @} */
diff --git a/mobicore/daemon/Daemon/FSD/public/FSD.h b/mobicore/MobiCoreDriverLib/Daemon/FSD/public/FSD.h
index 9a44fa6..0c7f97a 100644
--- a/mobicore/daemon/Daemon/FSD/public/FSD.h
+++ b/mobicore/MobiCoreDriverLib/Daemon/FSD/public/FSD.h
@@ -1,12 +1,4 @@
-/** @addtogroup MCD_MCDIMPL_DAEMON_SRV
- * @{
- * @file
- *
- * FSD server.
- *
- * Handles incoming storage requests from TA through STH
- *
- *
+/*
* Copyright (c) 2013 TRUSTONIC LIMITED
* All rights reserved.
*
@@ -36,6 +28,11 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ * FSD server.
+ *
+ * Handles incoming storage requests from TA through STH
+ */
#ifndef FSD_H_
#define FSD_H_
@@ -166,4 +163,3 @@ private:
#endif /* FSD_H_ */
-/** @} */
diff --git a/mobicore/MobiCoreDriverLib/Daemon/FSD/public/dci.h b/mobicore/MobiCoreDriverLib/Daemon/FSD/public/dci.h
new file mode 100644
index 0000000..cf0b8c2
--- /dev/null
+++ b/mobicore/MobiCoreDriverLib/Daemon/FSD/public/dci.h
@@ -0,0 +1,77 @@
+/*
+ * 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.
+ */
+
+/**
+ * @file dci.h
+ * @brief Contains DCI (Driver Control
+ * Interface) definitions and data structures
+ *
+ */
+
+#ifndef __DCI_H__
+#define __DCI_H__
+
+
+typedef uint32_t dciCommandId_t;
+typedef uint32_t dciResponseId_t;
+typedef uint32_t dciReturnCode_t;
+
+/**< Responses have bit 31 set */
+#define RSP_ID_MASK (1U << 31)
+#define RSP_ID(cmdId) (((uint32_t)(cmdId)) | RSP_ID_MASK)
+#define IS_CMD(cmdId) ((((uint32_t)(cmdId)) & RSP_ID_MASK) == 0)
+#define IS_RSP(cmdId) ((((uint32_t)(cmdId)) & RSP_ID_MASK) == RSP_ID_MASK)
+
+/**
+ * Return codes of driver commands.
+ */
+#define RET_OK 0
+#define RET_ERR_UNKNOWN_CMD 1
+#define RET_ERR_NOT_SUPPORTED 2
+#define RET_ERR_INTERNAL_ERROR 3
+/* ... add more error codes when needed */
+
+/**
+ * DCI command header.
+ */
+typedef struct{
+ dciCommandId_t commandId; /**< Command ID */
+} dciCommandHeader_t;
+
+/**
+ * DCI response header.
+ */
+typedef struct{
+ dciResponseId_t responseId; /**< Response ID (must be command ID | RSP_ID_MASK )*/
+ dciReturnCode_t returnCode; /**< Return code of command */
+} dciResponseHeader_t;
+
+#endif // __DCI_H__
diff --git a/mobicore/common/DrSecureStorage/drSecureStorage_Api.h b/mobicore/MobiCoreDriverLib/Daemon/FSD/public/drSecureStorage_Api.h
index 0ca7549..46cc36f 100644
--- a/mobicore/common/DrSecureStorage/drSecureStorage_Api.h
+++ b/mobicore/MobiCoreDriverLib/Daemon/FSD/public/drSecureStorage_Api.h
@@ -1,12 +1,32 @@
/*
* Copyright (c) 2013 TRUSTONIC LIMITED
- * All rights reserved
+ * All rights reserved.
*
- * The present software is the confidential and proprietary information of
- * TRUSTONIC LIMITED. You shall not disclose the present software and shall
- * use it only in accordance with the terms of the license agreement you
- * entered into with TRUSTONIC LIMITED. This software may be subject to
- * export or import laws in certain countries.
+ * 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.
*/
/**
@@ -19,8 +39,8 @@
#define __DRTEMPLATEAPI_H__
#include "dci.h"
-#include "tee_internal_api.h"
-
+#include "tee_type.h"
+#include "tee_error.h"
#define RW_DATA_SIZE 4096
diff --git a/mobicore/daemon/Daemon/MobiCoreDriverDaemon.cpp b/mobicore/MobiCoreDriverLib/Daemon/MobiCoreDriverDaemon.cpp
index 576dc88..f3e0b72 100644
--- a/mobicore/daemon/Daemon/MobiCoreDriverDaemon.cpp
+++ b/mobicore/MobiCoreDriverLib/Daemon/MobiCoreDriverDaemon.cpp
@@ -1,12 +1,5 @@
-/** @addtogroup MCD_MCDIMPL_DAEMON_CONHDLR
- * @{
- * @file
- *
- * Entry of the MobiCore Driver.
- */
-
/*
- * 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
@@ -35,7 +28,9 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-
+/**
+ * Entry of the MobiCore Driver.
+ */
#include <cstdlib>
#include <signal.h>
#include <fcntl.h>
@@ -66,10 +61,6 @@ static void checkMobiCoreVersion(MobiCoreDevice *mobiCoreDevice);
#define LOG_I_RELEASE(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
-pthread_mutex_t syncMutex = PTHREAD_MUTEX_INITIALIZER;
-pthread_cond_t syncCondition = PTHREAD_COND_INITIALIZER;
-bool Th_sync=false;
-
//------------------------------------------------------------------------------
MobiCoreDriverDaemon::MobiCoreDriverDaemon(
bool enableScheduler,
@@ -97,7 +88,8 @@ MobiCoreDriverDaemon::~MobiCoreDriverDaemon(
for (it = driverResources.begin(); it != driverResources.end(); it++) {
MobicoreDriverResources *res = *it;
mobiCoreDevice->closeSession(res->conn, res->sessionId);
- mobiCoreDevice->unregisterWsmL2(res->pTciWsm);
+ (void)mobiCoreDevice->unregisterWsmL2(res->pTciWsm);
+ res->pTciWsm = NULL;
}
delete mobiCoreDevice;
for (int i = 0; i < MAX_SERVERS; i++) {
@@ -112,8 +104,6 @@ void MobiCoreDriverDaemon::run(
void
)
{
- const char *devNode = "/dev/" MC_ADMIN_DEVNODE;
-
LOG_I_RELEASE("Daemon starting up...");
LOG_I_RELEASE("Socket interface version is %u.%u", DAEMON_VERSION_MAJOR, DAEMON_VERSION_MINOR);
@@ -134,59 +124,26 @@ void MobiCoreDriverDaemon::run(
// initialize device (setupo MCI)
if (!mobiCoreDevice->initDevice(
- devNode,
+ "/dev/" MC_ADMIN_DEVNODE,
enableScheduler)) {
- LOG_E("Could not initialize <t-base (because %s could not be openend)!", devNode);
+ LOG_E("Could not initialize <t-base!");
return;
}
// start device (scheduler)
mobiCoreDevice->start();
+ LOG_I_RELEASE("Checking version of <t-base");
+ checkMobiCoreVersion(mobiCoreDevice);
+
// Load device driver if requested
if (loadDriver) {
for (unsigned int i = 0; i < drivers.size(); i++)
loadDeviceDriver(drivers[i]);
}
- /* Look for tokens in the registry and pass them to <t-base for endorsement
- * purposes.
- */
- LOG_I("Looking for suitable tokens");
-
- mcSoAuthTokenCont_t authtoken;
- mcSoRootCont_t rootcont;
- uint32_t sosize;
- uint8_t *p = NULL;
-
- mcResult_t ret = mcRegistryReadAuthToken(&authtoken);
- if (ret != MC_DRV_OK) {
- LOG_I("Failed to read AuthToken (ret=%u). Trying Root Container", ret);
-
- sosize = sizeof(rootcont);
- ret = mcRegistryReadRoot(&rootcont, &sosize);
- if (ret != MC_DRV_OK) {
- LOG_I("Failed to read Root Cont, (ret=%u)", ret);
- LOG_W("Device endorsements not supported!");
- sosize = 0;
- }
- else {
- LOG_I("Found Root Cont.");
- p = (uint8_t *) &rootcont;
- }
- } else {
- LOG_I("Found AuthToken.");
- p = (uint8_t *) &authtoken;
- sosize = sizeof(authtoken);
- }
-
- if (sosize) {
- LOG_I("Found token of size: %u", sosize);
- if (!loadToken(p, sosize)) {
- LOG_E("Failed to pass token to <t-base. "
- "Device endorsements disabled");
- }
- }
+ // Look for tokens and send it to <t-base if any
+ installEndorsementToken();
LOG_I("Creating socket servers");
// Start listening for incoming TLC connections
@@ -199,18 +156,10 @@ void MobiCoreDriverDaemon::run(
servers[i]->start(i ? "McDaemon.Server" : "NetlinkServer");
}
- // Create the <t-base File Storage Daemon
- FSD *FileStorageDaemon = new FSD();
- // Start File Storage Daemon
- FileStorageDaemon->start("McDaemon.FSD");
-
// then wait for them to exit
for (i = 0; i < MAX_SERVERS; i++) {
servers[i]->join();
}
- //Wait for File Storage Daemon to exit
- FileStorageDaemon->join();
- delete FileStorageDaemon;
}
//------------------------------------------------------------------------------
@@ -315,7 +264,7 @@ bool MobiCoreDriverDaemon::loadDeviceDriver(
// Initialize information data of open session command
loadDataOpenSession_t loadDataOpenSession;
loadDataOpenSession.baseAddr = pWsm->physAddr;
- loadDataOpenSession.offs = ((uint32_t) regObj->value) & 0xFFF;
+ loadDataOpenSession.offs = ((uintptr_t) regObj->value) & 0xFFF;
loadDataOpenSession.len = regObj->len;
loadDataOpenSession.tlHeader = (mclfHeader_ptr) (regObj->value + regObj->tlStartOffset);
@@ -336,7 +285,12 @@ bool MobiCoreDriverDaemon::loadDeviceDriver(
// Unregister physical memory from kernel module.
// This will also destroy the WSM object.
- mobiCoreDevice->unregisterWsmL2(pWsm);
+ if (!mobiCoreDevice->unregisterWsmL2(pWsm))
+ {
+ pWsm = NULL;
+ LOG_E("unregistering of WsmL2 failed.");
+ break;
+ }
pWsm = NULL;
// Free memory occupied by Trustlet data
@@ -355,9 +309,9 @@ bool MobiCoreDriverDaemon::loadDeviceDriver(
LOG_I("%s: Freeing previously allocated resources!", __FUNCTION__);
if (pWsm != NULL) {
if (!mobiCoreDevice->unregisterWsmL2(pWsm)) {
- // At least make sure we don't leak the WSM object
- delete pWsm;
+ LOG_E("unregisterWsmL2 failed");
}
+ pWsm = NULL;
}
// No matter if we free NULL objects
free(regObj);
@@ -375,7 +329,7 @@ bool MobiCoreDriverDaemon::loadDeviceDriver(
#define RECV_PAYLOAD_FROM_CLIENT(CONNECTION, CMD_BUFFER) \
{ \
- void *payload = (void*)((uint32_t)CMD_BUFFER + sizeof(mcDrvCommandHeader_t)); \
+ void *payload = (void*)((uintptr_t)CMD_BUFFER + sizeof(mcDrvCommandHeader_t)); \
uint32_t payload_len = sizeof(*CMD_BUFFER) - sizeof(mcDrvCommandHeader_t); \
int32_t rlen = CONNECTION->readData(payload, payload_len); \
if (rlen < 0) { \
@@ -384,7 +338,7 @@ bool MobiCoreDriverDaemon::loadDeviceDriver(
writeResult(CONNECTION, MC_DRV_ERR_DAEMON_SOCKET); \
return; \
} \
- if (rlen != payload_len) {\
+ if ((uint32_t)rlen != payload_len) {\
LOG_E("wrong buffer length %i received from Client", rlen); \
writeResult(CONNECTION, MC_DRV_ERR_DAEMON_SOCKET); \
return; \
@@ -498,7 +452,7 @@ void MobiCoreDriverDaemon::processOpenSession(Connection *connection, bool isGpU
// Initialize information data of open session command
loadDataOpenSession_t loadDataOpenSession;
loadDataOpenSession.baseAddr = pWsm->physAddr;
- loadDataOpenSession.offs = ((uint32_t) regObj->value) & 0xFFF;
+ loadDataOpenSession.offs = ((uintptr_t) regObj->value) & 0xFFF;
loadDataOpenSession.len = regObj->len;
loadDataOpenSession.tlHeader = (mclfHeader_ptr) (regObj->value + regObj->tlStartOffset);
@@ -516,12 +470,13 @@ void MobiCoreDriverDaemon::processOpenSession(Connection *connection, bool isGpU
// This will also destroy the WSM object.
if (!device->unregisterWsmL2(pWsm)) {
+ pWsm = NULL;
// TODO-2012-07-02-haenellu: Can this ever happen? And if so, we should assert(), also TL might still be running.
free(regObj);
writeResult(connection, MC_DRV_ERR_DAEMON_KMOD_ERROR);
return;
}
-
+ pWsm = NULL;
// Free memory occupied by Trustlet data
free(regObj);
@@ -571,7 +526,7 @@ mcResult_t MobiCoreDriverDaemon::processLoadCheck(mcSpid_t spid, void *blob, uin
// Initialize information data of open session command
loadDataOpenSession_t loadDataOpenSession;
loadDataOpenSession.baseAddr = pWsm->physAddr;
- loadDataOpenSession.offs = ((uint32_t) regObj->value) & 0xFFF;
+ loadDataOpenSession.offs = ((uintptr_t) regObj->value) & 0xFFF;
loadDataOpenSession.len = regObj->len;
loadDataOpenSession.tlHeader = (mclfHeader_ptr) (regObj->value + regObj->tlStartOffset);
@@ -585,11 +540,13 @@ mcResult_t MobiCoreDriverDaemon::processLoadCheck(mcSpid_t spid, void *blob, uin
// This will also destroy the WSM object.
if (!device->unregisterWsmL2(pWsm)) {
+ pWsm = NULL;
// Free memory occupied by Trustlet data
free(regObj);
LOG_E("deallocating WSM for Trustlet failed");
return MC_DRV_ERR_DAEMON_KMOD_ERROR;
}
+ pWsm = NULL;
// Free memory occupied by Trustlet data
free(regObj);
@@ -662,7 +619,7 @@ void MobiCoreDriverDaemon::processOpenTrustlet(Connection *connection)
// Initialize information data of open session command
loadDataOpenSession_t loadDataOpenSession;
loadDataOpenSession.baseAddr = pWsm->physAddr;
- loadDataOpenSession.offs = ((uint32_t) regObj->value) & 0xFFF;
+ loadDataOpenSession.offs = ((uintptr_t) regObj->value) & 0xFFF;
loadDataOpenSession.len = regObj->len;
loadDataOpenSession.tlHeader = (mclfHeader_ptr) (regObj->value + regObj->tlStartOffset);
@@ -680,11 +637,13 @@ void MobiCoreDriverDaemon::processOpenTrustlet(Connection *connection)
// This will also destroy the WSM object.
if (!device->unregisterWsmL2(pWsm)) {
+ pWsm = NULL;
free(regObj);
// TODO-2012-07-02-haenellu: Can this ever happen? And if so, we should assert(), also TL might still be running.
writeResult(connection, MC_DRV_ERR_DAEMON_KMOD_ERROR);
return;
}
+ pWsm = NULL;
// Free memory occupied by Trustlet data
free(regObj);
@@ -750,16 +709,25 @@ void MobiCoreDriverDaemon::processNqConnect(Connection *connection)
return;
}
+ /*
+ * The fix extends the range of the trustlet_session_list mutex over the
+ * sending of the nq-socket message that confirms the creation of the session.
+ * That way an arriving SSIQ/notification-from-driver will not use the nq-socket before the ok message was sent.
+ */
+ device->mutex_tslist.lock();
TrustletSession *ts = device->registerTrustletConnection(
connection,
&cmd);
if (!ts) {
LOG_E("registerTrustletConnection() failed!");
writeResult(connection, MC_DRV_ERR_UNKNOWN);
+ device->mutex_tslist.unlock();
return;
}
writeResult(connection, MC_DRV_OK);
+ device->mutex_tslist.unlock();
+
ts->processQueuedNotifications();
}
@@ -770,7 +738,7 @@ void MobiCoreDriverDaemon::processNotify(Connection *connection)
// Read entire command data
MC_DRV_CMD_NOTIFY_struct cmd;
//RECV_PAYLOAD_FROM_CLIENT(connection, &cmd);
- void *payload = (void *)((uint32_t)&cmd + sizeof(mcDrvCommandHeader_t));
+ void *payload = (void *)((uintptr_t)&cmd + sizeof(mcDrvCommandHeader_t));
uint32_t payload_len = sizeof(cmd) - sizeof(mcDrvCommandHeader_t);
uint32_t rlen = connection->readData(payload, payload_len);
if ((int) rlen < 0) {
@@ -926,6 +894,8 @@ mcDrvResponseHeader_t rspRegistry = { responseId :
mcSpid_t spid;
mcUuid_t uuid;
+ memset(&spid, 0, sizeof(spid));
+
if (!checkPermission(connection)) {
connection->writeData(&rspRegistry, sizeof(rspRegistry));
return;
@@ -966,7 +936,7 @@ void MobiCoreDriverDaemon::processRegistryWriteData(uint32_t commandId, Connecti
mcDrvResponseHeader_t rspRegistry = { responseId :
MC_DRV_ERR_INVALID_OPERATION
};
- uint32_t soSize;
+ uint32_t soSize = 0;
void *so;
if (!checkPermission(connection)) {
@@ -993,12 +963,32 @@ mcDrvResponseHeader_t rspRegistry = { responseId :
if (!getData(connection, so, soSize))
break;
rspRegistry.responseId = mcRegistryStoreAuthToken(so, soSize);
+ if (rspRegistry.responseId != MC_DRV_OK) {
+ LOG_E("mcRegistryStoreAuthToken() failed");
+ break;
+ }
+ /* Load authentication token. Need to update <t-base to avoid
+ * reboot */
+ LOG_I("Auth Token stored. Updating <t-base.");
+ if (!loadToken((uint8_t *)so, sizeof(mcSoAuthTokenCont_t))) {
+ LOG_E("Failed to pass Auth Token to <t-base.");
+ }
break;
}
case MC_DRV_REG_WRITE_ROOT_CONT: {
if (!getData(connection, so, soSize))
break;
rspRegistry.responseId = mcRegistryStoreRoot(so, soSize);
+ if (rspRegistry.responseId != MC_DRV_OK) {
+ LOG_E("mcRegistryStoreRoot() failed");
+ break;
+ }
+ /* Load Root container. Need to update <t-base to avoid
+ * reboot */
+ LOG_I("Root container stored. Updating <t-base.");
+ if (!loadToken((uint8_t *)so, sizeof(mcSoRootCont_t))) {
+ LOG_E("Failed to pass Root container to <t-base.");
+ }
break;
}
case MC_DRV_REG_WRITE_SP_CONT: {
@@ -1013,6 +1003,7 @@ mcDrvResponseHeader_t rspRegistry = { responseId :
case MC_DRV_REG_WRITE_TL_CONT: {
mcUuid_t uuid;
mcSpid_t spid;
+ memset(&spid, 0, sizeof(spid));
if (!getData(connection, &uuid, sizeof(uuid)))
break;
if (!getData(connection, &spid, sizeof(spid)))
@@ -1032,6 +1023,7 @@ mcDrvResponseHeader_t rspRegistry = { responseId :
uint32_t blobSize = soSize;
mcSpid_t spid;
void *blob;
+ memset(&spid, 0, sizeof(spid));
if (!getData(connection, &spid, sizeof(spid)))
break;
blob = malloc(blobSize);
@@ -1069,7 +1061,7 @@ void MobiCoreDriverDaemon::processRegistryDeleteData(uint32_t commandId, Connect
mcDrvResponseHeader_t rspRegistry = { responseId :
MC_DRV_ERR_INVALID_OPERATION
};
- mcSpid_t spid;
+ mcSpid_t spid = MC_SPID_RESERVED; /* MC_SPID_RESERVED = 0 */
if (!checkPermission(connection)) {
connection->writeData(&rspRegistry, sizeof(rspRegistry));
@@ -1080,9 +1072,16 @@ mcDrvResponseHeader_t rspRegistry = { responseId :
case MC_DRV_REG_DELETE_AUTH_TOKEN:
rspRegistry.responseId = mcRegistryDeleteAuthToken();
break;
- case MC_DRV_REG_DELETE_ROOT_CONT:
+ case MC_DRV_REG_DELETE_ROOT_CONT: {
rspRegistry.responseId = mcRegistryCleanupRoot();
+ if (rspRegistry.responseId != MC_DRV_OK) {
+ LOG_E("mcRegistryCleanupRoot() failed");
+ break;
+ }
+ // Look for tokens and send it to <t-base if any
+ installEndorsementToken();
break;
+ }
case MC_DRV_REG_DELETE_SP_CONT:
if (!getData(connection, &spid, sizeof(spid)))
break;
@@ -1111,7 +1110,8 @@ bool MobiCoreDriverDaemon::handleConnection(
bool ret = false;
// This is the big lock around everything the Daemon does, including socket and MCI access
- static CMutex mutex;
+ static CMutex reg_mutex;
+ static CMutex siq_mutex;
/* In case of RTM fault do not try to signal anything to MobiCore
* just answer NO to all incoming connections! */
@@ -1120,9 +1120,6 @@ bool MobiCoreDriverDaemon::handleConnection(
return false;
}
- mutex.lock();
- mobiCoreDevice->mutex_mcp.lock();
-
LOG_I("handleConnection()==== %p", connection);
do {
// Read header
@@ -1148,43 +1145,63 @@ bool MobiCoreDriverDaemon::handleConnection(
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:
@@ -1192,7 +1209,9 @@ bool MobiCoreDriverDaemon::handleConnection(
break;
//-----------------------------------------
case MC_DRV_CMD_GET_MOBICORE_VERSION:
+ mobiCoreDevice->mutex_mcp.lock();
processGetMobiCoreVersion(connection);
+ mobiCoreDevice->mutex_mcp.unlock();
break;
//-----------------------------------------
/* Registry functionality */
@@ -1203,7 +1222,9 @@ bool MobiCoreDriverDaemon::handleConnection(
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
@@ -1211,7 +1232,9 @@ bool MobiCoreDriverDaemon::handleConnection(
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
@@ -1219,7 +1242,9 @@ bool MobiCoreDriverDaemon::handleConnection(
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:
@@ -1230,8 +1255,7 @@ bool MobiCoreDriverDaemon::handleConnection(
break;
}
} while (0);
- mobiCoreDevice->mutex_mcp.unlock();
- mutex.unlock();
+
LOG_I("handleConnection()<-------");
return ret;
@@ -1297,10 +1321,6 @@ int main(int argc, char *args[])
// By default don't fork
bool forkDaemon = false;
- /* Initialize mutex and condition variable objects */
- pthread_mutex_init(&syncMutex, NULL);
- pthread_cond_init (&syncCondition, NULL);
-
while ((c = getopt(argc, args, "r:sbhp:")) != -1) {
switch (c) {
case 'h': /* Help */
@@ -1336,25 +1356,12 @@ int main(int argc, char *args[])
/* ignore terminal has been closed signal */
signal(SIGHUP, SIG_IGN);
- int i = fork();
- if (i < 0) {
- exit(1);
- }
- // Parent
- else if (i > 0) {
- exit(0);
+ /* become a daemon */
+ if (daemon(0, 0) < 0) {
+ fprintf(stderr, "Fork failed, exiting.\n");
+ return 1;
}
- // obtain a new process group */
- setsid();
- /* close all descriptors */
- for (i = sysconf(_SC_OPEN_MAX); i >= 0; --i) {
- close(i);
- }
- // STDIN, STDOUT and STDERR should all point to /dev/null */
- i = open("/dev/null", O_RDWR);
- dup(i);
- dup(i);
/* ignore tty signals */
signal(SIGTSTP, SIG_IGN);
signal(SIGTTOU, SIG_IGN);
@@ -1381,9 +1388,6 @@ int main(int argc, char *args[])
delete mobiCoreDriverDaemon;
- pthread_mutex_destroy(&syncMutex);
- pthread_cond_destroy(&syncCondition);
-
// This should not happen
LOG_E("Exiting <t-base Daemon");
@@ -1410,29 +1414,28 @@ static void checkMobiCoreVersion(
// Check <t-base version info.
char *msg;
if (!checkVersionOkMCI(versionPayload.versionInfo.versionMci, &msg)) {
- LOG_E("checkVersionOkMCI failed - %s", msg);
+ LOG_E("%s", msg);
failed = true;
}
- LOG_I_RELEASE("versionMci - %s", msg);
+ LOG_I_RELEASE("%s", msg);
if (!checkVersionOkSO(versionPayload.versionInfo.versionSo, &msg)) {
- LOG_E("checkVersionOkSO failed - %s", msg);
+ LOG_E("%s", msg);
failed = true;
}
- LOG_I_RELEASE("versionSo - %s", msg);
+ LOG_I_RELEASE("%s", msg);
if (!checkVersionOkMCLF(versionPayload.versionInfo.versionMclf, &msg)) {
- LOG_E("checkVersionOkMCLF failed - %s", msg);
+ LOG_E("%s", msg);
failed = true;
}
- LOG_I_RELEASE("versionInfo - %s", msg);
+ LOG_I_RELEASE("%s", msg);
if (!checkVersionOkCONTAINER(versionPayload.versionInfo.versionContainer, &msg)) {
- LOG_E("checkVersionOkCONTAINER failed - %s", msg);
+ LOG_E("%s", msg);
failed = true;
}
- LOG_I_RELEASE("versionContainer - %s", msg);
+ LOG_I_RELEASE("%s", msg);
}
if (failed) {
- LOG_E("Failed to check mobiCore version");
exit(1);
}
}
@@ -1456,7 +1459,7 @@ bool MobiCoreDriverDaemon::loadToken(uint8_t *token, uint32_t sosize)
/* Initialize information data of LOAD_TOKEN command */
loadTokenData_t loadTokenData;
loadTokenData.addr = pWsm->physAddr;
- loadTokenData.offs = ((uint32_t) token) & 0xFFF;
+ loadTokenData.offs = ((uintptr_t) token) & 0xFFF;
loadTokenData.len = sosize;
conn = new Connection();
@@ -1465,7 +1468,11 @@ bool MobiCoreDriverDaemon::loadToken(uint8_t *token, uint32_t sosize)
/* Unregister physical memory from kernel module. This will also destroy
* the WSM object.
*/
- mobiCoreDevice->unregisterWsmL2(pWsm);
+ if (!mobiCoreDevice->unregisterWsmL2(pWsm)) {
+ LOG_E("Unregistering of WsmL2 failed.");
+ pWsm = NULL;
+ break;
+ }
pWsm = NULL;
if (mcRet != MC_MCP_RET_OK) {
@@ -1482,4 +1489,58 @@ bool MobiCoreDriverDaemon::loadToken(uint8_t *token, uint32_t sosize)
return ret;
}
-/** @} */
+//------------------------------------------------------------------------------
+void MobiCoreDriverDaemon::installEndorsementToken(void)
+{
+ /* Look for tokens in the registry and pass them to <t-base for endorsement
+ * purposes.
+ */
+ LOG_I("Looking for suitable tokens");
+
+ mcSoAuthTokenCont_t authtoken;
+ mcSoAuthTokenCont_t authtokenbackup;
+ mcSoRootCont_t rootcont;
+ uint32_t sosize;
+ uint8_t *p = NULL;
+
+ // Search order: 1. authtoken 2. authtoken backup 3. root container
+ sosize = 0;
+ mcResult_t ret = mcRegistryReadAuthToken(&authtoken);
+ if (ret != MC_DRV_OK) {
+ LOG_I("Failed to read AuthToken (ret=%u). Trying AuthToken backup", ret);
+
+ ret = mcRegistryReadAuthTokenBackup(&authtokenbackup);
+ if (ret != MC_DRV_OK) {
+ LOG_I("Failed to read AuthToken backup (ret=%u). Trying Root Cont", ret);
+
+ sosize = sizeof(rootcont);
+ ret = mcRegistryReadRoot(&rootcont, &sosize);
+ if (ret != MC_DRV_OK) {
+ LOG_I("Failed to read Root Cont, (ret=%u).", ret);
+ LOG_W("Device endorsements not supported!");
+ sosize = 0;
+ } else {
+ LOG_I("Found Root Cont.");
+ p = (uint8_t *) &rootcont;
+ }
+
+ } else {
+ LOG_I("Found AuthToken backup.");
+ p = (uint8_t *) &authtokenbackup;
+ sosize = sizeof(authtokenbackup);
+ }
+
+ } else {
+ LOG_I("Found AuthToken.");
+ p = (uint8_t *) &authtoken;
+ sosize = sizeof(authtoken);
+ }
+
+ if (sosize) {
+ LOG_I("Found token of size: %u", sosize);
+ if (!loadToken(p, sosize)) {
+ LOG_E("Failed to pass token to <t-base. "
+ "Device endorsements disabled");
+ }
+ }
+}
diff --git a/mobicore/daemon/Daemon/MobiCoreDriverDaemon.h b/mobicore/MobiCoreDriverLib/Daemon/MobiCoreDriverDaemon.h
index b13c8fa..2c4b807 100644
--- a/mobicore/daemon/Daemon/MobiCoreDriverDaemon.h
+++ b/mobicore/MobiCoreDriverLib/Daemon/MobiCoreDriverDaemon.h
@@ -1,11 +1,4 @@
-/** @addtogroup MCD_MCDIMPL_DAEMON_CONHDLR
- * @{
- * @file
- *
- * <t-base driver class.
- * The <t-base driver class implements the ConnectionHandler interface.
- *
- *
+/*
* Copyright (c) 2013 TRUSTONIC LIMITED
* All rights reserved.
*
@@ -35,6 +28,10 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ * <t-base driver class.
+ * The <t-base driver class implements the ConnectionHandler interface.
+ */
#ifndef MOBICOREDRIVER_H_
#define MOBICOREDRIVER_H_
@@ -262,8 +259,14 @@ private:
* @param sosize the size of the token
*/
bool loadToken(uint8_t *token, uint32_t sosize);
+
+ /**
+ * installEndorsementToken
+ * Look for tokens in the registry and pass them to <t-base for endorsement purposes
+ * Search order: 1. authtoken 2. authtoken backup 3. root container
+ */
+ void installEndorsementToken(void);
};
#endif /* MOBICOREDRIVER_H_ */
-/** @} */
diff --git a/mobicore/daemon/Daemon/Server/Android.mk b/mobicore/MobiCoreDriverLib/Daemon/Server/Android.mk
index 3f92d73..3f92d73 100644
--- a/mobicore/daemon/Daemon/Server/Android.mk
+++ b/mobicore/MobiCoreDriverLib/Daemon/Server/Android.mk
diff --git a/mobicore/daemon/Daemon/Server/NetlinkServer.cpp b/mobicore/MobiCoreDriverLib/Daemon/Server/NetlinkServer.cpp
index 5ffd41b..0e88cce 100644
--- a/mobicore/daemon/Daemon/Server/NetlinkServer.cpp
+++ b/mobicore/MobiCoreDriverLib/Daemon/Server/NetlinkServer.cpp
@@ -1,11 +1,3 @@
-/** @addtogroup MCD_MCDIMPL_DAEMON_SRV
- * @{
- * @file
- *
- * Connection server.
- *
- * Handles incoming socket connections from clients using the MobiCore driver.
- */
/*
* Copyright (c) 2013 TRUSTONIC LIMITED
* All rights reserved.
@@ -36,6 +28,11 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ * Connection server.
+ *
+ * Handles incoming socket connections from clients using the MobiCore driver.
+ */
#include "public/NetlinkServer.h"
#include <unistd.h>
#include <string.h>
@@ -82,7 +79,7 @@ void NetlinkServer::run(
src_addr.nl_family = AF_NETLINK;
src_addr.nl_pid = MC_DAEMON_PID; /* daemon pid */
src_addr.nl_groups = 0; /* not in mcast groups */
- if (::bind(serverSock, (struct sockaddr *)&src_addr, sizeof(src_addr)) < 0) {
+ if (bind(serverSock, (struct sockaddr *)&src_addr, sizeof(src_addr)) < 0) {
LOG_ERRNO("Binding to server socket failed, because bind");
close(serverSock);
serverSock = -1;
@@ -284,4 +281,3 @@ void NetlinkServer::cleanupConnections(
}
}
-/** @} */
diff --git a/mobicore/daemon/Daemon/Server/Server.cpp b/mobicore/MobiCoreDriverLib/Daemon/Server/Server.cpp
index 540e666..418d8b0 100644
--- a/mobicore/daemon/Daemon/Server/Server.cpp
+++ b/mobicore/MobiCoreDriverLib/Daemon/Server/Server.cpp
@@ -1,11 +1,3 @@
-/** @addtogroup MCD_MCDIMPL_DAEMON_SRV
- * @{
- * @file
- *
- * Connection server.
- *
- * Handles incoming socket connections from clients using the MobiCore driver.
- */
/*
* Copyright (c) 2013 TRUSTONIC LIMITED
* All rights reserved.
@@ -36,6 +28,11 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ * Connection server.
+ *
+ * Handles incoming socket connections from clients using the MobiCore driver.
+ */
#include "public/Server.h"
#include <unistd.h>
#include <string.h>
@@ -43,10 +40,7 @@
//#define LOG_VERBOSE
#include "log.h"
-
-extern pthread_mutex_t syncMutex;
-extern pthread_cond_t syncCondition;
-extern bool Th_sync;
+#include "FSD.h"
//------------------------------------------------------------------------------
Server::Server(
@@ -64,8 +58,10 @@ void Server::run(
void
)
{
+ bool isFSDStarted=false;
+ FSD *FileStorageDaemon=NULL;
+
do {
- pthread_mutex_lock(&syncMutex);
LOG_I("Server: start listening on socket %s", socketAddr.c_str());
@@ -120,9 +116,14 @@ void Server::run(
}
}
- pthread_cond_signal(&syncCondition);
- Th_sync=true;
- pthread_mutex_unlock(&syncMutex);
+ if (!isFSDStarted) {
+ // Create the <t-base File Storage Daemon
+ FileStorageDaemon = new FSD();
+ // Start File Storage Daemon
+ FileStorageDaemon->start("McDaemon.FSD");
+
+ isFSDStarted=true;
+ }
// Wait for activities, select() returns the number of sockets
// which require processing
@@ -208,6 +209,12 @@ void Server::run(
} while (false);
+ //Wait for File Storage Daemon to exit
+ if (FileStorageDaemon) {
+ FileStorageDaemon->join();
+ delete FileStorageDaemon;
+ }
+
LOG_ERRNO("Exiting Server, because");
}
@@ -252,4 +259,3 @@ Server::~Server(
}
}
-/** @} */
diff --git a/mobicore/daemon/Daemon/Server/public/ConnectionHandler.h b/mobicore/MobiCoreDriverLib/Daemon/Server/public/ConnectionHandler.h
index f647398..8c769e2 100644
--- a/mobicore/daemon/Daemon/Server/public/ConnectionHandler.h
+++ b/mobicore/MobiCoreDriverLib/Daemon/Server/public/ConnectionHandler.h
@@ -1,10 +1,4 @@
-/** @addtogroup MCD_MCDIMPL_DAEMON_SRV
- * @{
- * @file
- *
- * Interface for connection handlers used by Server.
- *
- *
+/*
* Copyright (c) 2013 TRUSTONIC LIMITED
* All rights reserved.
*
@@ -34,6 +28,9 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ * Interface for connection handlers used by Server.
+ */
#ifndef CONNECTIONHANDLER_H_
#define CONNECTIONHANDLER_H_
@@ -70,4 +67,3 @@ public:
#endif /* CONNECTIONHANDLER_H_ */
-/** @} */
diff --git a/mobicore/daemon/Daemon/Server/public/NetlinkServer.h b/mobicore/MobiCoreDriverLib/Daemon/Server/public/NetlinkServer.h
index 14e8b85..f272368 100644
--- a/mobicore/daemon/Daemon/Server/public/NetlinkServer.h
+++ b/mobicore/MobiCoreDriverLib/Daemon/Server/public/NetlinkServer.h
@@ -1,14 +1,4 @@
-/** @addtogroup MCD_MCDIMPL_DAEMON_SRV
- * @{
- * @file
- *
- * Connection server.
- *
- * Handles incoming socket connections from clients using the MobiCore driver.
- *
- * Iterative socket server using Netlink dgram protocol.
- *
- *
+/*
* Copyright (c) 2013 TRUSTONIC LIMITED
* All rights reserved.
*
@@ -38,6 +28,13 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ * Connection server.
+ *
+ * Handles incoming socket connections from clients using the MobiCore driver.
+ *
+ * Iterative socket server using Netlink dgram protocol.
+ */
#ifndef NETLINKSERVER_H_
#define NETLINKSERVER_H_
@@ -158,4 +155,3 @@ private:
#endif /* SERVER_H_ */
-/** @} */
diff --git a/mobicore/daemon/Daemon/Server/public/Server.h b/mobicore/MobiCoreDriverLib/Daemon/Server/public/Server.h
index fb09f23..28b74cc 100644
--- a/mobicore/daemon/Daemon/Server/public/Server.h
+++ b/mobicore/MobiCoreDriverLib/Daemon/Server/public/Server.h
@@ -1,14 +1,4 @@
-/** @addtogroup MCD_MCDIMPL_DAEMON_SRV
- * @{
- * @file
- *
- * Connection server.
- *
- * Handles incoming socket connections from clients using the MobiCore driver.
- *
- * Iterative socket server using UNIX domain stream protocol.
- *
- *
+/*
* Copyright (c) 2013 TRUSTONIC LIMITED
* All rights reserved.
*
@@ -38,6 +28,13 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ * Connection server.
+ *
+ * Handles incoming socket connections from clients using the MobiCore driver.
+ *
+ * Iterative socket server using UNIX domain stream protocol.
+ */
#ifndef SERVER_H_
#define SERVER_H_
@@ -109,4 +106,3 @@ private:
#endif /* SERVER_H_ */
-/** @} */
diff --git a/mobicore/daemon/Daemon/public/MobiCoreDriverCmd.h b/mobicore/MobiCoreDriverLib/Daemon/public/MobiCoreDriverCmd.h
index 4ec72b5..5b02c80 100644
--- a/mobicore/daemon/Daemon/public/MobiCoreDriverCmd.h
+++ b/mobicore/MobiCoreDriverLib/Daemon/public/MobiCoreDriverCmd.h
@@ -1,8 +1,4 @@
-/** @addtogroup MCD_MCDIMPL_DAEMON
- * @{
- * @file
- *
- *
+/*
* Copyright (c) 2013 TRUSTONIC LIMITED
* All rights reserved.
*
@@ -289,4 +285,3 @@ typedef union {
#endif /* MCDAEMON_H_ */
-/** @} */
diff --git a/mobicore/daemon/Daemon/public/mcVersion.h b/mobicore/MobiCoreDriverLib/Daemon/public/mcVersion.h
index a6cd02d..07d40ac 100644
--- a/mobicore/daemon/Daemon/public/mcVersion.h
+++ b/mobicore/MobiCoreDriverLib/Daemon/public/mcVersion.h
@@ -1,5 +1,4 @@
-/**
- *
+/*
* Copyright (c) 2013 TRUSTONIC LIMITED
* All rights reserved.
*
diff --git a/mobicore/daemon/Kernel/Android.mk b/mobicore/MobiCoreDriverLib/Kernel/Android.mk
index a01b410..a01b410 100644
--- a/mobicore/daemon/Kernel/Android.mk
+++ b/mobicore/MobiCoreDriverLib/Kernel/Android.mk
diff --git a/mobicore/daemon/Kernel/CKMod.cpp b/mobicore/MobiCoreDriverLib/Kernel/CKMod.cpp
index a2fe40f..442656e 100644
--- a/mobicore/daemon/Kernel/CKMod.cpp
+++ b/mobicore/MobiCoreDriverLib/Kernel/CKMod.cpp
@@ -1,10 +1,4 @@
-/** @addtogroup MCD_MCDIMPL_DAEMON_KERNEL
- * @{
- * @file
- *
- * Kernel Module Interface.
- *
- *
+/*
* Copyright (c) 2013 TRUSTONIC LIMITED
* All rights reserved.
*
@@ -34,7 +28,11 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ * Kernel Module Interface.
+ */
#include <cstdlib>
+#include <string.h>
#include <fcntl.h>
#include <sys/mman.h>
@@ -105,4 +103,3 @@ void CKMod::close(
}
}
-/** @} */
diff --git a/mobicore/daemon/Kernel/CKMod.h b/mobicore/MobiCoreDriverLib/Kernel/CKMod.h
index d0022e2..5f0ef97 100644
--- a/mobicore/daemon/Kernel/CKMod.h
+++ b/mobicore/MobiCoreDriverLib/Kernel/CKMod.h
@@ -1,10 +1,4 @@
-/** @addtogroup MCD_MCDIMPL_DAEMON_KERNEL
- * @{
- * @file
- *
- * Kernel Module Interface.
- *
- *
+/*
* Copyright (c) 2013 TRUSTONIC LIMITED
* All rights reserved.
*
@@ -34,6 +28,9 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ * Kernel Module Interface.
+ */
#ifndef CKMOD_H_
#define CKMOD_H_
diff --git a/mobicore/daemon/Kernel/Platforms/Generic/Android.mk b/mobicore/MobiCoreDriverLib/Kernel/Platforms/Generic/Android.mk
index 8b4b8b4..8b4b8b4 100644
--- a/mobicore/daemon/Kernel/Platforms/Generic/Android.mk
+++ b/mobicore/MobiCoreDriverLib/Kernel/Platforms/Generic/Android.mk
diff --git a/mobicore/daemon/Kernel/Platforms/Generic/CMcKMod.cpp b/mobicore/MobiCoreDriverLib/Kernel/Platforms/Generic/CMcKMod.cpp
index 9bee65f..0e57874 100644
--- a/mobicore/daemon/Kernel/Platforms/Generic/CMcKMod.cpp
+++ b/mobicore/MobiCoreDriverLib/Kernel/Platforms/Generic/CMcKMod.cpp
@@ -1,11 +1,5 @@
-/** @addtogroup MCD_MCDIMPL_DAEMON_KERNEL
- * @{
- * @file
- *
- * <t-base Driver Kernel Module Interface.
- */
/*
- * 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
@@ -34,6 +28,9 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ * <t-base Driver Kernel Module Interface.
+ */
#include <cstdlib>
#include <sys/mman.h>
@@ -57,8 +54,7 @@ MC_CHECK_VERSION(MCDRVMODULEAPI, 1, 1);
mcResult_t CMcKMod::mapWsm(
uint32_t len,
uint32_t *pHandle,
- addr_t *pVirtAddr,
- uint64_t *pPhysAddr)
+ addr_t *pVirtAddr)
{
int ret = 0;
LOG_V(" mapWsm(): len=%d", len);
@@ -81,12 +77,13 @@ mcResult_t CMcKMod::mapWsm(
fdKMod, mapParams.phys_addr);
if (virtAddr == MAP_FAILED) {
LOG_ERRNO("mmap");
+ (void)ioctl(fdKMod, MC_IO_FREE, mapParams.handle);
return MAKE_MC_DRV_KMOD_WITH_ERRNO(errno);
}
- LOG_V(" mapped to %p, handle=%d, phys=0x%llX ", virtAddr,
- mapParams.handle, mapParams.phys_addr);
+ LOG_V(" mapped to %p, handle=%d", virtAddr,
+ mapParams.handle);
if (pVirtAddr != NULL) {
*pVirtAddr = virtAddr;
@@ -96,19 +93,13 @@ mcResult_t CMcKMod::mapWsm(
*pHandle = mapParams.handle;
}
- if (pPhysAddr != NULL) {
- *pPhysAddr = mapParams.phys_addr;
- }
-
return 0;
}
//------------------------------------------------------------------------------
mcResult_t CMcKMod::mapMCI(
uint32_t len,
- uint32_t *pHandle,
addr_t *pVirtAddr,
- uint64_t *pPhysAddr,
bool *pReuse)
{
LOG_I("Mapping MCI: len=%d", len);
@@ -126,51 +117,28 @@ mcResult_t CMcKMod::mapMCI(
return MAKE_MC_DRV_KMOD_WITH_ERRNO(errno);
}
+ // MCI is defined as offset 0, so we do not pass the mapParams.phys_addr to mmap.
addr_t virtAddr = ::mmap(0, len, PROT_READ | PROT_WRITE, MAP_SHARED,
fdKMod, 0);
if (virtAddr == MAP_FAILED) {
LOG_ERRNO("mmap");
return MAKE_MC_DRV_KMOD_WITH_ERRNO(errno);
}
- mapParams.addr = (unsigned long)virtAddr;
+
*pReuse = mapParams.reused;
- LOG_V(" MCI mapped to %p, handle=%d, phys=0x%llx, reused=%s",
- (void *)mapParams.addr, mapParams.handle, mapParams.phys_addr,
- mapParams.reused ? "true" : "false");
+ LOG_V(" MCI mapped to %p, handle=%d, reused=%s",
+ (void *)virtAddr, mapParams.handle,
+ mapParams.reused ? "true" : "false");
if (pVirtAddr != NULL) {
- *pVirtAddr = (void *)mapParams.addr;
- }
-
- if (pHandle != NULL) {
- *pHandle = mapParams.handle;
- }
-
- if (pPhysAddr != NULL) {
- *pPhysAddr = mapParams.phys_addr;
+ *pVirtAddr = (void *)virtAddr;
}
- // clean memory
- //memset(pMmapResp, 0, sizeof(*pMmapResp));
-
return MC_DRV_OK;
}
//------------------------------------------------------------------------------
-mcResult_t CMcKMod::mapPersistent(
- uint32_t len,
- uint32_t *pHandle,
- addr_t *pVirtAddr,
- addr_t *pPhysAddr)
-{
- // Not currently supported by the driver
- LOG_E("<t-base Driver doesn't support persistent buffers");
- return MC_DRV_ERR_NOT_IMPLEMENTED;
-}
-
-
-//------------------------------------------------------------------------------
int CMcKMod::read(addr_t buffer, uint32_t len)
{
int ret = 0;
@@ -281,6 +249,7 @@ int CMcKMod::fcYield(void)
//------------------------------------------------------------------------------
+
int CMcKMod::fcNSIQ(void)
{
int ret = 0;
@@ -313,7 +282,7 @@ mcResult_t CMcKMod::free(uint32_t handle, addr_t buffer, uint32_t len)
// Even if unmap fails we still go on with our request
if (::munmap(buffer, len)) {
LOG_I("buffer = %p, len = %d", buffer, len);
- LOG_ERRNO("mmap failed");
+ LOG_ERRNO("munmap failed");
}
int ret = ioctl(fdKMod, MC_IO_FREE, handle);
@@ -343,7 +312,7 @@ mcResult_t CMcKMod::registerWsmL2(
struct mc_ioctl_reg_wsm params = {
buffer :
- (uint32_t) buffer,
+ (uintptr_t) buffer,
len :
len,
pid :
@@ -557,4 +526,3 @@ bool CMcKMod::checkVersion(void)
return true;
}
-/** @} */
diff --git a/mobicore/daemon/Kernel/Platforms/Generic/CMcKMod.h b/mobicore/MobiCoreDriverLib/Kernel/Platforms/Generic/CMcKMod.h
index a326468..366fbbd 100644
--- a/mobicore/daemon/Kernel/Platforms/Generic/CMcKMod.h
+++ b/mobicore/MobiCoreDriverLib/Kernel/Platforms/Generic/CMcKMod.h
@@ -1,10 +1,4 @@
-/** @addtogroup MCD_MCDIMPL_DAEMON_KERNEL
- * @{
- * @file
- *
- * <t-base Driver Kernel Module Interface.
- *
- *
+/*
* Copyright (c) 2013 TRUSTONIC LIMITED
* All rights reserved.
*
@@ -34,6 +28,9 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ * <t-base Driver Kernel Module Interface.
+ */
#ifndef CMCKMOD_H_
#define CMCKMOD_H_
@@ -55,7 +52,6 @@ public:
* @param len
* @param pHandle
* @param pVirtAddr
- * @param pPhysAddr
*
* @return 0 if all went fine
* @return MC_DRV_ERR_KMOD_NOT_OPEN
@@ -63,15 +59,12 @@ public:
*/
mcResult_t mapWsm(uint32_t len,
uint32_t *pHandle,
- addr_t *pVirtAddr,
- uint64_t *pPhysAddr);
+ addr_t *pVirtAddr);
/**
* Map data.
*
* @param len
- * @param pHandle
* @param pVirtAddr
- * @param pPhysAddr
* @param pMciReuse [in|out] set to true [in] for reusing MCI buffer
* is set to true [out] if MCI buffer has been reused
* @return 0 if all went fine
@@ -80,20 +73,9 @@ public:
*/
mcResult_t mapMCI(
uint32_t len,
- uint32_t *pHandle,
addr_t *pVirtAddr,
- uint64_t *pPhysAddr,
bool *pReuse);
- /**
- * Map persistent WSM which will not be freed up once the calling process dies.
- */
- mcResult_t mapPersistent(
- uint32_t len,
- uint32_t *pHandle,
- addr_t *pVirtAddr,
- addr_t *pPhysAddr);
-
int read(addr_t buffer, uint32_t len);
bool waitSSIQ(uint32_t *pCnt);
diff --git a/mobicore/MobiCoreDriverLib/NOTICE b/mobicore/MobiCoreDriverLib/NOTICE
new file mode 100644
index 0000000..627167a
--- /dev/null
+++ b/mobicore/MobiCoreDriverLib/NOTICE
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
diff --git a/mobicore/daemon/Registry/Android.mk b/mobicore/MobiCoreDriverLib/Registry/Android.mk
index d83160c..d83160c 100644
--- a/mobicore/daemon/Registry/Android.mk
+++ b/mobicore/MobiCoreDriverLib/Registry/Android.mk
diff --git a/mobicore/daemon/Registry/PrivateRegistry.cpp b/mobicore/MobiCoreDriverLib/Registry/PrivateRegistry.cpp
index 6d69ff9..f51571b 100644
--- a/mobicore/daemon/Registry/PrivateRegistry.cpp
+++ b/mobicore/MobiCoreDriverLib/Registry/PrivateRegistry.cpp
@@ -1,13 +1,5 @@
-/** Mobicore Driver Registry.
- *
- * Implements the MobiCore driver registry which maintains trustlets.
- *
- * @file
- * @ingroup MCD_MCDIMPL_DAEMON_REG
- */
-
/*
- * 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
@@ -36,7 +28,13 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-
+/** Mobicore Driver Registry.
+ *
+ * Implements the MobiCore driver registry which maintains trustlets.
+ *
+ * @file
+ * @ingroup MCD_MCDIMPL_DAEMON_REG
+ */
#include <stdlib.h>
#include <dirent.h>
#include <stdio.h>
@@ -67,13 +65,13 @@
/** Maximum size of a shared object container in bytes. */
#define MAX_SO_CONT_SIZE (512)
-// Asserts expression at compile-time (to be used within a function body).
-#define ASSERT_STATIC(e) do { enum { assert_static__ = 1 / (e) }; } while (0)
+#define MC_REGISTRY_ALL 0
+#define MC_REGISTRY_WRITABLE 1
-#define MC_REGISTRY_CONTAINER_PATH "/data/app/mcRegistry"
-#define MC_REGISTRY_DEFAULT_PATH "/system/app/mcRegistry"
-#define MC_REGISTRY_FALLBACK_PATH "/data/app/mcRegistry"
+#define MC_REGISTRY_SYSTEM_PATH "/system/app/mcRegistry"
+#define MC_REGISTRY_DATA_PATH "/data/app/mcRegistry"
#define AUTH_TOKEN_FILE_NAME "00000000.authtokcont"
+#define AUTH_TOKEN_FILE_NAME_BACKUP_SUFFIX ".backup"
#define ENV_MC_AUTH_TOKEN_PATH "MC_AUTH_TOKEN_PATH"
#define ROOT_FILE_NAME "00000000.rootcont"
#define SP_CONT_FILE_EXT ".spcont"
@@ -116,43 +114,9 @@ static bool doesDirExist(const char *path)
}
//------------------------------------------------------------------------------
-string getRegistryPath()
+string getTbStoragePath()
{
- string registryPath;
-
- // use the default registry path.
- registryPath = MC_REGISTRY_CONTAINER_PATH;
- LOG_I(" Using default registry path %s", registryPath.c_str());
-
- assert(registryPath.length() != 0);
-
- return registryPath;
-}
-
-//------------------------------------------------------------------------------
-string getTlRegistryPath()
-{
- string registryPath;
-
- // First, attempt to use regular registry environment variable.
- if (doesDirExist(MC_REGISTRY_DEFAULT_PATH)) {
- registryPath = MC_REGISTRY_DEFAULT_PATH;
- LOG_I(" Using MC_REGISTRY_PATH %s", registryPath.c_str());
- } else if (doesDirExist(MC_REGISTRY_FALLBACK_PATH)) {
- // Second, attempt to use fallback registry environment variable.
- registryPath = MC_REGISTRY_FALLBACK_PATH;
- LOG_I(" Using MC_REGISTRY_FALLBACK_PATH %s", registryPath.c_str());
- }
-
- // As a last resort, use the default registry path.
- if (registryPath.length() == 0) {
- registryPath = MC_REGISTRY_CONTAINER_PATH;
- LOG_I(" Using default registry path %s", registryPath.c_str());
- }
-
- assert(registryPath.length() != 0);
-
- return registryPath;
+ return MC_REGISTRY_DATA_PATH "/TbStorage";
}
//------------------------------------------------------------------------------
@@ -167,7 +131,7 @@ static string getAuthTokenFilePath()
LOG_I("getAuthTokenFilePath(): Using MC_AUTH_TOKEN_PATH %s", path);
authTokenPath = path;
} else {
- authTokenPath = getRegistryPath();
+ authTokenPath = MC_REGISTRY_DATA_PATH;
LOG_I("getAuthTokenFilePath(): Using path %s", authTokenPath.c_str());
}
@@ -175,34 +139,40 @@ static string getAuthTokenFilePath()
}
//------------------------------------------------------------------------------
+static string getAuthTokenFilePathBackup()
+{
+ return getAuthTokenFilePath() + AUTH_TOKEN_FILE_NAME_BACKUP_SUFFIX;
+}
+
+//------------------------------------------------------------------------------
static string getRootContFilePath()
{
- return getRegistryPath() + "/" + ROOT_FILE_NAME;
+ return MC_REGISTRY_DATA_PATH "/" ROOT_FILE_NAME;
}
//------------------------------------------------------------------------------
static string getSpDataPath(mcSpid_t spid)
{
- return getRegistryPath() + "/" + uint32ToString(spid);
+ return MC_REGISTRY_DATA_PATH "/" + uint32ToString(spid);
}
//------------------------------------------------------------------------------
static string getSpContFilePath(mcSpid_t spid)
{
- return getRegistryPath() + "/" + uint32ToString(spid) + SP_CONT_FILE_EXT;
+ return MC_REGISTRY_DATA_PATH "/" + uint32ToString(spid) + SP_CONT_FILE_EXT;
}
//------------------------------------------------------------------------------
static string getTlContFilePath(const mcUuid_t *uuid, const mcSpid_t spid)
{
- return getRegistryPath() + "/" + byteArrayToString(uuid, sizeof(*uuid))
+ return MC_REGISTRY_DATA_PATH "/" + byteArrayToString(uuid, sizeof(*uuid))
+ "." + uint32ToString(spid) + TL_CONT_FILE_EXT;
}
//------------------------------------------------------------------------------
static string getTlDataPath(const mcUuid_t *uuid)
{
- return getRegistryPath() + "/" + byteArrayToString(uuid, sizeof(*uuid));
+ return MC_REGISTRY_DATA_PATH "/" + byteArrayToString(uuid, sizeof(*uuid));
}
//------------------------------------------------------------------------------
@@ -212,26 +182,54 @@ static string getTlDataFilePath(const mcUuid_t *uuid, mcPid_t pid)
}
//------------------------------------------------------------------------------
-static string getTlBinFilePath(const mcUuid_t *uuid)
+static string getTlBinFilePath(const mcUuid_t *uuid, int registry)
{
- return getTlRegistryPath() + "/" + byteArrayToString(uuid, sizeof(*uuid)) + TL_BIN_FILE_EXT;
+ string path_ro_registry = MC_REGISTRY_SYSTEM_PATH"/" + byteArrayToString(uuid, sizeof(*uuid)) + TL_BIN_FILE_EXT;
+ string path_rw_registry = MC_REGISTRY_DATA_PATH"/" + byteArrayToString(uuid, sizeof(*uuid)) + TL_BIN_FILE_EXT;
+
+ if (registry == MC_REGISTRY_ALL) {
+ struct stat tmp;
+ if (stat(path_ro_registry.c_str(), &tmp) == 0) {
+ return path_ro_registry;
+ }
+ }
+ return path_rw_registry;
}
//------------------------------------------------------------------------------
-static string getTABinFilePath(const mcUuid_t *uuid)
+static string getTABinFilePath(const mcUuid_t *uuid, int registry)
{
- return getTlRegistryPath() + "/" + byteArrayToString(uuid, sizeof(*uuid)) + GP_TA_BIN_FILE_EXT;
+ string path_ro_registry = MC_REGISTRY_SYSTEM_PATH"/" + byteArrayToString(uuid, sizeof(*uuid)) + GP_TA_BIN_FILE_EXT;
+ string path_rw_registry = MC_REGISTRY_DATA_PATH"/" + byteArrayToString(uuid, sizeof(*uuid)) + GP_TA_BIN_FILE_EXT;
+
+ if (registry == MC_REGISTRY_ALL) {
+ struct stat tmp;
+ if (stat(path_ro_registry.c_str(), &tmp) == 0) {
+ return path_ro_registry;
+ }
+ }
+ return path_rw_registry;
}
//------------------------------------------------------------------------------
-static string getTASpidFilePath(const mcUuid_t *uuid)
+static string getTASpidFilePath(const mcUuid_t *uuid, int registry)
{
- return getTlRegistryPath() + "/" + byteArrayToString(uuid, sizeof(*uuid)) + GP_TA_SPID_FILE_EXT;
+ string path_ro_registry = MC_REGISTRY_SYSTEM_PATH"/" + byteArrayToString(uuid, sizeof(*uuid)) + GP_TA_SPID_FILE_EXT;
+ string path_rw_registry = MC_REGISTRY_DATA_PATH"/" + byteArrayToString(uuid, sizeof(*uuid)) + GP_TA_SPID_FILE_EXT;
+
+ if (registry == MC_REGISTRY_ALL) {
+ struct stat tmp;
+ if (stat(path_ro_registry.c_str(), &tmp) == 0) {
+ return path_ro_registry;
+ }
+ }
+ return path_rw_registry;
}
//------------------------------------------------------------------------------
mcResult_t mcRegistryStoreAuthToken(void *so, uint32_t size)
{
+ int res = 0;
if (so == NULL || size > 3 * MAX_SO_CONT_SIZE) {
LOG_E("mcRegistry store So.Soc failed: %d", MC_DRV_ERR_INVALID_PARAMETER);
return MC_DRV_ERR_INVALID_PARAMETER;
@@ -240,12 +238,22 @@ mcResult_t mcRegistryStoreAuthToken(void *so, uint32_t size)
LOG_I("store AuthToken: %s", authTokenFilePath.c_str());
FILE *fs = fopen(authTokenFilePath.c_str(), "wb");
- if (!fs) {
+ if (fs==NULL) {
LOG_E("mcRegistry store So.Soc failed: %d", MC_DRV_ERR_INVALID_DEVICE_FILE);
return MC_DRV_ERR_INVALID_DEVICE_FILE;
}
- fseek(fs, 0, SEEK_SET);
+ res = fseek(fs, 0, SEEK_SET);
+ if (res!=0) {
+ LOG_E("mcRegistry store So.Soc failed: %d", MC_DRV_ERR_INVALID_PARAMETER);
+ fclose(fs);
+ return MC_DRV_ERR_INVALID_PARAMETER;
+ }
fwrite((char *)so, 1, size, fs);
+ if (ferror(fs)) {
+ LOG_E("mcRegistry store So.Soc failed %d", MC_DRV_ERR_OUT_OF_RESOURCES);
+ fclose(fs);
+ return MC_DRV_ERR_OUT_OF_RESOURCES;
+ }
fflush(fs);
fclose(fs);
@@ -256,6 +264,7 @@ mcResult_t mcRegistryStoreAuthToken(void *so, uint32_t size)
//------------------------------------------------------------------------------
mcResult_t mcRegistryReadAuthToken(mcSoAuthTokenCont_t *so)
{
+ int res = 0;
if (NULL == so) {
LOG_E("mcRegistry read So.Soc failed: %d", MC_DRV_ERR_INVALID_PARAMETER);
return MC_DRV_ERR_INVALID_PARAMETER;
@@ -264,23 +273,99 @@ mcResult_t mcRegistryReadAuthToken(mcSoAuthTokenCont_t *so)
LOG_I("read AuthToken: %s", authTokenFilePath.c_str());
FILE *fs = fopen(authTokenFilePath.c_str(), "rb");
- if (!fs) {
+ if (fs==NULL) {
LOG_W("mcRegistry read So.Soc failed: %d", MC_DRV_ERR_INVALID_DEVICE_FILE);
return MC_DRV_ERR_INVALID_DEVICE_FILE;
}
- fseek(fs, 0, SEEK_END);
+ res = fseek(fs, 0, SEEK_END);
+ if (res!=0) {
+ LOG_E("mcRegistry read So.Soc failed: %d", MC_DRV_ERR_INVALID_PARAMETER);
+ fclose(fs);
+ return MC_DRV_ERR_INVALID_PARAMETER;
+ }
int32_t filesize = ftell(fs);
+ // We ensure that mcSoAuthTokenCont_t matches with filesize, as ferror (during fread operation) can't
+ // handle the case where mcSoAuthTokenCont_t < filesize
if (sizeof(mcSoAuthTokenCont_t) != filesize) {
fclose(fs);
LOG_W("mcRegistry read So.Soc failed: %d", MC_DRV_ERR_OUT_OF_RESOURCES);
return MC_DRV_ERR_OUT_OF_RESOURCES;
}
- fseek(fs, 0, SEEK_SET);
- if (fread((char *)so, 1, sizeof(mcSoAuthTokenCont_t), fs) !=
- sizeof(mcSoAuthTokenCont_t))
- {
+ res = fseek(fs, 0, SEEK_SET);
+ if (res!=0) {
+ LOG_E("mcRegistry read So.Soc failed: %d", MC_DRV_ERR_INVALID_PARAMETER);
+ fclose(fs);
+ return MC_DRV_ERR_INVALID_PARAMETER;
+ }
+ res = fread((char *)so, 1, sizeof(mcSoAuthTokenCont_t), fs);
+ if (ferror(fs)) {
+ fclose(fs);
+ LOG_E("mcRegistry read So.Soc failed: %d", MC_DRV_ERR_INVALID_PARAMETER);
+ return MC_DRV_ERR_INVALID_PARAMETER;
+ }
+ if ((unsigned)res<sizeof(mcSoAuthTokenCont_t)) {
+ //File is shorter than expected
+ if (feof(fs)) {
+ LOG_E("%s(): EOF reached: res is %u, size of mcSoAuthTokenCont_t is %u", __func__, (unsigned)res,
+ sizeof(mcSoAuthTokenCont_t));
+ }
+ fclose(fs);
+ return MC_DRV_ERR_INVALID_PARAMETER;
+ }
+ fclose(fs);
+
+ return MC_DRV_OK;
+}
+
+//------------------------------------------------------------------------------
+mcResult_t mcRegistryReadAuthTokenBackup(mcSoAuthTokenCont_t *so)
+{
+ int res = 0;
+ if (NULL == so) {
+ LOG_E("mcRegistry read So.Soc failed: %d", MC_DRV_ERR_INVALID_PARAMETER);
+ return MC_DRV_ERR_INVALID_PARAMETER;
+ }
+ const string &authTokenFilePath = getAuthTokenFilePathBackup();
+ LOG_I("read AuthToken: %s", authTokenFilePath.c_str());
+
+ FILE *fs = fopen(authTokenFilePath.c_str(), "rb");
+ if (fs==NULL) {
+ LOG_W("mcRegistry read So.Soc failed: %d", MC_DRV_ERR_INVALID_DEVICE_FILE);
+ return MC_DRV_ERR_INVALID_DEVICE_FILE;
+ }
+ res = fseek(fs, 0, SEEK_END);
+ if (res!=0) {
+ LOG_E("mcRegistry read So.Soc failed: %d", MC_DRV_ERR_INVALID_PARAMETER);
+ fclose(fs);
+ return MC_DRV_ERR_INVALID_PARAMETER;
+ }
+ int32_t filesize = ftell(fs);
+ // We ensure that mcSoAuthTokenCont_t matches with filesize, as ferror (during fread operation) can't
+ // handle the case where mcSoAuthTokenCont_t < filesize
+ if (sizeof(mcSoAuthTokenCont_t) != filesize) {
+ fclose(fs);
+ LOG_W("mcRegistry read So.Soc failed: %d", MC_DRV_ERR_OUT_OF_RESOURCES);
+ return MC_DRV_ERR_OUT_OF_RESOURCES;
+ }
+ res = fseek(fs, 0, SEEK_SET);
+ if (res!=0) {
+ LOG_E("mcRegistry read So.Soc failed: %d", MC_DRV_ERR_INVALID_PARAMETER);
+ fclose(fs);
+ return MC_DRV_ERR_INVALID_PARAMETER;
+ }
+ res = fread((char *)so, 1, sizeof(mcSoAuthTokenCont_t), fs);
+ if (ferror(fs)) {
+ fclose(fs);
+ LOG_E("mcRegistry read So.Soc failed: %d", MC_DRV_ERR_INVALID_PARAMETER);
+ return MC_DRV_ERR_INVALID_PARAMETER;
+ }
+ if ((unsigned)res<sizeof(mcSoAuthTokenCont_t)) {
+ //File is shorter than expected
+ if (feof(fs)) {
+ LOG_E("%s(): EOF reached: res is %u, size of mcSoAuthTokenCont_t is %u", __func__,
+ (unsigned)res, sizeof(mcSoAuthTokenCont_t));
+ }
fclose(fs);
- LOG_W("mcRegistry read So.Soc failed: %d", MC_DRV_ERR_INVALID_PARAMETER);
return MC_DRV_ERR_INVALID_PARAMETER;
}
fclose(fs);
@@ -291,8 +376,8 @@ mcResult_t mcRegistryReadAuthToken(mcSoAuthTokenCont_t *so)
//------------------------------------------------------------------------------
mcResult_t mcRegistryDeleteAuthToken(void)
{
- if (remove(getAuthTokenFilePath().c_str())) {
- LOG_ERRNO("Delete Auth token file!");
+ if (rename(getAuthTokenFilePath().c_str(), getAuthTokenFilePathBackup().c_str())) {
+ LOG_ERRNO("Rename Auth token file!");
return MC_DRV_ERR_UNKNOWN;
} else
return MC_DRV_OK;
@@ -302,6 +387,7 @@ mcResult_t mcRegistryDeleteAuthToken(void)
//------------------------------------------------------------------------------
mcResult_t mcRegistryStoreRoot(void *so, uint32_t size)
{
+ int res = 0;
if (so == NULL || size > 3 * MAX_SO_CONT_SIZE) {
LOG_E("mcRegistry store So.Root failed: %d", MC_DRV_ERR_INVALID_PARAMETER);
return MC_DRV_ERR_INVALID_PARAMETER;
@@ -311,12 +397,22 @@ mcResult_t mcRegistryStoreRoot(void *so, uint32_t size)
LOG_I("store Root: %s", rootContFilePath.c_str());
FILE *fs = fopen(rootContFilePath.c_str(), "wb");
- if (!fs) {
+ if (fs==NULL) {
LOG_E("mcRegistry store So.Root failed: %d", MC_DRV_ERR_INVALID_DEVICE_FILE);
return MC_DRV_ERR_INVALID_DEVICE_FILE;
}
- fseek(fs, 0, SEEK_SET);
+ res = fseek(fs, 0, SEEK_SET);
+ if (res!=0) {
+ LOG_E("mcRegistry store So.Root failed: %d", MC_DRV_ERR_INVALID_PARAMETER);
+ fclose(fs);
+ return MC_DRV_ERR_INVALID_PARAMETER;
+ }
fwrite((char *)so, 1, size, fs);
+ if (ferror(fs)) {
+ LOG_E("mcRegistry store So.Root failed: %d", MC_DRV_ERR_OUT_OF_RESOURCES);
+ fclose(fs);
+ return MC_DRV_ERR_OUT_OF_RESOURCES;
+ }
fflush(fs);
fclose(fs);
@@ -337,11 +433,16 @@ mcResult_t mcRegistryReadRoot(void *so, uint32_t *size)
LOG_I(" Opening %s", rootContFilePath.c_str());
FILE *fs = fopen(rootContFilePath.c_str(), "rb");
- if (!fs) {
+ if (fs==NULL) {
LOG_W("mcRegistry read So.Root failed: %d", MC_DRV_ERR_INVALID_DEVICE_FILE);
return MC_DRV_ERR_INVALID_DEVICE_FILE;
}
readBytes = fread((char *)so, 1, *size, fs);
+ if (ferror(fs)) {
+ fclose(fs);
+ LOG_E("mcRegistry read So.Root failed: %d", MC_DRV_ERR_INVALID_PARAMETER);
+ return MC_DRV_ERR_INVALID_PARAMETER;
+ }
fclose(fs);
if (readBytes > 0) {
@@ -357,6 +458,7 @@ mcResult_t mcRegistryReadRoot(void *so, uint32_t *size)
//------------------------------------------------------------------------------
mcResult_t mcRegistryStoreSp(mcSpid_t spid, void *so, uint32_t size)
{
+ int res = 0;
if ((spid == 0) || (so == NULL) || size > 3 * MAX_SO_CONT_SIZE) {
LOG_E("mcRegistry store So.Sp(SpId) failed: %d", MC_DRV_ERR_INVALID_PARAMETER);
return MC_DRV_ERR_INVALID_PARAMETER;
@@ -366,12 +468,22 @@ mcResult_t mcRegistryStoreSp(mcSpid_t spid, void *so, uint32_t size)
LOG_I("store SP: %s", spContFilePath.c_str());
FILE *fs = fopen(spContFilePath.c_str(), "wb");
- if (!fs) {
+ if (fs==NULL) {
LOG_E("mcRegistry store So.Sp(SpId) failed: %d", MC_DRV_ERR_INVALID_DEVICE_FILE);
return MC_DRV_ERR_INVALID_DEVICE_FILE;
}
- fseek(fs, 0, SEEK_SET);
+ res = fseek(fs, 0, SEEK_SET);
+ if (res!=0) {
+ LOG_E("mcRegistry store So.Sp(SpId) failed: %d", MC_DRV_ERR_INVALID_PARAMETER);
+ fclose(fs);
+ return MC_DRV_ERR_INVALID_PARAMETER;
+ }
fwrite((char *)so, 1, size, fs);
+ if (ferror(fs)) {
+ LOG_E("mcRegistry store So.Sp(SpId) failed: %d", MC_DRV_ERR_OUT_OF_RESOURCES);
+ fclose(fs);
+ return MC_DRV_ERR_OUT_OF_RESOURCES;
+ }
fflush(fs);
fclose(fs);
@@ -391,11 +503,16 @@ mcResult_t mcRegistryReadSp(mcSpid_t spid, void *so, uint32_t *size)
LOG_I(" Reading %s", spContFilePath.c_str());
FILE *fs = fopen(spContFilePath.c_str(), "rb");
- if (!fs) {
+ if (fs==NULL) {
LOG_E("mcRegistry read So.Sp(SpId) failed: %d", MC_DRV_ERR_INVALID_DEVICE_FILE);
return MC_DRV_ERR_INVALID_DEVICE_FILE;
}
readBytes = fread((char *)so, 1, *size, fs);
+ if (ferror(fs)) {
+ fclose(fs);
+ LOG_E("mcRegistry read So.Sp(SpId) failed: %d", MC_DRV_ERR_INVALID_PARAMETER);
+ return MC_DRV_ERR_INVALID_PARAMETER;
+ }
fclose(fs);
if (readBytes > 0) {
@@ -411,6 +528,7 @@ mcResult_t mcRegistryReadSp(mcSpid_t spid, void *so, uint32_t *size)
//------------------------------------------------------------------------------
mcResult_t mcRegistryStoreTrustletCon(const mcUuid_t *uuid, const mcSpid_t spid, void *so, uint32_t size)
{
+ int res = 0;
if ((uuid == NULL) || (so == NULL) || size > 3 * MAX_SO_CONT_SIZE) {
LOG_E("mcRegistry store So.TrustletCont(uuid) failed: %d", MC_DRV_ERR_INVALID_PARAMETER);
return MC_DRV_ERR_INVALID_PARAMETER;
@@ -420,12 +538,22 @@ mcResult_t mcRegistryStoreTrustletCon(const mcUuid_t *uuid, const mcSpid_t spid,
LOG_I("store TLc: %s", tlContFilePath.c_str());
FILE *fs = fopen(tlContFilePath.c_str(), "wb");
- if (!fs) {
+ if (fs==NULL) {
LOG_E("mcRegistry store So.TrustletCont(uuid) failed: %d", MC_DRV_ERR_INVALID_DEVICE_FILE);
return MC_DRV_ERR_INVALID_DEVICE_FILE;
}
- fseek(fs, 0, SEEK_SET);
+ res = fseek(fs, 0, SEEK_SET);
+ if (res!=0) {
+ LOG_E("mcRegistry store So.TrustletCont(uuid) failed: %d", MC_DRV_ERR_INVALID_PARAMETER);
+ fclose(fs);
+ return MC_DRV_ERR_INVALID_PARAMETER;
+ }
fwrite((char *)so, 1, size, fs);
+ if (ferror(fs)) {
+ LOG_E("mcRegistry store So.TrustletCont(uuid) failed: %d", MC_DRV_ERR_OUT_OF_RESOURCES);
+ fclose(fs);
+ return MC_DRV_ERR_OUT_OF_RESOURCES;
+ }
fflush(fs);
fclose(fs);
@@ -443,7 +571,7 @@ static uint32_t getAsUint32BE(
mcResult_t mcRegistryStoreTABlob(mcSpid_t spid, void *blob, uint32_t size)
{
-
+ int res = 0;
LOG_I("mcRegistryStoreTABlob started");
// Check blob size
@@ -517,33 +645,53 @@ mcResult_t mcRegistryStoreTABlob(mcSpid_t spid, void *blob, uint32_t size)
return MC_DRV_ERR_INVALID_PARAMETER;
}
}
- const string tlBinFilePath = getTABinFilePath((mcUuid_t *)&uuid);
+ const string taBinFilePath = getTABinFilePath((mcUuid_t *)&uuid, MC_REGISTRY_WRITABLE);
- LOG_I("Store TA blob at: %s", tlBinFilePath.c_str());
+ LOG_I("Store TA blob at: %s", taBinFilePath.c_str());
- FILE *fs = fopen(tlBinFilePath.c_str(), "wb");
- if (!fs) {
+ FILE *fs = fopen(taBinFilePath.c_str(), "wb");
+ if (fs==NULL) {
LOG_E("RegistryStoreTABlob failed - TA blob file open error: %d", MC_DRV_ERR_INVALID_DEVICE_FILE);
return MC_DRV_ERR_INVALID_DEVICE_FILE;
}
- fseek(fs, 0, SEEK_SET);
+ res = fseek(fs, 0, SEEK_SET);
+ if (res!=0) {
+ LOG_E("RegistryStoreTABlob failed: %d", MC_DRV_ERR_INVALID_PARAMETER);
+ fclose(fs);
+ return MC_DRV_ERR_INVALID_PARAMETER;
+ }
fwrite(blob, 1, size, fs);
+ if (ferror(fs)) {
+ LOG_E("RegistryStoreTABlob failed: %d", MC_DRV_ERR_OUT_OF_RESOURCES);
+ fclose(fs);
+ return MC_DRV_ERR_OUT_OF_RESOURCES;
+ }
fflush(fs);
fclose(fs);
if (header20->serviceType == SERVICE_TYPE_SP_TRUSTLET) {
- const string taspidFilePath = getTASpidFilePath((mcUuid_t *)&uuid);
+ const string taspidFilePath = getTASpidFilePath((mcUuid_t *)&uuid, MC_REGISTRY_WRITABLE);
LOG_I("Store spid file at: %s", taspidFilePath.c_str());
FILE *fs = fopen(taspidFilePath.c_str(), "wb");
- if (!fs) {
+ if (fs==NULL) {
//TODO: shouldn't we delete TA blob file ?
LOG_E("RegistryStoreTABlob failed - TA blob file open error: %d", MC_DRV_ERR_INVALID_DEVICE_FILE);
return MC_DRV_ERR_INVALID_DEVICE_FILE;
}
- fseek(fs, 0, SEEK_SET);
+ res = fseek(fs, 0, SEEK_SET);
+ if (res!=0) {
+ LOG_E("RegistryStoreTABlob failed: %d", MC_DRV_ERR_INVALID_PARAMETER);
+ fclose(fs);
+ return MC_DRV_ERR_INVALID_PARAMETER;
+ }
fwrite(&spid, 1, sizeof(mcSpid_t), fs);
+ if (ferror(fs)) {
+ LOG_E("RegistryStoreTABlob failed: %d", MC_DRV_ERR_OUT_OF_RESOURCES);
+ fclose(fs);
+ return MC_DRV_ERR_OUT_OF_RESOURCES;
+ }
fflush(fs);
fclose(fs);
}
@@ -553,6 +701,7 @@ mcResult_t mcRegistryStoreTABlob(mcSpid_t spid, void *blob, uint32_t size)
//------------------------------------------------------------------------------
mcResult_t mcRegistryReadTrustletCon(const mcUuid_t *uuid, const mcSpid_t spid, void *so, uint32_t *size)
{
+ int res = 0;
if ((uuid == NULL) || (so == NULL)) {
LOG_E("mcRegistry read So.TrustletCont(uuid) failed: %d", MC_DRV_ERR_INVALID_PARAMETER);
return MC_DRV_ERR_INVALID_PARAMETER;
@@ -562,12 +711,22 @@ mcResult_t mcRegistryReadTrustletCon(const mcUuid_t *uuid, const mcSpid_t spid,
LOG_I("read TLc: %s", tlContFilePath.c_str());
FILE *fs = fopen(tlContFilePath.c_str(), "rb");
- if (!fs) {
+ if (fs==NULL) {
LOG_E("mcRegistry read So.TrustletCont(uuid) failed: %d", MC_DRV_ERR_INVALID_DEVICE_FILE);
return MC_DRV_ERR_INVALID_DEVICE_FILE;
}
- fseek(fs, 0, SEEK_SET);
+ res = fseek(fs, 0, SEEK_SET);
+ if (res!=0) {
+ LOG_E("mcRegistry read So.TrustletCont(uuid) failed: %d", MC_DRV_ERR_INVALID_PARAMETER);
+ fclose(fs);
+ return MC_DRV_ERR_INVALID_PARAMETER;
+ }
readBytes = fread((char *)so, 1, *size, fs);
+ if (ferror(fs)) {
+ fclose(fs);
+ LOG_E("mcRegistry read So.TrustletCont(uuid) failed: %d", MC_DRV_ERR_INVALID_PARAMETER);
+ return MC_DRV_ERR_INVALID_PARAMETER;
+ }
fclose(fs);
if (readBytes > 0) {
@@ -584,6 +743,7 @@ mcResult_t mcRegistryReadTrustletCon(const mcUuid_t *uuid, const mcSpid_t spid,
mcResult_t mcRegistryStoreData(void *so, uint32_t size)
{
mcSoDataCont_t *dataCont = (mcSoDataCont_t *)so;
+ int res = 0;
if (dataCont == NULL || size != sizeof(mcSoDataCont_t)) {
LOG_E("mcRegistry store So.Data failed: %d", MC_DRV_ERR_INVALID_PARAMETER);
@@ -613,12 +773,22 @@ mcResult_t mcRegistryStoreData(void *so, uint32_t size)
LOG_I("store DT: %s", filename.c_str());
FILE *fs = fopen(filename.c_str(), "wb");
- if (!fs) {
+ if (fs==NULL) {
LOG_E("mcRegistry store So.Data(cid/pid) failed: %d", MC_DRV_ERR_INVALID_DEVICE_FILE);
return MC_DRV_ERR_INVALID_DEVICE_FILE;
}
- fseek(fs, 0, SEEK_SET);
+ res = fseek(fs, 0, SEEK_SET);
+ if (res!=0) {
+ LOG_E("mcRegistry store So.Data(cid/pid) failed: %d", MC_DRV_ERR_INVALID_PARAMETER);
+ fclose(fs);
+ return MC_DRV_ERR_INVALID_PARAMETER;
+ }
fwrite((char *)dataCont, 1, MC_SO_SIZE(dataCont->soHeader.plainLen, dataCont->soHeader.encryptedLen), fs);
+ if (ferror(fs)) {
+ LOG_E("mcRegistry store So.Data(cid/pid) failed: %d", MC_DRV_ERR_OUT_OF_RESOURCES);
+ fclose(fs);
+ return MC_DRV_ERR_OUT_OF_RESOURCES;
+ }
fflush(fs);
fclose(fs);
@@ -630,6 +800,7 @@ mcResult_t mcRegistryStoreData(void *so, uint32_t size)
mcResult_t mcRegistryReadData(uint32_t context, const mcCid_t *cid, mcPid_t pid,
mcSoDataCont_t *so, uint32_t maxLen)
{
+ int res = 0;
if ((NULL == cid) || (NULL == so)) {
LOG_E("mcRegistry read So.Data failed: %d", MC_DRV_ERR_INVALID_PARAMETER);
@@ -651,36 +822,61 @@ mcResult_t mcRegistryReadData(uint32_t context, const mcCid_t *cid, mcPid_t pid,
LOG_I("read DT: %s", filename.c_str());
FILE *fs = fopen(filename.c_str(), "rb");
- if (!fs) {
+ if (fs==NULL) {
LOG_E("mcRegistry read So.Data(cid/pid) failed: %d", MC_DRV_ERR_INVALID_DEVICE_FILE);
return MC_DRV_ERR_INVALID_DEVICE_FILE;
}
- fseek(fs, 0, SEEK_END);
+ res = fseek(fs, 0, SEEK_END);
+ if (res!=0) {
+ LOG_E("mcRegistry read So.Data(cid/pid) failed: %d", MC_DRV_ERR_INVALID_PARAMETER);
+ fclose(fs);
+ return MC_DRV_ERR_INVALID_PARAMETER;
+ }
uint32_t filesize = ftell(fs);
if (maxLen < filesize) {
fclose(fs);
LOG_E("mcRegistry read So.Data(cid/pid) failed: %d", MC_DRV_ERR_OUT_OF_RESOURCES);
return MC_DRV_ERR_OUT_OF_RESOURCES;
}
- fseek(fs, 0, SEEK_SET);
+ res = fseek(fs, 0, SEEK_SET);
+ if (res!=0) {
+ LOG_E("mcRegistry read So.Data(cid/pid) failed: %d", MC_DRV_ERR_INVALID_PARAMETER);
+ fclose(fs);
+ return MC_DRV_ERR_INVALID_PARAMETER;
+ }
char *p = (char *) so;
- if (fread(p, 1, sizeof(mcSoHeader_t), fs) != sizeof(mcSoHeader_t))
- {
+ res = fread(p, 1, sizeof(mcSoHeader_t), fs);
+ if (ferror(fs)) {
fclose(fs);
LOG_E("mcRegistry read So.Data(cid/pid) failed: %d", MC_DRV_ERR_INVALID_PARAMETER);
return MC_DRV_ERR_INVALID_PARAMETER;
}
+ if ((unsigned)res<sizeof(mcSoHeader_t)) {
+ //File is shorter than expected
+ if (feof(fs)) {
+ LOG_E("%s(): EOF reached: res is %u, size of mcSoHeader_t is %u", __func__, (unsigned)res, sizeof(mcSoHeader_t));
+ }
+ fclose(fs);
+ return MC_DRV_ERR_INVALID_PARAMETER;
+ }
p += sizeof(mcSoHeader_t);
- if (fread(p, 1, MC_SO_SIZE(so->soHeader.plainLen,
+ res = fread(p, 1, MC_SO_SIZE(so->soHeader.plainLen,
so->soHeader.encryptedLen)
- - sizeof(mcSoHeader_t), fs) !=
- MC_SO_SIZE(so->soHeader.plainLen, so->soHeader.encryptedLen)
- - sizeof(mcSoHeader_t))
- {
+ - sizeof(mcSoHeader_t), fs);
+ if (ferror(fs)) {
fclose(fs);
LOG_E("mcRegistry read So.Data(cid/pid) failed: %d", MC_DRV_ERR_INVALID_PARAMETER);
return MC_DRV_ERR_INVALID_PARAMETER;
}
+ if ((unsigned)res<(MC_SO_SIZE(so->soHeader.plainLen, so->soHeader.encryptedLen) - sizeof(mcSoHeader_t))) {
+ //File is shorter than expected
+ if (feof(fs)) {
+ LOG_E("%s(): EOF reached: res is %u, size of secure object is %u", __func__, (unsigned)res,
+ MC_SO_SIZE(so->soHeader.plainLen, so->soHeader.encryptedLen) - sizeof(mcSoHeader_t));
+ }
+ fclose(fs);
+ return MC_DRV_ERR_INVALID_PARAMETER;
+ }
fclose(fs);
return MC_DRV_OK;
@@ -695,6 +891,7 @@ static size_t getFileContent(
FILE *pStream;
long filesize;
uint8_t *content = NULL;
+ int res = 0;
/* Open the file */
pStream = fopen(pPath, "rb");
@@ -733,10 +930,18 @@ static size_t getFileContent(
}
/* Read data from the file into the buffer */
- if (fread(content, (size_t)filesize, 1, pStream) != 1) {
+ res = fread(content, (size_t)filesize, 1, pStream);
+ if (ferror(pStream)) {
LOG_E("Error: Cannot read file: %s.", pPath);
goto error;
}
+ if ((unsigned)res<1) {
+ //File is shorter than expected
+ if (feof(pStream)) {
+ LOG_E("Error: EOF reached: %s.", pPath);
+ }
+ goto error;
+ }
/* Close the file */
fclose(pStream);
@@ -796,13 +1001,12 @@ static bool mcCheckUuid(const mcUuid_t *uuid, const char *filename)
//this function deletes all the files owned by a GP TA and stored in the tbase secure storage dir.
//then it deletes GP TA folder.
-static int CleanupGPTAStorage(const char *basename)
+static int CleanupGPTAStorage(const char *uuid)
{
DIR *dp;
struct dirent *de;
int e;
- string TAPath = getRegistryPath()+"/TbStorage/"+ basename;
-
+ string TAPath = getTbStoragePath() + "/" + uuid;
if (NULL != (dp = opendir(TAPath.c_str()))) {
while (NULL != (de = readdir(dp))) {
if (de->d_name[0] != '.') {
@@ -825,21 +1029,20 @@ static int CleanupGPTAStorage(const char *basename)
return MC_DRV_OK;
}
-static void deleteSPTA(const mcUuid_t *uuid, const mcSpid_t spid, bool checkUuid)
+static void deleteSPTA(const mcUuid_t *uuid, const mcSpid_t spid)
{
DIR *dp;
struct dirent *de;
int e;
// Delete TABIN and SPID files - we loop searching required spid file
- string pathname = getRegistryPath();
- if (NULL != (dp = opendir(pathname.c_str()))) {
+ if (NULL != (dp = opendir(MC_REGISTRY_DATA_PATH))) {
while (NULL != (de = readdir(dp))) {
string spidFile;
string tabinFile;
string tabinUuid;
size_t pch_dot, pch_slash;
- spidFile = pathname + '/' + string(de->d_name);
+ spidFile = MC_REGISTRY_DATA_PATH "/" + string(de->d_name);
pch_dot = spidFile.find_last_of('.');
if (pch_dot == string::npos) continue;
pch_slash = spidFile.find_last_of('/');
@@ -857,28 +1060,31 @@ static void deleteSPTA(const mcUuid_t *uuid, const mcSpid_t spid, bool checkUuid
}
if (spid == curSpid) {
tabinFile = spidFile.substr(0, pch_dot) + GP_TA_BIN_FILE_EXT;
- if ((!checkUuid)||(mcCheckUuid(uuid, tabinFile.c_str()))) {
- tabinUuid = spidFile.substr(0, pch_dot);
- if (0 != (e = CleanupGPTAStorage(tabinUuid.c_str()))){
- LOG_E("cleanup TA Storage dir failed! errno: %d", e);
- //return MC_DRV_ERR_UNKNOWN;
- }
+ if (mcCheckUuid(uuid, tabinFile.c_str())) {
+ tabinUuid = spidFile.substr(0, pch_dot);
+ tabinUuid = tabinUuid.substr(tabinUuid.find_last_of('/')+1);
+ LOG_I("Remove TA storage %s", tabinUuid.c_str());
+ if (0 != (e = CleanupGPTAStorage(tabinUuid.c_str()))){
+ LOG_E("Remove TA storage failed! errno: %d", e);
+ /* Discard error */
+ }
+ LOG_I("Remove TA file %s", tabinFile.c_str());
if (0 != (e = remove(tabinFile.c_str()))) {
- LOG_E("remove TA file failed! errno: %d", e);
- //return MC_DRV_ERR_UNKNOWN;
+ LOG_E("Remove TA file failed! errno: %d", e);
+ /* Discard error */
}
+ LOG_I("Remove spid file %s", spidFile.c_str());
if (0 != (e = remove(spidFile.c_str()))) {
- LOG_E("remove SPID file failed! errno: %d", e);
- //return MC_DRV_ERR_UNKNOWN;
+ LOG_E("Remove spid file failed! errno: %d", e);
+ /* Discard error */
}
- if (checkUuid) break;
+ break;
}
}
}
if (dp) {
closedir(dp);
}
-
}
}
@@ -916,23 +1122,27 @@ mcResult_t mcRegistryCleanupTrustlet(const mcUuid_t *uuid, const mcSpid_t spid)
}
}
- // Delete TA binary with the name uuid.tlbin
- string tlBinFilePath = getTlBinFilePath(uuid);
- LOG_I("delete Tlb: %s", tlBinFilePath.c_str());
- if (0 != (e = remove(tlBinFilePath.c_str()))) {
- LOG_E("remove Tlb failed! errno: %d", e);
-// return MC_DRV_ERR_UNKNOWN; // a trustlet-binary must not be present ! (registered but not usable)
- }
+ string tlBinFilePath = getTlBinFilePath(uuid, MC_REGISTRY_WRITABLE);
+ struct stat tmp;
+ string tlContFilePath = getTlContFilePath(uuid, spid);;
- // Delete TABIN and SPID files - we loop searching required spid file
- deleteSPTA(uuid,spid,true);
+ if (stat(tlBinFilePath.c_str(), &tmp) == 0) {
+ /* Legacy TA */
+ LOG_I("Remove TA file %s", tlBinFilePath.c_str());
+ if (0 != (e = remove(tlBinFilePath.c_str()))) {
+ LOG_E("Remove TA file failed! errno: %d", e);
+ }
+ } else {
+ /* GP TA */
+ deleteSPTA(uuid, spid);
+ }
- string tlContFilePath = getTlContFilePath(uuid, spid);
- LOG_I("delete Tlc: %s", tlContFilePath.c_str());
+ LOG_I("Remove TA container %s", tlContFilePath.c_str());
if (0 != (e = remove(tlContFilePath.c_str()))) {
- LOG_E("remove Tlc failed! errno: %d", e);
+ LOG_E("Remove TA container failed! errno: %d", e);
return MC_DRV_ERR_UNKNOWN;
}
+
return MC_DRV_OK;
}
@@ -967,9 +1177,6 @@ mcResult_t mcRegistryCleanupSp(mcSpid_t spid)
return ret;
}
- // Delete remaining TABIN and SPID files
- deleteSPTA(NULL,spid,false);
-
string pathname = getSpDataPath(spid);
if (NULL != (dp = opendir(pathname.c_str()))) {
@@ -1057,9 +1264,6 @@ regObject_t *mcRegistryMemGetServiceBlob(mcSpid_t spid, void *trustlet, uint32_t
LOG_E("mcRegistryMemGetServiceBlob() failed: wrong header magic value: %d", pIntro->magic);
return NULL;
}
- LOG_I(" Service intro version %u.%u",
- MC_GET_MAJOR_VERSION(pIntro->version),
- MC_GET_MINOR_VERSION(pIntro->version));
// Get service type.
mclfHeaderV2_t *pHeader = (mclfHeaderV2_t *)trustlet;
@@ -1073,11 +1277,7 @@ regObject_t *mcRegistryMemGetServiceBlob(mcSpid_t spid, void *trustlet, uint32_t
}
#endif
- LOG_I(" Trustlet version %u.%u text %u data %u ",
- MC_GET_MAJOR_VERSION(pIntro->version),
- MC_GET_MINOR_VERSION(pIntro->version),
- pHeader->text.len,
- pHeader->data.len);
+ LOG_I(" Trustlet text %u data %u ", pHeader->text.len, pHeader->data.len);
// If loadable driver or system trustlet.
if (pHeader->serviceType == SERVICE_TYPE_DRIVER || pHeader->serviceType == SERVICE_TYPE_SYSTEM_TRUSTLET) {
@@ -1239,15 +1439,15 @@ regObject_t *mcRegistryGetServiceBlob(const mcUuid_t *uuid, bool isGpUuid)
// Open service blob file.
string tlBinFilePath;
if (isGpUuid) {
- tlBinFilePath = getTABinFilePath(uuid);
+ tlBinFilePath = getTABinFilePath(uuid, MC_REGISTRY_ALL);
} else {
- tlBinFilePath = getTlBinFilePath(uuid);
+ tlBinFilePath = getTlBinFilePath(uuid, MC_REGISTRY_ALL);
}
LOG_I("Loading %s", tlBinFilePath.c_str());
mcSpid_t spid = 0;
if (isGpUuid) {
- string taspidFilePath = getTASpidFilePath(uuid);
+ string taspidFilePath = getTASpidFilePath(uuid, MC_REGISTRY_ALL);
int fd = open(taspidFilePath.c_str(), O_RDONLY);
if (fd == -1) {
// This can be ok for System TAs
@@ -1290,4 +1490,3 @@ regObject_t *mcRegistryGetDriverBlob(const char *filename)
return regobj;
}
-/** @} */
diff --git a/mobicore/daemon/Registry/PrivateRegistry.h b/mobicore/MobiCoreDriverLib/Registry/PrivateRegistry.h
index 9404939..e885d8c 100644
--- a/mobicore/daemon/Registry/PrivateRegistry.h
+++ b/mobicore/MobiCoreDriverLib/Registry/PrivateRegistry.h
@@ -1,12 +1,3 @@
-/**
- * @addtogroup MCD_MCDIMPL_DAEMON_REG
- * @{
- * G&D MobiCore Registry Private implementation
- *
- * @file
- * Mobicore Driver Registry.
- */
-
/*
* Copyright (c) 2013 TRUSTONIC LIMITED
* All rights reserved.
@@ -37,6 +28,9 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ * MobiCore Registry Private implementation
+ */
#ifndef MOBICORE_REGISTRY_H_
#define MOBICORE_REGISTRY_H_
@@ -71,6 +65,12 @@ extern "C" {
*/
mcResult_t mcRegistryReadAuthToken(mcSoAuthTokenCont_t *so);
+ /** Reads an authentication token backup from registry.
+ * @param[out] so Authentication token secure object.
+ * @return MC_DRV_OK if successful, otherwise error code.
+ */
+ mcResult_t mcRegistryReadAuthTokenBackup(mcSoAuthTokenCont_t *so);
+
/** Deletes the authentication token secure object from the registry.
* @return MC_DRV_OK if successful, otherwise error code.
*/
@@ -213,4 +213,3 @@ extern "C" {
#endif // MOBICORE_REGISTRY_H_
-/** @} */
diff --git a/mobicore/daemon/Registry/Public/MobiCoreRegistry.h b/mobicore/MobiCoreDriverLib/Registry/Public/MobiCoreRegistry.h
index c629b14..ccdb756 100644
--- a/mobicore/daemon/Registry/Public/MobiCoreRegistry.h
+++ b/mobicore/MobiCoreDriverLib/Registry/Public/MobiCoreRegistry.h
@@ -1,12 +1,3 @@
-/**
- * @addtogroup MCD_MCDIMPL_DAEMON_REG
- * @{
- * G&D MobiCore Registry
- *
- * @file
- * Mobicore Driver Registry.
- */
-
/*
* Copyright (c) 2013 TRUSTONIC LIMITED
* All rights reserved.
@@ -147,4 +138,3 @@ extern "C" {
#endif // MOBICORE_REGISTRY_H_
-/** @} */
diff --git a/mobicore/daemon/Registry/Registry.cpp b/mobicore/MobiCoreDriverLib/Registry/Registry.cpp
index a900529..6f193fa 100644
--- a/mobicore/daemon/Registry/Registry.cpp
+++ b/mobicore/MobiCoreDriverLib/Registry/Registry.cpp
@@ -1,11 +1,3 @@
-/** Mobicore Driver Registry Interface
- *
- * Implements the MobiCore registry interface for the ROOT-PA
- *
- * @file
- * @ingroup MCD_MCDIMPL_DAEMON_REG
- */
-
/*
* Copyright (c) 2013 TRUSTONIC LIMITED
* All rights reserved.
@@ -36,6 +28,13 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/** Mobicore Driver Registry Interface
+ *
+ * Implements the MobiCore registry interface for the ROOT-PA
+ *
+ * @file
+ * @ingroup MCD_MCDIMPL_DAEMON_REG
+ */
#include <stdlib.h>
#include <dirent.h>
@@ -128,7 +127,7 @@ mcDrvResponseHeader_t rsp = { responseId :
//------------------------------------------------------------------------------
mcResult_t mcRegistryStoreAuthToken(void *so, uint32_t size)
{
- typedef struct {
+ typedef struct __attribute ((packed)) {
uint32_t commandId;
uint32_t soSize;
uint8_t so;
@@ -179,7 +178,7 @@ mcDrvCommandHeader_t cmd = { commandId :
//------------------------------------------------------------------------------
mcResult_t mcRegistryStoreRoot(void *so, uint32_t size)
{
- typedef struct {
+ typedef struct __attribute ((packed)) {
uint32_t commandId;
uint32_t soSize;
uint8_t so;
@@ -227,7 +226,7 @@ mcDrvCommandHeader_t cmd = { commandId :
//------------------------------------------------------------------------------
mcResult_t mcRegistryStoreSp(mcSpid_t spid, void *so, uint32_t size)
{
- typedef struct {
+ typedef struct __attribute ((packed)) {
uint32_t commandId;
uint32_t soSize;
mcSpid_t spid;
@@ -288,7 +287,7 @@ mcResult_t mcRegistryCleanupSp(mcSpid_t spid)
//------------------------------------------------------------------------------
mcResult_t mcRegistryStoreTrustletCon(const mcUuid_t *uuid, mcSpid_t spid, void *so, uint32_t size)
{
- typedef struct {
+ typedef struct __attribute ((packed)) {
uint32_t commandId;
uint32_t soSize;
mcUuid_t uuid;
@@ -395,4 +394,3 @@ mcResult_t mcRegistryReadData(uint32_t context, const mcCid_t *cid, mcPid_t pid,
return MC_DRV_ERR_INVALID_PARAMETER;
}
-/** @} */
diff --git a/mobicore/daemon/build.sh b/mobicore/MobiCoreDriverLib/build.sh
index 55a1593..55a1593 100644
--- a/mobicore/daemon/build.sh
+++ b/mobicore/MobiCoreDriverLib/build.sh
diff --git a/mobicore/MobiCoreDriverLib/buildTag.h b/mobicore/MobiCoreDriverLib/buildTag.h
new file mode 100644
index 0000000..b1d9959
--- /dev/null
+++ b/mobicore/MobiCoreDriverLib/buildTag.h
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+/** Build tag created during build by /home/buildserver/jenkins/workspace/CI_Trunk_BuildAndTest_TestRun-Arndale/dev/components/MobiCoreDriver/Linux/Daemon/../../../../../build/tools/Scripts/setBuildTag.sh. */
+#define MOBICORE_COMPONENT_BUILD_TAG \
+ " t-base-Qualcomm-MSM8994-Android-301B-V001"
diff --git a/mobicore/NOTICE b/mobicore/NOTICE
deleted file mode 100644
index d742e22..0000000
--- a/mobicore/NOTICE
+++ /dev/null
@@ -1,25 +0,0 @@
- Copyright Giesecke & Devrient GmbH 2009 - 2012
-
- 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. The name of the author may not be used to endorse or promote
- products derived from this software without specific prior
- written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. \ No newline at end of file
diff --git a/mobicore/common/DrSecureStorage/dci.h b/mobicore/common/DrSecureStorage/dci.h
deleted file mode 100644
index c805f5c..0000000
--- a/mobicore/common/DrSecureStorage/dci.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2013 TRUSTONIC LIMITED
- * All rights reserved
- *
- * The present software is the confidential and proprietary information of
- * TRUSTONIC LIMITED. You shall not disclose the present software and shall
- * use it only in accordance with the terms of the license agreement you
- * entered into with TRUSTONIC LIMITED. This software may be subject to
- * export or import laws in certain countries.
- */
-
-/**
- * @file dci.h
- * @brief Contains DCI (Driver Control
- * Interface) definitions and data structures
- *
- */
-
-#ifndef __DCI_H__
-#define __DCI_H__
-
-
-typedef uint32_t dciCommandId_t;
-typedef uint32_t dciResponseId_t;
-typedef uint32_t dciReturnCode_t;
-
-/**< Responses have bit 31 set */
-#define RSP_ID_MASK (1U << 31)
-#define RSP_ID(cmdId) (((uint32_t)(cmdId)) | RSP_ID_MASK)
-#define IS_CMD(cmdId) ((((uint32_t)(cmdId)) & RSP_ID_MASK) == 0)
-#define IS_RSP(cmdId) ((((uint32_t)(cmdId)) & RSP_ID_MASK) == RSP_ID_MASK)
-
-/**
- * Return codes of driver commands.
- */
-#define RET_OK 0
-#define RET_ERR_UNKNOWN_CMD 1
-#define RET_ERR_NOT_SUPPORTED 2
-#define RET_ERR_INTERNAL_ERROR 3
-/* ... add more error codes when needed */
-
-/**
- * DCI command header.
- */
-typedef struct{
- dciCommandId_t commandId; /**< Command ID */
-} dciCommandHeader_t;
-
-/**
- * DCI response header.
- */
-typedef struct{
- dciResponseId_t responseId; /**< Response ID (must be command ID | RSP_ID_MASK )*/
- dciReturnCode_t returnCode; /**< Return code of command */
-} dciResponseHeader_t;
-
-#endif // __DCI_H__
diff --git a/mobicore/common/DrSecureStorage/drError.h b/mobicore/common/DrSecureStorage/drError.h
deleted file mode 100644
index d686bc1..0000000
--- a/mobicore/common/DrSecureStorage/drError.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2013 TRUSTONIC LIMITED
- * All rights reserved
- *
- * The present software is the confidential and proprietary information of
- * TRUSTONIC LIMITED. You shall not disclose the present software and shall
- * use it only in accordance with the terms of the license agreement you
- * entered into with TRUSTONIC LIMITED. This software may be subject to
- * export or import laws in certain countries.
- */
-
-/**
- * @file drError.h
- * @brief Error id definitions
- *
- */
-
-#ifndef __DRERROR_H__
-#define __DRERROR_H__
-
-/**
- * Driver fatal error codes.
- */
-typedef enum {
- E_DR_OK = 0, /**< Success */
- E_DR_IPC = 1, /**< IPC error */
- E_DR_INTERNAL = 2, /**< Internal error */
- /* ... add more error codes when required */
-} drError_t;
-
-
-#endif // __DRERROR_H__
-
-
diff --git a/mobicore/common/DrSecureStorage/tee_internal_api.h b/mobicore/common/DrSecureStorage/tee_internal_api.h
deleted file mode 100644
index 05119a3..0000000
--- a/mobicore/common/DrSecureStorage/tee_internal_api.h
+++ /dev/null
@@ -1,1109 +0,0 @@
-/*
- * Copyright (c) 2012 Trusted Logic Mobility SAS.
- * All Rights Reserved.
- *
- * The present software is the confidential and proprietary information of
- * Trusted Logic Mobility SAS. You shall not disclose the present software
- * and shall use it only in accordance with the terms of the license
- * agreement you entered into with Trusted Logic Mobility SAS.
- * "Trusted Logic" is a registered trademark of Trusted Logic SAS.
- * This software may be subject to export or import laws in certain
- * countries.
- */
-
-//TODO: Remove functions that are not provided in potato release
-
-#ifndef __TEE_INTERNAL_API_H__
-#define __TEE_INTERNAL_API_H__
-
-typedef uint32_t TEE_Result;
-
-#define TEE_SUCCESS ((TEE_Result)0x00000000)
-
-/**
- * Generic error code : Generic error
- **/
-#define TEE_ERROR_GENERIC ((TEE_Result)0xFFFF0000)
-
-/**
- * Generic error code : The underlying security system denies the access to the
- * object
- **/
-#define TEE_ERROR_ACCESS_DENIED ((TEE_Result)0xFFFF0001)
-
-/**
- * Generic error code : The pending operation is cancelled.
- **/
-#define TEE_ERROR_CANCEL ((TEE_Result)0xFFFF0002)
-
-/**
- * Generic error code : The underlying system detects a conflict
- **/
-#define TEE_ERROR_ACCESS_CONFLICT ((TEE_Result)0xFFFF0003)
-
-/**
- * Generic error code : Too much data for the operation or some data remain
- * unprocessed by the operation.
- **/
-#define TEE_ERROR_EXCESS_DATA ((TEE_Result)0xFFFF0004)
-
-/**
- * Generic error code : Error of data format
- **/
-#define TEE_ERROR_BAD_FORMAT ((TEE_Result)0xFFFF0005)
-
-/**
- * Generic error code : The specified parameters are invalid
- **/
-#define TEE_ERROR_BAD_PARAMETERS ((TEE_Result)0xFFFF0006)
-
-/**
- * Generic error code : Illegal state for the operation.
- **/
-#define TEE_ERROR_BAD_STATE ((TEE_Result)0xFFFF0007)
-
-/**
- * Generic error code : The item is not found
- **/
-#define TEE_ERROR_ITEM_NOT_FOUND ((TEE_Result)0xFFFF0008)
-
-/**
- * Generic error code : The specified operation is not implemented
- **/
-#define TEE_ERROR_NOT_IMPLEMENTED ((TEE_Result)0xFFFF0009)
-
-/**
- * Generic error code : The specified operation is not supported
- **/
-#define TEE_ERROR_NOT_SUPPORTED ((TEE_Result)0xFFFF000A)
-
-/**
- * Generic error code : Insufficient data is available for the operation.
- **/
-#define TEE_ERROR_NO_DATA ((TEE_Result)0xFFFF000B)
-
-/**
- * Generic error code : Not enough memory to perform the operation
- **/
-#define TEE_ERROR_OUT_OF_MEMORY ((TEE_Result)0xFFFF000C)
-
-/**
- * Generic error code : The service is currently unable to handle the request;
- * try later
- **/
-#define TEE_ERROR_BUSY ((TEE_Result)0xFFFF000D)
-
-/**
- * Generic error code : security violation
- **/
-#define TEE_ERROR_SECURITY ((TEE_Result)0xFFFF000F)
-
-/**
- * Generic error code : the buffer is too short
- **/
-#define TEE_ERROR_SHORT_BUFFER ((TEE_Result)0xFFFF0010)
-
-/**
- * Generic error code : the operation is not terminated
- **/
-#define TEE_PENDING ((TEE_Result)0xFFFF2000)
-
-/**
- * Generic error code : A timeout occurred
- **/
-#define TEE_ERROR_TIMEOUT ((TEE_Result)0xFFFF3001)
-
-/**
- * Generic error code : Overflow
- **/
-#define TEE_ERROR_OVERFLOW ((TEE_Result)0xFFFF300F)
-
-/*------------------------------------------------------------------------------
- Communication Error Codes
-------------------------------------------------------------------------------*/
-
-/**
- * Generic communication error
- **/
-#define TEE_ERROR_COMMUNICATION ((TEE_Result)0xFFFF000E)
-
-/**
- * Error of communication: The target of the connection is dead
- **/
-#define TEE_ERROR_TARGET_DEAD ((TEE_Result)0xFFFF3024)
-
-/*------------------------------------------------------------------------------
- Storage Error Codes
-------------------------------------------------------------------------------*/
-
-/** File system error code: not enough space to complete the operation. */
-#define TEE_ERROR_STORAGE_NO_SPACE ((TEE_Result)0xFFFF3041)
-
-/*------------------------------------------------------------------------------
- Crypto error codes
-------------------------------------------------------------------------------*/
-#define TEE_ERROR_MAC_INVALID ((TEE_Result)0xFFFF3071)
-
-#define TEE_ERROR_SIGNATURE_INVALID ((TEE_Result)0xFFFF3072)
-
-/*------------------------------------------------------------------------------
- Date error codes
-------------------------------------------------------------------------------*/
-#define TEE_ERROR_TIME_NOT_SET ((TEE_Result)0xFFFF5000)
-
-#define TEE_ERROR_TIME_NEEDS_RESET ((TEE_Result)0xFFFF5001)
-
-
-/** Definition of an UUID (from RFC 4122 http://www.ietf.org/rfc/rfc4122.txt) */
-typedef struct
-{
- uint32_t timeLow;
- uint16_t timeMid;
- uint16_t timeHiAndVersion;
- uint8_t clockSeqAndNode[8];
-} TEE_UUID;
-
-/** Type definition for a TEE Identity */
-typedef struct TEE_Identity
-{
- uint32_t login;
- TEE_UUID uuid;
-} TEE_Identity;
-
-typedef uint32_t S_HANDLE;
-
-#define S_VAR_NOT_USED(variable) do{(void)(variable);}while(0);
-
-#define OUT
-#define IN
-
-#define TEE_EXPORT
-#define TA_EXPORT
-
-
-/*---------------------------------------------------------
- Common type definition
----------------------------------------------------------*/
-
-typedef union
-{
-
- struct
- {
- void* buffer;
- size_t size;
- } memref;
-
- struct
- {
- uint32_t a;
- uint32_t b;
- } value;
-
-}
-TEE_Param;
-
-typedef S_HANDLE TEE_TASessionHandle;
-typedef S_HANDLE TEE_PropSetHandle;
-typedef S_HANDLE TEE_ObjectHandle;
-typedef S_HANDLE TEE_ObjectEnumHandle;
-typedef S_HANDLE TEE_OperationHandle;
-
-#define TEE_HANDLE_NULL ((S_HANDLE)0)
-
-#define TEE_PARAM_TYPES(t0,t1,t2,t3) ((t0) | ((t1) << 4) | ((t2) << 8) | ((t3) << 12))
-#define TEE_PARAM_TYPE_GET(t, i) (((t) >> (i*4)) & 0xF)
-
-typedef enum {
- TEE_DATA_SEEK_SET,
- TEE_DATA_SEEK_CUR,
- TEE_DATA_SEEK_END
- } TEE_Whence;
-
-typedef struct TEE_Time
-{
- uint32_t seconds;
- uint32_t millis;
-} TEE_Time;
-
-typedef struct {
- uint32_t algorithm;
- uint32_t operationClass;
- uint32_t mode;
- uint32_t digestLength;
- uint32_t maxKeySize;
- uint32_t keySize;
- uint32_t requiredKeyUsage;
- uint32_t handleState;
- } TEE_OperationInfo;
-
-
-typedef enum {
- TEE_MODE_ENCRYPT,
- TEE_MODE_DECRYPT,
- TEE_MODE_SIGN,
- TEE_MODE_VERIFY,
- TEE_MODE_MAC,
- TEE_MODE_DIGEST,
- TEE_MODE_DERIVE
- } TEE_OperationMode;
-
-
-typedef struct {
- uint32_t attributeID;
- union
- {
- struct
- {
- void* buffer;
- size_t length;
- }ref;
- struct
- {
- uint32_t a, b;
- }value;
- }content;
- } TEE_Attribute;
-
-typedef struct {
- uint32_t objectType;
- uint32_t objectSize;
- uint32_t maxObjectSize;
- uint32_t objectUsage;
- uint32_t dataSize;
- uint32_t dataPosition;
- uint32_t handleFlags;
- } TEE_ObjectInfo;
-
-
-/*------------------------------------------------------------------------------
- Constants
-------------------------------------------------------------------------------*/
-
-#define TEE_TIMEOUT_INFINITE 0xFFFFFFFF
-
-/* Login types */
-#define TEE_LOGIN_PUBLIC 0x00000000
-#define TEE_LOGIN_USER 0x00000001
-#define TEE_LOGIN_GROUP 0x00000002
-#define TEE_LOGIN_APPLICATION 0x00000004
-#define TEE_LOGIN_APPLICATION_USER 0x00000005
-#define TEE_LOGIN_APPLICATION_GROUP 0x00000006
-#define TEE_LOGIN_TRUSTED_APP 0xF0000000
-
-/* Parameter types */
-#define TEE_PARAM_TYPE_NONE 0x0
-#define TEE_PARAM_TYPE_VALUE_INPUT 0x1
-#define TEE_PARAM_TYPE_VALUE_OUTPUT 0x2
-#define TEE_PARAM_TYPE_VALUE_INOUT 0x3
-#define TEE_PARAM_TYPE_MEMREF_INPUT 0x5
-#define TEE_PARAM_TYPE_MEMREF_OUTPUT 0x6
-#define TEE_PARAM_TYPE_MEMREF_INOUT 0x7
-
-#define TEE_MEMORY_ACCESS_READ 0x00000001
-#define TEE_MEMORY_ACCESS_WRITE 0x00000002
-#define TEE_MEMORY_ACCESS_ANY_OWNER 0x00000004
-
-#define TEE_ORIGIN_API 1
-#define TEE_ORIGIN_COMMS 2
-#define TEE_ORIGIN_TEE 3
-#define TEE_ORIGIN_TRUSTED_APP 4
-
-/* Property Sets Pseudo Handles */
-#define TEE_PROPSET_CURRENT_TA (TEE_PropSetHandle)0xFFFFFFFF
-#define TEE_PROPSET_CURRENT_CLIENT (TEE_PropSetHandle)0xFFFFFFFE
-#define TEE_PROPSET_TEE_IMPLEMENTATION (TEE_PropSetHandle)0xFFFFFFFD
-
-/* Allocation hints */
-#define TEE_ALLOCATION_HINT_ZEROED 0x00000000
-
-/* Crypto Usage Constants */
-#define TEE_USAGE_EXTRACTABLE 0x00000001
-#define TEE_USAGE_ENCRYPT 0x00000002
-#define TEE_USAGE_DECRYPT 0x00000004
-#define TEE_USAGE_MAC 0x00000008
-#define TEE_USAGE_SIGN 0x00000010
-#define TEE_USAGE_VERIFY 0x00000020
-#define TEE_USAGE_DERIVE 0x00000040
-
-/* Crypto Handle Flag Constants */
-#define TEE_HANDLE_FLAG_PERSISTENT 0x00010000
-#define TEE_HANDLE_FLAG_INITIALIZED 0x00020000
-#define TEE_HANDLE_FLAG_KEY_SET 0x00040000
-#define TEE_HANDLE_FLAG_EXPECT_TWO_KEYS 0x00080000
-
-/* Crypto Operation Constants */
-#define TEE_OPERATION_CIPHER 1
-#define TEE_OPERATION_MAC 3
-#define TEE_OPERATION_AE 4
-#define TEE_OPERATION_DIGEST 5
-#define TEE_OPERATION_ASYMMETRIC_CIPHER 6
-#define TEE_OPERATION_ASYMMETRIC_SIGNATURE 7
-#define TEE_OPERATION_KEY_DERIVATION 8
-
-/* Crypto Algortithm Constants */
-#define TEE_ALG_AES_ECB_NOPAD 0x10000010
-#define TEE_ALG_AES_CBC_NOPAD 0x10000110
-#define TEE_ALG_AES_CTR 0x10000210
-#define TEE_ALG_AES_CTS 0x10000310
-#define TEE_ALG_AES_XTS 0x10000410
-#define TEE_ALG_AES_CBC_MAC_NOPAD 0x30000110
-#define TEE_ALG_AES_CBC_MAC_PKCS5 0x30000510
-#define TEE_ALG_AES_CMAC 0x30000610
-#define TEE_ALG_AES_CCM 0x40000710
-#define TEE_ALG_AES_GCM 0x40000810
-#define TEE_ALG_DES_ECB_NOPAD 0x10000011
-#define TEE_ALG_DES_CBC_NOPAD 0x10000111
-#define TEE_ALG_DES_CBC_MAC_NOPAD 0x30000111
-#define TEE_ALG_DES_CBC_MAC_PKCS5 0x30000511
-#define TEE_ALG_DES_CMAC 0x30000611
-#define TEE_ALG_DES3_ECB_NOPAD 0x10000013
-#define TEE_ALG_DES3_CBC_NOPAD 0x10000113
-#define TEE_ALG_DES3_CBC_MAC_NOPAD 0x30000113
-#define TEE_ALG_DES3_CBC_MAC_PKCS5 0x30000513
-#define TEE_ALG_DES3_CMAC 0x30000613
-#define TEE_ALG_RSASSA_PKCS1_V1_5_MD5 0x70001830
-#define TEE_ALG_RSASSA_PKCS1_V1_5_SHA1 0x70002830
-#define TEE_ALG_RSASSA_PKCS1_V1_5_SHA224 0x70003830
-#define TEE_ALG_RSASSA_PKCS1_V1_5_SHA256 0x70004830
-#define TEE_ALG_RSASSA_PKCS1_V1_5_SHA384 0x70005830
-#define TEE_ALG_RSASSA_PKCS1_V1_5_SHA512 0x70006830
-#define TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA1 0x70212930
-#define TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA224 0x70313930
-#define TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA256 0x70414930
-#define TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA384 0x70515930
-#define TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA512 0x70616930
-#define TEE_ALG_RSAES_PKCS1_V1_5 0x60000130
-#define TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA1 0x60210230
-#define TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA224 0x60310230
-#define TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA256 0x60410230
-#define TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA384 0x60510230
-#define TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA512 0x60610230
-#define TEE_ALG_RSA_NOPAD 0x60000030
-#define TEE_ALG_DSA_SHA1 0x70002131
-#define TEE_ALG_DH_DERIVE_SHARED_SECRET 0x80000032
-#define TEE_ALG_MD5 0x50000001
-#define TEE_ALG_SHA1 0x50000002
-#define TEE_ALG_SHA224 0x50000003
-#define TEE_ALG_SHA256 0x50000004
-#define TEE_ALG_SHA384 0x50000005
-#define TEE_ALG_SHA512 0x50000006
-#define TEE_ALG_HMAC_MD5 0x30000001
-#define TEE_ALG_HMAC_SHA1 0x30000002
-#define TEE_ALG_HMAC_SHA224 0x30000003
-#define TEE_ALG_HMAC_SHA256 0x30000004
-#define TEE_ALG_HMAC_SHA384 0x30000005
-#define TEE_ALG_HMAC_SHA512 0x30000006
-
-/* Storage ID Values */
-#define TEE_STORAGE_PRIVATE 0x00000001
-
-/* Data Flags */
-#define TEE_DATA_FLAG_ACCESS_READ 0x00000001
-#define TEE_DATA_FLAG_ACCESS_WRITE 0x00000002
-#define TEE_DATA_FLAG_ACCESS_WRITE_META 0x00000004
-#define TEE_DATA_FLAG_SHARE_READ 0x00000010
-#define TEE_DATA_FLAG_SHARE_WRITE 0x00000020
-#define TEE_DATA_FLAG_CREATE 0x00000200
-#define TEE_DATA_FLAG_EXCLUSIVE 0x00000400
-
-/* Misc */
-#define TEE_DATA_MAX_POSITION 0xFFFFFFFF
-#define TEE_OBJECT_ID_MAX_LEN 0x40
-
-/* Object Types */
-#define TEE_TYPE_AES 0xA0000010
-#define TEE_TYPE_DES 0xA0000011
-#define TEE_TYPE_DES3 0xA0000013
-#define TEE_TYPE_HMAC_MD5 0xA0000001
-#define TEE_TYPE_HMAC_SHA1 0xA0000002
-#define TEE_TYPE_HMAC_SHA224 0xA0000003
-#define TEE_TYPE_HMAC_SHA256 0xA0000004
-#define TEE_TYPE_HMAC_SHA384 0xA0000005
-#define TEE_TYPE_HMAC_SHA512 0xA0000006
-#define TEE_TYPE_RSA_PUBLIC_KEY 0xA0000030
-#define TEE_TYPE_RSA_KEYPAIR 0xA1000030
-#define TEE_TYPE_DSA_PUBLIC_KEY 0xA0000031
-#define TEE_TYPE_DSA_KEYPAIR 0xA1000031
-#define TEE_TYPE_DH_KEYPAIR 0xA1000032
-#define TEE_TYPE_GENERIC_SECRET 0xA0000000
-
-/* Object Attribute Identifier Flags - bits 28 and 29 indicate the type (value/ref) and its visibility */
-#define TEE_ATTR_FLAG_VALUE 0x20000000
-#define TEE_ATTR_FLAG_PUBLIC 0x10000000
-
-/* Operation and Object Attribute ID Values */
-#define TEE_ATTR_SECRET_VALUE 0xC0000000
-#define TEE_ATTR_RSA_MODULUS 0xD0000130
-#define TEE_ATTR_RSA_PUBLIC_EXPONENT 0xD0000230
-#define TEE_ATTR_RSA_PRIVATE_EXPONENT 0xC0000330
-#define TEE_ATTR_RSA_PRIME1 0xC0000430 // p
-#define TEE_ATTR_RSA_PRIME2 0xC0000530 // q
-#define TEE_ATTR_RSA_EXPONENT1 0xC0000630 // dp
-#define TEE_ATTR_RSA_EXPONENT2 0xC0000730 // dq
-#define TEE_ATTR_RSA_COEFFICIENT 0xC0000830 // iq
-#define TEE_ATTR_DSA_PRIME 0xD0001031 // p
-#define TEE_ATTR_DSA_SUBPRIME 0xD0001131 // q
-#define TEE_ATTR_DSA_BASE 0xD0001231 // g
-#define TEE_ATTR_DSA_PUBLIC_VALUE 0xD0000131 // y
-#define TEE_ATTR_DSA_PRIVATE_VALUE 0xC0000231 // x
-#define TEE_ATTR_DH_PRIME 0xD0001032 // p
-#define TEE_ATTR_DH_SUBPRIME 0xD0001132 // q
-#define TEE_ATTR_DH_BASE 0xD0001232 // g
-#define TEE_ATTR_DH_X_BITS 0xF0001332 // type "Value" not "Ref"
-#define TEE_ATTR_DH_PUBLIC_VALUE 0xD0000132 // y
-#define TEE_ATTR_DH_PRIVATE_VALUE 0xC0000232 // x
-#define TEE_ATTR_RSA_OAEP_LABEL 0xD0000930
-#define TEE_ATTR_RSA_PSS_SALT_LENGTH 0xF0000A30 // type "Value" not "Ref"
-
-/*------------------------------------------------------------------------------
- Trusted Application Interface
- ------------------------------------------------------------------------------*/
-
-TEE_Result TA_EXPORT TA_CreateEntryPoint(void);
-
-void TA_EXPORT TA_DestroyEntryPoint(void);
-
-TEE_Result TA_EXPORT TA_OpenSessionEntryPoint(uint32_t nParamTypes,
- TEE_Param pParams[4],
- void** ppSessionContext);
-
-void TA_EXPORT TA_CloseSessionEntryPoint(void* pSessionContext);
-
-TEE_Result TA_EXPORT TA_InvokeCommandEntryPoint(
- void* pSessionContext,
- uint32_t nCommandID,
- uint32_t nParamTypes,
- TEE_Param pParams[4]
- );
-
-
-/*------------------------------------------------------------------------------
- Trusted Core Framework APIs
- ------------------------------------------------------------------------------*/
-
-void TEE_EXPORT TEE_Panic(TEE_Result nPanicCode);
-
-
-/*------------------------------------------------------------------------------
- Property Access Functions
- ------------------------------------------------------------------------------*/
-
-TEE_Result TEE_EXPORT TEE_GetPropertyAsString(
- TEE_PropSetHandle propsetOrEnumerator,
- char* name,
- char* valueBuffer,
- size_t* valueBufferLen );
-
-TEE_Result TEE_EXPORT TEE_GetPropertyAsBool(
- TEE_PropSetHandle propsetOrEnumerator,
- char* name,
- bool* value );
-
-TEE_Result TEE_EXPORT TEE_GetPropertyAsU32 (
- TEE_PropSetHandle propsetOrEnumerator,
- char* name,
- uint32_t* value );
-
-TEE_Result TEE_EXPORT TEE_GetPropertyAsBinaryBlock(
- TEE_PropSetHandle propsetOrEnumerator,
- char* name,
- void* valueBuffer,
- size_t* valueBufferLen );
-
-TEE_Result TEE_EXPORT TEE_GetPropertyAsUUID(
- TEE_PropSetHandle propsetOrEnumerator,
- char* name,
- TEE_UUID* value );
-
-TEE_Result TEE_EXPORT TEE_GetPropertyAsIdentity(
- TEE_PropSetHandle propsetOrEnumerator,
- char* name,
- TEE_Identity* value );
-
-TEE_Result TEE_EXPORT TEE_AllocatePropertyEnumerator(
- TEE_PropSetHandle* enumerator );
-
-void TEE_EXPORT TEE_FreePropertyEnumerator(
- TEE_PropSetHandle enumerator );
-
-void TEE_EXPORT TEE_StartPropertyEnumerator(
- TEE_PropSetHandle enumerator,
- TEE_PropSetHandle propSet );
-
-void TEE_EXPORT TEE_ResetPropertyEnumerator(
- TEE_PropSetHandle enumerator );
-
-TEE_Result TEE_EXPORT TEE_GetPropertyName(
- TEE_PropSetHandle enumerator,
- void* nameBuffer,
- size_t* nameBufferLen );
-
-TEE_Result TEE_EXPORT TEE_GetNextProperty(
- TEE_PropSetHandle enumerator );
-
-
-/*------------------------------------------------------------------------------
- Internal Client API
- ------------------------------------------------------------------------------*/
-
-TEE_Result TEE_EXPORT TEE_OpenTASession( TEE_UUID* destination, // [in]
- uint32_t cancellationRequestTimeout,
- uint32_t paramTypes,
- TEE_Param params[4], // [inout]
- TEE_TASessionHandle* session, // [out]
- uint32_t* returnOrigin
- );
-
-void TEE_EXPORT TEE_CloseTASession(TEE_TASessionHandle session);
-
-TEE_Result TEE_EXPORT TEE_InvokeTACommand(TEE_TASessionHandle session,
- uint32_t cancellationRequestTimeout,
- uint32_t commandID,
- uint32_t paramTypes,
- TEE_Param params[4],
- uint32_t* returnOrigin
- );
-
-/*------------------------------------------------------------------------------
- Cancellation Functions
- ------------------------------------------------------------------------------*/
-
-bool TEE_EXPORT TEE_GetCancellationFlag( void );
-bool TEE_EXPORT TEE_UnmaskCancellation( void );
-bool TEE_EXPORT TEE_MaskCancellation( void );
-
-
-/*------------------------------------------------------------------------------
- Memory Management Functions
- ------------------------------------------------------------------------------*/
-
-TEE_Result TEE_EXPORT TEE_CheckMemoryAccessRights(uint32_t accessFlags,
- void* buffer, size_t size
- );
-
-void TEE_EXPORT TEE_SetInstanceData( void* instanceData );
-
-TEE_EXPORT void* TEE_GetInstanceData( void );
-
-/**
- * Allocates a block of memory from a heap. The address of the allocated block
- * is aligned on a 8-bytes boundary. A block allocated by {malloc} must
- * be freed by {free}.
- *
- * @param nSize Number of bytes to be allocated. A zero value is invalid.
- *
- * @return A pointer to the allocated memory block or
- * NULL if the block cannot be allocated.
- **/
-TEE_EXPORT void* TEE_Malloc(uint32_t size, uint32_t hint);
-
-/**
- * Reallocates a block of memory from a heap.
- * This function enables you to resize a memory block.
- *
- * If <tt>pBlock</tt> is NULL, {realloc} is equivalent to {malloc}.
- * In particular, if nNewSize is 0, the function returns NULL.
- *
- * If <tt>pBlock</tt> is not NULL and <tt>nNewSize</tt> is 0, then
- * {realloc} is equivalent to {free} and returns NULL.
- *
- * If <tt>nNewSize</tt> is less or equal to the current size of the block,
- * the block is trucated, the content of the block is left unchanged and
- * the function returns <tt>pBlock</tt>.
- *
- * If <tt>nNewSize</tt> is greater than the current size of the block, the size
- * of the block is increased. The whole content of the block is copied at the
- * beginning of the new block. If possible, the block is enlarged in place and
- * the function retuns <tt>pBlock</tt>. If this is not possible, a new block
- * is allocated with the new size, the content of the current block is copied,
- * the current block is freed and the function retuns the pointer on the new
- * block.
- * @param pBlock Pointer to the block of memory that the function
- * reallocates. This value may be null or returned by an
- * earlier call to the {malloc} or {realloc}
- * function.
- *
- * @param nNewSize New size of the memory block, in bytes.
- * This value may be zero. A memory block's size can be
- * increased or decreased by using this function.
- *
- * @return A pointer to the reallocated memory block or
- * NULL if <tt>nNewSize</tt> is zero or if an error is detected.
- **/
-TEE_EXPORT void* TEE_Realloc(void* buffer, uint32_t newSize);
-
-/**
- * Frees a memory block allocated from a heap by the {malloc} or
- * {realloc} function.
- *
- * This function does nothing if pBlock is set to NULL.
- *
- * @param pBlock Pointer to the memory block to be freed.
- * This pointer is returned by an earlier call
- * to the {malloc} or {realloc} function.
- **/
-void TEE_EXPORT TEE_Free(void *buffer);
-
-void TEE_EXPORT TEE_MemMove(void* dest, void* src, uint32_t size);
-
-int32_t TEE_EXPORT TEE_MemCompare(void* buffer1, void* buffer2, uint32_t size);
-
-void TEE_EXPORT TEE_MemFill(void* buffer, uint32_t x, uint32_t size );
-
-
-/*------------------------------------------------------------------------------
- Time Functions
- ------------------------------------------------------------------------------*/
-
-TEE_Result TEE_EXPORT TEE_Wait(uint32_t timeout);
-
-void TEE_EXPORT TEE_GetSystemTime(TEE_Time* time);
-
-void TEE_EXPORT TEE_GetREETime(TEE_Time* time);
-
-TEE_Result TEE_EXPORT TEE_GetTAPersistentTime(TEE_Time* time);
-
-TEE_Result TEE_EXPORT TEE_SetTAPersistentTime(TEE_Time* time);
-
-
-/*------------------------------------------------------------------------------
- Arithmetical Functions
-------------------------------------------------------------------------------*/
-
-typedef uint32_t TEE_BigInt;
-typedef uint32_t TEE_BigIntFMMContext;
-typedef uint32_t TEE_BigIntFMM;
-
-#define TEE_BigIntSizeInU32(n) ((((n)+31)/32)+2)
-
-void TEE_EXPORT TEE_BigIntInit(
- OUT TEE_BigInt *bigInt,
- IN size_t len);
-
-int32_t TEE_EXPORT TEE_BigIntCmp(
- IN TEE_BigInt *op1,
- IN TEE_BigInt *op2);
-
-int32_t TEE_EXPORT TEE_BigIntCmpS32(
- IN TEE_BigInt *op,
- IN int32_t shortVal);
-
-TEE_Result TEE_EXPORT TEE_BigIntConvertFromOctetString(
- OUT TEE_BigInt *dest,
- IN uint8_t *buffer,
- IN size_t bufferLen,
- IN int32_t sign);
-
-TEE_Result TEE_EXPORT TEE_BigIntConvertToOctetString(
- OUT void *buffer,
- OUT size_t *bufferLen,
- IN TEE_BigInt *bigInt);
-
-void TEE_EXPORT TEE_BigIntConvertFromS32(
- OUT TEE_BigInt *dest,
- IN int32_t shortVal);
-
-TEE_Result TEE_EXPORT TEE_BigIntConvertToS32(
- OUT int32_t *dest,
- IN TEE_BigInt *src);
-
-void TEE_EXPORT TEE_BigIntShiftRight(
- OUT TEE_BigInt *dest,
- IN TEE_BigInt *op,
- IN size_t bits);
-
-bool TEE_EXPORT TEE_BigIntGetBit(
- IN TEE_BigInt *src,
- IN uint32_t bitIndex);
-
-uint32_t TEE_EXPORT TEE_BigIntGetBitCount(
- IN TEE_BigInt *src);
-
-void TEE_EXPORT TEE_BigIntAdd(
- OUT TEE_BigInt *dest,
- IN TEE_BigInt *op1,
- IN TEE_BigInt *op2);
-
-void TEE_EXPORT TEE_BigIntSub(
- OUT TEE_BigInt *dest,
- IN TEE_BigInt *op1,
- IN TEE_BigInt *op2);
-
-size_t TEE_EXPORT TEE_BigIntFMMContextSizeInU32(
- size_t modulusSizeInBits);
-
-size_t TEE_EXPORT TEE_BigIntFMMSizeInU32(
- size_t modulusSizeInBits);
-
-void TEE_EXPORT TEE_BigIntInitFMMContext(
- OUT TEE_BigIntFMMContext *context,
- size_t len,
- IN TEE_BigInt *modulus);
-
-void TEE_EXPORT TEE_BigIntInitFMM(
- OUT TEE_BigIntFMM *bigIntFMM,
- size_t len);
-
-void TEE_EXPORT TEE_BigIntNeg(
- OUT TEE_BigInt *dest,
- IN TEE_BigInt *op);
-
-void TEE_EXPORT TEE_BigIntMul(
- OUT TEE_BigInt *dest,
- IN TEE_BigInt *op1,
- IN TEE_BigInt *op2);
-
-void TEE_EXPORT TEE_BigIntSquare(
- OUT TEE_BigInt *dest,
- IN TEE_BigInt *op);
-
-void TEE_EXPORT TEE_BigIntDiv(
- OUT TEE_BigInt *dest_q,
- OUT TEE_BigInt *dest_r,
- IN TEE_BigInt *op1,
- IN TEE_BigInt *op2);
-
-void TEE_EXPORT TEE_BigIntMod(
- OUT TEE_BigInt *dest,
- IN TEE_BigInt *op,
- IN TEE_BigInt *n);
-
-void TEE_EXPORT TEE_BigIntAddMod(
- OUT TEE_BigInt *dest,
- IN TEE_BigInt *op1,
- IN TEE_BigInt *op2,
- IN TEE_BigInt *n);
-
-void TEE_EXPORT TEE_BigIntSubMod(
- OUT TEE_BigInt *dest,
- IN TEE_BigInt *op1,
- IN TEE_BigInt *op2,
- IN TEE_BigInt *n);
-
-void TEE_EXPORT TEE_BigIntMulMod(
- OUT TEE_BigInt *dest,
- IN TEE_BigInt *op1,
- IN TEE_BigInt *op2,
- IN TEE_BigInt *n);
-
-void TEE_EXPORT TEE_BigIntSquareMod(
- OUT TEE_BigInt *dest,
- IN TEE_BigInt *op,
- IN TEE_BigInt *n);
-
-void TEE_EXPORT TEE_BigIntInvMod(
- OUT TEE_BigInt *dest,
- IN TEE_BigInt *op,
- IN TEE_BigInt *n);
-
-bool TEE_EXPORT TEE_BigIntRelativePrime(
- IN TEE_BigInt *op1,
- IN TEE_BigInt *op2);
-
-void TEE_EXPORT TEE_BigIntComputeExtendedGcd(
- OUT TEE_BigInt *gcd,
- OUT TEE_BigInt *u,
- OUT TEE_BigInt *v,
- IN TEE_BigInt *op1,
- IN TEE_BigInt *op2);
-
-int32_t TEE_EXPORT TEE_BigIntIsProbablePrime(
- IN TEE_BigInt *op,
- uint32_t confidenceLevel);
-
-void TEE_EXPORT TEE_BigIntConvertToFMM(
- OUT TEE_BigIntFMM *dest,
- IN TEE_BigInt *src,
- IN TEE_BigInt *n,
- IN TEE_BigIntFMMContext *context);
-
-void TEE_EXPORT TEE_BigIntConvertFromFMM(
- OUT TEE_BigInt *dest,
- IN TEE_BigIntFMM *src,
- IN TEE_BigInt *n,
- IN TEE_BigIntFMMContext *context);
-
-void TEE_EXPORT TEE_BigIntComputeFMM(
- OUT TEE_BigIntFMM *dest,
- IN TEE_BigIntFMM *op1,
- IN TEE_BigIntFMM *op2,
- IN TEE_BigInt *n,
- IN TEE_BigIntFMMContext *context);
-
- /*------------------------------------------------------------------------------
- Cryptographic Operations API
- ------------------------------------------------------------------------------*/
-
- /*------------------------------------------------------------------------------
- Generic Operations Functions
- ------------------------------------------------------------------------------*/
-TEE_Result TEE_EXPORT TEE_AllocateOperation(TEE_OperationHandle* operation,
- uint32_t algorithm,
- uint32_t mode,
- uint32_t maxKeySize);
-
-void TEE_EXPORT TEE_FreeOperation(TEE_OperationHandle operation);
-
-void TEE_EXPORT TEE_GetOperationInfo(TEE_OperationHandle operation,
- TEE_OperationInfo* operationInfo);
-
-
-void TEE_EXPORT TEE_ResetOperation(TEE_OperationHandle operation);
-
-TEE_Result TEE_EXPORT TEE_SetOperationKey(TEE_OperationHandle operation,
- TEE_ObjectHandle key);
-
-TEE_Result TEE_EXPORT TEE_SetOperationKey2(TEE_OperationHandle operation,
- TEE_ObjectHandle key1,
- TEE_ObjectHandle key2);
-
-void TEE_EXPORT TEE_CopyOperation(TEE_OperationHandle dstOperation,
- TEE_OperationHandle srcOperation);
-
-
-/* Message Digest Functions */
-void TEE_EXPORT TEE_DigestUpdate(TEE_OperationHandle operation,
- void* chunk,
- size_t chunkSize);
-
-TEE_Result TEE_EXPORT TEE_DigestDoFinal(TEE_OperationHandle operation,
- void* chunk,
- size_t chunkLen,
- void* hash,
- size_t* hashLen);
-
-/* Symmetric Cipher Functions */
-void TEE_EXPORT TEE_CipherInit(TEE_OperationHandle operation,
- void* IV,
- size_t IVLen);
-
-TEE_Result TEE_EXPORT TEE_CipherUpdate(TEE_OperationHandle operation,
- void* srcData,
- size_t srcLen,
- void* destData,
- size_t* destLen);
-
-TEE_Result TEE_EXPORT TEE_CipherDoFinal(TEE_OperationHandle operation,
- void* srcData,
- size_t srcLen,
- void* destData,
- size_t* destLen);
-
-/*----------------------------------------------------------------------------
- MAC Functions
------------------------------------------------------------------------------*/
-void TEE_EXPORT TEE_MACInit(TEE_OperationHandle operation,
- void* IV,
- size_t IVLen);
-
-void TEE_EXPORT TEE_MACUpdate(TEE_OperationHandle operation,
- void* chunk,
- size_t chunkSize);
-
-TEE_Result TEE_EXPORT TEE_MACComputeFinal(TEE_OperationHandle operation,
- void* message,
- size_t messageLen,
- void* mac,
- size_t* macLen);
-
-TEE_Result TEE_EXPORT TEE_MACCompareFinal(TEE_OperationHandle operation,
- void* message,
- size_t messageLen,
- void* mac,
- size_t macLen);
-
-/*----------------------------------------------------------------------------
- Authenticated Encryption Functions ----------------------------------------
- ---------------------------------------------------------------------------*/
-TEE_Result TEE_EXPORT TEE_AEInit(TEE_OperationHandle operation,
- void* nonce,
- size_t nonceLen,
- uint32_t tagLen,
- uint32_t AADLen,
- uint32_t payloadLen);
-
-void TEE_EXPORT TEE_AEUpdateAAD(TEE_OperationHandle operation,
- void* AADdata,
- size_t AADdataLen);
-
-TEE_Result TEE_EXPORT TEE_AEUpdate(TEE_OperationHandle operation,
- void* srcData,
- size_t srcLen,
- void* destData,
- size_t* destLen);
-
- TEE_Result TEE_EXPORT TEE_AEEncryptFinal(TEE_OperationHandle operation,
- void* srcData,
- size_t srcLen,
- void* destData,
- size_t* destLen,
- void* tag,
- size_t* tagLen);
-
-TEE_Result TEE_EXPORT TEE_AEDecryptFinal(TEE_OperationHandle operation,
- void* srcData,
- size_t srcLen,
- void* destData,
- size_t* destLen,
- void* tag,
- size_t tagLen);
-
-/*-----------------------------------------------------------------------------
- Asymmetric Functions
------------------------------------------------------------------------------*/
-TEE_Result TEE_EXPORT TEE_AsymmetricEncrypt(TEE_OperationHandle operation,
- TEE_Attribute* params,
- uint32_t paramCount,
- void* srcData,
- size_t srcLen,
- void* destData,
- size_t* destLen);
-
-TEE_Result TEE_EXPORT TEE_AsymmetricDecrypt(TEE_OperationHandle operation,
- TEE_Attribute* params,
- uint32_t paramCount,
- void* srcData,
- size_t srcLen,
- void* destData,
- size_t* destLen);
-
-TEE_Result TEE_EXPORT TEE_AsymmetricSignDigest(TEE_OperationHandle operation,
- TEE_Attribute* params,
- uint32_t paramCount,
- void* digest,
- size_t digestLen,
- void* signature,
- size_t* signatureLen);
-
-TEE_Result TEE_EXPORT TEE_AsymmetricVerifyDigest(TEE_OperationHandle operation,
- TEE_Attribute* params,
- uint32_t paramCount,
- void* digest,
- size_t digestLen,
- void* signature,
- size_t signatureLen);
-
-/*-----------------------------------------------------------------------------
- Key Derivation Functions
------------------------------------------------------------------------------*/
-void TEE_EXPORT TEE_DeriveKey(TEE_OperationHandle operation,
- TEE_Attribute* params,
- uint32_t paramCount,
- TEE_ObjectHandle derivedKey);
-
-
-/*-----------------------------------------------------------------------------
- Random Data Generation Function
------------------------------------------------------------------------------*/
-void TEE_EXPORT TEE_GenerateRandom(void* randomBuffer,
- size_t randomBufferLen);
-
-
-/*------------------------------------------------------------------------------
- Trusted Storage Functions
-------------------------------------------------------------------------------*/
-
-/* Generic Object Functions */
-void TEE_EXPORT TEE_GetObjectInfo(TEE_ObjectHandle object,
- TEE_ObjectInfo* objectInfo);
-
-void TEE_EXPORT TEE_RestrictObjectUsage(TEE_ObjectHandle object,
- uint32_t objectUsage);
-
-TEE_Result TEE_EXPORT TEE_GetObjectBufferAttribute(TEE_ObjectHandle object,
- uint32_t attributeID,
- void* buffer,
- size_t* size);
-
-TEE_Result TEE_EXPORT TEE_GetObjectValueAttribute(TEE_ObjectHandle object,
- uint32_t attributeID,
- uint32_t* a,
- uint32_t* b);
-
-void TEE_EXPORT TEE_CloseObject(TEE_ObjectHandle object);
-
-/* Transient Object Functions */
-TEE_Result TEE_EXPORT TEE_AllocateTransientObject(uint32_t objectType,
- uint32_t maxObjectSize,
- TEE_ObjectHandle* object);
-
-void TEE_EXPORT TEE_FreeTransientObject(TEE_ObjectHandle object);
-
-void TEE_EXPORT TEE_ResetTransientObject(TEE_ObjectHandle object);
-
-TEE_Result TEE_EXPORT TEE_PopulateTransientObject(TEE_ObjectHandle object,
- TEE_Attribute* attrs,
- uint32_t attrCount);
-
-void TEE_EXPORT TEE_InitRefAttribute(TEE_Attribute* attr,
- uint32_t attributeID,
- void* buffer,
- size_t length);
-
-void TEE_EXPORT TEE_InitValueAttribute(TEE_Attribute* attr,
- uint32_t attributeID,
- uint32_t a,
- uint32_t b);
-
-void TEE_EXPORT TEE_CopyObjectAttributes(TEE_ObjectHandle destObject,
- TEE_ObjectHandle srcObject);
-
-TEE_Result TEE_EXPORT TEE_GenerateKey(TEE_ObjectHandle object,
- uint32_t keySize,
- TEE_Attribute* params,
- uint32_t paramCount);
-
-/* Persistant Object Functions */
-TEE_Result TEE_EXPORT TEE_CreatePersistentObject(uint32_t storageID,
- void* objectID,
- size_t objectIDLen,
- uint32_t flags,
- TEE_ObjectHandle attributes,
- void* initialData,
- size_t initialDataLen,
- TEE_ObjectHandle* object);
-
-TEE_Result TEE_EXPORT TEE_OpenPersistentObject(uint32_t storageID,
- void* objectID,
- size_t objectIDLen,
- uint32_t flags,
- TEE_ObjectHandle* object);
-
-void TEE_EXPORT TEE_CloseAndDeletePersistentObject(TEE_ObjectHandle object);
-
-TEE_Result TEE_EXPORT TEE_RenamePersistentObject(TEE_ObjectHandle object,
- void* newObjectID,
- size_t newObjectIDLen);
-
-TEE_Result TEE_EXPORT TEE_AllocatePersistentObjectEnumerator(TEE_ObjectEnumHandle* objectEnumerator);
-
-void TEE_EXPORT TEE_FreePersistentObjectEnumerator(TEE_ObjectEnumHandle objectEnumerator);
-
-void TEE_EXPORT TEE_ResetPersistentObjectEnumerator(TEE_ObjectEnumHandle objectEnumerator);
-
-TEE_Result TEE_EXPORT TEE_StartPersistentObjectEnumerator(TEE_ObjectEnumHandle objectEnumerator,
- uint32_t storageID);
-
-TEE_Result TEE_EXPORT TEE_GetNextPersistentObject(TEE_ObjectEnumHandle objectEnumerator,
- TEE_ObjectInfo* objectInfo,
- void* objectID,
- size_t* objectIDLen);
-
-TEE_Result TEE_EXPORT TEE_ReadObjectData(TEE_ObjectHandle object,
- void* buffer,
- size_t size,
- uint32_t* count);
-
-TEE_Result TEE_EXPORT TEE_WriteObjectData(TEE_ObjectHandle object,
- void* buffer,
- size_t size);
-
-TEE_Result TEE_EXPORT TEE_TruncateObjectData(TEE_ObjectHandle object,
- uint32_t size);
-
-TEE_Result TEE_EXPORT TEE_SeekObjectData(TEE_ObjectHandle object,
- int32_t offset,
- TEE_Whence whence);
-
-#endif /* __TEE_INTERNAL_API_H__ */
diff --git a/mobicore/common/DrSecureStorage/tlDriverApi.h b/mobicore/common/DrSecureStorage/tlDriverApi.h
deleted file mode 100644
index 6f42056..0000000
--- a/mobicore/common/DrSecureStorage/tlDriverApi.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2013 TRUSTONIC LIMITED
- * All rights reserved
- *
- * The present software is the confidential and proprietary information of
- * TRUSTONIC LIMITED. You shall not disclose the present software and shall
- * use it only in accordance with the terms of the license agreement you
- * entered into with TRUSTONIC LIMITED. This software may be subject to
- * export or import laws in certain countries.
- */
-
-/**
- * @file tlDriverApi.h
- * @brief Contains trustlet API definitions
- *
- */
-
-#ifndef __TLDRIVERAPI_H__
-#define __TLDRIVERAPI_H__
-
-#include "tlStd.h"
-#include "TlApi/TlApiError.h"
-
-
-/**
- * Open session to the driver with given data
- *
- * @return session id
- */
-_TLAPI_EXTERN_C uint32_t tlApiOpenSession( void );
-
-
-/**
- * Close session
- *
- * @param sid session id
- *
- * @return TLAPI_OK upon success or specific error
- */
-_TLAPI_EXTERN_C tlApiResult_t tlApiCloseSession( uint32_t sid );
-
-
-/**
- * Inits session data (sample data 01)
- *
- * @param length data length
- * @param address data address
- *
- * @return TLAPI_OK upon success or specific error
- */
-_TLAPI_EXTERN_C tlApiResult_t tlApiInitSampleData01(
- uint32_t sid,
- uint32_t length,
- uint32_t address);
-
-
-/**
- * Inits session data (sample data 02)
- *
- * @param data
- *
- * @return TLAPI_OK upon success or specific error
- */
-_TLAPI_EXTERN_C tlApiResult_t tlApiInitSampleData02(
- uint32_t sid,
- uint32_t data);
-
-
-/**
- * Executes command
- *
- * @param sid session id
- * @param commandId command id
- *
- * @return TLAPI_OK upon success or specific error
- */
-_TLAPI_EXTERN_C tlApiResult_t tlApiExecute(
- uint32_t sid,
- uint32_t commandId);
-
-
-/** tlApi function to call driver via IPC.
- * Sends a MSG_RQ message via IPC to a MobiCore driver.
- *
- * @param driverID The driver to send the IPC to.
- * @param pMarParam MPointer to marshaling parameters to send to the driver.
- *
- * @return TLAPI_OK
- * @return E_TLAPI_COM_ERROR in case of an IPC error.
- */
-_TLAPI_EXTERN_C tlApiResult_t tlApi_callDriver(
- uint32_t driver_ID,
- void* pMarParam);
-
-
-#endif // __TLDRIVERAPI_H__
diff --git a/mobicore/common/LogWrapper/Android.mk b/mobicore/common/LogWrapper/Android.mk
new file mode 100644
index 0000000..b869c2b
--- /dev/null
+++ b/mobicore/common/LogWrapper/Android.mk
@@ -0,0 +1,15 @@
+# =============================================================================
+#
+# MobiCore log wrapper to be included by Android components / products
+#
+# =============================================================================
+
+# This is not a separate module.
+# Only for inclusion by other modules.
+
+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
diff --git a/mobicore/common/LogWrapper/log.h b/mobicore/common/LogWrapper/log.h
index 07d0872..0894827 100644
--- a/mobicore/common/LogWrapper/log.h
+++ b/mobicore/common/LogWrapper/log.h
@@ -1,41 +1,40 @@
-/** Log wrapper for Android.
- * @{
- * @file
+/*
+ * Copyright (c) 2013-2014 TRUSTONIC LIMITED
+ * All rights reserved.
*
- * Maps LOG_*() macros to __android_log_print() if LOG_ANDROID is defined.
- * Adds some extra info to log output like LOG_TAG, file name and line number.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
*
- * <!-- Copyright Trustonic 2012-2013 -->
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
*
- * 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. The name of the author may not be used to endorse or promote
- * products derived from this software without specific prior
- * written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ * 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.
+ */
+/** Log wrapper for Android.
+ * Maps LOG_*() macros to __android_log_print() if LOG_ANDROID is defined.
+ * Adds some extra info to log output like LOG_TAG, file name and line number.
*/
#ifndef TLCWRAPPERANDROIDLOG_H_
#define TLCWRAPPERANDROIDLOG_H_
-#include <errno.h>
-#include <string.h>
#ifndef WIN32
#include <unistd.h>
#define GETPID getpid
@@ -78,10 +77,11 @@
#define LOG_W(fmt, args...) DUMMY_FUNCTION()
#else
// add LINE
- #define LOG_I(fmt, args...) LOG_i(fmt , ## args)
- #define LOG_W(fmt, args...) LOG_w(fmt , ## args)
+ #define LOG_I(fmt, args...) LOG_i(fmt";%d", ## args, __LINE__)
+ #define LOG_W(fmt, args...) LOG_w(fmt";%d", ## args, __LINE__)
#endif
- #define LOG_E(fmt, args...) LOG_e("ERROR - %s():\n***** " fmt, __FUNCTION__, ## args)
+ // LOG_E is always defined
+ #define _LOG_E(fmt, args...) LOG_e(fmt, ## args)
// actually mapping to log system, adding level and tag.
#define LOG_i(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
@@ -107,10 +107,10 @@
#define LOG_I(fmt, ...) DUMMY_FUNCTION()
#define LOG_W(fmt, ...) DUMMY_FUNCTION()
#else
- #define LOG_I(...) _LOG_x("I", __VA_ARGS__)
- #define LOG_W(...) _LOG_x("W", __VA_ARGS__)
+ #define LOG_I(...) _LOG_x("I",__VA_ARGS__)
+ #define LOG_W(...) _LOG_x("W",__VA_ARGS__)
#endif
- #define _LOG_E(...) _LOG_x("E", __VA_ARGS__)
+ #define _LOG_E(...) _LOG_x("E",__VA_ARGS__)
#define LOG_i(...) printf(__VA_ARGS__)
#define LOG_w(...) printf(__VA_ARGS__)
@@ -124,7 +124,6 @@
#define LOG_V(...) DUMMY_FUNCTION()
#endif
-#if 0
/** LOG_E() needs to be more prominent:
* Display "*********** ERROR ***********" before actual error message.
*/
@@ -132,14 +131,13 @@
do \
{ \
_LOG_E(" *****************************"); \
- _LOG_E(" *** ERROR: ", __VA_ARGS__); \
+ _LOG_E(" *** ERROR: " __VA_ARGS__); \
_LOG_E(" *** Detected in %s/%u()", __FUNCTION__, __LINE__); \
_LOG_E(" *****************************"); \
} while(1!=1)
-#endif
#define LOG_ERRNO(MESSAGE) \
- LOG_E("%s -- %s (errno %d)", MESSAGE, strerror(errno), errno);
+ LOG_E("%s failed with \"%s\"(errno %i)", MESSAGE, strerror(errno), errno);
#define LOG_I_BUF LOG_I_Buf
@@ -175,13 +173,13 @@ static void LOG_I_Buf(
{
index += sprintf(&buffer[index], "memory dump");
}
- index += sprintf(&buffer[index], " (0x%08x, %d bytes)", (uint32_t)blob,sizeOfBlob);
+ index += sprintf(&buffer[index], " (%p, %zu bytes)", blob,sizeOfBlob);
LOG_I("%s", buffer);
index = 0;
}
else if (NULL == szDescriptor)
{
- index += sprintf(&buffer[index], "Data at 0x%08x: ", (uint32_t)blob);
+ index += sprintf(&buffer[index], "Data at %p: ", blob);
}
if(sizeOfBlob == 0) {
@@ -235,4 +233,3 @@ static void LOG_I_Buf(
#endif /** TLCWRAPPERANDROIDLOG_H_ */
-/** @} */
diff --git a/mobicore/common/MobiCore/inc/DrApi/DrApi.h b/mobicore/common/MobiCore/inc/DrApi/DrApi.h
deleted file mode 100644
index 9ae1187..0000000
--- a/mobicore/common/MobiCore/inc/DrApi/DrApi.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2013 TRUSTONIC LIMITED
- * All rights reserved
- *
- * The present software is the confidential and proprietary information of
- * TRUSTONIC LIMITED. You shall not disclose the present software and shall
- * use it only in accordance with the terms of the license agreement you
- * entered into with TRUSTONIC LIMITED. This software may be subject to
- * export or import laws in certain countries.
- */
-
-#ifndef __DRAPI_H__
-#define __DRAPI_H__
-
-#if defined(DRIVER)
-#include "drStd.h"
-#endif
-#include "DrApi/version.h"
-#include "DrApi/DrApiError.h"
-#include "DrApi/DrApiMcSystem.h"
-#include "DrApi/DrApiMm.h"
-#include "DrApi/DrApiThread.h"
-#include "DrApi/DrApiLogging.h"
-#include "DrApi/DrApiHeap.h"
-#include "DrApi/DrApiFastCall.h"
-#include "DrApi/DrApiTime.h"
-
-#endif // __DRAPI_H__
diff --git a/mobicore/common/MobiCore/inc/DrApi/DrApiCommon.h b/mobicore/common/MobiCore/inc/DrApi/DrApiCommon.h
deleted file mode 100644
index 973d86d..0000000
--- a/mobicore/common/MobiCore/inc/DrApi/DrApiCommon.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (c) 2013 TRUSTONIC LIMITED
- * All rights reserved
- *
- * The present software is the confidential and proprietary information of
- * TRUSTONIC LIMITED. You shall not disclose the present software and shall
- * use it only in accordance with the terms of the license agreement you
- * entered into with TRUSTONIC LIMITED. This software may be subject to
- * export or import laws in certain countries.
- */
-
-#ifndef __DRAPICOMMON_H__
-#define __DRAPICOMMON_H__
-
-#include "DrApi/DrApiError.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-//------------------------------------------------------------------------------
-/** Definitions */
-
-#define SHIFT_4KB (12U) /**< SIZE_4KB is 1 << SHIFT_4KB aka. 2^SHIFT_4KB. */
-#define SIZE_4KB (1 << SHIFT_4KB) /**< Size of 1 KiB. */
-typedef uint8_t page4KB_t[SIZE_4KB]; /**< 4 KiB page. */
-typedef page4KB_t *page4KB_ptr; /**< pointer to 4 KiB page. */
-
-#define PTR2VAL(p) ((uintptr_t)(p))
-#define VAL2PTR(v) ((addr_t)(v))
-#define FUNC_PTR(func) VAL2PTR( PTR2VAL( func ) )
-
-//Stack types
-typedef uint32_t stackEntry_t;
-typedef stackEntry_t *stackEntry_ptr;
-typedef stackEntry_ptr stackTop_ptr;
-
-//==============================================================================
-//Common integer types
-typedef unsigned int u32_t;
-typedef unsigned short u16_t;
-typedef unsigned char u08_t;
-typedef u32_t word_t;
-
-//Common result type
-typedef word_t drApiResult_t;
-
-//MTK types
-typedef word_t taskid_t, *taskid_ptr; /**< task id data type. */
-typedef word_t threadno_t, *threadno_ptr; /**< thread no. data type. */
-typedef word_t threadid_t, *threadid_ptr; /**< thread id data type. */
-
-
-// interrupt mode flags. The design of the bits is that most common setting
-// RISING, EDGE, PERIODIC maps to the value the value 0. Not all mode
-// combinations may be available for each interrupt.
-#define INTR_MODE_MASK_TRIGGER (1U<<0)
-#define INTR_MODE_TRIGGER_LEVEL INTR_MODE_MASK_TRIGGER
-#define INTR_MODE_TRIGGER_EDGE 0
-#define INTR_MODE_MASK_CONDITION (1U<<1)
-#define INTR_MODE_CONDITION_FALLING INTR_MODE_MASK_CONDITION
-#define INTR_MODE_CONDITION_LOW INTR_MODE_MASK_CONDITION
-#define INTR_MODE_CONDITION_RISING 0
-#define INTR_MODE_CONDITION_HIGH 0
-#define INTR_MODE_MASK_OCCURANCE (1U<<2)
-#define INTR_MODE_OCCURANCE_ONESHOT INTR_MODE_MASK_OCCURANCE
-#define INTR_MODE_OCCURANCE_PERIODIC 0
-
-// convenience constants
-#define INTR_MODE_RAISING_EDGE (INTR_MODE_TRIGGER_EDGE | INTR_MODE_CONDITION_RISING)
-#define INTR_MODE_FALLING_EDGE (INTR_MODE_TRIGGER_EDGE | INTR_MODE_CONDITION_FALLING)
-#define INTR_MODE_LOW_LEVEL (INTR_MODE_TRIGGER_LEVEL | INTR_MODE_CONDITION_LOW)
-#define INTR_MODE_HIGH_LEVEL (INTR_MODE_TRIGGER_LEVEL | INTR_MODE_CONDITION_HIGH)
-
-//Interrupt types
-typedef word_t intrNo_t, *intrNo_ptr; /**< interrupt number. */
-typedef word_t intrMode_t, *intrMode_ptr; /**< interrupt mode. */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //__DRAPICOMMON_H__
-
diff --git a/mobicore/common/MobiCore/inc/DrApi/DrApiError.h b/mobicore/common/MobiCore/inc/DrApi/DrApiError.h
deleted file mode 100644
index fbac0b1..0000000
--- a/mobicore/common/MobiCore/inc/DrApi/DrApiError.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2013 TRUSTONIC LIMITED
- * All rights reserved
- *
- * The present software is the confidential and proprietary information of
- * TRUSTONIC LIMITED. You shall not disclose the present software and shall
- * use it only in accordance with the terms of the license agreement you
- * entered into with TRUSTONIC LIMITED. This software may be subject to
- * export or import laws in certain countries.
- */
-
-#ifndef __DRAPIERROR_H__
-#define __DRAPIERROR_H__
-
-/*
- * DRAPI error codes.
- * MAJOR part of error code is stable.
- * MAJOR part may be used in testing for specific error code.
- *
- * Detail error codes may change in different releases
- * Please do not test DETAIL part when comparing error codes.
- */
-#define DRAPI_ERROR_MAJOR(ecode) ((ecode) & 0xFFF) /**< Get MAJOR part of error code. */
-#define DRAPI_ERROR_MAJOR_CODE(ecode) ((ecode) & 0xFF) /**< Get MAJOR_CODE part of error code. */
-#define DRAPI_ERROR_MAJOR_COMPONENT(ecode) (((ecode)>>8) & 0xF) /**< Get MAJOR_COMPONENT part of error code. */
-
-#define DRAPI_ERROR_DETAIL(ecode) (((ecode)>>12) & 0xFFF) /**< Get detail part of error code. */
-
-#define DRAPI_ERROR_CREATE(ecode, detail) (((ecode)&0xFFF)|((detail&0xFFF)<<12)) /**< Create error code */
-
-//==============================================================================
-// Error code defintitions
-
-#define DRAPI_OK 0x0 /**< Returns on successful execution of a function. */
-
-#define E_DRAPI_KERNEL_ERROR 0xF01 /**< Kernel returned error. */
-#define E_DRAPI_INVALID_PARAMETER 0xF02 /**< Invalid parameter. */
-#define E_DRAPI_NOT_PERMITTED 0xF03 /**< Permission error */
-#define E_DRAPI_IPC_ERROR 0xF04 /**< Error in IPC. */
-#define E_DRAPI_TASK_NOT_ACCEPTABLE 0xF05 /**< Task not acceptable for operation. */
-#define E_DRAPI_CANNOT_MAP 0xF06 /**< Cannot create mapping. */
-#define E_DRAPI_DRV_NO_SUCH_CLIENT 0xF07 /**< Client does not exist. */
-#define E_DRAPI_CANNOT_INIT 0xF08 /**< Cannot be initialized. */
-#define E_DRAPI_NOT_IMPLEMENTED 0xF09 /**< Function not yet implemented. */
-
-
-// Error codes inherited from MTK
-#define E_OK 0 /**< no error. */
-#define E_INVALID 1 /**< invalid argument. */
-#define E_BADTASK 2 /**< current task does not own target task. */
-#define E_NOTACTIVATED 3 /**< task has not been activated. */
-#define E_NOTOWNER 4 /**< current task does not own specified task. */
-#define E_ACTIVATED 5 /**< task has been activated. */
-#define E_LIMIT 6 /**< limit broken. */
-#define E_NOABILITY 7 /**< no permission. */
-#define E_STARTED 8 /**< task or thread does have been started. */
-#define E_BADMAP 9 /**< invalid mapping. architecture specific error. */
-#define E_MAPPED 10 /**< mapping overlaps existing mapping. */
-#define E_NOTSTARTED 11 /**< thread has been started. */
-#define E_TIMEOUT 12 /**< timeout period expired. */
-#define E_ABORT 13 /**< operation aborted. */
-#define E_MSGTYPE 14 /**< message to send is not of the type the receiver is waiting for. */
-#define E_MSGLENGTH 15 /**< message to send exceeds message length the receiver is waiting for. */
-
-
-#endif // __DRAPIERROR_H__
-
diff --git a/mobicore/common/MobiCore/inc/DrApi/DrApiFastCall.h b/mobicore/common/MobiCore/inc/DrApi/DrApiFastCall.h
deleted file mode 100644
index 6477fe3..0000000
--- a/mobicore/common/MobiCore/inc/DrApi/DrApiFastCall.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 2013 TRUSTONIC LIMITED
- * All rights reserved
- *
- * The present software is the confidential and proprietary information of
- * TRUSTONIC LIMITED. You shall not disclose the present software and shall
- * use it only in accordance with the terms of the license agreement you
- * entered into with TRUSTONIC LIMITED. This software may be subject to
- * export or import laws in certain countries.
- */
-
-#ifndef FASTCALL_H_
-#define FASTCALL_H_
-
-/** Firmware Driver and Fastcall Handlers
- *
- * Mobicore can have one firmware driver. Such driver is loaded
- * typically at boot, and cannot be unloaded. Firmware driver is
- * intended to act as system integration means, and is not intended
- * to act as typical peripheral driver.
- *
- * Fastcall handlers
- * Firmware driver can register fastcall handler in some platforms.
- * Fastcall handler is called for fastcalls unknown to Mobicore.
- *
- * Fastcall handlers get driver memory mappings in range of 0-2MB
- * at the time handler is installed. Driver must not unmap any of
- * these mappings. If new mappings are made, they cannot be relied
- * to be visible in fastcall hook function.
- *
- * Fastcall handler may map sections (of size 1M). These mappings are not
- * visible to driver.
- *
- * Fastcall handler gets access to number of registers at the time of
- * fastcall was made in NWd. Actual number of registers depends on
- * platform, but is always at least 4 (r0-r3).
- *
- * Notes on use of Fastcall handlers
- * Fastcall handlers
- * - cannot call any TlApi or DrApi functions.
- * - cannot have synchronization with firmware driver.
- * - do not have large stack. If stack is needed, switch to your own.
- * - may be executed concurrently in all CPUs.
- * - must not cause exceptions. There is no means to recover in case
- * of exception.
- *
- */
-
-#define FASTCALL_OWNER_TZOS (0xFF000000)
-#define FASTCALL_OWNER_SIP (0x81000000)
-#define FASTCALL_OWNER_OEM (0x83000000)
-#define FASTCALL_OWNER_STD (0x84000000)
-
-#define FASTCALL_OWNER_MASK (0xFF000000)
-
-#define FCH_L1_MAX 12
-
-typedef word_t *fastcall_registers_t;
-
-/** Context for FCs hook call
- *
- * This is (currently) shared between all processors
- */
-struct fcContext {
- word_t size; // Size of context
- // Callback to modify L1 entry.
- // idx is the address in MBytes of the entry to modify (starting at 8MB).
- // (for example idx=2 will modify the entry for address 10MB)
- // Return the virtual address corresponding to modified entry.
- // Return NULL if there is an error.
- // 64 bits version must be used to modify L1 table in LPAE mode.
- void *(*setL1Entry)(struct fcContext *context, word_t idx, word_t entry);
- word_t registers; // Number of registers available in fastcall
- void (*prepareIdenticalMapping)(struct fcContext *context, addr_t start, word_t length, word_t flags);
- void (*generateFcNotification)(struct fcContext *context);
- void *(*setL1Entry64)(struct fcContext *context, word_t idx, uint64_t entry);
-};
-
-/* Fastcall handler initialization
- *
- * Called once before any fastcall.
- * Can map memories for fastcall context.
- * This function must never cause any exceptions.
- * Call is executed in SVC mode.
- *
- * Return value
- * 0 Successfull initialization.
- * Other cancel hook installation
- */
-typedef word_t (*fcInitHook)(
- struct fcContext *context
-);
-
-
-/* Fastcall handler
- *
- * Executed possibly concurrently in all CPUs.
- * This function must never cause any exceptions.
- * Call is executed in IRQ mode.
- * On Entry
- * fastcall_regs_t[0]...fastcall_regs_t[15] contain input registers.
- * On exit
- * fastcall_regs_t[0]...fastcall_regs_t[N] contain r0...rN.
- * If driver did not handle fastcall, registers must be unmodified.
- * If driver handled fastcall registers r0...r3 may be modified.
- * Registers beyond r3 must not be modified. Result of any
- * modification is unpredictable.
- * Return values
- * Nonzero return value means that fastcall is handled.
- */
-typedef word_t (*fcEntryHook)(
- fastcall_registers_t *regs_t,
- struct fcContext *context
-);
-
-
-#endif /* FASTCALL_H_ */
diff --git a/mobicore/common/MobiCore/inc/DrApi/DrApiHeap.h b/mobicore/common/MobiCore/inc/DrApi/DrApiHeap.h
deleted file mode 100644
index 8f93a24..0000000
--- a/mobicore/common/MobiCore/inc/DrApi/DrApiHeap.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2013 TRUSTONIC LIMITED
- * All rights reserved
- *
- * The present software is the confidential and proprietary information of
- * TRUSTONIC LIMITED. You shall not disclose the present software and shall
- * use it only in accordance with the terms of the license agreement you
- * entered into with TRUSTONIC LIMITED. This software may be subject to
- * export or import laws in certain countries.
- */
-
-#ifndef __DRAPIHEAP_H__
-#define __DRAPIHEAP_H__
-
-#if TBASE_API_LEVEL >= 3
-
-#include "DrApi/DrApiCommon.h"
-#include "DrApi/DrApiError.h"
-
-/**
- * Allocates a block of memory from the heap.
- * The address of the allocated block is aligned on a 8-bytes boundary. A block
- * allocated by drApiMalloc must be freed by drApiFree.
- * If the size of the space requested is zero, the value returned is still a
- * non-NULL pointer that the Trusted Application must not attempt to access.
- *
- * @param size: [in] the number of bytes to be allocated.
- *
- * @param hint: [in] must be 0
- *
- * @return Upon successful completion, with size not equal to zero, the
- * function returns a pointer to the allocated space.
- * Otherwise, a NULL pointer is returned.
- **/
-_DRAPI_EXTERN_C void* drApiMalloc(uint32_t size, uint32_t hint);
-
-/**
- * Reallocates a block of memory from a heap.
- * This function allows resizing a memory block.
- * If buffer is NULL, drApiRealloc is equivalent to drApiMalloc.
- * If buffer is not NULL and newSize is 0, then drApiRealloc is equivalent to
- * drApiFree and returns a non-NULL pointer that the Trusted Application must
- * not attempt to access.
- * If newSize is less or equal to the current size of the block, the block is
- * truncated, the content of the block is left unchanged and the function
- * returns buffer.
- * If newSize is greater than the current size of the block, the size of the
- * block is increased. The whole content of the block is copied at the beginning
- * of the new block. If possible, the block is enlarged in place and the
- * function returns buffer. If this is not possible, a new block is allocated
- * with the new size, the content of the current block is copied, the current
- * block is freed and the function returns the pointer on the new block.
- *
- * @param buffer: [in] Pointer to the block of memory that the function
- * reallocates.
- * This value may be null or returned by an earlier call
- * to drApiMalloc or drApiRealloc.
- *
- * @param newSize: [in] size of the memory block in bytes.
- * This value may be zero.
- *
- * @return A pointer to the reallocated memory block, a non-NULL pointer if the
- * newSize is zero or NULL if an error is detected.
- **/
-_DRAPI_EXTERN_C void* drApiRealloc(void* buffer, uint32_t newSize);
-
-
-/**
- * Frees a memory block allocated from a heap by drApiMalloc or drApiRealloc.
- * This function does nothing if buffer is NULL.
- *
- * @param buffer: [in] Pointer to the block of memory to be freed.
- **/
-_DRAPI_EXTERN_C void drApiFree(void* buffer);
-
-#endif /* TBASE_API_LEVEL */
-
-#endif /* !defined(__DRAPIHEAP_H__) */
diff --git a/mobicore/common/MobiCore/inc/DrApi/DrApiIpcMsg.h b/mobicore/common/MobiCore/inc/DrApi/DrApiIpcMsg.h
deleted file mode 100644
index 410a6e3..0000000
--- a/mobicore/common/MobiCore/inc/DrApi/DrApiIpcMsg.h
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
- * Copyright (c) 2013 TRUSTONIC LIMITED
- * All rights reserved
- *
- * The present software is the confidential and proprietary information of
- * TRUSTONIC LIMITED. You shall not disclose the present software and shall
- * use it only in accordance with the terms of the license agreement you
- * entered into with TRUSTONIC LIMITED. This software may be subject to
- * export or import laws in certain countries.
- */
-#ifndef __DRAPI_IPCMSG_H__
-#define __DRAPI_IPCMSG_H__
-
-#include "DrApiCommon.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-//------------------------------------------------------------------------------
-/** Possible message types/event types of the system. */
-typedef enum {
- MSG_NULL = 0, // Used for initializing state machines
- MSG_RQ = 1,
- // Client Request, blocks until MSG_RS is received
- // Client -> Server
- MSG_RS = 2,
- // Driver Response, answer to MSG_RQ
- // Server -> Client
- MSG_RD = 3,
- // Driver becomes ready
- // Server -> IPCH
- MSG_NOT = 4,
- // Notification to NWd for a session, send-only message with no
- // response
- // client/server -> IPCH;
- MSG_CLOSE_TRUSTLET = 5,
- // Close Trustlet, must be answered by MSG_CLOSE_TRUSTLET_ACK
- // MSH -> IPCH, IPCH -> Server
- MSG_CLOSE_TRUSTLET_ACK = 6,
- // Close Trustlet Ack, in response to MSG_CLOSE_TRUSTLET
- // Server -> IPCH
- MSG_MAP = 7,
- // Map Client into Server, send-only message with no reponse
- //Server -> IPCH;
- MSG_ERR_NOT = 8,
- // Error Notification
- // EXCH/SIQH -> IPCH
- MSG_CLOSE_DRIVER = 9,
- // Close Driver, must be answered with MSG_CLOSE_DRIVER_ACK
- // MSH -> IPCH, IPCH -> Driver/Server
- MSG_CLOSE_DRIVER_ACK = 10,
- // Close Driver Ack, response to MSG_CLOSE_DRIVER
- // Driver/Server -> IPCH, IPCH -> MSH
- MSG_GET_DRIVER_VERSION = 11,
- // Get driver version, used for response also
- // Client <-> IPCH
- MSG_GET_DRAPI_VERSION = 12,
- // Get DrApi version, used for response also
- // Driver <-> IPCH */
- MSG_SET_NOTIFICATION_HANDLER = 13,
- // Set (change) the SIQ handler thread, used for response also
- // Driver <-> IPCH
- MSG_GET_REGISTRY_ENTRY = 14,
- // Get registry entry, available only if MC_FEATURE_DEBUG_SUPPORT is
- // set, used for response also
- // Driver <-> IPCH
- MSG_DRV_NOT = 15,
- // Notification to a Trustlet, looks like a notification from NWd for
- // the Trustlet, send-only message with no response
- // Driver -> Trustlet
- MSG_SET_FASTCALL_HANDLER = 16,
- // install a FastCall handler, used for response also
- // Driver <-> IPCH
- MSG_GET_CLIENT_ROOT_AND_SP_ID = 17,
- // get Root DI and SP ID, used for response also
- // Driver <-> IPCH
- MSG_SUSPEND = 18,
- // Suspend, requires MSG_SUSPEND_ACK as response
- // MSH -> IPCH, IPCH -> driver
- MSG_SUSPEND_ACK = 19,
- // Suspend Ack, response to MSG_SUSPEND
- // driver -> IPCH, IPCH -> MSH
- MSG_RESUME = 20,
- // resume, , requires MSG_RESUME_ACK as response
- // MSH -> IPCH, IPCH -> driver
- MSG_RESUME_ACK = 21,
- // resume, , response to MSG_RESUME
- // driver -> IPCH, IPCH -> MSH
- MSG_GET_ENDORSEMENT_SO = 22,
- // get SO from RTM for the Endorsement functionality
- // Driver <-> IPCH
- MSG_GET_SERVICE_VERSION = 23,
- // get version of service (TA)
- // Driver <-> IPCH
- MSG_ERROR = 24,
- // IPCH returns error to Driver
- // IPCH <-> DRIVER
- MSG_CALL_FASTCALL = 25,
- // Call fastcall from driver
- // DRIVER -> IPCH -> MTK -> FASTCALL -> return
-} message_t;
-
-
-//------------------------------------------------------------------------------
-/** Waits with infinite timeout for IPC.
- *
- * @param ipcPartner IPC partner to signal.
- * @param pMr0 IPC register 0.
- * @param pMr1 IPC register 1.
- * @param pMr2 IPC register 2.
- *
- * @returns DRAPI_OK in case of success
- * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code)
- */
-drApiResult_t drApiIpcWaitForMessage(
- threadid_t *pIpcPartner,
- uint32_t *pMr0,
- uint32_t *pMr1,
- uint32_t *pMr2
-);
-
-//------------------------------------------------------------------------------
-/**
- * Send ready message or answer to IPCH and waits for a client request
- *
- * @param ipcPeer Destination to send message to.
- * @param ipcMsg IPC message.
- * @param ipcData Additional IPC data.
- *
- * @returns DRAPI_OK in case of success
- * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code)
- */
-drApiResult_t drApiIpcCallToIPCH(
- threadid_t *pIpcPeer,
- message_t *pIpcMsg,
- uint32_t *pIpcData
-);
-
-//------------------------------------------------------------------------------
-/** Sets signal.
- * The signal (SIGNAL) is used by a thread to inform another thread about an event.
- * The signal operation is asynchronous, which means that the operation will return
- * immediately without blocking the user. Function uses auto-clear signals, meaning that
- * the signal is cleared automatically when the receiver receives it.
- *
- * It is up to the destination of the signal to pick up and process the information.
- *
- * @param receiver Thread to set the signal for.
- *
- * @returns DRAPI_OK in case of success
- * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code)
- */
-drApiResult_t drApiIpcSignal(
- const threadid_t receiver
-);
-
-//------------------------------------------------------------------------------
-/** Signal wait operation.
- * A thread uses the sigWait operation to check if a signal has occurred. If no signal is
- * pending the thread will block until a signal arrives.
- *
- * @returns DRAPI_OK in case of success
- * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code)
- */
-drApiResult_t drApiIpcSigWait( void );
-
-//------------------------------------------------------------------------------
-/** Notify NWd driver
- *
- * @returns DRAPI_OK in case of success
- * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code)
- */
-drApiResult_t drApiNotify( void );
-
-
-//------------------------------------------------------------------------------
-/**
- * Makes control syscall with given parameters
- *
- * @param controlid control id
- * @param param1 parameter 1
- * @param param2 parameter 2
- * @param param3 parameter 3
- * @param param4 parameter 4
- * @param *data set by control syscall
- *
- * @returns DRAPI_OK in case of success
- * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code)
- */
-drApiResult_t drApiSyscallControl(
- uint32_t controlid,
- uint32_t param1,
- uint32_t param2,
- uint32_t param3,
- uint32_t param4,
- uint32_t *data
-);
-
-
-//------------------------------------------------------------------------------
-/** Reads OEM data starting from given offset
- *
- * @param offset data offset
- * @param data set by control syscall
- *
- * @returns DRAPI_OK in case of success
- * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code)
- */
-drApiResult_t drApiReadOemData(
- const uint32_t offset,
- uint32_t *data
-);
-
-//------------------------------------------------------------------------------
-/** Sends notification to client
- *
- * @param client Client's thread id
- * *
- * @return MTK return code
- */
-drApiResult_t drApiNotifyClient(
- const threadid_t client
-);
-
-//------------------------------------------------------------------------------
-/** Returns ID of Root and Service Provider ID of the specified client
- *
- * @param rootId ID of Root
- * @param spId Service Provider ID
- * @param client Thread ID
- *
- * @returns DRAPI_OK in case of success
- * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code)
- */
-drApiResult_t drApiGetClientRootAndSpId(
- uint32_t *rootId,
- uint32_t *spId,
- const threadid_t client
-);
-
-
-//------------------------------------------------------------------------------
-/**
- * Handles unknown messages
- * This function has to be called by Driver if it receives a message it doesn’t recognize
- *
- * @param ipcPeer Sender of message.
- * @param ipcMsg IPC message.
- * @param ipcData Additional IPC data.
- *
- * @returns DRAPI_OK in case of success
- * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code)
- */
-drApiResult_t drApiIpcUnknownMessage(
- threadid_t *pIpcPeer,
- message_t *pIpcMsg,
- uint32_t *pIpcData
-);
-
-//------------------------------------------------------------------------------
-#if TBASE_API_LEVEL >= 3
-/**
- * Makes request to t-base to update notification thread
- *
- * @param threadNo Number of the new notification thread.
- *
- * @retval DRAPI_OK or relevant error code.
- */
-drApiResult_t drApiUpdateNotificationThread(
- threadno_t threadno
-);
-#endif /* TBASE_API_LEVEL */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /** __DRAPI_IPCMSG_H__ */
-
diff --git a/mobicore/common/MobiCore/inc/DrApi/DrApiLogging.h b/mobicore/common/MobiCore/inc/DrApi/DrApiLogging.h
deleted file mode 100644
index 8e59d5b..0000000
--- a/mobicore/common/MobiCore/inc/DrApi/DrApiLogging.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 2013 TRUSTONIC LIMITED
- * All rights reserved
- *
- * The present software is the confidential and proprietary information of
- * TRUSTONIC LIMITED. You shall not disclose the present software and shall
- * use it only in accordance with the terms of the license agreement you
- * entered into with TRUSTONIC LIMITED. This software may be subject to
- * export or import laws in certain countries.
- */
-
-#ifndef __DRAPILOGGING_H__
-#define __DRAPILOGGING_H__
-
-#include "DrApi/DrApiCommon.h"
-#include "DrApi/DrApiError.h"
-
-/** Formatted logging functions.
- *
- * drApiLogvPrintf, drApiLogPrintf
- *
- * Minimal printf-like function to print logging message to NWd log.
- *
- * Supported formatters:
- * %s String, NULL value emit "<NULL>".
- * %x %X hex
- * %p pointer (hex with fixed width of 8)
- * %d %i signed decimal
- * %u unsigned decimal
- * %t timestamp (if available in platform). NOTE: This does not consume any value in parameter list.
- * %% outputs single %
- *
- * %s, %x, %d, and %u support width (example %5s). Width is interpreted as minimum number of characters.
- * Hex number is left padded using '0' to desired width.
- * Decimal number is left padded using ' ' to desired width.
- * String is right padded to desired length.
- *
- * Newline is used to terminate logging line.
- *
- * @param fmt Formatter
- * @param args Argument list.
- */
-_DRAPI_EXTERN_C void drApiLogvPrintf(
- const char *fmt,
- va_list args);
-
-_DRAPI_EXTERN_C void drApiLogPrintf(
- const char *fmt,
- ...);
-
-#if defined(__INCLUDE_DEBUG)
-
- #define drDbgPrintf(...) drApiLogPrintf(__VA_ARGS__)
- #define drDbgvPrintf(...) drApiLogvPrintf(__VA_ARGS__)
-
-#else
-
- #define drDbgPrintf(...) DUMMY_FUNCTION()
- #define drDbgvPrintf(...) DUMMY_FUNCTION()
-
-#endif // __INCLUDE_DEBUG
-
-#ifndef EOL
- #define EOL "\n"
-#endif
-
-#define drDbgPrintLnf(...) do{drDbgPrintf(__VA_ARGS__);dbgS(EOL);}while(FALSE)
-
-
-#endif // __DRAPILOGGING_H__
-
diff --git a/mobicore/common/MobiCore/inc/DrApi/DrApiMcSystem.h b/mobicore/common/MobiCore/inc/DrApi/DrApiMcSystem.h
deleted file mode 100644
index d9a4f04..0000000
--- a/mobicore/common/MobiCore/inc/DrApi/DrApiMcSystem.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2013 TRUSTONIC LIMITED
- * All rights reserved
- *
- * The present software is the confidential and proprietary information of
- * TRUSTONIC LIMITED. You shall not disclose the present software and shall
- * use it only in accordance with the terms of the license agreement you
- * entered into with TRUSTONIC LIMITED. This software may be subject to
- * export or import laws in certain countries.
- */
-
-#ifndef __DRAPIMCSYSTEM_H__
-#define __DRAPIMCSYSTEM_H__
-
-#include "DrApiCommon.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** Get information about the implementation of the MobiCore Driver API version.
- *
- * @param drApiVersion pointer to Driver Api version.
- * @returns DRAPI_OK if version has been set
- * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code)
- */
-_DRAPI_EXTERN_C drApiResult_t drApiGetVersion(
- uint32_t *drApiVersion);
-
-/** Install fastcall handler
- *
- * @param entryTable pointer to entry table.
- * @param fastcallId fastcall ID.
- * @returns DRAPI_OK if version has been set
- * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code)
- */
-_DRAPI_EXTERN_C drApiResult_t drApiInstallFc(
- void *entryTable, uint32_t fastcallId);
-
-
-_DRAPI_EXTERN_C drApiResult_t drApiFastCall(
- uint32_t *fastcall_registers,
- uint32_t size);
-#ifdef __cplusplus
-}
-#endif
-
-#endif // __DRAPIMCSYSTEM_H__
-
diff --git a/mobicore/common/MobiCore/inc/DrApi/DrApiMm.h b/mobicore/common/MobiCore/inc/DrApi/DrApiMm.h
deleted file mode 100644
index 0ccd991..0000000
--- a/mobicore/common/MobiCore/inc/DrApi/DrApiMm.h
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- * Copyright (c) 2013 TRUSTONIC LIMITED
- * All rights reserved
- *
- * The present software is the confidential and proprietary information of
- * TRUSTONIC LIMITED. You shall not disclose the present software and shall
- * use it only in accordance with the terms of the license agreement you
- * entered into with TRUSTONIC LIMITED. This software may be subject to
- * export or import laws in certain countries.
- */
-
-#ifndef __DRAPIMM_H__
-#define __DRAPIMM_H__
-
-#include "DrApiCommon.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-//------------------------------------------------------------------------------
-/** Definitions */
-
-/** Memory mapping attributes. */
-#define MAP_READABLE (1U << 0) /**< mapping gives have the ability to do read access. */
-#define MAP_WRITABLE (1U << 1) /**< mapping gives have the ability to do write access. */
-#define MAP_EXECUTABLE (1U << 2) /**< mapping gives have the ability to do program execution. */
-#define MAP_UNCACHED (1U << 3) /**< mapping gives have uncached memory access. */
-#define MAP_IO (1U << 4) /**< mapping gives have memory mapped I/O access. Will ignore MAP_UNCACHED, as this would be implied anyway. */
-
-//------------------------------------------------------------------------------
-/** Maximum number of parameter . */
-#define MAX_MAR_LIST_LENGTH 8 /**< Maximum list of possible marshaling parameters. */
-/** Marshaled union. */
-typedef struct {
- uint32_t functionId; /**< Function identifier. */
- union {
- uint32_t parameter[MAX_MAR_LIST_LENGTH]; /* untyped parameter list (expands union to 8 entries) */
- } payload;
-} drApiMarshalingParam_t, *drApiMarshalingParam_ptr;
-
-
-//------------------------------------------------------------------------------
-/** Address translation from trustlet to Driver address space.
- * Translates an address/pointer given by a Trustlet to the Driver mapping.
- * Checks correct address range and null pointer.
- *
- * @param addr Address in trustlet address space.
- * @returns address in Driver virtual space
- * @returns NULL if address is equal to NULL or if address is out of D3-D8 address space
- */
-addr_t drApiAddrTranslateAndCheck(addr_t addr);
-
-//------------------------------------------------------------------------------
-#if TBASE_API_LEVEL >= 3
-
-/** Addresses translation for a buffer from trustlet to driver address space.
- * Checks that the buffer given by its start address and its length fits correct address range.
- * Translate the start address/pointer given by a trustlet to the driver's mapping.
- *
- * @param addr Start address of the buffer in trustlet address space.
- * @param len Length of the buffer
- * @returns start address in Driver virtual space
- * @returns NULL if address is equal to NULL or if the buffer is out of D3-D8 address space
- */
-addr_t drApiAddrTranslateAndCheckBuffer(addr_t adr, uint32_t len);
-
-#endif /* TBASE_API_LEVEL */
-
-//------------------------------------------------------------------------------
-/** Maps requesting client and return translated pointer to request parameters
- *
- * @param ipcReqClient client requesting a service
- * @param params pointer to marshaled parameter in client address space
- * @returns pointer to parameter for request in the current address space
- * @returns NULL in case of error
- */
-drApiMarshalingParam_ptr drApiMapClientAndParams(
- threadid_t ipcReqClient,
- uint32_t params
-);
-
-//------------------------------------------------------------------------------
-
-/** Maps a physical page to a virtual address.
- * All addresses and lengths must be multiples of page size (4K).
- *
- * @param startVirt virtual address in Driver address space
- * @param len Length of area
- * @param startPhys physical address of hardware
- * @param attr mapping attributes
- * @returns DRAPI_OK in case of success
- * @returns E_DRAPI_INVALID_PARAMETER in case any input parameter is not page size aligned or designated virtual memory area does not fit into D1-D2 address range
- * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code)
- */
-
-drApiResult_t drApiMapPhys(
- const addr_t startVirt,
- const uint32_t len,
- const addr_t startPhys,
- const uint32_t attr
-);
-#if TBASE_API_LEVEL >= 3
-drApiResult_t drApiMapPhys64(
- const addr_t startVirt,
- const uint32_t len,
- const uint64_t startPhys,
- const uint32_t attr
-);
-#endif /* TBASE_API_LEVEL */
-
-/** Removes mapping for virtual pages.
- * All addresses and lengths must be multiples of page size (4K).
- *
- * @param startVirt virtual address in Driver address space
- * @param len Length of area
- * @returns DRAPI_OK in case of success
- * @returns E_DRAPI_INVALID_PARAMETER in case any input parameter is not page size aligned or designated virtual memory area does not fit into D1-D2 address range
- * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code)
- */
-
-drApiResult_t drApiUnmap(
- const addr_t startVirt,
- const uint32_t len
-);
-
-//------------------------------------------------------------------------------
-/** The function removes mapping for a single page.
- *
- * @param startVirt virtual address in Driver address space
- * @returns DRAPI_OK in case of success
- * @returns E_DRAPI_INVALID_PARAMETER in case any input parameter is not page size aligned or designated virtual memory area does not fit into D1-D2 address range
- * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code)
- */
-drApiResult_t drApiUnmapPage4KB(
- const page4KB_ptr virtPage
-);
-
-//------------------------------------------------------------------------------
-/** Maps a single physical page to a virtual address
- *
- * @param physPage virtual address in Driver address space
- * @param startPhys physical address of hardware
- * @param attr mapping attributes
- * @returns DRAPI_OK in case of success
- * @returns E_DRAPI_INVALID_PARAMETER in case any input parameter is not page size aligned or designated virtual memory area does not fit into D1-D2 address range
- * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code)
- */
-drApiResult_t drApiMapPhysPage4KB(
- const page4KB_ptr virtPage,
- const page4KB_ptr physPage,
- const uint32_t attr
-);
-#if TBASE_API_LEVEL >= 3
-drApiResult_t drApiMapPhysPage4KB64(
- const page4KB_ptr virtPage,
- const uint64_t physPage,
- const uint32_t attr
-);
-#endif /* TBASE_API_LEVEL */
-
-//------------------------------------------------------------------------------
-/** Maps a physical page with hardware interface
- * This is prepared auxiliary function that at first removes mapping of the virtPage (if present)
- * and then maps it with MAP_READABLE | MAP_WRITABLE | MAP_IO attributes
- *
- * @param physPage virtual address in Driver address space
- * @param startPhys physical address of hardware
- * @returns DRAPI_OK in case of success
- * @returns E_DRAPI_INVALID_PARAMETER in case any input parameter is not page size aligned or designated virtual memory area does not fit into D1-D2 address range
- * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code)
- */
-drApiResult_t drApiMapPhysPage4KBWithHardware(
- const page4KB_ptr virtPage,
- const page4KB_ptr physPage
-);
-#if TBASE_API_LEVEL >= 3
-drApiResult_t drApiMapPhysPage4KBWithHardware64(
- const page4KB_ptr virtPage,
- const uint64_t physPage
-);
-#endif /* TBASE_API_LEVEL */
-
-//------------------------------------------------------------------------------
-/** Converts virtual address (in Driver address space) to physical address
- *
- * @param taskid Reserved for Future Use. It must be set to zero.
- * @param virtAddr virtual address in Driver address space
- * @param physAddr physical address
- * @returns DRAPI_OK in case of success
- * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code)
- */
-drApiResult_t drApiVirt2Phys(
- const taskid_t taskid,
- const addr_t virtAddr,
- addr_t * physAddr
-);
-#if TBASE_API_LEVEL >= 3
-drApiResult_t drApiVirt2Phys64(
- const taskid_t taskid,
- const addr_t virtAddr,
- uint64_t * physAddr
-);
-#endif /* TBASE_API_LEVEL */
-
-//------------------------------------------------------------------------------
-/** Clean all data cache
- *
- * NOTE: Currently addr is always NULL.
- * When extending this for not-clean-all, one can assume that there is
- * more parameters ONLY if addr is non-NULL.
- * Also this ensures that more specific cleans are mapped to cleanall, if specific clean is not supported.
- *
- * @param none
- * @returns DRAPI_OK in case of success
- * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code)
- */
-drApiResult_t drApiCacheDataCleanAll( void );
-
-
-//------------------------------------------------------------------------------
-/** Cleans and invalidates all data cache
- *
- * NOTE: Currently addr is always NULL.
- * When extending this for not-clean-invalidate-all, one can assume that there is
- * more parameters ONLY if addr is non-NULL.
- * Also this ensures that more specific cleans are mapped to cleanall, if specific clean is not supported.
- *
- * @param none
- * @returns DRAPI_OK in case of success
- * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code)
- */
-drApiResult_t drApiCacheDataCleanInvalidateAll( void );
-
-
-//------------------------------------------------------------------------------
-#if TBASE_API_LEVEL >= 3
-
-/** Clean a portion of the data cache by MVA
- *
- * @param virtAddrStart
- * @param virtAddrEnd
- * @returns DRAPI_OK in case of success
- * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code)
- */
-drApiResult_t drApiCacheDataCleanRange(
- addr_t *virtAddrStart,
- uint32_t len,
- uint32_t flags
-);
-
-
-//------------------------------------------------------------------------------
-/** Cleans and invalidates a portion of data cache by MVA
- *
- * @param virtAddrStart
- * @param virtAddrEnd
- * @returns DRAPI_OK in case of success
- * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code)
- */
-drApiResult_t drApiCacheDataCleanInvalidateRange(
- addr_t *virtAddrStart,
- uint32_t len,
- uint32_t flags
-);
-
-//------------------------------------------------------------------------------
-/** Cache clean attributes */
-#define DRAPI_CACHE_ALL (0xff)
-#define DRAPI_CACHE_L1_ONLY (0x1)
-#define DRAPI_CACHE_L1_L2 (0x2)
-#endif /* TBASE_API_LEVEL */
-
-//------------------------------------------------------------------------------
-/** Memory type attributes */
-#define DRAPI_PHYS_MEM_TYPE_HIGH_SECURE (1U<<0) /**< High secure memory. (Typically iRam) */
-#define DRAPI_PHYS_MEM_TYPE_SECURE (1U<<1) /**< Secure memory in Dram */
-#define DRAPI_PHYS_MEM_TYPE_NON_SECURE (1U<<2) /**< NonSecure memory in Dram. Accessible from NonSecure world */
-
-/** Returns physical memory type (secure or non-secure)
- *
- * @param type pointer to address where type is returned
- * @param addr start address of checked memory
- * @param size size checked memory
- * @returns E_OK in case of success
- */
-
-drApiResult_t drApiGetPhysMemType(
- uint32_t *type,
- addr_t addr,
- uint32_t size
- );
-#if TBASE_API_LEVEL >= 3
-drApiResult_t drApiGetPhysMemType64(
- uint32_t *type,
- uint64_t addr,
- uint32_t size
- );
-#endif /* TBASE_API_LEVEL */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // __DRAPIMM_H__
diff --git a/mobicore/common/MobiCore/inc/DrApi/DrApiThread.h b/mobicore/common/MobiCore/inc/DrApi/DrApiThread.h
deleted file mode 100644
index 45c297f..0000000
--- a/mobicore/common/MobiCore/inc/DrApi/DrApiThread.h
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- * Copyright (c) 2013 TRUSTONIC LIMITED
- * All rights reserved
- *
- * The present software is the confidential and proprietary information of
- * TRUSTONIC LIMITED. You shall not disclose the present software and shall
- * use it only in accordance with the terms of the license agreement you
- * entered into with TRUSTONIC LIMITED. This software may be subject to
- * export or import laws in certain countries.
- */
-
-#ifndef __DRAPI_THREAD_H__
-#define __DRAPI_THREAD_H__
-
-#include "DrApiCommon.h"
-#include "DrApiIpcMsg.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-//------------------------------------------------------------------------------
-/** Definitions */
-#define NILTASK 0 /**< returns NILTASK. */
-#define NILTHREAD 0 /**< returns NILTHREAD. */
-
-#define MAX_PRIORITY (15U) /**< maximum priority of a task or thread. */
-
-#if defined(DRIVER)
-#define ANYINTR 0x0000FFFF /**< returns ANYINTR. */
-#endif
-
-#define TASK_THREAD_QUOTA_SHL 24
-#define TASK_TIME_QUOTA_MASK ((1 << TASK_THREAD_QUOTA_SHL) - 1) /**< mask to get/set time quota of a task. */
-#define TIME_INFINITE ((time_t)TASK_TIME_QUOTA_MASK) /**< returns infinite. */
-
-/* Control ids for drApiThreadExRegs() API call */
-#define THREAD_EX_REGS_IP (1U << 0) /**< currently set instruction pointer of the thread is replaced by the specified instruction pointer. */
-#define THREAD_EX_REGS_SP (1U << 1) /**< currently set stack pointer of the thread is replaced by the specified stack pointer. */
-
-//------------------------------------------------------------------------------
-// Time data type
-typedef word_t time_t, *time_ptr;
-
-
-//------------------------------------------------------------------------------
-/**
- * Returns task ID for current task.
- *
- * @returns taskid
- * @returns 0 in case of any error
- */
-taskid_t drApiGetTaskid( void );
-
-//------------------------------------------------------------------------------
-/**
- * The function returns thread ID corresponding to task ID and thread number specified.
- *
- * @param taskid taskid having the thread.
- * @param threadno Thread number in task.
- *
- * @returns Thread ID in case of success
- * @returns 0 if task ID or thread number are invalid.
- */
-threadid_t drApiTaskidGetThreadid(
- taskid_t taskid,
- threadno_t threadNo
-);
-
-//------------------------------------------------------------------------------
-/**
- * The function returns thread ID for current task corresponding to thread number specified.
- *
- * @param threadNo Thread number in current task.
- *
- * @returns Thread ID in case of success
- * @returns 0 thread number is invalid.
- *
- */
-threadid_t drApiGetLocalThreadid(
- threadno_t threadNo
-);
-
-//------------------------------------------------------------------------------
-/** Suspend current thread.
- *
- * @param timeout Time to suspend thread.
- *
- * @returns DRAPI_OK in case of success
- * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code)
- */
-drApiResult_t drApiThreadSleep(
- time_t timeout
-);
-
-//------------------------------------------------------------------------------
-/** Starts a thread in Driver.
- * @param threadNo Thread number in task.
- * @param threadEntry Thread entry function
- * @param stackPointer Thread top stack pointer (declared statically using DECLARE_STACK)
- * @param priority Thread priority (Maximum level is defined as MAX_PRIORITY, higher priority level corresponds to higher priority thread)
- * @param localExceptionHandler The parameter specifies the number of a thread that serves as an exception handler
- *
- * @returns DRAPI_OK in case of success
- * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code)
- */
-drApiResult_t drApiStartThread(
- const threadno_t threadNo,
- const addr_t threadEntry,
- const stackTop_ptr stackPointer,
- const uint32_t priority,
- const threadno_t localExceptionHandlerThreadNo
-);
-
-
-//------------------------------------------------------------------------------
-/** Stop a thread in Driver.
- * If thread no. of thread to stop is set to NILTHREAD,
- * the current thread is stopped. The to stopped thread is detached from any
- * previously attached interrupts. If any thread is waiting for stopped thread
- * to do any ipc, this ipc is aborted.
- *
- * @param threadNo Thread number in task.
- *
- * @returns DRAPI_OK in case of success
- * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code)
- */
-
-drApiResult_t drApiStopThread(
- const threadno_t threadNo
-);
-
-
-//------------------------------------------------------------------------------
-/** Resumes a thread in Driver.
- *
- * @param threadNo Thread number in task.
- *
- * @returns DRAPI_OK in case of success
- * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code)
- */
-
-drApiResult_t drApiResumeThread(
- const threadno_t threadNo
-);
-
-
-//------------------------------------------------------------------------------
-/** Sets priority level for a thread in Driver.
- * @param threadNo Thread number in task.
- * @param priority Thread priority (Maximum level is defined as MAX_PRIORITY, higher priority level corresponds to higher priority thread)
- *
- * @returns DRAPI_OK in case of success
- * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code)
- */
-drApiResult_t drApiSetThreadPriority(
- const threadno_t threadNo,
- const uint32_t priority
-);
-
-//------------------------------------------------------------------------------
-/**
- * Sets the value registers for specified thread.
- * if the @ref THREAD_EX_REGS_IP bit of argument ctrl is set, the currently set instruction pointer is exchanged by the value of the argument ip (3).
- * if the @ref THREAD_EX_REGS_SP bit of argument ctrl is set, the currently set stack pointer is exchanged by the value of the argument sp (4).
- *
- * @param threadNo Number of the thread.
- * @param ctrl Control flags
- * @param ip ip value
- * @param sp sp value
- *
- * @returns DRAPI_OK in case of success
- * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code)
- */
-drApiResult_t drApiThreadExRegs(
- const threadno_t threadNo,
- const uint32_t ctrl,
- const addr_t ip,
- const addr_t sp
-);
-
-//------------------------------------------------------------------------------
-#if TBASE_API_LEVEL >= 3
-/**
- * Restart an internal thread with given IP and SP.
- *
- * @param threadNo Number of the thread.
- * @param ip ip value
- * @param sp sp value
- *
- * @retval DRAPI_OK or relevant error code.
- */
-drApiResult_t drApiRestartThread(
- const threadno_t threadno,
- const addr_t ip,
- const addr_t sp
-);
-#endif /* TBASE_API_LEVEL */
-
-//------------------------------------------------------------------------------
-/** Attaches an interrupt with the specified trigger condition to current thread.
- * Please refer to the target platform specific MobiCore documentation about
- * the trigger modes supported for each interrupt. In most cases, the mode
- * parameters will be INTR_MODE_RAISING_EDGE, as interrupts usually indicate
- * that a certain event has happened.
- *
- * @param intrNo interrupt number.
- * @param intrMode interrupt mode.
- *
- * @returns DRAPI_OK in case of success
- * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code)
- */
-drApiResult_t drApiIntrAttach(
- intrNo_t intrNo,
- intrMode_t intrMode
-);
-
-
-//------------------------------------------------------------------------------
-/** Detaches interrupt from current thread.
- *
- * @param intrNo interrupt number.
- *
- * @returns DRAPI_OK in case of success
- * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code)
- */
-drApiResult_t drApiIntrDetach(
- intrNo_t intrNo
-);
-
-//------------------------------------------------------------------------------
-/** Wait with infinite timeout for interrupt message from kernel.
- *
- * @param intrNo interrupt number (if ANYINTR is used, the interrupt is returned in the parameter intrRet).
- * @param timeout timeout to wait (allowed the same values as for MTK signal_wait()).
- * @param pIntrRet receives interrupt. Parameter can be NULL if caller does not need this.
- *
- * @returns DRAPI_OK in case of success
- * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code)
- */
-drApiResult_t drApiWaitForIntr(
- const intrNo_t intrNo,
- const uint32_t timeout,
- intrNo_t *pIntrRet
-);
-
-//------------------------------------------------------------------------------
-/**
- * Trigger software interrupt in the NWd to notify it.
- *
- * @param intrNo interrupt number.
- *
- * @returns DRAPI_OK in case of success
- * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code)
- */
-drApiResult_t drApiTriggerIntr(
- intrNo_t intrNo
-);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // __DRAPI_THREAD_H__
diff --git a/mobicore/common/MobiCore/inc/DrApi/version.h b/mobicore/common/MobiCore/inc/DrApi/version.h
deleted file mode 100644
index b8621b4..0000000
--- a/mobicore/common/MobiCore/inc/DrApi/version.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * Copyright (c) 2013 TRUSTONIC LIMITED
- * All rights reserved
- *
- * The present software is the confidential and proprietary information of
- * TRUSTONIC LIMITED. You shall not disclose the present software and shall
- * use it only in accordance with the terms of the license agreement you
- * entered into with TRUSTONIC LIMITED. This software may be subject to
- * export or import laws in certain countries.
- */
-#ifndef DRAPI_VERSION_H_
-#define DRAPI_VERSION_H_
-
-#define DRAPI_VERSION_MAJOR 1
-#define DRAPI_VERSION_MINOR 1
-
-#endif /** DRAPI_VERSION_H_ */
diff --git a/mobicore/common/MobiCore/inc/FwDrv/DrApiFastCall.h b/mobicore/common/MobiCore/inc/FwDrv/DrApiFastCall.h
deleted file mode 100644
index 6477fe3..0000000
--- a/mobicore/common/MobiCore/inc/FwDrv/DrApiFastCall.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 2013 TRUSTONIC LIMITED
- * All rights reserved
- *
- * The present software is the confidential and proprietary information of
- * TRUSTONIC LIMITED. You shall not disclose the present software and shall
- * use it only in accordance with the terms of the license agreement you
- * entered into with TRUSTONIC LIMITED. This software may be subject to
- * export or import laws in certain countries.
- */
-
-#ifndef FASTCALL_H_
-#define FASTCALL_H_
-
-/** Firmware Driver and Fastcall Handlers
- *
- * Mobicore can have one firmware driver. Such driver is loaded
- * typically at boot, and cannot be unloaded. Firmware driver is
- * intended to act as system integration means, and is not intended
- * to act as typical peripheral driver.
- *
- * Fastcall handlers
- * Firmware driver can register fastcall handler in some platforms.
- * Fastcall handler is called for fastcalls unknown to Mobicore.
- *
- * Fastcall handlers get driver memory mappings in range of 0-2MB
- * at the time handler is installed. Driver must not unmap any of
- * these mappings. If new mappings are made, they cannot be relied
- * to be visible in fastcall hook function.
- *
- * Fastcall handler may map sections (of size 1M). These mappings are not
- * visible to driver.
- *
- * Fastcall handler gets access to number of registers at the time of
- * fastcall was made in NWd. Actual number of registers depends on
- * platform, but is always at least 4 (r0-r3).
- *
- * Notes on use of Fastcall handlers
- * Fastcall handlers
- * - cannot call any TlApi or DrApi functions.
- * - cannot have synchronization with firmware driver.
- * - do not have large stack. If stack is needed, switch to your own.
- * - may be executed concurrently in all CPUs.
- * - must not cause exceptions. There is no means to recover in case
- * of exception.
- *
- */
-
-#define FASTCALL_OWNER_TZOS (0xFF000000)
-#define FASTCALL_OWNER_SIP (0x81000000)
-#define FASTCALL_OWNER_OEM (0x83000000)
-#define FASTCALL_OWNER_STD (0x84000000)
-
-#define FASTCALL_OWNER_MASK (0xFF000000)
-
-#define FCH_L1_MAX 12
-
-typedef word_t *fastcall_registers_t;
-
-/** Context for FCs hook call
- *
- * This is (currently) shared between all processors
- */
-struct fcContext {
- word_t size; // Size of context
- // Callback to modify L1 entry.
- // idx is the address in MBytes of the entry to modify (starting at 8MB).
- // (for example idx=2 will modify the entry for address 10MB)
- // Return the virtual address corresponding to modified entry.
- // Return NULL if there is an error.
- // 64 bits version must be used to modify L1 table in LPAE mode.
- void *(*setL1Entry)(struct fcContext *context, word_t idx, word_t entry);
- word_t registers; // Number of registers available in fastcall
- void (*prepareIdenticalMapping)(struct fcContext *context, addr_t start, word_t length, word_t flags);
- void (*generateFcNotification)(struct fcContext *context);
- void *(*setL1Entry64)(struct fcContext *context, word_t idx, uint64_t entry);
-};
-
-/* Fastcall handler initialization
- *
- * Called once before any fastcall.
- * Can map memories for fastcall context.
- * This function must never cause any exceptions.
- * Call is executed in SVC mode.
- *
- * Return value
- * 0 Successfull initialization.
- * Other cancel hook installation
- */
-typedef word_t (*fcInitHook)(
- struct fcContext *context
-);
-
-
-/* Fastcall handler
- *
- * Executed possibly concurrently in all CPUs.
- * This function must never cause any exceptions.
- * Call is executed in IRQ mode.
- * On Entry
- * fastcall_regs_t[0]...fastcall_regs_t[15] contain input registers.
- * On exit
- * fastcall_regs_t[0]...fastcall_regs_t[N] contain r0...rN.
- * If driver did not handle fastcall, registers must be unmodified.
- * If driver handled fastcall registers r0...r3 may be modified.
- * Registers beyond r3 must not be modified. Result of any
- * modification is unpredictable.
- * Return values
- * Nonzero return value means that fastcall is handled.
- */
-typedef word_t (*fcEntryHook)(
- fastcall_registers_t *regs_t,
- struct fcContext *context
-);
-
-
-#endif /* FASTCALL_H_ */
diff --git a/mobicore/common/MobiCore/inc/GP/tee_type.h b/mobicore/common/MobiCore/inc/GP/tee_type.h
deleted file mode 100644
index 8cf5898..0000000
--- a/mobicore/common/MobiCore/inc/GP/tee_type.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/**
- * Copyright (c) 2013 TRUSTONIC LIMITED
- * All rights reserved
- *
- * The present software is the confidential and proprietary information of
- * TRUSTONIC LIMITED. You shall not disclose the present software and shall
- * use it only in accordance with the terms of the license agreement you
- * entered into with TRUSTONIC LIMITED. This software may be subject to
- * export or import laws in certain countries.
- */
-
-/**
- * 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
-# ifdef __cplusplus
-# define NULL 0
-# else
-# define NULL ((void *)0)
-# endif
-#endif
-
-#define IN
-#define OUT
-
-/*
- * Definition of other common types
- */
-
-// to delete when all completed
-typedef uint32_t TEE_Result;
-typedef TEE_Result TEEC_Result;
-
-typedef uint32_t TEE_HANDLE;
-
-/** Definition of an UUID (from RFC 4122 http://www.ietf.org/rfc/rfc4122.txt) */
-typedef struct TEE_UUID {
- uint32_t timeLow;
- uint16_t timeMid;
- uint16_t timeHiAndVersion;
- uint8_t clockSeqAndNode[8];
-} TEE_UUID;
-typedef TEE_UUID TEEC_UUID;
-
-/** Type definition for a TEE Identity */
-typedef struct TEE_Identity {
- uint32_t login;
- TEE_UUID uuid;
-} TEE_Identity;
-
-typedef struct __TEE_PropSetHandle {
- unsigned char reserved;
-} __TEE_PropSetHandle;
-
-typedef struct __TEE_PropSetHandle* TEE_PropSetHandle;
-
-/* Property Sets Pseudo Handles */
-#define TEE_PROPSET_CURRENT_TA (TEE_PropSetHandle)0xFFFFFFFF
-#define TEE_PROPSET_CURRENT_CLIENT (TEE_PropSetHandle)0xFFFFFFFE
-#define TEE_PROPSET_TEE_IMPLEMENTATION (TEE_PropSetHandle)0xFFFFFFFD
-
-
-/* DLL Import/Export directives */
-
-#if defined(WIN32) || defined(__ARMCC_VERSION) || defined(__WINSCW__) || defined(_WIN32_WCE)
-# define S_DLL_EXPORT __declspec(dllexport)
-# define S_DLL_IMPORT __declspec(dllimport)
-# define S_NO_RETURN __declspec(noreturn)
-#elif defined(__GNUC__)
-# define S_DLL_EXPORT __attribute__ ((visibility ("default")))
-# define S_DLL_IMPORT __attribute__ ((visibility ("default")))
-# define S_NO_RETURN __attribute__ ((noreturn))
-#else
-# define S_DLL_EXPORT
-# define S_DLL_IMPORT
-# define S_NO_RETURN
-#endif
-
-#if defined(_MSC_VER)
-#define __func__ __FUNCTION__
-#endif
-
-#endif /* __TEE_TYPE_H__ */
diff --git a/mobicore/common/MobiCore/inc/GP/uuid_attestation.h b/mobicore/common/MobiCore/inc/GP/uuid_attestation.h
deleted file mode 100644
index ab8f1be..0000000
--- a/mobicore/common/MobiCore/inc/GP/uuid_attestation.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * Copyright (c) 2013 TRUSTONIC LIMITED
- * All rights reserved
- *
- * The present software is the confidential and proprietary information of
- * TRUSTONIC LIMITED. You shall not disclose the present software and shall
- * use it only in accordance with the terms of the license agreement you
- * entered into with TRUSTONIC LIMITED. This software may be subject to
- * export or import laws in certain countries.
- */
-
-#ifndef __TEE_UUID_ATTESTATION_H__
-#define __TEE_UUID_ATTESTATION_H__
-
-#include "tee_type.h"
-
-// Sizes of the fields of attestation structure
-#define AT_MAGIC_SIZE 8
-#define AT_SIZE_SIZE sizeof(uint32_t)
-#define AT_VERSION_SIZE sizeof(uint32_t)
-#define AT_UUID_SIZE sizeof(TEE_UUID)
-
-// Sizes of the fields used to generate signature
-#define AT_TAG_SIZE 20
-#define AT_SHA1_HASH_SIZE 20
-
-// Max size of RSA modulus supported
-#define AT_MODULUS_MAX_SIZE 256
-// Max size of RSA public exponent supported
-#define AT_PUBLIC_EXPO_MAX_SIZE 4
-
-// Attestation version
-#define AT_VERSION 1
-
-// Name space ID (the UUID of the RSA OID)
-const uint8_t RSA_OID_UUID[AT_UUID_SIZE] = {0x6b, 0x8e, 0x02, 0x6b, 0x63, 0xc1, 0x5d, 0x58, 0xb0, 0x64, 0x00, 0xd3, 0x51, 0x89, 0xce, 0x65};
-// Magic word
-const char MAGIC[AT_MAGIC_SIZE] = "TAUUID\0";
-
-// Tag for signature generation
-const char TAG[AT_TAG_SIZE]="Trusted Application";
-
-// Public key structure
-typedef struct uuid_public_key {
- uint32_t type; // TEE TYPE RSA KEYPAIR: 0xa0000030
- uint16_t modulus_bytes; // Length of the modulus in bytes
- uint16_t exponent_bytes; // Length of the exponent in bytes
- uint8_t data[]; // Key material
-} uuid_public_key;
-
-// Attestation structure
-typedef struct uuid_attestation {
- uint8_t magic[AT_MAGIC_SIZE]; // Magic word: "TAUUID\0\0"
- uint32_t size; // Attestation size (4 bytes)
- uint32_t version; // Version number: 1 (4 bytes)
- uint8_t uuid[AT_UUID_SIZE]; // UUID
- uuid_public_key key; // Public key
-} uuid_attestation;
-
-#endif /* __TEE_UUID_ATTESTATION_H__ */
diff --git a/mobicore/common/MobiCore/inc/McLib/GpTci.h b/mobicore/common/MobiCore/inc/McLib/GpTci.h
index 3a561fb..47df0f2 100644
--- a/mobicore/common/MobiCore/inc/McLib/GpTci.h
+++ b/mobicore/common/MobiCore/inc/McLib/GpTci.h
@@ -28,7 +28,6 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-
#ifndef _GP_TCI_H_
#define _GP_TCI_H_
@@ -78,11 +77,6 @@ typedef struct {
uint32_t returnStatus;
} _TEEC_TCI;
-#define TEEC_MEMREF_WHOLE 0xC
-#define TEEC_MEMREF_PARTIAL_INPUT 0xD
-#define TEEC_MEMREF_PARTIAL_OUTPUT 0xE
-#define TEEC_MEMREF_PARTIAL_INOUT 0xF
-
/**
* Termination codes
*/
diff --git a/mobicore/common/MobiCore/inc/McLib/TlApiCryptoMarshal.h b/mobicore/common/MobiCore/inc/McLib/TlApiCryptoMarshal.h
deleted file mode 100644
index 641a0ce..0000000
--- a/mobicore/common/MobiCore/inc/McLib/TlApiCryptoMarshal.h
+++ /dev/null
@@ -1,388 +0,0 @@
- /*
- * Copyright (c) 2013 TRUSTONIC LIMITED
- * All rights reserved
- *
- * The present software is the confidential and proprietary information of
- * TRUSTONIC LIMITED. You shall not disclose the present software and shall
- * use it only in accordance with the terms of the license agreement you
- * entered into with TRUSTONIC LIMITED. This software may be subject to
- * export or import laws in certain countries.
- *
- *
- * @addtogroup TlApi
- * @{
- * @file
- * Marshaling types and declarations.
- *
- * Functions for the marshaling of function ID and parameters.
- *
- */
-
-#ifndef __TLAPICRYPTOMARSHAL_H__
-#define __TLAPICRYPTOMARSHAL_H__
-
-
-#include "mcDriverId.h"
-
-#include "TlApi/TlApiError.h"
-#include "TlApi/TlApiCrypto.h"
-#include "TlApi/TlApiSecurity.h"
-#include "TlApi/TlApiMcSystem.h"
-#include "TlApi/TlApiTime.h"
-
-
-/** Each function must have its own ID.
- * Extend this list if you add a new function.
- */
-typedef enum {
- FID_KPD_GRAB_KEYPAD = 0, /**< Function to reserve the keypad. */
- FID_KPD_GET_C, /**< Function to read a character from the keypad. */
- FID_KPD_GET_MULTIPLE_C, /**< Function to read multiple characters from the keypad. */
- FID_KPD_RELEASE_KEYPAD /**< Function to release the grabbed keypad. */
-} kpdFuncID_t;
-
-
-/** Each function must have its own ID.
- * Extend this list if you add a new function.
- */
-typedef enum {
- FID_CRYPTO_MD = 0, /**< ID for message digest algorithms. */
- FID_CRYPTO_MD_INIT = 1, /**< Function to init a message digest. */
- FID_CRYPTO_MD_INIT_WITH_DATA = 2, /**< Function to init a message digest with data. */
- FID_CRYPTO_MD_UPDATE = 3, /**< Function to update a message digest. */
- FID_CRYPTO_MD_DOFINAL = 4, /**< Function to finalize a message digest. */
-
- FID_CRYPTO_SIG = 5, /**< ID for signature algorithms. */
- FID_CRYPTO_SIG_INIT = 6, /**< Function to init a signature. */
- FID_CRYPTO_SIG_INIT_WITH_DATA = 7, /**< Function to init a signature with data. */
- FID_CRYPTO_SIG_UPDATE = 8, /**< Function to update a signature. */
- FID_CRYPTO_SIG_SIGN = 9, /**< Function to make a signature. */
- FID_CRYPTO_SIG_VERIFY = 10, /**< Function to verify a signature. */
-
- FID_CRYPTO_RNG = 11, /**< ID for RNG algorithms. */
- FID_CRYPTO_RNG_GENERATE_DATA = 12, /**< Function to generate random data. */
-
- FID_CRYPTO_CIPHER = 13, /**< ID for cipher algorithms. */
- FID_CRYPTO_CIPHER_INIT = 14, /**< Function to init a cipher. */
- FID_CRYPTO_CIPHER_INIT_WITH_DATA = 15, /**< Function to init a cipher with data. */
- FID_CRYPTO_CIPHER_UPDATE = 16, /**< Function to update a cipher. */
- FID_CRYPTO_CIPHER_DOFINAL = 17, /**< Function to finalize a cipher. */
-
- FID_CRYPTO_SESSION_ABORT = 18, /**< Function to abort a crypto session. */
-
- FID_CRYPTO_GENERATE_KEY_PAIR = 19, /**< Function to generate a key pair. */
- FID_CRYPTO_GENERATE_KEY_PAIR_BUFFER = 20, /**< Function to generate a key pair into a buffer. */
-
- FID_SECURITY_WRAP_OBJECT = 21, /**< Function to wrap given data and create a secure object. */
- FID_SECURITY_UNWRAP_OBJECT = 22, /**< Function to unwrap given secure object and create plaintext data. */
- FID_SECURITY_GET_SUID = 23, /**< Function to acquire System on chip Unique ID. */
- FID_SECURITY_IS_DEVICE_BOUND = 24, /**< Currently not used. */
- FID_SECURITY_BIND_DEVICE = 25, /**< Currently not used. */
-
- FID_SYSTEM_GET_VERSION = 26, /**< Function to get information about the underlying MobiCore version. */
-
- FID_SECURITY_GET_TIME_STAMP = 27, /**< Function to get a secure time stamp. */
-
- FID_SECURITY_DERIVE_KEY = 28, /**< Function to derive key. */
-
- FID_CRYPTO_MD_DOFINAL_WITHOUT_CLOSE = 29, /**< Function to finalize a message digest without close. */
- FID_CRYPTO_OVERWRITE_KEY = 30, /**< Function to overwrite key. */
- FID_CRYPTO_MAC_INIT = 31, /**< Function to initialize hmac structures with key that is earlier given. */
- FID_CRYPTO_SIG_SIGN_WITHOUT_CLOSE = 32, /**< Function to finalize a sign without close. */
- FID_CRYPTO_SIG_VERIFY_WITHOUT_CLOSE = 33, /**< Function to finalize a verify without close. */
- FID_CRYPTO_CIPHER_WITHOUT_CLOSE = 34, /**< Function to finalize a cipher without close. */
- FID_SECURITY_ENDORSE = 35, /**< Function to create endorsement */
-
- FID_CRYPTO_CIPHER_UPDATE_IV = 36, /**< Function to update cipher IV */
-
-} cryptoFuncID_t;
-
-
-/** Marshaled function parameters.
- * structs and union of marshaling parameters via TlApi.
- *
- * @note The structs can NEVER be packed !
- * @note The structs can NOT used via sizeof(..) !
- */
-typedef struct {
- tlApiCrSession_t sessionHandle; /* handle of session to be aborted */
-} tlApiCrAbort_t, *tlApiCrAbort_ptr;
-
-
-typedef struct {
- tlApiKeyPair_t *keyPair; /* reference to key pair structure */
- tlApiKeyPairType_t type; /* see enum keyPairType_t */
- size_t len; /* requested byte length of keys */
- uint8_t *buffer; /* reference to buffer into which generated key components are written */
- size_t bufferLen; /* length of buffer for generated components */
-} tlApiCrGenerateKeyPair_t, *tlApiCrGenerateKeyPair_ptr;
-
-
-typedef struct {
- tlApiCrSession_t *pSessionHandle; /* reference to generated Cipher session handle */
- tlApiCipherAlg_t alg; /* see enum cipherMode_t */
- tlApiCipherMode_t mode; /* TLAPI_MODE_ENCRYPT or TLAPI_MODE_DECRYPT */
- const tlApiKey_t *key; /* key for this session */
- const uint8_t *buffer; /* reference to algorithm specific data like initial values for CBC */
- size_t bufferLen; /* length of buffer containing algorithm specific data */
-} tlApiCipherInit_t, *tlApiCipherInit_ptr;
-
-typedef struct {
- tlApiCrSession_t sessionHandle; /* handle of a running Cipher session */
- const uint8_t *srcData; /* reference to input data to be encrypted/decrypted */
- size_t srcLen; /* byte length of input data to be encrypted/decrypted */
- uint8_t *destData; /* reference to result area */
- size_t *destLen; /* [in] byte length of output buffer. [out] byte length of generated output data */
-} tlApiCipherUpdate_t, *tlApiCipherUpdate_ptr;
-
-
-typedef struct {
- tlApiCrSession_t sessionHandle; /* handle of a running Cipher session */
- const uint8_t *srcData; /* reference to input data to be encrypted/decrypted */
- size_t srcLen; /* byte length of input data to be encrypted/decrypted */
- uint8_t *destData; /* reference to result area */
- size_t *destLen; /* [in] byte length of buffer for output data. [out] byte length of generated output */
-} tlApiCipherDoFinal_t, *tlApiCipherDoFinal_ptr;
-
-
-typedef struct {
- tlApiCrSession_t *pSessionHandle; /* reference to generated Signatures session handle */
- const tlApiKey_t *key; /* key for this session */
- tlApiSigMode_t mode; /* TLAPI_MODE_SIGN or TLAPI_MODE_VERIFY */
- tlApiSigAlg_t alg; /* see enum of algorithms */
- const uint8_t *buffer; /* reference to algorithm specific data like seed for hash */
- size_t bufferLen; /* length of buffer containing algorithm specific data */
-} tlApiSignatureInit_t, *tlApiSignatureInit_ptr;
-
-
-typedef struct {
- tlApiCrSession_t sessionHandle; /* handle of a running Signature session */
- const uint8_t *message; /* reference to message to be signed/verified */
- size_t messageLen; /* byte length of message */
-} tlApiSignatureUpdate_t, *tlApiSignatureUpdate_ptr;
-
-
-typedef struct {
- tlApiCrSession_t sessionHandle; /* handle of a running Signature session */
- const uint8_t *message; /* reference to message to be signed */
- size_t messageLen; /* byte length of message */
- uint8_t *signature; /* reference to generated signature */
- size_t *signatureLen; /* [in] byte length of signature buffer. [out] byte length of generated signature */
-} tlApiSignatureSign_t, *tlApiSignatureSign_ptr;
-
-
-typedef struct {
- tlApiCrSession_t sessionHandle; /* handle of a running Signature session */
- const uint8_t *message; /* reference to message to be verified */
- size_t messageLen; /* byte length of message */
- const uint8_t *signature; /* reference to signature to be verified */
- size_t signatureLen; /* byte length of signature */
- bool *validity; /* reference to verification result, TRUE if verified, otherwise FALSE */
-} tlApiSignatureVerify_t, *tlApiSignatureVerify_ptr;
-
-typedef struct {
- tlApiCrSession_t *pSessionHandle; /* reference to generated Message Digest session handle */
- tlApiMdAlg_t alg; /* see enum mdAlg_t */
- const uint8_t *buffer; /* reference to previously calculated hash data */
- const uint8_t *lenPreHashedData; /* byte array in big endian format containing length of previously calculated hash */
-} tlApiMessageDigestInit_t, *tlApiMessageDigestInit_ptr;
-
-
-typedef struct {
- tlApiCrSession_t sessionHandle; /* handle of a running session Message Digest session */
- const uint8_t *message; /* reference to message to be hashed */
- size_t messageLen; /* byte length of input data to be hashed */
-} tlApiMessageDigestUpdate_t, *tlApiMessageDigestUpdate_ptr;
-
-
-typedef struct {
- tlApiCrSession_t sessionHandle; /* handle of a running session Message Digest session */
- const uint8_t *message; /* reference to message to be hashed */
- size_t messageLen; /* byte length of message */
- uint8_t *hash; /* reference to generated hash */
- size_t *hashLen; /* [in] byte length of hash buffer. [out] byte length of generated hash data */
-} tlApiMessageDigestDoFinal_t, *tlApiMessageDigestDoFinal_ptr;
-
-
-typedef struct {
- tlApiRngAlg_t alg; /* see enum randomDataGenerationAlg_t */
- uint8_t *randomBuffer; /* reference to generated random data */
- size_t *randomLen; /* byte length of requested random data */
-} tlApiRandomGenerateData_t, *tlApiRandomGenerateData_ptr;
-
-
-typedef struct {
- uint32_t unused; /* place holder - unused !!! */
-} tlApiGrabKeypad_t, *tlApiGrabKeypad_ptr;
-
-
-typedef struct {
- uint32_t *c; /* pointer to the rx-character */
- uint32_t timeout; /* time in milliseconds to wait */
-} tlApiGetKeypadEvent_t, *tlApiGetKeypadEvent_ptr;
-
-
-typedef struct {
- uint32_t unused; /* place holder - unused !!! */
-} tlApiReleaseKeypadGrab_t, *tlApiReleaseKeypadGrab_ptr;
-
-
-typedef struct {
- const void *src; /* Source data. */
- size_t plainLen; /* Length of header. */
- size_t encryptedLen; /* Length of payload to encrypt. */
- void *dest; /* Destination buffer (secure object). */
- size_t *destLen; /* [in] Length of the destination buffer.
- [out] Length of output data. */
- mcSoContext_t context; /* Context of operation. */
- mcSoLifeTime_t lifetime; /** Secure object lifetime and flags combined. */
- const tlApiSpTrustletId_t *consumer; /* NULL or trustlet identifier for delegated wrapping. */
-} tlApiWrapObject_t, *tlApiWrapObject_ptr;
-
-
-typedef struct {
- void *src; /* Source data (secure object). */
- void *dest; /* Destination buffer (unwrapped data). */
- size_t *destLen; /* [in] Length of the destination buffer.
- [out] Length of output data. */
- size_t srcLen; /* [in] Length of the source buffer. */
- uint32_t flags; /* [in] Flags for unwrap. */
-} tlApiUnwrapObject_t, *tlApiUnwrapObject_ptr;
-
-
-typedef struct {
- mcSuid_t *suid; /**< System on chip Unique ID */
-} tlApiGetSuid_t, *tlApiGetSuid_ptr;
-
-
-typedef struct {
- mcVersionInfo_t *mcVersionInfo; /**< Version of MobiCore */
-} tlApiGetMcVersion_t, *tlApiGetMcVersion_ptr;
-
-
-typedef struct {
- timestamp_t *ts; /**< Returned time stamp */
- tsSource_t source; /**< Requested timer source */
-} tlApiGetTimeStamp_t, *tlApiGetTimeStamp_ptr;
-
-
-typedef struct {
- const void *seed; /* Source seed. */
- size_t seedLen; /* Length of seed. */
- void *dest; /* Destination buffer (key). */
- size_t destLen; /* Length of the destination buffer. */
- mcSoContext_t context; /* Context of operation. */
- mcSoLifeTime_t lifetime; /** key lifetime. */
-} tlApiDeriveKey_t, *tlApiDeriveKey_ptr;
-
-typedef struct {
- tlApiCrSession_t sessionHandle; /* handle of a running session Message Digest session */
- const uint8_t *message; /* reference to message to be hashed */
- size_t messageLen; /* byte length of message */
- uint8_t *hash; /* reference to generated hash */
- size_t *hashLen; /* [in] byte length of hash buffer. [out] byte length of generated hash data */
-} tlApiMessageDigestDoFinalWithOutClose_t, *tlApiMessageDigestDoFinalWithOutClose_ptr;
-
-typedef struct {
- tlApiCrSession_t sessionHandle;
- const tlApiKey_t *keyData;
-} tlApiOverwriteKey_t, *tlApiOverwriteKey_ptr;
-
-typedef struct {
- tlApiCrSession_t sessionHandle;
- uint8_t *iv;
- size_t ivLen;
-} tlApiMacInit_t, *tlApiMacInit_ptr;
-
-typedef struct {
- tlApiCrSession_t sessionHandle;
- const uint8_t *iv;
- size_t ivLen;
-} tlApiCipherUpdateIV_t, *tlApiCipherUpdateIV_ptr;
-
-#define STH_PUBLIC_FILE_NAME_SIZE 20
-typedef struct S_UUID_t {
- uint32_t timeLow;
- uint16_t timeMid;
- uint16_t timeHiAndVersion;
- uint8_t clockSeqAndNode[8];
-} UUID_t;
-
-typedef enum {
- STH_MESSAGE_TYPE_LOOK = 0,
- STH_MESSAGE_TYPE_READ,
- STH_MESSAGE_TYPE_WRITE,
- STH_MESSAGE_TYPE_DELETE
-} tlApiStorageOps_t;
-
-typedef struct {
- uint32_t status;
- uint8_t type;
- uint8_t reserved0;
- uint16_t flags;
- uint32_t payloadLen;
- UUID_t uuid;
- unsigned char filename[STH_PUBLIC_FILE_NAME_SIZE];
- unsigned char payload[];
-} STH_TA_message_t;
-
-/*typedef struct {
- storageOps_t operation;
- union {
- storageLook_t look;
- storageRead_t read;
- storageWrite_t write;
- storageDelete_t del;
- }payload;
-} marshalingParam;*/ // merge to marshalingParam
-
-typedef struct {
- const void *msg; /* Source message. */
- size_t msgLen; /* Length of message. */
- void *dst; /* Destination buffer (endorsement). */
- size_t *dstLen; /* Length of the destination buffer. */
- mcScope_t scope; /* Scope of the endorsement. */
-} tlApiEndorse_t;
-
-/** Maximum number of parameter . */
-#define MAX_MAR_LIST_LENGTH 8 /**< Maximum list of possible marshaling parameters. */
-
-/** Marshaled union. */
-typedef struct {
- uint32_t functionId; /**< Function identifier. */
- union {
- tlApiCrAbort_t crAbort;
- tlApiCrGenerateKeyPair_t crGenerateKeyPair;
- tlApiCipherInit_t cipherInit;
- tlApiCipherUpdate_t cipherUpdate;
- tlApiCipherDoFinal_t cipherDoFinal;
- tlApiSignatureInit_t signatureInit;
- tlApiSignatureUpdate_t signatureUpdate;
- tlApiSignatureSign_t signatureSign;
- tlApiSignatureVerify_t signatureVerify;
- tlApiMessageDigestInit_t messageDigestInit;
- tlApiMessageDigestUpdate_t messageDigestUpdate;
- tlApiMessageDigestDoFinal_t messageDigestDoFinal;
- tlApiRandomGenerateData_t randomGenerateData;
- tlApiGrabKeypad_t grabKeypad;
- tlApiGetKeypadEvent_t getKeypadEvent;
- tlApiReleaseKeypadGrab_t releaseKeypadGrab;
- tlApiWrapObject_t wrapObject;
- tlApiUnwrapObject_t unwrapObject;
- tlApiGetSuid_t getSuid;
- tlApiGetMcVersion_t getVersion;
- tlApiGetTimeStamp_t getTimeStamp;
- tlApiDeriveKey_t deriveKey;
- tlApiOverwriteKey_t overwriteKey;
- tlApiMacInit_t macInit;
- tlApiEndorse_t endorse;
- tlApiCipherUpdateIV_t cipherUpdateIV;
- tlApiResult_t retVal;
- STH_TA_message_t taMessage;
- uint32_t parameter[MAX_MAR_LIST_LENGTH]; /* untyped parameter list (expands union to 8 entries) */
- } payload;
-} marshalingParamCR_t, *marshalingParamCR_ptr;
-
-#endif // __TLAPICRYPTOMARSHAL_H__
-
-/** @} */
diff --git a/mobicore/common/MobiCore/inc/McLib/TlApiStorageMarshal.h b/mobicore/common/MobiCore/inc/McLib/TlApiStorageMarshal.h
deleted file mode 100644
index b1848eb..0000000
--- a/mobicore/common/MobiCore/inc/McLib/TlApiStorageMarshal.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 2013 TRUSTONIC LIMITED
- * All rights reserved
- *
- * The present software is the confidential and proprietary information of
- * TRUSTONIC LIMITED. You shall not disclose the present software and shall
- * use it only in accordance with the terms of the license agreement you
- * entered into with TRUSTONIC LIMITED. This software may be subject to
- * export or import laws in certain countries.
- */
-
-
-#ifndef __TEE_STORAGE_H__
-#define __TEE_STORAGE_H__
-#include <mcstd.h>
-#include <mcutil.h>
-
-#include "tee_internal_api.h"
-#include "TlApi/TlApi.h"
-
-#include "TlApiCryptoMarshal.h"
-#include "TlApiImpl.h"
-
-#define MC_FLAG_FILE_MAY_EXIST ( 1 << 0 )
-#define MC_DRV_ID_STORAGE 0x0200
-
-#define TLAPI_FNC_CR_SIGN_INIT_ID 19
-#define TLAPI_FNC_CR_SIGN_UPDATE_ID 20
-#define TLAPI_FNC_CR_SIGN_SIGN_ID 21
-#define TLAPI_FNC_CR_SIGN_VERIFY_ID 22
-
-
-/* ** should be put in TlApiMarshal.h ** */
-typedef struct
-{
- uint32_t dataLen;
- uint32_t position;
- unsigned char objectID[TEE_OBJECT_ID_MAX_LEN];
- unsigned char data[0];
-}_TEE_PersistentData;
-
-
-typedef struct
-{
- uint32_t flags;
- uint8_t version;
- uint8_t objectIDLen;
- uint16_t cryptoLen;
- _TEE_PersistentData *persistent;
- unsigned char crypto[0];
-}TEE_FileObject;
-
-typedef struct
-{
- uint32_t flags;
- uint8_t version;
- uint8_t objectIDLen;
- uint16_t cryptoLen;
- _TEE_PersistentData *persistent;
-}__TEE_ObjectHandle;
-
-typedef struct
-{
- char header[5];
- unsigned char version;
- uint16_t cryptoLen;
- uint32_t dataLen;
-}STH_plaintext;
-
-typedef struct {
- uint8_t objectIDLen;
- unsigned char reserved1[7];
- unsigned char objectID[TEE_OBJECT_ID_MAX_LEN];
- unsigned char data[];
-}STH_ciphertext;
-
-typedef struct {
- char header[6];
- unsigned char version;
- unsigned char objectIDLen;
- TEE_UUID uuid;
- unsigned char objectID[TEE_OBJECT_ID_MAX_LEN];
-} STH_file_name;
-
-#define PLAIN_TEXT_HEADER ("fname")
-
-
-#endif // __TEE_STORAGE_H__
diff --git a/mobicore/common/MobiCore/inc/McLib/TlApiTuiMarshal.h b/mobicore/common/MobiCore/inc/McLib/TlApiTuiMarshal.h
deleted file mode 100644
index 28c7808..0000000
--- a/mobicore/common/MobiCore/inc/McLib/TlApiTuiMarshal.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/** @addtogroup DRIVER_TUI
- * @{
- * @file drApiMarshal.h
- * Marshaling types and declarations for TUI driver and trustlet.
- *
- * Functions for the marshaling of function ID and parameters.
- *
- * <Copyright goes here>
- */
-#ifndef __TLAPIMARSHAL_TUI_H__
-#define __TLAPIMARSHAL_TUI_H__
-
-#include "TlApi/TlApiError.h"
-#include "TlApi/TlApiTui.h"
-
-/** Invalid session id. Returned in case of an error. */
-#define DR_SID_INVALID 0xffffffff
-
-/** Each function must have its own ID.
- * Extend this list if you add a new function.
- */
-typedef enum {
- FID_DR_NONE = 0,
- FID_DR_OPEN_SESSION,
- FID_DR_CLOSE_SESSION,
- FID_DR_RESERVED0,
- FID_DR_SET_IMAGE,
- FID_DR_GET_SCREEN_INFO,
- FID_DR_GET_TOUCH_EVENT,
- FID_DR_RESERVED1,
-} tuiFuncID_t;
-
-/** Marshaled function parameters.
- * structs and union of marshaling parameters via TlApi.
- *
- * @note The structs can NEVER be packed !
- * @note The structs can NOT used via sizeof(..) !
- */
-typedef struct {
- union{
- uint32_t *version;
- uint32_t *securityLevel;
- tlApiTuiImage_ptr image;
- tlApiTuiScreenInfo_ptr screenInfo;
- tlApiTuiTouchEvent_ptr touchEvent;
- }content;
- tlApiTuiCoordinates_t coordinates;
-
-} tuiMarshalingData_t, *tuiMarshalingData_ptr;
-
-/** Union of marshaling parameters. */
-/* If adding any function, add the marshaling structure here */
-typedef struct {
- uint32_t functionId; /**< Function identifier. */
- union {
- tuiMarshalingData_t params;
- tlApiResult_t retVal; /** Return value */
- } payload;
-
-} tuiMarshalingParam_t, *tuiMarshalingParam_ptr;
-
-#endif // __TLAPIMARSHAL_TUI_H__
-
-/** @} */
diff --git a/mobicore/common/MobiCore/inc/McLib/mcLibWB.h b/mobicore/common/MobiCore/inc/McLib/mcLibWB.h
deleted file mode 100644
index 91b8cdf..0000000
--- a/mobicore/common/MobiCore/inc/McLib/mcLibWB.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/** @addtogroup MC_RTM_START
- * @{
- * @file
- *
- * <!-- Copyright Trustonic Limited 2013 -->
- */
-
-/** Index of flags to be checked after mcWaitNotification */
-#define MCLIB_WB_INDEX_NOTIFICATION_FLAGS (0)
-#define MCLIB_WB_NOTIFICATION_FLAG_CA_DEAD (1)
-
-/** Index of entry in which the base address of heap is stored. */
-#define MCLIB_WB_INDEX_HEAP_BASE_ADDRESS (1)
-
-/** Index of flags to be checked after mcWaitNotification */
-#define MCLIB_WB_INDEX_CONTEXT (2)
diff --git a/mobicore/common/MobiCore/inc/McLib/mclib_size.h b/mobicore/common/MobiCore/inc/McLib/mclib_size.h
deleted file mode 100644
index a9fbb48..0000000
--- a/mobicore/common/MobiCore/inc/McLib/mclib_size.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * mclib_size.h
- *
- * Created on: Oct 22, 2013
- * Author: lukhan01
- */
-
-#ifndef MCLIB_SIZE_H_
-#define MCLIB_SIZE_H_
-
-// Note: this file is read by .c and .sct file, no magic allowed.
-// Please modify these values manually.
-#define MCLIB_PAGES 5
-#define MCLIB_SIZE 0x00005000
-#define MCLIB_BASE 0x000FA000
-
-
-#endif /* MCLIB_SIZE_H_ */
diff --git a/mobicore/common/MobiCore/inc/McLib/tplay_marshal.h b/mobicore/common/MobiCore/inc/McLib/tplay_marshal.h
deleted file mode 100644
index 955aa89..0000000
--- a/mobicore/common/MobiCore/inc/McLib/tplay_marshal.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2013 TRUSTONIC LIMITED
- * All rights reserved
- *
- * The present software is the confidential and proprietary information of
- * TRUSTONIC LIMITED. You shall not disclose the present software and shall
- * use it only in accordance with the terms of the license agreement you
- * entered into with TRUSTONIC LIMITED. This software may be subject to
- * export or import laws in certain countries.
- */
-
-#ifndef __TPLAY_MARSHAL_H__
-#define __TPLAY_MARSHAL_H__ __FILE__
-
-#include "DrApi/DrApiCommon.h"
-#include "TlApi/TlApiError.h"
-#include "TlApi/TPlay.h"
-
-/**
- * Driver ID
- */
-#define TPLAY_DR_ID TB_DRV_ID_TPLAY
-
-/**
- * Function id definitions
- */
-#define FID_DR_OPEN_SESSION 1
-#define FID_DR_CLOSE_SESSION 2
-#define FID_DR_PROCESS_DRM_CONTENT 3
-#define FID_DR_CHECK_LINK 4
-#define FID_DR_UNKNOWN_CMD 100 /* For test purposes */
-
-/**
- * Secure cipher request data structure.
- * This structure helps define a buffer that contains mixed encrypted and clear data.
- */
-typedef struct {
- uint8_t sHandle;
- tlApiDrmDecryptContext_t decryptCtx;
- uint8_t *input;
- tlApiDrmInputSegmentDescriptor_t inputDesc;
- uint32_t processMode;
- uint8_t *rfu;
-} tlDrmApiDrmContent_t, *tlDrmApiDrmContent_ptr;
-
-/**
- * Link status data structure.
- */
-typedef struct {
- uint8_t sHandle;
- tlApiDrmLink_t link;
-} tlDrmApiLink_t, *tlDrmApiLink_ptr;
-
-/**
- * Union of marshaling parameters. */
-/* If adding any function, add the marshaling structure here
- */
-typedef struct {
- uint32_t functionId; /* Function identifier. */
- union {
- uint8_t *returned_sHandle;
- uint8_t sHandle_to_close;
- tlDrmApiDrmContent_t drmContent;
- tlDrmApiLink_t link;
- int32_t retVal; /* Return value */
- } payload;
-} tplayMarshalingParam_t, *tplayMarshalingParam_ptr;
-
-
-#endif // __TPLAY_MARSHAL_H__
-
-
diff --git a/mobicore/common/MobiCore/inc/Mci/mci.h b/mobicore/common/MobiCore/inc/Mci/mci.h
index b9011e5..2ecbedb 100644
--- a/mobicore/common/MobiCore/inc/Mci/mci.h
+++ b/mobicore/common/MobiCore/inc/Mci/mci.h
@@ -1,32 +1,34 @@
/*
* Copyright (c) 2013 TRUSTONIC LIMITED
- * All rights reserved
+ * 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.
+ * 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. The name of the author may not be used to endorse or promote
- * products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- *
*
+ * 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.
+ */
+/**
* <h2>Introduction</h2>
* The MobiCore Control Interface (MCI) is the interface for integrating G&D MobiCore technology into the
* rich operating system running in the non-secure part of an ARM TrustZone enabled platform.
@@ -70,9 +72,9 @@
* <tr><td>2009-07-01</td><td>0.2</td><td>Major rewrite</td></tr>
* <tr><td>2009-08-06</td><td>0.3</td><td>Added documentation for FastCall helper functions</td></tr>
* <tr><td>2009-09-10</td><td>0.4</td><td>Update of constant naming. Modification of doxygen config.</td></tr>
- * <tr><td>2010-03-09</td><td>0.5</td><td>Added fastCallPower() helper function for MC_FC_POWER.</td></tr>
+ * <tr><td>2010-03-09</td><td>0.5</td><td>Added fastCallPower() helper function for MC_FC_POWER.</td></tr>
* <tr><td>2010-05-10</td><td>0.6</td><td>Restructuring of load format header.</td></tr>
- * <tr><td>2011-07-19</td><td>0.7</td><td>update to reflect current code changes.</td></tr>
+ * <tr><td>2011-07-19</td><td>0.7</td><td>update to reflect current code changes.</td></tr>
* </table>
*
*
diff --git a/mobicore/common/MobiCore/inc/Mci/mcifc.h b/mobicore/common/MobiCore/inc/Mci/mcifc.h
index 12c34d6..07590e5 100644
--- a/mobicore/common/MobiCore/inc/Mci/mcifc.h
+++ b/mobicore/common/MobiCore/inc/Mci/mcifc.h
@@ -1,40 +1,35 @@
/*
- * Copyright (c) 2013 TRUSTONIC LIMITED
- * All rights reserved
+ * 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.
+ * 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. The name of the author may not be used to endorse or promote
- * products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
*
+ * 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.
*
- * @addtogroup FCI
- * @{
- * @file
- * FastCall declarations.
- *
+ * 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.
+ */
+/**
* Holds the functions for SIQ, YIELD and FastCall for switching to the secure world.
- *
-
*/
#ifndef MCIFC_H_
#define MCIFC_H_
@@ -46,9 +41,40 @@
// --- global ----
#define MC_FC_INVALID ((uint32_t) 0 ) /**< Invalid FastCall ID */
+
+#if defined(__AARCH32__)
+
+// These should be handled as 64-bit FCs; now they are more like 32bits...
+#define MC_FC_STD64_BASE ((uint32_t)0xFF000000)
+#define MC_FC_STD64(x) ((uint32_t)(MC_FC_STD64_BASE + (x)))
+
+#define MC_FC_INIT MC_FC_STD64(1) /**< Initializing FastCall. */
+#define MC_FC_INFO MC_FC_STD64(2) /**< Info FastCall. */
+
+// --- MEM traces ---
+#define MC_FC_MEM_TRACE MC_FC_STD64(10) /**< Enable SWd tracing via memory */
+
+// --- store value in sDDRRAM ---
+#define MC_FC_STORE_BINFO MC_FC_STD64(20) /**< write a 32bit value in secure DDRRAM in incremented art (max 2kB) */
+#define MC_FC_LOAD_BINFO MC_FC_STD64(21) /**< load a 32bit value from secure DDRRAM using an offset */
+
+// --- system settings ---
+#define MC_FC_STAT_COUNTER MC_FC_STD64(30) /**< Require status counter */
+
+// --- sleep modes ---
+#define MC_FC_SLEEP MC_FC_STD64(40) /**< enter power-sleep */
+#define MC_FC_AFTR MC_FC_STD64(41) /**< enter AFTR-sleep (called from core-0) */
+// --- wake-up access ---
+#define MC_FC_CORE_X_WAKEUP MC_FC_STD64(50) /**< wakeup/boot core-x (optional core-number in r1, not "0" ) */
+#define MC_FC_C15_RESUME MC_FC_STD64(51) /**< Write power control & diag registers */
+#define MC_FC_CMD_SAVE MC_FC_STD64(52) /**< Save core context to CP15 table(r1 is core number) */
+#define MC_FC_CMD_SHUTDOWN MC_FC_STD64(53) /**< Shutdown core(r1 is core number, cache flush is expected) */
+#define MC_FC_SWAP_CPU MC_FC_STD64(54) /**< Change new active Core */
+
+#else
+
#define MC_FC_INIT ((uint32_t)(-1)) /**< Initializing FastCall. */
#define MC_FC_INFO ((uint32_t)(-2)) /**< Info FastCall. */
-
// following defines are currently frozen, so they will candidate for later big-change
// --- sleep modes ---
#define MC_FC_SLEEP ((uint32_t)(-3)) /**< enter power-sleep */
@@ -58,6 +84,8 @@
#define MC_FC_C15_RESUME ((uint32_t)(-11)) /**< Write power control & diag registers */
#define MC_FC_CMD_SAVE ((uint32_t)(-6)) /**< Save core context to CP15 table(r1 is core number) */
#define MC_FC_CMD_SHUTDOWN ((uint32_t)(-7)) /**< Shutdown core(r1 is core number, cache flush is expected) */
+// --- fiq debugger ---
+#define MC_FC_ENABLE_INTERRUPT_FIQ_DUMP ((uint32_t)(-8)) /**< enable a certain interrupt, r1 is the interrupt id */
// --- L2 cache access ---
#define MC_FC_L2X0_CTRL ((uint32_t)(-21)) /**< Write to L2X0 control register */
#define MC_FC_L2X0_SETUP1 ((uint32_t)(-22)) /**< Setup L2X0 register - part 1 */
@@ -75,13 +103,11 @@
#define MC_FC_STORE_BINFO ((uint32_t)(-201)) /**< write a 32bit value in secure DDRRAM in incremented art (max 2kB) */
#define MC_FC_LOAD_BINFO ((uint32_t)(-202)) /**< load a 32bit value from secure DDRRAM using an offset */
-// Broadcom Specific Fastcalls
-#define MC_FC_BCM_VC_CORE_START ((uint32_t)(-301)) /**< Set the VC Core start address*/
-#define MC_FC_MAX_ID ((uint32_t)(0xFFFF0000)) /**< Maximum allowed FastCall ID */
-
#define MC_FC_SWAP_CPU ((uint32_t)(0x84000005)) /**< Change new active Core */
// r1 is requested status (0,1,2), on return r2 holds this status value
+#endif
+
/** @} */
/** @name MobiCore SMC Defines
diff --git a/mobicore/common/MobiCore/inc/Mci/mcifcfunc.h b/mobicore/common/MobiCore/inc/Mci/mcifcfunc.h
deleted file mode 100644
index 895507e..0000000
--- a/mobicore/common/MobiCore/inc/Mci/mcifcfunc.h
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * 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. The name of the author may not be used to endorse or promote
- * products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 FCI
- * @{
- * @file
- * Declaration of FastCall helper functions.
- *
- * @attention Helper functions are mostly RealView (ARM CC) specific.
- *
- * Holds the functions for SIQ, YIELD and FastCall for switching to the secure world.
- * <!-- Copyright Trustonic Limited 2013 -->
- *
- */
-
-#ifndef MCIFCFUNC_H_
-#define MCIFCFUNC_H_
-
-#include "mcifc.h"
-/**
- * Execute a secure monitor call (SMC).
- *
- * @param mode SMC mode affects the way SMC is handled
- *
- * @attention This function shall not be used directly. Use N_Siq() or Yield() instead.
- */
-__smc(0) void smc(int32_t mode);
-
-/**
- * N-SIQ switch from NWd to SWd.
- * Execution will continue in the SWd. The notification queue will be drained by the MC4 and MC4 system schedules its services.
- */
-inline void N_Siq(void) { smc(MC_SMC_N_SIQ); }
-
-/**
- * Yield switch from NWd to SWd.
- * Execution will continue in the SWd without scheduling MC4 services.
- */
-inline void Yield(void) { smc(MC_SMC_N_YIELD); }
-
-/** Wrapper structure for parameter passing in registers.
- * This structure is used as a "wrapper" return value for functions that
- * return data in the registers r0 to r3. With the RealView compiler such
- * function are declare as: _value_in_regs reg_r0_r1_r2_r3_t foo()
-
- */
-typedef struct {
- uint32_t r0;
- uint32_t r1;
- uint32_t r2;
- uint32_t r3;
-} reg_r0_r1_r2_r3_t;
-
-/** Parameterized SMC for FastCalls.
- * @attention This function shall not be used directly.
- */
-__smc(0) __value_in_regs reg_r0_r1_r2_r3_t smcFc(
- uint32_t r0,
- uint32_t r1,
- uint32_t r2,
- uint32_t r3
-);
-
-/** FastCall helper function.
- * @attention This function shall not be used directly.
- */
-inline static __value_in_regs reg_r0_r1_r2_r3_t fastCall(
- uint32_t r0,
- uint32_t r1,
- uint32_t r2,
- uint32_t r3
-) {
- return smcFc(r0,r1,r2,r3);
-}
-
-/**
- * Initialize the MobiCore.
- * The FcMc4init FastCall shall be used to set up the MCI. The function passes the message buffers used in the MCI to the MC4 system.
- * As long as the buffers are not set up the MC4 message passing mechanisms (notifications, MCP commands) are not available.
- * NQ buffer and MCP buffer as well as length calculations are described in the "MobiCore4 Driver Interface Specification".
- * <br> The fastCallInit() will not check the parameters for validity. Instead the MC4 will perform a check on first usage of the parameters.
- *
- * @image html DoxyMciBuffer.png "MCI buffer"
- * @image latex DoxyMciBuffer.png "MCI buffer" width=12cm
- *
- * @param base Physical start address of the MCI buffer. Must be 4kB aligned.
- * @param nqOffset Offset in bytes to the beginning of the NQ buffer.
- * @param nqLength Length of the NQ buffer in bytes.
- * @param mcpOffset Offset in bytes to the beginning of the MCP buffer.
- * @param mcpLength Length of the MCP buffer in bytes
- *
- */
-inline static uint32_t fastCallInit(
- uint8_t *base,
- uint32_t nqOffset,
- uint32_t nqLength,
- uint32_t mcpOffset,
- uint32_t mcpLength
-) {
-
- reg_r0_r1_r2_r3_t ret;
-
- ret = fastCall(
- MC_FC_INIT,
- (uint32_t)base,
- ((nqOffset << 16) | (nqLength & 0xFFFF)),
- ((mcpOffset << 16) | (mcpLength & 0xFFFF)) );
-
-
- return ret.r1;
-}
-
-
-/** Get status information about MobiCore.
- * The FcMcGetInfo FastCall provides information about the current state of the MobiCore.
- * In certain states extended information is provided.
- *
- * @param extInfoId Extended info word to be obtained.
- * @param mc4state Current state of the MobiCore.
- * @param extInfo Extended information depending on state.
- */
-inline static uint32_t fastCallGetInfo(
- uint32_t extInfoId,
- uint32_t *mc4state,
- uint32_t *extInfo
-) {
- reg_r0_r1_r2_r3_t ret;
-
- ret = fastCall(MC_FC_INFO,extInfoId,0,0);
-
- if (MC_FC_RET_OK == ret.r1)
- {
- *mc4state = ret.r2;
- *extInfo = ret.r3;
- }
-
- return ret.r1;
-}
-
-/**
- * Power management.
- * The power management FastCall is platform specific.
- *
- * @param param0 platform specific parameter.
- * @param param1 platform specific parameter.
- * @param param2 platform specific parameter.
- */
-inline static uint32_t fastCallPower(
- uint32_t param0,
- uint32_t param1,
- uint32_t param2
-) {
-
- reg_r0_r1_r2_r3_t ret;
-
- ret = fastCall(
- MC_FC_POWER,
- param0,
- param1,
- param2 );
-
- return ret.r1;
-}
-
-#endif /* MCIFCFUNC_H_ */
-/**
- * @}*/
diff --git a/mobicore/common/MobiCore/inc/Mci/mcimcp.h b/mobicore/common/MobiCore/inc/Mci/mcimcp.h
index 1dc30e2..f03510d 100644
--- a/mobicore/common/MobiCore/inc/Mci/mcimcp.h
+++ b/mobicore/common/MobiCore/inc/Mci/mcimcp.h
@@ -1,33 +1,34 @@
/*
* Copyright (c) 2013 TRUSTONIC LIMITED
- * All rights reserved
+ * 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.
+ * 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. The name of the author may not be used to endorse or promote
- * products derived from this software without specific prior
- * written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ * 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.
*
- *
- * @addtogroup MCP
+ * 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 MCP
* @{
* The MCP defines commands and responses which are used to control the MobiCore system.
* MCP information is exchanged in a world share memory buffer which has been established prior between NWd
diff --git a/mobicore/common/MobiCore/inc/Mci/mcinq.h b/mobicore/common/MobiCore/inc/Mci/mcinq.h
index 4036cab..3a87545 100644
--- a/mobicore/common/MobiCore/inc/Mci/mcinq.h
+++ b/mobicore/common/MobiCore/inc/Mci/mcinq.h
@@ -1,32 +1,34 @@
/*
* Copyright (c) 2013 TRUSTONIC LIMITED
- * All rights reserved
+ * 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.
+ * 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. The name of the author may not be used to endorse or promote
- * products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
*
+ * 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 NQ
* @{
* Notifications inform the MobiCore runtime environment that information is pending in a WSM buffer.
diff --git a/mobicore/common/MobiCore/inc/Mci/version.h b/mobicore/common/MobiCore/inc/Mci/version.h
index 0130941..7b577bd 100644
--- a/mobicore/common/MobiCore/inc/Mci/version.h
+++ b/mobicore/common/MobiCore/inc/Mci/version.h
@@ -1,33 +1,33 @@
/*
* Copyright (c) 2013 TRUSTONIC LIMITED
- * All rights reserved
+ * 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.
+ * 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. The name of the author may not be used to endorse or promote
- * products derived from this software without specific prior
- * written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ * 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 MCI_VERSION_H_
#define MCI_VERSION_H_
diff --git a/mobicore/common/MobiCore/inc/TlCm/2.0/cmp.h b/mobicore/common/MobiCore/inc/TlCm/2.0/cmp.h
index 94fa4e2..33182ad 100644
--- a/mobicore/common/MobiCore/inc/TlCm/2.0/cmp.h
+++ b/mobicore/common/MobiCore/inc/TlCm/2.0/cmp.h
@@ -15,7 +15,7 @@
* 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,
@@ -69,7 +69,7 @@ typedef struct {
mcSoAuthTokenCont_t soAuthTokenCont;
} cmpCmdBeginSocAuthentication_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_BEGIN_SOC_AUTHENTICATION_RSP Response_2_0
* @{ */
@@ -98,9 +98,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 +123,7 @@ typedef struct {
mcSoRootCont_t soRootCont;
} cmpCmdBeginRootAuthentication_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_BEGIN_ROOT_AUTHENTICATION_RSP Response_2_0
* @{ */
@@ -152,9 +152,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 +220,7 @@ typedef struct {
/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_AUTHENTICATE MC_CMP_2_0_CMD_AUTHENTICATE
* @{ */
@@ -256,7 +256,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 +272,7 @@ typedef struct {
cmpAuthenticateCmd_t cmd;
} cmpCmdAuthenticate_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_AUTHENTICATE_RSP Response_2_0
* @{ */
@@ -321,9 +321,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 +352,7 @@ typedef struct {
cmpAuthenticateTerminateCmd_t cmd;
} cmpCmdAuthenticateTerminate_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_AUTHENTICATE_TERMINATE_RSP Response_2_0
* @{ */
@@ -426,7 +426,7 @@ typedef struct {
cmpRootContRegisterActivateCmd_t cmd;
} cmpCmdRootContRegisterActivate_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_ROOT_CONT_REGISTER_ACTIVATE_RSP Response_2_0
* @{ */
@@ -518,7 +518,7 @@ typedef struct {
cmpRootContUnregisterCmd_t cmd;
} cmpCmdRootContUnregister_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_ROOT_CONT_UNREGISTER_RSP Response_2_0
* @{ */
@@ -561,9 +561,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 +592,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 +635,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 +666,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 +709,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 +757,7 @@ typedef struct {
cmpSpContRegisterActivateCmd_t cmd;
} cmpCmdSpContRegisterActivate_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_SP_CONT_REGISTER_ACTIVATE_RSP Response_2_0
* @{ */
@@ -837,7 +837,7 @@ typedef struct {
cmpSpContUnregisterCmd_t cmd;
} cmpCmdSpContUnregister_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_SP_CONT_UNREGISTER_RSP Response_2_0
* @{ */
@@ -880,9 +880,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 +929,7 @@ typedef struct {
cmpSpContRegisterCmd_t cmd;
} cmpCmdSpContRegister_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_SP_CONT_REGISTER_RSP Response_2_0
* @{ */
@@ -975,9 +975,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 +989,7 @@ typedef struct {
/** SpContLockByRoot signed command. */
typedef struct {
/** Command header. */
- cmpCommandHeader_t cmdHeader;
+ cmpCommandHeader_t cmdHeader;
/** Spid. */
mcSpid_t spid;
} cmpSpLockByRootCmdSdata_t;
@@ -1010,7 +1010,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 +1053,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 +1067,7 @@ typedef struct {
/** SpContUnlockByRoot signed command. */
typedef struct {
/** Command header. */
- cmpCommandHeader_t cmdHeader;
+ cmpCommandHeader_t cmdHeader;
/** Spid. */
mcSpid_t spid;
} cmpSpUnlockByRootCmdSdata_t;
@@ -1088,7 +1088,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 +1131,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 +1180,7 @@ typedef struct {
cmpSpContActivateCmd_t cmd;
} cmpCmdSpContActivate_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_SP_CONT_ACTIVATE_RSP Response_2_0
* @{ */
@@ -1223,9 +1223,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 +1237,7 @@ typedef struct {
/** SpContLockBySp signed command. */
typedef struct {
/** Command header. */
- cmpCommandHeader_t cmdHeader;
+ cmpCommandHeader_t cmdHeader;
/** Spid. */
mcSpid_t spid;
} cmpSpLockBySpCmdSdata_t;
@@ -1256,7 +1256,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 +1299,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 +1313,7 @@ typedef struct {
/** SpContUnlockBySp signed command. */
typedef struct {
/** Command header. */
- cmpCommandHeader_t cmdHeader;
+ cmpCommandHeader_t cmdHeader;
/** Spid. */
mcSpid_t spid;
} cmpSpUnlockBySpCmdSdata_t;
@@ -1332,7 +1332,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 +1426,7 @@ typedef struct {
cmpTltContRegisterActivateCmd_t cmd;
} cmpCmdTltContRegisterActivate_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_TLT_CONT_REGISTER_ACTIVATE_RSP Response_2_0
* @{ */
@@ -1508,7 +1508,7 @@ typedef struct {
cmpTltContUnregisterCmd_t cmd;
} cmpCmdTltContUnregister_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_TLT_CONT_UNREGISTER_RSP Response_2_0
* @{ */
@@ -1551,9 +1551,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 +1602,7 @@ typedef struct {
cmpTltContRegisterCmd_t cmd;
} cmpCmdTltContRegister_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_TLT_CONT_REGISTER_RSP Response_2_0
* @{ */
@@ -1649,9 +1649,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 +1686,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 +1729,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 +1766,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 +1809,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 +1846,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 +1891,7 @@ typedef struct {
/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_2_0_CMD_TLT_CONT_PERSONALIZE \
MC_CMP_2_0_CMD_TLT_CONT_PERSONALIZE
@@ -1946,7 +1946,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 19483b6..d653145 100644
--- a/mobicore/common/MobiCore/inc/TlCm/2.0/tlCmApi.h
+++ b/mobicore/common/MobiCore/inc/TlCm/2.0/tlCmApi.h
@@ -10,7 +10,7 @@
* 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,
diff --git a/mobicore/common/MobiCore/inc/TlCm/3.0/cmp.h b/mobicore/common/MobiCore/inc/TlCm/3.0/cmp.h
index ef2ba56..8454131 100644
--- a/mobicore/common/MobiCore/inc/TlCm/3.0/cmp.h
+++ b/mobicore/common/MobiCore/inc/TlCm/3.0/cmp.h
@@ -15,7 +15,7 @@
* 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,
@@ -50,7 +50,7 @@ typedef struct {
/** Address of the mapped memory. */
void* addr;
/** 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 +58,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 +81,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 +145,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
@@ -191,7 +191,7 @@ typedef struct {
cmpMapOffsetInfo_t cmpAuthTokenContMapOffsetInfo;
} cmpCmdBeginSocAuthenticationTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_BEGIN_SOC_AUTHENTICATION_TCI_RSP Response
* @{ */
@@ -204,9 +204,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 +223,7 @@ typedef struct {
cmpMapOffsetInfo_t cmpRootContMapOffsetInfo;
} cmpCmdBeginRootAuthenticationTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_BEGIN_ROOT_AUTHENTICATION_TCI_RSP Response
* @{ */
@@ -236,7 +236,7 @@ typedef struct {
cmpMapOffsetInfo_t cmpRspMapOffsetInfo;
} cmpRspBeginRootAuthenticationTci_t;
-/** @} */
+/** @} */
/** @} */
@@ -257,7 +257,7 @@ typedef struct {
cmpMapOffsetInfo_t cmpSpContMapOffsetInfo;
} cmpCmdBeginSpAuthenticationTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_BEGIN_SP_AUTHENTICATION_TCI_RSP Response
* @{ */
@@ -270,9 +270,9 @@ typedef struct {
cmpMapOffsetInfo_t cmpRspMapOffsetInfo;
} cmpRspBeginSpAuthenticationTci_t;
-/** @} */
+/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_AUTHENTICATE_TCI \
MC_CMP_CMD_AUTHENTICATE_TCI
@@ -287,7 +287,7 @@ typedef struct {
cmpCommandHeaderTci_t cmdHeader;
} cmpCmdAuthenticateTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_AUTHENTICATE_TCI_RSP Response
* @{ */
@@ -300,9 +300,9 @@ typedef struct {
cmpMapOffsetInfo_t cmpRspMapOffsetInfo;
} cmpRspAuthenticateTci_t;
-/** @} */
+/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_AUTHENTICATE_TERMINATE_TCI \
MC_CMP_CMD_AUTHENTICATE_TERMINATE_TCI
@@ -317,7 +317,7 @@ typedef struct {
cmpCommandHeaderTci_t cmdHeader;
} cmpCmdAuthenticateTerminateTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_AUTHENTICATE_TERMINATE_TCI_RSP Response
* @{ */
@@ -330,9 +330,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 +347,7 @@ typedef struct {
cmpCommandHeaderTci_t cmdHeader;
} cmpCmdRootContRegisterActivateTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_ROOT_CONT_REGISTER_ACTIVATE_TCI_RSP Response
* @{ */
@@ -379,7 +379,7 @@ typedef struct {
cmpCommandHeaderTci_t cmdHeader;
} cmpCmdRootContUnregisterTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_ROOT_CONT_UNREGISTER_TCI_RSP Response
* @{ */
@@ -392,9 +392,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 +409,7 @@ typedef struct {
cmpCommandHeaderTci_t cmdHeader;
} cmpCmdRootContLockByRootTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_ROOT_CONT_LOCK_BY_ROOT_TCI_RSP Response
* @{ */
@@ -424,9 +424,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 +441,7 @@ typedef struct {
cmpCommandHeaderTci_t cmdHeader;
} cmpCmdRootContUnlockByRootTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_ROOT_CONT_UNLOCK_BY_ROOT_TCI_RSP Response
* @{ */
@@ -456,9 +456,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 +473,7 @@ typedef struct {
cmpCommandHeaderTci_t cmdHeader;
} cmpCmdSpContRegisterActivateTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_REGISTER_ACTIVATE_TCI_RSP Response
* @{ */
@@ -490,9 +490,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 +507,7 @@ typedef struct {
cmpCommandHeaderTci_t cmdHeader;
} cmpCmdSpContUnregisterTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_UNREGISTER_TCI_RSP Response
* @{ */
@@ -522,7 +522,7 @@ typedef struct {
cmpMapOffsetInfo_t cmpRootContMapOffsetInfo;
} cmpRspSpContUnregisterTci_t;
-/** @} */
+/** @} */
/** @} */
@@ -539,7 +539,7 @@ typedef struct {
cmpCommandHeaderTci_t cmdHeader;
} cmpCmdSpContRegisterTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_REGISTER_TCI_RSP Response
* @{ */
@@ -556,9 +556,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 +575,7 @@ typedef struct {
cmpMapOffsetInfo_t cmpSpContMapOffsetInfo;
} cmpCmdSpContLockByRootTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_LOCK_BY_ROOT_TCI_RSP Response
* @{ */
@@ -590,9 +590,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 +609,7 @@ typedef struct {
cmpMapOffsetInfo_t cmpSpContMapOffsetInfo;
} cmpCmdSpContUnlockByRootTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_UNLOCK_BY_ROOT_TCI_RSP Response
* @{ */
@@ -624,9 +624,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 +641,7 @@ typedef struct {
cmpCommandHeaderTci_t cmdHeader;
} cmpCmdSpContActivateTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_ACTIVATE_TCI_RSP Response
* @{ */
@@ -656,9 +656,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 +673,7 @@ typedef struct {
cmpCommandHeaderTci_t cmdHeader;
} cmpCmdSpContLockBySpTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_LOCK_BY_SP_TCI_RSP Response
* @{ */
@@ -688,9 +688,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 +705,7 @@ typedef struct {
cmpCommandHeaderTci_t cmdHeader;
} cmpCmdSpContUnlockBySpTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_UNLOCK_BY_SP_TCI_RSP Response
* @{ */
@@ -720,9 +720,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 +737,7 @@ typedef struct {
cmpCommandHeaderTci_t cmdHeader;
} cmpCmdTltContRegisterActivateTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_TLT_CONT_REGISTER_ACTIVATE_TCI_RSP Response
* @{ */
@@ -756,7 +756,7 @@ typedef struct {
/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_TLT_CONT_UNREGISTER_TCI \
MC_CMP_CMD_TLT_CONT_UNREGISTER_TCI
@@ -771,7 +771,7 @@ typedef struct {
cmpCommandHeaderTci_t cmdHeader;
} cmpCmdTltContUnregisterTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_TLT_CONT_UNREGISTER_TCI_RSP Response
* @{ */
@@ -803,7 +803,7 @@ typedef struct {
cmpCommandHeaderTci_t cmdHeader;
} cmpCmdTltContRegisterTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_TLT_CONT_REGISTER_TCI_RSP Response
* @{ */
@@ -820,7 +820,7 @@ typedef struct {
cmpMapOffsetInfo_t cmpTltContMapOffsetInfo;
} cmpRspTltContRegisterTci_t;
-/** @} */
+/** @} */
/** @} */
@@ -839,7 +839,7 @@ typedef struct {
cmpMapOffsetInfo_t cmpTltContMapOffsetInfo;
} cmpCmdTltContActivateTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_TLT_CONT_ACTIVATE_TCI_RSP Response
* @{ */
@@ -854,9 +854,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 +873,7 @@ typedef struct {
cmpMapOffsetInfo_t cmpTltContMapOffsetInfo;
} cmpCmdTltContLockBySpTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_TLT_CONT_LOCK_BY_SP_TCI_RSP Response
* @{ */
@@ -888,9 +888,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 +907,7 @@ typedef struct {
cmpMapOffsetInfo_t cmpTltContMapOffsetInfo;
} cmpCmdTltContUnlockBySpTci_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_TLT_CONT_UNLOCK_BY_SP_TCI_RSP Response
* @{ */
@@ -941,7 +941,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 0727407..05c3e7c 100644
--- a/mobicore/common/MobiCore/inc/TlCm/3.0/cmpMap.h
+++ b/mobicore/common/MobiCore/inc/TlCm/3.0/cmpMap.h
@@ -15,7 +15,7 @@
* 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,
@@ -192,7 +192,7 @@ typedef struct {
cmpBeginRootAuthenticationCmd_t cmd;
} cmpCmdBeginRootAuthentication_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_BEGIN_ROOT_AUTHENTICATION_RSP Response
* @{ */
@@ -221,7 +221,7 @@ typedef struct {
cmpBeginRootAuthenticationRsp_t rsp;
} cmpRspBeginRootAuthentication_t;
-/** @} */
+/** @} */
/** Map CMP BeginRootAuthentication message. */
typedef union {
@@ -231,7 +231,7 @@ typedef union {
cmpRspBeginRootAuthentication_t cmpRspBeginRootAuthentication;
} cmpMapBeginRootAuthentication_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_BEGIN_SP_AUTHENTICATION \
MC_CMP_CMD_BEGIN_SP_AUTHENTICATION
@@ -285,7 +285,7 @@ typedef struct {
cmpBeginSpAuthenticationRsp_t rsp;
} cmpRspBeginSpAuthentication_t;
-/** @} */
+/** @} */
/** Map CMP BeginSpAuthentication message. */
typedef union {
@@ -295,7 +295,7 @@ typedef union {
cmpRspBeginSpAuthentication_t cmpRspBeginSpAuthentication;
} cmpMapBeginSpAuthentication_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_AUTHENTICATE MC_CMP_CMD_AUTHENTICATE
* @{ */
@@ -333,7 +333,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 +349,7 @@ typedef struct {
cmpAuthenticateCmd_t cmd;
} cmpCmdAuthenticate_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_AUTHENTICATE_RSP Response
* @{ */
@@ -410,7 +410,7 @@ typedef union {
cmpRspAuthenticate_t cmpRspAuthenticate;
} cmpMapAuthenticate_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_AUTHENTICATE_TERMINATE \
MC_CMP_CMD_AUTHENTICATE_TERMINATE
@@ -439,7 +439,7 @@ typedef struct {
cmpAuthenticateTerminateCmd_t cmd;
} cmpCmdAuthenticateTerminate_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_AUTHENTICATE_TERMINATE_RSP Response
* @{ */
@@ -474,7 +474,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 +523,7 @@ typedef struct {
cmpRootContRegisterActivateCmd_t cmd;
} cmpCmdRootContRegisterActivate_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_ROOT_CONT_REGISTER_ACTIVATE_RSP Response
* @{ */
@@ -609,7 +609,7 @@ typedef struct {
cmpRootContUnregisterCmd_t cmd;
} cmpCmdRootContUnregister_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_ROOT_CONT_UNREGISTER_RSP Response
* @{ */
@@ -652,7 +652,7 @@ typedef struct {
cmpRootContUnregisterRsp_t rsp;
} cmpRspRootContUnregister_t;
-/** @} */
+/** @} */
/** Map CMP RootContUnregister message. */
typedef union {
@@ -662,7 +662,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 +691,7 @@ typedef struct {
cmpRootContLockByRootCmd_t cmd;
} cmpCmdRootContLockByRoot_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_ROOT_CONT_LOCK_BY_ROOT_RSP Response
* @{ */
@@ -719,7 +719,7 @@ typedef struct {
cmpRootContLockByRootRsp_t rsp;
} cmpRspRootContLockByRoot_t;
-/** @} */
+/** @} */
/** Map CMP RootContLockByRoot message. */
typedef union {
@@ -729,7 +729,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 +758,7 @@ typedef struct {
cmpRootContUnlockByRootCmd_t cmd;
} cmpCmdRootContUnlockByRoot_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_ROOT_CONT_UNLOCK_BY_ROOT_RSP Response
* @{ */
@@ -787,7 +787,7 @@ typedef struct {
cmpRootContUnlockByRootRsp_t rsp;
} cmpRspRootContUnlockByRoot_t;
-/** @} */
+/** @} */
/** Map CMP RootContUnlockByRoot message. */
typedef union {
@@ -797,7 +797,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 +846,7 @@ typedef struct {
cmpSpContRegisterActivateCmd_t cmd;
} cmpCmdSpContRegisterActivate_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_REGISTER_ACTIVATE_RSP Response
* @{ */
@@ -879,7 +879,7 @@ typedef struct {
cmpSpContRegisterActivateRsp_t rsp;
} cmpRspSpContRegisterActivate_t;
-/** @} */
+/** @} */
/** Map CMP SpContRegisterActivate message. */
typedef union {
@@ -889,7 +889,7 @@ typedef union {
cmpRspSpContRegisterActivate_t cmpRspSpContRegisterActivate;
} cmpMapSpContRegisterActivate_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_UNREGISTER \
MC_CMP_CMD_SP_CONT_UNREGISTER
@@ -920,7 +920,7 @@ typedef struct {
cmpSpContUnregisterCmd_t cmd;
} cmpCmdSpContUnregister_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_UNREGISTER_RSP Response
* @{ */
@@ -949,7 +949,7 @@ typedef struct {
cmpSpContUnregisterRsp_t rsp;
} cmpRspSpContUnregister_t;
-/** @} */
+/** @} */
/** Map CMP SpContUnregister message. */
typedef union {
@@ -959,7 +959,7 @@ typedef union {
cmpRspSpContUnregister_t cmpRspSpContUnregister;
} cmpMapSpContUnregister_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_REGISTER \
MC_CMP_CMD_SP_CONT_REGISTER
@@ -1008,7 +1008,7 @@ typedef struct {
cmpSpContRegisterCmd_t cmd;
} cmpCmdSpContRegister_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_REGISTER_RSP Response
* @{ */
@@ -1041,7 +1041,7 @@ typedef struct {
cmpSpContRegisterRsp_t rsp;
} cmpRspSpContRegister_t;
-/** @} */
+/** @} */
/** Map CMP SpContRegister message. */
typedef union {
@@ -1051,7 +1051,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 +1063,7 @@ typedef union {
/** SpContLockByRoot signed command. */
typedef struct {
/** Command header. */
- cmpCommandHeaderMap_t cmdHeader;
+ cmpCommandHeaderMap_t cmdHeader;
/** Spid. */
mcSpid_t spid;
} cmpSpLockByRootCmdSdata_t;
@@ -1082,7 +1082,7 @@ typedef struct {
cmpSpContLockByRootCmd_t cmd;
} cmpCmdSpContLockByRoot_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_LOCK_BY_ROOT_RSP Response
* @{ */
@@ -1111,7 +1111,7 @@ typedef struct {
cmpSpContLockByRootRsp_t rsp;
} cmpRspSpContLockByRoot_t;
-/** @} */
+/** @} */
/** Map CMP SpContLockByRoot message. */
typedef union {
@@ -1121,7 +1121,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 +1133,7 @@ typedef union {
/** SpContUnlockByRoot signed command. */
typedef struct {
/** Command header. */
- cmpCommandHeaderMap_t cmdHeader;
+ cmpCommandHeaderMap_t cmdHeader;
/** Spid. */
mcSpid_t spid;
} cmpSpUnlockByRootCmdSdata_t;
@@ -1152,7 +1152,7 @@ typedef struct {
cmpSpContUnlockByRootCmd_t cmd;
} cmpCmdSpContUnlockByRoot_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_UNLOCK_BY_ROOT_RSP Response
* @{ */
@@ -1181,7 +1181,7 @@ typedef struct {
cmpSpContUnlockByRootRsp_t rsp;
} cmpRspSpContUnlockByRoot_t;
-/** @} */
+/** @} */
/** Map CMP SpContUnlockByRoot message. */
typedef union {
@@ -1191,7 +1191,7 @@ typedef union {
cmpRspSpContUnlockByRoot_t cmpRspSpContUnlockByRoot;
} cmpMapSpContUnlockByRoot_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_ACTIVATE \
MC_CMP_CMD_SP_CONT_ACTIVATE
@@ -1240,7 +1240,7 @@ typedef struct {
cmpSpContActivateCmd_t cmd;
} cmpCmdSpContActivate_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_ACTIVATE_RSP Response
* @{ */
@@ -1269,7 +1269,7 @@ typedef struct {
cmpSpContActivateRsp_t rsp;
} cmpRspSpContActivate_t;
-/** @} */
+/** @} */
/** Map CMP SpContActivate message. */
typedef union {
@@ -1279,7 +1279,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 +1291,7 @@ typedef union {
/** SpContLockBySp signed command. */
typedef struct {
/** Command header. */
- cmpCommandHeaderMap_t cmdHeader;
+ cmpCommandHeaderMap_t cmdHeader;
/** Spid. */
mcSpid_t spid;
} cmpSpLockBySpCmdSdata_t;
@@ -1310,7 +1310,7 @@ typedef struct {
cmpSpContLockBySpCmd_t cmd;
} cmpCmdSpContLockBySp_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_LOCK_BY_SP_RSP Response
* @{ */
@@ -1339,7 +1339,7 @@ typedef struct {
cmpSpContLockBySpRsp_t rsp;
} cmpRspSpContLockBySp_t;
-/** @} */
+/** @} */
/** Map CMP SpContLockBySp message. */
typedef union {
@@ -1349,7 +1349,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 +1361,7 @@ typedef union {
/** SpContUnlockBySp signed command. */
typedef struct {
/** Command header. */
- cmpCommandHeaderMap_t cmdHeader;
+ cmpCommandHeaderMap_t cmdHeader;
/** Spid. */
mcSpid_t spid;
} cmpSpUnlockBySpCmdSdata_t;
@@ -1380,7 +1380,7 @@ typedef struct {
cmpSpContUnlockBySpCmd_t cmd;
} cmpCmdSpContUnlockBySp_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_SP_CONT_UNLOCK_BY_SP_RSP Response
* @{ */
@@ -1409,7 +1409,7 @@ typedef struct {
cmpSpContUnlockBySpRsp_t rsp;
} cmpRspSpContUnlockBySp_t;
-/** @} */
+/** @} */
/** Map CMP SpContUnlockBySp message. */
typedef union {
@@ -1419,7 +1419,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 +1451,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 +1474,7 @@ typedef struct {
cmpTltContRegisterActivateCmd_t cmd;
} cmpCmdTltContRegisterActivate_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_TLT_CONT_REGISTER_ACTIVATE_RSP Response
* @{ */
@@ -1505,7 +1505,7 @@ typedef struct {
cmpTltContRegisterActivateRsp_t rsp;
} cmpRspTltContRegisterActivate_t;
-/** @} */
+/** @} */
/** Map CMP TltContRegisterActivate message. */
typedef union {
@@ -1548,7 +1548,7 @@ typedef struct {
cmpTltContUnregisterCmd_t cmd;
} cmpCmdTltContUnregister_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_TLT_CONT_UNREGISTER_RSP Response
* @{ */
@@ -1577,7 +1577,7 @@ typedef struct {
cmpTltContUnregisterRsp_t rsp;
} cmpRspTltContUnregister_t;
-/** @} */
+/** @} */
/** Map CMP TltContUnregister message. */
typedef union {
@@ -1619,7 +1619,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 +1642,7 @@ typedef struct {
cmpTltContRegisterCmd_t cmd;
} cmpCmdTltContRegister_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_TLT_CONT_REGISTER_RSP Response
* @{ */
@@ -1675,7 +1675,7 @@ typedef struct {
cmpTltContRegisterRsp_t rsp;
} cmpRspTltContRegister_t;
-/** @} */
+/** @} */
/** Map CMP TltContRegister message. */
typedef union {
@@ -1685,7 +1685,7 @@ typedef union {
cmpRspTltContRegister_t cmpRspTltContRegister;
} cmpMapTltContRegister_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_TLT_CONT_ACTIVATE \
MC_CMP_CMD_TLT_CONT_ACTIVATE
@@ -1718,7 +1718,7 @@ typedef struct {
cmpTltContActivateCmd_t cmd;
} cmpCmdTltContActivate_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_TLT_CONT_ACTIVATE_RSP Response
* @{ */
@@ -1747,7 +1747,7 @@ typedef struct {
cmpTltContActivateRsp_t rsp;
} cmpRspTltContActivate_t;
-/** @} */
+/** @} */
/** Map CMP TltContActivate message. */
typedef union {
@@ -1757,7 +1757,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 +1790,7 @@ typedef struct {
cmpTltContLockBySpCmd_t cmd;
} cmpCmdTltContLockBySp_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_TLT_CONT_LOCK_BY_SP_RSP Response
* @{ */
@@ -1819,7 +1819,7 @@ typedef struct {
cmpTltContLockBySpRsp_t rsp;
} cmpRspTltContLockBySp_t;
-/** @} */
+/** @} */
/** Map CMP TltContLockBySp message. */
typedef union {
@@ -1829,7 +1829,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 +1862,7 @@ typedef struct {
cmpTltContUnlockBySpCmd_t cmd;
} cmpCmdTltContUnlockBySp_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_TLT_CONT_UNLOCK_BY_SP_RSP Response
* @{ */
@@ -1901,7 +1901,7 @@ typedef union {
cmpRspTltContUnlockBySp_t cmpRspTltContUnlockBySp;
} cmpMapTltContUnlockBySp_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_TLT_CONT_PERSONALIZE \
MC_CMP_CMD_TLT_CONT_PERSONALIZE
@@ -1953,7 +1953,7 @@ typedef struct {
cmpTltContPersonalizeCmd_t cmd;
} cmpCmdTltContPersonalize_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_TLT_CONT_PERSONALIZE_RSP Response
* @{ */
diff --git a/mobicore/common/MobiCore/inc/TlCm/3.0/tlCmApi.h b/mobicore/common/MobiCore/inc/TlCm/3.0/tlCmApi.h
index 9325e1c..c66ab5a 100644
--- a/mobicore/common/MobiCore/inc/TlCm/3.0/tlCmApi.h
+++ b/mobicore/common/MobiCore/inc/TlCm/3.0/tlCmApi.h
@@ -10,7 +10,7 @@
* 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,
@@ -150,7 +150,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 006a1c2..7c460ea 100644
--- a/mobicore/common/MobiCore/inc/TlCm/cmpCommon.h
+++ b/mobicore/common/MobiCore/inc/TlCm/cmpCommon.h
@@ -12,7 +12,7 @@
* 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,
@@ -69,7 +69,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 +141,7 @@ typedef struct {
cmpCommandHeader_t cmdHeader;
} cmpCmdGetVersion_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_GET_VERSION_RSP Response
* @{ */
@@ -158,7 +158,7 @@ typedef struct {
/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_GET_SUID MC_CMP_CMD_GET_SUID
* @{ */
@@ -172,7 +172,7 @@ typedef struct {
cmpCommandHeader_t cmdHeader;
} cmpCmdGetSuid_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_GET_SUID_RSP Response
* @{ */
@@ -187,7 +187,7 @@ typedef struct {
/** @} */
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_GENERATE_AUTH_TOKEN MC_CMP_CMD_GENERATE_AUTH_TOKEN
* @{ */
@@ -229,7 +229,7 @@ typedef struct {
cmpGenAuthTokenCmd_t cmd;
} cmpCmdGenAuthToken_t;
-/** @} */
+/** @} */
/** @defgroup MC_CMP_CMD_GENERATE_AUTH_TOKEN_RSP Response
* @{ */
@@ -247,9 +247,9 @@ typedef struct {
mcSoAuthTokenCont_t soAuthCont;
} cmpRspGenAuthToken_t;
-/** @} */
+/** @} */
-/** @} */
+/** @} */
#endif // CMP_COMMON_H_
diff --git a/mobicore/common/MobiCore/inc/TlCm/tlCmApiCommon.h b/mobicore/common/MobiCore/inc/TlCm/tlCmApiCommon.h
index 1158c57..b526edd 100644
--- a/mobicore/common/MobiCore/inc/TlCm/tlCmApiCommon.h
+++ b/mobicore/common/MobiCore/inc/TlCm/tlCmApiCommon.h
@@ -9,7 +9,7 @@
* 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,
@@ -47,7 +47,7 @@ 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_ROOT_CONT_ACTIVATE = 6,
diff --git a/mobicore/common/MobiCore/inc/TlCm/tlCmError.h b/mobicore/common/MobiCore/inc/TlCm/tlCmError.h
index 6d08dcb..90d9ba9 100644
--- a/mobicore/common/MobiCore/inc/TlCm/tlCmError.h
+++ b/mobicore/common/MobiCore/inc/TlCm/tlCmError.h
@@ -8,7 +8,7 @@
* 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,
diff --git a/mobicore/common/MobiCore/inc/TlCm/tlCmUuid.h b/mobicore/common/MobiCore/inc/TlCm/tlCmUuid.h
index dabb9c7..5ce25c1 100644
--- a/mobicore/common/MobiCore/inc/TlCm/tlCmUuid.h
+++ b/mobicore/common/MobiCore/inc/TlCm/tlCmUuid.h
@@ -6,7 +6,7 @@
* 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,
diff --git a/mobicore/common/MobiCore/inc/TlCm/version.h b/mobicore/common/MobiCore/inc/TlCm/version.h
index a51c19e..00f3841 100644
--- a/mobicore/common/MobiCore/inc/TlCm/version.h
+++ b/mobicore/common/MobiCore/inc/TlCm/version.h
@@ -6,7 +6,7 @@
* 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,
diff --git a/mobicore/common/MobiCore/inc/mcContainer.h b/mobicore/common/MobiCore/inc/mcContainer.h
index c94e807..da741b0 100644
--- a/mobicore/common/MobiCore/inc/mcContainer.h
+++ b/mobicore/common/MobiCore/inc/mcContainer.h
@@ -1,15 +1,32 @@
-/** @addtogroup MC_CONTAINER mcContainer - Containers for MobiCore Content Management.
- * @ingroup MC_DATA_TYPES
- * @{
+/*
+ * Copyright (c) 2013-2014 TRUSTONIC LIMITED
+ * All rights reserved.
*
- * 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:
*
- * The present software is the confidential and proprietary information of
- * TRUSTONIC LIMITED. You shall not disclose the present software and shall
- * use it only in accordance with the terms of the license agreement you
- * entered into with TRUSTONIC LIMITED. This software may be subject to
- * export or import laws in certain countries.
+ * 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 MC_CONTAINER_H_
@@ -90,15 +107,15 @@ typedef enum {
/** SOC container. */
CONT_TYPE_SOC = 0,
/** Root container. */
- CONT_TYPE_ROOT,
+ CONT_TYPE_ROOT = 1,
/** Service provider container. */
- CONT_TYPE_SP,
+ CONT_TYPE_SP = 2,
/** Trustlet container. */
- CONT_TYPE_TLCON,
+ CONT_TYPE_TLCON = 3,
/** Service provider data. */
- CONT_TYPE_SPDATA,
+ CONT_TYPE_SPDATA = 4,
/** Trustlet data. */
- CONT_TYPE_TLDATA
+ CONT_TYPE_TLDATA = 5
} contType_t;
/** SHA256 checksum. */
@@ -108,7 +125,7 @@ typedef struct {
/** @defgroup MC_CONTAINER_CRYPTO_OBJECTS Container secrets.
* Data that is stored encrypted within the container.
- * @{ */
+ */
/** SoC secret */
typedef struct {
@@ -141,11 +158,9 @@ typedef union {
mcUuid_t uuid;
} mcCid_t;
-/** @} */
-
/** @defgroup MC_CONTAINER_CONTAINER_OBJECTS Container definitions.
* Container type definitions.
- * @{ */
+ */
/** SoC Container */
typedef struct {
@@ -213,8 +228,6 @@ typedef struct {
mcCoDataCont_t co;
} mcDataCont_t;
-/** @} */
-
/** Helper for finding maximum value */
#define MC_MAX(x, y) (((x)<(y))?(y):(x))
@@ -234,7 +247,7 @@ typedef struct {
/** @defgroup MC_CONTAINER_SECURE_OBJECTS Containers in secure objects.
* Secure objects wrapping different containers.
- * @{ */
+ */
/** Authentication token */
typedef struct {
@@ -300,8 +313,5 @@ typedef struct {
#define MC_TLBLOBLEN_MAGIC 0x7672746C
-/** @} */
-
#endif // MC_CONTAINER_H_
-/** @} */
diff --git a/mobicore/common/MobiCore/inc/mcDriverId.h b/mobicore/common/MobiCore/inc/mcDriverId.h
index df9aa88..de4535c 100644
--- a/mobicore/common/MobiCore/inc/mcDriverId.h
+++ b/mobicore/common/MobiCore/inc/mcDriverId.h
@@ -1,15 +1,32 @@
-/**
- * @file
- * Driver ID definition.
+/*
+ * Copyright (c) 2013-2014 TRUSTONIC LIMITED
+ * All rights reserved.
*
- * 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:
*
- * The present software is the confidential and proprietary information of
- * TRUSTONIC LIMITED. You shall not disclose the present software and shall
- * use it only in accordance with the terms of the license agreement you
- * entered into with TRUSTONIC LIMITED. This software may be subject to
- * export or import laws in certain countries.
+ * 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 RTMDRVID_H_
diff --git a/mobicore/common/MobiCore/inc/mcLoadFormat.h b/mobicore/common/MobiCore/inc/mcLoadFormat.h
index 028dbb5..85ac4f2 100644
--- a/mobicore/common/MobiCore/inc/mcLoadFormat.h
+++ b/mobicore/common/MobiCore/inc/mcLoadFormat.h
@@ -1,24 +1,32 @@
-/**
- * @defgroup MCLF MobiCore Load Format
- *
- * @defgroup MCLF_VER MCLF Versions
- * @ingroup MCLF
+/*
+ * Copyright (c) 2013-2014 TRUSTONIC LIMITED
+ * All rights reserved.
*
- * @addtogroup MCLF
- * @{
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
*
- * MobiCore Load Format declarations.
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
*
- * Holds the definitions for the layout of MobiCore Trustlet Blob.
+ * 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.
*
- * Copyright (c) 2013 TRUSTONIC LIMITED
- * All rights reserved
+ * 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.
*
- * The present software is the confidential and proprietary information of
- * TRUSTONIC LIMITED. You shall not disclose the present software and shall
- * use it only in accordance with the terms of the license agreement you
- * entered into with TRUSTONIC LIMITED. This software may be subject to
- * export or import laws in certain countries.
+ * 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 MCLOADFORMAT_H_
#define MCLOADFORMAT_H_
@@ -36,16 +44,9 @@
#define MC_SERVICE_HEADER_MAGIC_STR "MCLF" /**< "MCLF" as string */
/** @name MCLF flags */
-/*@{*/
#define MC_SERVICE_HEADER_FLAGS_PERMANENT (1U << 0) /**< Loaded service cannot be unloaded from MobiCore. */
#define MC_SERVICE_HEADER_FLAGS_NO_CONTROL_INTERFACE (1U << 1) /**< Service has no WSM control interface. */
#define MC_SERVICE_HEADER_FLAGS_DEBUGGABLE (1U << 2) /**< Service can be debugged. */
-/*@}*/
-
-#if !defined(ADDR_T_DEFINED)
-#define ADDR_T_DEFINED
-typedef void* addr_t; /**< an address, can be physical or virtual */
-#endif // !defined(ADDR_T_DEFINED)
/** Service type.
* The service type defines the type of executable.
@@ -55,7 +56,6 @@ typedef enum {
SERVICE_TYPE_DRIVER = 1, /**< Service is a driver. */
SERVICE_TYPE_SP_TRUSTLET = 2, /**< Service is a Trustlet. */
SERVICE_TYPE_SYSTEM_TRUSTLET = 3, /**< Service is a system Trustlet. */
-// SERVICE_TYPE_SP_TA = 4, /**< Service is a Trusted Application for t-base 300. */
} serviceType_t;
/**
@@ -71,7 +71,7 @@ typedef enum {
* Descriptor for a memory segment.
*/
typedef struct {
- addr_t start; /**< Virtual start address. */
+ uint32_t start; /**< Virtual start address. */
uint32_t len; /**< Length of the segment in bytes. */
} segmentDescriptor_t, *segmentDescriptor_ptr;
@@ -84,8 +84,6 @@ typedef struct {
uint32_t version; /**< Version of the MCLF header structure. */
} mclfIntro_t, *mclfIntro_ptr;
-/** @} */
-
// Version 2 /////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
@@ -93,7 +91,6 @@ typedef struct {
* @ingroup MCLF_VER
*
* @addtogroup MCLF_VER_V2
- * @{
*/
/**
@@ -120,7 +117,7 @@ typedef struct {
segmentDescriptor_t text; /**< Virtual text segment. */
segmentDescriptor_t data; /**< Virtual data segment. */
uint32_t bssLen; /**< Length of the BSS segment in bytes. MUST be at least 8 byte. */
- addr_t entry; /**< Virtual start address of service code. */
+ uint32_t entry; /**< Virtual start address of service code. */
uint32_t serviceVersion; /**< Version of the interface the driver exports. */
// These should be put on next MCLF update:
@@ -128,7 +125,6 @@ typedef struct {
// uint32_t permittedHwCf; /**< Starting 2.3: If nonzero, hw configuration which is allowed to execute binary */
} mclfHeaderV2_t, *mclfHeaderV2_ptr;
-/** @} */
/**
@@ -139,7 +135,6 @@ typedef struct {
mcSuid_t permittedSuid; /**< Starting 2.3: If nonzero, suid which is allowed to execute binary */
uint32_t permittedHwCfg; /**< Starting 2.3: If nonzero, hw configuration which is allowed to execute binary */
} mclfHeaderV23_t, *mclfHeaderV23_ptr;
-/** @} */
/**
@@ -151,7 +146,6 @@ typedef struct {
uint32_t attestationOffset; /**<Starting 2.4: Offset of attestation data area. */
} mclfHeaderV24_t, *mclfHeaderV24_ptr;
-/** @} */
@@ -164,16 +158,16 @@ typedef struct {
typedef struct {
uint32_t version; /**< Version of the TextHeader structure. */
uint32_t textHeaderLen; /**< Size of this structure (fixed at compile time) */
- uint32_t requiredFeat; /**< Flags to indicate features that Mobicore must understand/interprete when loading.
+ uint32_t requiredFeat; /**< Flags to indicate features that Mobicore must understand/interpret when loading.
Initial value set at compile time.
Required always. */
- addr_t mcLibEntry; /**< Address for McLib entry.
+ uint32_t mcLibEntry; /**< Address for McLib entry.
Mobicore sets at load time for trustlets / drivers.
Required always. */
segmentDescriptor_t mcLibData; /**< Segment for McLib data.
Set at compile time.
Required always. */
- addr_t mcLibBase; /**< McLib base address.
+ uint32_t mcLibBase; /**< McLib base address.
Mobicore sets at load time for trustlets / drivers.
Required always. */
uint32_t tlApiVers; /**< TlApi version used when building trustlet.
@@ -182,13 +176,12 @@ typedef struct {
uint32_t drApiVers; /**< DrApi version used when building trustlet.
Value set at compile time for drivers. 0 for trustlets.
Required always. */
- addr_t ta_properties; /**< address of _TA_Properties in the TA. */
+ uint32_t ta_properties; /**< address of _TA_Properties in the TA. */
} mclfTextHeader_t, *mclfTextHeader_ptr;
// Version 2 ///////////////////////////////////////////////////////////////////////////////////////////////////
/**
* @addtogroup MCLF
- * @{
*/
/** MCLF header */
@@ -210,4 +203,3 @@ typedef union {
#endif /* MCLOADFORMAT_H_ */
-/** @} */
diff --git a/mobicore/common/MobiCore/inc/mcRootid.h b/mobicore/common/MobiCore/inc/mcRootid.h
index b60bb56..57e12bc 100644
--- a/mobicore/common/MobiCore/inc/mcRootid.h
+++ b/mobicore/common/MobiCore/inc/mcRootid.h
@@ -1,19 +1,32 @@
-/**
- * @addtogroup MC_ROOTID mcRootid - Root container id.
+/*
+ * Copyright (c) 2013-2014 TRUSTONIC LIMITED
+ * All rights reserved.
*
- * Global definition of root ID.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
*
- * Copyright (c) 2013 TRUSTONIC LIMITED
- * All rights reserved
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
*
- * The present software is the confidential and proprietary information of
- * TRUSTONIC LIMITED. You shall not disclose the present software and shall
- * use it only in accordance with the terms of the license agreement you
- * entered into with TRUSTONIC LIMITED. This software may be subject to
- * export or import laws in certain countries.
+ * 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.
*
- * @ingroup MC_DATA_TYPES
- * @{
+ * 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 MC_ROOTID_H_
@@ -33,4 +46,3 @@ static const mcRootid_t MC_ROOTID_SYSTEM = 0xFFFFFFFE;
#endif // MC_ROOTID_H_
-/** @} */
diff --git a/mobicore/common/MobiCore/inc/mcSo.h b/mobicore/common/MobiCore/inc/mcSo.h
index 848d6d4..897f756 100644
--- a/mobicore/common/MobiCore/inc/mcSo.h
+++ b/mobicore/common/MobiCore/inc/mcSo.h
@@ -1,20 +1,32 @@
-/**
- * @defgroup MC_DATA_TYPES MobiCore generic data types
- *
- * @addtogroup MC_SO mcSo - Secure objects definitions.
- *
- * Copyright (c) 2013 TRUSTONIC LIMITED
- * All rights reserved
- *
- * The present software is the confidential and proprietary information of
- * TRUSTONIC LIMITED. You shall not disclose the present software and shall
- * use it only in accordance with the terms of the license agreement you
- * entered into with TRUSTONIC LIMITED. This software may be subject to
- * export or import laws in certain countries.
- *
- * @ingroup MC_DATA_TYPES
- * @{
- *
+/*
+ * 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.
*/
#ifndef MC_SO_H_
@@ -231,4 +243,3 @@ typedef struct {
#endif // MC_SO_H_
-/** @} */
diff --git a/mobicore/common/MobiCore/inc/mcSpid.h b/mobicore/common/MobiCore/inc/mcSpid.h
index 2714d1e..b630d87 100644
--- a/mobicore/common/MobiCore/inc/mcSpid.h
+++ b/mobicore/common/MobiCore/inc/mcSpid.h
@@ -1,17 +1,32 @@
-/**
- * @addtogroup MC_SPID mcSpid - service provider ID.
+/*
+ * Copyright (c) 2013-2014 TRUSTONIC LIMITED
+ * All rights reserved.
*
- * 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:
*
- * The present software is the confidential and proprietary information of
- * TRUSTONIC LIMITED. You shall not disclose the present software and shall
- * use it only in accordance with the terms of the license agreement you
- * entered into with TRUSTONIC LIMITED. This software may be subject to
- * export or import laws in certain countries.
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
*
- * @ingroup MC_DATA_TYPES
- * @{
+ * 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 MC_SPID_H_
@@ -33,6 +48,8 @@ static const mcSpid_t MC_SPID_SYSTEM = 0xFFFFFFFE;
static const mcSpid_t MC_SPID_RESERVED_TEST = 0xFFFFFFFD;
static const mcSpid_t MC_SPID_TRUSTONIC_TEST = 0x4;
+/** SPID reserved for OTA development */
+static const mcSpid_t MC_SPID_TRUSTONIC_OTA = 0x2A;
+
#endif // MC_SPID_H_
-/** @} */
diff --git a/mobicore/common/MobiCore/inc/mcSuid.h b/mobicore/common/MobiCore/inc/mcSuid.h
index a80cfc5..8a6a55e 100644
--- a/mobicore/common/MobiCore/inc/mcSuid.h
+++ b/mobicore/common/MobiCore/inc/mcSuid.h
@@ -1,17 +1,32 @@
-/**
- * @addtogroup MC_SUID mcSuid - SoC unique ID.
+/*
+ * Copyright (c) 2013-2014 TRUSTONIC LIMITED
+ * All rights reserved.
*
- * 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:
*
- * The present software is the confidential and proprietary information of
- * TRUSTONIC LIMITED. You shall not disclose the present software and shall
- * use it only in accordance with the terms of the license agreement you
- * entered into with TRUSTONIC LIMITED. This software may be subject to
- * export or import laws in certain countries.
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
*
- * @ingroup MC_DATA_TYPES
- * @{
+ * 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 MC_SUID_H_
@@ -33,4 +48,3 @@ typedef struct {
#endif // MC_SUID_H_
-/** @} */
diff --git a/mobicore/common/MobiCore/inc/mcUuid.h b/mobicore/common/MobiCore/inc/mcUuid.h
index 16ebb85..918d7f8 100644
--- a/mobicore/common/MobiCore/inc/mcUuid.h
+++ b/mobicore/common/MobiCore/inc/mcUuid.h
@@ -1,17 +1,32 @@
-/**
- * @addtogroup MC_UUID mcUuid - Universally Unique Identifier.
+/*
+ * Copyright (c) 2013-2014 TRUSTONIC LIMITED
+ * All rights reserved.
*
- * 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:
*
- * The present software is the confidential and proprietary information of
- * TRUSTONIC LIMITED. You shall not disclose the present software and shall
- * use it only in accordance with the terms of the license agreement you
- * entered into with TRUSTONIC LIMITED. This software may be subject to
- * export or import laws in certain countries.
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
*
- * @ingroup MC_DATA_TYPES
- * @{
+ * 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 MC_UUID_H_
@@ -30,7 +45,7 @@ typedef struct {
{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }
-static const mcUuid_t MC_UUID_FREE = {
+static __attribute__((unused)) const mcUuid_t MC_UUID_FREE = {
MC_UUID_FREE_DEFINE
};
@@ -39,7 +54,7 @@ static const mcUuid_t MC_UUID_FREE = {
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
-static const mcUuid_t MC_UUID_RESERVED = {
+static __attribute__((unused)) const mcUuid_t MC_UUID_RESERVED = {
MC_UUID_RESERVED_DEFINE
};
@@ -48,10 +63,9 @@ static const mcUuid_t MC_UUID_RESERVED = {
{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE }
-static const mcUuid_t MC_UUID_SYSTEM = {
+static __attribute__((unused)) const mcUuid_t MC_UUID_SYSTEM = {
MC_UUID_SYSTEM_DEFINE
};
#endif // MC_UUID_H_
-/** @} */
diff --git a/mobicore/common/MobiCore/inc/mcVersionHelper.h b/mobicore/common/MobiCore/inc/mcVersionHelper.h
index a5af69f..b4f9b5f 100644
--- a/mobicore/common/MobiCore/inc/mcVersionHelper.h
+++ b/mobicore/common/MobiCore/inc/mcVersionHelper.h
@@ -1,28 +1,42 @@
-/** @addtogroup MC_RTM
- * @{
- * MobiCore Version Helper Macros
- *
- * Copyright (c) 2013 TRUSTONIC LIMITED
- * All rights reserved
- *
- * The present software is the confidential and proprietary information of
- * TRUSTONIC LIMITED. You shall not disclose the present software and shall
- * use it only in accordance with the terms of the license agreement you
- * entered into with TRUSTONIC LIMITED. This software may be subject to
- * export or import laws in certain countries.
+/*
+ * 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.
*/
-#include <stdio.h>
-
-//lint -emacro(*,MC_CHECK_VERSION) Disable all warnings for this macro.
-//lint -emacro(*,MC_MAKE_VERSION) Disable all warnings for this macro.
-//lint -emacro(*,MC_GET_MAJOR_VERSION) Disable all warnings for this macro.
-//lint -emacro(*,MC_GET_MINOR_VERSION) Disable all warnings for this macro.
-//lint -emacro(*,MC_GET_MINOR_VERSION) Disable all warnings for this macro.
-//lint -emacro(*,ASSERT_VERSION_IMPLEMENTATION) Disable all warnings for this macro.
-//lint -esym(*,Actual_*) Disable all warnings for these functions.
-/** Create a version number given major and minor numbers. */
-#define MC_MAKE_VERSION(major,minor) \
+#ifndef MCVERSIONHELPER_H_
+#define MCVERSIONHELPER_H_
+
+#include <stdio.h>
+
+
+/** Create a version number given major and minor numbers. */
+#define MC_MAKE_VERSION(major,minor) \
( (((major) & 0xffff) << 16) |\
((minor) & 0xffff))
@@ -211,3 +225,6 @@
return 0; \
}
#endif
+
+#endif // MCVERSIONHELPER_H_
+
diff --git a/mobicore/common/MobiCore/inc/mcVersionInfo.h b/mobicore/common/MobiCore/inc/mcVersionInfo.h
index f93115a..26542ff 100644
--- a/mobicore/common/MobiCore/inc/mcVersionInfo.h
+++ b/mobicore/common/MobiCore/inc/mcVersionInfo.h
@@ -1,17 +1,33 @@
-/** @addtogroup MC_RTM
- * @{
- * MobiCore Version Information
+/*
+ * Copyright (c) 2013-2014 TRUSTONIC LIMITED
+ * All rights reserved.
*
- * 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:
*
- * The present software is the confidential and proprietary information of
- * TRUSTONIC LIMITED. You shall not disclose the present software and shall
- * use it only in accordance with the terms of the license agreement you
- * entered into with TRUSTONIC LIMITED. This software may be subject to
- * export or import laws in certain countries.
+ * 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 MCVERSIONINFO_H_
#define MCVERSIONINFO_H_
diff --git a/mobicore/common/MobiCore/inc/version.md5 b/mobicore/common/MobiCore/inc/version.md5
new file mode 100644
index 0000000..3750066
--- /dev/null
+++ b/mobicore/common/MobiCore/inc/version.md5
@@ -0,0 +1 @@
+a548519579b1a7cddb06c56989fd01f8 *-
diff --git a/mobicore/daemon/CleanSpec.mk b/mobicore/daemon/CleanSpec.mk
deleted file mode 100644
index 7dd6f6c..0000000
--- a/mobicore/daemon/CleanSpec.mk
+++ /dev/null
@@ -1,61 +0,0 @@
-# Copyright (C) 2007 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-# If you don't need to do a full clean build but would like to touch
-# a file or delete some intermediate files, add a clean step to the end
-# of the list. These steps will only be run once, if they haven't been
-# run before.
-#
-# E.g.:
-# $(call add-clean-step, touch -c external/sqlite/sqlite3.h)
-# $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates)
-#
-# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with
-# files that are missing or have been moved.
-#
-# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory.
-# Use $(OUT_DIR) to refer to the "out" directory.
-#
-# If you need to re-do something that's already mentioned, just copy
-# the command and add it to the bottom of the list. E.g., if a change
-# that you made last week required touching a file and a change you
-# made today requires touching the same file, just copy the old
-# touch step and add it to the end of the list.
-#
-# ************************************************
-# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
-# ************************************************
-
-# For example:
-#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates)
-#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates)
-#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f)
-#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)
-#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/EXECUTABLES/openssl_intermediates)
-#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/EXECUTABLES/openssl_intermediates)
-#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libcrypto_intermediates $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libssl_intermediates $(PRODUCT_OUT)/obj/EXECUTABLES/openssl_intermediates $(PRODUCT_OUT)/obj/EXECUTABLES/ssltest_intermediates)
-#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libcrypto_intermediates $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libssl_intermediates $(PRODUCT_OUT)/obj/EXECUTABLES/openssl_intermediates $(PRODUCT_OUT)/obj/EXECUTABLES/ssltest_intermediates)
-#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libcrypto_intermediates $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libssl_intermediates $(PRODUCT_OUT)/obj/EXECUTABLES/openssl_intermediates $(PRODUCT_OUT)/obj/EXECUTABLES/ssltest_intermediates)
-#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libcrypto_intermediates $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libssl_intermediates $(PRODUCT_OUT)/obj/EXECUTABLES/openssl_intermediates $(PRODUCT_OUT)/obj/EXECUTABLES/ssltest_intermediates)
-#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libcrypto_intermediates $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libssl_intermediates $(PRODUCT_OUT)/obj/EXECUTABLES/openssl_intermediates $(PRODUCT_OUT)/obj/EXECUTABLES/ssltest_intermediates)
-#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libssl_intermediates)
-#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libcrypto_intermediates)
-#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libssl_static_intermediates)
-#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libcrypto_static_intermediates)
-#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/EXECUTABLES/*ssl*_intermediates $(PRODUCT_OUT)/obj/*/libssl_*intermediates $(PRODUCT_OUT)/obj/*/libcrypto_*intermediates)
-
-# ************************************************
-# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
-# ************************************************
diff --git a/mobicore/daemon/ClientLib/public/GP/tee_error.h b/mobicore/daemon/ClientLib/public/GP/tee_error.h
deleted file mode 100644
index fbae687..0000000
--- a/mobicore/daemon/ClientLib/public/GP/tee_error.h
+++ /dev/null
@@ -1,177 +0,0 @@
-/**
- * Copyright (c) 2013 TRUSTONIC LIMITED
- * All rights reserved
- *
- * The present software is the confidential and proprietary information of
- * TRUSTONIC LIMITED. You shall not disclose the present software and shall
- * use it only in accordance with the terms of the license agreement you
- * entered into with TRUSTONIC LIMITED. This software may be subject to
- * export or import laws in certain countries.
- */
-
-#ifndef __TEE_ERROR_H__
-#define __TEE_ERROR_H__
-
-#define TEE_SUCCESS ((TEE_Result)0x00000000)
-#define TEEC_SUCCESS TEE_SUCCESS
-
-#define TEE_ERROR_CORRUPT_OBJECT ((TEE_Result)0xF0100001)
-#define TEE_ERROR_CORRUPT_OBJECT_2 ((TEE_Result)0xF0100002)
-
-/**
- * Generic error code : Generic error
- **/
-#define TEE_ERROR_GENERIC ((TEE_Result)0xFFFF0000)
-#define TEEC_ERROR_GENERIC TEE_ERROR_GENERIC
-
-/**
- * Generic error code : The underlying security system denies the access to the
- * object
- **/
-#define TEE_ERROR_ACCESS_DENIED ((TEE_Result)0xFFFF0001)
-#define TEEC_ERROR_ACCESS_DENIED TEE_ERROR_ACCESS_DENIED
-
-/**
- * Generic error code : The pending operation is cancelled.
- **/
-#define TEE_ERROR_CANCEL ((TEE_Result)0xFFFF0002)
-#define TEEC_ERROR_CANCEL TEE_ERROR_CANCEL
-
-/**
- * Generic error code : The underlying system detects a conflict
- **/
-#define TEE_ERROR_ACCESS_CONFLICT ((TEE_Result)0xFFFF0003)
-#define TEEC_ERROR_ACCESS_CONFLICT TEE_ERROR_ACCESS_CONFLICT
-
-/**
- * Generic error code : Too much data for the operation or some data remain
- * unprocessed by the operation.
- **/
-#define TEE_ERROR_EXCESS_DATA ((TEE_Result)0xFFFF0004)
-#define TEEC_ERROR_EXCESS_DATA TEE_ERROR_EXCESS_DATA
-
-/**
- * Generic error code : Error of data format
- **/
-#define TEE_ERROR_BAD_FORMAT ((TEE_Result)0xFFFF0005)
-#define TEEC_ERROR_BAD_FORMAT TEE_ERROR_BAD_FORMAT
-
-/**
- * Generic error code : The specified parameters are invalid
- **/
-#define TEE_ERROR_BAD_PARAMETERS ((TEE_Result)0xFFFF0006)
-#define TEEC_ERROR_BAD_PARAMETERS TEE_ERROR_BAD_PARAMETERS
-
-
-/**
- * Generic error code : Illegal state for the operation.
- **/
-#define TEE_ERROR_BAD_STATE ((TEE_Result)0xFFFF0007)
-#define TEEC_ERROR_BAD_STATE TEE_ERROR_BAD_STATE
-
-/**
- * Generic error code : The item is not found
- **/
-#define TEE_ERROR_ITEM_NOT_FOUND ((TEE_Result)0xFFFF0008)
-#define TEEC_ERROR_ITEM_NOT_FOUND TEE_ERROR_ITEM_NOT_FOUND
-
-/**
- * Generic error code : The specified operation is not implemented
- **/
-#define TEE_ERROR_NOT_IMPLEMENTED ((TEE_Result)0xFFFF0009)
-#define TEEC_ERROR_NOT_IMPLEMENTED TEE_ERROR_NOT_IMPLEMENTED
-
-/**
- * Generic error code : The specified operation is not supported
- **/
-#define TEE_ERROR_NOT_SUPPORTED ((TEE_Result)0xFFFF000A)
-#define TEEC_ERROR_NOT_SUPPORTED TEE_ERROR_NOT_SUPPORTED
-
-/**
- * Generic error code : Insufficient data is available for the operation.
- **/
-#define TEE_ERROR_NO_DATA ((TEE_Result)0xFFFF000B)
-#define TEEC_ERROR_NO_DATA TEE_ERROR_NO_DATA
-
-/**
- * Generic error code : Not enough memory to perform the operation
- **/
-#define TEE_ERROR_OUT_OF_MEMORY ((TEE_Result)0xFFFF000C)
-#define TEEC_ERROR_OUT_OF_MEMORY TEE_ERROR_OUT_OF_MEMORY
-
-/**
- * Generic error code : The service is currently unable to handle the request;
- * try later
- **/
-#define TEE_ERROR_BUSY ((TEE_Result)0xFFFF000D)
-#define TEEC_ERROR_BUSY TEE_ERROR_BUSY
-
-/**
- * Generic communication error
- **/
-#define TEE_ERROR_COMMUNICATION ((TEE_Result)0xFFFF000E)
-#define TEEC_ERROR_COMMUNICATION TEE_ERROR_COMMUNICATION
-
-/**
- * Generic error code : security violation
- **/
-#define TEE_ERROR_SECURITY ((TEE_Result)0xFFFF000F)
-#define TEEC_ERROR_SECURITY TEE_ERROR_SECURITY
-
-/**
- * Generic error code : the buffer is too short
- **/
-#define TEE_ERROR_SHORT_BUFFER ((TEE_Result)0xFFFF0010)
-#define TEEC_ERROR_SHORT_BUFFER TEE_ERROR_SHORT_BUFFER
-
-/**
- * Generic error code : The pending operation is cancelled.
- */
-#define TEE_ERROR_EXTERNAL_CANCEL ((TEE_Result)0xFFFF0011)
-
-/**
- * Generic error code : the operation is not terminated
- **/
-#define TEE_PENDING ((TEE_Result)0xFFFF2000)
-
-/**
- * Generic error code : A timeout occurred
- **/
-#define TEE_ERROR_TIMEOUT ((TEE_Result)0xFFFF3001)
-
-/**
- * Generic error code : Overflow
- **/
-#define TEE_ERROR_OVERFLOW ((TEE_Result)0xFFFF300F)
-
-/**
- * Error of communication: The target of the connection is dead
- **/
-#define TEE_ERROR_TARGET_DEAD ((TEE_Result)0xFFFF3024)
-#define TEEC_ERROR_TARGET_DEAD TEE_ERROR_TARGET_DEAD
-
-/*------------------------------------------------------------------------------
- Storage Error Codes
-------------------------------------------------------------------------------*/
-
-/** File system error code: not enough space to complete the operation. */
-#define TEE_ERROR_STORAGE_NO_SPACE ((TEE_Result)0xFFFF3041)
-
-/*------------------------------------------------------------------------------
- Crypto error codes
-------------------------------------------------------------------------------*/
-
-#define TEE_ERROR_MAC_INVALID ((TEE_Result)0xFFFF3071)
-
-#define TEE_ERROR_SIGNATURE_INVALID ((TEE_Result)0xFFFF3072)
-
-/*------------------------------------------------------------------------------
- Date error codes
-------------------------------------------------------------------------------*/
-
-#define TEE_ERROR_TIME_NOT_SET ((TEE_Result)0xFFFF5000)
-
-#define TEE_ERROR_TIME_NEEDS_RESET ((TEE_Result)0xFFFF5001)
-
-#endif /* __TEE_ERROR_H__ */
-
diff --git a/mobicore/daemon/ClientLib/public/GP/tee_internal_api_impl.h b/mobicore/daemon/ClientLib/public/GP/tee_internal_api_impl.h
deleted file mode 100644
index 9acd363..0000000
--- a/mobicore/daemon/ClientLib/public/GP/tee_internal_api_impl.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * Copyright (c) 2013 TRUSTONIC LIMITED
- * All rights reserved
- *
- * The present software is the confidential and proprietary information of
- * TRUSTONIC LIMITED. You shall not disclose the present software and shall
- * use it only in accordance with the terms of the license agreement you
- * entered into with TRUSTONIC LIMITED. This software may be subject to
- * export or import laws in certain countries.
- */
-
-#ifndef __TEE_INTERNAL_API_IMPL_H__
-#define __TEE_INTERNAL_API_IMPL_H__
-
-#if TBASE_API_LEVEL >= 3
-
-/*------------------------------------------------------------------------------
- Constants
-------------------------------------------------------------------------------*/
-// Property type constants
-#define TEE_PROPERTY_TYPE_NONE 0
-#define TEE_PROPERTY_TYPE_BOOLEAN 1
-#define TEE_PROPERTY_TYPE_UINT32 2
-#define TEE_PROPERTY_TYPE_BINARY 3
-#define TEE_PROPERTY_TYPE_STRING 4
-#define TEE_PROPERTY_TYPE_UUID 5
-
-// Predefined offsets to properties
-#define TEE_PROPERTY_GPUUID_VALUE_OFFSET 20
-#define TEE_PROPERTY_DATASIZE_VALUE_OFFSET 152
-#define TEE_PROPERTY_STACKSIZE_VALUE_OFFSET 180
-
-#endif /* TBASE_API_LEVEL */
-
-#endif /* __TEE_INTERNAL_API_IMPL_H__ */
diff --git a/mobicore/daemon/ClientLib/public/Windows/t-base_client_api.def b/mobicore/daemon/ClientLib/public/Windows/t-base_client_api.def
deleted file mode 100644
index 382a5b7..0000000
--- a/mobicore/daemon/ClientLib/public/Windows/t-base_client_api.def
+++ /dev/null
@@ -1,25 +0,0 @@
-; ------------------------------------------------------------------------
-; Copyright (c) 2013 TRUSTONIC LIMITED
-; All rights reserved
-;
-; The present software is the confidential and proprietary information of
-; TRUSTONIC LIMITED. You shall not disclose the present software and shall
-; use it only in accordance with the terms of the license agreement you
-; entered into with TRUSTONIC LIMITED. This software may be subject to
-; export or import laws in certain countries.
-; ------------------------------------------------------------------------
-EXPORTS
- mcOpenDevice
- mcCloseDevice
- mcOpenSession
- mcOpenTrustlet
- mcCloseSession
- mcNotify
- mcWaitNotification
- mcMallocWsm
- mcFreeWsm
- mcMap
- mcUnmap
- mcGetSessionErrorCode
- mcGetMobiCoreVersion
-
diff --git a/mobicore/daemon/ClientLib/public/Windows/t-base_client_api.sln b/mobicore/daemon/ClientLib/public/Windows/t-base_client_api.sln
deleted file mode 100644
index df39313..0000000
--- a/mobicore/daemon/ClientLib/public/Windows/t-base_client_api.sln
+++ /dev/null
@@ -1,20 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Express 2012 for Windows Desktop
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "t-base_client_api", "t-base_client_api.vcxproj", "{AA0349EE-7BCF-4CFF-ABB0-62EC1810DE67}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Release|Win32 = Release|Win32
- Release|x64 = Release|x64
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {AA0349EE-7BCF-4CFF-ABB0-62EC1810DE67}.Release|Win32.ActiveCfg = Release|Win32
- {AA0349EE-7BCF-4CFF-ABB0-62EC1810DE67}.Release|Win32.Build.0 = Release|Win32
- {AA0349EE-7BCF-4CFF-ABB0-62EC1810DE67}.Release|x64.ActiveCfg = Release|x64
- {AA0349EE-7BCF-4CFF-ABB0-62EC1810DE67}.Release|x64.Build.0 = Release|x64
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/mobicore/daemon/ClientLib/public/Windows/t-base_client_api.vcxproj b/mobicore/daemon/ClientLib/public/Windows/t-base_client_api.vcxproj
deleted file mode 100644
index 41bfa15..0000000
--- a/mobicore/daemon/ClientLib/public/Windows/t-base_client_api.vcxproj
+++ /dev/null
@@ -1,109 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="..\ClientLib.cpp" />
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{AA0349EE-7BCF-4CFF-ABB0-62EC1810DE67}</ProjectGuid>
- <RootNamespace>t-base_client_api</RootNamespace>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>
- </CharacterSet>
- <PlatformToolset>v110</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet />
- <PlatformToolset>v110</PlatformToolset>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\..\Out\Bin\Windows\$(Platform)\Release\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\..\Out\_build\Windows\$(Platform)\Release\</IntDir>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <OutDir>..\..\..\..\Out\Bin\Windows\$(Platform)\Release\</OutDir>
- <IntDir>..\..\..\..\Out\_build\Windows\$(Platform)\Release\</IntDir>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>..\Common;$(COMP_PATH_TlSdk)\Public\MobiCore\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32</PreprocessorDefinitions>
- <WarningLevel>
- </WarningLevel>
- <RuntimeLibrary>
- </RuntimeLibrary>
- </ClCompile>
- <ResourceCompile>
- <PreprocessorDefinitions>
- </PreprocessorDefinitions>
- <Culture>
- </Culture>
- <AdditionalIncludeDirectories>
- </AdditionalIncludeDirectories>
- </ResourceCompile>
- <Lib>
- <AdditionalDependencies>
- </AdditionalDependencies>
- </Lib>
- <Link>
- <ImportLibrary>
- </ImportLibrary>
- <ModuleDefinitionFile>$(TargetName).def</ModuleDefinitionFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <AdditionalIncludeDirectories>..\Common;$(COMP_PATH_TlSdk)\Public\MobiCore\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32</PreprocessorDefinitions>
- <WarningLevel>
- </WarningLevel>
- <RuntimeLibrary>
- </RuntimeLibrary>
- </ClCompile>
- <ResourceCompile>
- <PreprocessorDefinitions>
- </PreprocessorDefinitions>
- <Culture>
- </Culture>
- <AdditionalIncludeDirectories>
- </AdditionalIncludeDirectories>
- </ResourceCompile>
- <Lib>
- <AdditionalDependencies>
- </AdditionalDependencies>
- </Lib>
- <Link>
- <ImportLibrary>
- </ImportLibrary>
- <ModuleDefinitionFile>$(TargetName).def</ModuleDefinitionFile>
- </Link>
- </ItemDefinitionGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/mobicore/daemon/Daemon/Device/public/ExcDevice.h b/mobicore/daemon/Daemon/Device/public/ExcDevice.h
deleted file mode 100644
index 733fbcd..0000000
--- a/mobicore/daemon/Daemon/Device/public/ExcDevice.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/** @addtogroup MCD_MCDIMPL_DAEMON_DEV
- * @{
- * @file
- *
- * Device exceptions.
- *
- * 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 EXCDEVICE_H_
-#define EXCDEVICE_H_
-
-#include <stdint.h>
-#include <exception>
-#include <cstdio>
-#include <cstdlib>
-
-#define ERROR_MCI_VERSION_MISMATCH ((int)(-2))
-#define ERROR_KMOD_VERSION_MISMATCH ((int)(-3))
-
-class ExcDevice: public std::exception
-{
-
-public:
-
- ExcDevice(const char *description, int cause) :
- cause(cause), description(description) {
- }
-
- virtual int getCause() const throw () {
- return cause;
- }
-
- virtual const char *getDescription() const throw () {
- return description;
- }
-
-private:
-
- int cause;
- const char *description;
-};
-
-#endif /* EXCDEVICE_H_ */
-
-/** @} */
diff --git a/mobicore/daemon/Daemon/FSD/public/dci.h b/mobicore/daemon/Daemon/FSD/public/dci.h
deleted file mode 100644
index c805f5c..0000000
--- a/mobicore/daemon/Daemon/FSD/public/dci.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2013 TRUSTONIC LIMITED
- * All rights reserved
- *
- * The present software is the confidential and proprietary information of
- * TRUSTONIC LIMITED. You shall not disclose the present software and shall
- * use it only in accordance with the terms of the license agreement you
- * entered into with TRUSTONIC LIMITED. This software may be subject to
- * export or import laws in certain countries.
- */
-
-/**
- * @file dci.h
- * @brief Contains DCI (Driver Control
- * Interface) definitions and data structures
- *
- */
-
-#ifndef __DCI_H__
-#define __DCI_H__
-
-
-typedef uint32_t dciCommandId_t;
-typedef uint32_t dciResponseId_t;
-typedef uint32_t dciReturnCode_t;
-
-/**< Responses have bit 31 set */
-#define RSP_ID_MASK (1U << 31)
-#define RSP_ID(cmdId) (((uint32_t)(cmdId)) | RSP_ID_MASK)
-#define IS_CMD(cmdId) ((((uint32_t)(cmdId)) & RSP_ID_MASK) == 0)
-#define IS_RSP(cmdId) ((((uint32_t)(cmdId)) & RSP_ID_MASK) == RSP_ID_MASK)
-
-/**
- * Return codes of driver commands.
- */
-#define RET_OK 0
-#define RET_ERR_UNKNOWN_CMD 1
-#define RET_ERR_NOT_SUPPORTED 2
-#define RET_ERR_INTERNAL_ERROR 3
-/* ... add more error codes when needed */
-
-/**
- * DCI command header.
- */
-typedef struct{
- dciCommandId_t commandId; /**< Command ID */
-} dciCommandHeader_t;
-
-/**
- * DCI response header.
- */
-typedef struct{
- dciResponseId_t responseId; /**< Response ID (must be command ID | RSP_ID_MASK )*/
- dciReturnCode_t returnCode; /**< Return code of command */
-} dciResponseHeader_t;
-
-#endif // __DCI_H__
diff --git a/mobicore/daemon/Daemon/FSD/public/drSecureStorage_Api.h b/mobicore/daemon/Daemon/FSD/public/drSecureStorage_Api.h
deleted file mode 100644
index 6c881e3..0000000
--- a/mobicore/daemon/Daemon/FSD/public/drSecureStorage_Api.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (c) 2013 TRUSTONIC LIMITED
- * All rights reserved
- *
- * The present software is the confidential and proprietary information of
- * TRUSTONIC LIMITED. You shall not disclose the present software and shall
- * use it only in accordance with the terms of the license agreement you
- * entered into with TRUSTONIC LIMITED. This software may be subject to
- * export or import laws in certain countries.
- */
-
-/**
- * @file drSecureStorage_Api.h
- * @brief Contains DCI command definitions and data structures
- *
- */
-
-#ifndef __DRTEMPLATEAPI_H__
-#define __DRTEMPLATEAPI_H__
-
-#include "dci.h"
-#include "tee_internal_api.h"
-
-
-#define RW_DATA_SIZE 4096
-
-/**
- * Command ID's for communication
- * FSD <--> STH
- */
-
-#define STH_MESSAGE_TYPE_LOOK 0
-#define STH_MESSAGE_TYPE_READ 1
-#define STH_MESSAGE_TYPE_WRITE 2
-#define STH_MESSAGE_TYPE_DELETE 3
-
-#define CMD_ST_SYNC 5
-#define NOTIFY_DCIH 6
-#define NOTIFY_IPCH 7
-/*... add more command ids when needed */
-
-#define STH_PUBLIC_FILE_NAME_SIZE 20
-
-typedef struct {
- uint32_t status;
- uint8_t type;
- uint8_t reserved0;
- uint16_t flags;
- uint32_t payloadLen;
- TEE_UUID uuid;
- unsigned char filename[STH_PUBLIC_FILE_NAME_SIZE];
- unsigned char payload[];
-} STH_FSD_message_t;
-
-typedef struct
-{
- char header[5];
- unsigned char version;
- uint16_t cryptoLen;
- uint32_t dataLen;
-}FSD_plaintext;
-
-/**
- * command message.
- *
- * @param len Lenght of the data to process.
- * @param data Data to be processed
- */
-typedef struct {
- dciCommandHeader_t header; /**< Command header */
- uint32_t len; /**< Length of data to process */
-} cmd_t;
-
-
-/**
- * Response structure
- */
-typedef struct {
- dciResponseHeader_t header; /**< Response header */
- uint32_t len;
-} rsp_t;
-
-/**
- * DCI message data.
- */
-typedef struct {
- union {
- cmd_t command;
- rsp_t response;
- };
-
- STH_FSD_message_t sth_request;
-} dciMessage_t;
-
-/**
- * Driver UUID. Update accordingly after reserving UUID
- */
-#define DRV_STH_UUID { { 0x07, 0x05, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }
-
-
-#endif // __DRTEMPLATEAPI_H__
diff --git a/mobicore/daemon/MODULE_LICENSE_BSD b/mobicore/daemon/MODULE_LICENSE_BSD
deleted file mode 100644
index e69de29..0000000
--- a/mobicore/daemon/MODULE_LICENSE_BSD
+++ /dev/null
diff --git a/mobicore/daemon/NOTICE b/mobicore/daemon/NOTICE
deleted file mode 100644
index d742e22..0000000
--- a/mobicore/daemon/NOTICE
+++ /dev/null
@@ -1,25 +0,0 @@
- Copyright Giesecke & Devrient GmbH 2009 - 2012
-
- 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. The name of the author may not be used to endorse or promote
- products derived from this software without specific prior
- written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. \ No newline at end of file
diff --git a/mobicore/daemon/README.android b/mobicore/daemon/README.android
deleted file mode 100644
index 29edee1..0000000
--- a/mobicore/daemon/README.android
+++ /dev/null
@@ -1,64 +0,0 @@
-MobiCore Daemon in Android
----
-Command line
---
-The MobiCore Daemon supports 4 command line options. It also displays them with the help option:
-
-# ./mcDriverDaemon -h
-usage: ./mcDriverDaemon [-mdsbh]
-Start MobiCore Daemon
-
--h show this help
--b fork to background
--m IMAGE load mobicore from IMAGE to DDR
--s disable daemon scheduler(default enabled)
--r DRIVER load dyamic driver
-
--b Forks the daemon to background
-
-# ./mcDriverDaemon -b
-
-Makes the daemon run in background and returns immediate control to the shell. No need to use shell forking with &
-
--m Loads a mobicore image to DDR
-
-# ./mcDriverDaemon -m /data/app/mobicore.img
-
-Loads the mobicore.img to DDR and starts executing it.
-
--s Disables NQ IRQ scheduler
-
-# ./mcDriverDaemon -s
-
--r Loads dynamic driver at startup. The full path of the driver binary must be given, eg. /data/app/driver.drbin
-
-# ./mcDriverDaemon -r /data/app/driver.drbin
-
-Custom registry locations
---
-Registry fallback
-
-In case of a Device wipe in Android the /data/app/mcRegistry folder will be deleted with all it's contents. To overcome
-this the daemon supports a fallback location(eg /system/app/mcRegistry): it first tries to load the trustlet
-from /data/app/mcRegistry/[uuid].tlbin and if it fails then it tries to read the trustlet from /system/app/mcRegistry/[uuid].tlb
-
-Both paths are completely configurable for the Daemon using 2 environment variables:MC_REGISTRY_PATH and MC_REGISTRY_FALLBACK_PATH
-
-For example if you want to use /data/app/mcRegistry as the default path and /system/app/mcRegistry as the fallback path:
-
-$ export MC_REGISTRY_PATH=/data/app/mcRegistry
-$ export MC_REGISTRY_FALLBACK_PATH=/system/app/mcRegistry
-$ /data/app/mcDriverDaemon
-
-Custom authtoken path
---
-
-The authtoken file is created at provisioning and is by default located in /data/app/mcRegistry/00000.authtoken
-
-Because a device wipe could delete this file and make MobiCore unusable a new environment variable has been added to change the
-default behaviour: MC_AUTH_TOKEN_PATH
-
-$ export MC_AUTH_TOKEN_PATH=/efs
-$ /data/app/mcDriverDaemon
-
-This would change the location of the authtoken file to /efs
diff --git a/mobicore/daemon/buildTag.h b/mobicore/daemon/buildTag.h
deleted file mode 100644
index 928fb31..0000000
--- a/mobicore/daemon/buildTag.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * <-- Copyright Trustonic Limited 2013 -->
- *
- * 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. The name of the author may not be used to endorse or promote
- * products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
- */
-#define MOBICORE_COMPONENT_BUILD_TAG "*** t-base-300-Ares-2-Android-V001 ###"
diff --git a/mobicore/include/Public/mc_linux.h b/mobicore/include/Public/mc_linux.h
index e794662..3da4ae3 100644
--- a/mobicore/include/Public/mc_linux.h
+++ b/mobicore/include/Public/mc_linux.h
@@ -1,4 +1,34 @@
/*
+ * 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.
+ */
+/*
* The <t-base Driver Kernel Module is a Linux device driver, which represents
* the command proxy on the lowest layer to the secure world (Swd). Additional
* services like memory allocation via mmap and generation of a MMU tables for
@@ -7,33 +37,6 @@
* As customary the driver is handled as Linux device driver with "open",
* "close" and "ioctl" commands. Access to the driver is possible after the
* devices "/dev/mobicore" and "/dev/mobicore-user" have been created.
- *
- * <-- Copyright Giesecke & Devrient GmbH 2010-2012 -->
- * <-- Copyright Trustonic Limited 2013-2014 -->
- *
- * 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. The name of the author may not be used to endorse or promote
- * products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 _MC_LINUX_H_
@@ -81,10 +84,10 @@ struct mc_ioctl_info {
* already. I.e. Daemon was restarted.
*/
struct mc_ioctl_map {
- size_t len; /* Buffer length */
+ uint32_t len; /* Buffer length */
uint32_t handle; /* WSM handle */
uint64_t phys_addr; /* physical address of WSM (or 0) */
- unsigned long addr; /* Virtual address */
+ uint32_t rfu;
bool reused; /* if WSM memory was reused, or new allocated */
};
@@ -95,8 +98,11 @@ struct mc_ioctl_map {
* Returns the physical address of the MMU table.
* The page alignment will be created and the appropriated pSize and pOffsetMMU
* will be modified to the used values.
+ *
+ * We assume the 64 bit compatible one to be the default and the
+ * 32 bit one to be the compat one but we must serve both of them.
*/
-struct mc_ioctl_reg_wsm {
+struct mc_compat_ioctl_reg_wsm {
uint32_t buffer; /* base address of the virtual address */
uint32_t len; /* size of the virtual address space */
uint32_t pid; /* process id */
@@ -104,6 +110,14 @@ struct mc_ioctl_reg_wsm {
uint64_t table_phys; /* physical address of the MMU table */
};
+struct mc_ioctl_reg_wsm {
+ uint64_t buffer; /* base address of the virtual address */
+ uint32_t len; /* size of the virtual address space */
+ uint32_t pid; /* process id */
+ uint32_t handle; /* driver handle for locked memory */
+ uint64_t table_phys;/* physical address of the MMU table */
+};
+
/*
* Data exchange structure of the MC_IO_RESOLVE_CONT_WSM ioctl command.
*/
@@ -166,8 +180,14 @@ struct mc_ioctl_resolv_wsm {
* Creates a MMU Table of the given base address and the size of the
* data.
* Parameter: mc_ioctl_reg_wsm
+ *
+ * Since the end ID is also based on the size of the structure it is
+ * safe to use the same ID(6) for both
*/
#define MC_IO_REG_WSM _IOWR(MC_IOC_MAGIC, 6, struct mc_ioctl_reg_wsm)
+#define MC_COMPAT_REG_WSM _IOWR(MC_IOC_MAGIC, 6, \
+ struct mc_compat_ioctl_reg_wsm)
+
#define MC_IO_UNREG_WSM _IO(MC_IOC_MAGIC, 7)
#define MC_IO_LOCK_WSM _IO(MC_IOC_MAGIC, 8)
#define MC_IO_UNLOCK_WSM _IO(MC_IOC_MAGIC, 9)
diff --git a/mobicore/include/Public/version.h b/mobicore/include/Public/version.h
index 591ca3d..9262a78 100644
--- a/mobicore/include/Public/version.h
+++ b/mobicore/include/Public/version.h
@@ -1,30 +1,32 @@
/*
- * <-- Copyright Giesecke & Devrient GmbH 2010-2012 -->
- * <-- Copyright Trustonic Limited 2013 -->
+ * 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.
+ * 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. The name of the author may not be used to endorse or promote
- * products derived from this software without specific prior
- * written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ * 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 _MC_DRV_VERSION_H_
diff --git a/mobicore/provlib/Android.mk b/mobicore/provlib/Android.mk
deleted file mode 100644
index db3da67..0000000
--- a/mobicore/provlib/Android.mk
+++ /dev/null
@@ -1,16 +0,0 @@
-# =============================================================================
-#
-# Makefile pointing to all makefiles within the project.
-#
-# =============================================================================
-
-PROJECT_PATH := $(call my-dir)
-
-# adding the root folder to the search path appears to make absolute paths
-# work for import-module - lets see how long this works and what surprises
-# future developers get from this.
-$(call import-add-path,/)
-$(call import-module,$(COMP_PATH_MobiCoreDriverLib))
-
-# Include the Scripts
-include $(PROJECT_PATH)/jni/Android.mk
diff --git a/mobicore/provlib/Application.mk b/mobicore/provlib/Application.mk
deleted file mode 100644
index fde1054..0000000
--- a/mobicore/provlib/Application.mk
+++ /dev/null
@@ -1,23 +0,0 @@
-# =============================================================================
-#
-# Main build file defining the project modules and their global variables.
-#
-# =============================================================================
-
-# Don't remove this - mandatory
-APP_PROJECT_PATH := $(call my-dir)
-
-# Don't optimize for better debugging
-APP_OPTIM := debug
-
-# Show all warnings
-#APP_CFLAGS := -Wall
-
-MC_INCLUDE_DIR := \
- $(COMP_PATH_TlCm)/Public \
- $(COMP_PATH_TlCm)/Public/TlCm \
- $(COMP_PATH_TlCm)/Public/TlCm/2.0 \
- $(COMP_PATH_MobiCoreDriverLib)/Public
-MC_DEBUG := _DEBUG
-SYSTEM_LIB_DIR=/system/lib
-GDM_PROVLIB_SHARED_LIBS=MobiCoreDriver
diff --git a/mobicore/provlib/buildTag.h b/mobicore/provlib/buildTag.h
deleted file mode 100644
index 928fb31..0000000
--- a/mobicore/provlib/buildTag.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * <-- Copyright Trustonic Limited 2013 -->
- *
- * 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. The name of the author may not be used to endorse or promote
- * products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
- */
-#define MOBICORE_COMPONENT_BUILD_TAG "*** t-base-300-Ares-2-Android-V001 ###"
diff --git a/mobicore/provlib/inc_private/gdmcdevicebinding.h b/mobicore/provlib/inc_private/gdmcdevicebinding.h
deleted file mode 100644
index 3b979b8..0000000
--- a/mobicore/provlib/inc_private/gdmcdevicebinding.h
+++ /dev/null
@@ -1,101 +0,0 @@
-#ifndef _INC_GDMCDEVICEBINDING_H
-#define _INC_GDMCDEVICEBINDING_H
-
-#include <gdmcprovlib.h>
-#include <gdmcprovprotocol.h>
-#ifdef ARM
-#include <android/log.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct _KSoCAuthSNTS KSoCAuthSNTS;
-
-struct _KSoCAuthSNTS
-{
- mcSymmetricKey_t kSoCAuth;
- _u64 serialNumber;
- _u64 timeStamp;
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#ifdef ARM
-
-extern "C" void GDPROVAPI GDMCLog ( int prio, const char *tag, const char *fmt, ... );
-
-#ifdef _DEBUG
-extern "C" void GDMCHexDump ( const unsigned char *data, int size );
-#endif
-
-#define LOG_TAG "GDMCProvLib"
-
-#ifdef _DEBUG
-#define LOG_d(...) do { GDMCLog(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__); } while(0)
-#else
-#define LOG_d(...) do { } while(0)
-#endif
-#define LOG_i(...) do { GDMCLog(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__); } while(0)
-#define LOG_w(...) do { GDMCLog(ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__); } while(0)
-#define LOG_e(...) do { GDMCLog(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__); } while(0)
-
-#else
-
-#define LOG_d(...) do { } while(0)
-#define LOG_i(...) do { } while(0)
-#define LOG_w(...) do { } while(0)
-#define LOG_e(...) do { } while(0)
-
-#endif // ARM
-
-gderror GDMCComposeErrorMessage ( gdmcinst *inst,
- gderror error,
- _u8 *msgout,
- _u32 *msgout_size,
- _u32 initial_msgout_size,
- const char *pszmsg, ... );
-
-gderror GDPROVAPI GDMCValidateProvMessage ( const _u8 *msg,
- _u32 msgsize,
- gdmc_msgheader **ppheader,
- _u8 **ppbody,
- gdmc_msgtrailer **pptrailer );
-
-gderror GDPROVAPI GDMCHandleGetSUID ( gdmcinst *inst,
- _u8 *msgout,
- _u32 *msgout_size,
- _u32 initial_msgout_size );
-
-gderror GDPROVAPI GDMCHandleGenAuthToken ( gdmcinst *inst,
- gdmc_actmsg_req *req,
- _u8 *msgout,
- _u32 *msgout_size,
- _u32 initial_msgout_size );
-
-gderror GDPROVAPI GDMCHandleValidateAuthToken ( gdmcinst *inst,
- gdmc_so_authtok *validateSoAuthTok,
- _u8 *msgout,
- _u32 *msgout_size,
- _u32 initial_msgout_size );
-
-#define ERRMSG_0001 "Unable to access me