30.12.2015 Views

Intel SGX Enclave Support in Windows 10 Fall Update (Threshold 2)

1ks6upt

1ks6upt

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

_In_ PVOID Parameter1,<br />

_In_ PVOID Parameter2,<br />

_In_ PVOID Parameter3<br />

);<br />

Here are the currently def<strong>in</strong>ed lead functions supported by <strong>SGX</strong>1. We will see many of these throughout<br />

this whitepaper, and describe their use by the W<strong>in</strong>dows kernel.<br />

In order to create the enclave, KeCreate<strong>Enclave</strong> needs to use the ECREATE (0) leaf function, which has<br />

the follow<strong>in</strong>g <strong>in</strong>puts:<br />

As you can imag<strong>in</strong>e, RBX will conta<strong>in</strong> the PAGEINFO structure that was create above. RCX, on the other<br />

hand, is the dest<strong>in</strong>ation of the SECS page – aga<strong>in</strong>, that’s go<strong>in</strong>g to be the kernel address backed by the<br />

system PTE from earlier. Once this <strong>in</strong>struction returns, KeCreate<strong>Enclave</strong> f<strong>in</strong>ally returns back to<br />

MiCreate<strong>Enclave</strong>.<br />

The last th<strong>in</strong>g this function does is to read any output flags – such as the one describ<strong>in</strong>g that this is a<br />

debuggable enclave, based on the DEBUG attribute we saw KeCreate<strong>Enclave</strong> verify<strong>in</strong>g earlier. If the DEBUG<br />

attribute is set, a Debug flag will be set <strong>in</strong> the <strong>Enclave</strong> VAD, whose use we’ll understand later. Additionally,<br />

the NumberOfDebug<strong>Enclave</strong>s field <strong>in</strong> the MI_USER_VA_INFO sub-structure part of the current<br />

process’ work<strong>in</strong>g set (MMWSL) structure is <strong>in</strong>cremented (<strong>in</strong>terest<strong>in</strong>gly, no such field exists for regular<br />

enclaves – only debuggable enclaves are accounted).<br />

MiCreate<strong>Enclave</strong> now returns back to NtCreate<strong>Enclave</strong>, which returns back to the user, with the base<br />

address of the enclave that was allocated, or any errors if anyth<strong>in</strong>g <strong>in</strong> the above failed <strong>in</strong> any way. The<br />

hard part is done – now it’s time to load data <strong>in</strong>to the enclave!

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!