Intel® Software Guard Extensions (Intel® SGX)
Discussion board focused on hardware-based isolation and memory encryption to provide extended code protection in solutions.
1459 Discussions

Heap memory corruption during calling enclave code from C#.

Vaurine
Beginner
1,690 Views

I need to call some sgx methods in my C# code. I have found simple example with C# SGX integration on this page: https://software.intel.com/content/www/us/en/develop/articles/csharp-application-with-intel-software.... I try to rewrite it on my personal project, and everything builds fine, but when I run I have such error:

Exception thrown at 0x00007FFC598B9229 (ntdll.dll) in HttpClient.exe: 0xC0000374: Heap Memory corruption (parameters: 0x00007FFC599227F0).

What can be the issue of that? Moreover when I continue debugging, it returns valid data from enclave(I have included sceen), which makes it really difficult to me to diagnoze. It even run properly without exception approximately one time  in six times.

Exception is thrown in "retValve = native->enclaveString(pString);" line in LinkManaged.cpp class:

String^ SigningEnclaveLinkManaged::enclaveString(String^ s)
{
string retValve;
char* pString = (char*)Marshal::StringToHGlobalAnsi(s).ToPointer();
string nativeString(pString); // make your std::string
retValve = native->enclaveString(pString);
String^ clistr = gcnew String(retValve.c_str()); // make your System::String^
return clistr;
}

0 Kudos
1 Solution
JesusG_Intel
Moderator
1,681 Views

Hello Vaurine,

 

Unfortunately, that C# sample is outdated and no longer supported. It has not been updated for modern SGX SDKs or .NET frameworks.


Microsoft’s OpenEnclave documentation may have advice on interacting with .NET languages.


View solution in original post

0 Kudos
2 Replies
JesusG_Intel
Moderator
1,682 Views

Hello Vaurine,

 

Unfortunately, that C# sample is outdated and no longer supported. It has not been updated for modern SGX SDKs or .NET frameworks.


Microsoft’s OpenEnclave documentation may have advice on interacting with .NET languages.


0 Kudos
JesusG_Intel
Moderator
1,667 Views

Intel is no longer monitoring this thread. If you want a response from Intel in a follow-up question, please open a new thread.


0 Kudos
Reply