<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re:Details when evicting an enclave page from EPC to the untrusted memroy in Intel® Software Guard Extensions (Intel® SGX)</title>
    <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Details-when-evicting-an-enclave-page-from-EPC-to-the-untrusted/m-p/1326462#M4975</link>
    <description>&lt;P&gt;&lt;B&gt;This thread has been marked as answered and Intel will no longer monitor this thread. If you want a response from Intel in a follow-up question, please open a new thread.&lt;/B&gt;&lt;/P&gt;&lt;BR /&gt;</description>
    <pubDate>Tue, 02 Nov 2021 00:11:41 GMT</pubDate>
    <dc:creator>JesusG_Intel</dc:creator>
    <dc:date>2021-11-02T00:11:41Z</dc:date>
    <item>
      <title>Details when evicting an enclave page from EPC to the untrusted memroy</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Details-when-evicting-an-enclave-page-from-EPC-to-the-untrusted/m-p/1325662#M4962</link>
      <description>&lt;P&gt;Hi, I am confused while digging into the page swapping process. I have read the Intel SDM and the &lt;A href="https://eprint.iacr.org/2016/204.pdf" target="_self"&gt;MEE paper&lt;/A&gt;. Here is my question.&lt;/P&gt;
&lt;P&gt;(1) The MEE paper says that when the data is moved from cache to the EPC, it is encrypted and integrity protected. The encryption scheme used is a tweaked AES Counter Mode, in which the cache line address (shown in the Figure below as x, and I am assuming the physical address here) is involved as the spatial coordinate, while the 56-bit counter (shown in the Figure below as y) is the temporal coordinates. As a result, I think the enclave data can only be decrypted successfully when it is loaded into the cache, if the data is stored in the same physical address (as it is stored previously into the memory from the cache).&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="yunfeng7854_0-1635465581756.png" style="width: 400px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/20272i5D9FBE887355E443/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="yunfeng7854_0-1635465581756.png" alt="yunfeng7854_0-1635465581756.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;(2) According to Intel SDM, the EWB instruction will encrypt the EPC page and copy the encrypted page&amp;nbsp;along with some metadata (such as the page version number for replay protection, and the MAC for integrity protection) to untrusted memory. Then the ELDU/B instruction can decrypt the data from the untrusted memory and verify the version number as well as the MAC for freshness and integrity. If the verification passes, the data is copied back to the EPC.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My question is: whether the EPC page is copied back to the same physical address (as the physical address before the eviction)? If not, I think it may not be decrypted successfully when the data is loaded back to the cache, since the cache line address changes (see item (1) above).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe, I am thinking it is possible, the EWB instruction will first decrypt the EPC page and get the plaintext enclave data, then encrypt the plaintext data, which is sent to the untrusted memory. When it is loaded from the untrusted memory to the EPC, the ELDU/B instruction will decrypt&amp;nbsp; and get the plaintext enclave data, then encrypt it again using the new cache line address as part of the CTR. However, the SDM seems to inform that the EWB instruction only encrypts the EPC page (without decrypting it first).&lt;/P&gt;
&lt;P&gt;Thank you for your time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Wenhao&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Oct 2021 00:15:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Details-when-evicting-an-enclave-page-from-EPC-to-the-untrusted/m-p/1325662#M4962</guid>
      <dc:creator>yunfeng7854</dc:creator>
      <dc:date>2021-10-29T00:15:46Z</dc:date>
    </item>
    <item>
      <title>Re:Details when evicting an enclave page from EPC to the untrusted memroy</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Details-when-evicting-an-enclave-page-from-EPC-to-the-untrusted/m-p/1326012#M4969</link>
      <description>&lt;P&gt;Helllo yunfeng7854,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I will consult with my resources and respond on this thread as soon as I have an answer.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Sincerely,&lt;/P&gt;&lt;P&gt;Jesus G.&lt;/P&gt;&lt;P&gt;Intel Customer Support&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 29 Oct 2021 22:26:58 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Details-when-evicting-an-enclave-page-from-EPC-to-the-untrusted/m-p/1326012#M4969</guid>
      <dc:creator>JesusG_Intel</dc:creator>
      <dc:date>2021-10-29T22:26:58Z</dc:date>
    </item>
    <item>
      <title>Re:Details when evicting an enclave page from EPC to the untrusted memroy</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Details-when-evicting-an-enclave-page-from-EPC-to-the-untrusted/m-p/1326014#M4970</link>
      <description>&lt;P&gt;Hello yunfeng7854,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Your answer may be found in &lt;I&gt;section 5.5&lt;/I&gt; &lt;I&gt;EPC P&lt;/I&gt;age &lt;I&gt;Eviction&lt;/I&gt; of &lt;A href="https://eprint.iacr.org/2016/086.pdf" rel="noopener noreferrer" target="_blank"&gt;SGX Explained&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Sincerely,&lt;/P&gt;&lt;P&gt;Jesus G.&lt;/P&gt;&lt;P&gt;Intel Customer Support&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 29 Oct 2021 22:34:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Details-when-evicting-an-enclave-page-from-EPC-to-the-untrusted/m-p/1326014#M4970</guid>
      <dc:creator>JesusG_Intel</dc:creator>
      <dc:date>2021-10-29T22:34:52Z</dc:date>
    </item>
    <item>
      <title>Re: Re:Details when evicting an enclave page from EPC to the untrusted memroy</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Details-when-evicting-an-enclave-page-from-EPC-to-the-untrusted/m-p/1326104#M4971</link>
      <description>&lt;P&gt;Thank you for your response.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As I read through the Foreshadow paper, I think I have resolved the issue. The foreshadow paper mentions that the ELDU instruction will decrypt the page to get the plaintext data and put the data into L1 cache.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;Wenhao&lt;/P&gt;</description>
      <pubDate>Sun, 31 Oct 2021 02:44:28 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Details-when-evicting-an-enclave-page-from-EPC-to-the-untrusted/m-p/1326104#M4971</guid>
      <dc:creator>yunfeng7854</dc:creator>
      <dc:date>2021-10-31T02:44:28Z</dc:date>
    </item>
    <item>
      <title>Re:Details when evicting an enclave page from EPC to the untrusted memroy</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Details-when-evicting-an-enclave-page-from-EPC-to-the-untrusted/m-p/1326462#M4975</link>
      <description>&lt;P&gt;&lt;B&gt;This thread has been marked as answered and Intel will no longer monitor this thread. If you want a response from Intel in a follow-up question, please open a new thread.&lt;/B&gt;&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 02 Nov 2021 00:11:41 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Details-when-evicting-an-enclave-page-from-EPC-to-the-untrusted/m-p/1326462#M4975</guid>
      <dc:creator>JesusG_Intel</dc:creator>
      <dc:date>2021-11-02T00:11:41Z</dc:date>
    </item>
  </channel>
</rss>

