test(realm): test realm pauth state is preserved

Modify Pauth lib to work for multiple CPU
Test if Realm pauth state is preserved for all RECs
on context switch to RMM/NS.

Change-Id: Ibb393b415bab27066289b560be49e02d0c8f58ba
Signed-off-by: Shruti Gupta <shruti.gupta@arm.com>
diff --git a/tftf/tests/extensions/pauth/test_pauth.c b/tftf/tests/extensions/pauth/test_pauth.c
index b29e5d0..ada2f1d 100644
--- a/tftf/tests/extensions/pauth/test_pauth.c
+++ b/tftf/tests/extensions/pauth/test_pauth.c
@@ -13,6 +13,11 @@
 #include <tsp.h>
 #include <string.h>
 
+#ifdef __aarch64__
+static uint128_t pauth_keys_before[NUM_KEYS];
+static uint128_t pauth_keys_after[NUM_KEYS];
+#endif
+
 /*
  * TF-A is expected to allow access to key registers from lower EL's,
  * reading the keys excercises this, on failure this will trap to
@@ -23,7 +28,7 @@
 	SKIP_TEST_IF_AARCH32();
 #ifdef __aarch64__
 	SKIP_TEST_IF_PAUTH_NOT_SUPPORTED();
-	pauth_test_lib_read_keys();
+	pauth_test_lib_read_keys(pauth_keys_before);
 	return TEST_RESULT_SUCCESS;
 #endif	/* __aarch64__ */
 }
@@ -37,11 +42,11 @@
 	SKIP_TEST_IF_AARCH32();
 #ifdef __aarch64__
 	SKIP_TEST_IF_PAUTH_NOT_SUPPORTED();
-	pauth_test_lib_read_keys();
+	pauth_test_lib_read_keys(pauth_keys_before);
 
 	tftf_get_psci_version();
 
-	return pauth_test_lib_compare_template();
+	return pauth_test_lib_compare_template(pauth_keys_before, pauth_keys_after);
 #endif	/* __aarch64__ */
 }
 
@@ -84,7 +89,7 @@
 	SKIP_TEST_IF_PAUTH_NOT_SUPPORTED();
 	SKIP_TEST_IF_TSP_NOT_PRESENT();
 
-	pauth_test_lib_fill_regs_and_template();
+	pauth_test_lib_fill_regs_and_template(pauth_keys_before);
 
 	/* Standard SMC to ADD two numbers */
 	tsp_svc_params.fid = TSP_STD_FID(TSP_ADD);
@@ -106,6 +111,6 @@
 		return TEST_RESULT_FAIL;
 	}
 
-	return pauth_test_lib_compare_template();
+	return pauth_test_lib_compare_template(pauth_keys_before, pauth_keys_after);
 #endif	/* __aarch64__ */
 }