Commit Graph

99579 Commits

Author SHA1 Message Date
Simon Glass
c7c867390c docs: Merge .claude/README.md into CLAUDE.md
Consolidate build and coding documentation into CLAUDE.md and
remove the redundant .claude/README.md file.

Mention the use of the Co-developed-by tag and how to run tests.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-17 16:51:03 -07:00
Simon Glass
adf71f6928 Merge branch 'secg' into 'master'
luks: Integrate support for a TKey

See merge request u-boot/u-boot!211
2025-11-17 17:32:41 +00:00
Simon Glass
5e381f02ee luks: Support disk unlock using a TKey
Add a -t option to the 'luks unlock' command to allow a TKey to be used
to unlock a disk. The password is used as the user-supplied secret (USS)
in this case.

Series-to: concept
Cover-letter:
luks: Integrate support for a TKey
This series illustrates how to use a Tillitis TKey to unlock an
encrypted disk. This has the advantage that the key depends on a
physical key in the user's posession as well as the usual passphrase.

The TKey handles the key derivation, so this series includes logic to
skip that step when a TKey is used.

The 'luks unlock' command provides a -t flag to use a TKey.

It also provides a small pytest fix to ease conflicts with Labgrid
integration.
END

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Series-links: 1:63
2025-11-17 06:59:47 -07:00
Simon Glass
8d033bde28 luks: Check for out-of-memory with Argon2
This algorithm can use a lot of memory, so add a check for this condition
and return the correct error.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-17 06:59:47 -07:00
Simon Glass
48dd57511c luks: Support a pre-derived key
Update luks_unlock() to support a pre-derived key, such as that obtained
from a TKey. This must match the key_size of the LUKS partition,
otherwise it will fail to unlock.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-17 06:59:47 -07:00
Simon Glass
c8b4ede816 luks: Support a pre-derived key with LUKSv2
In some cases we may wish to provide a pre-derived key, e.g. obtained
from a TKey. Provide an option for this with LUKSv2. For now it is not
exported.

Improve the error-return documentation while we are here.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-17 06:59:47 -07:00
Simon Glass
c5dcc1c39f luks: Support a pre-derived key with LUKSv1
In some cases we may wish to provide a pre-derived key, e.g. obtained
from a TKey. Provide an option for this with LUKSv1. For now it is not
exported.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-17 06:59:47 -07:00
Simon Glass
6fc61beecb luks: Split LUKSv1 unlock code into a separate function
Move the LUKSv1-specific unlock logic from luks_unlock() into a new
unlock_luks1() function, lining up with the structure used for LUKSv2.

Also update unlock_luks1() to use a local key_size variable and only
set the output parameter on success.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-17 06:59:47 -07:00
Simon Glass
3caa43da35 luks: Move key derivation to the caller of try_keyslot()
Move the derive_key_pbkdf2() call from inside try_keyslot() to the
caller, luks_unlock()

With this change luks_unlock() deals with key derivation and
try_keyslot() only handles the decryption part, using a supplied
derived key.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-17 06:59:47 -07:00
Simon Glass
dba921b736 luks: Extract PBKDF2 key derivation into separate function
Create a new derive_key_pbkdf2() function to handle key derivation, to
allow this be called from other places and to reduce the size of
try_keyslot()

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-17 06:59:47 -07:00
Simon Glass
c65703bfb9 luks: Update luks_unlock() to take binary passphrase
Update luks_unlock() to accept a binary passphrase, to match the LUKS2
implementation.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-17 06:59:47 -07:00
Simon Glass
19354111d0 luks: Update unlock_luks2() to take binary passphrase
Update unlock_luks2() and related functions to accept a binary
passphrase instead of a string passphrase. This will allow unlocking
using hashed data.

For now this is internal to the luks implementation.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-17 06:59:47 -07:00
Simon Glass
efc838e1d2 luks: Update try_keyslot() to allow a bytestring
In preparation for supporting unlock using binary data, update
try_keyslot() to accept an array of bytes instead of a string.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-17 06:59:47 -07:00
Simon Glass
78c21d6d81 luks: Tidy up debugging of unlock
Name the derived key as such to avoid confusion. Fix a typo in nearby
log_debug() statement.

Update essiv_decrypt() to have a const * for its first argument.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-17 06:59:47 -07:00
Simon Glass
21c8e23ac7 luks: Make essiv_decrypt() a shared function
Both luks.c and luks2.c have similar implementations of essiv_decrypt().
Drop the version in the later to reduce code duplication.

Drop the duplicate function comments while we are here, since exported
functions should have the information in the header file.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-17 06:59:47 -07:00
Simon Glass
6359810bbc test/py: Avoid pulling in Labgrid with tests
When Labgrid is installed as an editable package (pip install -e),
pytest automatically loads it as a plugin. This can interfere with
U-Boot's test suite.

Disable automatic loading of the Labgrid pytest plugin to prevent
conflicts.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-17 06:59:47 -07:00
GitLab CI
36239d348f docs: Add 2025.12-rc3 to release history 2025-11-17 10:39:39 +00:00
GitLab CI
634ace57a6 chore: Bump version for release candidate 2025.12-rc3 c2025.12-rc3 2025-11-17 10:39:37 +00:00
Simon Glass
826b435241 Merge branch 'secf' into 'master'
Continue TKey development This series add

See merge request u-boot/u-boot!210
2025-11-15 21:49:58 +00:00
Simon Glass
a809e8959e boot: Detect encrypted partitions with extlinux
We don't have an explicit indication of whether the root disk is
encrypted or not. For now, try to detect it and set the flag if
found.

Series-to: concept
Cover-letter:
Continue TKey development
This series adds the ability to provide a user-supplied secret to the
TKey and use that to obtain a disk-encryption key.

Expo is enhanced to support password entry and bootflows can now record
whether the root disk is encrypted or not.

Further work will enable the TKey in the UI and actually unlock an
encrypted disk.
END

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-15 09:50:23 -07:00
Simon Glass
0a2b56c8ce boot: Show an indication for encrypted bootflows
We don't support storing the OS on an encrypted partition, but in some
cases the root partition may be encrypted. Add an indication of this
when listing the bootflows.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-15 09:50:22 -07:00
Simon Glass
a85e22cd0b boot: Use constants for a few common strings
The header and the extlinux image on mmc1 appear in several tests. Add
a shared constant for this.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-14 12:00:31 -07:00
Simon Glass
e4bbfb6d58 tkey: Provide a real tkey device with test.dts
It is sometimes useful to use a real TKey even when running with the
test devicetree. Put it first, so it becomes the default. Update tests
to select the emulator explicitly.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-14 12:00:31 -07:00
Simon Glass
9c97e30ef6 tkey: Allow selecting the TKey device by name
Enhance the 'tkey connect' command to allow the device name to be
specified. This will be useful in tests.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-14 12:00:31 -07:00
Simon Glass
cb9b0f0e88 tkey: sandbox: Avoid returning -ENODEV from the driver
With driver model, -ENODEV has a specific meaning, i.e. there is no
device. Return -EIO instead, since the device actually does exist in
driver model, even if it is not currently connected.

Remove a few error messages which we are here.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-14 12:00:31 -07:00
Simon Glass
3b61461616 tkey: Use SHA256 to obtain the disk-encryption key
Rather than Blake2b, use SHA256 to obtain the disk-encryption key based
on the key material provided by the TKey. This matches the upcoming
disk-encryption test.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-14 12:00:31 -07:00
Simon Glass
2f8d7e7815 tkey: Provide some back-door functions for TKey tests
The tests need to reset the emulated TKey and put it into a known state.
Add a few more functions to help with this.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-14 12:00:31 -07:00
Simon Glass
00834d3aa6 tkey: Support loading an app with a user-supplied secret
One useful feature a the TKey is the ability to set up its app with an
key modified by a user-supplied secret. Add support for this.

Take this opportunity to make the API more expo-friendly by allowing
loading of the TKey to take place iteratively. The TKey runs fairly
slowly (about 60Kbaud) and loading an app takes 6 seconds or so.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-14 12:00:31 -07:00
Simon Glass
a60f0e34c8 tkey: Allow modelling the tkey being disconnected
Provide some plat data which tracks whether the emulated tkey is
connected or not, to allow testing of re-inserting a tkey to reset the
passphrase.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-14 12:00:31 -07:00
Simon Glass
8b54227528 expo: Allow entering text into textline in non-popup expos
Currently textlines only support text entry when with popup expos. In
some cases we want to have menu items to support this, e.g. to enter a
passphrase to unlock an encrypted disk.

Add the missing logic.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-14 12:00:31 -07:00
Simon Glass
16dad5cc12 expo: Support disk-passphrase entry in the menu
Provide fields to show that a disk is locked and allow the user to
enter a passphrase to unlock it.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-14 12:00:31 -07:00
Simon Glass
6926f89a20 expo: Support hiding password entry
Some fields may have sensitive information. Allow it to be obscured
during entry, in case someone is watching the display nearby.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-14 12:00:31 -07:00
Simon Glass
be1ea51b83 input: Provide a way for tests to register a mouse click
In tests it is useful to fake a mouse click to check that expo handles
it correctly. Create a function for this.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-14 12:00:31 -07:00
Simon Glass
c22bf794bf emulation: Support the bootcmd more generally
The code for obtaining a bootcmd from the host when running until QEMU
is currently x86-specific. In fact it can be supported on other
architecture.

Move it into a common place and update the documentation.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-14 12:00:30 -07:00
Simon Glass
76aa68ed86 aes: Use const pointers for read-only parameters
Update AES function signatures to use const pointers for parameters that
are not modified. This improves type safety and makes it easier to see
which parameters are read-only.

Fix the Nuvoton npcm_ae driver as well since it implements the API.
Really that should be handled by a driver, but leave that for now.

Functions updated:
- aes_expand_key(): key parameter
- aes_encrypt(): in and expkey parameters
- aes_decrypt(): in and expkey parameters
- aes_apply_cbc_chain_data(): cbc_chain_data and src parameters
- aes_cbc_encrypt_blocks(): key_exp, iv, and src parameters
- aes_cbc_decrypt_blocks(): key_exp, iv, and src parameters
- add_round_key(): key parameter (internal)
- debug_print_vector(): data parameter (internal)

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-14 11:28:34 -07:00
Simon Glass
33f5f5cb3f Merge branch 'fat' into 'master'
fat: Some code improvements

See merge request u-boot/u-boot!209
2025-11-14 03:55:09 +00:00
Simon Glass
20652517c8 fat: Use standard types for fixed-size values
Convert all __u8, __u16, and __u32 types to their u8, u16, u32
equivalents throughout the FAT filesystem code.

Series-to: u-boot
Series-cc: heinrich
Cover-letter:
fat: Some code improvements
This is an attempt to improve the structure of the FAT code, since it
doesn't fully follow the U-Boot conventions:

- fat_write.c includes fat.c which is odd
- use of __u32 and its ilk
- use of typedef
- old-style struct comments

This series resolves these problems, making it easier to take on other
improvements in future.
END

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-13 19:59:03 -07:00
Simon Glass
5026a22549 fat: Convert fat.h to kernel-doc style
Add kernel-doc comments to structs and public functions in fat.h so that
it is easier to understand the code.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-13 19:58:50 -07:00
Simon Glass
aa6f5484e6 fat: Remove typedefs in fat.h
Convert all typedefs in fat.h to normal struct declarations.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-12 18:39:22 -07:00
Simon Glass
ffb7d606ff fat: Update struct fat_itr to kernel-doc style
Convert the struct fat_itr documentation from the older style with
separate @field comments to the standard kernel-doc style where field
descriptions are listed in the header comment block.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-12 18:39:13 -07:00
Simon Glass
cb30dcb8b6 fat: Separate fat.c from fat_write.c
Currently fat_write.c includes fat.c directly, which is unusual and
makes the code harder to maintain. Use the internal header file to hold
shared functions, to avoid this.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-12 18:39:11 -07:00
Simon Glass
b92ee1a12f fat: Create an internal header file
As a first step towards separating fat.c from fat_write.c, create a
header file for the definitions.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-12 18:28:57 -07:00
Simon Glass
d3df5a8ca1 Merge branch 'edc' into 'master'
expo: Ensure that cyclic tasks can run

See merge request u-boot/u-boot!208
2025-11-12 18:13:41 +00:00
Simon Glass
dffd7b41a5 expo: Ensure that cyclic tasks can run
Since expo now runs with no delays it can trigger the watchdog on
sandbox. Add a call to schedule() to avoid this.

Series-to: concept
Signed-off-by: Simon Glass <sjg@chromium.org>

Change-Id: 0b1b9f90177b7b2e682d57f3df20cf3cdb453517
Series-links: 1:60
2025-11-12 10:20:02 -07:00
Simon Glass
95e9d0e699 Merge branch 'laca' into 'master'
ulib: Various improvements (part A)

See merge request u-boot/u-boot!207
2025-11-12 17:19:48 +00:00
Simon Glass
9553cc4e50 x86: efi: Set linker symbols for embedded dtb
The embedded dtb cannot currently be found with ulib, likely due to the
symbols being dropped when building. Add them explicitly into the linker
scripts.

Series-to: concept
Cover-letter:
ulib: Various improvements (part A)
This series collects together a large number of minor improvements to
the U-Boot library (ulib):

- Allow use of ulib with relocating board
- Add support for qemu-x86 (32-bit only so far)
- Supress startup-output with non-EFI builds
- Reserve space for the efi_priv struct before relocation
- A few minor build tweaks
- support custom firmware in build-efi
END

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-12 08:40:05 -07:00
Simon Glass
5ea9e69b82 efi: Add a flag to enable ulib
When running as an EFI app we should set the ulib flag early so as to
avoid printing unwanted output on start. Add a parameter to
efi_startup() to control whether ulib is used.

Drop the starting message in this case.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-12 08:40:05 -07:00
Simon Glass
dc475d0c11 efi: Allow init messages to be optional
Add a 'verbose' argument to efi_init() so that the init messages can be
suppressed if desired.

For now, keep them as they are.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-12 08:40:05 -07:00
Simon Glass
93ce7858e3 efi: Allow memory messages to be optional
Add a 'verbose' argument to setup_memory() so that the memory messages
can be suppressed if desired.

For now, keep them as they are.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-12 08:40:05 -07:00
Simon Glass
7b5f0041aa ulib: Restrict shared library build to sandbox only
Shared libraries are only meaningful for sandbox builds that run on the
host system. For bare-metal targets like x86, only the static library
(libu-boot.a) makes sense.

Make CONFIG_ULIB_SHARED_LIB depend on SANDBOX to avoid link errors about
missing C-runtime files.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-12 08:40:05 -07:00