Add unit tests for Pointer Authentication
Add unit tests to:
Test access to the key registers.
Use the pointer authentication instructions.
Call psci version and check the EL3 pointer authentication keys
aren't leaked.
Make a tsp call and check the secure world keys aren't leaked.
Change-Id: Ic7940757e6f9fc905ccef8c035e0c22b47b35cd7
Signed-off-by: Joel Hutton <Joel.Hutton@Arm.com>
diff --git a/include/common/test_helpers.h b/include/common/test_helpers.h
index 983aed3..2cf6e83 100644
--- a/include/common/test_helpers.h
+++ b/include/common/test_helpers.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -7,6 +7,7 @@
#ifndef __TEST_HELPERS_H__
#define __TEST_HELPERS_H__
+#include <arch_features.h>
#include <plat_topology.h>
#include <psci.h>
#include <spci_svc.h>
@@ -25,6 +26,16 @@
typedef test_result_t (*test_function_arg_t)(void *arg);
+#ifdef AARCH32
+#define SKIP_TEST_IF_AARCH32() \
+ do { \
+ tftf_testcase_printf("Test not supported on aarch32\n"); \
+ return TEST_RESULT_SKIPPED; \
+ } while (0)
+#else
+#define SKIP_TEST_IF_AARCH32()
+#endif
+
#define SKIP_TEST_IF_LESS_THAN_N_CLUSTERS(n) \
do { \
unsigned int clusters_cnt; \
@@ -77,6 +88,15 @@
} \
} while (0)
+#define SKIP_TEST_IF_PAUTH_NOT_SUPPORTED() \
+ do { \
+ if (!is_armv8_3_pauth_present()) { \
+ tftf_testcase_printf( \
+ "Pointer Authentication not supported\n"); \
+ return TEST_RESULT_SKIPPED; \
+ } \
+ } while (0)
+
#define SKIP_TEST_IF_MM_NOT_PRESENT() \
do { \
smc_args version_smc = { MM_VERSION_AARCH32 }; \