From b35e2ad8443b31266536153b2f67d359efdbc449 Mon Sep 17 00:00:00 2001 From: Valentin David Date: Thu, 23 Nov 2023 12:23:24 +0100 Subject: [PATCH 1/2] crypt.go: do not forget option InlineCryptoEngine --- crypt.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crypt.go b/crypt.go index ad2dc2a4..4da1ac66 100755 --- a/crypt.go +++ b/crypt.go @@ -609,7 +609,8 @@ func InitializeLUKS2Container(devicePath, label string, key DiskUnlockKey, optio MetadataKiBSize: options.MetadataKiBSize, KeyslotsAreaKiBSize: options.KeyslotsAreaKiBSize, KDFOptions: options.KDFOptions, - InitialKeyslotName: options.InitialKeyslotName} + InitialKeyslotName: options.InitialKeyslotName, + InlineCryptoEngine: options.InlineCryptoEngine} } if options.KDFOptions == nil { From 43ea3f94f37598f902e969dc200d3a7e1e00ff4d Mon Sep 17 00:00:00 2001 From: Valentin David Date: Wed, 29 Nov 2023 13:16:27 +0100 Subject: [PATCH 2/2] crypt_test.go: test that InlineCryptoEngine is passed through --- crypt_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/crypt_test.go b/crypt_test.go index 979430b7..208d4993 100644 --- a/crypt_test.go +++ b/crypt_test.go @@ -3540,6 +3540,11 @@ var _ = Suite(&cryptSuiteUnmockedExpensive{}) func (s *cryptSuiteUnmockedBase) testInitializeLUKS2Container(c *C, options *InitializeLUKS2ContainerOptions) { restore := MockLUKS2Format(func(devicePath, label string, key []byte, opts *luks2.FormatOptions) error { + // We only test that InlineCryptoEngine is passed + // through. But it will likely not work, so we disable + // it. + c.Check(opts.InlineCryptoEngine, Equals, options != nil && options.InlineCryptoEngine) + opts.InlineCryptoEngine = false var expectedTargetDuration time.Duration if options != nil && options.KDFOptions != nil { expectedTargetDuration = options.KDFOptions.TargetDuration @@ -3652,6 +3657,12 @@ func (s *cryptSuiteUnmocked) TestInitializeLUKS2ContainerWithCustomKDFIterations KDFOptions: &KDFOptions{MemoryKiB: 32, ForceIterations: 8}}) } +func (s *cryptSuiteUnmocked) TestInitializeLUKS2ContainerInlineCryptoEngine(c *C) { + s.testInitializeLUKS2Container(c, &InitializeLUKS2ContainerOptions{ + InlineCryptoEngine: true, + }) +} + type testAddLUKS2ContainerUnlockKeyUnmockedData struct { keyslotName string options *KDFOptions