mirror of
https://github.com/ultravioletrs/cocos.git
synced 2026-06-23 04:10:25 +00:00
NOISSUE - Fix TDXEnabled function to check for 'Y' instead of '1' in kernel parameter (#467)
* Fix TDXEnabled function to check for 'Y' instead of '1' in kernel parameter Signed-off-by: Sammy Oina <sammyoina@gmail.com> * Fix TDXEnabled test to check for 'Y' instead of '1' in CPU flags Signed-off-by: Sammy Oina <sammyoina@gmail.com> --------- Signed-off-by: Sammy Oina <sammyoina@gmail.com>
This commit is contained in:
committed by
GitHub
parent
31c7833c3d
commit
f52702b631
+1
-1
@@ -209,7 +209,7 @@ func SEVSNPEnabled(cpuinfo, kernelParam string) bool {
|
||||
}
|
||||
|
||||
func TDXEnabled(cpuinfo, kernelParam string) bool {
|
||||
return strings.Contains(cpuinfo, "tdx_host_platform") && strings.TrimSpace(kernelParam) == "1"
|
||||
return strings.Contains(cpuinfo, "tdx_host_platform") && strings.TrimSpace(kernelParam) == "Y"
|
||||
}
|
||||
|
||||
// Checks if SEV is supported and usable by verifying both CPU flags and the /dev/sev device.
|
||||
|
||||
@@ -192,7 +192,7 @@ func TestSEVSNPEnabled(t *testing.T) {
|
||||
|
||||
func TestTDXEnabled(t *testing.T) {
|
||||
t.Run("cpuinfo and kvm param correct", func(t *testing.T) {
|
||||
assert.True(t, TDXEnabled("flags: tdx_host_platform abc", "1"))
|
||||
assert.True(t, TDXEnabled("flags: tdx_host_platform abc", "Y"))
|
||||
})
|
||||
|
||||
t.Run("missing tdx_host_platform in cpuinfo", func(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user