Skip to content

Commit

Permalink
sl_header: limit amount of measured data
Browse files Browse the repository at this point in the history
With reordered sections and most of the data structures built at runtime,
size of actual code that has to be measured by TPM can be reduced. As
that size field used to specify offset to bootloader data, a new field
was added to the header for that purpose.

Signed-off-by: Krystian Hebel <[email protected]>
  • Loading branch information
krystian-hebel committed Feb 22, 2024
1 parent e623ad8 commit 4a43680
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
5 changes: 3 additions & 2 deletions head.S
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@

GLOBAL(sl_header)
.word _entry /* SL header SKL offset to code start */
.word bootloader_data /* SL header SKL measured length */
.word skl_info
.word _end_of_measured /* SL header SKL measured length */
.word skl_info /* Offset to SKL info with UUID and version */
.word bootloader_data /* Offset to SLRT filled by the bootloader */
ENDDATA(sl_header)

.text
Expand Down
3 changes: 2 additions & 1 deletion include/boot.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ extern const char _start[];

typedef struct __packed sl_header {
u16 skl_entry_point;
u16 bootloader_data_offset;
u16 skl_measured_size;
u16 skl_info_offset;
u16 bootloader_data_offset;
} sl_header_t;
extern sl_header_t sl_header;

Expand Down
14 changes: 8 additions & 6 deletions link.lds
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ SECTIONS
.data : {
*(SORT_BY_ALIGNMENT(.data*))
}

.skl_info : {
*(.skl_info)
}

_end_of_measured = .;

.bss : {
. = ALIGN(4096);
_bss = .;
Expand All @@ -49,18 +56,13 @@ SECTIONS
_ebss = .;
}

.skl_info : {
*(.skl_info)
}

. = ALIGN(8);

/*
* Bootloader must pass non-constant data (e.g. address of zeropage). Keep
* it in separate section, outside of measured part of SL. This must be
* done in order to keep hashes constant, it also allows us to measure SL
* offline.
*/
. = ALIGN(4);
.bootloader_data : {
*(.bootloader_data)
}
Expand Down

0 comments on commit 4a43680

Please sign in to comment.