| 1 |
package test |
| 2 |
|
| 3 |
import _ "embed" // Necessary to use go:embed |
| 4 |
|
| 5 |
// Raw binary TCG Event Logs |
| 6 |
var ( |
| 7 |
//go:embed eventlogs/arch-linux-workstation.bin |
| 8 |
ArchLinuxWorkstationEventLog []byte |
| 9 |
//go:embed eventlogs/debian-10.bin |
| 10 |
Debian10EventLog []byte |
| 11 |
//go:embed eventlogs/glinux-alex.bin |
| 12 |
GlinuxAlexEventLog []byte |
| 13 |
//go:embed eventlogs/rhel8-uefi.bin |
| 14 |
Rhel8EventLog []byte |
| 15 |
//go:embed eventlogs/ubuntu-1804-amd-sev.bin |
| 16 |
Ubuntu1804AmdSevEventLog []byte |
| 17 |
//go:embed eventlogs/ubuntu-2104-no-dbx.bin |
| 18 |
Ubuntu2104NoDbxEventLog []byte |
| 19 |
//go:embed eventlogs/ubuntu-2104-no-secure-boot.bin |
| 20 |
Ubuntu2104NoSecureBootEventLog []byte |
| 21 |
//go:embed eventlogs/ubuntu-2404-amd-sevsnp.bin |
| 22 |
Ubuntu2404AmdSevSnpEventLog []byte |
| 23 |
//go:embed eventlogs/cos-85-amd-sev.bin |
| 24 |
Cos85AmdSevEventLog []byte |
| 25 |
//go:embed eventlogs/cos-93-amd-sev.bin |
| 26 |
Cos93AmdSevEventLog []byte |
| 27 |
//go:embed eventlogs/cos-101-amd-sev.bin |
| 28 |
Cos101AmdSevEventLog []byte |
| 29 |
//go:embed eventlogs/gdc-host.bin |
| 30 |
GdcHost []byte |
| 31 |
//go:embed eventlogs/eventlogwithsp800155.bin |
| 32 |
SP800155EventLog []byte |
| 33 |
//go:embed eventlogs/confidential-gke-debug-251000_eventlog.bin |
| 34 |
CGKE251000 []byte |
| 35 |
) |
| 36 |
|
| 37 |
// Kernel command lines from event logs. |
| 38 |
var ( |
| 39 |
Ubuntu2404AmdSevSnpCmdline = "/vmlinuz-6.8.0-1010-gcp root=PARTUUID=8270f3c9-b4e4-4345-80ee-5a62db7ebf3f ro console=ttyS0,115200 panic=-1\x00" |
| 40 |
Cos85AmdSevCmdline = "/syslinux/vmlinuz.A init=/usr/lib/systemd/systemd boot=local rootwait ro noresume noswap loglevel=7 noinitrd console=ttyS0 security=apparmor virtio_net.napi_tx=1 systemd.unified_cgroup_hierarchy=false systemd.legacy_systemd_cgroup_controller=false csm.disabled=1 loadpin.exclude=kernel-module modules-load=loadpin_trigger module.sig_enforce=1 dm_verity.error_behavior=3 dm_verity.max_bios=-1 dm_verity.dev_wait=1 i915.modeset=1 cros_efi root=/dev/dm-0 \"dm=1 vroot none ro 1,0 4077568 verity payload=PARTUUID=EF8ECEE2-2385-AE4F-A146-1ED93D8AC217 hashtree=PARTUUID=EF8ECEE2-2385-AE4F-A146-1ED93D8AC217 hashstart=4077568 alg=sha256 root_hexdigest=795872ee03859c10dfcc4d67b4b96c85094b340c2d8784783abc2fa12a6ed671 salt=40eb77fb9093cbff56a6f9c2214c4f7554817d079513b7c77de4953d6b8ffc16\"\x00" |
| 41 |
Cos93AmdSevCmdline = "/syslinux/vmlinuz.A init=/usr/lib/systemd/systemd boot=local rootwait ro noresume loglevel=7 noinitrd console=ttyS0 security=apparmor virtio_net.napi_tx=1 systemd.unified_cgroup_hierarchy=false systemd.legacy_systemd_cgroup_controller=false csm.disabled=1 loadpin.exclude=kernel-module modules-load=loadpin_trigger module.sig_enforce=1 console=tty1 dm_verity.error_behavior=3 dm_verity.max_bios=-1 dm_verity.dev_wait=1 i915.modeset=1 cros_efi root=/dev/dm-0 \"dm=1 vroot none ro 1,0 4077568 verity payload=PARTUUID=05CDEDEA-42C6-2248-B6B3-AB4CE3EA7501 hashtree=PARTUUID=05CDEDEA-42C6-2248-B6B3-AB4CE3EA7501 hashstart=4077568 alg=sha256 root_hexdigest=8db95edb446a7311634fc8409e6eab39c66886c4db16aeeef166bbd8fe4ff357 salt=3ec6b6fef69119253b9a5f79a5bb06bc7b12f177063b2466a04f08976375af44\"\x00" |
| 42 |
Cos101AmdSevCmdline = "/syslinux/vmlinuz.A init=/usr/lib/systemd/systemd boot=local rootwait ro noresume loglevel=7 console=tty1 console=ttyS0 security=apparmor virtio_net.napi_tx=1 nmi_watchdog=0 csm.disabled=1 loadpin.exclude=kernel-module modules-load=loadpin_trigger module.sig_enforce=1 dm_verity.error_behavior=3 dm_verity.max_bios=-1 dm_verity.dev_wait=1 i915.modeset=1 cros_efi root=/dev/dm-0 \"dm=1 vroot none ro 1,0 4077568 verity payload=PARTUUID=1D70214B-9AB3-E542-8372-3CCD786534FA hashtree=PARTUUID=1D70214B-9AB3-E542-8372-3CCD786534FA hashstart=4077568 alg=sha256 root_hexdigest=48d436350a7e83bde985cd3f7e79fa443557743b42243803ce31104ca4719c5d salt=b323b014b6f463172fca758a1c5a6745a2c8e5872be0e175e2f4b40c8295b2ab\"\x00" |
| 43 |
) |
| 44 |
|
| 45 |
// Attestation .pb files. |
| 46 |
var ( |
| 47 |
//go:embed attestations/gce-cos-85-no-nonce.pb |
| 48 |
COS85NoNonce []byte |
| 49 |
//go:embed attestations/gce-cos-85-nonce9009.pb |
| 50 |
COS85Nonce9009 []byte |
| 51 |
) |
| 52 |
|
| 53 |
// EK and AK Certificates. |
| 54 |
var ( |
| 55 |
//go:embed certificates/pca_tpm_ecc_enc_cert.pem |
| 56 |
GCEEncryptECCCertPCA []byte |
| 57 |
//go:embed certificates/pca_tpm_ecc_sign_cert.pem |
| 58 |
GCESignECCCertPCA []byte |
| 59 |
//go:embed certificates/pca_tpm_rsa_enc_cert.pem |
| 60 |
GCEEncryptRSACertPCA []byte |
| 61 |
//go:embed certificates/pca_tpm_rsa_sign_cert.pem |
| 62 |
GCESignRSACertPCA []byte |
| 63 |
|
| 64 |
//go:embed certificates/uca_tpm_ecc_enc_cert.pem |
| 65 |
GCEEncryptECCCertUCA []byte |
| 66 |
//go:embed certificates/uca_tpm_ecc_sign_cert.pem |
| 67 |
GCESignECCCertUCA []byte |
| 68 |
//go:embed certificates/uca_tpm_rsa_enc_cert.pem |
| 69 |
GCEEncryptRSACertUCA []byte |
| 70 |
//go:embed certificates/uca_tpm_rsa_sign_cert.pem |
| 71 |
GCESignRSACertUCA []byte |
| 72 |
) |
| 73 |
|
| 74 |
// GCECertPEMs provides a variety of GCE test certificates, including AK/EK, |
| 75 |
// RSA/ECC, and PCA/UCA. |
| 76 |
var GCECertPEMs = [][]byte{ |
| 77 |
GCEEncryptECCCertPCA, GCESignECCCertPCA, |
| 78 |
GCEEncryptRSACertPCA, GCESignRSACertPCA, |
| 79 |
GCEEncryptECCCertUCA, GCESignECCCertUCA, |
| 80 |
GCEEncryptRSACertUCA, GCESignRSACertUCA, |
| 81 |
} |
| 82 |
|
| 83 |
// TDX test files |
| 84 |
var ( |
| 85 |
//go:embed tdx_test_files/tdxReportData.bin |
| 86 |
TdxReportData []byte // Use as tdx nonce |
| 87 |
) |