From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8ECE2C04FF6 for ; Fri, 12 Apr 2024 10:38:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2Bv8Z0qwajpGT2Lms1da4jnpPf4A+Bn+oZJ9w0HkUyU=; b=KPGDD6xz9bIlUF iQvit7+ryDeUNjOjl0cztEH5T5lG/F7v4kTjEHsIn0mW2x565FYXy85qMYS0f+EwrJezKHtp8+OGX t3cLNZAjmDHwPUN/E+NdKSawdGb66lELS5gr3lFtSvsesq9bES3bWUUaJr2A8prJQj2dtFgYv0S7a T0ss5oEFefaSHIcpxqW8vyRcMr0LFlrfCWGIZYZEd1zyLmuntsMfgwdwrckH7eAK0nq1niBG2RB4h zo2/O6t7qVBel668S1+AuYd+B1Oy/atrDNfY0aST5mlKDCVV4RyTYbF6Hj+6zMyPFa3QIm5v7mTzb fvQstycjSxlA9G0A8cUw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rvEIm-0000000GixQ-1l9d; Fri, 12 Apr 2024 10:38:36 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rvEFc-0000000Gh1s-03vp for linux-arm-kernel@lists.infradead.org; Fri, 12 Apr 2024 10:35:28 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B9DD715DB; Fri, 12 Apr 2024 03:35:48 -0700 (PDT) Received: from ewhatever.cambridge.arm.com (ewhatever.cambridge.arm.com [10.1.197.1]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id A97313F64C; Fri, 12 Apr 2024 03:35:17 -0700 (PDT) From: Suzuki K Poulose To: kvmarm@lists.linux.dev Cc: kvm@vger.kernel.org, linux-coco@lists.linux.dev, linux-arm-kernel@lists.infradead.org, maz@kernel.org, alexandru.elisei@arm.com, joey.gouly@arm.com, steven.price@arm.com, james.morse@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com, andrew.jones@linux.dev, eric.auger@redhat.com, Suzuki K Poulose , Mate Toth-Pal Subject: [kvm-unit-tests PATCH 30/33] arm: realm: Add Realm attestation tests Date: Fri, 12 Apr 2024 11:34:05 +0100 Message-Id: <20240412103408.2706058-31-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240412103408.2706058-1-suzuki.poulose@arm.com> References: <20240412103408.2706058-1-suzuki.poulose@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240412_033520_352742_6CC8582A X-CRM114-Status: GOOD ( 10.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add tests for Attestation and measurement related RSI calls. Signed-off-by: Mate Toth-Pal Co-developed-by: Suzuki K Poulose [ Rewrote the test cases, keeping the core testing data/logic Added more test scenarios to test the ABI ] Signed-off-by: Suzuki K Poulose --- 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel