tdx: Update RTMR patch with intel fixes

Applies the upstream patch
https://github.com/intel/tdx/commit/415ba3e9b5bf5830afcf03401478f5cf1fd3732b.

The patch had to be amended to keep tdx_rtmr_cap inline because our c
compiler incorrectly flags it as not being a compile time constant
otherwise.

BUG=b/336560571
TEST=presubmit, validation
RELEASE_NOTE=None

Change-Id: I8a97c76240eec1f67b939a6b87befc034440c1c7
Reviewed-on: https://cos-review.googlesource.com/c/cos/overlays/board-overlays/+/76539
Tested-by: Cusky Presubmit Bot <presubmit@cos-infra-prod.iam.gserviceaccount.com>
Reviewed-by: Oleksandr Tymoshenko <ovt@google.com>
diff --git a/project-lakitu/sys-kernel/lakitu-kernel-6_1/files/tdx/0034-virt-tdx-guest-Add-runtime-measurement-update-RTMR-s.patch b/project-lakitu/sys-kernel/lakitu-kernel-6_1/files/tdx/0034-virt-tdx-guest-Add-runtime-measurement-update-RTMR-s.patch
index fa2c756..d9a25cf 100644
--- a/project-lakitu/sys-kernel/lakitu-kernel-6_1/files/tdx/0034-virt-tdx-guest-Add-runtime-measurement-update-RTMR-s.patch
+++ b/project-lakitu/sys-kernel/lakitu-kernel-6_1/files/tdx/0034-virt-tdx-guest-Add-runtime-measurement-update-RTMR-s.patch
@@ -33,7 +33,7 @@
  1 file changed, 103 insertions(+)
 
 diff --git a/drivers/virt/coco/tdx-guest/tdx-guest.c b/drivers/virt/coco/tdx-guest/tdx-guest.c
-index 1253bf76b570..4cec550fd22d 100644
+index 1253bf76b5703..e01581fe21a60 100644
 --- a/drivers/virt/coco/tdx-guest/tdx-guest.c
 +++ b/drivers/virt/coco/tdx-guest/tdx-guest.c
 @@ -17,6 +17,7 @@
@@ -68,7 +68,7 @@
 +	 * "Measurement Register Usage in TD", only RTMR index 2 or 3 can
 +	 * be used for userspace measurement extension.
 +	 */
-+	if (index != RTMR_INDEX_USER_APPLICATION || index != RTMR_INDEX_SPECIAL) {
++	if (index != RTMR_INDEX_USER_APPLICATION && index != RTMR_INDEX_SPECIAL) {
 +		pr_err("RTMR extend failed, index %d is not allowed for user udpates\n",
 +			index);
 +		return -EINVAL;
@@ -123,7 +123,7 @@
 +		return ret;
 +	}
 +
-+	rtmr = tdreport + TDREPORT_RTMR_OFFSET + (SHA384_DIGEST_SIZE * index);
++	rtmr = tdreport + TDREPORT_RTMR_OFFSET + (digest_size * index);
 +
 +	memcpy(digest, rtmr, digest_size);
 +
diff --git a/project-lakitu/sys-kernel/lakitu-kernel-6_1/lakitu-kernel-6_1-9999.ebuild b/project-lakitu/sys-kernel/lakitu-kernel-6_1/lakitu-kernel-6_1-9999.ebuild
index a9c1139..7c8d937 100644
--- a/project-lakitu/sys-kernel/lakitu-kernel-6_1/lakitu-kernel-6_1-9999.ebuild
+++ b/project-lakitu/sys-kernel/lakitu-kernel-6_1/lakitu-kernel-6_1-9999.ebuild
@@ -72,4 +72,4 @@
 # NOTE: There's nothing magic keeping this number prime but you just need to
 # make _any_ change to this file.  ...so why not keep it prime?
 #
-# The coolest prime number is: 13
+# The coolest prime number is: 23
diff --git a/project-lakitu/sys-kernel/lakitu-kernel-6_6/files/tdx/0034-virt-tdx-guest-Add-runtime-measurement-update-RTMR-s.patch b/project-lakitu/sys-kernel/lakitu-kernel-6_6/files/tdx/0034-virt-tdx-guest-Add-runtime-measurement-update-RTMR-s.patch
index fa2c756..d9a25cf 100644
--- a/project-lakitu/sys-kernel/lakitu-kernel-6_6/files/tdx/0034-virt-tdx-guest-Add-runtime-measurement-update-RTMR-s.patch
+++ b/project-lakitu/sys-kernel/lakitu-kernel-6_6/files/tdx/0034-virt-tdx-guest-Add-runtime-measurement-update-RTMR-s.patch
@@ -33,7 +33,7 @@
  1 file changed, 103 insertions(+)
 
 diff --git a/drivers/virt/coco/tdx-guest/tdx-guest.c b/drivers/virt/coco/tdx-guest/tdx-guest.c
-index 1253bf76b570..4cec550fd22d 100644
+index 1253bf76b5703..e01581fe21a60 100644
 --- a/drivers/virt/coco/tdx-guest/tdx-guest.c
 +++ b/drivers/virt/coco/tdx-guest/tdx-guest.c
 @@ -17,6 +17,7 @@
@@ -68,7 +68,7 @@
 +	 * "Measurement Register Usage in TD", only RTMR index 2 or 3 can
 +	 * be used for userspace measurement extension.
 +	 */
-+	if (index != RTMR_INDEX_USER_APPLICATION || index != RTMR_INDEX_SPECIAL) {
++	if (index != RTMR_INDEX_USER_APPLICATION && index != RTMR_INDEX_SPECIAL) {
 +		pr_err("RTMR extend failed, index %d is not allowed for user udpates\n",
 +			index);
 +		return -EINVAL;
@@ -123,7 +123,7 @@
 +		return ret;
 +	}
 +
-+	rtmr = tdreport + TDREPORT_RTMR_OFFSET + (SHA384_DIGEST_SIZE * index);
++	rtmr = tdreport + TDREPORT_RTMR_OFFSET + (digest_size * index);
 +
 +	memcpy(digest, rtmr, digest_size);
 +
diff --git a/project-lakitu/sys-kernel/lakitu-kernel-6_6/lakitu-kernel-6_6-9999.ebuild b/project-lakitu/sys-kernel/lakitu-kernel-6_6/lakitu-kernel-6_6-9999.ebuild
index add0fab..474b760 100644
--- a/project-lakitu/sys-kernel/lakitu-kernel-6_6/lakitu-kernel-6_6-9999.ebuild
+++ b/project-lakitu/sys-kernel/lakitu-kernel-6_6/lakitu-kernel-6_6-9999.ebuild
@@ -72,4 +72,4 @@
 # NOTE: There's nothing magic keeping this number prime but you just need to
 # make _any_ change to this file.  ...so why not keep it prime?
 #
-# The coolest prime number is: 3
+# The coolest prime number is: 5