Skip to content

Commit 2b44084

Browse files
WIP
Signed-off-by: Krystian Hebel <[email protected]>
1 parent de18990 commit 2b44084

File tree

4 files changed

+72
-8
lines changed

4 files changed

+72
-8
lines changed

head.S

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,18 @@ GLOBAL(sl_header)
4545
.word _entry /* SL header SKL offset to code start */
4646
.word _end_of_measured /* SL header SKL measured length */
4747
.byte 0xda, 0x75, 0xc4, 0x0e, 0xd0, 0xd3, 0x5d, 0x48, 0xb6, 0xae, 0x3c, 0xb2, 0xf, 0xb7, 0xad, 0x3a
48-
.long 0xffffffff
49-
.long 0xaaaa5555
50-
.word 0x1E
48+
.long 0xffffffff /* Reserved */
49+
.long 0xaaaa5555 /* Total Length including signature and pubkey raw data */
50+
.word soc_flag /* Offset to SOCFLAG Structure, see below */
51+
.word skl_info /* Offset to SKL info with UUID and version */
52+
.word bootloader_data /* Offset to SLRT filled by the bootloader */
53+
54+
soc_flag:
55+
/*
56+
* This structure isn't described in the spec, but it is assumed to be a
57+
* number of entries, followed by family and model of supported CPUs, in
58+
* form of EAX of CPUID leaf 1 with stepping set to 0.
59+
*/
5160
.long 0x00000008
5261
.long 0x00860f00
5362
.long 0x00a50f00
@@ -57,8 +66,6 @@ GLOBAL(sl_header)
5766
.long 0x00a10f00
5867
.long 0x00a80f00
5968
.long 0x00aa0f00
60-
.word skl_info /* Offset to SKL info with UUID and version */
61-
.word bootloader_data /* Offset to SLRT filled by the bootloader */
6269
ENDDATA(sl_header)
6370

6471
.text
@@ -313,9 +320,11 @@ gdt:
313320
.Lgdt_end:
314321
ENDDATA(gdt)
315322

323+
/*
316324
.section .skinit_reserved, "a", @progbits
317325
GLOBAL(skinit_reserved)
318326
.fill 0x740, 1, 0x00
327+
*/
319328

320329
#ifdef __x86_64__
321330
/* 64bit Pagetables, identity map of the first 4G of RAM. */

link.lds

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,18 @@ SECTIONS
5151

5252
. = ALIGN(16);
5353

54-
.skinit_reserved : {
55-
*(.skinit_reserved)
54+
.skl_sig_hdr : {
55+
*(.skl_sig_hdr)
56+
}
57+
58+
_end_of_signed = .;
59+
60+
.skl_sig : {
61+
*(.skl_sig)
62+
}
63+
64+
.skl_pubkey : {
65+
*(.skl_pubkey)
5666
}
5767

5868
.bss : {

main.c

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,51 @@ const skl_info_t __used skl_info = {
4040
.version = 0,
4141
};
4242

43+
#if !defined(AMDSL)
44+
typedef struct tdFW_SIG_HEADER
45+
{
46+
u8 Nonce[16]; /* [0x00] Unique image id */
47+
u32 HeaderVersion; /* [0x10] Version of the header */
48+
u32 SizeFWSigned; /* [0x14] Signed Fw Size in bytes */
49+
u32 EncOption; /* [0x18] 0 - Not encrypted, 1 - encrypted */
50+
u32 EncAlgID; /* [0x1C] Encryption algorithm id */
51+
u8 EncParameters[16]; /* [0x20] Encryption Parameters */
52+
u32 SigOption; /* [0x30] 0 - not signed 1 - signed */
53+
u32 SigAlgID; /* [0x34] Signature algorithm ID */
54+
u8 SigParameters[16]; /* [0x38] Signature parameter */
55+
u32 CompOption; /* [0x48] Compression option */
56+
u32 SecPatchLevel; /* [0x4C] Security patch level */
57+
u32 UnCompImageSize; /* [0x50] Uncompressed Image Size */
58+
u32 CompImageSize; /* [0x54] compressed Image Size */
59+
u8 CompParameters[8]; /* [0x58] Compression Parameters */
60+
u32 ImageVersion; /* [0x60] Off Chip Firmware Version */
61+
u32 APUFamilyID; /* [0x64] APU Family ID or SoC ID */
62+
u32 FirmwareLoadAddr; /* [0x68] Firmware Load address (default 0) */
63+
u32 SizeImage; /* [0x6C] FW size with signature */
64+
u32 SizeFWUnSigned; /* [0x70] Size of Un-signed portion of the FW */
65+
u32 FirmwareSplitAddr; /* [0x74] Offset of Nwd OS */
66+
u32 SigFlags; /* [0x78] Flags for FW signing options, perm, etc */
67+
u8 FwType; /* [0x7C] FwType */
68+
u8 SubType; /* [0x7D] SubType identifies FW */
69+
u8 Reserved1[2]; /* [0x7E] *** RESERVED *** */
70+
u8 EncKey[16]; /* [0x80] Encryption Key (Wrapped MEK) */
71+
u8 SigningInfo[16]; /* [0x90] Signing tool specific information */
72+
u8 Padd[96]; /* [0xA0] *** RESERVED *** */
73+
} FW_SIG_HEADER; /* Total 256 bytes */
74+
75+
extern char _end_of_signed[];
76+
77+
FW_SIG_HEADER __section(".skl_sig_hdr") __used hdr = {
78+
.HeaderVersion = 0x31534124, /* "$AS1" */
79+
.SizeFWSigned = _u(_end_of_signed),
80+
.SigOption = 1,
81+
.SigParameters = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
82+
0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}, /* TBD! */
83+
.ImageVersion = 0x02000200,
84+
.SizeImage = _u(_end_of_signed) + 0x200,
85+
};
86+
#endif
87+
4388
#if !defined(AMDSL)
4489
static void extend_pcr(struct tpm *tpm, void *data, u32 size, u32 pcr, char *ev)
4590
{

sanity_check.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
. util.sh
33

4-
SKL_INFO=`hexdump "$SLB_FILE" -s66 -n2 -e '/2 "%u"'`
4+
SKL_INFO=`hexdump "$SLB_FILE" -s30 -n2 -e '/2 "%u"'`
55

66
if ! od --format=x8 --skip-bytes=$SKL_INFO --read-bytes=16 $SLB_FILE | grep -q "e91192048e26f178 02ccc4765bc82a83"; then
77
echo "ERROR: SKL UUID missing or misplaced in $SLB_FILE" >&2

0 commit comments

Comments
 (0)