[Concept,10/15] test: Switch mmc12 over to use argon2id

Message ID 20251111124131.1198930-11-sjg@u-boot.org
State New
Headers
Series luks: Provide support for LUKSv2 |

Commit Message

Simon Glass Nov. 11, 2025, 12:41 p.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

Use the more common argon2id algorithm for this disk so that we can test
the implementation.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
---

 test/py/img/common.py    | 7 +++++--
 test/py/img/ubuntu.py    | 6 ++++--
 test/py/tests/test_ut.py | 3 ++-
 3 files changed, 11 insertions(+), 5 deletions(-)
  

Patch

diff --git a/test/py/img/common.py b/test/py/img/common.py
index f5a7fcba804..74ea04771c7 100644
--- a/test/py/img/common.py
+++ b/test/py/img/common.py
@@ -33,7 +33,7 @@  def copy_partition(ubman, fsfile, outname):
 
 
 def setup_extlinux_image(config, log, devnum, basename, vmlinux, initrd, dtbdir,
-                         script, part2_size=1, use_fde=0):
+                         script, part2_size=1, use_fde=0, luks_kdf='pbkdf2'):
     """Create a 20MB disk image with a single FAT partition
 
     Args:
@@ -47,6 +47,8 @@  def setup_extlinux_image(config, log, devnum, basename, vmlinux, initrd, dtbdir,
         script (str): Script to place in the extlinux.conf file
         part2_size (int): Size of second partition in MB (default: 1)
         use_fde (int): LUKS version for full-disk encryption (0=none, 1=LUKS1, 2=LUKS2)
+        luks_kdf (str): Key derivation function for LUKS2: 'pbkdf2' or 'argon2id'.
+            Defaults to 'pbkdf2'. Ignored for LUKS1.
     """
     fsh = FsHelper(config, 'vfat', 18, prefix=basename)
     fsh.setup()
@@ -83,7 +85,8 @@  def setup_extlinux_image(config, log, devnum, basename, vmlinux, initrd, dtbdir,
     ext4 = FsHelper(config, 'ext4', max(1, part2_size - 30), prefix=basename,
                     part_mb=part2_size,
                     passphrase='test' if use_fde else None,
-                    luks_version=use_fde if use_fde else 2)
+                    luks_version=use_fde if use_fde else 2,
+                    luks_kdf=luks_kdf)
     ext4.setup()
 
     bindir = os.path.join(ext4.srcdir, 'bin')
diff --git a/test/py/img/ubuntu.py b/test/py/img/ubuntu.py
index b783f7eb3cf..243fa38d021 100644
--- a/test/py/img/ubuntu.py
+++ b/test/py/img/ubuntu.py
@@ -7,7 +7,7 @@  from img.common import setup_extlinux_image
 
 
 def setup_ubuntu_image(config, log, devnum, basename, version='24.04.1 LTS',
-                       use_fde=0):
+                       use_fde=0, luks_kdf='pbkdf2'):
     """Create a Ubuntu disk image with a FAT partition and ext4 partition
 
     This creates a FAT partition containing extlinux files, kernel, etc. and a
@@ -19,6 +19,8 @@  def setup_ubuntu_image(config, log, devnum, basename, version='24.04.1 LTS',
         devnum (int): Device number to use, e.g. 1
         basename (str): Base name to use in the filename, e.g. 'mmc'
         use_fde (int): LUKS version for full-disk encryption (0=none, 1=LUKS1, 2=LUKS2)
+        luks_kdf (str): Key derivation function for LUKS2: 'pbkdf2' or 'argon2id'.
+            Defaults to 'pbkdf2'. Ignored for LUKS1.
     """
     vmlinux = 'vmlinuz-6.8.0-53-generic'
     initrd = 'initrd.img-6.8.0-53-generic'
@@ -50,4 +52,4 @@  label l0r
 ''' % ((version, vmlinux, initrd) * 2)
     setup_extlinux_image(config, log, devnum, basename, vmlinux, initrd, dtbdir,
                          script, part2_size=60 if use_fde else 1,
-                         use_fde=use_fde)
+                         use_fde=use_fde, luks_kdf=luks_kdf)
diff --git a/test/py/tests/test_ut.py b/test/py/tests/test_ut.py
index 94d98b3b73b..e2b4d49a2e0 100644
--- a/test/py/tests/test_ut.py
+++ b/test/py/tests/test_ut.py
@@ -84,7 +84,8 @@  def test_ut_dm_init_bootstd(u_boot_config, u_boot_log):
     setup_localboot_image(u_boot_config, u_boot_log)
     setup_vbe_image(u_boot_config, u_boot_log)
     setup_ubuntu_image(u_boot_config, u_boot_log, 11, 'mmc', use_fde=1)
-    setup_ubuntu_image(u_boot_config, u_boot_log, 12, 'mmc', use_fde=2)
+    setup_ubuntu_image(u_boot_config, u_boot_log, 12, 'mmc', use_fde=2,
+                       luks_kdf='argon2id')
 
 def test_ut(ubman, ut_subtest):
     """Execute a "ut" subtest.