<?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 Question about Enclave paging encryption Key (CR_BASE_PK) in Intel® Software Guard Extensions (Intel® SGX)</title>
    <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Question-about-Enclave-paging-encryption-Key-CR-BASE-PK/m-p/1130196#M1874</link>
    <description>&lt;P&gt;Dear,&lt;/P&gt;

&lt;P&gt;In the Intel software developer's manual (SDM), I found that evicted pages would be encrypted via AES-GCM with the key &lt;STRONG&gt;CR_BASE_PK&lt;/STRONG&gt;. Here is the pseudo-code from SDM:&lt;/P&gt;

&lt;PRE class="brush:;"&gt;(* Encrypt the page, DS:RCX could be encrypted in place. AES-GCM produces 2 values, {ciphertext, MAC}. *)
(* AES-GCM input parameters: key, GCM Counter, MAC_HDR, MAC_HDR_SIZE, SRC, SRC_SIZE) *)
{DS:TMP_SRCPGE, DS:TMP_PCMD.MAC} &amp;lt;- AES_GCM_ENC(CR_BASE_PK, (TMP_VER &amp;lt;&amp;lt; 32), TMP_HEADER, 128, DS:RCX, 4096);&lt;/PRE&gt;

&lt;P&gt;And the SDM also indicates that the key &lt;STRONG&gt;CR_BASE_PK&lt;/STRONG&gt; is an internal CREG.&lt;/P&gt;

&lt;P&gt;In the SGX patent (https://patents.google.com/patent/US20120159184A1/en), I found the evicted pages is encrypted by CMA (old name of MEE). Quote from patent:&lt;/P&gt;

&lt;P&gt;"When enclave pages residing in the EPC is evicted from the cache to the main memory outside the CPU package, it is protected by CMA (Crypto Memory Aperture) encryption. The CMA will encrypt the data to provide data confidentiality. The integrity of the EPC is provided by range registers that prevent reads and writes to the EPC."&lt;/P&gt;

&lt;P&gt;So my question is whether the encryption key &lt;STRONG&gt;CR_BASE_PK&lt;/STRONG&gt; is generated and used by MEE. If not, is it hard-coded inside CPU? Is it related to enclave key generation? Do all enclaves share the same key for paging encryption?&lt;/P&gt;

&lt;DIV class="OutlineElement Ltr SCXW55461631" style="direction: ltr;"&gt;
	&lt;P class="Paragraph SCXW55461631" style="font-weight: normal; font-style: normal; vertical-align: baseline; background-color: transparent; color: windowtext; text-align: left; margin-left: 0px; margin-right: 0px; padding-left: 0px; padding-right: 0px; text-indent: 0px;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;</description>
    <pubDate>Fri, 25 May 2018 15:18:30 GMT</pubDate>
    <dc:creator>SONGSONG_L_</dc:creator>
    <dc:date>2018-05-25T15:18:30Z</dc:date>
    <item>
      <title>Question about Enclave paging encryption Key (CR_BASE_PK)</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Question-about-Enclave-paging-encryption-Key-CR-BASE-PK/m-p/1130196#M1874</link>
      <description>&lt;P&gt;Dear,&lt;/P&gt;

&lt;P&gt;In the Intel software developer's manual (SDM), I found that evicted pages would be encrypted via AES-GCM with the key &lt;STRONG&gt;CR_BASE_PK&lt;/STRONG&gt;. Here is the pseudo-code from SDM:&lt;/P&gt;

&lt;PRE class="brush:;"&gt;(* Encrypt the page, DS:RCX could be encrypted in place. AES-GCM produces 2 values, {ciphertext, MAC}. *)
(* AES-GCM input parameters: key, GCM Counter, MAC_HDR, MAC_HDR_SIZE, SRC, SRC_SIZE) *)
{DS:TMP_SRCPGE, DS:TMP_PCMD.MAC} &amp;lt;- AES_GCM_ENC(CR_BASE_PK, (TMP_VER &amp;lt;&amp;lt; 32), TMP_HEADER, 128, DS:RCX, 4096);&lt;/PRE&gt;

&lt;P&gt;And the SDM also indicates that the key &lt;STRONG&gt;CR_BASE_PK&lt;/STRONG&gt; is an internal CREG.&lt;/P&gt;

&lt;P&gt;In the SGX patent (https://patents.google.com/patent/US20120159184A1/en), I found the evicted pages is encrypted by CMA (old name of MEE). Quote from patent:&lt;/P&gt;

&lt;P&gt;"When enclave pages residing in the EPC is evicted from the cache to the main memory outside the CPU package, it is protected by CMA (Crypto Memory Aperture) encryption. The CMA will encrypt the data to provide data confidentiality. The integrity of the EPC is provided by range registers that prevent reads and writes to the EPC."&lt;/P&gt;

&lt;P&gt;So my question is whether the encryption key &lt;STRONG&gt;CR_BASE_PK&lt;/STRONG&gt; is generated and used by MEE. If not, is it hard-coded inside CPU? Is it related to enclave key generation? Do all enclaves share the same key for paging encryption?&lt;/P&gt;

&lt;DIV class="OutlineElement Ltr SCXW55461631" style="direction: ltr;"&gt;
	&lt;P class="Paragraph SCXW55461631" style="font-weight: normal; font-style: normal; vertical-align: baseline; background-color: transparent; color: windowtext; text-align: left; margin-left: 0px; margin-right: 0px; padding-left: 0px; padding-right: 0px; text-indent: 0px;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 25 May 2018 15:18:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Question-about-Enclave-paging-encryption-Key-CR-BASE-PK/m-p/1130196#M1874</guid>
      <dc:creator>SONGSONG_L_</dc:creator>
      <dc:date>2018-05-25T15:18:30Z</dc:date>
    </item>
  </channel>
</rss>

