STRUCT SGX_SECS(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ struct sgx_secs(9) ✨

okay so bestie, this is from the Kernel API Manual and it's literally about the SGX Enclave Control Structure and ngl it's kind of iconic πŸ’… like it's the main character of enclave creation, periodt.


πŸ¦‹ NAME πŸ¦‹

struct sgx_secs β€” the SGX Enclave Control Structure (SECS), and yes it's giving very much "special enclave page" energy πŸ‘‘


πŸ“œ SYNOPSIS πŸ“œ

struct sgx_secs {
    u64 size;
    u64 base;
    u32 ssa_frame_size;
    u32 miscselect;
    u8 reserved1[24];
    u64 attributes;
    u64 xfrm;
    u32 mrenclave[8];
    u8 reserved2[32];
    u32 mrsigner[8];
    u8 reserved3[32];
    u32 config_id[16];
    u16 isv_prod_id;
    u16 isv_svn;
    u16 config_svn;
    u8 reserved4[3834];
 };

like, yes, reserved4[3834] is a whole mood fr fr πŸ’€


🌸 MEMBERS 🌸

okay let's go through these one by one because every single field matters bestie 🫢

  • size β€” how big the address space is, like the total footprint vibes ✨
  • base β€” where the address space starts, the literal base address, no cap
  • ssa_frame_size β€” the size of an SSA frame, yes that's the whole thing
  • miscselect β€” extra info that gets stored to an SSA frame, little bonus data moment πŸ’–
  • attributes β€” the attributes for the enclave, like its whole personality
  • xfrm β€” the XSave-Feature Request Mask (which is a subset of XCR0, keep that in mind bestie)
  • mrenclave β€” SHA256-hash of the enclave contents, like a lil fingerprint of what's inside πŸ”₯
  • mrsigner β€” SHA256-hash of the public key used to sign the SIGSTRUCT, the signing key's fingerprint fr
  • config_id β€” a user-defined value that's used in key derivation
  • isv_prod_id β€” a user-defined value that's used in key derivation (yes again, it's giving key derivation energy)
  • isv_svn β€” a user-defined value that's used in key derivation (still key derivation, still slay)
  • config_svn β€” a user-defined value that's used in key derivation (last one, promise πŸŽ€)

πŸ’œ DESCRIPTION πŸ’œ

so the SGX Enclave Control Structure (SECS) is this special enclave page that is not visible in the address space, which is lowkey wild but that's just how it is πŸ™ˆ

like, in fact, this structure is the one that defines the address range and all the other global attributes for the enclave, and it's the first EPC page created for any enclave, main character energy for real πŸ‘‘

it gets moved from a temporary buffer to an EPC by the means of the ENCLS[ECREATE] function and that's literally the whole process bestie, ENCLS[ECREATE] ate and left no crumbs πŸ’…


πŸ”— SEE ALSO πŸ”—

bestie you gotta check these out too, they're all part of the squad 🧚

  • Kernel file ./arch/x86/include/asm/sgx.h
  • SGX_ENCLS_FAULT_FLAG(9)
  • enum sgx_return_code(9)
  • enum sgx_miscselect(9)
  • enum sgx_attribute(9)
  • enum sgx_tcs_flags(9)
  • struct sgx_tcs(9)
  • struct sgx_pageinfo(9)
  • enum sgx_page_type(9)
  • enum sgx_secinfo_flags(9)
  • struct sgx_secinfo(9)
  • struct sgx_pcmd(9)
  • struct sgx_sigstruct_header(9)
  • struct sgx_sigstruct_body(9)
  • struct sgx_sigstruct(9)

okay that's the whole page bestie, hope it slayed for you πŸ’–

xoxo, from the ./arch/x86/include/asm directory, dated October 2026 β€” catch you on the flip side, struct sgx_secs(9) out 🌈⭐

πŸ“¦ where this page comes from