On 6/16/26 10:40, Ilias Apalodimas wrote:
On Tue, 16 Jun 2026 at 11:12, Ludwig Nussel <[email protected]> wrote:
On 6/11/26 11:57, Ilias Apalodimas wrote:
On Wed, 10 Jun 2026 at 13:52, Ludwig Nussel <[email protected]> wrote:
[...]
/**
diff --git a/include/tpm_tcg2.h b/include/tpm_tcg2.h
index eb6afe49e77..db3f6f486e9 100644
--- a/include/tpm_tcg2.h
+++ b/include/tpm_tcg2.h
@@ -162,12 +162,14 @@ struct tcg_efi_spec_id_event {
* @log_position: Current entry position
* @log_size: Log space available
* @found: Boolean indicating if an existing log was discovered
+ * @allocated: Boolean indicating that the log was allocated by u-boot
*/
struct tcg2_event_log {
u8 *log;
u32 log_position;
u32 log_size;
bool found;
+ bool allocated;
};
I think it makes more sense to define an eventlog state with a u32 and
replace the found boolean with it. e.g
#define ELOG_FOUND BIT(0)
#define ELOG_ALLOCATED BIT(1) etc
Is there a specific reason why explicit low level bit operations would
be preferred? Since the structure is only used as internal data
structure of u-boot, what about declaring bits like this:
+ bool found:1;
+ bool allocated:1;
Looks like that style is also used within U-Boot.
With the patches I pointed you at there are a bunch of booleans before
this as well, so I doubt declaring bitflelds will make the struct
smaller in the end. Padding/alignment will probably give you the same
size.
OTOH the patches introduce more states that are conceptually relevant
to the eventlog.
The updated struct looks like
struct tcg2_event_log {
void *log;
u32 log_size;
u32 log_position;
void *final_buffer;
u32 final_position;
u32 last_event_size;
bool get_event_called;
bool ebs_called;
bool truncated;
bool found;
bool allocated;
};
The TCG2 code behaves different if GetEvent or ExitBootServices has
been called as far as the EventLog is concerned. So I think it would
make more sense to encode the last four booleans to a 'log_state' (or
something along those lines) variable.
To clarify, you are asking me to change the code like this, right?
- !elog.found
+ !(elog.log_state & ELOG_FOUND)
- elog.found = true
+ elog.log_state |= ELOG_FOUND
- elog->found = false
+ elog->log_state &= ~ELOG_FOUND
If that's what's preventing the patches from getting in I will do it of
course.
cu
Ludwig
--
Ludwig Nussel
Siemens AG
www.siemens.com