Adding_an_SGX_Enclave.htm 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <!--------------------------------------------------------------------------->
  2. <!-- Copyright (c) 2016 Intel Corporation. -->
  3. <!-- -->
  4. <!-- All rights reserved. This program and the accompanying materials -->
  5. <!-- are made available under the terms of the Eclipse Public License v1.0 -->
  6. <!-- which accompanies this distribution, and is available at -->
  7. <!-- http://www.eclipse.org/legal/epl-v10.html -->
  8. <!-- -->
  9. <!-- Contributors: -->
  10. <!-- Intel Corporation - initial implementation and documentation -->
  11. <!--------------------------------------------------------------------------->
  12. <?xml version="1.0" encoding="utf-8"?>
  13. <html xmlns:MadCap="http://www.madcapsoftware.com/Schemas/MadCap.xsd" MadCap:lastBlockDepth="6" MadCap:lastHeight="2003" MadCap:lastWidth="524">
  14. <head><title>Adding an SGX Enclave</title>
  15. <link href="Resources/Stylesheets/intel_css_styles.css" rel="stylesheet" type="text/css" />
  16. </head>
  17. <body>
  18. <h2>Adding an SGX Enclave</h2>
  19. <p>After you add the SGX nature to a project, you can start creating a minimal but complete skeleton for a new enclave:</p>
  20. <ol>
  21. <li>Right-click on the project root in <b>Project Explorer</b>.</li>
  22. <li>
  23. <p>Open the dialog <b>Add New SGX Enclave</b> by selecting <b>Software Guard Extensions Tools → Add SGX Enclave</b> from the contextual menu.</p>
  24. <p>
  25. <img src="Resources/Images/Add_New_Intel_SGX_Enclave_Dialog.png" />
  26. </p>
  27. <p class="figcap">Add New Intel® SGX Enclave Dialog</p>
  28. </li>
  29. <li>
  30. <p>Choose a name for the enclave in <b>Enclave name</b> field. This name is used in the process of generation of the skeleton to give unicity to the source files and the name of the resulting executable, so you can add more than one enclave to the same project.</p>
  31. <ul>
  32. <li>
  33. <p>If you do not select the <b>Generate sample untrusted application</b> checkbox, the plugin generates only a trusted file and a Makefile fragment to build and compile the trusted part. See the following graphic. All the code for the enclave, including build Makefile, is put in a directory <code>&lt;root&gt;/sgx/enclave_&lt;name&gt;</code> . C/C++ code for the enclave proper are in <code>&lt;root&gt;/sgx/enclave_&lt;name&gt;/trusted</code>.</p>
  34. <p>
  35. <img src="Resources/Images/Generated_Skeleton_for_an_Enclave.png" />
  36. </p>
  37. <p class="figcap">Generated Skeleton for an Enclave. The option to Generate Sample was not Used</p>
  38. </li>
  39. <li>
  40. <p>If you select <b>Generate sample untrusted application</b> checkbox, a simple ready to work sample application is generated, including untrusted stubs and implementation for a sample OCALL and ECALL.</p>
  41. <p>
  42. <img src="Resources/Images/Generated_Sample_Untrusted_Application.png" />
  43. </p>
  44. <p class="figcap">Generated Sample Untrusted Application</p>
  45. </li>
  46. </ul>
  47. </li>
  48. </ol>
  49. <div class="NoteCont">
  50. <p class="NoteTipHead">NOTE:</p>
  51. <p>If you select the <b>Generate sample untrusted application</b> checkbox, ecalls from the untrusted part are not be resolved by Eclipse C/C++ indexer. These functions are marked with a red line. The declaration of these ecalls resides in the unstrusted stub header which is generated during the build proces and is not indexed by Eclipse. To resolve this problem, right-click on project root and select <b>Index → Freshen All Files</b>.</p>
  52. </div>
  53. </body>
  54. </html>