Add demo app for attestation service
Adds the platform_inspect deployment that builds a user-space app
that retrieves an attestation token, verifies it and pretty
prints the result. The platform_inspect app may be extended
to inspect other aspects of the device firmware e.g. a list
of TS service providers.
Signed-off-by: Julian Hall <julian.hall@arm.com>
Change-Id: I98efd0313f15fdfd50d92716341165afdb1f0ff5
diff --git a/deployments/platform-inspect/arm-linux/CMakeLists.txt b/deployments/platform-inspect/arm-linux/CMakeLists.txt
new file mode 100644
index 0000000..f4d02c0
--- /dev/null
+++ b/deployments/platform-inspect/arm-linux/CMakeLists.txt
@@ -0,0 +1,45 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+cmake_minimum_required(VERSION 3.16)
+include(../../deployment.cmake REQUIRED)
+
+#-------------------------------------------------------------------------------
+# Required for use of stdout/stderr file pointers from the application.
+#
+#-------------------------------------------------------------------------------
+set(CMAKE_POSITION_INDEPENDENT_CODE True)
+
+#-------------------------------------------------------------------------------
+# The CMakeLists.txt for building the platform-inspect deployment for arm-linux
+#
+#-------------------------------------------------------------------------------
+include(${TS_ROOT}/environments/arm-linux/env.cmake)
+project(trusted-services LANGUAGES CXX C)
+add_executable(platform-inspect)
+target_include_directories(platform-inspect PRIVATE "${TOP_LEVEL_INCLUDE_DIRS}")
+
+#-------------------------------------------------------------------------------
+# Extend with components that are common across all deployments of
+# platform-inspect
+#
+#-------------------------------------------------------------------------------
+include(../platform-inspect.cmake REQUIRED)
+
+#-------------------------------------------------------------------------------
+# Define library options and dependencies.
+#
+#-------------------------------------------------------------------------------
+env_set_link_options(TGT platform-inspect)
+target_link_libraries(platform-inspect PRIVATE stdc++ gcc m)
+
+#-------------------------------------------------------------------------------
+# Linker option to enable repeated searches for undefined references.
+# Required to resolve dependencies between t_cose and qcbor libraries.
+#-------------------------------------------------------------------------------
+target_link_options(platform-inspect PRIVATE
+ -Wl,--start-group
+ )
diff --git a/deployments/platform-inspect/linux-pc/CMakeLists.txt b/deployments/platform-inspect/linux-pc/CMakeLists.txt
new file mode 100644
index 0000000..52a5834
--- /dev/null
+++ b/deployments/platform-inspect/linux-pc/CMakeLists.txt
@@ -0,0 +1,24 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+cmake_minimum_required(VERSION 3.16)
+include(../../deployment.cmake REQUIRED)
+
+#-------------------------------------------------------------------------------
+# The CMakeLists.txt for building the platform-inspect deployment for linux-pc
+#
+#-------------------------------------------------------------------------------
+include(${TS_ROOT}/environments/linux-pc/env.cmake)
+project(trusted-services LANGUAGES CXX C)
+add_executable(platform-inspect)
+target_include_directories(platform-inspect PRIVATE "${TOP_LEVEL_INCLUDE_DIRS}")
+
+#-------------------------------------------------------------------------------
+# Extend with components that are common across all deployments of
+# platform-inspect
+#
+#-------------------------------------------------------------------------------
+include(../platform-inspect.cmake REQUIRED)
diff --git a/deployments/platform-inspect/platform-inspect.cmake b/deployments/platform-inspect/platform-inspect.cmake
new file mode 100644
index 0000000..a8952f4
--- /dev/null
+++ b/deployments/platform-inspect/platform-inspect.cmake
@@ -0,0 +1,69 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+#-------------------------------------------------------------------------------
+# The base build file shared between deployments of 'platform-inspect' for
+# different environments.
+#-------------------------------------------------------------------------------
+
+#-------------------------------------------------------------------------------
+# Use libts for locating and accessing trusted services. An appropriate version
+# of libts will be imported for the enviroment in which platform-inspect is
+# built.
+#-------------------------------------------------------------------------------
+include(${TS_ROOT}/deployments/libts/libts-import.cmake)
+target_link_libraries(platform-inspect PRIVATE libts)
+
+#-------------------------------------------------------------------------------
+# Components that are common accross all deployments
+#
+#-------------------------------------------------------------------------------
+add_components(
+ TARGET "platform-inspect"
+ BASE_DIR ${TS_ROOT}
+ COMPONENTS
+ "components/app/platform-inspect"
+ "components/common/tlv"
+ "components/common/cbor_dump"
+ "components/service/common/include"
+ "components/service/attestation/include"
+ "components/service/attestation/client/psa"
+ "components/service/attestation/client/provision"
+ "components/service/attestation/reporter/dump/raw"
+ "components/service/attestation/reporter/dump/pretty"
+)
+
+#-------------------------------------------------------------------------------
+# Components used from external projects
+#
+#-------------------------------------------------------------------------------
+
+# Configuration for mbedcrypto
+set(MBEDTLS_USER_CONFIG_FILE
+ "${TS_ROOT}/components/service/crypto/client/cpp/config_mbedtls_user.h"
+ CACHE STRING "Configuration file for mbedcrypto")
+
+# Mbed TLS provides libmbedcrypto
+include(../../../external/MbedTLS/MbedTLS.cmake)
+target_link_libraries(platform-inspect PRIVATE mbedcrypto)
+
+# Qcbor
+include(${TS_ROOT}/external/qcbor/qcbor.cmake)
+target_link_libraries(platform-inspect PRIVATE qcbor)
+
+# t_cose
+include(${TS_ROOT}/external/t_cose/t_cose.cmake)
+target_link_libraries(platform-inspect PRIVATE t_cose)
+
+#-------------------------------------------------------------------------------
+# Define install content.
+#
+#-------------------------------------------------------------------------------
+if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+ set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "location to install build output to." FORCE)
+endif()
+install(TARGETS platform-inspect RUNTIME DESTINATION ${TS_ENV}/bin)