<?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 Please take a look at the in Intel® Software Guard Extensions (Intel® SGX)</title>
    <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Unsupported-C-Standard-Functions-time-and-gmtime/m-p/1178549#M3455</link>
    <description>&lt;P&gt;Please take a look at the provided monotonic counter (&lt;A href="https://software.intel.com/en-us/node/709160"&gt;https://software.intel.com/en-us/node/709160&lt;/A&gt;)&amp;nbsp;and sgx trusted time (&lt;A href="https://software.intel.com/en-us/node/709158"&gt;https://software.intel.com/en-us/node/709158&lt;/A&gt;) functions if the platform can support them.&lt;/P&gt;</description>
    <pubDate>Tue, 23 Jan 2018 23:27:13 GMT</pubDate>
    <dc:creator>Hoang_N_Intel</dc:creator>
    <dc:date>2018-01-23T23:27:13Z</dc:date>
    <item>
      <title>Unsupported C Standard Functions time() and gmtime()</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Unsupported-C-Standard-Functions-time-and-gmtime/m-p/1178548#M3454</link>
      <description>&lt;P&gt;I realize the following is documented, I do however have a question none-the-less.&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
	&lt;HEADER style="box-sizing: border-box; color: rgb(102, 102, 102); font-family: Arial, Tahoma, Helvetica, sans-serif; font-size: 13px;"&gt;
		&lt;H1 class="page__title title" id="page-title" style="margin-bottom: 10px; font-size: 30px; color: rgb(83, 86, 90); box-sizing: border-box; line-height: 1.2em;"&gt;Unsupported C standard Functions&lt;/H1&gt;
	&lt;/HEADER&gt;

	&lt;DIV class="field field-name-body field-type-text-with-summary field-label-hidden" style="box-sizing: border-box; max-width: 100%; color: rgb(102, 102, 102); font-family: Arial, Tahoma, Helvetica, sans-serif; font-size: 13px;"&gt;
		&lt;DIV class="field-items" style="box-sizing: border-box;"&gt;
			&lt;DIV class="field-item even" property="content:encoded" style="box-sizing: border-box;"&gt;
				&lt;DIV class="topic-wrapper" id="5403a555-80e5-11e6-bdf4-0800200c9a66" style="box-sizing: border-box;"&gt;
					&lt;P style="margin-bottom: 1em; box-sizing: border-box; word-wrap: break-word; line-height: 1.4; max-width: 100%; width: auto;"&gt;You cannot use the following Standard C functions within an enclave; otherwise, the compilation would fail.&lt;/P&gt;

					&lt;P style="margin-bottom: 1em; box-sizing: border-box; word-wrap: break-word; line-height: 1.4; max-width: 100%; width: auto;"&gt;Table 20 Unsupported C Standard Functions&lt;/P&gt;

					&lt;P style="margin-bottom: 1em; box-sizing: border-box; word-wrap: break-word; line-height: 1.4; max-width: 100%; width: auto;"&gt;...&lt;/P&gt;

					&lt;TABLE class="table_3" style="border-width: initial; border-top-style: none; border-top-color: initial; border-right-style: initial; border-right-color: white; border-bottom-style: initial; border-bottom-color: white; border-left-style: initial; border-left-color: white; font-size: 13px; margin-top: 1.6em; margin-bottom: 1.6em; width: 702px; border-collapse: collapse; box-sizing: border-box; max-width: 100%; overflow-x: auto; display: block;"&gt;
						&lt;TBODY style="box-sizing: border-box; border-style: none;"&gt;
							&lt;TR style="box-sizing: border-box; border-bottom: 1px solid rgb(204, 204, 204); background-color: rgb(242, 242, 242);"&gt;
								&lt;TD class="td_13" style="border-right-style: solid; border-left-style: solid; border-right-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); padding: 9px 10px; box-sizing: border-box;"&gt;
									&lt;P class="p_22" style="margin-bottom: 1em; box-sizing: border-box; word-wrap: break-word; line-height: 1.4; max-width: 100%; width: auto;"&gt;time.h&lt;/P&gt;
								&lt;/TD&gt;
								&lt;TD class="td_14" style="border-right-style: solid; border-right-color: rgb(204, 204, 204); padding: 9px 10px; box-sizing: border-box; background: none;"&gt;
									&lt;P class="p_22" style="margin-bottom: 1em; box-sizing: border-box; word-wrap: break-word; line-height: 1.4; max-width: 100%; width: auto;"&gt;Yes&lt;/P&gt;
								&lt;/TD&gt;
								&lt;TD class="td_14" style="border-right-style: solid; border-right-color: rgb(204, 204, 204); padding: 9px 10px; box-sizing: border-box; font-family: monospace;"&gt;
									&lt;P style="margin-bottom: 1em; box-sizing: border-box; word-wrap: break-word; line-height: 1.4; max-width: 100%; width: auto;"&gt;timespec&lt;/P&gt;
								&lt;/TD&gt;
								&lt;TD class="td_14" style="border-right-style: solid; border-right-color: rgb(204, 204, 204); padding: 9px 10px; box-sizing: border-box; background: none;"&gt;
									&lt;P style="margin-bottom: 1em; box-sizing: border-box; word-wrap: break-word; line-height: 1.4; max-width: 100%; width: auto;"&gt;&lt;CODE style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; box-sizing: border-box; line-height: 1.6em;"&gt;clock(), mktime(), time(), asctime_s(), ctime(), ctime_s(), gmtime(), gtime_s(), localtime(), localtime_s()&lt;/CODE&gt;&lt;/P&gt;
								&lt;/TD&gt;
							&lt;/TR&gt;
						&lt;/TBODY&gt;
					&lt;/TABLE&gt;
				&lt;/DIV&gt;
			&lt;/DIV&gt;
		&lt;/DIV&gt;
	&lt;/DIV&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;I wish to load an existing library into an enclave with as few changes as possible. Unfortunately this library has a dependency on the c-standard library functions "time" and "gmtime". I have done the following:&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;&amp;lt;Enclave.cpp&amp;gt;
long time(long* arg)
{
	long retVal;
	if (ocall_time(&amp;amp;retVal, arg) != SGX_SUCCESS)
		abort();
	return retVal;
}&lt;/PRE&gt;

&lt;PRE class="brush:cpp;"&gt;&amp;lt;Enclave.edl&amp;gt;
untrusted {
		[cdecl] long ocall_time([in] long* arg);
    };&lt;/PRE&gt;

&lt;PRE class="brush:cpp;"&gt;&amp;lt;App.c&amp;gt;
long ocall_time(long* arg)
{
	return (long) time((time_t*) arg);
}&lt;/PRE&gt;

&lt;P&gt;That works ok for compiling (I have not yet been able to test run-time functionality as I need to also solve the gmtime call).&lt;/P&gt;

&lt;P&gt;The issue I am facing with gmtime is that when I declare:&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;&amp;lt;Enclave.edl&amp;gt;
[cdecl] struct tm* ocall_gmtime([in] const long* timer);&lt;/PRE&gt;

&lt;P&gt;Then the Enclave_t.h expects a tm** to be returned instead of a tm*. gmtime however returns a tm* so my ocall_gmtime would ideally be:&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;struct tm* ocall_gmtime(const long* timer)
{
    return gmtime((time_t*)timer);
}&lt;/PRE&gt;

&lt;P&gt;What is the best solution for calling a c standard function that returns a pointer in this way?&lt;BR /&gt;
	Alternatively, is there a better solution for using "time()" and "gmtime()" in an enclave when they are necessary? Are there SGX alternatives that can be used instead?&lt;/P&gt;

&lt;P&gt;Thanks and Regards,&lt;/P&gt;

&lt;P&gt;- K&lt;/P&gt;</description>
      <pubDate>Thu, 28 Dec 2017 22:06:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Unsupported-C-Standard-Functions-time-and-gmtime/m-p/1178548#M3454</guid>
      <dc:creator>kalsheraut</dc:creator>
      <dc:date>2017-12-28T22:06:10Z</dc:date>
    </item>
    <item>
      <title>Please take a look at the</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Unsupported-C-Standard-Functions-time-and-gmtime/m-p/1178549#M3455</link>
      <description>&lt;P&gt;Please take a look at the provided monotonic counter (&lt;A href="https://software.intel.com/en-us/node/709160"&gt;https://software.intel.com/en-us/node/709160&lt;/A&gt;)&amp;nbsp;and sgx trusted time (&lt;A href="https://software.intel.com/en-us/node/709158"&gt;https://software.intel.com/en-us/node/709158&lt;/A&gt;) functions if the platform can support them.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2018 23:27:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Unsupported-C-Standard-Functions-time-and-gmtime/m-p/1178549#M3455</guid>
      <dc:creator>Hoang_N_Intel</dc:creator>
      <dc:date>2018-01-23T23:27:13Z</dc:date>
    </item>
  </channel>
</rss>

