<?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 Clarification: You may not be in Intel® Software Guard Extensions (Intel® SGX)</title>
    <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/std-hash-output-differs-inside-and-outside-enclave/m-p/1143436#M2337</link>
    <description>&lt;P&gt;Clarification: You may not be able to include the entire header file. If you do, you may have issues/conflicts with your compiler's C++ headers and this one and #ifdefs. Consider isolating this functionality to a single .cpp file / copy the hash function to avoid these types of conflicts.&lt;/P&gt;</description>
    <pubDate>Thu, 31 Jan 2019 20:08:31 GMT</pubDate>
    <dc:creator>Francisco_C_Intel</dc:creator>
    <dc:date>2019-01-31T20:08:31Z</dc:date>
    <item>
      <title>std::hash output differs inside and outside enclave</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/std-hash-output-differs-inside-and-outside-enclave/m-p/1143434#M2335</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I have an application where I calculate the std::hash in untrusted app layer and this is verified by the enclave by generating the hash again. But as we know std::hash in untrusted layer is provided by C++ stdlib and inside enclave it is provided by Intel sgxlib.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example:- std::hash&amp;lt;std::string&amp;gt;{}(std::to_string(1234567890));&lt;/P&gt;&lt;P&gt;This produces different output inside and outside library.&lt;/P&gt;&lt;P&gt;Is there any way to make use of the C++std lib function std::hash inside enclave ? or std::hash provided by sgxlib outside the enclave ?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jan 2019 12:13:58 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/std-hash-output-differs-inside-and-outside-enclave/m-p/1143434#M2335</guid>
      <dc:creator>kh__Naveen</dc:creator>
      <dc:date>2019-01-30T12:13:58Z</dc:date>
    </item>
    <item>
      <title>The source for the hash</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/std-hash-output-differs-inside-and-outside-enclave/m-p/1143435#M2336</link>
      <description>&lt;P&gt;The source for the hash functions, __murmur2_or_cityhash,&amp;nbsp;is in the memory header&lt;/P&gt;&lt;P&gt;C:\Program Files (x86)\Intel\IntelSGXSDK\include\libc++\memory&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/intel/linux-sgx/blob/master/sdk/tlibcxx/include/memory" target="_blank"&gt;https://github.com/intel/linux-sgx/blob/master/sdk/tlibcxx/include/memory&lt;/A&gt;&lt;/P&gt;&lt;P&gt;You should be able to use that header in your untrusted source outside of the enclave.&lt;/P&gt;&lt;P&gt;The compiler you are using&amp;nbsp;for&amp;nbsp;outside the enclave&amp;nbsp;may be using a different hash algorithm, and you can probably find it by following the STL headers.&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;Francisco&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2019 20:04:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/std-hash-output-differs-inside-and-outside-enclave/m-p/1143435#M2336</guid>
      <dc:creator>Francisco_C_Intel</dc:creator>
      <dc:date>2019-01-31T20:04:00Z</dc:date>
    </item>
    <item>
      <title>Clarification: You may not be</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/std-hash-output-differs-inside-and-outside-enclave/m-p/1143436#M2337</link>
      <description>&lt;P&gt;Clarification: You may not be able to include the entire header file. If you do, you may have issues/conflicts with your compiler's C++ headers and this one and #ifdefs. Consider isolating this functionality to a single .cpp file / copy the hash function to avoid these types of conflicts.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2019 20:08:31 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/std-hash-output-differs-inside-and-outside-enclave/m-p/1143436#M2337</guid>
      <dc:creator>Francisco_C_Intel</dc:creator>
      <dc:date>2019-01-31T20:08:31Z</dc:date>
    </item>
    <item>
      <title>Quote:Francisco C. (Intel)</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/std-hash-output-differs-inside-and-outside-enclave/m-p/1143437#M2338</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;Francisco C. (Intel) wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Clarification: You may not be able to include the entire header file. If you do, you may have issues/conflicts with your compiler's C++ headers and this one and #ifdefs. Consider isolating this functionality to a single .cpp file / copy the hash function to avoid these types of conflicts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you. This is what I wanted. I am planning to copy the source from the memory header. But, God, it looks so confusing as to what to copy and what not to.&lt;/P&gt;&lt;P&gt;Currently I am calling my hash function like below&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class="brush:cpp; class-name:dark;"&gt;std::hash&amp;lt;string&amp;gt;{}(&amp;lt;some string&amp;gt;)&lt;/PRE&gt;

&lt;P&gt;I see that inside the enclave when I check where std::hash is defined, it takes me to the below code defined in C:\Program Files (x86)\Intel\IntelSGXSDK\include\libcxx\string. So I am a little confused now, what exactly to copy.&lt;/P&gt;

&lt;PRE class="brush:cpp; class-name:dark;"&gt;template&amp;lt;class _CharT, class _Traits, class _Allocator&amp;gt;
struct _LIBCPP_TYPE_VIS_ONLY hash&amp;lt;basic_string&amp;lt;_CharT, _Traits, _Allocator&amp;gt; &amp;gt;
    : public unary_function&amp;lt;basic_string&amp;lt;_CharT, _Traits, _Allocator&amp;gt;, size_t&amp;gt;
{
    size_t
        operator()(const basic_string&amp;lt;_CharT, _Traits, _Allocator&amp;gt;&amp;amp; __val) const _NOEXCEPT;
};&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2019 20:51:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/std-hash-output-differs-inside-and-outside-enclave/m-p/1143437#M2338</guid>
      <dc:creator>kh__Naveen</dc:creator>
      <dc:date>2019-01-31T20:51:30Z</dc:date>
    </item>
    <item>
      <title>I was able to achieve this</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/std-hash-output-differs-inside-and-outside-enclave/m-p/1143438#M2339</link>
      <description>&lt;P&gt;I was able to achieve this myself. I copied the murmur 64 bit function to seperate file for the untrusted layer and used it.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Feb 2019 21:11:32 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/std-hash-output-differs-inside-and-outside-enclave/m-p/1143438#M2339</guid>
      <dc:creator>kh__Naveen</dc:creator>
      <dc:date>2019-02-04T21:11:32Z</dc:date>
    </item>
  </channel>
</rss>

