summaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
authorHashcode <hashcode0f@gmail.com>2015-01-07 22:42:05 -0800
committerHashcode <hashcode0f@gmail.com>2015-02-02 16:30:35 -0800
commitfeff2ab184e8c41a7bdbe9e9e2ccd7d02035c96c (patch)
treefa908662b9095dcb9b36c035c167ccfb2be08614 /security
parent82e6c936c898273febbafcc1a93a9b0ff0363b4d (diff)
downloadhardware_ti_omap4-feff2ab184e8c41a7bdbe9e9e2ccd7d02035c96c.zip
hardware_ti_omap4-feff2ab184e8c41a7bdbe9e9e2ccd7d02035c96c.tar.gz
hardware_ti_omap4-feff2ab184e8c41a7bdbe9e9e2ccd7d02035c96c.tar.bz2
security: misc cleanup
- Align LDFLAGS to previous versions for easier comparison of changes - Remove Android logging Change-Id: Ib8242be6be3411fb7277147ca08d68e9fbb45b67
Diffstat (limited to 'security')
-rw-r--r--security/smc_pa_ctrl/Android.mk14
-rw-r--r--security/smc_pa_ctrl/s_version.h3
-rw-r--r--security/tee_client_api/Android.mk14
-rw-r--r--security/tee_client_api/s_version.h2
-rw-r--r--security/tee_client_api/tee_client_api_linux_driver.c8
-rw-r--r--security/tf_crypto_sst/Android.mk9
-rw-r--r--security/tf_crypto_sst/sst_stub.c3
-rw-r--r--security/tf_daemon/Android.mk16
-rw-r--r--security/tf_daemon/delegation_client.c192
-rw-r--r--security/tf_daemon/s_version.h2
-rw-r--r--security/tf_daemon/service_delegation_protocol.h22
-rw-r--r--security/tf_daemon/smc_properties.c4
-rw-r--r--security/tf_daemon/smc_properties_parser.c4
-rw-r--r--security/tf_sdk/include/s_type.h236
14 files changed, 157 insertions, 372 deletions
diff --git a/security/smc_pa_ctrl/Android.mk b/security/smc_pa_ctrl/Android.mk
index 0e1e923..0203cad 100644
--- a/security/smc_pa_ctrl/Android.mk
+++ b/security/smc_pa_ctrl/Android.mk
@@ -1,8 +1,4 @@
-# Only applicable for OMAP4 and OMAP5 boards.
-# First eliminate OMAP3 and then ensure that this is not used
-# for customer boards
-ifneq ($(TARGET_BOARD_PLATFORM),omap3)
-ifeq ($(findstring omap, $(TARGET_BOARD_PLATFORM)),omap)
+ifeq ($(TARGET_BOARD_PLATFORM),omap4)
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
@@ -12,14 +8,13 @@ LOCAL_ARM_MODE := arm
LOCAL_SRC_FILES:= \
smc_pa_ctrl.c smc_pa_ctrl_linux.c
+LOCAL_CFLAGS += -DLINUX
+LOCAL_CFLAGS += -D__ANDROID32__
+
ifdef S_VERSION_BUILD
LOCAL_CFLAGS += -DS_VERSION_BUILD=$(S_VERSION_BUILD)
endif
-LOCAL_LDLIBS += -llog
-
-LOCAL_CFLAGS += -DLINUX
-LOCAL_CFLAGS += -DANDROID
LOCAL_CFLAGS += -I $(LOCAL_PATH)/../tf_sdk/include/
LOCAL_MODULE:= smc_pa_ctrl
@@ -27,4 +22,3 @@ LOCAL_MODULE_TAGS := optional
include $(BUILD_EXECUTABLE)
endif
-endif
diff --git a/security/smc_pa_ctrl/s_version.h b/security/smc_pa_ctrl/s_version.h
index cff19d7..6c779e2 100644
--- a/security/smc_pa_ctrl/s_version.h
+++ b/security/smc_pa_ctrl/s_version.h
@@ -27,6 +27,7 @@
* (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 __S_VERSION_H__
#define __S_VERSION_H__
@@ -44,7 +45,7 @@
#if defined(WIN32)
#define S_VERSION_OS "W" /* "W" for Windows PC (XP, Vista…) */
#define S_VERSION_PLATFORM "X" /* "X" for ix86 PC simulators */
-#elif defined(ANDROID)
+#elif defined(__ANDROID32__)
#define S_VERSION_OS "A" /* "A" for Android */
#define S_VERSION_PLATFORM "G" /* "G" for 4430 */
#elif defined(LINUX)
diff --git a/security/tee_client_api/Android.mk b/security/tee_client_api/Android.mk
index f8010f6..30279a6 100644
--- a/security/tee_client_api/Android.mk
+++ b/security/tee_client_api/Android.mk
@@ -1,8 +1,4 @@
-# Only applicable for OMAP4 and OMAP5 boards.
-# First eliminate OMAP3 and then ensure that this is not used
-# for customer boards
-ifneq ($(TARGET_BOARD_PLATFORM),omap3)
-ifeq ($(findstring omap, $(TARGET_BOARD_PLATFORM)),omap)
+ifeq ($(TARGET_BOARD_PLATFORM),omap4)
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
@@ -12,14 +8,13 @@ LOCAL_ARM_MODE := arm
LOCAL_SRC_FILES:= \
tee_client_api_linux_driver.c
+LOCAL_CFLAGS += -DLINUX
+LOCAL_CFLAGS += -D__ANDROID32__
+
ifdef S_VERSION_BUILD
LOCAL_CFLAGS += -DS_VERSION_BUILD=$(S_VERSION_BUILD)
endif
-LOCAL_LDLIBS += -llog
-
-LOCAL_CFLAGS += -DLINUX
-LOCAL_CFLAGS += -DANDROID
LOCAL_CFLAGS += -I $(LOCAL_PATH)/../tf_sdk/include/
LOCAL_MODULE:= libtee_client_api_driver
@@ -27,4 +22,3 @@ LOCAL_MODULE_TAGS := optional
include $(BUILD_STATIC_LIBRARY)
endif
-endif
diff --git a/security/tee_client_api/s_version.h b/security/tee_client_api/s_version.h
index cff19d7..64a376c 100644
--- a/security/tee_client_api/s_version.h
+++ b/security/tee_client_api/s_version.h
@@ -44,7 +44,7 @@
#if defined(WIN32)
#define S_VERSION_OS "W" /* "W" for Windows PC (XP, Vista…) */
#define S_VERSION_PLATFORM "X" /* "X" for ix86 PC simulators */
-#elif defined(ANDROID)
+#elif defined(__ANDROID32__)
#define S_VERSION_OS "A" /* "A" for Android */
#define S_VERSION_PLATFORM "G" /* "G" for 4430 */
#elif defined(LINUX)
diff --git a/security/tee_client_api/tee_client_api_linux_driver.c b/security/tee_client_api/tee_client_api_linux_driver.c
index af5d36f..70ffcf3 100644
--- a/security/tee_client_api/tee_client_api_linux_driver.c
+++ b/security/tee_client_api/tee_client_api_linux_driver.c
@@ -96,13 +96,6 @@ typedef struct
#define TRACE_WARNING(...)
#define TRACE_INFO(...)
#else
-#if defined ANDROID
-#define LOG_TAG "TEE"
-#include <android/log.h>
-#define TRACE_INFO(format, ...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, format, __VA_ARGS__)
-#define TRACE_ERROR(format, ...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, format, __VA_ARGS__)
-#define TRACE_WARNING(format, ...) __android_log_print(ANDROID_LOG_WARN, LOG_TAG, format, __VA_ARGS__)
-#else
static void TRACE_ERROR(const char* format, ...)
{
va_list ap;
@@ -132,7 +125,6 @@ static void TRACE_INFO(const char* format, ...)
fprintf(stderr, "\n");
va_end(ap);
}
-#endif /* ANDROID */
#endif /* NDEBUG */
diff --git a/security/tf_crypto_sst/Android.mk b/security/tf_crypto_sst/Android.mk
index 8ae3242..201a658 100644
--- a/security/tf_crypto_sst/Android.mk
+++ b/security/tf_crypto_sst/Android.mk
@@ -14,21 +14,18 @@ LOCAL_SRC_FILES := \
pkcs11_object.c \
pkcs11_session.c
+LOCAL_CFLAGS += -DLINUX
+LOCAL_CFLAGS += -D__ANDROID32__
+
ifdef S_VERSION_BUILD
LOCAL_CFLAGS += -DS_VERSION_BUILD=$(S_VERSION_BUILD)
endif
-LOCAL_LDLIBS += -llog
-
-LOCAL_CFLAGS += -DLINUX
-LOCAL_CFLAGS += -DANDROID
LOCAL_CFLAGS += -I $(LOCAL_PATH)/../tf_sdk/include/
LOCAL_MODULE:= libtf_crypto_sst
LOCAL_STATIC_LIBRARIES := libtee_client_api_driver
LOCAL_MODULE_TAGS := optional
-LOCAL_SHARED_LIBRARIES:= liblog
-
include $(BUILD_SHARED_LIBRARY)
endif
diff --git a/security/tf_crypto_sst/sst_stub.c b/security/tf_crypto_sst/sst_stub.c
index e6e37b6..e8a78bc 100644
--- a/security/tf_crypto_sst/sst_stub.c
+++ b/security/tf_crypto_sst/sst_stub.c
@@ -27,7 +27,8 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifdef ANDROID
+
+#ifdef __ANDROID32__
#include <stddef.h>
#endif
diff --git a/security/tf_daemon/Android.mk b/security/tf_daemon/Android.mk
index 416a9ff..50a51e1 100644
--- a/security/tf_daemon/Android.mk
+++ b/security/tf_daemon/Android.mk
@@ -1,8 +1,4 @@
-# Only applicable for OMAP4 and OMAP5 boards.
-# First eliminate OMAP3 and then ensure that this is not used
-# for customer boards
-ifneq ($(TARGET_BOARD_PLATFORM),omap3)
-ifeq ($(findstring omap, $(TARGET_BOARD_PLATFORM)),omap)
+ifeq ($(TARGET_BOARD_PLATFORM),omap4)
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
@@ -16,15 +12,14 @@ LOCAL_SRC_FILES := \
smc_properties_parser.c \
lib_manifest2.c
+LOCAL_CFLAGS += -DLINUX
+LOCAL_CFLAGS += -D__ANDROID32__
+LOCAL_CFLAGS += -DSUPPORT_DELEGATION_EXTENSION
+
ifdef S_VERSION_BUILD
LOCAL_CFLAGS += -DS_VERSION_BUILD=$(S_VERSION_BUILD)
endif
-LOCAL_LDLIBS += -llog
-
-LOCAL_CFLAGS += -DLINUX
-LOCAL_CFLAGS += -DANDROID
-LOCAL_CFLAGS += -DSUPPORT_DELEGATION_EXTENSION
LOCAL_CFLAGS += -I $(LOCAL_PATH)/../tf_sdk/include/
LOCAL_MODULE:= tf_daemon
@@ -33,4 +28,3 @@ LOCAL_MODULE_TAGS := optional
include $(BUILD_EXECUTABLE)
endif
-endif
diff --git a/security/tf_daemon/delegation_client.c b/security/tf_daemon/delegation_client.c
index a2bff0b..72d6d49 100644
--- a/security/tf_daemon/delegation_client.c
+++ b/security/tf_daemon/delegation_client.c
@@ -28,7 +28,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined(ANDROID)
+#if defined(__ANDROID32__)
#include <stddef.h>
#endif
#include <stdio.h>
@@ -43,12 +43,12 @@
#include <sys/types.h>
#include <fcntl.h>
-#if defined(LINUX) || defined(ANDROID)
+#if defined(LINUX) || defined(__ANDROID32__)
#include <unistd.h>
#include <sys/resource.h>
-#if defined(ANDROID)
+#if defined(__ANDROID32__)
/* fdatasync does not exist on Android */
#define fdatasync fsync
#else
@@ -58,14 +58,14 @@
* in some distributions
*/
int fdatasync(int fd);
-#endif /* ANDROID */
+#endif /* __ANDROID32__ */
#include <syslog.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <pthread.h>
#include <semaphore.h>
#define PATH_SEPARATOR '/'
-#endif /* LINUX || ANDROID */
+#endif /* LINUX || __ANDROID32__ */
#ifdef WIN32
#include <windows.h>
@@ -97,10 +97,6 @@ int fdatasync(int fd);
#include "delegation_client_extension.h"
#endif
-#ifdef TFSW_FDM_ANDROID
-#include <android/log.h>
-#endif
-
/*----------------------------------------------------------------------------
* Design notes
* ============
@@ -128,21 +124,6 @@ typedef struct
uint8_t sWorkspace[1/*g_nWorkspaceSize*/];
} DELEGATION_EXCHANGE_BUFFER;
-#ifdef SUPPORT_RPMB_PARTITION
-typedef struct
-{
- uint8_t pDummy[196];
- uint8_t pMAC[32];
- uint8_t pData[256];
- uint8_t pNonce[16];
- uint32_t nMC;
- uint16_t nAddr;
- uint16_t nBlockCount;
- uint16_t nResult;
- uint16_t nReqOrResp;
-} DELEGATION_RPMB_MESSAGE;
-#endif
-
#define MD_VAR_NOT_USED(variable) do{(void)(variable);}while(0);
#define MD_INLINE __inline
@@ -160,7 +141,7 @@ typedef struct
in release builds whereas logs are visible to the customer.
-----------------------------------------------*/
-#if defined(LINUX) || (defined ANDROID)
+#if defined(LINUX) || (defined __ANDROID32__)
static bool bDetached = false;
@@ -174,13 +155,9 @@ static MD_INLINE void LogError(const char* format, ...)
}
else
{
-#ifdef TFSW_FDM_ANDROID
- __android_log_vprint(ANDROID_LOG_ERROR , "TF Daemon", format, ap);
-#else
fprintf(stderr, "ERROR: ");
vfprintf(stderr, format, ap);
fprintf(stderr, "\n");
-#endif
}
va_end(ap);
}
@@ -195,13 +172,9 @@ static MD_INLINE void LogWarning(const char* format, ...)
}
else
{
-#ifdef TFSW_FDM_ANDROID
- __android_log_vprint(ANDROID_LOG_WARN , "TF Daemon", format, ap);
-#else
fprintf(stderr, "WARNING: ");
vfprintf(stderr, format, ap);
fprintf(stderr, "\n");
-#endif
}
va_end(ap);
}
@@ -215,12 +188,8 @@ static MD_INLINE void LogInfo(const char* format, ...)
}
else
{
-#ifdef TFSW_FDM_ANDROID
- __android_log_vprint(ANDROID_LOG_INFO , "TF Daemon", format, ap);
-#else
vfprintf(stderr, format, ap);
fprintf(stderr, "\n");
-#endif
}
va_end(ap);
}
@@ -236,13 +205,9 @@ static MD_INLINE void TRACE_ERROR(const char* format, ...)
}
else
{
-#ifdef TFSW_FDM_ANDROID
- __android_log_vprint(ANDROID_LOG_ERROR , "TF Daemon", format, ap);
-#else
fprintf(stderr, "TRACE: ERROR: ");
vfprintf(stderr, format, ap);
fprintf(stderr, "\n");
-#endif
}
va_end(ap);
#else
@@ -261,13 +226,9 @@ static MD_INLINE void TRACE_WARNING(const char* format, ...)
}
else
{
-#ifdef TFSW_FDM_ANDROID
- __android_log_vprint(ANDROID_LOG_WARN , "TF Daemon", format, ap);
-#else
fprintf(stderr, "TRACE: WARNING: ");
vfprintf(stderr, format, ap);
fprintf(stderr, "\n");
-#endif
}
va_end(ap);
#else
@@ -286,13 +247,9 @@ static MD_INLINE void TRACE_INFO(const char* format, ...)
}
else
{
-#ifdef TFSW_FDM_ANDROID
- __android_log_vprint(ANDROID_LOG_INFO , "TF Daemon", format, ap);
-#else
fprintf(stderr, "TRACE: ");
vfprintf(stderr, format, ap);
fprintf(stderr, "\n");
-#endif
}
va_end(ap);
#else
@@ -332,7 +289,7 @@ static MD_INLINE void TRACE_INFO(const char* format, ...)
}
#else
-/* !defined(LINUX) || !defined(ANDROID) */
+/* !defined(LINUX) || !defined(__ANDROID32__) */
static MD_INLINE void LogError(const char* format, ...)
{
@@ -402,7 +359,7 @@ static MD_INLINE void TRACE_INFO(const char* format, ...)
MD_VAR_NOT_USED(format);
#endif /* NDEBUG */
}
-#endif /* defined(LINUX) || defined(ANDROID) */
+#endif /* defined(LINUX) || defined(__ANDROID32__) */
/*----------------------------------------------------------------------------
* Globals
@@ -526,7 +483,7 @@ int static_checkStorageDirAndAccessRights(char * directoryName)
if (result == 0)
{
/* Storage dir exists. Check access rights */
-#if defined(LINUX) || (defined ANDROID)
+#if defined(LINUX) || (defined __ANDROID32__)
if ((buf.st_mode & (S_IXUSR | S_IWUSR)) != (S_IXUSR | S_IWUSR))
{
LogError("storageDir '%s' does not have read-write access", directoryName);
@@ -572,7 +529,7 @@ static TEEC_Result partitionDestroy(uint32_t nPartitionID)
}
/* Try to erase the file */
-#if defined(LINUX) || (defined ANDROID) || defined (__SYMBIAN32__)
+#if defined(LINUX) || (defined __ANDROID32__) || defined (__SYMBIAN32__)
if (unlink(g_pPartitionNames[nPartitionID]) != 0)
#endif
#ifdef WIN32
@@ -729,46 +686,6 @@ static TEEC_Result partitionRead(uint32_t nPartitionID, uint32_t nSectorIndex, u
return S_SUCCESS;
}
-#ifdef SUPPORT_RPMB_PARTITION
-static TEEC_Result rpmbRead(DELEGATION_RPMB_INSTRUCTION *pInstruction)
-{
- DELEGATION_RPMB_MESSAGE* pMessages;
- uint32_t nNbMsg, nIndex;
-
- nNbMsg = g_nSectorSize >> 8;
- pMessages = (DELEGATION_RPMB_MESSAGE*)malloc(nNbMsg * sizeof(DELEGATION_RPMB_MESSAGE));
- if (pMessages == NULL)
- {
- return S_ERROR_OUT_OF_MEMORY;
- }
- memset(pMessages,0,nNbMsg * sizeof(DELEGATION_RPMB_MESSAGE));
-
- for (nIndex=0;nIndex<nNbMsg;nIndex++)
- {
- memcpy(pMessages[nIndex].pNonce , pInstruction->pNonce, 16);
- pMessages[nIndex].nAddr = pInstruction->nAddr;
- pMessages[nIndex].nBlockCount = pInstruction->nBlockCount;
- pMessages[nIndex].nReqOrResp = 0x0004;
- }
- memcpy(pMessages[nNbMsg-1].pMAC,pInstruction->nMAC,32);
-
- /* TODO: send to the RPMB driver */
-
- memcpy(pInstruction->pNonce,pMessages[0].pNonce , 16);
- pInstruction->nAddr = pMessages[0].nAddr;
- pInstruction->nBlockCount = pMessages[0].nBlockCount;
- for (nIndex=0;nIndex<nNbMsg;nIndex++)
- {
- memcpy(g_pWorkspaceBuffer + pInstruction->nWorkspaceOffset[nIndex],pMessages[nIndex].pData,256);
- }
- memcpy(pInstruction->nMAC, pMessages[nNbMsg-1].pMAC,32);
- pInstruction->nResult=pMessages[nNbMsg-1].nResult;
-
- free(pMessages);
-
- return S_SUCCESS;
-}
-#endif
/**
* This function executes the WRITE instruction.
*
@@ -807,42 +724,7 @@ static TEEC_Result partitionWrite(uint32_t nPartitionID, uint32_t nSectorIndex,
return S_SUCCESS;
}
-#ifdef SUPPORT_RPMB_PARTITION
-static TEEC_Result rpmbWrite(DELEGATION_RPMB_INSTRUCTION *pInstruction)
-{
- DELEGATION_RPMB_MESSAGE* pMessages;
- uint32_t nNbMsg, nIndex;
- nNbMsg = g_nSectorSize >> 8;
- pMessages = (DELEGATION_RPMB_MESSAGE*)malloc(nNbMsg * sizeof(DELEGATION_RPMB_MESSAGE));
- if (pMessages == NULL)
- {
- return S_ERROR_OUT_OF_MEMORY;
- }
- memset(pMessages,0,nNbMsg * sizeof(DELEGATION_RPMB_MESSAGE));
-
- for (nIndex=0;nIndex<nNbMsg;nIndex++)
- {
- memcpy(pMessages[nIndex].pData,g_pWorkspaceBuffer + pInstruction->nWorkspaceOffset[nIndex],256);
- pMessages[nIndex].nMC = pInstruction->nMC;
- pMessages[nIndex].nAddr = pInstruction->nAddr;
- pMessages[nIndex].nBlockCount = pInstruction->nBlockCount;
- pMessages[nIndex].nReqOrResp = 0x0003;
- }
- memcpy(pMessages[nNbMsg-1].pMAC,pInstruction->nMAC,32);
-
- /* TODO: send to the RPMB driver */
-
- pInstruction->nAddr = pMessages[0].nAddr;
- pInstruction->nMC = pMessages[0].nMC;
- memcpy(pInstruction->nMAC, pMessages[nNbMsg-1].pMAC,32);
- pInstruction->nResult=pMessages[nNbMsg-1].nResult;
-
- free(pMessages);
-
- return S_SUCCESS;
-}
-#endif
/**
* This function executes the SET_SIZE instruction.
*
@@ -892,7 +774,7 @@ static TEEC_Result partitionSetSize(uint32_t nPartitionID, uint32_t nNewSectorCo
{
int result = 0;
/* Truncate the partition file */
-#if defined(LINUX) || (defined ANDROID)
+#if defined(LINUX) || (defined __ANDROID32__)
result = ftruncate(fileno(pFile),nNewSectorCount * g_nSectorSize);
#endif
#if defined (__SYMBIAN32__)
@@ -937,7 +819,7 @@ static TEEC_Result partitionSync(uint32_t nPartitionID)
}
/* Then synchronize the file descriptor with the file-system */
-#if defined(LINUX) || (defined ANDROID)
+#if defined(LINUX) || (defined __ANDROID32__)
result=fdatasync(fileno(pFile));
#endif
#if defined (__SYMBIAN32__)
@@ -1126,13 +1008,6 @@ static int runSession(TEEC_Context* pContext, TEEC_Session* pSession, TEEC_Opera
{
case DELEGATION_INSTRUCTION_PARTITION_CREATE:
nError = partitionCreate(nPartitionID);
-#ifdef SUPPORT_RPMB_PARTITION
- if (nPartitionID == RPMB_PARTITION_ID)
- {
- /* TODO: get the Write counter */
- pInstruction->sAuthRW.nMC = 0;
- }
-#endif
TRACE_INFO("INSTRUCTION: ID=0x%x pid=%d err=%d", (nInstructionID & 0x0F), nPartitionID, nError);
break;
case DELEGATION_INSTRUCTION_PARTITION_OPEN:
@@ -1144,33 +1019,9 @@ static int runSession(TEEC_Context* pContext, TEEC_Session* pSession, TEEC_Opera
{
g_pExchangeBuffer->sAdministrativeData.nPartitionOpenSizes[nPartitionID] = nPartitionSize;
}
-#ifdef SUPPORT_RPMB_PARTITION
- if (nPartitionID == RPMB_PARTITION_ID)
- {
- /* TODO: get the Write counter */
- pInstruction->sAuthRW.nMC = 0;
- }
-#endif
break;
}
case DELEGATION_INSTRUCTION_PARTITION_READ:
-#ifdef SUPPORT_RPMB_PARTITION
- if (nPartitionID == RPMB_PARTITION_ID)
- {
- if (nInstructionsIndex + sizeof(DELEGATION_RPMB_INSTRUCTION)-sizeof(uint32_t) <= nInstructionsBufferSize)
- {
- nInstructionsIndex+=sizeof(DELEGATION_RPMB_INSTRUCTION)-sizeof(uint32_t);
- }
- else
- {
- goto instruction_parse_end;
- }
- nError = rpmbRead(&pInstruction->sAuthRW);
- TRACE_INFO("INSTRUCTION: ID=0x%x pid=%d err=%d", (nInstructionID & 0x0F), nPartitionID, nError);
- break;
- }
- else
-#endif
{
/* Parse parameters */
uint32_t nSectorID;
@@ -1190,23 +1041,6 @@ static int runSession(TEEC_Context* pContext, TEEC_Session* pSession, TEEC_Opera
break;
}
case DELEGATION_INSTRUCTION_PARTITION_WRITE:
-#ifdef SUPPORT_RPMB_PARTITION
- if (nPartitionID == RPMB_PARTITION_ID)
- {
- if (nInstructionsIndex + sizeof(DELEGATION_RPMB_INSTRUCTION)-sizeof(uint32_t) <= nInstructionsBufferSize)
- {
- nInstructionsIndex+=sizeof(DELEGATION_RPMB_INSTRUCTION)-sizeof(uint32_t);
- }
- else
- {
- goto instruction_parse_end;
- }
- nError = rpmbWrite(&pInstruction->sAuthRW);
- TRACE_INFO("INSTRUCTION: ID=0x%x pid=%d err=%d", (nInstructionID & 0x0F), nPartitionID, nError);
- break;
- }
- else
-#endif
{
/* Parse parameters */
uint32_t nSectorID;
@@ -1483,7 +1317,7 @@ int main(int argc, char* argv[])
* Detach the daemon from the console
*/
-#if defined(LINUX) || (defined ANDROID)
+#if defined(LINUX) || (defined __ANDROID32__)
{
/*
* Turns this application into a daemon => fork off parent process, setup logging, ...
diff --git a/security/tf_daemon/s_version.h b/security/tf_daemon/s_version.h
index cff19d7..64a376c 100644
--- a/security/tf_daemon/s_version.h
+++ b/security/tf_daemon/s_version.h
@@ -44,7 +44,7 @@
#if defined(WIN32)
#define S_VERSION_OS "W" /* "W" for Windows PC (XP, Vista…) */
#define S_VERSION_PLATFORM "X" /* "X" for ix86 PC simulators */
-#elif defined(ANDROID)
+#elif defined(__ANDROID32__)
#define S_VERSION_OS "A" /* "A" for Android */
#define S_VERSION_PLATFORM "G" /* "G" for 4430 */
#elif defined(LINUX)
diff --git a/security/tf_daemon/service_delegation_protocol.h b/security/tf_daemon/service_delegation_protocol.h
index bf831f8..22b291d 100644
--- a/security/tf_daemon/service_delegation_protocol.h
+++ b/security/tf_daemon/service_delegation_protocol.h
@@ -70,10 +70,6 @@
#define DELEGATION_NOTIFY_TYPE_INFO 0x000000E3
#define DELEGATION_NOTIFY_TYPE_DEBUG 0x000000E4
-#ifdef SUPPORT_RPMB_PARTITION
-#define RPMB_PARTITION_ID 14
-#endif
-
typedef struct
{
uint32_t nInstructionID;
@@ -94,21 +90,6 @@ typedef struct
uint32_t nWorkspaceOffset;
} DELEGATION_RW_INSTRUCTION;
-#ifdef SUPPORT_RPMB_PARTITION
-typedef struct
-{
- uint32_t nInstructionID;
- uint8_t nMAC[32];
- uint32_t nWorkspaceOffset[16];
- uint8_t pNonce[16];
- uint32_t nMC;
- uint16_t nAddr;
- uint16_t nBlockCount;
- uint16_t nResult;
- uint16_t nRequest;
-} DELEGATION_RPMB_INSTRUCTION;
-#endif
-
typedef struct
{
uint32_t nInstructionID;
@@ -121,9 +102,6 @@ typedef union
DELEGATION_NOTIFY_INSTRUCTION sNotify;
DELEGATION_RW_INSTRUCTION sReadWrite;
DELEGATION_SET_SIZE_INSTRUCTION sSetSize;
-#ifdef SUPPORT_RPMB_PARTITION
- DELEGATION_RPMB_INSTRUCTION sAuthRW;
-#endif
} DELEGATION_INSTRUCTION;
typedef struct
diff --git a/security/tf_daemon/smc_properties.c b/security/tf_daemon/smc_properties.c
index 48bfa8c..ce1e7e3 100644
--- a/security/tf_daemon/smc_properties.c
+++ b/security/tf_daemon/smc_properties.c
@@ -76,7 +76,7 @@ typedef enum
STATE_BINARY
} INTEGER_FORMAT;
-#if defined (LINUX) || defined(ANDROID)
+#if defined (LINUX) || defined(__ANDROID32__)
#define SEPARATOR_CHAR '/'
#elif defined (WIN32) || defined (__SYMBIAN32__) || defined (_WIN32_WCE)
@@ -151,7 +151,7 @@ static bool checkFilePath(char *pPath)
printf("Path %s doesn't point on a directory.\n", pDir);
return false;
}
-#if (!defined(__SYMBIAN32__)) && (!defined(_WIN32_WCE)) && (!defined(ANDROID))
+#if (!defined(__SYMBIAN32__)) && (!defined(_WIN32_WCE)) && (!defined(__ANDROID32__))
// TODO : under Symbian, Android and WM, check access right of a directory failed? I don't know why...
/* check read access */
if ((buf.st_mode & S_IREAD) != S_IREAD)
diff --git a/security/tf_daemon/smc_properties_parser.c b/security/tf_daemon/smc_properties_parser.c
index 8d0d676..99b7e97 100644
--- a/security/tf_daemon/smc_properties_parser.c
+++ b/security/tf_daemon/smc_properties_parser.c
@@ -58,7 +58,7 @@
#define GET_LAST_ERR errno
#endif
-#if defined (LINUX) || defined (__SYMBIAN32__) || defined (ANDROID)
+#if defined (LINUX) || defined (__SYMBIAN32__) || defined (__ANDROID32__)
#define STRICMP strcasecmp
#elif defined(_WIN32_WCE)
#define STRICMP _stricmp
@@ -402,7 +402,7 @@ static S_RESULT SMCPropYacc(uint8_t* pBuffer, uint32_t nBufferLength,
nError=S_ERROR_OUT_OF_MEMORY;
goto error;
}
-#if defined (LINUX) || defined (__SYMBIAN32__) || defined(ANDROID)
+#if defined (LINUX) || defined (__SYMBIAN32__) || defined(__ANDROID32__)
{
// put each char of the value in uppercase
char* p=pProperty->pValue;
diff --git a/security/tf_sdk/include/s_type.h b/security/tf_sdk/include/s_type.h
index ae260cc..cab5e9d 100644
--- a/security/tf_sdk/include/s_type.h
+++ b/security/tf_sdk/include/s_type.h
@@ -26,121 +26,121 @@
* 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
- **/
-#ifndef __S_TYPE_H__
-#define __S_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
- */
-
-typedef uint32_t S_RESULT;
-typedef S_RESULT TEEC_Result;
-typedef S_RESULT SM_ERROR;
-
-typedef uint32_t S_HANDLE;
-typedef S_HANDLE SM_HANDLE;
-#define S_HANDLE_NULL ((S_HANDLE)0)
-#define SM_HANDLE_INVALID S_HANDLE_NULL
-
-/** Definition of an UUID (from RFC 4122 http://www.ietf.org/rfc/rfc4122.txt) */
-typedef struct S_UUID
-{
- uint32_t time_low;
- uint16_t time_mid;
- uint16_t time_hi_and_version;
- uint8_t clock_seq_and_node[8];
-}S_UUID;
-typedef S_UUID TEEC_UUID;
-typedef S_UUID SM_UUID;
-
-/* 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
-
-#endif /* __S_TYPE_H__ */
-
+ */
+
+/**
+ * Definition of the machine-specific integer types
+ **/
+#ifndef __S_TYPE_H__
+#define __S_TYPE_H__
+
+/* C99 integer types */
+#if (!defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L) &&(!defined(__ANDROID32__))
+
+#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
+ */
+
+typedef uint32_t S_RESULT;
+typedef S_RESULT TEEC_Result;
+typedef S_RESULT SM_ERROR;
+
+typedef uint32_t S_HANDLE;
+typedef S_HANDLE SM_HANDLE;
+#define S_HANDLE_NULL ((S_HANDLE)0)
+#define SM_HANDLE_INVALID S_HANDLE_NULL
+
+/** Definition of an UUID (from RFC 4122 http://www.ietf.org/rfc/rfc4122.txt) */
+typedef struct S_UUID
+{
+ uint32_t time_low;
+ uint16_t time_mid;
+ uint16_t time_hi_and_version;
+ uint8_t clock_seq_and_node[8];
+}S_UUID;
+typedef S_UUID TEEC_UUID;
+typedef S_UUID SM_UUID;
+
+/* 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
+
+#endif /* __S_TYPE_H__ */
+