summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--security/smc_pa_ctrl/Android.mk7
-rw-r--r--security/smc_pa_ctrl/s_version.h5
-rw-r--r--security/tee_client_api/Android.mk1
-rw-r--r--security/tee_client_api/s_version.h4
-rw-r--r--security/tee_client_api/tee_client_api_linux_driver.c4
-rw-r--r--security/tf_crypto_sst/Android.mk9
-rw-r--r--security/tf_crypto_sst/pkcs11_object.c235
-rw-r--r--security/tf_crypto_sst/sst_stub.c3
-rw-r--r--security/tf_daemon/Android.mk11
-rw-r--r--security/tf_daemon/lib_uuid.h2
-rw-r--r--security/tf_daemon/s_version.h4
-rw-r--r--security/tf_sdk/include/OEMCrypto.h388
-rw-r--r--security/tf_sdk/include/common_secure_driver_protocol.h35
-rw-r--r--security/tf_sdk/include/sddi.h85
-rw-r--r--security/tf_sdk/include/smapi.h366
-rw-r--r--security/tf_sdk/include/smapi_ex.h123
-rw-r--r--security/tf_sdk/include/ssdi.h529
-rw-r--r--security/tf_sdk/include/ssdi_smc_ext.h61
-rw-r--r--security/tf_sdk/include/ssdi_v2_compat.h308
-rw-r--r--security/tf_sdk/include/wvdrm_protocol.h131
20 files changed, 696 insertions, 1615 deletions
diff --git a/security/smc_pa_ctrl/Android.mk b/security/smc_pa_ctrl/Android.mk
index 2a123bc..3a0e945 100644
--- a/security/smc_pa_ctrl/Android.mk
+++ b/security/smc_pa_ctrl/Android.mk
@@ -13,13 +13,14 @@ 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
diff --git a/security/smc_pa_ctrl/s_version.h b/security/smc_pa_ctrl/s_version.h
index fb9e652..cff19d7 100644
--- a/security/smc_pa_ctrl/s_version.h
+++ b/security/smc_pa_ctrl/s_version.h
@@ -27,7 +27,6 @@
* (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__
@@ -45,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(__ANDROID32__)
+#elif defined(ANDROID)
#define S_VERSION_OS "A" /* "A" for Android */
#define S_VERSION_PLATFORM "G" /* "G" for 4430 */
#elif defined(LINUX)
@@ -67,7 +66,7 @@
* defines to set the version number. Else set these values to 0.
*/
#define S_VERSION_ENG 0
-#define S_VERSION_PATCH 0
+#define S_VERSION_PATCH 6
#ifdef S_VERSION_BUILD
/* TRICK: detect if S_VERSION is defined but empty */
diff --git a/security/tee_client_api/Android.mk b/security/tee_client_api/Android.mk
index 8f1fe24..d148b64 100644
--- a/security/tee_client_api/Android.mk
+++ b/security/tee_client_api/Android.mk
@@ -20,6 +20,7 @@ endif
LOCAL_LDLIBS += -llog
LOCAL_CFLAGS += -DLINUX
+LOCAL_CFLAGS += -DANDROID
LOCAL_CFLAGS += -I $(LOCAL_PATH)/../tf_sdk/include/
LOCAL_MODULE:= libtee_client_api_driver
diff --git a/security/tee_client_api/s_version.h b/security/tee_client_api/s_version.h
index f712db2..cff19d7 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(__ANDROID32__)
+#elif defined(ANDROID)
#define S_VERSION_OS "A" /* "A" for Android */
#define S_VERSION_PLATFORM "G" /* "G" for 4430 */
#elif defined(LINUX)
@@ -66,7 +66,7 @@
* defines to set the version number. Else set these values to 0.
*/
#define S_VERSION_ENG 0
-#define S_VERSION_PATCH 0
+#define S_VERSION_PATCH 6
#ifdef S_VERSION_BUILD
/* TRICK: detect if S_VERSION is defined but empty */
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 584eea2..af5d36f 100644
--- a/security/tee_client_api/tee_client_api_linux_driver.c
+++ b/security/tee_client_api/tee_client_api_linux_driver.c
@@ -101,7 +101,7 @@ typedef struct
#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(TRACE_WARNING, 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, ...)
{
@@ -900,7 +900,7 @@ void TEEC_GetImplementationInfo(
TEEC_Context* context,
TEEC_ImplementationInfo* description)
{
- TRACE_INFO("TEEC_GetImplementationInfo");
+ TRACE_INFO("TEEC_GetImplementationInfo", NULL);
memset(description, 0, sizeof(TEEC_ImplementationInfo));
diff --git a/security/tf_crypto_sst/Android.mk b/security/tf_crypto_sst/Android.mk
index 6d3a9d8..21df372 100644
--- a/security/tf_crypto_sst/Android.mk
+++ b/security/tf_crypto_sst/Android.mk
@@ -15,18 +15,21 @@ 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/pkcs11_object.c b/security/tf_crypto_sst/pkcs11_object.c
index 53caadc..7fcdb70 100644
--- a/security/tf_crypto_sst/pkcs11_object.c
+++ b/security/tf_crypto_sst/pkcs11_object.c
@@ -93,148 +93,117 @@ static CK_RV static_checkPreConditionsAndUpdateHandles(
return CKR_OK;
}
-/******************************************/
-/* The buffer must be freed by the caller */
-/******************************************/
-static CK_RV static_encodeTwoTemplates(
- uint8_t** ppBuffer,
- uint32_t * pBufferSize,
- const uint32_t nParamIndex,
- CK_ATTRIBUTE* pTemplate1,
- CK_ULONG ulCount1,
- CK_ATTRIBUTE* pTemplate2,
- CK_ULONG ulCount2)
+/* Add up the sizes of the items and values in an attribute template.
+ */
+static CK_RV static_analyzeTemplate(
+ uint32_t *const pDataOffset,
+ uint32_t *const pBufferSize,
+ const CK_ATTRIBUTE *const pTemplate,
+ CK_ULONG const ulCount)
{
- INPUT_TEMPLATE_ITEM sItem;
-
- uint32_t i;
- uint32_t nDataOffset = 0;
- uint32_t nBufferIndex = 0;
- uint32_t nBufferSize = 0;
- uint8_t* pBuffer = NULL;
- CK_RV nErrorCode = CKR_OK;
+ CK_ULONG i;
+ uint32_t nItemsSize;
+ uint32_t nValuesSize = 0;
- if (ulCount1 == 0)
- {
- /* Nothing to do */
- return CKR_OK;
- }
- if (pTemplate1 == NULL)
+ nItemsSize = sizeof(uint32_t); /* for the number of attributes */
+ if (ulCount == 0)
{
- /* Nothing to do */
+ /* There are zero attributes, so the buffer will only contain the size word. */
+ *pDataOffset += nItemsSize;
+ *pBufferSize += nItemsSize;
return CKR_OK;
}
+ nItemsSize += sizeof(INPUT_TEMPLATE_ITEM) * ulCount; /*for the attribute items*/
- /* First compute the total required buffer size that
- * will contain the full templates (for the template 1 AND 2)
- */
- nBufferSize = 4 + /* Nb Attributes */
- sizeof(INPUT_TEMPLATE_ITEM)*ulCount1; /* The attributes items */
- if (pTemplate2 != NULL)
- {
- nBufferSize += 4 + /* Nb Attributes */
- sizeof(INPUT_TEMPLATE_ITEM)*ulCount2; /* The attributes items */
- }
-
- /* First data (attribute values) on either template 1 or 2 will just be after the last item */
- nDataOffset = nBufferSize;
-
- for (i = 0; i < ulCount1; i++)
- {
- /* Each value will be aligned on 4 bytes.
- This computation includes the spare bytes. */
- nBufferSize += PKCS11_GET_SIZE_WITH_ALIGNMENT(pTemplate1[i].ulValueLen);
- }
- if (pTemplate2 != NULL)
+ /* Add up the attribute value sizes, taking the 4-byte alignment into account. */
+ for (i = 0; i < ulCount; i++)
{
- for (i = 0; i < ulCount2; i++)
+ if (*pBufferSize + nValuesSize > 0x40000000)
{
- /* Each value will be aligned on 4 bytes.
- This computation includes the spare bytes. */
- nBufferSize += PKCS11_GET_SIZE_WITH_ALIGNMENT(pTemplate2[i].ulValueLen);
+ /* Offsets above 0x40000000 aren't supported. */
+ return CKR_DEVICE_ERROR;
}
+ nValuesSize += PKCS11_GET_SIZE_WITH_ALIGNMENT(pTemplate[i].ulValueLen);
}
- pBuffer = (uint8_t*)malloc(nBufferSize);
- if (pBuffer == NULL)
- {
- /* Not enough memory */
- return CKR_DEVICE_MEMORY;
- }
-
- memset(pBuffer, 0, nBufferSize);
+ *pDataOffset += nItemsSize;
+ *pBufferSize += nItemsSize + nValuesSize;
+ return CKR_OK;
+}
- /*
- * First template
- */
- *(uint32_t*)(pBuffer + nBufferIndex) = ulCount1;
- nBufferIndex += 4;
- for (i = 0; i < ulCount1; i++)
+static void static_copyTemplate(
+ uint8_t *const pBuffer,
+ uint32_t const nParamIndex,
+ uint8_t **const ppAttributeCursor,
+ uint8_t **const ppDataCursor,
+ const CK_ATTRIBUTE *const pTemplate,
+ CK_ULONG const ulCount)
+{
+ INPUT_TEMPLATE_ITEM sItem;
+ CK_ULONG i;
+ *(uint32_t*)(*ppAttributeCursor) = ulCount;
+ *ppAttributeCursor += sizeof(uint32_t);
+ for (i = 0; i < ulCount; i++)
{
- sItem.attributeType = (uint32_t)pTemplate1[i].type;
+ sItem.attributeType = pTemplate[i].type;
/* dataOffset = 0 means NULL buffer */
- sItem.dataOffset = ((pTemplate1[i].pValue == NULL) ? 0 : nDataOffset);
+ sItem.dataOffset = ((pTemplate[i].pValue == NULL) ? 0 :
+ *ppDataCursor - pBuffer);
sItem.dataParamIndex = nParamIndex; /* The parameter where we store the data (0 to 3) */
- sItem.dataValueLen = (uint32_t)pTemplate1[i].ulValueLen;
+ sItem.dataValueLen = pTemplate[i].ulValueLen;
/* Copy the item */
- memcpy(pBuffer + nBufferIndex, &sItem, sizeof(INPUT_TEMPLATE_ITEM));
- nBufferIndex += sizeof(INPUT_TEMPLATE_ITEM);
- if (pTemplate1[i].pValue != NULL)
+ memcpy(*ppAttributeCursor, &sItem, sizeof(INPUT_TEMPLATE_ITEM));
+ *ppAttributeCursor += sizeof(INPUT_TEMPLATE_ITEM);
+ if (pTemplate[i].pValue != NULL)
{
/* Copy the data */
- memcpy(pBuffer + nDataOffset, (uint8_t*)pTemplate1[i].pValue, (uint32_t)pTemplate1[i].ulValueLen);
+ memcpy(*ppDataCursor, pTemplate[i].pValue, pTemplate[i].ulValueLen);
/* Next data will be stored just after the previous one but aligned on 4 bytes */
- nDataOffset += PKCS11_GET_SIZE_WITH_ALIGNMENT(pTemplate1[i].ulValueLen);
- if ((nDataOffset & 0xC0000000) != 0)
- {
- /* We whould never go in this case, that means the dataOffset will not be able to store the offset correctly */
- nErrorCode = CKR_DEVICE_ERROR;
- goto error;
- }
+ *ppDataCursor += PKCS11_GET_SIZE_WITH_ALIGNMENT(pTemplate[i].ulValueLen);
}
}
+}
- /*
- * Second template
- */
- if (pTemplate2 != NULL)
- {
- *(uint32_t*)(pBuffer + nBufferIndex) = ulCount2;
- nBufferIndex += 4;
- for (i = 0; i < ulCount2; i++)
- {
- sItem.attributeType = (uint32_t)pTemplate2[i].type;
- /* dataOffset = 0 means NULL buffer */
- sItem.dataOffset = ((pTemplate2[i].pValue == NULL) ? 0 : nDataOffset);
- sItem.dataParamIndex = nParamIndex; /* The parameter where we store the data (0..3) */
- sItem.dataValueLen = (uint32_t)pTemplate2[i].ulValueLen;
- /* Copy the item */
- memcpy(pBuffer + nBufferIndex, &sItem, sizeof(INPUT_TEMPLATE_ITEM));
- nBufferIndex += sizeof(INPUT_TEMPLATE_ITEM);
- if (pTemplate2[i].pValue != NULL)
- {
- /* Copy the data */
- memcpy(pBuffer + nDataOffset, (uint8_t*)pTemplate2[i].pValue, (uint32_t)pTemplate2[i].ulValueLen);
- /* Next data will be stored just after the previous one but aligned on 4 bytes */
- nDataOffset += PKCS11_GET_SIZE_WITH_ALIGNMENT(pTemplate2[i].ulValueLen);
- if ((nDataOffset & 0xC0000000) != 0)
- {
- /* We whould never go in this case, that means the dataOffset will not be able to store the offset correctly */
- nErrorCode = CKR_DEVICE_ERROR;
- goto error;
- }
- }
- }
- }
+/******************************************/
+/* The buffer must be freed by the caller */
+/******************************************/
+static CK_RV static_encodeTwoTemplates(
+ uint8_t** ppBuffer,
+ uint32_t * pBufferSize,
+ const uint32_t nParamIndex,
+ const CK_ATTRIBUTE* pTemplate1,
+ CK_ULONG ulCount1,
+ const CK_ATTRIBUTE* pTemplate2,
+ CK_ULONG ulCount2)
+{
+ uint8_t* pBuffer = NULL;
+ uint32_t nBufferSize = 0;
+ uint32_t nDataOffset = 0;
+ uint8_t *pAttributeCursor;
+ uint8_t *pDataCursor;
+ CK_RV nErrorCode;
+
+ nErrorCode = static_analyzeTemplate(&nDataOffset, &nBufferSize, pTemplate1, ulCount1);
+ if (nErrorCode != CKR_OK) return nErrorCode;
+ nErrorCode = static_analyzeTemplate(&nDataOffset, &nBufferSize, pTemplate2, ulCount2);
+ if (nErrorCode != CKR_OK) return nErrorCode;
+
+ pBuffer = malloc(nBufferSize);
+ if (pBuffer == NULL) return CKR_DEVICE_MEMORY;
+ memset(pBuffer, 0, nBufferSize);
+
+ pAttributeCursor = pBuffer;
+ pDataCursor = pBuffer + nDataOffset;
+ static_copyTemplate(pBuffer, nParamIndex,
+ &pAttributeCursor, &pDataCursor,
+ pTemplate1, ulCount1);
+ static_copyTemplate(pBuffer, nParamIndex,
+ &pAttributeCursor, &pDataCursor,
+ pTemplate2, ulCount2);
*ppBuffer = pBuffer;
*pBufferSize = nBufferSize;
-
return CKR_OK;
-
-error:
- free(pBuffer);
- return nErrorCode;
}
/******************************************/
@@ -247,7 +216,35 @@ static CK_RV static_encodeTemplate(
CK_ATTRIBUTE* pTemplate,
CK_ULONG ulCount)
{
- return static_encodeTwoTemplates(ppBuffer, pBufferSize, nParamIndex, pTemplate, ulCount, NULL, 0);
+ uint8_t* pBuffer = NULL;
+ uint32_t nBufferSize = 0;
+ uint32_t nDataOffset = 0;
+ uint8_t *pAttributeCursor;
+ uint8_t *pDataCursor;
+ CK_RV nErrorCode;
+
+ if (pTemplate == NULL || ulCount == 0)
+ {
+ *ppBuffer = NULL;
+ *pBufferSize = 0;
+ return CKR_OK;
+ }
+
+ nErrorCode = static_analyzeTemplate(&nDataOffset, &nBufferSize, pTemplate, ulCount);
+ if (nErrorCode != CKR_OK) return nErrorCode;
+
+ pBuffer = malloc(nBufferSize);
+ if (pBuffer == NULL) return CKR_DEVICE_MEMORY;
+
+ pAttributeCursor = pBuffer;
+ pDataCursor = pBuffer + nDataOffset;
+ static_copyTemplate(pBuffer, nParamIndex,
+ &pAttributeCursor, &pDataCursor,
+ pTemplate, ulCount);
+
+ *ppBuffer = pBuffer;
+ *pBufferSize = nBufferSize;
+ return CKR_OK;
}
/* ----------------------------------------------------------------------- */
@@ -1268,7 +1265,7 @@ CK_RV PKCS11_EXPORT C_GenerateKeyPair(
PPKCS11_PRIMARY_SESSION_CONTEXT pSession;
if ( (pMechanism == NULL) ||
- (pPublicKeyTemplate == NULL) || (pPrivateKeyTemplate == NULL) ||
+ (pPublicKeyTemplate == NULL) ||
(phPublicKey== NULL) || (phPrivateKey== NULL))
{
return CKR_ARGUMENTS_BAD;
@@ -1280,7 +1277,7 @@ CK_RV PKCS11_EXPORT C_GenerateKeyPair(
return nErrorCode;
}
- nErrorCode = static_encodeTwoTemplates(&pBuffer, &nBufferSize, 2, (CK_ATTRIBUTE*)pPublicKeyTemplate, ulPublicKeyAttributeCount, (CK_ATTRIBUTE*)pPrivateKeyTemplate, ulPrivateKeyAttributeCount);
+ nErrorCode = static_encodeTwoTemplates(&pBuffer, &nBufferSize, 2, pPublicKeyTemplate, ulPublicKeyAttributeCount, pPrivateKeyTemplate, ulPrivateKeyAttributeCount);
if (nErrorCode != CKR_OK)
{
return nErrorCode;
diff --git a/security/tf_crypto_sst/sst_stub.c b/security/tf_crypto_sst/sst_stub.c
index e8a78bc..e6e37b6 100644
--- a/security/tf_crypto_sst/sst_stub.c
+++ b/security/tf_crypto_sst/sst_stub.c
@@ -27,8 +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.
*/
-
-#ifdef __ANDROID32__
+#ifdef ANDROID
#include <stddef.h>
#endif
diff --git a/security/tf_daemon/Android.mk b/security/tf_daemon/Android.mk
index 1146b5c..a163d3c 100644
--- a/security/tf_daemon/Android.mk
+++ b/security/tf_daemon/Android.mk
@@ -17,16 +17,15 @@ LOCAL_SRC_FILES := \
smc_properties_parser.c \
lib_manifest2.c
-LOCAL_LDLIBS += -llog
-
-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
diff --git a/security/tf_daemon/lib_uuid.h b/security/tf_daemon/lib_uuid.h
index acec4a0..09bee2e 100644
--- a/security/tf_daemon/lib_uuid.h
+++ b/security/tf_daemon/lib_uuid.h
@@ -1,5 +1,5 @@
/**
- * Copyright(c) 2011 Trusted Logic. All rights reserved.
+ * Copyright(c) 2012 Trusted Logic. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/security/tf_daemon/s_version.h b/security/tf_daemon/s_version.h
index f712db2..cff19d7 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(__ANDROID32__)
+#elif defined(ANDROID)
#define S_VERSION_OS "A" /* "A" for Android */
#define S_VERSION_PLATFORM "G" /* "G" for 4430 */
#elif defined(LINUX)
@@ -66,7 +66,7 @@
* defines to set the version number. Else set these values to 0.
*/
#define S_VERSION_ENG 0
-#define S_VERSION_PATCH 0
+#define S_VERSION_PATCH 6
#ifdef S_VERSION_BUILD
/* TRICK: detect if S_VERSION is defined but empty */
diff --git a/security/tf_sdk/include/OEMCrypto.h b/security/tf_sdk/include/OEMCrypto.h
new file mode 100644
index 0000000..daefdc8
--- /dev/null
+++ b/security/tf_sdk/include/OEMCrypto.h
@@ -0,0 +1,388 @@
+/*******************************************************************************
+ *
+ * Reference APIs needed to support Widevine's crypto algorithms.
+ *
+ ******************************************************************************/
+
+#ifndef _OEMCRYPTO_AES_H
+#define _OEMCRYPTO_AES_H
+
+typedef unsigned char OEMCrypto_UINT8;
+typedef char OEMCrypto_INT8;
+typedef unsigned int OEMCrypto_UINT32;
+typedef unsigned int OEMCrypto_SECURE_BUFFER;
+
+
+typedef enum OEMCryptoResult {
+ OEMCrypto_SUCCESS = 0,
+ OEMCrypto_ERROR_INIT_FAILED,
+ OEMCrypto_ERROR_TERMINATE_FAILED,
+ OEMCrypto_ERROR_ENTER_SECURE_PLAYBACK_FAILED,
+ OEMCrypto_ERROR_EXIT_SECURE_PLAYBACK_FAILED,
+ OEMCrypto_ERROR_SHORT_BUFFER,
+ OEMCrypto_ERROR_NO_DEVICE_KEY,
+ OEMCrypto_ERROR_NO_ASSET_KEY,
+ OEMCrypto_ERROR_KEYBOX_INVALID,
+ OEMCrypto_ERROR_NO_KEYDATA,
+ OEMCrypto_ERROR_NO_CW,
+ OEMCrypto_ERROR_DECRYPT_FAILED,
+ OEMCrypto_ERROR_WRITE_KEYBOX,
+ OEMCrypto_ERROR_WRAP_KEYBOX,
+ OEMCrypto_ERROR_BAD_MAGIC,
+ OEMCrypto_ERROR_BAD_CRC,
+ OEMCrypto_ERROR_NO_DEVICEID,
+ OEMCrypto_ERROR_RNG_FAILED,
+ OEMCrypto_ERROR_RNG_NOT_SUPPORTED,
+ OEMCrypto_ERROR_SETUP
+} OEMCryptoResult;
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define OEMCrypto_Initialize _oec01
+#define OEMCrypto_Terminate _oec02
+#define OEMCrypto_SetEntitlementKey _oec03
+#define OEMCrypto_DeriveControlWord _oec04
+#define OEMCrypto_DecryptVideo _oec05
+#define OEMCrypto_DecryptAudio _oec06
+#define OEMCrypto_InstallKeybox _oec07
+#define OEMCrypto_GetKeyData _oec08
+#define OEMCrypto_IsKeyboxValid _oec09
+#define OEMCrypto_GetRandom _oec10
+#define OEMCrypto_GetDeviceID _oec11
+#define OEMCrypto_EnterSecurePlayback _oec12
+#define OEMCrypto_ExitSecurePlayback _oec13
+#define OEMCrypto_WrapKeybox _oec14
+
+/*
+ * OEMCrypto_Initialize
+ *
+ * Description:
+ * Initializes the crypto hardware
+ *
+ * Parameters:
+ * N/A
+ *
+ * Returns:
+ * OEMCrypto_SUCCESS success
+ * OEMCrypto_ERROR_INIT_FAILED failed to initialize crypto hardware
+ */
+OEMCryptoResult OEMCrypto_Initialize(void);
+
+
+/*
+ * OEMCrypto_Terminate
+ *
+ * Description:
+ * The API closes the crypto operation and releases all resources used.
+ *
+ * Parameters:
+ * N/A
+ *
+ * Returns:
+ * OEMCrypto_SUCCESS success
+ * OEMCrypto_ERROR_TERMINATE_FAILED failed to de-initialize crypto hardware
+ */
+OEMCryptoResult OEMCrypto_Terminate(void);
+
+/*
+ * OEMCrypto_EnterSecurePlayback
+ *
+ * Description:
+ * Configures the security processor for secure decryption. This may involve
+ * setting up firewall regions. It is called when the decrypt session for an
+ * asset is established.
+ *
+ * Parameters:
+ * N/A
+ *
+ * Returns:
+ * OEMCrypto_SUCCESS success
+ * OEMCrypto_ERROR_ENTER_SECURE_PLAYBACK_FAILED
+ */
+OEMCryptoResult OEMCrypto_EnterSecurePlayback(void);
+
+/*
+ * OEMCrypto_ExitSecurePlayback
+ *
+ * Description:
+ * Exit the secure playback mode. This may involve releasing the firewall regions. It is
+ * called when the decrypt session for an asset is closed.
+ *
+ * Parameters:
+ * N/A
+ *
+ * Returns:
+ * OEMCrypto_SUCCESS success
+ * OEMCrypto_ERROR_EXIT_SECURE_PLAYBACK_FAILED
+ */
+OEMCryptoResult OEMCrypto_ExitSecurePlayback(void);
+
+/*
+ * OEMCrypto_SetEntitlementKey
+ *
+ * Description:
+ * Decrypt the entitlement (EMM) key, also known as the asset key,
+ * using the encrypted device key (Device Key field) in the Widevine Keybox.
+ *
+ * As shown in Figure 1 on the next page, Step 1 uses an OEM root key to decrypt
+ * (AES-128-ECB) the Device Key in the Keybox; the result is “latched” in hardware
+ * key ladder.
+ *
+ * Step 2 uses the “latched” clear device key to decrypt (AES-128-ECB) the
+ * entitlement key passed in as the *emmKey parameter and “latched” the clear
+ * entitlement key in hardware for the next operation.
+ *
+ * Parameters:
+ * emmKey (in) - pointer to the encrypted entitlement key
+ * emmKeyLength (in) – length of entitlement key in bytes
+ *
+ * Returns:
+ * OEMCrypto_SUCCESS success
+ * OEMCrypto_ERROR_NO_DEVICE_KEY failed to decrypt device key
+ * OEMCrypto_ERROR_NO_ASSET_KEY failed to decrypt asset key
+ * OEMCrypto_ERROR_KEYBOX_INVALID cannot decrypt and read from Keybox
+ */
+
+OEMCryptoResult OEMCrypto_SetEntitlementKey(const OEMCrypto_UINT8* emmKey,
+ const OEMCrypto_UINT32 emmKeyLength);
+
+/*
+ * OEMCrypto_DeriveControlWord
+ *
+ * Description:
+ * Using the active key ladder key from OEMCrypto_SetEntitlementKey(), decrypts
+ * (AES-128-CBC, iv=0) the 32-byte ECM referenced by the *ecm parameter; returns in
+ * *flags the first clear 4 bytes data. “Latched” the clear bytes [4..20] as the
+ * clear control word for subsequent payload decryption operation.
+ *
+ * Parameters:
+ * ecm (in) - points to encrypted ECM data
+ * length (in) – length of encrypted ECM data in bytes
+ * flags (out) - points to buffer to receive 4 byte clear flag value
+ *
+ * Returns:
+ * OEMCrypto_SUCCESS success
+ * OEMCrypto_ERROR_NO_CW cannot decrypt control word
+*/
+
+OEMCryptoResult OEMCrypto_DeriveControlWord(const OEMCrypto_UINT8* ecm,
+ const OEMCrypto_UINT32 length,
+ OEMCrypto_UINT32* flags);
+
+
+/*
+ * OEMCrypto_DecryptVideo
+ *
+ * Description:
+ *
+ * The API decrypts (AES-128-CBC) the video payload in the buffer referenced by
+ * the *input parameter into the secure buffer referenced by the output
+ * parameter, using the control word “latched” in the active hardware key
+ * ladder. If inputLength is not a multiple of the crypto block size (16 bytes),
+ * the API handles the residual bytes using CipherText Stealing (CTS).
+ *
+ * Parameters:
+ * iv (in/out) - If iv is NULL, then no decryption is required, i.e. the packets are
+ * already clear. Otherwise, iv references the AES initialization
+ * vector. Note that the updated IV after processing the final crypto
+ * block must be passed back out in *iv.
+ * input (in) - buffer containing the encrypted data
+ * inputLength (in) - number of bytes in the input payload, which may not be a multiple of 16 bytes
+ * output (in) – reference to the secure buffer which will receive the decrypted data
+ * outputLength (out) - number of bytes written into the secure buffer
+ *
+ * Returns:
+ * OEMCrypto_SUCCESS success
+ * OEMCrypto_ERROR_DECRYPT_FAILED failed decryption
+*/
+
+OEMCryptoResult
+OEMCrypto_DecryptVideo(const OEMCrypto_UINT8* iv,
+ const OEMCrypto_UINT8* input, const OEMCrypto_UINT32 inputLength,
+ OEMCrypto_UINT32 output_handle, OEMCrypto_UINT32 output_offset, OEMCrypto_UINT32 *outputLength);
+
+
+/*
+ * OEMCrypto_DecryptAudio
+ *
+ * Description:
+ * The API decrypts (AES-128-CBC) the audio payload in the buffer referenced by
+ * the *input parameter into the non-secure buffer referenced by the output
+ * parameter, using the control word “latched” in the active hardware key
+ * ladder. If inputLength is not a multiple of the crypto block size (16 bytes),
+ * the API handles the residual bytes using CipherText Stealing (CTS).
+ *
+ * OEMCrypto_DecryptAudio must make sure that it cannot be used to decrypt a video
+ * stream into non-firewalled buffers, by verifying that no video packets are
+ * processed.
+ *
+ * Parameters:
+ * iv (in/out) - If iv is NULL, then no decryption is required, i.e. the packets are
+ * already clear. Otherwise, iv references the AES initialization
+ * vector. Note that the updated IV after processing the final crypto
+ * block must be passed back out in *iv.
+ * input (in) - buffer containing the encrypted data
+ * inputLength (in) - number of bytes in the input payload, which may not be a multiple of 16 bytes
+ * output (in) – reference to the non-secure buffer which will receive the decrypted data
+ * outputLength (out) - number of bytes written into the non-secure buffer
+ *
+ * Returns:
+ * OEMCrypto_SUCCESS success
+ * OEMCrypto_ERROR_DECRYPT_FAILED failed decryption
+*/
+OEMCryptoResult
+OEMCrypto_DecryptAudio(const OEMCrypto_UINT8* iv,
+ const OEMCrypto_UINT8* input, const OEMCrypto_UINT32 inputLength,
+ OEMCrypto_UINT8 *output, OEMCrypto_UINT32 *outputLength);
+
+
+/*
+ * OEMCrypto_InstallKeybox
+ *
+ * Description:
+ * Unwrap and store the keybox to persistent memory. The device key must be stored
+ * securely. The device key will be decrypted and
+ * “latched” into hardware key ladder by OEMCrypto_SetEntitlementKey.
+ *
+ * This function is used once to load the keybox onto the device at provisioning time.
+ *
+ * Parameters:
+ * keybox (in) - Pointer to clear keybox data. Must have been wrapped with OEMCrypto_WrapKeybox
+ * keyboxLength (in) - Length of the keybox data in bytes
+ *
+ * Returns:
+ * OEMCrypto_SUCCESS success
+ * OEMCrypto_ERROR_WRITE_KEYBOX failed to handle and store Keybox
+ */
+
+OEMCryptoResult OEMCrypto_InstallKeybox(OEMCrypto_UINT8 *keybox,
+ OEMCrypto_UINT32 keyBoxLength);
+
+
+/*
+ * OEMCrypto_IsKeyboxValid
+ *
+ * Description:
+ * Validate the Widevine Keybox stored on the device.
+ *
+ * The API performs two verification steps on the Keybox. It first verifies the MAGIC
+ * field contains a valid signature (i.e. ‘k’’b’’o’’x’). The API then computes the
+ * CRC using CRC-32-IEEE 802.3 standard and compares the checksum to the CRC stored
+ * in the Keybox. The CRC is computed over the entire Keybox excluding the 4 bytes
+ * CRC (i.e. Keybox[0..123].
+ *
+ * Parameters:
+ * none
+ *
+ * Returns:
+ * OEMCrypto_SUCCESS
+ * OEMCrypto_ERROR_BAD_MAGIC
+ * OEMCrypto_ERROR_BAD_CRC
+ */
+
+OEMCryptoResult OEMCrypto_IsKeyboxValid(void);
+
+
+/*
+ * OEMCrypto_GetDeviceID
+ *
+ * Description:
+ * Retrieve the device's unique identifier from the Keybox.
+ *
+ * Parameters:
+ * deviceId (out) - pointer to the buffer that receives the Device ID
+ * idLength (in/out) - on input, size of the caller's device ID buffer.
+ * On output, the number of bytes written into the buffer.
+ *
+ * Returns:
+ * OEMCrypto_SUCCESS success
+ * OEMCrypto_ERROR_SHORT_BUFFER if the buffer is too small to return the device ID
+ * OEMCrypto_ERROR_NO_DEVICEID failed to return Device Id
+ */
+OEMCryptoResult OEMCrypto_GetDeviceID(OEMCrypto_UINT8* deviceID,
+ OEMCrypto_UINT32 *idLength);
+
+
+/*
+ * OEMCrypto_GetKeyData
+ *
+ * Description:
+ * Returns the Key Data field from the Keybox. The Key Data field does not need to be
+ * encrypted by an OEM root key, but may be if desired.
+ *
+ * If the Key Data field was encrypted with an OEM root key when the Keybox was stored
+ * on the device, then this function should decrypt it and return the clear Key Data.
+ * If the Key Data was not encrypted, then this function should just access and return
+ * the clear Key data.
+ *
+ * Parameters:
+ * keyData (out) - pointer to the buffer to hold the Key Data field from the Keybox
+ * dataLength (in/out) - on input, the allocated buffer size. On output, the number
+ * of bytes in KeyData.
+ *
+ * Returns:
+ * OEMCrypto_SUCCESS success
+ * OEMCrypto_ERROR_SHORT_BUFFER if the buffer is too small to return the KeyData
+ * OEMCrypto_ERROR_NO_KEYDATA failed to return KeyData
+ */
+OEMCryptoResult OEMCrypto_GetKeyData(OEMCrypto_UINT8* keyData,
+ OEMCrypto_UINT32 *keyDataLength);
+
+
+/*
+ * OEMCrypto_GetRandom
+ *
+ * Description:
+ * Returns a buffer filled with hardware-generated random bytes, if supported by the hardware.
+ *
+ * Parameters:
+ * randomData (out) - Points to the buffer that should recieve the random data.
+ * dataLength (in) - Length of the random data buffer in bytes.
+ *
+ * Returns:
+ * OEMCrypto_SUCCESS success
+ * OEMCrypto_ERROR_RNG_FAILED failed to generate random number
+ * OEMCrypto_ERROR_RNG_NOT_SUPPORTED function not supported
+ */
+
+OEMCryptoResult OEMCrypto_GetRandom(OEMCrypto_UINT8* randomData,
+ OEMCrypto_UINT32 dataLength);
+
+/*
+ * OEMCrypto_WrapKeybox
+ *
+ * Description:
+ * Wrap the Keybox with a key derived for the device key.
+ *
+ * Parameters:
+ * keybox (in) - Pointer to keybox data.
+ * keyboxLength - Length of the Keybox data in bytes
+ * wrappedKeybox (out) - Pointer to wrapped keybox
+ * wrappedKeyboxLength (out) - Pointer to the length of the wrapped keybox in bytes
+ * transportKey (in) - An optional AES transport key. If provided, the parameter
+ * keybox is passed encrypted with this transport key with AES-CBC
+ * and a null IV
+ * transportKeyLength - number of bytes in the transportKey
+ *
+ * Returns:
+ * OEMCrypto_SUCCESS success
+ * OEMCrypto_ERROR_WRAP_KEYBOX failed to wrap Keybox
+ */
+
+OEMCryptoResult OEMCrypto_WrapKeybox(OEMCrypto_UINT8 *keybox,
+ OEMCrypto_UINT32 keyBoxLength,
+ OEMCrypto_UINT8 *wrappedKeybox,
+ OEMCrypto_UINT32 *wrappedKeyBoxLength,
+ OEMCrypto_UINT8 *transportKey,
+ OEMCrypto_UINT32 transportKeyLength);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/***************************** End of File *****************************/
diff --git a/security/tf_sdk/include/common_secure_driver_protocol.h b/security/tf_sdk/include/common_secure_driver_protocol.h
new file mode 100644
index 0000000..3f46113
--- /dev/null
+++ b/security/tf_sdk/include/common_secure_driver_protocol.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2011 Trusted Logic S.A.
+ * All Rights Reserved.
+ *
+ * This software is the confidential and proprietary information of
+ * Trusted Logic S.A. ("Confidential Information"). You shall not
+ * disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered
+ * into with Trusted Logic S.A.
+ *
+ * TRUSTED LOGIC S.A. MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE
+ * SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING
+ * BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. TRUSTED LOGIC S.A. SHALL
+ * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING,
+ * MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
+ */
+#ifndef __COMMON_SECURE_DRIVER_PROTOCOL_H__
+#define __COMMON_SECURE_DRIVER_PROTOCOL_H__
+
+/*C2537CC3-36F0-48D9-820E-559601478029*/
+#define COMMON_SECURE_DRIVER_UUID {0xC2537CC3, 0x36F0, 0x48D9, {0x82, 0x0E, 0x55, 0x96, 0x01, 0x47, 0x80, 0x29}}
+
+#define COMMON_SECURE_DRIVER_GET_SECURE_BUFFER 0x00000000
+#define COMMON_SECURE_DRIVER_HDCP_SECURE_IS_SECURE 0x00000002
+#define COMMON_SECURE_DRIVER_ENTER_SECURE_PLAYBACK 0x00003000
+#define COMMON_SECURE_DRIVER_EXIT_SECURE_PLAYBACK 0x00003001
+#define COMMON_SECURE_DRIVER_LOCK_SECURE_PLAYBACK 0x00004000
+#define COMMON_SECURE_DRIVER_UNLOCK_SECURE_PLAYBACK 0x00004001
+
+#define COMMON_SECURE_DRIVER_CEK_UNWRAP 0x00006000
+#define COMMON_SECURE_DRIVER_KEK_WRAP 0x00006001
+#define COMMON_SECURE_DRIVER_KEK_UNWRAP 0x00006002
+
+#endif /* __COMMON_SECURE_DRIVER_PROTOCOL_H__ */
diff --git a/security/tf_sdk/include/sddi.h b/security/tf_sdk/include/sddi.h
deleted file mode 100644
index 713e070..0000000
--- a/security/tf_sdk/include/sddi.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * Copyright(c) 2011 Trusted Logic. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name Trusted Logic 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
- * OWNER 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 __SDDI_H__
-#define __SDDI_H__
-
-#include "ssdi.h"
-
-#ifndef SDDI_EXPORT
-#if defined(WIN32) || defined(__ARMCC_VERSION)
-#ifdef SMODULE_IMPLEMENTATION
-#define SDDI_EXPORT __declspec(dllexport)
-#else
-#define SDDI_EXPORT __declspec(dllimport)
-#endif
-#elif defined(__GNUC__)
-#define SDDI_EXPORT __attribute__ ((visibility ("default")))
-#else
-#define SDDI_EXPORT
-#endif
-#endif /* !SDDI_EXPORT */
-
-#ifndef SDRV_EXPORT
-#if defined(WIN32) || defined(_WIN32_WCE) || defined(__ARMCC_VERSION)
-#define SDRV_EXPORT __declspec(dllexport)
-#elif defined(__GNUC__)
-#define SDRV_EXPORT __attribute__ ((visibility ("default")))
-#else
-#define SDRV_EXPORT
-#endif
-#endif /* !SDRV_EXPORT */
-
-#define S_CACHE_OPERATION_CLEAN 0x00000001
-#define S_CACHE_OPERATION_INVALIDATE 0x00000002
-#define S_CACHE_OPERATION_CLEAN_AND_INVALIDATE 0x00000003
-
-void SDDI_EXPORT *SMemGetVirtual(uint32_t nSegmentID);
-
-S_RESULT SDDI_EXPORT SMemGetPhysical(void* pVirtual, uint32_t* pnPhysical);
-
-S_RESULT SDDI_EXPORT SMemFlush(
- uint32_t nSegmentID,
- uint32_t nOperation);
-
-S_RESULT SDDI_EXPORT SMemFlushByAddress(
- void* pStartAddress,
- uint32_t nLength,
- uint32_t nOperation);
-
-/*------------------------------------------------------------------------------
- Driver Common Entry Points
-------------------------------------------------------------------------------*/
-
-S_RESULT SDRV_EXPORT SDrvCreate(uint32_t nParam0, uint32_t nParam1);
-
-void SDRV_EXPORT SDrvDestroy(void);
-
-#endif /* #ifndef __SDDI_H__ */
diff --git a/security/tf_sdk/include/smapi.h b/security/tf_sdk/include/smapi.h
deleted file mode 100644
index 2fc3e5e..0000000
--- a/security/tf_sdk/include/smapi.h
+++ /dev/null
@@ -1,366 +0,0 @@
-/**
- * Copyright(c) 2011 Trusted Logic. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name Trusted Logic 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
- * OWNER 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 : smapi.h
- * Last-Author : Trusted Logic S.A.
- * Created : March 15, 2003
- */
-
-#ifndef __SMAPI_H__
-#define __SMAPI_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*------------------------------------------------------------------------------
- Includes
-------------------------------------------------------------------------------*/
-
-#include "s_type.h"
-#include "s_error.h"
-/*------------------------------------------------------------------------------
- SMAPI Types
-------------------------------------------------------------------------------*/
-
-
-#ifdef SM_EXPORT_IMPLEMENTATION
-#define SM_EXPORT S_DLL_EXPORT
-#else
-#define SM_EXPORT S_DLL_IMPORT
-#endif
-
-typedef struct SM_PROPERTY
-{
- wchar_t* pName;
- wchar_t* pValue;
-} SM_PROPERTY;
-
-typedef struct SM_TIME_LIMIT
-{
- uint32_t nHighTime;
- uint32_t nLowTime;
-} SM_TIME_LIMIT;
-
-/*------------------------------------------------------------------------------
- Constants
-------------------------------------------------------------------------------*/
-
-
-#define SM_API_VERSION 0x03000000
-
-#define SM_CONTROL_MODE_USER ( (uint32_t)0x00000002 )
-#define SM_CONTROL_MODE_MANAGER ( (uint32_t)0x00000008 )
-#define SM_CONTROL_MODE_EXCLUSIVE_MANAGER ( (uint32_t)0x00000010 )
-
-#define SM_LOGIN_PUBLIC ( (uint32_t)0x00000000 )
-#define SM_LOGIN_OS_IDENTIFICATION ( (uint32_t)0x00000005 )
-#define SM_LOGIN_AUTHENTICATION ( (uint32_t)0x80000000 )
-#define SM_LOGIN_AUTHENTICATION_FALLBACK_OS_IDENTIFICATION ( (uint32_t)0x80000001 )
-#define SM_LOGIN_PRIVILEGED ( (uint32_t)0x80000002 )
-
-#define SM_MEMORY_ACCESS_CLIENT_WRITE_SERVICE_READ ( (uint32_t)0x00000001 )
-#define SM_MEMORY_ACCESS_CLIENT_READ_SERVICE_WRITE ( (uint32_t)0x00000002 )
-
-#define SMX_MEMORY_ACCESS_DIRECT ( (uint32_t)0x80000000 )
-#define SMX_MEMORY_ACCESS_DIRECT_FORCE ( (uint32_t)0x40000000 )
-
-#define SM_INFINITE_TIMEOUT ( (uint32_t)0xFFFFFFFF )
-
-#define SM_NULL_ELEMENT ( (uint32_t)0xFFFFFFFF )
-
-/*------------------------------------------------------------------------------
- Functions and Macros
-------------------------------------------------------------------------------*/
-
-SM_EXPORT SM_ERROR SMDeviceCreateContext(
- const wchar_t* pDeviceName,
- uint32_t nReserved,
- SM_HANDLE* phDevice);
-
-SM_EXPORT SM_ERROR SMDeviceDeleteContext(
- SM_HANDLE hDevice);
-
-SM_EXPORT void SMFree(
- SM_HANDLE hElement,
- void* pBuffer);
-
-SM_EXPORT SM_ERROR SMStubGetTimeLimit(
- SM_HANDLE hElement,
- uint32_t nTimeout,
- SM_TIME_LIMIT* pTimeLimit);
-
-SM_EXPORT SM_ERROR SMStubPrepareOpenOperation(
- SM_HANDLE hDevice,
- uint32_t nLoginType,
- const void* pLoginInfo,
- const SM_UUID* pidService,
- uint32_t nControlMode,
- const SM_TIME_LIMIT* pTimeLimit,
- uint32_t nReserved1,
- uint32_t nReserved2,
- SM_HANDLE* phClientSession,
- SM_HANDLE* phParameterEncoder,
- SM_HANDLE* phOperation);
-
-SM_EXPORT SM_ERROR SMStubPrepareInvokeOperation(
- SM_HANDLE hClientSession,
- uint32_t nCommandIdentifier,
- const SM_TIME_LIMIT* pTimeLimit,
- uint32_t nReserved1,
- uint32_t nReserved2,
- SM_HANDLE* phParameterEncoder,
- SM_HANDLE* phOperation);
-
-SM_EXPORT SM_ERROR SMStubPrepareCloseOperation(
- SM_HANDLE hClientSession,
- uint32_t nReserved1,
- uint32_t nReserved2,
- SM_HANDLE* phParameterEncoder,
- SM_HANDLE* phOperation);
-
-SM_EXPORT SM_ERROR SMStubPerformOperation(
- SM_HANDLE hOperation,
- uint32_t nReserved,
- SM_ERROR* pnServiceErrorCode,
- SM_HANDLE* phAnswerDecoder);
-
-SM_EXPORT SM_ERROR SMStubCancelOperation(
- SM_HANDLE hOperation);
-
-SM_EXPORT SM_ERROR SMStubReleaseOperation(
- SM_HANDLE hOperation);
-
-SM_EXPORT SM_ERROR SMStubAllocateSharedMemory(
- SM_HANDLE hClientSession,
- uint32_t nLength,
- uint32_t nFlags,
- uint32_t nReserved,
- void** ppBlock,
- SM_HANDLE* phBlockHandle);
-
-SM_EXPORT SM_ERROR SMStubRegisterSharedMemory(
- SM_HANDLE hClientSession,
- void* pBuffer,
- uint32_t nBufferLength,
- uint32_t nFlags,
- uint32_t nReserved,
- SM_HANDLE* phBlockHandle);
-
-SM_EXPORT SM_ERROR SMStubReleaseSharedMemory(
- SM_HANDLE hBlockHandle);
-
-SM_EXPORT void SMStubEncoderWriteUint8(
- SM_HANDLE hEncoder,
- uint8_t nValue);
-
-SM_EXPORT void SMStubEncoderWriteUint16(
- SM_HANDLE hEncoder,
- uint16_t nValue);
-
-SM_EXPORT void SMStubEncoderWriteUint32(
- SM_HANDLE hEncoder,
- uint32_t nValue);
-
-SM_EXPORT void SMStubEncoderWriteBoolean(
- SM_HANDLE hEncoder,
- bool nValue);
-
-SM_EXPORT void SMStubEncoderWriteHandle(
- SM_HANDLE hEncoder,
- SM_HANDLE hValue);
-
-SM_EXPORT void SMStubEncoderWriteString(
- SM_HANDLE hEncoder,
- const wchar_t* pValue);
-
-SM_EXPORT void SMStubEncoderWriteUint8Array(
- SM_HANDLE hEncoder,
- uint32_t nArrayLength,
- const uint8_t* pnArray);
-
-SM_EXPORT void SMStubEncoderWriteUint16Array(
- SM_HANDLE hEncoder,
- uint32_t nArrayLength,
- const uint16_t* pnArray);
-
-SM_EXPORT void SMStubEncoderWriteUint32Array(
- SM_HANDLE hEncoder,
- uint32_t nArrayLength,
- const uint32_t* pnArray);
-
-SM_EXPORT void SMStubEncoderWriteHandleArray(
- SM_HANDLE hEncoder,
- uint32_t nArrayLength,
- const SM_HANDLE* pnArray);
-
-SM_EXPORT void SMStubEncoderWriteMemoryReference(
- SM_HANDLE hEncoder,
- SM_HANDLE hBlock,
- uint32_t nOffset,
- uint32_t nLength,
- uint32_t nFlags);
-
-SM_EXPORT void SMStubEncoderOpenSequence(
- SM_HANDLE hEncoder);
-
-SM_EXPORT void SMStubEncoderCloseSequence(
- SM_HANDLE hEncoder);
-
-SM_EXPORT SM_ERROR SMStubDecoderGetError(
- SM_HANDLE hDecoder);
-
-SM_EXPORT bool SMStubDecoderHasData(
- SM_HANDLE hDecoder);
-
-SM_EXPORT uint8_t SMStubDecoderReadUint8(
- SM_HANDLE hDecoder);
-
-SM_EXPORT uint16_t SMStubDecoderReadUint16(
- SM_HANDLE hDecoder);
-
-SM_EXPORT uint32_t SMStubDecoderReadUint32(
- SM_HANDLE hDecoder);
-
-SM_EXPORT bool SMStubDecoderReadBoolean(
- SM_HANDLE hDecoder);
-
-SM_EXPORT SM_HANDLE SMStubDecoderReadHandle(
- SM_HANDLE hDecoder);
-
-SM_EXPORT wchar_t* SMStubDecoderReadString(
- SM_HANDLE hDecoder);
-
-SM_EXPORT uint8_t* SMStubDecoderReadUint8Array(
- SM_HANDLE hDecoder,
- uint32_t* pnArrayLength);
-
-SM_EXPORT uint16_t* SMStubDecoderReadUint16Array(
- SM_HANDLE hDecoder,
- uint32_t* pnArrayLength);
-
-SM_EXPORT uint32_t* SMStubDecoderReadUint32Array(
- SM_HANDLE hDecoder,
- uint32_t* pnArrayLength);
-
-SM_EXPORT SM_HANDLE* SMStubDecoderReadHandleArray(
- SM_HANDLE hDecoder,
- uint32_t* pnArrayLength);
-
-SM_EXPORT uint32_t SMStubDecoderReadArrayLength(
- SM_HANDLE hDecoder);
-
-SM_EXPORT uint32_t SMStubDecoderCopyUint8Array(
- SM_HANDLE hDecoder,
- uint32_t nIndex,
- uint32_t nMaxLength,
- uint8_t* pArray);
-
-SM_EXPORT uint32_t SMStubDecoderCopyUint16Array(
- SM_HANDLE hDecoder,
- uint32_t nIndex,
- uint32_t nMaxLength,
- uint16_t* pArray);
-
-SM_EXPORT uint32_t SMStubDecoderCopyUint32Array(
- SM_HANDLE hDecoder,
- uint32_t nIndex,
- uint32_t nMaxLength,
- uint32_t* pArray);
-
-SM_EXPORT uint32_t SMStubDecoderCopyHandleArray(
- SM_HANDLE hDecoder,
- uint32_t nIndex,
- uint32_t nMaxLength,
- SM_HANDLE* pArray);
-
-SM_EXPORT void SMStubDecoderReadSequence(
- SM_HANDLE hDecoder,
- SM_HANDLE* phSequenceDecoder);
-
-SM_EXPORT void SMStubDecoderSkip(
- SM_HANDLE hDecoder);
-
-SM_EXPORT SM_ERROR SMManagerOpen(
- SM_HANDLE hDevice,
- uint32_t nLoginType,
- const void* pLoginInfo,
- uint32_t nControlMode,
- SM_HANDLE* phServiceManager);
-
-SM_EXPORT SM_ERROR SMManagerClose(
- SM_HANDLE hServiceManager);
-
-SM_EXPORT SM_ERROR SMManagerGetAllServices(
- SM_HANDLE hServiceManager,
- SM_UUID** ppServiceIdentifierList,
- uint32_t* pnListLength);
-
-SM_EXPORT SM_ERROR SMManagerGetServiceProperty(
- SM_HANDLE hServiceManager,
- const SM_UUID* pidService,
- wchar_t* pPropertyName,
- wchar_t** ppPropertyValue);
-
-SM_EXPORT SM_ERROR SMManagerGetAllServiceProperties(
- SM_HANDLE hServiceManager,
- const SM_UUID* pidService,
- SM_PROPERTY** ppProperties,
- uint32_t* pnPropertiesLength);
-
-SM_EXPORT SM_ERROR SMManagerDownloadService(
- SM_HANDLE hServiceManager,
- const uint8_t* pServiceCode,
- uint32_t nServiceCodeSize,
- SM_UUID* pidService);
-
-SM_EXPORT SM_ERROR SMManagerRemoveService(
- SM_HANDLE hServiceManager,
- const SM_UUID* pidService);
-
-SM_EXPORT SM_ERROR SMGetImplementationProperty(
- SM_HANDLE hDevice,
- const wchar_t* pPropertyName,
- wchar_t** ppPropertyValue);
-
-SM_EXPORT SM_ERROR SMGetAllImplementationProperties(
- SM_HANDLE hDevice,
- SM_PROPERTY** ppProperties,
- uint32_t* pnPropertiesLength);
-
-#include "smapi_ex.h"
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __SMAPI_H__ */
diff --git a/security/tf_sdk/include/smapi_ex.h b/security/tf_sdk/include/smapi_ex.h
deleted file mode 100644
index 14444f7..0000000
--- a/security/tf_sdk/include/smapi_ex.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/**
- * Copyright(c) 2011 Trusted Logic. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name Trusted Logic 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
- * OWNER 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 : smapi_ex.h
- * Last-Author : Trusted Logic S.A.
- * Created : April 23, 2007
- */
-
-#ifndef __SMAPI_EX_H__
-#define __SMAPI_EX_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Appends the specified UUID value to the encoded data of the specified
- * encoder instance.
- *
- * Upon error, this function sets the error state of the encoder. No other state
- * is affected.
- *
- * This function does nothing if the error state of the encoder is set upon
- * entry.
- *
- * @param hEncoder The handle of the encoder instance.
- *
- * @param pUUID A pointer to the UUID value to encode.
- */
-SM_EXPORT void SMStubEncoderWriteUUID(
- SM_HANDLE hEncoder,
- const SM_UUID *pUUID);
-
-/**
- * Reads the UUID value at the current offset in the encoded data parsed by the
- * specified decoder instance.
- *
- * Upon return, the current offset of the decoder references the first item
- * following the decoded item.
- *
- * If the decoder error state is set upon entry, the function sets the UUID
- * placeholder to the nil UUID and does nothing more.
- *
- * @param hDecoder The handle of the decoder instance.
- *
- * @param pUUID A pointer to the placeholder to be set to the decoded UUID
- * value. This placeholder is set to the nil UUID upon failure.
- */
-SM_EXPORT void SMStubDecoderReadUUID(
- SM_HANDLE hDecoder,
- SM_UUID *pUUID);
-
-/**
- * Opens a sequence in the current decoder. The current decoder must point to a
- * sequence.
- *
- * After this function is called, the current decoder points to the first element
- * of the sequence.
- *
- * If the error state of the decoder is set upon entry, this function does nothing.
- *
- * Upon error, this function sets the error state of the current decoder.
- * In particular, if the decoder does not point to a sequence, the error state
- * is set to S_ERROR_BAD_FORMAT.
- *
- * @param hDecoder A handle of the decoder instance.
- *
- */
-SM_EXPORT void SMStubDecoderOpenSequence(
- SM_HANDLE hDecoder);
-
-/**
- * Closes a sequence in the current decoder. At least one sequence must have been
- * opened using the function {SMStubDecoderOpenSequence}
- *
- * When this function returns, the current decoder points to the first element
- * following the current sequence.
- *
- * If the error state of the decoder is set upon entry, this function does nothing.
- *
- * Upon error, this function sets the error state of the current decoder.
- * In particular, if the decoder does not point within a sequence, the error state
- * is set to S_ERROR_ILLEGAL_STATE.
- *
- * @param hDecoder A handle of the decoder instance.
- *
- */
-SM_EXPORT void SMStubDecoderCloseSequence(
- SM_HANDLE hDecoder);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __SMAPI_EX_H__ */
diff --git a/security/tf_sdk/include/ssdi.h b/security/tf_sdk/include/ssdi.h
deleted file mode 100644
index 256f62e..0000000
--- a/security/tf_sdk/include/ssdi.h
+++ /dev/null
@@ -1,529 +0,0 @@
-/**
- * Copyright(c) 2011 Trusted Logic. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name Trusted Logic 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
- * OWNER 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 : ssdi.h
-*
-* Original-Author : Trusted Logic S.A.
-*
-* Created : May 31, 2006
-*/
-
-/**
- * SSDI specification 3.0 header file.
- */
-
-#ifndef __SSDI_H__
-#define __SSDI_H__
-
-#include "s_type.h"
-#include "s_error.h"
-
-#ifndef SSDI_EXPORT
-#ifdef SMODULE_IMPLEMENTATION
-#define SSDI_EXPORT S_DLL_EXPORT
-#else
-#define SSDI_EXPORT S_DLL_IMPORT
-#endif
-#endif
-
-#ifndef SRVX_EXPORT
-#define SRVX_EXPORT S_DLL_EXPORT
-#endif
-
-/*------------------------------------------------------------------------------
- SSDI Types
-------------------------------------------------------------------------------*/
-
-typedef struct S_PROPERTY
-{
- char* pName;
- char* pValue ;
-} S_PROPERTY;
-
-typedef struct S_TIME_LIMIT
-{
- uint32_t nTime1;
- uint32_t nTime2;
-} S_TIME_LIMIT;
-
-typedef struct S_CALENDAR
-{
- int32_t nYear;
- int32_t nMonth;
- int32_t nDayOfWeek;
- int32_t nDay;
- int32_t nHour;
- int32_t nMinute;
- int32_t nSecond;
-} S_CALENDAR;
-
-typedef enum
-{
- S_FILE_SEEK_SET = 0,
- S_FILE_SEEK_CUR,
- S_FILE_SEEK_END
-} S_WHENCE;
-
-typedef struct S_FILE_INFO
-{
- char* pName;
- uint32_t nSize;
- uint32_t nNameLength;
-}S_FILE_INFO;
-
-typedef struct
-{
- void* pBuffer;
- uint32_t nSize;
-}
-S_PARAM_MEMREF;
-
-typedef struct
-{
- uint32_t a;
- uint32_t b;
-}
-S_PARAM_VALUE;
-
-typedef union
-{
- S_PARAM_MEMREF memref;
- S_PARAM_VALUE value;
-}
-S_PARAM;
-
-
-/*------------------------------------------------------------------------------
- Constants
-------------------------------------------------------------------------------*/
-#define S_TIMEOUT_INFINITE 0xFFFFFFFF
-
-/* storage private to the service */
-#define S_FILE_STORAGE_PRIVATE 0x00000001
-
-#ifdef SUPPORT_RPMB_PARTITION
-/* storage on rpmb */
-#define S_FILE_STORAGE_RPMB 0x00000002
-#endif
-
-/* Cryptoki slotID constants */
-#define S_CRYPTOKI_KEYSTORE_PRIVATE 0x00000001
-#define S_CRYPTOKI_KEYSTORE_PRIVATE_USER 0x00004004
-
-/* SFile constants */
-#define S_FILE_FLAG_ACCESS_READ 0x0001
-#define S_FILE_FLAG_ACCESS_WRITE 0x0002
-#define S_FILE_FLAG_ACCESS_WRITE_META 0x0004
-
-#define S_FILE_FLAG_SHARE_READ 0x0010
-#define S_FILE_FLAG_SHARE_WRITE 0x0020
-
-#define S_FILE_FLAG_CREATE 0x0200
-#define S_FILE_FLAG_EXCLUSIVE 0x0400
-
-#define S_FILE_NAME_MAX 0x40
-#define S_FILE_MAX_POSITION 0xFFFFFFFF
-
-/* SDate constants */
-#define S_DATE_STATUS_NOT_SET 0xFFFF5000
-#define S_DATE_STATUS_NEEDS_RESET 0xFFFF5001
-#define S_DATE_STATUS_SET 0x00000000
-
-/* Login types */
-#define S_LOGIN_PUBLIC 0x00000000
-#define S_LOGIN_USER 0x00000001
-#define S_LOGIN_GROUP 0x00000002
-#define S_LOGIN_APPLICATION 0x00000004
-#define S_LOGIN_APPLICATION_USER 0x00000005
-#define S_LOGIN_APPLICATION_GROUP 0x00000006
-#define S_LOGIN_AUTHENTICATION 0x80000000
-#define S_LOGIN_PRIVILEGED 0x80000002
-#define S_LOGIN_CLIENT_IS_SERVICE 0xF0000000
-#define S_LOGIN_SYSTEM 0xF0000001
-
-/* Parameter types */
-#define S_PARAM_TYPE_NONE 0x0
-#define S_PARAM_TYPE_VALUE_INPUT 0x1
-#define S_PARAM_TYPE_VALUE_OUTPUT 0x2
-#define S_PARAM_TYPE_VALUE_INOUT 0x3
-#define S_PARAM_TYPE_MEMREF_INPUT 0x5
-#define S_PARAM_TYPE_MEMREF_OUTPUT 0x6
-#define S_PARAM_TYPE_MEMREF_INOUT 0x7
-
-#define S_PARAM_TYPE_INPUT_FLAG 0x1
-#define S_PARAM_TYPE_OUTPUT_FLAG 0x2
-#define S_PARAM_TYPE_MEMREF_FLAG 0x4
-
-#define S_PARAM_TYPES(t0,t1,t2,t3) ((t0) | ((t1) << 4) | ((t2) << 8) | ((t3) << 12))
-#define S_PARAM_TYPE_GET(t, i) (((t) >> (i*4)) & 0xF)
-
-#define S_ORIGIN_API 1
-#define S_ORIGIN_COMMS 2
-#define S_ORIGIN_TEE 3
-#define S_ORIGIN_TRUSTED_APP 4
-
-/*------------------------------------------------------------------------------
- Implementation Functions
-------------------------------------------------------------------------------*/
-
-S_RESULT SSDI_EXPORT SImplementationGetAllProperties(
- S_PROPERTY** ppProperties,
- uint32_t* pnPropertiesCount);
-
-S_RESULT SSDI_EXPORT SImplementationGetProperty(const char* pName,
- char** ppValue);
-
-S_RESULT SSDI_EXPORT SImplementationGetPropertyAsInt(const char* pName,
- uint32_t* pnValue);
-
-S_RESULT SSDI_EXPORT SImplementationGetPropertyAsBool(const char* pName,
- bool* pbValue);
-
-/*------------------------------------------------------------------------------
- Service Functions
-------------------------------------------------------------------------------*/
-
-S_RESULT SSDI_EXPORT SServiceGetAllProperties(
- OUT S_PROPERTY** ppProperties,
- OUT uint32_t* pnPropertiesCount);
-
-S_RESULT SSDI_EXPORT SServiceGetProperty (
- IN const char* pName,
- OUT char** ppValue);
-
-S_RESULT SSDI_EXPORT SServiceGetPropertyAsInt (
- IN const char* pName,
- OUT uint32_t* pnValue);
-
-S_RESULT SSDI_EXPORT SServiceGetPropertyAsBool(
- IN const char* pName,
- OUT bool* pbValue);
-
-/*------------------------------------------------------------------------------
- Instance Functions
-------------------------------------------------------------------------------*/
-
-void SSDI_EXPORT SInstanceSetData(
- void* pInstanceData);
-
-void SSDI_EXPORT *SInstanceGetData(void);
-
-/*------------------------------------------------------------------------------
- Session Functions
-------------------------------------------------------------------------------*/
-
-void SSDI_EXPORT SSessionGetClientID(
- S_UUID* pClientID);
-
-S_RESULT SSDI_EXPORT SSessionGetAllClientProperties(
- OUT uint32_t* pnPropertyCount,
- OUT S_PROPERTY** ppPropertyArray);
-
-S_RESULT SSDI_EXPORT SSessionGetClientProperty(
- IN const char* pName,
- OUT char** ppValue);
-
-S_RESULT SSDI_EXPORT SSessionGetClientPropertyAsInt (
- IN const char* pName,
- OUT uint32_t* pnValue);
-
-S_RESULT SSDI_EXPORT SSessionGetClientPropertyAsBool (
- IN const char* pName,
- OUT bool* pnValue);
-
-/*------------------------------------------------------------------------------
- Memory Management Functions
-------------------------------------------------------------------------------*/
-
-void SSDI_EXPORT *SMemAlloc(uint32_t size);
-
-void SSDI_EXPORT *SMemRealloc(void* ptr, uint32_t newSize);
-
-void SSDI_EXPORT SMemFree(void *ptr);
-
-void SSDI_EXPORT *SMemMove(void *dest, const void *src, uint32_t n);
-
-int32_t SSDI_EXPORT SMemCompare(const void *s1, const void *s2, uint32_t n);
-
-void SSDI_EXPORT *SMemFill(void *s, uint32_t c, uint32_t n);
-
-void SSDI_EXPORT *SMemAllocEx(uint32_t nPoolID, uint32_t nSize);
-
-S_RESULT SMemDup(void *src, uint32_t n, void **dest);
-
-/*------------------------------------------------------------------------------
- Trace & Debug Functions
-------------------------------------------------------------------------------*/
-void SSDI_EXPORT _SLogTrace(
- const char *message,
- ... /* arguments */);
-void SSDI_EXPORT _SLogWarning(
- const char *message,
- ... /* arguments */);
-void SSDI_EXPORT _SLogError(
- const char *message,
- ... /* arguments */);
-
-#ifdef __SSDI_USE_TRACE_EX
-#include "ssdi_trace_ex.h"
-#else
-
-#ifndef SSDI_NO_TRACE
-
-#define SLogTrace _SLogTrace
-#define SLogWarning _SLogWarning
-#define SLogError _SLogError
-
-#else /* defined(SSDI_NO_TRACE) */
-
-/* Note that the following code depends on the compiler's supporting variadic macros */
-#define SLogTrace(...) do ; while(false)
-#define SLogWarning(...) do ; while(false)
-#define SLogError(...) do ; while(false)
-
-#endif /* !defined(SSDI_NO_TRACE) */
-
-#endif /* __SSDI_USE_TRACE_EX */
-
-void SSDI_EXPORT _SAssertionFailed(
- const char* pFileName,
- uint32_t nLine,
- const char* pExpression);
-
-#ifdef SSDI_DEBUG
-#define SAssert(test) \
- do \
- { \
- if (!(test)) \
- { \
- _SAssertionFailed(__FILE__, __LINE__, #test); \
- } \
- } \
- while (0)
-#else /* !defined(SSDI_DEBUG) */
-#define SAssert(test)
-#endif /* defined(SSDI_DEBUG) */
-
-#define S_VAR_NOT_USED(variable) do{(void)(variable);}while(0);
-
-/*------------------------------------------------------------------------------
- Time Utility
-------------------------------------------------------------------------------*/
-void SSDI_EXPORT STimeGetLimit(
- uint32_t nTimeout,
- OUT S_TIME_LIMIT* pTimeLimit );
-
-
-/*------------------------------------------------------------------------------
- Thread Functions
-------------------------------------------------------------------------------*/
-S_RESULT SSDI_EXPORT SThreadCreate(
- OUT S_HANDLE* phThread,
- uint32_t stackSize,
- uint32_t (*pEntryPoint)(void*),
- IN void* pThreadArg);
-
-S_RESULT SSDI_EXPORT SThreadJoin(
- S_HANDLE hThread,
- uint32_t* pnExitCode,
- const S_TIME_LIMIT* pTimeLimit);
-
-void SSDI_EXPORT SThreadYield(void);
-
-S_RESULT SSDI_EXPORT SThreadSleep(const S_TIME_LIMIT* pTimeLimit);
-
-void SSDI_EXPORT SThreadCancel(S_HANDLE hThread, uint32_t nReserved);
-
-bool SSDI_EXPORT SThreadIsCancelled (void* pReserved);
-
-void SSDI_EXPORT SThreadResetCancel(void);
-
-void SSDI_EXPORT SThreadMaskCancellation ( bool bMask );
-
-/*------------------------------------------------------------------------------
- Semaphore Functions
-------------------------------------------------------------------------------*/
-
-S_RESULT SSDI_EXPORT SSemaphoreCreate (
- uint32_t initialCount,
- S_HANDLE* phSemaphore);
-
-S_RESULT SSDI_EXPORT SSemaphoreAcquire(S_HANDLE hSemaphore, const S_TIME_LIMIT* pTimeLimit);
-
-void SSDI_EXPORT SSemaphoreRelease(S_HANDLE hSemaphore);
-
-/*------------------------------------------------------------------------------
- File System Functions
-------------------------------------------------------------------------------*/
-
-S_RESULT SSDI_EXPORT SFileOpen(
- uint32_t nStorageID,
- const char *pFilename,
- uint32_t nFlags,
- uint32_t nReserved,
- S_HANDLE *phFile);
-
-S_RESULT SSDI_EXPORT SFileRead(S_HANDLE hFile,
- uint8_t* pBuffer,
- uint32_t nSize,
- uint32_t* pnCount);
-
-S_RESULT SSDI_EXPORT SFileWrite (S_HANDLE hFile,
- const uint8_t* pBuffer,
- uint32_t nSize);
-
-S_RESULT SSDI_EXPORT SFileTruncate(S_HANDLE hFile,
- uint32_t nSize);
-
-S_RESULT SSDI_EXPORT SFileSeek(S_HANDLE hFile,
- int32_t nOffset,
- S_WHENCE eWhence);
-
-uint32_t SSDI_EXPORT SFileTell(S_HANDLE hFile);
-
-bool SSDI_EXPORT SFileEOF(S_HANDLE hFile);
-
-S_RESULT SSDI_EXPORT SFileCloseAndDelete(S_HANDLE hFile);
-
-S_RESULT SSDI_EXPORT SFileRename(S_HANDLE hFile, const char* pNewFilename);
-
-S_RESULT SSDI_EXPORT SFileGetSize(uint32_t nStorageID,
- const char* pFilename,
- uint32_t* pnFileSize);
-
-S_RESULT SSDI_EXPORT SFileEnumerationStart (
- uint32_t nStorageID,
- const char* pFilenamePattern,
- uint32_t nReserved1,
- uint32_t nReserved2,
- S_HANDLE* phFileEnumeration);
-
-S_RESULT SSDI_EXPORT SFileEnumerationGetNext (
- S_HANDLE hFileEnumeration,
- OUT S_FILE_INFO** ppFileInfo);
-
-/*------------------------------------------------------------------------------
- Date Functions
-------------------------------------------------------------------------------*/
-
-S_RESULT SSDI_EXPORT SDateSet (
- int32_t nSeconds,
- uint32_t nReserved);
-
-S_RESULT SSDI_EXPORT SDateGet(
- OUT int32_t* pnSeconds,
- OUT uint32_t* pnDateStatus,
- uint32_t nReserved );
-
-int32_t SSDI_EXPORT SClockGet(void);
-
-S_RESULT SSDI_EXPORT SDateConvertSecondsToCalendar(
- IN int32_t nSeconds,
- IN const S_CALENDAR* pOrigin,
- OUT S_CALENDAR* pDate );
-
-S_RESULT SSDI_EXPORT SDateConvertCalendarToSeconds(
- IN const S_CALENDAR* pOrigin,
- IN const S_CALENDAR* pDate,
- OUT int32_t* pnSeconds);
-
-/*------------------------------------------------------------------------------
- Handle Functions
-------------------------------------------------------------------------------*/
-void SSDI_EXPORT SHandleClose ( S_HANDLE hHandle);
-
-/*------------------------------------------------------------------------------
- Crypto API
-------------------------------------------------------------------------------*/
-
-#define PKCS11_EXPORT SSDI_EXPORT
-
-#include "pkcs11.h"
-
-/*------------------------------------------------------------------------------
- Cryptoki Update Shortcut
-------------------------------------------------------------------------------*/
-
-#define S_UPDATE_SHORTCUT_FLAG_AGGRESSIVE 0x00000001
-
-CK_RV SSDI_EXPORT CV_ActivateUpdateShortcut2(
- CK_SESSION_HANDLE hCryptokiSession,
- uint32_t nCommandID,
- uint32_t nFlags,
- uint32_t nReserved);
-
-void SSDI_EXPORT CV_DeactivateUpdateShortcut(
- CK_SESSION_HANDLE hCryptokiSession);
-
-
-/*------------------------------------------------------------------------------
- Panic Function
-------------------------------------------------------------------------------*/
-
-void SSDI_EXPORT SPanic(uint32_t nReserved);
-
-/*------------------------------------------------------------------------------
- SXControl functions
-------------------------------------------------------------------------------*/
-S_RESULT SSDI_EXPORT SXControlOpenClientSession (
- const S_UUID* pDestination,
- S_TIME_LIMIT* pDeadline,
- uint32_t nParamTypes,
- S_PARAM pParams[4],
- OUT S_HANDLE* phSessionHandle,
- uint32_t* pnReturnOrigin);
-
-S_RESULT SSDI_EXPORT SXControlInvokeCommand (
- S_HANDLE hSessionHandle,
- S_TIME_LIMIT* pDeadline,
- uint32_t nCommandID,
- uint32_t nParamTypes,
- S_PARAM pParams[4],
- uint32_t* pnReturnOrigin);
-
-/*------------------------------------------------------------------------------
- SRVX Entry Points
-------------------------------------------------------------------------------*/
-
-extern S_RESULT SRVX_EXPORT SRVXCreate(void);
-extern void SRVX_EXPORT SRVXDestroy(void);
-extern S_RESULT SRVX_EXPORT SRVXOpenClientSession(uint32_t nParamTypes,
- IN OUT S_PARAM pParams[4],
- OUT void** ppSessionContext);
-extern S_RESULT SRVX_EXPORT SRVXInvokeCommand(IN OUT void* pSessionContext,
- uint32_t nCommandID,
- uint32_t nParamTypes,
- IN OUT S_PARAM pParams[4]);
-extern void SRVX_EXPORT SRVXCloseClientSession(IN OUT void* pSessionContext);
-
-#include "ssdi_v2_compat.h"
-
-#endif /* __SSDI_H__ */
diff --git a/security/tf_sdk/include/ssdi_smc_ext.h b/security/tf_sdk/include/ssdi_smc_ext.h
deleted file mode 100644
index d0cb1c7..0000000
--- a/security/tf_sdk/include/ssdi_smc_ext.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * Copyright(c) 2011 Trusted Logic. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name Trusted Logic 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
- * OWNER 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 : ssdi_smc_ext.h
-*
-* Original-Author : Trusted Logic S.A.
-*
-* Created : October 27, 2008
-*/
-
-/**
- * SSDI SMC Extensions specification header file.
- */
-
-#ifndef __SSDI_SMC_EXT_H__
-#define __SSDI_SMC_EXT_H__
-
-
-/* Cryptoki slotID constants */
-#define S_CRYPTOKI_KEYSTORE_HW_TOKEN 0x00007FFF
-
-
-#define CKMV_SMC_KEK_DERIVE 0xC0000000
-
-
-typedef struct CKV_SMC_KEK_DERIVE_PARAMS
-{
- CK_ULONG Id;
- CK_BYTE diversify[16];
-} CKV_SMC_KEK_DERIVE_PARAMS;
-
-
-#endif /* __SSDI_SMC_EXT_H__ */
diff --git a/security/tf_sdk/include/ssdi_v2_compat.h b/security/tf_sdk/include/ssdi_v2_compat.h
deleted file mode 100644
index 06a3b0e..0000000
--- a/security/tf_sdk/include/ssdi_v2_compat.h
+++ /dev/null
@@ -1,308 +0,0 @@
-/**
- * Copyright(c) 2011 Trusted Logic. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name Trusted Logic 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
- * OWNER 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 : ssdi_v2_compat.h
-*
-* Original-Author : Trusted Logic S.A.
-*
-* Created : July 08, 2010
-*/
-
-/**
- * This header file contains the definitions for the legacy
- * SSDI-V2 types and functions
- */
-
-#ifndef __SSDI_V2_COMPAT_H__
-#define __SSDI_V2_COMPAT_H__
-
-#include "s_type.h"
-#include "s_error.h"
-#include "ssdi.h"
-
-/* SSPI entry points must not be exported.
- SRVX entry points defined in the ssdi_v2_compat library are exported. */
-#define SSPI_EXPORT
-
-/*------------------------------------------------------------------------------
- Constants
-------------------------------------------------------------------------------*/
-#define S_SHARED_MEMORY_ACCESS_READ 0x01
-#define S_SHARED_MEMORY_ACCESS_WRITE 0x02
-
-#define S_NULL_ELEMENT 0xFFFFFFFF
-
-#define S_SHARED_MEMORY_ACCESS_READ 0x01
-#define S_SHARED_MEMORY_ACCESS_WRITE 0x02
-
-/* SControl constants */
-#define S_CONTROL_MODE_USER 0x00000002
-#define S_CONTROL_MODE_MANAGER 0x00000008
-#define S_CONTROL_MODE_EXCLUSIVE_MANAGER 0x00000010
-
-/* Shared memory access */
-#define S_MEMORY_ACCESS_CLIENT_WRITE_SERVICE_READ 0x00000001
-#define S_MEMORY_ACCESS_CLIENT_READ_SERVICE_WRITE 0x00000002
-
-/* Login types */
-#define S_LOGIN_OS_IDENTIFICATION S_LOGIN_APPLICATION_USER
-
-/*------------------------------------------------------------------------------
- Decoder Functions
-------------------------------------------------------------------------------*/
-
-S_RESULT SDecoderGetError(S_HANDLE hDecoder);
-
-bool SDecoderHasData(S_HANDLE hDecoder);
-
-uint8_t SDecoderReadUint8(S_HANDLE hDecoder);
-
-uint16_t SDecoderReadUint16(S_HANDLE hDecoder);
-
-uint32_t SDecoderReadUint32(S_HANDLE hDecoder);
-
-char *SDecoderReadString(S_HANDLE hDecoder);
-
-bool SDecoderReadBoolean(S_HANDLE hDecoder);
-
-uint8_t *SDecoderReadUint8Array(
- S_HANDLE hDecoder,
- OUT uint32_t* pnArrayLength);
-
-uint16_t *SDecoderReadUint16Array(
- S_HANDLE hDecoder,
- OUT uint32_t* pnArrayLength);
-
-uint32_t *SDecoderReadUint32Array(
- S_HANDLE hDecoder,
- OUT uint32_t* pnArrayLength);
-
-uint32_t SDecoderReadArrayLength(S_HANDLE hDecoder);
-
-uint32_t SDecoderCopyUint8Array(
- IN S_HANDLE hDecoder,
- IN uint32_t nIndex,
- IN uint32_t nMaxLength,
- OUT uint8_t* pArray);
-
-uint32_t SDecoderCopyUint16Array(
- IN S_HANDLE hDecoder,
- IN uint32_t nIndex,
- IN uint32_t nMaxLength,
- OUT uint16_t* pArray);
-
-uint32_t SDecoderCopyUint32Array(
- IN S_HANDLE hDecoder,
- IN uint32_t nIndex,
- IN uint32_t nMaxLength,
- OUT uint32_t* pArray);
-
-void SDecoderOpenSequence(S_HANDLE hDecoder);
-
-void SDecoderCloseSequence(S_HANDLE hDecoder);
-
-void SDecoderSkip(S_HANDLE hDecoder);
-
-uint8_t *SDecoderReadMemoryReference(
- S_HANDLE hDecoder,
- uint32_t nFlags,
- OUT uint32_t* pnSize);
-void SDecoderReadUUID(
- IN S_HANDLE hDecoder,
- OUT S_UUID* pUUID);
-
-/*------------------------------------------------------------------------------
- Encoder Functions
-------------------------------------------------------------------------------*/
-
-void SEncoderWriteUint8(
- IN S_HANDLE hEncoder,
- IN uint8_t value);
-
-void SEncoderWriteUint16(
- IN S_HANDLE hEncoder,
- IN uint16_t value);
-
-void SEncoderWriteUint32(IN S_HANDLE hEncoder,
- IN uint32_t value);
-
-void SEncoderWriteBoolean(IN S_HANDLE hEncoder,
- IN bool value);
-
-void SEncoderWriteString(IN S_HANDLE hEncoder,
- IN const char* value);
-
-void SEncoderWriteUint8Array(IN S_HANDLE hEncoder,
- IN uint32_t nArrayLength,
- IN const uint8_t* pnArray);
-
-void SEncoderWriteUint16Array(IN S_HANDLE hEncoder,
- IN uint32_t nArrayLength,
- IN const uint16_t* pnArray);
-
-void SEncoderWriteUint32Array(IN S_HANDLE hEncoder,
- IN uint32_t nArrayLength,
- IN const uint32_t* pnArray);
-
-void SEncoderWriteBooleanArray(IN S_HANDLE hEncoder,
- IN uint32_t nArrayLength,
- IN const bool* pnArray);
-
-void SEncoderWriteStringArray(IN S_HANDLE hEncoder,
- IN uint32_t nArrayLength,
- IN const char** pnArray);
-
-void SEncoderWriteMemoryReference(
- S_HANDLE hEncoder,
- S_HANDLE hBlock,
- uint32_t nOffset,
- uint32_t nLength,
- uint32_t nFlags);
-
-void SEncoderOpenSequence( S_HANDLE hEncoder );
-
-void SEncoderCloseSequence( S_HANDLE hEncoder );
-
-S_RESULT SEncoderGetError(S_HANDLE hEncoder);
-
-void SEncoderReset( S_HANDLE hEncoder );
-
-void SEncoderWriteUUID(
- IN S_HANDLE hEncoder,
- IN const S_UUID* pUUID);
-
-/*------------------------------------------------------------------------------
- Service Control Functions
-------------------------------------------------------------------------------*/
-
-S_RESULT SControlPrepareOpenOperation(
- IN const S_UUID* pIdService,
- uint32_t nControlMode,
- IN const S_TIME_LIMIT* pTimeLimit,
- uint32_t nEncoderBufferSize,
- uint32_t nDecoderBufferSize,
- OUT S_HANDLE* phClientSession,
- OUT S_HANDLE* phParameterEncoder,
- OUT S_HANDLE* phOperation );
-
-S_RESULT SControlPrepareInvokeOperation(
- S_HANDLE hClientSession,
- uint32_t nCommandIdentifier,
- IN const S_TIME_LIMIT* pTimeLimit,
- uint32_t nEncoderBufferSize,
- uint32_t nDecoderBufferSize,
- OUT S_HANDLE* phParameterEncoder,
- OUT S_HANDLE* phOperation );
-
-S_RESULT SControlPrepareCloseOperation(
- S_HANDLE hClientSession,
- uint32_t nEncoderBufferSize,
- uint32_t nDecoderBufferSize,
- OUT S_HANDLE* phParameterEncoder,
- OUT S_HANDLE* phOperation );
-
-S_RESULT SControlPerformOperation(
- S_HANDLE hOperation,
- uint32_t nReserved,
- OUT S_RESULT* pnServiceErrorCode,
- OUT S_HANDLE* phAnswerDecoder );
-
-S_RESULT SControlCancelOperation( S_HANDLE hOperation );
-
-S_RESULT SControlAllocateSharedMemory(
- S_HANDLE hClientSession,
- uint32_t nLength,
- uint32_t nFlags,
- uint32_t nReserved,
- OUT void** ppBlock,
- OUT S_HANDLE* phBlockHandle);
-
-S_RESULT SControlRegisterSharedMemory(
- S_HANDLE hClientSession,
- IN const void* pBuffer,
- uint32_t nBufferLength,
- uint32_t nFlags,
- uint32_t nReserved,
- OUT S_HANDLE* phBlockHandle );
-
-/*------------------------------------------------------------------------------
- Service Manager Functions
-------------------------------------------------------------------------------*/
-
-S_RESULT SManagerOpen(
- uint32_t nControlMode,
- S_HANDLE* phServiceManager);
-
-S_RESULT SManagerGetAllServices(
- S_HANDLE hServiceManager,
- S_UUID** ppServiceIdentifierList,
- uint32_t* pnListLength);
-
-S_RESULT SManagerGetServiceProperty(
- S_HANDLE hServiceManager,
- const S_UUID* pidService,
- const char* pPropertyName,
- char** ppPropertyValue);
-
-S_RESULT SManagerGetAllServiceProperties(
- S_HANDLE hServiceManager,
- const S_UUID* pidService,
- S_PROPERTY** ppProperties,
- uint32_t* pnPropertiesLength);
-
-S_RESULT SManagerDownloadService(
- S_HANDLE hServiceManager,
- const uint8_t* pServiceCode,
- uint32_t nServiceCodeSize,
- S_UUID* pidService);
-
-S_RESULT SManagerRemoveService(
- S_HANDLE hServiceManager,
- const S_UUID* pidService);
-
-/*------------------------------------------------------------------------------
- SSPI Entry Points
-------------------------------------------------------------------------------*/
-
-S_RESULT SSPICreate(void);
-void SSPIDestroy(void);
-S_RESULT SSPIOpenClientSession(S_HANDLE hDecoder,
- S_HANDLE hEncoder,
- OUT void** ppSessionContext);
-S_RESULT SSPIInvokeCommand(IN OUT void* pSessionContext,
- uint32_t nCommandID,
- S_HANDLE hDecoder,
- S_HANDLE hEncoder);
-S_RESULT SSPICloseClientSession(IN OUT void* pSessionContext,
- uint32_t nCause,
- S_HANDLE hDecoder,
- S_HANDLE hEncoder);
-#endif /* __SSDI_V2_COMPAT_H__ */
diff --git a/security/tf_sdk/include/wvdrm_protocol.h b/security/tf_sdk/include/wvdrm_protocol.h
new file mode 100644
index 0000000..de51fb6
--- /dev/null
+++ b/security/tf_sdk/include/wvdrm_protocol.h
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2011 Trusted Logic S.A.
+ * All Rights Reserved.
+ *
+ * This software is the confidential and proprietary information of
+ * Trusted Logic S.A. ("Confidential Information"). You shall not
+ * disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered
+ * into with Trusted Logic S.A.
+ *
+ * TRUSTED LOGIC S.A. MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE
+ * SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING
+ * BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. TRUSTED LOGIC S.A. SHALL
+ * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING,
+ * MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
+ */
+#ifndef __WVDRM_PROTOCOL_H__
+#define __WVDRM_PROTOCOL_H__
+
+#include <common_secure_driver_protocol.h>
+
+/* 45544DF9-B1DF-9BEE-D0B9-0C98CE3B41F6 */
+#define WVDRM_UUID {0x45544DF9, 0xB1DF, 0x9BEE, {0xD0, 0xB9, 0x0C, 0x98, 0xCE, 0x3B, 0x41, 0xF6}}
+
+/*
+ * Persistently install the DRM "key box" previously wrapped
+ * with WRAP_KEYBOX
+ *
+ * Param #0: MEMREF_INPUT:
+ * The encrypted keybox
+ */
+#define WVDRM_INSTALL_KEYBOX 0x00001000
+
+/*
+ * Test if a keybox is provisioned and optionnally get its key data
+ *
+ * #0:
+ * - NONE: for testing if the keybox is valid (returns S_ERROR_ITEM_NOT_FOUND if not)
+ * - MEMREF_OUTPUT: to actually get the key data
+ */
+#define WVDRM_GET_KEY_DATA 0x00001001
+
+/*
+ * Generate random data
+ *
+ * #0:
+ * - MEMREF_OUTPUT: buffer to fill with random data
+ */
+#define WVDRM_GET_RANDOM 0x00001002
+
+/*
+ * Get the device ID
+ *
+ * #0: MEMREF_OUTPUT: filled with the device ID
+ */
+#define WVDRM_GET_DEVICE_ID 0x00001003
+
+/*
+ * Optionnally decrypt a keybox with a transport key
+ * and wrap it with a device specific key. The result
+ * can be later passed to INSTALL_KEYBOX
+ *
+ * #0: MEMREF_INPUT: the input keybox
+ * - either in cleartext if param #2 is NONE
+ * - or encrypted with the key in param #2
+ * #1: MEMREF_OUTPUT: the resulting wrapped key box
+ * #2:
+ * - NONE: param#0 is the clear-text keybox
+ * - MEMREF_INPUT: a transport key, in which case
+ * param#0 is the encryption with AES-CBC-128 of the
+ * keybox with an IV filled with zeros
+ */
+#define WVDRM_WRAP_KEYBOX 0x00001004
+
+/*
+ * Unwrap an asset key. The asset key is stored in transient memory
+ * but available globally to all sessons. There can be only one asset key
+ * at a time.
+ *
+ * #0: MEMREF_INPUT
+ */
+#define WVDRM_SET_ENTITLEMENT_KEY 0x00002000
+
+/*
+ * Decrypt the ECM (Entitlement Control Message = content key) using the asset key.
+ * Store the flags associated with the ECM. These flags will be later used, e.g.,
+ * to activate HDCP protection. Also returns the flags.
+ *
+ * #0: MEMREF_INPUT
+ * #1: VALUE_OUTPUT: a=flags
+ *
+ */
+#define WVDRM_DERIVE_CONTROL_WORD 0x00002001
+
+/*
+ * Decrypt a chunk of content from a non-secure buffer into
+ * a secure buffer opaquely referred to as an offset within
+ * the Decrypted-Encoded-Buffer part of the carveout.
+ *
+ * #0: MEMREF_INPUT: the encrypted content
+ * #1: VALUE_INPUT:
+ * [in] a=physical address of the ION handle, b=size of the handle
+ * #2: MEMREF_INOUT: the IV
+ * #3: VALUE_INOUT:
+ * [in] a=offset from the physical address of the ION handle, b=max size
+ * [out] b=actual size or required size
+ */
+#define WVDRM_DECRYPT_VIDEO 0x00002002
+
+/*
+ * Decrypt a chunk of content into a non-secure buffer. This
+ * must be used only for audio content.
+ *
+ * #0: MEMREF_INPUT: the encrypted content
+ * #1: MEMREF_OUTPUT: the decrypted content
+ * #2: MEMREF_INOUT: the IV
+ */
+#define WVDRM_DECRYPT_AUDIO 0x00002003
+
+/*
+ * Enter in secure playback.
+ */
+#define WVDRM_ENTER_SECURE_PLAYBACK COMMON_SECURE_DRIVER_ENTER_SECURE_PLAYBACK
+
+/*
+ * Exit in secure playback.
+ */
+#define WVDRM_EXIT_SECURE_PLAYBACK COMMON_SECURE_DRIVER_EXIT_SECURE_PLAYBACK
+
+#endif /* __WVDRM_PROTOCOL_H__ */