<?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 sgx_ecall read access violation in Intel® Software Guard Extensions (Intel® SGX)</title>
    <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/sgx-ecall-read-access-violation/m-p/1148470#M2499</link>
    <description>&lt;DIV&gt;&lt;SPAN style="font-size: 12.195px;"&gt;Through SGX EDL I defined this signature for computing a digital signature:&lt;/SPAN&gt;&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;

&lt;DIV&gt;
	&lt;PRE class="brush:cpp;"&gt;trusted {
    public void enc_sign([in, size=messageLength] Ipp8u* message, unsigned messageLength,
    [out, size=outputLength] Ipp8u* output, unsigned outputLength, unsigned saltLength, int signBufferSize,
    [in, size=publicLength] IppsRSAPublicKeyState* publicKeyContext, int publicLength,
    [in, size=privateLength] IppsRSAPrivateKeyState* privateKeyContext, int privateLength);
};&lt;/PRE&gt;

	&lt;P&gt;I don't think that the code of the function itself is relevant as outside of an enclave it works well.&lt;/P&gt;
&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;

&lt;DIV&gt;&lt;SPAN style="font-size: 12.195px;"&gt;SGX SDK then autogenerates untrusted proxy code which is in charge to perform the ecall; however, I am getting an error.&lt;/SPAN&gt;&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;

&lt;DIV&gt;&lt;SPAN style="font-size: 12.195px;"&gt;The autogenerated code is the following (just the relevant part):&lt;/SPAN&gt;&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;

&lt;DIV&gt;
	&lt;PRE class="brush:cpp;"&gt;sgx_status_t enc_sign(sgx_enclave_id_t eid, Ipp8u* message,
  unsigned int messageLength, Ipp8u* output, unsigned int outputLength,
  unsigned int saltLength, int signBufferSize,
  IppsRSAPublicKeyState* publicKeyContext, int publicLength,
  IppsRSAPrivateKeyState* privateKeyContext, int privateLength)
{
    sgx_status_t status;
    ms_enc_sign_t ms;
    ms.ms_message = message;
    ms.ms_messageLength = messageLength;
    ms.ms_output = output;
    ms.ms_outputLength = outputLength;
    ms.ms_saltLength = saltLength;
    ms.ms_signBufferSize = signBufferSize;
    ms.ms_publicKeyContext = publicKeyContext;
    ms.ms_publicLength = publicLength;
    ms.ms_privateKeyContext = privateKeyContext;
    ms.ms_privateLength = privateLength;
    status = sgx_ecall(eid, 0, &amp;amp;ocall_table_ESigner, &amp;amp;ms);
    return status;
}&lt;/PRE&gt;

	&lt;P&gt;This code, in particular the line status = sgx_ecall(eid, 0, &amp;amp;ocall_table_ESigner, &amp;amp;ms); causes me an access violation: read to address 0x00000000.&lt;/P&gt;
&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;

&lt;DIV&gt;&lt;SPAN style="font-size: 12.195px;"&gt;I double checked it, and eid ocall_table_ESigner and ms are not null. Moreover changing the second parameter to any other number makes the error disappear, so I am assuming that is is a function index problem.&lt;/SPAN&gt;&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;

&lt;DIV&gt;&lt;SPAN style="font-size: 12.195px;"&gt;Still, no clue on how to solve it.&lt;/SPAN&gt;&lt;/DIV&gt;</description>
    <pubDate>Mon, 05 Mar 2018 12:14:00 GMT</pubDate>
    <dc:creator>Caprioli__Nico</dc:creator>
    <dc:date>2018-03-05T12:14:00Z</dc:date>
    <item>
      <title>sgx_ecall read access violation</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/sgx-ecall-read-access-violation/m-p/1148470#M2499</link>
      <description>&lt;DIV&gt;&lt;SPAN style="font-size: 12.195px;"&gt;Through SGX EDL I defined this signature for computing a digital signature:&lt;/SPAN&gt;&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;

&lt;DIV&gt;
	&lt;PRE class="brush:cpp;"&gt;trusted {
    public void enc_sign([in, size=messageLength] Ipp8u* message, unsigned messageLength,
    [out, size=outputLength] Ipp8u* output, unsigned outputLength, unsigned saltLength, int signBufferSize,
    [in, size=publicLength] IppsRSAPublicKeyState* publicKeyContext, int publicLength,
    [in, size=privateLength] IppsRSAPrivateKeyState* privateKeyContext, int privateLength);
};&lt;/PRE&gt;

	&lt;P&gt;I don't think that the code of the function itself is relevant as outside of an enclave it works well.&lt;/P&gt;
&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;

&lt;DIV&gt;&lt;SPAN style="font-size: 12.195px;"&gt;SGX SDK then autogenerates untrusted proxy code which is in charge to perform the ecall; however, I am getting an error.&lt;/SPAN&gt;&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;

&lt;DIV&gt;&lt;SPAN style="font-size: 12.195px;"&gt;The autogenerated code is the following (just the relevant part):&lt;/SPAN&gt;&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;

&lt;DIV&gt;
	&lt;PRE class="brush:cpp;"&gt;sgx_status_t enc_sign(sgx_enclave_id_t eid, Ipp8u* message,
  unsigned int messageLength, Ipp8u* output, unsigned int outputLength,
  unsigned int saltLength, int signBufferSize,
  IppsRSAPublicKeyState* publicKeyContext, int publicLength,
  IppsRSAPrivateKeyState* privateKeyContext, int privateLength)
{
    sgx_status_t status;
    ms_enc_sign_t ms;
    ms.ms_message = message;
    ms.ms_messageLength = messageLength;
    ms.ms_output = output;
    ms.ms_outputLength = outputLength;
    ms.ms_saltLength = saltLength;
    ms.ms_signBufferSize = signBufferSize;
    ms.ms_publicKeyContext = publicKeyContext;
    ms.ms_publicLength = publicLength;
    ms.ms_privateKeyContext = privateKeyContext;
    ms.ms_privateLength = privateLength;
    status = sgx_ecall(eid, 0, &amp;amp;ocall_table_ESigner, &amp;amp;ms);
    return status;
}&lt;/PRE&gt;

	&lt;P&gt;This code, in particular the line status = sgx_ecall(eid, 0, &amp;amp;ocall_table_ESigner, &amp;amp;ms); causes me an access violation: read to address 0x00000000.&lt;/P&gt;
&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;

&lt;DIV&gt;&lt;SPAN style="font-size: 12.195px;"&gt;I double checked it, and eid ocall_table_ESigner and ms are not null. Moreover changing the second parameter to any other number makes the error disappear, so I am assuming that is is a function index problem.&lt;/SPAN&gt;&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;

&lt;DIV&gt;&lt;SPAN style="font-size: 12.195px;"&gt;Still, no clue on how to solve it.&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 05 Mar 2018 12:14:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/sgx-ecall-read-access-violation/m-p/1148470#M2499</guid>
      <dc:creator>Caprioli__Nico</dc:creator>
      <dc:date>2018-03-05T12:14:00Z</dc:date>
    </item>
  </channel>
</rss>

