Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions package/yast2-storage-ng.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Jan 29 09:00:40 UTC 2026 - Ancor Gonzalez Sosa <ancor@suse.com>

- Adjusted the criteria to check whether TPM-based full-disk
encryption is available at Agama (bsc#1257315).
- 5.0.40

-------------------------------------------------------------------
Thu Jan 15 08:26:47 UTC 2026 - Ladislav Slezák <lslezak@suse.com>

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-storage-ng.spec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

Name: yast2-storage-ng
Version: 5.0.39
Version: 5.0.40
Release: 0
Summary: YaST2 - Storage Configuration
License: GPL-2.0-only OR GPL-3.0-only
Expand Down
29 changes: 3 additions & 26 deletions src/lib/y2storage/encryption_method/tpm_fde.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,16 @@ def available?
false
end

# Whether both the target system and the product being installed meet the requisites
# to setup devices using this encryption method.
# Whether the target system meets the requisites to setup devices using this
# encryption method.
#
# The encryption method must be used at least for the root filesystem (eg. is not possible to
# use it for /var but not for /), but that can't hardly be controlled here. A separate
# validation that considers the whole devicegraph is needed.
#
# @return [Boolean]
def possible?
tpm_system? && tpm_product?
Y2Storage::Arch.new.efiboot? && tpm_present?
end

# Creates an encryption device for the given block device
Expand All @@ -109,15 +109,6 @@ def encryption_process
EncryptionProcesses::TpmFdeTools.new(self)
end

# Whether the system is capable of using the encryption method
#
# @see #possible?
#
# @return [Boolean]
def tpm_system?
Y2Storage::Arch.new.efiboot? && tpm_present?
end

# Whether a TPM2 chip is present and working
#
# @see #possible?
Expand All @@ -128,20 +119,6 @@ def tpm_present?

@tpm_present = EncryptionProcesses::FdeTools.new.tpm_present?
end

# Whether the product being installed has the ability to configure the encryption method
#
# @see #possible?
#
# @return [Boolean]
def tpm_product?
# TODO: We should likely do some memoization of the result. But it is not clear when
# such memoization would be invalidated (eg. new packages available due to some change
# in selected product or to new repositories).

# Beware: apart from true and false, AvailableAll can return nil if things go wrong
!!Yast::Package.AvailableAll(YastFeature::ENCRYPTION_TPM_FDE.pkg_list)
end
end
end
end
4 changes: 4 additions & 0 deletions test/support/devices_planner_context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@

Yast::ProductFeatures.Import("partitioning" => control_file_content)

# Needed because of the more than questionable implementation of preferred_bootloader
allow(Y2Storage::BootRequirementsStrategies::Analyzer)
.to receive(:bls_bootloader_proposed?).and_return false

allow(Y2Storage::BootRequirementsChecker).to receive(:new).and_return boot_checker
allow(boot_checker).to receive(:needed_partitions).and_return(
[
Expand Down
54 changes: 6 additions & 48 deletions test/y2storage/encryption_method/tpm_fde_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@
end

allow(Y2Storage::Arch).to receive(:new).and_return(arch)

allow(Yast::Package).to receive(:AvailableAll).and_return pkgs_available
end

let(:arch) { instance_double("Y2Storage::Arch", efiboot?: efi) }
Expand All @@ -89,36 +87,16 @@
context "and there is a working TPM2 chip" do
let(:tpm_present) { true }

context "and the needed packages can be installed in the target system" do
let(:pkgs_available) { true }

it "#possible? returns true and #available? returns false" do
expect(subject.available?).to eq false
expect(subject.possible?).to eq true
end
end

context "and the needed packages can not be installed in the target system" do
let(:pkgs_available) { false }

include_examples "TPM_FDE impossible and not available"
it "#possible? returns true and #available? returns false" do
expect(subject.available?).to eq false
expect(subject.possible?).to eq true
end
end

context "and there is no TPM2 chip" do
let(:tpm_present) { false }

context "and the needed packages can be installed in the target system" do
let(:pkgs_available) { true }

include_examples "TPM_FDE impossible and not available"
end

context "and the needed packages can not be installed in the target system" do
let(:pkgs_available) { false }

include_examples "TPM_FDE impossible and not available"
end
include_examples "TPM_FDE impossible and not available"
end
end

Expand All @@ -128,33 +106,13 @@
context "and there is a working TPM2 chip" do
let(:tpm_present) { true }

context "and the needed packages can be installed in the target system" do
let(:pkgs_available) { true }

include_examples "TPM_FDE impossible and not available"
end

context "and the needed packages can not be installed in the target system" do
let(:pkgs_available) { false }

include_examples "TPM_FDE impossible and not available"
end
include_examples "TPM_FDE impossible and not available"
end

context "and there is no TPM2 chip" do
let(:tpm_present) { false }

context "and the needed packages can be installed in the target system" do
let(:pkgs_available) { true }

include_examples "TPM_FDE impossible and not available"
end

context "and the needed packages can not be installed in the target system" do
let(:pkgs_available) { false }

include_examples "TPM_FDE impossible and not available"
end
include_examples "TPM_FDE impossible and not available"
end
end
end
Expand Down