[kvm-unit-tests PATCH 30/33] arm: realm: Add Realm attestation tests
Suzuki K Poulose
suzuki.poulose at arm.com
Fri Apr 12 03:34:05 PDT 2024
Add tests for Attestation and measurement related RSI calls.
Signed-off-by: Mate Toth-Pal <mate.toth-pal at arm.com>
Co-developed-by: Suzuki K Poulose <suzuki.poulose at arm.com>
[ Rewrote the test cases, keeping the core testing data/logic
Added more test scenarios to test the ABI
]
Signed-off-by: Suzuki K Poulose <suzuki.poulose at arm.com>
---
arm/realm-attest.c | 25 ++++++++++++-------------
1 file changed, 12 insertions(+), 13 deletions(-)
diff --git a/arm/realm-attest.c b/arm/realm-attest.c
index 082d4964..6e407bae 100644
--- a/arm/realm-attest.c
+++ b/arm/realm-attest.c
@@ -108,7 +108,7 @@ static int attest_token_complete(phys_addr_t base, size_t buf_size,
if ((buf_size - len) < size)
size = buf_size - len;
- ret = rsi_attest_token_continue(ipa, offset, size, &bytes);
+ ret = attest_token_continue(ipa, offset, size, &bytes);
len += bytes;
ipa += bytes;
offset += bytes;
@@ -116,7 +116,6 @@ static int attest_token_complete(phys_addr_t base, size_t buf_size,
if (plen)
*plen = len;
- report_info("Found %ldbytes\n", len);
return ret;
}
@@ -130,14 +129,14 @@ static int get_attest_token(phys_addr_t ipa,
rc = attest_token_init(ch, &max_size);
if (max_size > size)
- report_info("Attestation token size (%ld bytes) is greater than the buffer size\n",
+ report_info("Attestation token size (%ld bytes) is greater than the buffer size",
max_size);
if (rc)
return rc;
rc = attest_token_complete(ipa, size, len);
if (len && *len > max_size)
- report_info("RMM BUG: Token size is greater than the max token size from RSI_ATTEST_TOKEN_INIT\n");
+ report_info("RMM BUG: Token size is greater than the max token size from RSI_ATTEST_TOKEN_INIT");
return rc;
}
@@ -293,7 +292,7 @@ static void test_get_attest_token_abi_misuse(void)
report_prefix_pop(); /* miss token init */
return;
}
- report_info("Received a token of size %ld\n", len);
+ report_info("Received a token of size %ld", len);
/*
* step2. Execute RSI_ATTEST_TOKEN_CONTINUE without an RSI_ATTEST_TOKEN_INIT.
@@ -333,7 +332,7 @@ static void test_get_attest_token_abi_misuse(void)
" (%d) vs expected (%d), len: %ld vs 0",
rc.status, RSI_ERROR_INPUT, len);
} else {
- report(true, "Attestation token continue failed for invalid IPA\n");
+ report(true, "Attestation token continue failed for invalid IPA");
}
report_prefix_pop();
@@ -350,7 +349,7 @@ static void test_get_attest_token_abi_misuse(void)
" (%d) vs expected (%d), len: %ld vs 0",
rc.status, RSI_ERROR_INPUT, len);
} else {
- report(true, "Attestation token continue failed for invalid offset\n");
+ report(true, "Attestation token continue failed for invalid offset");
}
report_prefix_pop();
@@ -367,7 +366,7 @@ static void test_get_attest_token_abi_misuse(void)
" (%d) vs expected (%d)",
rc.status, RSI_ERROR_INPUT);
} else {
- report(true, "Attestation token continue failed for invalid size\n");
+ report(true, "Attestation token continue failed for invalid size");
}
report_prefix_pop();
@@ -383,7 +382,7 @@ static void test_get_attest_token_abi_misuse(void)
" (%d) vs expected (%d), len: %ld vs 0",
rc.status, RSI_ERROR_INPUT, len);
} else {
- report(true, "Attestation token continue failed for overflow size\n");
+ report(true, "Attestation token continue failed for overflow size");
}
report_prefix_pop();
@@ -399,7 +398,7 @@ static void test_get_attest_token_abi_misuse(void)
" (%d) vs expected (%d), len: %ld vs 0",
rc.status, RSI_ERROR_INPUT, len);
} else {
- report(true, "Attestation token continue failed for overflow offset\n");
+ report(true, "Attestation token continue failed for overflow offset");
}
report_prefix_pop();
@@ -415,7 +414,7 @@ static void test_get_attest_token_abi_misuse(void)
" (%d) vs expected (%d), len: %ld vs 0",
rc.status, RSI_ERROR_INPUT, len);
} else {
- report(true, "Attestation token continue failed for unaligned ipa\n");
+ report(true, "Attestation token continue failed for unaligned ipa");
}
report_prefix_pop();
@@ -431,7 +430,7 @@ static void test_get_attest_token_abi_misuse(void)
" (%d) vs expected (%d), len: %ld vs 0",
rc.status, RSI_INCOMPLETE, len);
} else {
- report(true, "Attestation token continue returned 0bytes\n");
+ report(true, "Attestation token continue returned 0bytes");
}
report_prefix_pop(); /* invalid input */
@@ -472,7 +471,7 @@ static void test_get_attest_token_abi_abort_req(void)
}
/* Execute one cycles, but not let it complete */
- report_info("Attest token continue with %lx, 0, 4K\n", addr);
+ report_info("Attest token continue with %lx, 0, 4K", addr);
ret = attest_token_continue(addr, 0, RSI_GRANULE_SIZE, &size);
if (ret != RSI_INCOMPLETE) {
if (ret) {
--
2.34.1
More information about the linux-arm-kernel
mailing list