ENT-1187 - Update Intel SGX SDK (#165)

* Remove diverged copy of 'linux-sgx'

* Squashed 'sgx-jvm/linux-sgx/' content from commit 3699ffd5e

git-subtree-dir: sgx-jvm/linux-sgx
git-subtree-split: 3699ffd5ebd8e79d599301fa2e5814e2386cad2d

* ENT-1194 - Executable heap

* ENT-1194 - Placeholder for passing of enclave context to create_thread
This commit is contained in:
Tommy Lillehagen 2017-12-14 12:33:15 +00:00 committed by GitHub
parent 205663d37f
commit f21f8e7142
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
829 changed files with 32308 additions and 123810 deletions

View File

@ -4,6 +4,6 @@ enclave {
public void create_new_thread(unsigned int nonce);
};
untrusted {
void request_new_thread([enclave_id] uint64_t enclave_id, uint32_t nonce);
void request_new_thread(uint64_t enclave_id, uint32_t nonce);
};
};

View File

@ -35,7 +35,11 @@ thread_data_t *start_thread(void (*routine)(void *), void *param) {
aex_assert(new_thread_map.find(nonce) == new_thread_map.end());
new_thread_map[nonce] = thread_init_data;
}
request_new_thread(nonce);
// TODO use MRENCLAVE instead of enclave_id (this is currently not used)
uint64_t enclave_id = 0L;
request_new_thread(enclave_id, nonce);
sgx_thread_cond_wait(&thread_started, &thread_started_mutex);
sgx_thread_mutex_guard started_thread_data_map_guard(&started_thread_data_map_mutex);
auto thread_data_iter = started_thread_data_map.find(nonce);

View File

@ -1,13 +1,13 @@
<project name="update site">
<!-- ========================================================================= -->
<!-- Extracts feature zip for update site -->
<!-- expected properties: -->
<!-- id - feature id to extract -->
<!-- buildDirectory - base directgory where build takes place -->
<!-- buildLabel - build id label -->
<!-- updateSiteRoot - where to extract feature zip -->
<!-- ========================================================================= -->
<target name="extractFeature">
<unzip src="${buildDirectory}/${buildLabel}/${id}-${buildId}.zip" dest="${updateSiteRoot}"/>
</target>
</project>
<project name="update site">
<!-- ========================================================================= -->
<!-- Extracts feature zip for update site -->
<!-- expected properties: -->
<!-- id - feature id to extract -->
<!-- buildDirectory - base directgory where build takes place -->
<!-- buildLabel - build id label -->
<!-- updateSiteRoot - where to extract feature zip -->
<!-- ========================================================================= -->
<target name="extractFeature">
<unzip src="${buildDirectory}/${buildLabel}/${id}-${buildId}.zip" dest="${updateSiteRoot}"/>
</target>
</project>

View File

@ -192,17 +192,17 @@
<!-- Steps to do to generate the update site -->
<!-- ===================================================================== -->
<target name="generateUpdateSite">
<echo message="Copying update site source ${updateSiteSource} to destination ${updateSiteDestination}"/>
<copy file="${updateSiteSource}/site.xml" overwrite="true" todir="${updateSiteDestination}"/>
<!-- replace qualifier version references with build label -->
<echo message="Copying update site source ${updateSiteSource} to destination ${updateSiteDestination}"/>
<copy file="${updateSiteSource}/site.xml" overwrite="true" todir="${updateSiteDestination}"/>
<!-- replace qualifier version references with build label -->
<replace file="${updateSiteDestination}/site.xml" token="qualifier" value="${forceContextQualifier}"/>
<!-- now extract each features zip to update site -->
<antcall target="allElements">
<param name="genericTargets" value="${builder}/buildUpdateSite.xml"/>
<param name="target" value="extractFeature" />
</antcall>
<!-- now extract each features zip to update site -->
<antcall target="allElements">
<param name="genericTargets" value="${builder}/buildUpdateSite.xml"/>
<param name="target" value="extractFeature" />
</antcall>
</target>
</project>

View File

@ -1,18 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- -->
<!-- Copyright (c) 2016 Intel Corporation. -->
<!-- -->
<!-- All rights reserved. This program and the accompanying materials -->
<!-- are made available under the terms of the Eclipse Public License v1.0 -->
<!-- which accompanies this distribution, and is available at -->
<!-- http://www.eclipse.org/legal/epl-v10.html -->
<!-- -->
<!-- Contributors: -->
<!-- Intel Corporation - initial implementation and documentation -->
<!-- -->
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<!-- -->
<!-- Copyright (c) 2016 Intel Corporation. -->
<!-- -->
<!-- All rights reserved. This program and the accompanying materials -->
<!-- are made available under the terms of the Eclipse Public License v1.0 -->
<!-- which accompanies this distribution, and is available at -->
<!-- http://www.eclipse.org/legal/epl-v10.html -->
<!-- -->
<!-- Contributors: -->
<!-- Intel Corporation - initial implementation and documentation -->
<!-- -->
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -1,39 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- -->
<!-- Copyright (c) 2016 Intel Corporation. -->
<!-- -->
<!-- All rights reserved. This program and the accompanying materials -->
<!-- are made available under the terms of the Eclipse Public License v1.0 -->
<!-- which accompanies this distribution, and is available at -->
<!-- http://www.eclipse.org/legal/epl-v10.html -->
<!-- -->
<!-- Contributors: -->
<!-- Intel Corporation - initial implementation and documentation -->
<!-- -->
<projectDescription>
<name>com.intel.sgx.userguide</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<!-- -->
<!-- Copyright (c) 2016 Intel Corporation. -->
<!-- -->
<!-- All rights reserved. This program and the accompanying materials -->
<!-- are made available under the terms of the Eclipse Public License v1.0 -->
<!-- which accompanies this distribution, and is available at -->
<!-- http://www.eclipse.org/legal/epl-v10.html -->
<!-- -->
<!-- Contributors: -->
<!-- Intel Corporation - initial implementation and documentation -->
<!-- -->
<projectDescription>
<name>com.intel.sgx.userguide</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -6,6 +6,6 @@ Bundle-SymbolicName: com.intel.sgx.userguide;singleton:=true
Bundle-Version: 1.0.1.qualifier
Bundle-Activator: com.intel.sgx.userguide.Activator
Bundle-Vendor: INTEL
Require-Bundle: org.eclipse.ui,
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime
Bundle-ActivationPolicy: lazy

View File

@ -1,19 +1,19 @@
#########################################################################
# Copyright (c) 2016 Intel Corporation. #
# #
# All rights reserved. This program and the accompanying materials #
# are made available under the terms of the Eclipse Public License v1.0 #
# which accompanies this distribution, and is available at #
# http://www.eclipse.org/legal/epl-v10.html #
# #
# Contributors: #
# Intel Corporation - initial implementation and documentation #
#########################################################################
source.. = src/
output.. = bin/
bin.includes = plugin.xml,\
META-INF/,\
.,\
html/,\
*.xml
#########################################################################
# Copyright (c) 2016 Intel Corporation. #
# #
# All rights reserved. This program and the accompanying materials #
# are made available under the terms of the Eclipse Public License v1.0 #
# which accompanies this distribution, and is available at #
# http://www.eclipse.org/legal/epl-v10.html #
# #
# Contributors: #
# Intel Corporation - initial implementation and documentation #
#########################################################################
source.. = src/
output.. = bin/
bin.includes = plugin.xml,\
META-INF/,\
.,\
html/,\
*.xml

View File

@ -1,470 +1,470 @@
/*************************************************************************/
/* Copyright (c) 2016 Intel Corporation. */
/* */
/* All rights reserved. This program and the accompanying materials */
/* are made available under the terms of the Eclipse Public License v1.0 */
/* which accompanies this distribution, and is available at */
/* http://www.eclipse.org/legal/epl-v10.html */
/* */
/* Contributors: */
/* Intel Corporation - initial implementation and documentation */
/*************************************************************************/
/*<meta />*/
/*begin-old-version{{*/
body
{
color: #333333;
background-color: #ffffff;
font-family: "Intel Clear", Verdana, Arial, sans-serif;
margin-left: 30px;
margin-right: 30px;
margin-bottom: 7%;
color: #333333;
background-color: #ffffff;
font-family: "Intel Clear", Verdana, Arial, sans-serif;
margin-left: 30px;
margin-right: 30px;
margin-bottom: 7%;
font-size: 12pt;
}
.RevUpdate
{
background-color: #FFFF99;
font-weight: normal;
line-height: 100%;
background-color: #FFFF99;
font-weight: normal;
line-height: 100%;
}
.NonStdFortran
{
color: #007F00;
color: #007F00;
}
body.OH_VSIP_body
{
margin-left: 30px;
margin-left: 30px;
}
DIV.OH_outerContent
{
border: 0px none #FFFFFF;
border: 0px none #ffffff;
}
h1
{
color: #0071c5;
font-size: 15pt;
font-weight: normal;
padding-bottom: 1px;
margin-left: 0pt;
margin-bottom: 0px;
color: #0071c5;
font-size: 15pt;
font-weight: normal;
padding-bottom: 1px;
margin-left: 0pt;
margin-bottom: 0px;
}
h1.firsttitle
{
font-weight: normal;
border-bottom: 0 none;
margin-left: 0;
font-size: 18pt;
border-bottom: 1px solid #0071c5;
line-height: 100%;
padding-bottom: 10px;
margin-bottom: 20px;
margin-top: 20px;
font-weight: normal;
border-bottom: 0 none;
margin-left: 0;
font-size: 18pt;
border-bottom: 1px solid #0071c5;
line-height: 100%;
padding-bottom: 10px;
margin-bottom: 20px;
margin-top: 20px;
}
h2
{
color: #0071c5;
margin-top: 15pt;
margin-bottom: 5pt;
font-size: 12pt;
color: #0071c5;
margin-top: 15pt;
margin-bottom: 5pt;
font-size: 12pt;
}
h3
{
color: #333333;
font-weight: bold;
margin-top: 15pt;
margin-bottom: 5pt;
font-size: 11pt;
color: #333333;
font-weight: bold;
margin-top: 15pt;
margin-bottom: 5pt;
font-size: 11pt;
}
h4
{
color: #0071c5;
margin-top: 10pt;
margin-bottom: 5pt;
padding-left: 0px;
font-size: 10pt;
color: #0071c5;
margin-top: 10pt;
margin-bottom: 5pt;
padding-left: 0px;
font-size: 10pt;
}
h5
{
color: #0071c5;
margin-top: 10pt;
margin-bottom: 5pt;
padding-left: 0px;
font-size: 10pt;
color: #0071c5;
margin-top: 10pt;
margin-bottom: 5pt;
padding-left: 0px;
font-size: 10pt;
}
h6
{
color: #0071c5;
margin-top: 10pt;
margin-bottom: 5pt;
padding-left: 0px;
font-size: 10pt;
color: #0071c5;
margin-top: 10pt;
margin-bottom: 5pt;
padding-left: 0px;
font-size: 10pt;
}
.relinfo
{
padding-left: 30px;
padding-left: 30px;
}
.tablecap
{
color: #0071c5;
}
caption
{
font-weight: bold;
text-align: left;
font-weight: bold;
text-align: left;
font-size: 12pt;
}
.figcap
{
margin-left: 24px;
font-size: 10pt;
font-weight: bold;
text-align: center;
margin-left: 24px;
font-size: 10pt;
font-weight: bold;
text-align: center;
}
.sectiontitle
{
padding-left: 0px;
padding-left: 0px;
}
.linklist
{
padding-left: 0px;
padding-left: 0px;
}
h1.topictitle1
{
color: #0071c5;
font-size: 18pt;
margin-left: 0pt;
margin-bottom: 15px;
color: #0071c5;
font-size: 18pt;
margin-left: 0pt;
margin-bottom: 15px;
}
#header_text
{
color: #0071C5;
text-align: right;
color: #0071C5;
text-align: right;
}
.titlepage
{
margin-right: 15%;
margin-right: 15%;
}
.familylinks
{
margin-top: 1em;
margin-top: 1em;
}
a.start
{
font-size: 18pt;
text-decoration: underline;
font-size: 18pt;
text-decoration: underline;
}
a.underlined
{
text-decoration: underline;
text-decoration: underline;
}
.shortdesc
{
font-size: inherit;
padding-left: inherit;
line-height: 16pt;
margin-top: 0px;
margin-bottom: 0.5em;
font-size: inherit;
padding-left: inherit;
line-height: 16pt;
margin-top: 0px;
margin-bottom: 0.5em;
}
.shortdesc-it
{
font-style: italic;
font-style: italic;
}
p
{
margin-left: 0px;
line-height: 120%;
margin-top: 0;
margin-bottom: 10px;
margin-left: 0px;
line-height: 120%;
margin-top: 0;
margin-bottom: 10px;
font-size: 12pt;
}
.p
{
font-size: inherit;
margin-left: 0px;
line-height: 170%;
margin-top: 0;
margin-bottom: 5pt;
padding-left: 0pt;
font-size: inherit;
margin-left: 0px;
line-height: 170%;
margin-top: 0;
margin-bottom: 5pt;
padding-left: 0pt;
}
table
{
margin-bottom: 5pt;
border-collapse: collapse;
margin-left: 0px;
margin-top: 0.3em;
font-size: 10pt;
margin-bottom: 5pt;
border-collapse: collapse;
margin-left: 0px;
margin-top: 0.3em;
font-size: 10pt;
}
tr
{
vertical-align: top;
vertical-align: top;
}
DIV.Note
{
margin-top: 20pt;
margin-bottom: 20pt;
margin-right: 0.46cm;
padding-left: 5px;
border-top-style: solid;
border-top-width: 1px;
border-bottom-style: solid;
border-bottom-width: 1px;
font-size: 10pt;
}
p.NoteTipHead
{
font-weight: bold;
font-style: italic;
margin-top: 9pt;
margin-bottom: 3pt;
line-height: 15pt;
margin-left: 0.202cm;
font-family: "Verdana", "sans-serif";
text-transform: uppercase;
text-align: justify;
font-size: 12pt;
}
MadCap|xref
{
color: #0860a8;
mc-format: '{paratext}';
text-decoration: none;
font-size: 12pt;
}
div.NoteCont
{
border-bottom-style: solid;
border-bottom-width: 1px;
border-top-style: solid;
border-top-width: 1px;
font-size: 10pt;
}
p.figcap
{
text-align: left;
font-size: 12pt;
}
th
{
text-align: left;
font-size: 12pt;
}
ul
{
font-size: 12pt;
}
ol
{
font-size: 12pt;
}
li
{
font-size: 12pt;
}
b
{
font-size: 12pt;
}
code
{
font-size: 12pt;
}
a:link
{
color: #0071c5;
text-decoration: none;
color: #0071c5;
text-decoration: none;
}
a:visited
{
color: #0071c5;
text-decoration: none;
color: #0071c5;
text-decoration: none;
}
a:hover
{
color: #00aeef;
text-decoration: underline;
color: #00aeef;
text-decoration: underline;
}
a:active
{
color: #0071c5;
text-decoration: underline;
color: #0071c5;
text-decoration: underline;
}
a.start:visited
{
color: #0071c5;
text-decoration: underline;
color: #0071c5;
text-decoration: underline;
}
a.start:active
{
color: #0071c5;
text-decoration: underline;
color: #0071c5;
text-decoration: underline;
}
a.underlined:visited
{
color: #0071c5;
text-decoration: underline;
color: #0071c5;
text-decoration: underline;
}
a.underlined:active
{
color: #0071c5;
text-decoration: underline;
color: #0071c5;
text-decoration: underline;
}
/*************************************************************************/
/* Copyright (c) 2016 Intel Corporation. */
/* */
/* All rights reserved. This program and the accompanying materials */
/* are made available under the terms of the Eclipse Public License v1.0 */
/* which accompanies this distribution, and is available at */
/* http://www.eclipse.org/legal/epl-v10.html */
/* */
/* Contributors: */
/* Intel Corporation - initial implementation and documentation */
/*************************************************************************/
/*<meta />*/
/*begin-old-version{{*/
body
{
color: #333333;
background-color: #ffffff;
font-family: "Intel Clear", Verdana, Arial, sans-serif;
margin-left: 30px;
margin-right: 30px;
margin-bottom: 7%;
color: #333333;
background-color: #ffffff;
font-family: "Intel Clear", Verdana, Arial, sans-serif;
margin-left: 30px;
margin-right: 30px;
margin-bottom: 7%;
font-size: 12pt;
}
.RevUpdate
{
background-color: #FFFF99;
font-weight: normal;
line-height: 100%;
background-color: #FFFF99;
font-weight: normal;
line-height: 100%;
}
.NonStdFortran
{
color: #007F00;
color: #007F00;
}
body.OH_VSIP_body
{
margin-left: 30px;
margin-left: 30px;
}
DIV.OH_outerContent
{
border: 0px none #FFFFFF;
border: 0px none #ffffff;
}
h1
{
color: #0071c5;
font-size: 15pt;
font-weight: normal;
padding-bottom: 1px;
margin-left: 0pt;
margin-bottom: 0px;
color: #0071c5;
font-size: 15pt;
font-weight: normal;
padding-bottom: 1px;
margin-left: 0pt;
margin-bottom: 0px;
}
h1.firsttitle
{
font-weight: normal;
border-bottom: 0 none;
margin-left: 0;
font-size: 18pt;
border-bottom: 1px solid #0071c5;
line-height: 100%;
padding-bottom: 10px;
margin-bottom: 20px;
margin-top: 20px;
font-weight: normal;
border-bottom: 0 none;
margin-left: 0;
font-size: 18pt;
border-bottom: 1px solid #0071c5;
line-height: 100%;
padding-bottom: 10px;
margin-bottom: 20px;
margin-top: 20px;
}
h2
{
color: #0071c5;
margin-top: 15pt;
margin-bottom: 5pt;
font-size: 12pt;
color: #0071c5;
margin-top: 15pt;
margin-bottom: 5pt;
font-size: 12pt;
}
h3
{
color: #333333;
font-weight: bold;
margin-top: 15pt;
margin-bottom: 5pt;
font-size: 11pt;
color: #333333;
font-weight: bold;
margin-top: 15pt;
margin-bottom: 5pt;
font-size: 11pt;
}
h4
{
color: #0071c5;
margin-top: 10pt;
margin-bottom: 5pt;
padding-left: 0px;
font-size: 10pt;
color: #0071c5;
margin-top: 10pt;
margin-bottom: 5pt;
padding-left: 0px;
font-size: 10pt;
}
h5
{
color: #0071c5;
margin-top: 10pt;
margin-bottom: 5pt;
padding-left: 0px;
font-size: 10pt;
color: #0071c5;
margin-top: 10pt;
margin-bottom: 5pt;
padding-left: 0px;
font-size: 10pt;
}
h6
{
color: #0071c5;
margin-top: 10pt;
margin-bottom: 5pt;
padding-left: 0px;
font-size: 10pt;
color: #0071c5;
margin-top: 10pt;
margin-bottom: 5pt;
padding-left: 0px;
font-size: 10pt;
}
.relinfo
{
padding-left: 30px;
padding-left: 30px;
}
.tablecap
{
color: #0071c5;
}
caption
{
font-weight: bold;
text-align: left;
font-weight: bold;
text-align: left;
font-size: 12pt;
}
.figcap
{
margin-left: 24px;
font-size: 10pt;
font-weight: bold;
text-align: center;
margin-left: 24px;
font-size: 10pt;
font-weight: bold;
text-align: center;
}
.sectiontitle
{
padding-left: 0px;
padding-left: 0px;
}
.linklist
{
padding-left: 0px;
padding-left: 0px;
}
h1.topictitle1
{
color: #0071c5;
font-size: 18pt;
margin-left: 0pt;
margin-bottom: 15px;
color: #0071c5;
font-size: 18pt;
margin-left: 0pt;
margin-bottom: 15px;
}
#header_text
{
color: #0071C5;
text-align: right;
color: #0071C5;
text-align: right;
}
.titlepage
{
margin-right: 15%;
margin-right: 15%;
}
.familylinks
{
margin-top: 1em;
margin-top: 1em;
}
a.start
{
font-size: 18pt;
text-decoration: underline;
font-size: 18pt;
text-decoration: underline;
}
a.underlined
{
text-decoration: underline;
text-decoration: underline;
}
.shortdesc
{
font-size: inherit;
padding-left: inherit;
line-height: 16pt;
margin-top: 0px;
margin-bottom: 0.5em;
font-size: inherit;
padding-left: inherit;
line-height: 16pt;
margin-top: 0px;
margin-bottom: 0.5em;
}
.shortdesc-it
{
font-style: italic;
font-style: italic;
}
p
{
margin-left: 0px;
line-height: 120%;
margin-top: 0;
margin-bottom: 10px;
margin-left: 0px;
line-height: 120%;
margin-top: 0;
margin-bottom: 10px;
font-size: 12pt;
}
.p
{
font-size: inherit;
margin-left: 0px;
line-height: 170%;
margin-top: 0;
margin-bottom: 5pt;
padding-left: 0pt;
font-size: inherit;
margin-left: 0px;
line-height: 170%;
margin-top: 0;
margin-bottom: 5pt;
padding-left: 0pt;
}
table
{
margin-bottom: 5pt;
border-collapse: collapse;
margin-left: 0px;
margin-top: 0.3em;
font-size: 10pt;
margin-bottom: 5pt;
border-collapse: collapse;
margin-left: 0px;
margin-top: 0.3em;
font-size: 10pt;
}
tr
{
vertical-align: top;
vertical-align: top;
}
DIV.Note
{
margin-top: 20pt;
margin-bottom: 20pt;
margin-right: 0.46cm;
padding-left: 5px;
border-top-style: solid;
border-top-width: 1px;
border-bottom-style: solid;
border-bottom-width: 1px;
font-size: 10pt;
}
p.NoteTipHead
{
font-weight: bold;
font-style: italic;
margin-top: 9pt;
margin-bottom: 3pt;
line-height: 15pt;
margin-left: 0.202cm;
font-family: "Verdana", "sans-serif";
text-transform: uppercase;
text-align: justify;
font-size: 12pt;
}
MadCap|xref
{
color: #0860a8;
mc-format: '{paratext}';
text-decoration: none;
font-size: 12pt;
}
div.NoteCont
{
border-bottom-style: solid;
border-bottom-width: 1px;
border-top-style: solid;
border-top-width: 1px;
font-size: 10pt;
}
p.figcap
{
text-align: left;
font-size: 12pt;
}
th
{
text-align: left;
font-size: 12pt;
}
ul
{
font-size: 12pt;
}
ol
{
font-size: 12pt;
}
li
{
font-size: 12pt;
}
b
{
font-size: 12pt;
}
code
{
font-size: 12pt;
}
a:link
{
color: #0071c5;
text-decoration: none;
color: #0071c5;
text-decoration: none;
}
a:visited
{
color: #0071c5;
text-decoration: none;
color: #0071c5;
text-decoration: none;
}
a:hover
{
color: #00aeef;
text-decoration: underline;
color: #00aeef;
text-decoration: underline;
}
a:active
{
color: #0071c5;
text-decoration: underline;
color: #0071c5;
text-decoration: underline;
}
a.start:visited
{
color: #0071c5;
text-decoration: underline;
color: #0071c5;
text-decoration: underline;
}
a.start:active
{
color: #0071c5;
text-decoration: underline;
color: #0071c5;
text-decoration: underline;
}
a.underlined:visited
{
color: #0071c5;
text-decoration: underline;
color: #0071c5;
text-decoration: underline;
}
a.underlined:active
{
color: #0071c5;
text-decoration: underline;
color: #0071c5;
text-decoration: underline;
}

View File

@ -1,24 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- -->
<!-- Copyright (c) 2016 Intel Corporation. -->
<!-- -->
<!-- All rights reserved. This program and the accompanying materials -->
<!-- are made available under the terms of the Eclipse Public License v1.0 -->
<!-- which accompanies this distribution, and is available at -->
<!-- http://www.eclipse.org/legal/epl-v10.html -->
<!-- -->
<!-- Contributors: -->
<!-- Intel Corporation - initial implementation and documentation -->
<!-- -->
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.help.toc">
<toc
file="toc.xml"
primary="true">
</toc>
</extension>
</plugin>
<?xml version="1.0" encoding="UTF-8"?>
<!-- -->
<!-- Copyright (c) 2016 Intel Corporation. -->
<!-- -->
<!-- All rights reserved. This program and the accompanying materials -->
<!-- are made available under the terms of the Eclipse Public License v1.0 -->
<!-- which accompanies this distribution, and is available at -->
<!-- http://www.eclipse.org/legal/epl-v10.html -->
<!-- -->
<!-- Contributors: -->
<!-- Intel Corporation - initial implementation and documentation -->
<!-- -->
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.help.toc">
<toc
file="toc.xml"
primary="true">
</toc>
</extension>
</plugin>

View File

@ -1,73 +1,73 @@
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016 Intel Corporation. //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v1.0 //
// which accompanies this distribution, and is available at //
// http://www.eclipse.org/legal/epl-v10.html //
// //
// Contributors: //
// Intel Corporation - initial implementation and documentation //
///////////////////////////////////////////////////////////////////////////
package com.intel.sgx.userguide;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
*/
public class Activator extends AbstractUIPlugin {
// The plug-in ID
public static final String PLUGIN_ID = "com.intel.sgx.userguide"; //$NON-NLS-1$
// The shared instance
private static Activator plugin;
/**
* The constructor
*/
public Activator() {
}
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
}
/**
* Returns the shared instance
*
* @return the shared instance
*/
public static Activator getDefault() {
return plugin;
}
/**
* Returns an image descriptor for the image file at the given
* plug-in relative path
*
* @param path the path
* @return the image descriptor
*/
public static ImageDescriptor getImageDescriptor(String path) {
return imageDescriptorFromPlugin(PLUGIN_ID, path);
}
}
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016 Intel Corporation. //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v1.0 //
// which accompanies this distribution, and is available at //
// http://www.eclipse.org/legal/epl-v10.html //
// //
// Contributors: //
// Intel Corporation - initial implementation and documentation //
///////////////////////////////////////////////////////////////////////////
package com.intel.sgx.userguide;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
*/
public class Activator extends AbstractUIPlugin {
// The plug-in ID
public static final String PLUGIN_ID = "com.intel.sgx.userguide"; //$NON-NLS-1$
// The shared instance
private static Activator plugin;
/**
* The constructor
*/
public Activator() {
}
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
}
/**
* Returns the shared instance
*
* @return the shared instance
*/
public static Activator getDefault() {
return plugin;
}
/**
* Returns an image descriptor for the image file at the given
* plug-in relative path
*
* @param path the path
* @return the image descriptor
*/
public static ImageDescriptor getImageDescriptor(String path) {
return imageDescriptorFromPlugin(PLUGIN_ID, path);
}
}

View File

@ -1,24 +1,24 @@
#########################################################################
# Copyright (c) 2016 Intel Corporation. #
# #
# All rights reserved. This program and the accompanying materials #
# are made available under the terms of the Eclipse Public License v1.0 #
# which accompanies this distribution, and is available at #
# http://www.eclipse.org/legal/epl-v10.html #
# #
# Contributors: #
# Intel Corporation - initial implementation and documentation #
#########################################################################
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
templates/,\
discovery/,\
build.properties,\
OSGI-INF/,\
OSGI-INF/l10n/bundle.properties
jre.compilation.profile = JavaSE-1.8
#########################################################################
# Copyright (c) 2016 Intel Corporation. #
# #
# All rights reserved. This program and the accompanying materials #
# are made available under the terms of the Eclipse Public License v1.0 #
# which accompanies this distribution, and is available at #
# http://www.eclipse.org/legal/epl-v10.html #
# #
# Contributors: #
# Intel Corporation - initial implementation and documentation #
#########################################################################
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
templates/,\
discovery/,\
build.properties,\
OSGI-INF/,\
OSGI-INF/l10n/bundle.properties
jre.compilation.profile = JavaSE-1.8

View File

@ -1,75 +1,75 @@
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016 Intel Corporation. //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v1.0 //
// which accompanies this distribution, and is available at //
// http://www.eclipse.org/legal/epl-v10.html //
// //
// Contributors: //
// Intel Corporation - initial implementation and documentation //
///////////////////////////////////////////////////////////////////////////
package com.intel.sgx;
import java.net.URL;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
*/
public class Activator extends AbstractUIPlugin {
public static final String PLUGIN_ID = "com.intel.sgx";//$NON-NLS-1$
private static Activator plugin;
public Activator() {
}
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
}
public static Activator getDefault() {
return plugin;
}
public static ImageDescriptor getImageDescriptor(String path) {
return imageDescriptorFromPlugin(PLUGIN_ID, path);
}
public static void log(Exception e) {
plugin.getLog().log(newStatus(e));
}
public static IStatus newStatus(Exception e) {
return new Status(IStatus.ERROR, PLUGIN_ID, e.getMessage(), e);
}
public static URL findFile(Path path) {
return FileLocator.find(plugin.getBundle(), path, null);
}
public static Bundle getBundle(String id){
for(Bundle bundle : plugin.getBundle().getBundleContext().getBundles()){
if(bundle.getSymbolicName().equals(id))
return bundle;
}
return null;
}
}
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016 Intel Corporation. //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v1.0 //
// which accompanies this distribution, and is available at //
// http://www.eclipse.org/legal/epl-v10.html //
// //
// Contributors: //
// Intel Corporation - initial implementation and documentation //
///////////////////////////////////////////////////////////////////////////
package com.intel.sgx;
import java.net.URL;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
*/
public class Activator extends AbstractUIPlugin {
public static final String PLUGIN_ID = "com.intel.sgx";//$NON-NLS-1$
private static Activator plugin;
public Activator() {
}
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
}
public static Activator getDefault() {
return plugin;
}
public static ImageDescriptor getImageDescriptor(String path) {
return imageDescriptorFromPlugin(PLUGIN_ID, path);
}
public static void log(Exception e) {
plugin.getLog().log(newStatus(e));
}
public static IStatus newStatus(Exception e) {
return new Status(IStatus.ERROR, PLUGIN_ID, e.getMessage(), e);
}
public static URL findFile(Path path) {
return FileLocator.find(plugin.getBundle(), path, null);
}
public static Bundle getBundle(String id){
for(Bundle bundle : plugin.getBundle().getBundleContext().getBundles()){
if(bundle.getSymbolicName().equals(id))
return bundle;
}
return null;
}
}

View File

@ -1,46 +1,46 @@
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016 Intel Corporation. //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v1.0 //
// which accompanies this distribution, and is available at //
// http://www.eclipse.org/legal/epl-v10.html //
// //
// Contributors: //
// Intel Corporation - initial implementation and documentation //
///////////////////////////////////////////////////////////////////////////
package com.intel.sgx;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
import org.eclipse.cdt.core.settings.model.extension.CConfigurationDataProvider;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
public class CConfigurationDataProvider2 extends CConfigurationDataProvider {
public CConfigurationDataProvider2() {
}
@Override
public CConfigurationData loadConfiguration(ICConfigurationDescription des,
IProgressMonitor monitor) throws CoreException {
return null;
}
@Override
public CConfigurationData createConfiguration(
ICConfigurationDescription des,
ICConfigurationDescription baseDescription,
CConfigurationData baseData, boolean clone, IProgressMonitor monitor)
throws CoreException {
return null;
}
@Override
public void removeConfiguration(ICConfigurationDescription des,
CConfigurationData data, IProgressMonitor monitor) {
}
}
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016 Intel Corporation. //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v1.0 //
// which accompanies this distribution, and is available at //
// http://www.eclipse.org/legal/epl-v10.html //
// //
// Contributors: //
// Intel Corporation - initial implementation and documentation //
///////////////////////////////////////////////////////////////////////////
package com.intel.sgx;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
import org.eclipse.cdt.core.settings.model.extension.CConfigurationDataProvider;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
public class CConfigurationDataProvider2 extends CConfigurationDataProvider {
public CConfigurationDataProvider2() {
}
@Override
public CConfigurationData loadConfiguration(ICConfigurationDescription des,
IProgressMonitor monitor) throws CoreException {
return null;
}
@Override
public CConfigurationData createConfiguration(
ICConfigurationDescription des,
ICConfigurationDescription baseDescription,
CConfigurationData baseData, boolean clone, IProgressMonitor monitor)
throws CoreException {
return null;
}
@Override
public void removeConfiguration(ICConfigurationDescription des,
CConfigurationData data, IProgressMonitor monitor) {
}
}

View File

@ -1,70 +1,70 @@
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016 Intel Corporation. //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v1.0 //
// which accompanies this distribution, and is available at //
// http://www.eclipse.org/legal/epl-v10.html //
// //
// Contributors: //
// Intel Corporation - initial implementation and documentation //
///////////////////////////////////////////////////////////////////////////
package com.intel.sgx;
import java.io.File;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.variableresolvers.PathVariableResolver;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.preference.IPreferenceStore;
import com.intel.sgx.preferences.PreferenceConstants;
import com.intel.sgx.preferences.SGXPreferencePage;
public class SdkPathVariableProvider extends PathVariableResolver {
public SdkPathVariableProvider() {
super();
}
@Override
public String[] getVariableNames(String variable, IResource resource) {
String variableNames[] = {"SGX_SDK_DIR_PATH"};
return (variableNames);
}
@Override
public String getValue(String variable, IResource resource) {
if(variable.equals("SGX_SDK_DIR_PATH")) {
IPreferenceStore store = Activator.getDefault().getPreferenceStore();
String SDKPath = store.getString(PreferenceConstants.SDK_PATH);
IPath SDKCanonicalPath= new Path(SDKPath);
return(SDKCanonicalPath.append("Include").toOSString());
}
return null;
}
public static String getSGXSdkLocation() {
return Activator.getDefault().getPreferenceStore().getString(PreferenceConstants.SDK_PATH);
}
public static boolean isSGXSdkLocationValid() {
String location = getSGXSdkLocation();
if (location.length() == 0)
return false;
return isValidSGXSdkLocation(location);
}
public static boolean isValidSGXSdkLocation(String location) {
File dir = new File(location);
if (!dir.isDirectory())
return false;
return new PreferenceConstants.SGXSDK64Descriptor(dir).getSignerPath().canExecute()
|| new PreferenceConstants.SGXSDK32Descriptor(dir).getSignerPath().canExecute();
}
}
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016 Intel Corporation. //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v1.0 //
// which accompanies this distribution, and is available at //
// http://www.eclipse.org/legal/epl-v10.html //
// //
// Contributors: //
// Intel Corporation - initial implementation and documentation //
///////////////////////////////////////////////////////////////////////////
package com.intel.sgx;
import java.io.File;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.variableresolvers.PathVariableResolver;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.preference.IPreferenceStore;
import com.intel.sgx.preferences.PreferenceConstants;
import com.intel.sgx.preferences.SGXPreferencePage;
public class SdkPathVariableProvider extends PathVariableResolver {
public SdkPathVariableProvider() {
super();
}
@Override
public String[] getVariableNames(String variable, IResource resource) {
String variableNames[] = {"SGX_SDK_DIR_PATH"};
return (variableNames);
}
@Override
public String getValue(String variable, IResource resource) {
if(variable.equals("SGX_SDK_DIR_PATH")) {
IPreferenceStore store = Activator.getDefault().getPreferenceStore();
String SDKPath = store.getString(PreferenceConstants.SDK_PATH);
IPath SDKCanonicalPath= new Path(SDKPath);
return(SDKCanonicalPath.append("Include").toOSString());
}
return null;
}
public static String getSGXSdkLocation() {
return Activator.getDefault().getPreferenceStore().getString(PreferenceConstants.SDK_PATH);
}
public static boolean isSGXSdkLocationValid() {
String location = getSGXSdkLocation();
if (location.length() == 0)
return false;
return isValidSGXSdkLocation(location);
}
public static boolean isValidSGXSdkLocation(String location) {
File dir = new File(location);
if (!dir.isDirectory())
return false;
return new PreferenceConstants.SGXSDK64Descriptor(dir).getSignerPath().canExecute()
|| new PreferenceConstants.SGXSDK32Descriptor(dir).getSignerPath().canExecute();
}
}

View File

@ -1,38 +1,38 @@
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016 Intel Corporation. //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v1.0 //
// which accompanies this distribution, and is available at //
// http://www.eclipse.org/legal/epl-v10.html //
// //
// Contributors: //
// Intel Corporation - initial implementation and documentation //
///////////////////////////////////////////////////////////////////////////
/**
* This class follows the same solution provided in the NDK_PLUGIN for NDKCommandLauncher.
*/
package com.intel.sgx.build;
import org.eclipse.cdt.core.CommandLauncher;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import com.intel.sgx.SdkPathVariableProvider;
/**
* This launches the sgx-ndk-build.
*/
public class SGXSDKCommandLauncher extends CommandLauncher {
@Override
public Process execute(IPath commandPath, String[] args, String[] env, IPath changeToDirectory,
IProgressMonitor monitor)
throws CoreException {
return super.execute(commandPath, args, env, changeToDirectory, monitor);
}
}
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016 Intel Corporation. //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v1.0 //
// which accompanies this distribution, and is available at //
// http://www.eclipse.org/legal/epl-v10.html //
// //
// Contributors: //
// Intel Corporation - initial implementation and documentation //
///////////////////////////////////////////////////////////////////////////
/**
* This class follows the same solution provided in the NDK_PLUGIN for NDKCommandLauncher.
*/
package com.intel.sgx.build;
import org.eclipse.cdt.core.CommandLauncher;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import com.intel.sgx.SdkPathVariableProvider;
/**
* This launches the sgx-ndk-build.
*/
public class SGXSDKCommandLauncher extends CommandLauncher {
@Override
public Process execute(IPath commandPath, String[] args, String[] env, IPath changeToDirectory,
IProgressMonitor monitor)
throws CoreException {
return super.execute(commandPath, args, env, changeToDirectory, monitor);
}
}

View File

@ -1,126 +1,126 @@
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016 Intel Corporation. //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v1.0 //
// which accompanies this distribution, and is available at //
// http://www.eclipse.org/legal/epl-v10.html //
// //
// Contributors: //
// Intel Corporation - initial implementation and documentation //
///////////////////////////////////////////////////////////////////////////
package com.intel.sgx.dialogs;
import javax.swing.JOptionPane;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import com.intel.sgx.handlers.AddEnclave;
public class AddEnclaveFileDialog extends SGXDialogBase {
private Text fileNameField;
private AddEnclave addHandler;
private boolean generateApp = true;
public AddEnclaveFileDialog(Shell shell, AddEnclave addHandler) {
super(shell);
this.addHandler = addHandler;
this.shell = shell;
// setShellStyle(SWT.RESIZE | SWT.TITLE);
}
public boolean generateApp()
{
return generateApp;
}
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
final GridLayout gridLayout = new GridLayout(1,false);
composite.setLayout(gridLayout);
final Group container = new Group(composite, SWT.NONE);
container.setLayout(new GridLayout(3,false));
GridData innergrid1 = new GridData(GridData.FILL_HORIZONTAL);
innergrid1.horizontalSpan = 3;
container.setLayoutData(innergrid1);
addLabel(container, "Enter the name of the Enclave. Make sure the name is unique within the hosting application.");
final Label fileNameLabel = new Label(container, SWT.NONE);
fileNameLabel.setText("Enclave name:");
fileNameLabel.setLayoutData(new GridData(GridData.BEGINNING,GridData.CENTER, false, false));
fileNameField = new Text(container,SWT.SINGLE | SWT.BORDER);
GridData textGridData1 = new GridData(GridData.FILL_HORIZONTAL);
textGridData1.minimumWidth = 400;
textGridData1.grabExcessHorizontalSpace = true;
fileNameField.setLayoutData(textGridData1);
Button generateUntrustedApp = new Button(container, SWT.CHECK);
generateUntrustedApp.setText("Generate sample untrusted application?");
generateUntrustedApp.setLayoutData(new GridData(GridData.BEGINNING, GridData.END, false, false, 3, 1));
generateUntrustedApp.setSelection(true);
generateUntrustedApp.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
Button btn = (Button) event.getSource();
generateApp = btn.getSelection();
}
});
container.layout();
composite.layout();
return composite;
}
@Override
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText("Add New Intel(R) SGX Enclave Dialog");
newShell.layout();
}
@Override
protected
void okPressed() {
addHandler.edlFilename = fileNameField.getText();
if(!fileNameField.getText().isEmpty()
){
if(Character.isDigit(fileNameField.getText().charAt(0)))
{
JOptionPane.showMessageDialog(null, "Enclave names starting with digits are not allowed.", "Error",
JOptionPane.ERROR_MESSAGE);
}
else
super.okPressed();
}
}
@Override
protected Point getInitialSize(){
return new Point(675,200);
}
public String getFileName() {
return fileNameField.getText();
}
}
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016 Intel Corporation. //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v1.0 //
// which accompanies this distribution, and is available at //
// http://www.eclipse.org/legal/epl-v10.html //
// //
// Contributors: //
// Intel Corporation - initial implementation and documentation //
///////////////////////////////////////////////////////////////////////////
package com.intel.sgx.dialogs;
import javax.swing.JOptionPane;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import com.intel.sgx.handlers.AddEnclave;
public class AddEnclaveFileDialog extends SGXDialogBase {
private Text fileNameField;
private AddEnclave addHandler;
private boolean generateApp = true;
public AddEnclaveFileDialog(Shell shell, AddEnclave addHandler) {
super(shell);
this.addHandler = addHandler;
this.shell = shell;
// setShellStyle(SWT.RESIZE | SWT.TITLE);
}
public boolean generateApp()
{
return generateApp;
}
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
final GridLayout gridLayout = new GridLayout(1,false);
composite.setLayout(gridLayout);
final Group container = new Group(composite, SWT.NONE);
container.setLayout(new GridLayout(3,false));
GridData innergrid1 = new GridData(GridData.FILL_HORIZONTAL);
innergrid1.horizontalSpan = 3;
container.setLayoutData(innergrid1);
addLabel(container, "Enter the name of the Enclave. Make sure the name is unique within the hosting application.");
final Label fileNameLabel = new Label(container, SWT.NONE);
fileNameLabel.setText("Enclave name:");
fileNameLabel.setLayoutData(new GridData(GridData.BEGINNING,GridData.CENTER, false, false));
fileNameField = new Text(container,SWT.SINGLE | SWT.BORDER);
GridData textGridData1 = new GridData(GridData.FILL_HORIZONTAL);
textGridData1.minimumWidth = 400;
textGridData1.grabExcessHorizontalSpace = true;
fileNameField.setLayoutData(textGridData1);
Button generateUntrustedApp = new Button(container, SWT.CHECK);
generateUntrustedApp.setText("Generate sample untrusted application?");
generateUntrustedApp.setLayoutData(new GridData(GridData.BEGINNING, GridData.END, false, false, 3, 1));
generateUntrustedApp.setSelection(true);
generateUntrustedApp.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
Button btn = (Button) event.getSource();
generateApp = btn.getSelection();
}
});
container.layout();
composite.layout();
return composite;
}
@Override
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText("Add New Intel(R) SGX Enclave Dialog");
newShell.layout();
}
@Override
protected
void okPressed() {
addHandler.edlFilename = fileNameField.getText();
if(!fileNameField.getText().isEmpty()
){
if(Character.isDigit(fileNameField.getText().charAt(0)))
{
JOptionPane.showMessageDialog(null, "Enclave names starting with digits are not allowed.", "Error",
JOptionPane.ERROR_MESSAGE);
}
else
super.okPressed();
}
}
@Override
protected Point getInitialSize(){
return new Point(675,200);
}
public String getFileName() {
return fileNameField.getText();
}
}

View File

@ -1,109 +1,109 @@
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016 Intel Corporation. //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v1.0 //
// which accompanies this distribution, and is available at //
// http://www.eclipse.org/legal/epl-v10.html //
// //
// Contributors: //
// Intel Corporation - initial implementation and documentation //
///////////////////////////////////////////////////////////////////////////
package com.intel.sgx.dialogs;
import javax.swing.JOptionPane;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import com.intel.sgx.handlers.AddTrustedStaticLib;
public class AddTrustedStaticLibFileDialog extends SGXDialogBase {
private Text fileNameField;
private AddTrustedStaticLib addHandler;
private boolean generateApp = false;
public AddTrustedStaticLibFileDialog(Shell shell, AddTrustedStaticLib addHandler) {
super(shell);
this.addHandler = addHandler;
this.shell = shell;
// setShellStyle(SWT.RESIZE | SWT.TITLE);
}
public boolean generateApp()
{
return generateApp;
}
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
final GridLayout gridLayout = new GridLayout(1,false);
composite.setLayout(gridLayout);
final Group container = new Group(composite, SWT.NONE);
container.setLayout(new GridLayout(3,false));
GridData innergrid1 = new GridData(GridData.FILL_HORIZONTAL);
innergrid1.horizontalSpan = 3;
container.setLayoutData(innergrid1);
addLabel(container, "Enter the name of the Static Trusted Library.");
addLabel(container, "Make sure the name is unique within the hosting application.");
final Label fileNameLabel = new Label(container, SWT.NONE);
fileNameLabel.setText("Static Trusted Library Name:");
fileNameLabel.setLayoutData(new GridData(GridData.BEGINNING,GridData.CENTER, false, false));
fileNameField = new Text(container,SWT.SINGLE | SWT.BORDER);
GridData textGridData1 = new GridData(GridData.FILL_HORIZONTAL);
textGridData1.minimumWidth = 400;
textGridData1.grabExcessHorizontalSpace = true;
fileNameField.setLayoutData(textGridData1);
composite.layout();
return composite;
}
@Override
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText("Add New Intel(R) SGX Static Trusted Library Dialog");
}
@Override
protected
void okPressed(){
addHandler.edlFilename = fileNameField.getText();
if(!fileNameField.getText().isEmpty()
){
if(Character.isDigit(fileNameField.getText().charAt(0)))
{
JOptionPane.showMessageDialog(null, "Enclave names starting with digits are not allowed.", "Error",
JOptionPane.ERROR_MESSAGE);
}
else
super.okPressed();
}
}
@Override
protected Point getInitialSize(){
return new Point(675,200);
}
public String getFileName() {
return fileNameField.getText();
}
}
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016 Intel Corporation. //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v1.0 //
// which accompanies this distribution, and is available at //
// http://www.eclipse.org/legal/epl-v10.html //
// //
// Contributors: //
// Intel Corporation - initial implementation and documentation //
///////////////////////////////////////////////////////////////////////////
package com.intel.sgx.dialogs;
import javax.swing.JOptionPane;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import com.intel.sgx.handlers.AddTrustedStaticLib;
public class AddTrustedStaticLibFileDialog extends SGXDialogBase {
private Text fileNameField;
private AddTrustedStaticLib addHandler;
private boolean generateApp = false;
public AddTrustedStaticLibFileDialog(Shell shell, AddTrustedStaticLib addHandler) {
super(shell);
this.addHandler = addHandler;
this.shell = shell;
// setShellStyle(SWT.RESIZE | SWT.TITLE);
}
public boolean generateApp()
{
return generateApp;
}
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
final GridLayout gridLayout = new GridLayout(1,false);
composite.setLayout(gridLayout);
final Group container = new Group(composite, SWT.NONE);
container.setLayout(new GridLayout(3,false));
GridData innergrid1 = new GridData(GridData.FILL_HORIZONTAL);
innergrid1.horizontalSpan = 3;
container.setLayoutData(innergrid1);
addLabel(container, "Enter the name of the Static Trusted Library.");
addLabel(container, "Make sure the name is unique within the hosting application.");
final Label fileNameLabel = new Label(container, SWT.NONE);
fileNameLabel.setText("Static Trusted Library Name:");
fileNameLabel.setLayoutData(new GridData(GridData.BEGINNING,GridData.CENTER, false, false));
fileNameField = new Text(container,SWT.SINGLE | SWT.BORDER);
GridData textGridData1 = new GridData(GridData.FILL_HORIZONTAL);
textGridData1.minimumWidth = 400;
textGridData1.grabExcessHorizontalSpace = true;
fileNameField.setLayoutData(textGridData1);
composite.layout();
return composite;
}
@Override
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText("Add New Intel(R) SGX Static Trusted Library Dialog");
}
@Override
protected
void okPressed(){
addHandler.edlFilename = fileNameField.getText();
if(!fileNameField.getText().isEmpty()
){
if(Character.isDigit(fileNameField.getText().charAt(0)))
{
JOptionPane.showMessageDialog(null, "Enclave names starting with digits are not allowed.", "Error",
JOptionPane.ERROR_MESSAGE);
}
else
super.okPressed();
}
}
@Override
protected Point getInitialSize(){
return new Point(675,200);
}
public String getFileName() {
return fileNameField.getText();
}
}

View File

@ -1,72 +1,72 @@
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016 Intel Corporation. //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v1.0 //
// which accompanies this distribution, and is available at //
// http://www.eclipse.org/legal/epl-v10.html //
// //
// Contributors: //
// Intel Corporation - initial implementation and documentation //
///////////////////////////////////////////////////////////////////////////
package com.intel.sgx.dialogs;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import com.intel.sgx.handlers.TwoStepSignHandlerBase;
public class TwoStepSignStep1Dialog1 extends TwoStepSignDialogBase {
final private TwoStepSignHandlerBase handler;
public TwoStepSignStep1Dialog1(Shell parentShell, TwoStepSignHandlerBase handler) {
super(parentShell);
this.handler = handler;
}
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
final GridLayout gridLayout = new GridLayout(1, false);
composite.setLayout(gridLayout);
enclaveFileField = addGroup(composite, "Unsigned Enclave Path:",
"Select Enclave for which to generate the Hash.",
"Enclave Path:", "Select Enclave", enclaveFileSelectionListener);
hashFileField = addGroup(composite, "Generate Hash:",
"Select Location to Output Hash File.", "Hash File Location:",
"Select File Path", hashFileSelectionListener);
configFileField = addGroup(composite, "Configuration File:",
"Select Input Configuration XML File. ",
"Configuration File:", "Select Config",
configFileSelectionListener);
composite.pack(true);
return composite;
}
@Override
protected void okPressed() {
handler.enclaveFile = enclaveFileField.getText();
handler.hashFile = hashFileField.getText();
handler.configFile = configFileField.getText();
super.okPressed();
}
@Override
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText("Two Step Enclave Sign - Generate Hash");
}
}
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016 Intel Corporation. //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v1.0 //
// which accompanies this distribution, and is available at //
// http://www.eclipse.org/legal/epl-v10.html //
// //
// Contributors: //
// Intel Corporation - initial implementation and documentation //
///////////////////////////////////////////////////////////////////////////
package com.intel.sgx.dialogs;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import com.intel.sgx.handlers.TwoStepSignHandlerBase;
public class TwoStepSignStep1Dialog1 extends TwoStepSignDialogBase {
final private TwoStepSignHandlerBase handler;
public TwoStepSignStep1Dialog1(Shell parentShell, TwoStepSignHandlerBase handler) {
super(parentShell);
this.handler = handler;
}
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
final GridLayout gridLayout = new GridLayout(1, false);
composite.setLayout(gridLayout);
enclaveFileField = addGroup(composite, "Unsigned Enclave Path:",
"Select Enclave for which to generate the Hash.",
"Enclave Path:", "Select Enclave", enclaveFileSelectionListener);
hashFileField = addGroup(composite, "Generate Hash:",
"Select Location to Output Hash File.", "Hash File Location:",
"Select File Path", hashFileSelectionListener);
configFileField = addGroup(composite, "Configuration File:",
"Select Input Configuration XML File. ",
"Configuration File:", "Select Config",
configFileSelectionListener);
composite.pack(true);
return composite;
}
@Override
protected void okPressed() {
handler.enclaveFile = enclaveFileField.getText();
handler.hashFile = hashFileField.getText();
handler.configFile = configFileField.getText();
super.okPressed();
}
@Override
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText("Two Step Enclave Sign - Generate Hash");
}
}

View File

@ -1,89 +1,89 @@
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016 Intel Corporation. //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v1.0 //
// which accompanies this distribution, and is available at //
// http://www.eclipse.org/legal/epl-v10.html //
// //
// Contributors: //
// Intel Corporation - initial implementation and documentation //
///////////////////////////////////////////////////////////////////////////
package com.intel.sgx.dialogs;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
public class TwoStepSignStep1Dialog2 extends TwoStepSignDialogBase {
final private String hashFile;
public TwoStepSignStep1Dialog2(Shell parentShell, String hashFile) {
super(parentShell);
this.hashFile = hashFile;
}
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
final GridLayout gridLayout = new GridLayout(1,false);
composite.setLayout(gridLayout);
addGroup1(composite);
addGroup3(composite);
return composite;
}
private void addGroup1(Composite composite) {
final Group container = new Group(composite, SWT.None);
container.setLayout(new GridLayout(3,false));
GridData innergrid1 = new GridData(GridData.FILL_HORIZONTAL);
innergrid1.horizontalSpan = 3;
container.setLayoutData(innergrid1);
container.setText("Hash File:");
final Label messageLabel = new Label(container, SWT.NONE);
messageLabel.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 3, 1));
messageLabel.setText("Hash File Generated at Location:");
final Label messageLabel1 = new Label(container, SWT.NONE);
messageLabel1.setText(hashFile);
messageLabel1.setLayoutData(new GridData(GridData.BEGINNING));
}
private void addGroup3(Composite composite) {
final Group container3 = new Group(composite, SWT.None);
container3.setLayout(new GridLayout(3,false));
GridData innergrid3 = new GridData(GridData.FILL_HORIZONTAL);
innergrid3.horizontalSpan = 3;
container3.setLayoutData(innergrid3);
container3.setText("Generate Signed Enclave (Step-2):");
final Label messageLabel4 = new Label(container3, SWT.NONE);
messageLabel4.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 3, 1));
messageLabel4.setText("To Generate Signed Enclave Now: Click OK");
final Label messageLabel5 = new Label(container3, SWT.NONE);
messageLabel5.setLayoutData(new GridData(GridData.CENTER, GridData.END, false, false, 3, 1));
messageLabel5.setText("To Generate Signed Enclave Later: Click Cancel");
}
@Override
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText("Two Step Enclave Sign - Generate Hash");
}
}
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016 Intel Corporation. //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v1.0 //
// which accompanies this distribution, and is available at //
// http://www.eclipse.org/legal/epl-v10.html //
// //
// Contributors: //
// Intel Corporation - initial implementation and documentation //
///////////////////////////////////////////////////////////////////////////
package com.intel.sgx.dialogs;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
public class TwoStepSignStep1Dialog2 extends TwoStepSignDialogBase {
final private String hashFile;
public TwoStepSignStep1Dialog2(Shell parentShell, String hashFile) {
super(parentShell);
this.hashFile = hashFile;
}
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
final GridLayout gridLayout = new GridLayout(1,false);
composite.setLayout(gridLayout);
addGroup1(composite);
addGroup3(composite);
return composite;
}
private void addGroup1(Composite composite) {
final Group container = new Group(composite, SWT.None);
container.setLayout(new GridLayout(3,false));
GridData innergrid1 = new GridData(GridData.FILL_HORIZONTAL);
innergrid1.horizontalSpan = 3;
container.setLayoutData(innergrid1);
container.setText("Hash File:");
final Label messageLabel = new Label(container, SWT.NONE);
messageLabel.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 3, 1));
messageLabel.setText("Hash File Generated at Location:");
final Label messageLabel1 = new Label(container, SWT.NONE);
messageLabel1.setText(hashFile);
messageLabel1.setLayoutData(new GridData(GridData.BEGINNING));
}
private void addGroup3(Composite composite) {
final Group container3 = new Group(composite, SWT.None);
container3.setLayout(new GridLayout(3,false));
GridData innergrid3 = new GridData(GridData.FILL_HORIZONTAL);
innergrid3.horizontalSpan = 3;
container3.setLayoutData(innergrid3);
container3.setText("Generate Signed Enclave (Step-2):");
final Label messageLabel4 = new Label(container3, SWT.NONE);
messageLabel4.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 3, 1));
messageLabel4.setText("To Generate Signed Enclave Now: Click OK");
final Label messageLabel5 = new Label(container3, SWT.NONE);
messageLabel5.setLayoutData(new GridData(GridData.CENTER, GridData.END, false, false, 3, 1));
messageLabel5.setText("To Generate Signed Enclave Later: Click Cancel");
}
@Override
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText("Two Step Enclave Sign - Generate Hash");
}
}

View File

@ -1,105 +1,105 @@
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016 Intel Corporation. //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v1.0 //
// which accompanies this distribution, and is available at //
// http://www.eclipse.org/legal/epl-v10.html //
// //
// Contributors: //
// Intel Corporation - initial implementation and documentation //
///////////////////////////////////////////////////////////////////////////
package com.intel.sgx.dialogs;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import com.intel.sgx.handlers.TwoStepSignHandlerBase;
public class TwoStepSignStep1Dialog3 extends TwoStepSignDialogBase {
final private TwoStepSignHandlerBase handler;
public TwoStepSignStep1Dialog3(Shell parentShell, TwoStepSignHandlerBase handler) {
super(parentShell);
this.handler = handler;
}
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
final GridLayout gridLayout = new GridLayout(1, false);
composite.setLayout(gridLayout);
addInfoGroup(composite);
externalSignPublicKeyFileField = addGroup(composite, "Public Key:",
"Select the Public Key file obtained from signing facility",
"Public Key:", "Select", publicKeyLocationSelectionListener);
externalSignedHashFileField = addGroup(composite, "Signature:",
"Select the Signature file obtained from signing facility.",
"Signature:",
"Select", externalSignedHashFileSelectionListener);
outputSignedEnclaveFileField = addGroup(composite, "Signed Enclave:",
"Select where to save the output Signed Enclave.",
"Signed Enclave:",
"Select", outputSignedEnclaveListener);
return composite;
}
protected void addInfoGroup(Composite composite) {
final Group container = new Group(composite, SWT.None);
container.setLayout(new GridLayout(3,false));
GridData innergrid1 = new GridData(GridData.FILL_HORIZONTAL);
innergrid1.horizontalSpan = 3;
container.setLayoutData(innergrid1);
container.setText("Hash and Enclave:");
addInfoKeyValue(container, "Enclave File:", handler.enclaveFile);
addInfoKeyValue(container, "Config File:", handler.configFile);
addInfoKeyValue(container, "Hash File:", handler.hashFile);
}
private void addInfoKeyValue(final Group container, String key,
String value) {
final Label messageLabel2 = new Label(container, SWT.NONE);
messageLabel2.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 3, 1));
messageLabel2.setText(key);
final Label messageLabel3 = new Label(container, SWT.NONE);
messageLabel3.setText(value);
messageLabel3.setLayoutData(new GridData(GridData.BEGINNING));
}
@Override
protected void okPressed() {
handler.externalSignPublicKeyFile = externalSignPublicKeyFileField.getText();
handler.externallySignedHashFile = externalSignedHashFileField.getText();
handler.outputSignedEnclaveFile = outputSignedEnclaveFileField.getText();
super.okPressed();
}
@Override
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText("Two Step Enclave Sign - Generate Signed Enclave");
}
}
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016 Intel Corporation. //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v1.0 //
// which accompanies this distribution, and is available at //
// http://www.eclipse.org/legal/epl-v10.html //
// //
// Contributors: //
// Intel Corporation - initial implementation and documentation //
///////////////////////////////////////////////////////////////////////////
package com.intel.sgx.dialogs;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import com.intel.sgx.handlers.TwoStepSignHandlerBase;
public class TwoStepSignStep1Dialog3 extends TwoStepSignDialogBase {
final private TwoStepSignHandlerBase handler;
public TwoStepSignStep1Dialog3(Shell parentShell, TwoStepSignHandlerBase handler) {
super(parentShell);
this.handler = handler;
}
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
final GridLayout gridLayout = new GridLayout(1, false);
composite.setLayout(gridLayout);
addInfoGroup(composite);
externalSignPublicKeyFileField = addGroup(composite, "Public Key:",
"Select the Public Key file obtained from signing facility",
"Public Key:", "Select", publicKeyLocationSelectionListener);
externalSignedHashFileField = addGroup(composite, "Signature:",
"Select the Signature file obtained from signing facility.",
"Signature:",
"Select", externalSignedHashFileSelectionListener);
outputSignedEnclaveFileField = addGroup(composite, "Signed Enclave:",
"Select where to save the output Signed Enclave.",
"Signed Enclave:",
"Select", outputSignedEnclaveListener);
return composite;
}
protected void addInfoGroup(Composite composite) {
final Group container = new Group(composite, SWT.None);
container.setLayout(new GridLayout(3,false));
GridData innergrid1 = new GridData(GridData.FILL_HORIZONTAL);
innergrid1.horizontalSpan = 3;
container.setLayoutData(innergrid1);
container.setText("Hash and Enclave:");
addInfoKeyValue(container, "Enclave File:", handler.enclaveFile);
addInfoKeyValue(container, "Config File:", handler.configFile);
addInfoKeyValue(container, "Hash File:", handler.hashFile);
}
private void addInfoKeyValue(final Group container, String key,
String value) {
final Label messageLabel2 = new Label(container, SWT.NONE);
messageLabel2.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 3, 1));
messageLabel2.setText(key);
final Label messageLabel3 = new Label(container, SWT.NONE);
messageLabel3.setText(value);
messageLabel3.setLayoutData(new GridData(GridData.BEGINNING));
}
@Override
protected void okPressed() {
handler.externalSignPublicKeyFile = externalSignPublicKeyFileField.getText();
handler.externallySignedHashFile = externalSignedHashFileField.getText();
handler.outputSignedEnclaveFile = outputSignedEnclaveFileField.getText();
super.okPressed();
}
@Override
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText("Two Step Enclave Sign - Generate Signed Enclave");
}
}

View File

@ -1,92 +1,92 @@
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016 Intel Corporation. //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v1.0 //
// which accompanies this distribution, and is available at //
// http://www.eclipse.org/legal/epl-v10.html //
// //
// Contributors: //
// Intel Corporation - initial implementation and documentation //
///////////////////////////////////////////////////////////////////////////
package com.intel.sgx.dialogs;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import com.intel.sgx.handlers.TwoStepSignHandlerBase;
import com.intel.sgx.handlers.TwoStepSignStep2;
public class TwoStepSignStep2Dialog extends TwoStepSignDialogBase{
final private TwoStepSignHandlerBase handler;
public TwoStepSignStep2Dialog(Shell parentShell, TwoStepSignHandlerBase handler) {
super(parentShell);
this.handler = handler;
}
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
final GridLayout gridLayout = new GridLayout(1,false);
composite.setLayout(gridLayout);
enclaveFileField= addGroup(composite, "Enclave:",
"Select the unsigned enclave file",
"Unsigned Enclave File:", "Select", enclaveFileSelectionListener);
configFileField = addGroup(composite, "Configuration File:",
"Select Input Configuration XML File. ",
"Configuration File:", "Select Config",
configFileSelectionListener);
hashFileField= addGroup(composite, "Hash:",
"Select the Hash file obtained from previous step",
"Hash File:", "Select", hashFileSelectionListener);
externalSignPublicKeyFileField= addGroup(composite, "Public Key:",
"Select the Public Key file obtained from external signing facility",
"Public Key:", "Select", publicKeyLocationSelectionListener);
externalSignedHashFileField = addGroup(composite, "Signature:",
"Select the Signature file obtained from signing facility.",
"Signature:",
"Select", externalSignedHashFileSelectionListener);
outputSignedEnclaveFileField = addGroup(composite, "Signed Enclave:",
"Select where to save the output Signed Enclave.",
"Signed Enclave:",
"Select", outputSignedEnclaveListener);
return composite;
}
@Override
protected void okPressed() {
handler.enclaveFile = enclaveFileField.getText();
handler.hashFile = hashFileField.getText();
handler.configFile = configFileField.getText();
handler.externalSignPublicKeyFile = externalSignPublicKeyFileField.getText();
handler.externallySignedHashFile = externalSignedHashFileField.getText();
handler.outputSignedEnclaveFile = outputSignedEnclaveFileField.getText();
super.okPressed();
}
@Override
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText("Two Step Enclave Sign - Generate Signed Enclave");
}
}
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016 Intel Corporation. //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v1.0 //
// which accompanies this distribution, and is available at //
// http://www.eclipse.org/legal/epl-v10.html //
// //
// Contributors: //
// Intel Corporation - initial implementation and documentation //
///////////////////////////////////////////////////////////////////////////
package com.intel.sgx.dialogs;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import com.intel.sgx.handlers.TwoStepSignHandlerBase;
import com.intel.sgx.handlers.TwoStepSignStep2;
public class TwoStepSignStep2Dialog extends TwoStepSignDialogBase{
final private TwoStepSignHandlerBase handler;
public TwoStepSignStep2Dialog(Shell parentShell, TwoStepSignHandlerBase handler) {
super(parentShell);
this.handler = handler;
}
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
final GridLayout gridLayout = new GridLayout(1,false);
composite.setLayout(gridLayout);
enclaveFileField= addGroup(composite, "Enclave:",
"Select the unsigned enclave file",
"Unsigned Enclave File:", "Select", enclaveFileSelectionListener);
configFileField = addGroup(composite, "Configuration File:",
"Select Input Configuration XML File. ",
"Configuration File:", "Select Config",
configFileSelectionListener);
hashFileField= addGroup(composite, "Hash:",
"Select the Hash file obtained from previous step",
"Hash File:", "Select", hashFileSelectionListener);
externalSignPublicKeyFileField= addGroup(composite, "Public Key:",
"Select the Public Key file obtained from external signing facility",
"Public Key:", "Select", publicKeyLocationSelectionListener);
externalSignedHashFileField = addGroup(composite, "Signature:",
"Select the Signature file obtained from signing facility.",
"Signature:",
"Select", externalSignedHashFileSelectionListener);
outputSignedEnclaveFileField = addGroup(composite, "Signed Enclave:",
"Select where to save the output Signed Enclave.",
"Signed Enclave:",
"Select", outputSignedEnclaveListener);
return composite;
}
@Override
protected void okPressed() {
handler.enclaveFile = enclaveFileField.getText();
handler.hashFile = hashFileField.getText();
handler.configFile = configFileField.getText();
handler.externalSignPublicKeyFile = externalSignPublicKeyFileField.getText();
handler.externallySignedHashFile = externalSignedHashFileField.getText();
handler.outputSignedEnclaveFile = outputSignedEnclaveFileField.getText();
super.okPressed();
}
@Override
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText("Two Step Enclave Sign - Generate Signed Enclave");
}
}

View File

@ -1,202 +1,202 @@
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016 Intel Corporation. //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v1.0 //
// which accompanies this distribution, and is available at //
// http://www.eclipse.org/legal/epl-v10.html //
// //
// Contributors: //
// Intel Corporation - initial implementation and documentation //
///////////////////////////////////////////////////////////////////////////
package com.intel.sgx.discovery;
import java.util.List;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo;
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredScannerInfoSerializable;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import com.intel.sgx.Activator;
/*
* This code has been taken from the NDK plugin for Linux. If there is an update to this code there, then refactor this code.
*/
public class SGXSDKDiscoveredPathInfo implements IDiscoveredPathInfo {
private final IProject mProject;
private long mLastUpdate = IFile.NULL_STAMP;
private IPath[] mIncludePaths;
private Map<String, String> mSymbols;
private boolean mNeedReindexing = false;
private static final IPath LINUX_MK = new Path("sgx/Makefile");
//Keys for preferences
// public static final String LAST_UPDATE = "lastUpdate"; //$NON-NLS-1$
public SGXSDKDiscoveredPathInfo(IProject project) {
this.mProject = project;
load();
}
@Override
public IProject getProject() {
return mProject;
}
@Override
public IPath[] getIncludePaths() {
if (mNeedReindexing) {
CCorePlugin.getIndexManager().reindex(CoreModel.getDefault().create(mProject));
mNeedReindexing = false;
}
return mIncludePaths;
}
void setIncludePaths(List<String> pathStrings) {
mIncludePaths = new IPath[pathStrings.size()];
int i = 0;
for (String path : pathStrings)
mIncludePaths[i++] = new Path(path);
mNeedReindexing = true;
}
@Override
public Map<String, String> getSymbols() {
if (mSymbols == null)
mSymbols = new HashMap<String, String>();
return mSymbols;
}
void setSymbols(Map<String, String> symbols) {
this.mSymbols = symbols;
}
@Override
public IDiscoveredScannerInfoSerializable getSerializable() {
return null;
}
public void update(IProgressMonitor monitor) throws CoreException {
if (!needUpdating())
return;
new SGXSDKDiscoveryUpdater(this).runUpdate(monitor);
if (mIncludePaths != null && mSymbols != null) {
recordUpdate();
save();
}
}
private boolean needUpdating() {
if (mLastUpdate == IFile.NULL_STAMP) {
return true;
}
return mProject.getFile(LINUX_MK).getLocalTimeStamp() > mLastUpdate;
}
private void recordUpdate() {
mLastUpdate = mProject.getFile(LINUX_MK).getLocalTimeStamp();
}
public void delete() {
mLastUpdate = IFile.NULL_STAMP;
}
private File getInfoFile() {
File stateLoc = Activator.getDefault().getStateLocation().toFile();
return new File(stateLoc, mProject.getName() + ".pathInfo"); //$NON-NLS-1$
}
private void save() {
try {
File infoFile = getInfoFile();
infoFile.getParentFile().mkdirs();
PrintStream out = new PrintStream(infoFile);
out.print("t,"); //$NON-NLS-1$
out.print(mLastUpdate);
out.println();
for (IPath include : mIncludePaths) {
out.print("i,"); //$NON-NLS-1$
out.print(include.toPortableString());
out.println();
}
for (Entry<String, String> symbol : mSymbols.entrySet()) {
out.print("d,"); //$NON-NLS-1$
out.print(symbol.getKey());
out.print(","); //$NON-NLS-1$
out.print(symbol.getValue());
out.println();
}
out.close();
} catch (IOException e) {
Activator.log(e);
}
}
private void load() {
try {
File infoFile = getInfoFile();
if (!infoFile.exists())
return;
long timestamp = IFile.NULL_STAMP;
List<IPath> includes = new ArrayList<IPath>();
Map<String, String> defines = new HashMap<String, String>();
BufferedReader reader = new BufferedReader(new FileReader(infoFile));
for (String line = reader.readLine(); line != null; line = reader.readLine()) {
switch (line.charAt(0)) {
case 't':
timestamp = Long.valueOf(line.substring(2));
break;
case 'i':
includes.add(Path.fromPortableString(line.substring(2)));
break;
case 'd':
int n = line.indexOf(',', 2);
if (n == -1)
defines.put(line.substring(2), ""); //$NON-NLS-1$
else
defines.put(line.substring(2, n), line.substring(n + 1));
break;
}
}
reader.close();
mLastUpdate = timestamp;
mIncludePaths = includes.toArray(new IPath[includes.size()]);
mSymbols = defines;
} catch (IOException e) {
Activator.log(e);
}
}
}
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016 Intel Corporation. //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v1.0 //
// which accompanies this distribution, and is available at //
// http://www.eclipse.org/legal/epl-v10.html //
// //
// Contributors: //
// Intel Corporation - initial implementation and documentation //
///////////////////////////////////////////////////////////////////////////
package com.intel.sgx.discovery;
import java.util.List;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo;
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredScannerInfoSerializable;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import com.intel.sgx.Activator;
/*
* This code has been taken from the NDK plugin for Linux. If there is an update to this code there, then refactor this code.
*/
public class SGXSDKDiscoveredPathInfo implements IDiscoveredPathInfo {
private final IProject mProject;
private long mLastUpdate = IFile.NULL_STAMP;
private IPath[] mIncludePaths;
private Map<String, String> mSymbols;
private boolean mNeedReindexing = false;
private static final IPath LINUX_MK = new Path("sgx/Makefile");
//Keys for preferences
// public static final String LAST_UPDATE = "lastUpdate"; //$NON-NLS-1$
public SGXSDKDiscoveredPathInfo(IProject project) {
this.mProject = project;
load();
}
@Override
public IProject getProject() {
return mProject;
}
@Override
public IPath[] getIncludePaths() {
if (mNeedReindexing) {
CCorePlugin.getIndexManager().reindex(CoreModel.getDefault().create(mProject));
mNeedReindexing = false;
}
return mIncludePaths;
}
void setIncludePaths(List<String> pathStrings) {
mIncludePaths = new IPath[pathStrings.size()];
int i = 0;
for (String path : pathStrings)
mIncludePaths[i++] = new Path(path);
mNeedReindexing = true;
}
@Override
public Map<String, String> getSymbols() {
if (mSymbols == null)
mSymbols = new HashMap<String, String>();
return mSymbols;
}
void setSymbols(Map<String, String> symbols) {
this.mSymbols = symbols;
}
@Override
public IDiscoveredScannerInfoSerializable getSerializable() {
return null;
}
public void update(IProgressMonitor monitor) throws CoreException {
if (!needUpdating())
return;
new SGXSDKDiscoveryUpdater(this).runUpdate(monitor);
if (mIncludePaths != null && mSymbols != null) {
recordUpdate();
save();
}
}
private boolean needUpdating() {
if (mLastUpdate == IFile.NULL_STAMP) {
return true;
}
return mProject.getFile(LINUX_MK).getLocalTimeStamp() > mLastUpdate;
}
private void recordUpdate() {
mLastUpdate = mProject.getFile(LINUX_MK).getLocalTimeStamp();
}
public void delete() {
mLastUpdate = IFile.NULL_STAMP;
}
private File getInfoFile() {
File stateLoc = Activator.getDefault().getStateLocation().toFile();
return new File(stateLoc, mProject.getName() + ".pathInfo"); //$NON-NLS-1$
}
private void save() {
try {
File infoFile = getInfoFile();
infoFile.getParentFile().mkdirs();
PrintStream out = new PrintStream(infoFile);
out.print("t,"); //$NON-NLS-1$
out.print(mLastUpdate);
out.println();
for (IPath include : mIncludePaths) {
out.print("i,"); //$NON-NLS-1$
out.print(include.toPortableString());
out.println();
}
for (Entry<String, String> symbol : mSymbols.entrySet()) {
out.print("d,"); //$NON-NLS-1$
out.print(symbol.getKey());
out.print(","); //$NON-NLS-1$
out.print(symbol.getValue());
out.println();
}
out.close();
} catch (IOException e) {
Activator.log(e);
}
}
private void load() {
try {
File infoFile = getInfoFile();
if (!infoFile.exists())
return;
long timestamp = IFile.NULL_STAMP;
List<IPath> includes = new ArrayList<IPath>();
Map<String, String> defines = new HashMap<String, String>();
BufferedReader reader = new BufferedReader(new FileReader(infoFile));
for (String line = reader.readLine(); line != null; line = reader.readLine()) {
switch (line.charAt(0)) {
case 't':
timestamp = Long.valueOf(line.substring(2));
break;
case 'i':
includes.add(Path.fromPortableString(line.substring(2)));
break;
case 'd':
int n = line.indexOf(',', 2);
if (n == -1)
defines.put(line.substring(2), ""); //$NON-NLS-1$
else
defines.put(line.substring(2, n), line.substring(n + 1));
break;
}
}
reader.close();
mLastUpdate = timestamp;
mIncludePaths = includes.toArray(new IPath[includes.size()]);
mSymbols = defines;
} catch (IOException e) {
Activator.log(e);
}
}
}

View File

@ -1,310 +1,310 @@
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016 Intel Corporation. //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v1.0 //
// which accompanies this distribution, and is available at //
// http://www.eclipse.org/legal/epl-v10.html //
// //
// Contributors: //
// Intel Corporation - initial implementation and documentation //
///////////////////////////////////////////////////////////////////////////
package com.intel.sgx.discovery;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
import org.eclipse.cdt.core.envvar.IEnvironmentVariableManager;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.managedbuilder.core.IBuilder;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import com.intel.sgx.Activator;
import com.intel.sgx.build.SGXSDKCommandLauncher;
/*
* This code has been taken from the NDK plugin for Linux. If there is an update to this code there, then refactor this code.
*/
public class SGXSDKDiscoveryUpdater {
private final SGXSDKDiscoveredPathInfo mPathInfo;
private final IProject mProject;
private boolean mCPlusPlus = false;
private String mCommand;
private List<String> mArguments = new ArrayList<String>();
public SGXSDKDiscoveryUpdater(SGXSDKDiscoveredPathInfo pathInfo) {
mPathInfo = pathInfo;
mProject = pathInfo.getProject();
}
public void runUpdate(IProgressMonitor monitor) throws CoreException {
try {
// Run make -nB to get the list of commands
IPath commandPath = new Path("make"); //$NON-NLS-1$
String[] args = {"-f", "sgx/Makefile", "-n", "-B" }; //$NON-NLS-1$
String[] env = calcEnvironment();
File projectDir = new File(mProject.getLocationURI());
IPath changeToDirectory = new Path(projectDir.getAbsolutePath());
Process proc = new SGXSDKCommandLauncher().execute(commandPath, args, env,changeToDirectory, monitor);
if (proc == null) {
return;
}
BufferedReader reader = new BufferedReader(new InputStreamReader(proc.getInputStream()));
String line = reader.readLine();
while (line != null) {
checkBuildLine(line);
line = reader.readLine();
}
if (mCommand == null) {
return;
}
// Run the unique commands with special gcc options to extract the
// symbols and paths
// -E -P -v -dD
mArguments.add("-E"); //$NON-NLS-1$
mArguments.add("-P"); //$NON-NLS-1$
mArguments.add("-v"); //$NON-NLS-1$
mArguments.add("-dD"); //$NON-NLS-1$
URL url = Activator.findFile(new Path("discovery/" + (mCPlusPlus ? "test.cpp" : "test.c"))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
File testFile = new File(FileLocator.toFileURL(url).toURI());
String testFileName = testFile.getAbsolutePath().replace('\\', '/');
mArguments.add(testFileName);
args = mArguments.toArray(new String[mArguments.size()]);
proc = new SGXSDKCommandLauncher().execute(new Path(mCommand), args, env,changeToDirectory, monitor);
final InputStream errStream = proc.getErrorStream();
new Thread() {
@Override
public void run() {
checkIncludes(errStream);
};
}.start();
checkDefines(proc.getInputStream());
} catch (IOException e) {
throw new CoreException(Activator.newStatus(e));
} catch (URISyntaxException e) {
throw new CoreException(Activator.newStatus(e));
}
}
private String[] calcEnvironment() throws CoreException {
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(mProject);
IBuilder builder = info.getDefaultConfiguration().getBuilder();
HashMap<String, String> envMap = new HashMap<String, String>();
if (builder.appendEnvironment()) {
ICConfigurationDescription cfgDes = ManagedBuildManager.getDescriptionForConfiguration(builder.getParent().getParent());
IEnvironmentVariableManager mngr = CCorePlugin.getDefault().getBuildEnvironmentManager();
IEnvironmentVariable[] vars = mngr.getVariables(cfgDes, true);
for (IEnvironmentVariable var : vars) {
envMap.put(var.getName(), var.getValue());
}
}
// Add variables from build info
Map<String, String> builderEnv = builder.getExpandedEnvironment();
if (builderEnv != null)
envMap.putAll(builderEnv);
List<String> strings = new ArrayList<String>(envMap.size());
for (Entry<String, String> entry : envMap.entrySet()) {
StringBuffer buffer = new StringBuffer(entry.getKey());
buffer.append('=').append(entry.getValue());
strings.add(buffer.toString());
}
return strings.toArray(new String[strings.size()]);
}
private static class Line {
private final String line;
private int pos;
public Line(String line) {
this.line = line;
}
public Line(String line, int pos) {
this(line);
this.pos = pos;
}
public String getToken() {
skipWhiteSpace();
if (pos == line.length())
return null;
int start = pos;
boolean inQuote = false;
while (true) {
char c = line.charAt(pos);
if (c == ' ') {
if (!inQuote)
return line.substring(start, pos);
} else if (c == '"') {
inQuote = !inQuote;
}
if (++pos == line.length())
return null;
}
}
private String getRemaining() {
if (pos == line.length())
return null;
skipWhiteSpace();
String rc = line.substring(pos);
pos = line.length();
return rc;
}
private void skipWhiteSpace() {
while (true) {
if (pos == line.length())
return;
char c = line.charAt(pos);
if (c == ' ')
pos++;
else
return;
}
}
}
private void checkBuildLine(String text) {
Line line = new Line(text);
String cmd = line.getToken();
if (cmd == null) {
return;
} else if (cmd.endsWith("g++")) { //$NON-NLS-1$
if (mCommand == null || !mCPlusPlus) {
mCommand = cmd;
mCPlusPlus = true;
}
gatherOptions(line);
} else if (cmd.endsWith("gcc")) { //$NON-NLS-1$
if (mCommand == null){
mCommand = cmd;
}
gatherOptions(line);
}
}
private void gatherOptions(Line line) {
for (String option = line.getToken(); option != null; option = line.getToken()) {
if (option.startsWith("-")) { //$NON-NLS-1$
// only look at options
if (option.equals("-I")) { //$NON-NLS-1$
String dir = line.getToken();
if (dir != null)
addArg(option + dir);
} else if (option.startsWith("-I")) { //$NON-NLS-1$
addArg(option);
} else if (option.equals("-D")) { //$NON-NLS-1$
String def = line.getToken();
if (def != null)
addArg(option + def);
} else if (option.startsWith("-D")) { //$NON-NLS-1$
addArg(option);
} else if (option.startsWith("-f")) { //$NON-NLS-1$
addArg(option);
} else if (option.startsWith("-m")) { //$NON-NLS-1$
addArg(option);
} else if (option.startsWith("--sysroot")) { //$NON-NLS-1$
addArg(option);
}
}
}
}
private void addArg(String arg) {
if (!mArguments.contains(arg))
mArguments.add(arg);
}
private void checkIncludes(InputStream in) {
try {
List<String> includes = new ArrayList<String>();
boolean inIncludes1 = false;
boolean inIncludes2 = false;
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
String line = reader.readLine();
while (line != null) {
if (!inIncludes1) {
if (line.equals("#include \"...\" search starts here:")) //$NON-NLS-1$
inIncludes1 = true;
} else {
if (!inIncludes2) {
if (line.equals("#include <...> search starts here:")) //$NON-NLS-1$
inIncludes2 = true;
else
includes.add(line.trim());
} else {
if (line.equals("End of search list.")) { //$NON-NLS-1$
mPathInfo.setIncludePaths(includes);
} else {
includes.add(line.trim());
}
}
}
line = reader.readLine();
}
} catch (IOException e) {
Activator.log(e);
}
}
private void checkDefines(InputStream in) {
try {
Map<String, String> defines = new HashMap<String, String>();
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
String line = reader.readLine();
while (line != null) {
if (line.startsWith("#define")) { //$NON-NLS-1$
Line l = new Line(line, 7);
String var = l.getToken();
if (var == null)
continue;
String value = l.getRemaining();
if (value == null)
value = ""; //$NON-NLS-1$
defines.put(var, value);
}
line = reader.readLine();
}
mPathInfo.setSymbols(defines);
} catch (IOException e) {
Activator.log(e);
}
}
}
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016 Intel Corporation. //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v1.0 //
// which accompanies this distribution, and is available at //
// http://www.eclipse.org/legal/epl-v10.html //
// //
// Contributors: //
// Intel Corporation - initial implementation and documentation //
///////////////////////////////////////////////////////////////////////////
package com.intel.sgx.discovery;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
import org.eclipse.cdt.core.envvar.IEnvironmentVariableManager;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.managedbuilder.core.IBuilder;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import com.intel.sgx.Activator;
import com.intel.sgx.build.SGXSDKCommandLauncher;
/*
* This code has been taken from the NDK plugin for Linux. If there is an update to this code there, then refactor this code.
*/
public class SGXSDKDiscoveryUpdater {
private final SGXSDKDiscoveredPathInfo mPathInfo;
private final IProject mProject;
private boolean mCPlusPlus = false;
private String mCommand;
private List<String> mArguments = new ArrayList<String>();
public SGXSDKDiscoveryUpdater(SGXSDKDiscoveredPathInfo pathInfo) {
mPathInfo = pathInfo;
mProject = pathInfo.getProject();
}
public void runUpdate(IProgressMonitor monitor) throws CoreException {
try {
// Run make -nB to get the list of commands
IPath commandPath = new Path("make"); //$NON-NLS-1$
String[] args = {"-f", "sgx/Makefile", "-n", "-B" }; //$NON-NLS-1$
String[] env = calcEnvironment();
File projectDir = new File(mProject.getLocationURI());
IPath changeToDirectory = new Path(projectDir.getAbsolutePath());
Process proc = new SGXSDKCommandLauncher().execute(commandPath, args, env,changeToDirectory, monitor);
if (proc == null) {
return;
}
BufferedReader reader = new BufferedReader(new InputStreamReader(proc.getInputStream()));
String line = reader.readLine();
while (line != null) {
checkBuildLine(line);
line = reader.readLine();
}
if (mCommand == null) {
return;
}
// Run the unique commands with special gcc options to extract the
// symbols and paths
// -E -P -v -dD
mArguments.add("-E"); //$NON-NLS-1$
mArguments.add("-P"); //$NON-NLS-1$
mArguments.add("-v"); //$NON-NLS-1$
mArguments.add("-dD"); //$NON-NLS-1$
URL url = Activator.findFile(new Path("discovery/" + (mCPlusPlus ? "test.cpp" : "test.c"))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
File testFile = new File(FileLocator.toFileURL(url).toURI());
String testFileName = testFile.getAbsolutePath().replace('\\', '/');
mArguments.add(testFileName);
args = mArguments.toArray(new String[mArguments.size()]);
proc = new SGXSDKCommandLauncher().execute(new Path(mCommand), args, env,changeToDirectory, monitor);
final InputStream errStream = proc.getErrorStream();
new Thread() {
@Override
public void run() {
checkIncludes(errStream);
};
}.start();
checkDefines(proc.getInputStream());
} catch (IOException e) {
throw new CoreException(Activator.newStatus(e));
} catch (URISyntaxException e) {
throw new CoreException(Activator.newStatus(e));
}
}
private String[] calcEnvironment() throws CoreException {
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(mProject);
IBuilder builder = info.getDefaultConfiguration().getBuilder();
HashMap<String, String> envMap = new HashMap<String, String>();
if (builder.appendEnvironment()) {
ICConfigurationDescription cfgDes = ManagedBuildManager.getDescriptionForConfiguration(builder.getParent().getParent());
IEnvironmentVariableManager mngr = CCorePlugin.getDefault().getBuildEnvironmentManager();
IEnvironmentVariable[] vars = mngr.getVariables(cfgDes, true);
for (IEnvironmentVariable var : vars) {
envMap.put(var.getName(), var.getValue());
}
}
// Add variables from build info
Map<String, String> builderEnv = builder.getExpandedEnvironment();
if (builderEnv != null)
envMap.putAll(builderEnv);
List<String> strings = new ArrayList<String>(envMap.size());
for (Entry<String, String> entry : envMap.entrySet()) {
StringBuffer buffer = new StringBuffer(entry.getKey());
buffer.append('=').append(entry.getValue());
strings.add(buffer.toString());
}
return strings.toArray(new String[strings.size()]);
}
private static class Line {
private final String line;
private int pos;
public Line(String line) {
this.line = line;
}
public Line(String line, int pos) {
this(line);
this.pos = pos;
}
public String getToken() {
skipWhiteSpace();
if (pos == line.length())
return null;
int start = pos;
boolean inQuote = false;
while (true) {
char c = line.charAt(pos);
if (c == ' ') {
if (!inQuote)
return line.substring(start, pos);
} else if (c == '"') {
inQuote = !inQuote;
}
if (++pos == line.length())
return null;
}
}
private String getRemaining() {
if (pos == line.length())
return null;
skipWhiteSpace();
String rc = line.substring(pos);
pos = line.length();
return rc;
}
private void skipWhiteSpace() {
while (true) {
if (pos == line.length())
return;
char c = line.charAt(pos);
if (c == ' ')
pos++;
else
return;
}
}
}
private void checkBuildLine(String text) {
Line line = new Line(text);
String cmd = line.getToken();
if (cmd == null) {
return;
} else if (cmd.endsWith("g++")) { //$NON-NLS-1$
if (mCommand == null || !mCPlusPlus) {
mCommand = cmd;
mCPlusPlus = true;
}
gatherOptions(line);
} else if (cmd.endsWith("gcc")) { //$NON-NLS-1$
if (mCommand == null){
mCommand = cmd;
}
gatherOptions(line);
}
}
private void gatherOptions(Line line) {
for (String option = line.getToken(); option != null; option = line.getToken()) {
if (option.startsWith("-")) { //$NON-NLS-1$
// only look at options
if (option.equals("-I")) { //$NON-NLS-1$
String dir = line.getToken();
if (dir != null)
addArg(option + dir);
} else if (option.startsWith("-I")) { //$NON-NLS-1$
addArg(option);
} else if (option.equals("-D")) { //$NON-NLS-1$
String def = line.getToken();
if (def != null)
addArg(option + def);
} else if (option.startsWith("-D")) { //$NON-NLS-1$
addArg(option);
} else if (option.startsWith("-f")) { //$NON-NLS-1$
addArg(option);
} else if (option.startsWith("-m")) { //$NON-NLS-1$
addArg(option);
} else if (option.startsWith("--sysroot")) { //$NON-NLS-1$
addArg(option);
}
}
}
}
private void addArg(String arg) {
if (!mArguments.contains(arg))
mArguments.add(arg);
}
private void checkIncludes(InputStream in) {
try {
List<String> includes = new ArrayList<String>();
boolean inIncludes1 = false;
boolean inIncludes2 = false;
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
String line = reader.readLine();
while (line != null) {
if (!inIncludes1) {
if (line.equals("#include \"...\" search starts here:")) //$NON-NLS-1$
inIncludes1 = true;
} else {
if (!inIncludes2) {
if (line.equals("#include <...> search starts here:")) //$NON-NLS-1$
inIncludes2 = true;
else
includes.add(line.trim());
} else {
if (line.equals("End of search list.")) { //$NON-NLS-1$
mPathInfo.setIncludePaths(includes);
} else {
includes.add(line.trim());
}
}
}
line = reader.readLine();
}
} catch (IOException e) {
Activator.log(e);
}
}
private void checkDefines(InputStream in) {
try {
Map<String, String> defines = new HashMap<String, String>();
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
String line = reader.readLine();
while (line != null) {
if (line.startsWith("#define")) { //$NON-NLS-1$
Line l = new Line(line, 7);
String var = l.getToken();
if (var == null)
continue;
String value = l.getRemaining();
if (value == null)
value = ""; //$NON-NLS-1$
defines.put(var, value);
}
line = reader.readLine();
}
mPathInfo.setSymbols(defines);
} catch (IOException e) {
Activator.log(e);
}
}
}

View File

@ -1,213 +1,213 @@
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016 Intel Corporation. //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v1.0 //
// which accompanies this distribution, and is available at //
// http://www.eclipse.org/legal/epl-v10.html //
// //
// Contributors: //
// Intel Corporation - initial implementation and documentation //
///////////////////////////////////////////////////////////////////////////
package com.intel.sgx.handlers;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Map;
import org.eclipse.cdt.core.templateengine.TemplateCore;
import org.eclipse.cdt.core.templateengine.TemplateEngine;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.IHandler;
import org.eclipse.core.commands.IHandlerListener;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.handlers.HandlerUtil;
import com.intel.sgx.Activator;
import com.intel.sgx.dialogs.AddEnclaveFileDialog;
import com.intel.sgx.preferences.PreferenceConstants;
public class AddEnclave extends ModuleCreationBaseHandler implements IHandler {
public String edlFilename = "";
public String linuxMakePath = "";
@Override
public void addHandlerListener(IHandlerListener handlerListener) {
}
@Override
public void dispose() {
}
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
String edlBasename,linuxPath,enclaveBasename;
IProject project = null;
// Display display = Display.getCurrent();
// Shell shell = new Shell(display);
Shell shell = null;
AddEnclaveFileDialog dialog = new AddEnclaveFileDialog(shell, this);
if (dialog.open() != InputDialog.OK) {
return null;
}
if((edlFilename.isEmpty())){
System.err.println("No Enclave selected to Import.");
return null;
}
edlBasename = edlFilename;
ISelection selection = HandlerUtil.getCurrentSelection(event);
Object element = null;
if (selection instanceof IStructuredSelection) {
element = ((IStructuredSelection) selection).getFirstElement();
if (element instanceof IResource) {
project = ((IResource) element).getProject();
}
}
if (!project.exists()) {
System.err.println("Error: Project not found");
return null;
}
for (IConfigurationElement i : Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.core.resources.projectNature")){
}
IPath linuxMkRelPath = (Path.fromOSString(linuxMakePath)).makeRelativeTo(project.getLocation().append("sgx").append("enclave_"+edlBasename));
if(linuxMkRelPath.removeLastSegments(1).lastSegment().toString().equalsIgnoreCase("sgx")){
linuxPath = linuxMkRelPath.removeLastSegments(3).toOSString();
enclaveBasename = linuxMkRelPath.removeLastSegments(2).lastSegment().toString();
}
else{
linuxPath = linuxMkRelPath.removeLastSegments(2).toOSString();
enclaveBasename = linuxMkRelPath.removeLastSegments(1).lastSegment().toString();
}
IProgressMonitor monitor = new NullProgressMonitor();
TemplateCore template = null;
if(isCPProject(project))
if(dialog.generateApp())
{
template = TemplateEngine.getDefault().getTemplateById("SGXEnclaveC++WithSample");
}
else
{
template = TemplateEngine.getDefault().getTemplateById("SGXEnclaveC++Minimal");
}
else
if(dialog.generateApp())
{
template = TemplateEngine.getDefault().getTemplateById("SGXEnclaveCWithSample");
}
else
{
template = TemplateEngine.getDefault().getTemplateById("SGXEnclaveCMinimal");
}
Map<String, String> valueStore = template.getValueStore();
valueStore.put("projectName", project.getName());
valueStore.put("workspacePath", linuxPath);
valueStore.put("baseName", enclaveBasename);
valueStore.put("enclaveName",edlFilename);
valueStore.put("EnclaveName",capitalize(edlFilename));
valueStore.put("ENCLAVENAME",edlFilename.toUpperCase());
valueStore.put("SdkPathFromPlugin", Activator.getDefault().getPreferenceStore().getString(PreferenceConstants.SDK_PATH));
IStatus[] statuses = template.executeTemplateProcesses(monitor, false);
for(IStatus e: statuses)
{
}
ManagedBuildManager.saveBuildInfo(project, true);
try {
project.refreshLocal(IResource.DEPTH_INFINITE, null);
} catch (CoreException e) {
Activator.log(e);
e.printStackTrace();
}
return null;
}
private String capitalize(final String line) {
return Character.toUpperCase(line.charAt(0)) + line.substring(1);
}
@Override
public boolean isEnabled() {
return true;
}
@Override
public boolean isHandled() {
return true;
}
@Override
public void removeHandlerListener(IHandlerListener handlerListener) {
}
public void setFilename(String filename) {
edlFilename = filename;
}
public static void copyFile(File source, File dest) throws IOException {
byte[] bytes = new byte[4092];
if (source != null && dest != null) {
if (source.isFile()) {
FileInputStream in = null;
FileOutputStream out = null;
try {
in = new FileInputStream(source);
out = new FileOutputStream(dest);
int len;
while ((len = in.read(bytes)) != -1) {
out.write(bytes, 0, len);
}
} catch (Exception e) {
Activator.log(e);
System.err.println("Error: " + e.toString());
} finally {
try {
if (in != null)
in.close();
} finally {
if (out != null)
out.close();
}
}
}
}
}
}
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016 Intel Corporation. //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v1.0 //
// which accompanies this distribution, and is available at //
// http://www.eclipse.org/legal/epl-v10.html //
// //
// Contributors: //
// Intel Corporation - initial implementation and documentation //
///////////////////////////////////////////////////////////////////////////
package com.intel.sgx.handlers;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Map;
import org.eclipse.cdt.core.templateengine.TemplateCore;
import org.eclipse.cdt.core.templateengine.TemplateEngine;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.IHandler;
import org.eclipse.core.commands.IHandlerListener;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.handlers.HandlerUtil;
import com.intel.sgx.Activator;
import com.intel.sgx.dialogs.AddEnclaveFileDialog;
import com.intel.sgx.preferences.PreferenceConstants;
public class AddEnclave extends ModuleCreationBaseHandler implements IHandler {
public String edlFilename = "";
public String linuxMakePath = "";
@Override
public void addHandlerListener(IHandlerListener handlerListener) {
}
@Override
public void dispose() {
}
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
String edlBasename,linuxPath,enclaveBasename;
IProject project = null;
// Display display = Display.getCurrent();
// Shell shell = new Shell(display);
Shell shell = null;
AddEnclaveFileDialog dialog = new AddEnclaveFileDialog(shell, this);
if (dialog.open() != InputDialog.OK) {
return null;
}
if((edlFilename.isEmpty())){
System.err.println("No Enclave selected to Import.");
return null;
}
edlBasename = edlFilename;
ISelection selection = HandlerUtil.getCurrentSelection(event);
Object element = null;
if (selection instanceof IStructuredSelection) {
element = ((IStructuredSelection) selection).getFirstElement();
if (element instanceof IResource) {
project = ((IResource) element).getProject();
}
}
if (!project.exists()) {
System.err.println("Error: Project not found");
return null;
}
for (IConfigurationElement i : Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.core.resources.projectNature")){
}
IPath linuxMkRelPath = (Path.fromOSString(linuxMakePath)).makeRelativeTo(project.getLocation().append("sgx").append("enclave_"+edlBasename));
if(linuxMkRelPath.removeLastSegments(1).lastSegment().toString().equalsIgnoreCase("sgx")){
linuxPath = linuxMkRelPath.removeLastSegments(3).toOSString();
enclaveBasename = linuxMkRelPath.removeLastSegments(2).lastSegment().toString();
}
else{
linuxPath = linuxMkRelPath.removeLastSegments(2).toOSString();
enclaveBasename = linuxMkRelPath.removeLastSegments(1).lastSegment().toString();
}
IProgressMonitor monitor = new NullProgressMonitor();
TemplateCore template = null;
if(isCPProject(project))
if(dialog.generateApp())
{
template = TemplateEngine.getDefault().getTemplateById("SGXEnclaveC++WithSample");
}
else
{
template = TemplateEngine.getDefault().getTemplateById("SGXEnclaveC++Minimal");
}
else
if(dialog.generateApp())
{
template = TemplateEngine.getDefault().getTemplateById("SGXEnclaveCWithSample");
}
else
{
template = TemplateEngine.getDefault().getTemplateById("SGXEnclaveCMinimal");
}
Map<String, String> valueStore = template.getValueStore();
valueStore.put("projectName", project.getName());
valueStore.put("workspacePath", linuxPath);
valueStore.put("baseName", enclaveBasename);
valueStore.put("enclaveName",edlFilename);
valueStore.put("EnclaveName",capitalize(edlFilename));
valueStore.put("ENCLAVENAME",edlFilename.toUpperCase());
valueStore.put("SdkPathFromPlugin", Activator.getDefault().getPreferenceStore().getString(PreferenceConstants.SDK_PATH));
IStatus[] statuses = template.executeTemplateProcesses(monitor, false);
for(IStatus e: statuses)
{
}
ManagedBuildManager.saveBuildInfo(project, true);
try {
project.refreshLocal(IResource.DEPTH_INFINITE, null);
} catch (CoreException e) {
Activator.log(e);
e.printStackTrace();
}
return null;
}
private String capitalize(final String line) {
return Character.toUpperCase(line.charAt(0)) + line.substring(1);
}
@Override
public boolean isEnabled() {
return true;
}
@Override
public boolean isHandled() {
return true;
}
@Override
public void removeHandlerListener(IHandlerListener handlerListener) {
}
public void setFilename(String filename) {
edlFilename = filename;
}
public static void copyFile(File source, File dest) throws IOException {
byte[] bytes = new byte[4092];
if (source != null && dest != null) {
if (source.isFile()) {
FileInputStream in = null;
FileOutputStream out = null;
try {
in = new FileInputStream(source);
out = new FileOutputStream(dest);
int len;
while ((len = in.read(bytes)) != -1) {
out.write(bytes, 0, len);
}
} catch (Exception e) {
Activator.log(e);
System.err.println("Error: " + e.toString());
} finally {
try {
if (in != null)
in.close();
} finally {
if (out != null)
out.close();
}
}
}
}
}
}

View File

@ -1,193 +1,193 @@
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016 Intel Corporation. //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v1.0 //
// which accompanies this distribution, and is available at //
// http://www.eclipse.org/legal/epl-v10.html //
// //
// Contributors: //
// Intel Corporation - initial implementation and documentation //
///////////////////////////////////////////////////////////////////////////
package com.intel.sgx.handlers;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Map;
import org.eclipse.cdt.core.templateengine.TemplateCore;
import org.eclipse.cdt.core.templateengine.TemplateEngine;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.IHandler;
import org.eclipse.core.commands.IHandlerListener;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.handlers.HandlerUtil;
import com.intel.sgx.Activator;
import com.intel.sgx.dialogs.AddTrustedStaticLibFileDialog;
import com.intel.sgx.preferences.PreferenceConstants;
public class AddTrustedStaticLib extends ModuleCreationBaseHandler implements IHandler {
public String edlFilename = "";
public String linuxMakePath = "";
@Override
public void addHandlerListener(IHandlerListener handlerListener) {
}
@Override
public void dispose() {
}
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
String edlBasename,linuxPath,enclaveBasename;
IProject project = null;
// Display display = Display.getCurrent();
// Shell shell = new Shell(display);
Shell shell = null;
AddTrustedStaticLibFileDialog dialog = new AddTrustedStaticLibFileDialog(shell, this);
if (dialog.open() != InputDialog.OK) {
return null;
}
if((edlFilename.isEmpty() )){
System.err.println("No Enclave selected to Import.");
return null;
}
edlBasename = edlFilename;
ISelection selection = HandlerUtil.getCurrentSelection(event);
Object element = null;
if (selection instanceof IStructuredSelection) {
element = ((IStructuredSelection) selection).getFirstElement();
if (element instanceof IResource) {
project = ((IResource) element).getProject();
}
}
if (!project.exists()) {
System.err.println("Error: Project not found");
return null;
}
for (IConfigurationElement i : Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.core.resources.projectNature")){
}
IPath linuxMkRelPath = (Path.fromOSString(linuxMakePath)).makeRelativeTo(project.getLocation().append("sgx").append("enclave_"+edlBasename));
if(linuxMkRelPath.removeLastSegments(1).lastSegment().toString().equalsIgnoreCase("sgx")){
linuxPath = linuxMkRelPath.removeLastSegments(3).toOSString();
enclaveBasename = linuxMkRelPath.removeLastSegments(2).lastSegment().toString();
}
else{
linuxPath = linuxMkRelPath.removeLastSegments(2).toOSString();
enclaveBasename = linuxMkRelPath.removeLastSegments(1).lastSegment().toString();
}
IProgressMonitor monitor = new NullProgressMonitor();
TemplateCore template = null;
if(isCPProject(project))
template = TemplateEngine.getDefault().getTemplateById("SGXTrustedStaticLibraryC++Minimal");
else
template = TemplateEngine.getDefault().getTemplateById("SGXTrustedStaticLibraryCMinimal");
Map<String, String> valueStore = template.getValueStore();
valueStore.put("projectName", project.getName());
valueStore.put("workspacePath", linuxPath);
valueStore.put("baseName", enclaveBasename);
valueStore.put("enclaveName",edlFilename);
valueStore.put("EnclaveName",capitalize(edlFilename));
valueStore.put("ENCLAVENAME",edlFilename.toUpperCase());
valueStore.put("SdkPathFromPlugin", Activator.getDefault().getPreferenceStore().getString(PreferenceConstants.SDK_PATH));
IStatus[] statuses = template.executeTemplateProcesses(monitor, false);
ManagedBuildManager.saveBuildInfo(project, true);
try {
project.refreshLocal(IResource.DEPTH_INFINITE, null);
} catch (CoreException e) {
Activator.log(e);
e.printStackTrace();
}
return null;
}
private String capitalize(final String line) {
return Character.toUpperCase(line.charAt(0)) + line.substring(1);
}
@Override
public boolean isEnabled() {
return true;
}
@Override
public boolean isHandled() {
return true;
}
@Override
public void removeHandlerListener(IHandlerListener handlerListener) {
}
public void setFilename(String filename) {
edlFilename = filename;
}
public static void copyFile(File source, File dest) throws IOException {
byte[] bytes = new byte[4092];
if (source != null && dest != null) {
if (source.isFile()) {
FileInputStream in = null;
FileOutputStream out = null;
try {
in = new FileInputStream(source);
out = new FileOutputStream(dest);
int len;
while ((len = in.read(bytes)) != -1) {
out.write(bytes, 0, len);
}
} catch (Exception e) {
Activator.log(e);
System.err.println("Error: " + e.toString());
} finally {
try {
if (in != null)
in.close();
} finally {
if (out != null)
out.close();
}
}
}
}
}
}
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016 Intel Corporation. //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v1.0 //
// which accompanies this distribution, and is available at //
// http://www.eclipse.org/legal/epl-v10.html //
// //
// Contributors: //
// Intel Corporation - initial implementation and documentation //
///////////////////////////////////////////////////////////////////////////
package com.intel.sgx.handlers;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Map;
import org.eclipse.cdt.core.templateengine.TemplateCore;
import org.eclipse.cdt.core.templateengine.TemplateEngine;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.IHandler;
import org.eclipse.core.commands.IHandlerListener;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.handlers.HandlerUtil;
import com.intel.sgx.Activator;
import com.intel.sgx.dialogs.AddTrustedStaticLibFileDialog;
import com.intel.sgx.preferences.PreferenceConstants;
public class AddTrustedStaticLib extends ModuleCreationBaseHandler implements IHandler {
public String edlFilename = "";
public String linuxMakePath = "";
@Override
public void addHandlerListener(IHandlerListener handlerListener) {
}
@Override
public void dispose() {
}
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
String edlBasename,linuxPath,enclaveBasename;
IProject project = null;
// Display display = Display.getCurrent();
// Shell shell = new Shell(display);
Shell shell = null;
AddTrustedStaticLibFileDialog dialog = new AddTrustedStaticLibFileDialog(shell, this);
if (dialog.open() != InputDialog.OK) {
return null;
}
if((edlFilename.isEmpty() )){
System.err.println("No Enclave selected to Import.");
return null;
}
edlBasename = edlFilename;
ISelection selection = HandlerUtil.getCurrentSelection(event);
Object element = null;
if (selection instanceof IStructuredSelection) {
element = ((IStructuredSelection) selection).getFirstElement();
if (element instanceof IResource) {
project = ((IResource) element).getProject();
}
}
if (!project.exists()) {
System.err.println("Error: Project not found");
return null;
}
for (IConfigurationElement i : Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.core.resources.projectNature")){
}
IPath linuxMkRelPath = (Path.fromOSString(linuxMakePath)).makeRelativeTo(project.getLocation().append("sgx").append("enclave_"+edlBasename));
if(linuxMkRelPath.removeLastSegments(1).lastSegment().toString().equalsIgnoreCase("sgx")){
linuxPath = linuxMkRelPath.removeLastSegments(3).toOSString();
enclaveBasename = linuxMkRelPath.removeLastSegments(2).lastSegment().toString();
}
else{
linuxPath = linuxMkRelPath.removeLastSegments(2).toOSString();
enclaveBasename = linuxMkRelPath.removeLastSegments(1).lastSegment().toString();
}
IProgressMonitor monitor = new NullProgressMonitor();
TemplateCore template = null;
if(isCPProject(project))
template = TemplateEngine.getDefault().getTemplateById("SGXTrustedStaticLibraryC++Minimal");
else
template = TemplateEngine.getDefault().getTemplateById("SGXTrustedStaticLibraryCMinimal");
Map<String, String> valueStore = template.getValueStore();
valueStore.put("projectName", project.getName());
valueStore.put("workspacePath", linuxPath);
valueStore.put("baseName", enclaveBasename);
valueStore.put("enclaveName",edlFilename);
valueStore.put("EnclaveName",capitalize(edlFilename));
valueStore.put("ENCLAVENAME",edlFilename.toUpperCase());
valueStore.put("SdkPathFromPlugin", Activator.getDefault().getPreferenceStore().getString(PreferenceConstants.SDK_PATH));
IStatus[] statuses = template.executeTemplateProcesses(monitor, false);
ManagedBuildManager.saveBuildInfo(project, true);
try {
project.refreshLocal(IResource.DEPTH_INFINITE, null);
} catch (CoreException e) {
Activator.log(e);
e.printStackTrace();
}
return null;
}
private String capitalize(final String line) {
return Character.toUpperCase(line.charAt(0)) + line.substring(1);
}
@Override
public boolean isEnabled() {
return true;
}
@Override
public boolean isHandled() {
return true;
}
@Override
public void removeHandlerListener(IHandlerListener handlerListener) {
}
public void setFilename(String filename) {
edlFilename = filename;
}
public static void copyFile(File source, File dest) throws IOException {
byte[] bytes = new byte[4092];
if (source != null && dest != null) {
if (source.isFile()) {
FileInputStream in = null;
FileOutputStream out = null;
try {
in = new FileInputStream(source);
out = new FileOutputStream(dest);
int len;
while ((len = in.read(bytes)) != -1) {
out.write(bytes, 0, len);
}
} catch (Exception e) {
Activator.log(e);
System.err.println("Error: " + e.toString());
} finally {
try {
if (in != null)
in.close();
} finally {
if (out != null)
out.close();
}
}
}
}
}
}

View File

@ -1,169 +1,169 @@
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016 Intel Corporation. //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v1.0 //
// which accompanies this distribution, and is available at //
// http://www.eclipse.org/legal/epl-v10.html //
// //
// Contributors: //
// Intel Corporation - initial implementation and documentation //
///////////////////////////////////////////////////////////////////////////
package com.intel.sgx.handlers;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.IHandler;
import org.eclipse.core.commands.IHandlerListener;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.handlers.HandlerUtil;
import com.intel.sgx.Activator;
import com.intel.sgx.dialogs.RemoveEnclaveFileDialog;
public class RemoveEnclave implements IHandler {
public String edlFilename = "";
private IPath edlCanonicalFilename;
@Override
public void addHandlerListener(IHandlerListener handlerListener) {
}
@Override
public void dispose() {
}
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
String edlBasename;
IProject project = null;
// Display display = Display.getCurrent();
// Shell shell = new Shell(display);
RemoveEnclaveFileDialog dialog = new RemoveEnclaveFileDialog(null, this);
if (dialog.open() != InputDialog.OK) {
return null;
}
edlCanonicalFilename = Path.fromOSString(edlFilename);
edlBasename = edlCanonicalFilename.lastSegment();
if(edlBasename.isEmpty()){
return null;
}
ISelection selection = HandlerUtil.getCurrentSelection(event);
Object element = null;
if(selection instanceof IStructuredSelection) {
element = ((IStructuredSelection)selection).getFirstElement();
if (element instanceof IResource) {
project= ((IResource)element).getProject();
}
}
if (!project.exists()) {
System.err.println("Error: Project not found");
return null;
}
IPath targetRelPath = project.getProjectRelativePath().append("sgx").append("enclave_" + edlBasename);
try {
for (int i=1;i<=targetRelPath.segmentCount();i++) {
IFolder subfolder = project.getFolder(targetRelPath.uptoSegment(i));
if (subfolder.exists()){
if(subfolder.getProjectRelativePath().toOSString().contains("enclave_"+edlBasename)){
subfolder.delete(true, true, null);
break;
}
}
}
targetRelPath = project.getProjectRelativePath().append("sgx").append(edlBasename);
for (int i=1;i<=targetRelPath.segmentCount();i++) {
IFolder subfolder = project.getFolder(targetRelPath.uptoSegment(i));
if (subfolder.exists()){
if(subfolder.getProjectRelativePath().toOSString().contains(edlBasename)){
subfolder.delete(true, true, null);
break;
}
}
}
} catch (Exception e) {
Activator.log(e);
}
try {
project.refreshLocal(IResource.DEPTH_INFINITE, null);
} catch (CoreException e) {
Activator.log(e);
} catch (IllegalArgumentException e){
Activator.log(e);
}
return null;
}
@Override
public boolean isEnabled() {
return true;
}
@Override
public boolean isHandled() {
return true;
}
@Override
public void removeHandlerListener(IHandlerListener handlerListener) {
}
public static void copyFile(File source, File dest) throws IOException {
byte[] bytes = new byte[4092];
if (source != null && dest != null) {
if (source.isFile()) {
FileInputStream in = null;
FileOutputStream out = null;
try {
in = new FileInputStream(source);
out = new FileOutputStream(dest);
int len;
while ((len = in.read(bytes)) != -1) {
out.write(bytes, 0, len);
}
} catch (Exception e) {
System.err.println("Error: " + e.toString());
Activator.log(e);
} finally {
try {
if (in != null)
in.close();
} finally {
if (out != null)
out.close();
}
}
}
}
}
}
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016 Intel Corporation. //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v1.0 //
// which accompanies this distribution, and is available at //
// http://www.eclipse.org/legal/epl-v10.html //
// //
// Contributors: //
// Intel Corporation - initial implementation and documentation //
///////////////////////////////////////////////////////////////////////////
package com.intel.sgx.handlers;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.IHandler;
import org.eclipse.core.commands.IHandlerListener;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.handlers.HandlerUtil;
import com.intel.sgx.Activator;
import com.intel.sgx.dialogs.RemoveEnclaveFileDialog;
public class RemoveEnclave implements IHandler {
public String edlFilename = "";
private IPath edlCanonicalFilename;
@Override
public void addHandlerListener(IHandlerListener handlerListener) {
}
@Override
public void dispose() {
}
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
String edlBasename;
IProject project = null;
// Display display = Display.getCurrent();
// Shell shell = new Shell(display);
RemoveEnclaveFileDialog dialog = new RemoveEnclaveFileDialog(null, this);
if (dialog.open() != InputDialog.OK) {
return null;
}
edlCanonicalFilename = Path.fromOSString(edlFilename);
edlBasename = edlCanonicalFilename.lastSegment();
if(edlBasename.isEmpty()){
return null;
}
ISelection selection = HandlerUtil.getCurrentSelection(event);
Object element = null;
if(selection instanceof IStructuredSelection) {
element = ((IStructuredSelection)selection).getFirstElement();
if (element instanceof IResource) {
project= ((IResource)element).getProject();
}
}
if (!project.exists()) {
System.err.println("Error: Project not found");
return null;
}
IPath targetRelPath = project.getProjectRelativePath().append("sgx").append("enclave_" + edlBasename);
try {
for (int i=1;i<=targetRelPath.segmentCount();i++) {
IFolder subfolder = project.getFolder(targetRelPath.uptoSegment(i));
if (subfolder.exists()){
if(subfolder.getProjectRelativePath().toOSString().contains("enclave_"+edlBasename)){
subfolder.delete(true, true, null);
break;
}
}
}
targetRelPath = project.getProjectRelativePath().append("sgx").append(edlBasename);
for (int i=1;i<=targetRelPath.segmentCount();i++) {
IFolder subfolder = project.getFolder(targetRelPath.uptoSegment(i));
if (subfolder.exists()){
if(subfolder.getProjectRelativePath().toOSString().contains(edlBasename)){
subfolder.delete(true, true, null);
break;
}
}
}
} catch (Exception e) {
Activator.log(e);
}
try {
project.refreshLocal(IResource.DEPTH_INFINITE, null);
} catch (CoreException e) {
Activator.log(e);
} catch (IllegalArgumentException e){
Activator.log(e);
}
return null;
}
@Override
public boolean isEnabled() {
return true;
}
@Override
public boolean isHandled() {
return true;
}
@Override
public void removeHandlerListener(IHandlerListener handlerListener) {
}
public static void copyFile(File source, File dest) throws IOException {
byte[] bytes = new byte[4092];
if (source != null && dest != null) {
if (source.isFile()) {
FileInputStream in = null;
FileOutputStream out = null;
try {
in = new FileInputStream(source);
out = new FileOutputStream(dest);
int len;
while ((len = in.read(bytes)) != -1) {
out.write(bytes, 0, len);
}
} catch (Exception e) {
System.err.println("Error: " + e.toString());
Activator.log(e);
} finally {
try {
if (in != null)
in.close();
} finally {
if (out != null)
out.close();
}
}
}
}
}
}

View File

@ -1,38 +1,38 @@
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016 Intel Corporation. //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v1.0 //
// which accompanies this distribution, and is available at //
// http://www.eclipse.org/legal/epl-v10.html //
// //
// Contributors: //
// Intel Corporation - initial implementation and documentation //
///////////////////////////////////////////////////////////////////////////
package com.intel.sgx.handlers;
import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.ui.wizards.STDWizardHandler;
public class SGXSDKWizardHandler extends STDWizardHandler {
public SGXSDKWizardHandler() {
super(null, null);
}
@Override
public IToolChain[] getSelectedToolChains() {
IToolChain[] tcs = ManagedBuildManager.getRealToolChains();
for (IToolChain tc : tcs) {
if (tc.getId().equals("com.intel.sgx.SGXtoolChain"))
return new IToolChain[] {
tc
};
}
return super.getSelectedToolChains();
}
}
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016 Intel Corporation. //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v1.0 //
// which accompanies this distribution, and is available at //
// http://www.eclipse.org/legal/epl-v10.html //
// //
// Contributors: //
// Intel Corporation - initial implementation and documentation //
///////////////////////////////////////////////////////////////////////////
package com.intel.sgx.handlers;
import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.ui.wizards.STDWizardHandler;
public class SGXSDKWizardHandler extends STDWizardHandler {
public SGXSDKWizardHandler() {
super(null, null);
}
@Override
public IToolChain[] getSelectedToolChains() {
IToolChain[] tcs = ManagedBuildManager.getRealToolChains();
for (IToolChain tc : tcs) {
if (tc.getId().equals("com.intel.sgx.SGXtoolChain"))
return new IToolChain[] {
tc
};
}
return super.getSelectedToolChains();
}
}

View File

@ -1,74 +1,74 @@
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016 Intel Corporation. //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v1.0 //
// which accompanies this distribution, and is available at //
// http://www.eclipse.org/legal/epl-v10.html //
// //
// Contributors: //
// Intel Corporation - initial implementation and documentation //
///////////////////////////////////////////////////////////////////////////
package com.intel.sgx.handlers;
import org.eclipse.jface.dialogs.InputDialog;
import com.intel.sgx.dialogs.SGXDialogBase;
import com.intel.sgx.dialogs.TwoStepSignStep1Dialog1;
import com.intel.sgx.dialogs.TwoStepSignStep1Dialog2;
import com.intel.sgx.dialogs.TwoStepSignStep1Dialog3;
// Generate Hash
public class TwoStepSignStep1 extends TwoStepSignHandlerBase {
public TwoStepSignStep1() {
}
@Override
protected Object executeSGXStuff() throws ErrorException, CancelException {
initializeSigntool();
showDialog1();
showDialog2();
showDialog3();
return null;
}
private void showDialog1() throws CancelException, ErrorException {
TwoStepSignStep1Dialog1 dialog1 = new TwoStepSignStep1Dialog1(shell, this);
if (dialog1.open() != InputDialog.OK) {
cancel();
}
executeGenData();
}
private void showDialog2() throws CancelException {
TwoStepSignStep1Dialog2 dialog2 = new TwoStepSignStep1Dialog2(shell,
hashFile);
if (dialog2.open() != InputDialog.OK) {
cancel();
}
}
protected void showDialog3() throws CancelException, ErrorException {
SGXDialogBase dialog3 = new TwoStepSignStep1Dialog3(shell, this);
if (dialog3.open() != InputDialog.OK) {
cancel();
}
validateExternalSignPublicKeyFile();
validateExternallySignedHashFile();
executeCatSig();
}
}
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016 Intel Corporation. //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v1.0 //
// which accompanies this distribution, and is available at //
// http://www.eclipse.org/legal/epl-v10.html //
// //
// Contributors: //
// Intel Corporation - initial implementation and documentation //
///////////////////////////////////////////////////////////////////////////
package com.intel.sgx.handlers;
import org.eclipse.jface.dialogs.InputDialog;
import com.intel.sgx.dialogs.SGXDialogBase;
import com.intel.sgx.dialogs.TwoStepSignStep1Dialog1;
import com.intel.sgx.dialogs.TwoStepSignStep1Dialog2;
import com.intel.sgx.dialogs.TwoStepSignStep1Dialog3;
// Generate Hash
public class TwoStepSignStep1 extends TwoStepSignHandlerBase {
public TwoStepSignStep1() {
}
@Override
protected Object executeSGXStuff() throws ErrorException, CancelException {
initializeSigntool();
showDialog1();
showDialog2();
showDialog3();
return null;
}
private void showDialog1() throws CancelException, ErrorException {
TwoStepSignStep1Dialog1 dialog1 = new TwoStepSignStep1Dialog1(shell, this);
if (dialog1.open() != InputDialog.OK) {
cancel();
}
executeGenData();
}
private void showDialog2() throws CancelException {
TwoStepSignStep1Dialog2 dialog2 = new TwoStepSignStep1Dialog2(shell,
hashFile);
if (dialog2.open() != InputDialog.OK) {
cancel();
}
}
protected void showDialog3() throws CancelException, ErrorException {
SGXDialogBase dialog3 = new TwoStepSignStep1Dialog3(shell, this);
if (dialog3.open() != InputDialog.OK) {
cancel();
}
validateExternalSignPublicKeyFile();
validateExternallySignedHashFile();
executeCatSig();
}
}

View File

@ -1,39 +1,39 @@
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016 Intel Corporation. //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v1.0 //
// which accompanies this distribution, and is available at //
// http://www.eclipse.org/legal/epl-v10.html //
// //
// Contributors: //
// Intel Corporation - initial implementation and documentation //
///////////////////////////////////////////////////////////////////////////
package com.intel.sgx.handlers;
import org.eclipse.jface.dialogs.InputDialog;
import com.intel.sgx.dialogs.TwoStepSignStep2Dialog;
// Sign
public class TwoStepSignStep2 extends TwoStepSignHandlerBase {
public TwoStepSignStep2() {
}
@Override
protected Object executeSGXStuff() throws ErrorException, CancelException {
initializeSigntool();
TwoStepSignStep2Dialog dialog = new TwoStepSignStep2Dialog(shell, this);
if(dialog.open() != InputDialog.OK) {
cancel();
}
executeCatSig();
return null;
}
}
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016 Intel Corporation. //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v1.0 //
// which accompanies this distribution, and is available at //
// http://www.eclipse.org/legal/epl-v10.html //
// //
// Contributors: //
// Intel Corporation - initial implementation and documentation //
///////////////////////////////////////////////////////////////////////////
package com.intel.sgx.handlers;
import org.eclipse.jface.dialogs.InputDialog;
import com.intel.sgx.dialogs.TwoStepSignStep2Dialog;
// Sign
public class TwoStepSignStep2 extends TwoStepSignHandlerBase {
public TwoStepSignStep2() {
}
@Override
protected Object executeSGXStuff() throws ErrorException, CancelException {
initializeSigntool();
TwoStepSignStep2Dialog dialog = new TwoStepSignStep2Dialog(shell, this);
if(dialog.open() != InputDialog.OK) {
cancel();
}
executeCatSig();
return null;
}
}

View File

@ -1,83 +1,83 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- -->
<!-- Copyright (c) 2016 Intel Corporation. -->
<!-- -->
<!-- All rights reserved. This program and the accompanying materials -->
<!-- are made available under the terms of the Eclipse Public License v1.0 -->
<!-- which accompanies this distribution, and is available at -->
<!-- http://www.eclipse.org/legal/epl-v10.html -->
<!-- -->
<!-- Contributors: -->
<!-- Intel Corporation - initial implementation and documentation -->
<!-- -->
<template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="Bala Torati (Symbian)"
copyright="Copyright (c) 2007 Symbian Software Limited and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available athttp://www.eclipse.org/legal/epl-v10.html"
id="myHelloWorldCCProject" label="HelloWorld.CCtemplate.label" description="HelloWorld.CCtemplate.description"
help="help.html">
<property-group id="basics" label="HelloWorld.basics.label" description="HelloWorld.basics.description" type="PAGES-ONLY" help="help.html">
<property id="author"
label="HelloWorld.author.label"
description="HelloWorld.author.description"
type="input"
pattern=".*"
default=""
hidden="false"
persist="true"/>
<property id="copyright"
label="HelloWorld.copyright.label"
description="HelloWorld.copyright.description"
type="input"
pattern=".*"
default="HelloWorld.copyright.default"
hidden="false"
persist="true"/>
<property id="message"
label="HelloWorld.message.label"
description="HelloWorld.message.description"
type="input"
pattern=".*"
default="HelloWorld.message.default"
hidden="false"
persist="true"/>
<property id="sourceDir"
label="HelloWorld.sourceDir.label"
description="HelloWorld.sourceDir.description"
type="input"
default="HelloWorld.sourceDir.default"
pattern="[a-zA-Z0-9]+"
persist="true"/>
</property-group>
<process type="org.eclipse.cdt.managedbuilder.core.NewManagedProject">
<simple name="name" value="$(projectName)" />
<simple name="artifactExtension" value="exe" />
<simple name="isCProject" value="false" />
</process>
<process type="org.eclipse.cdt.core.CreateSourceFolder">
<simple name="projectName" value="$(projectName)"/>
<simple name="path" value="$(sourceDir)"/>
</process>
<process type="org.eclipse.cdt.core.AddFiles">
<simple name="projectName" value="$(projectName)"/>
<complex-array name="files">
<element>
<simple name="source" value="src/Basename.cpp"/>
<simple name="target" value="$(sourceDir)/$(projectName).cpp"/>
<simple name="replaceable" value="true"/>
</element>
</complex-array>
</process>
<process type="org.eclipse.cdt.ui.OpenFiles">
<simple name="projectName" value="$(projectName)"/>
<complex-array name="files">
<element>
<simple name="target" value="$(sourceDir)/$(projectName).cpp"/>
</element>
</complex-array>
</process>
</template>
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- -->
<!-- Copyright (c) 2016 Intel Corporation. -->
<!-- -->
<!-- All rights reserved. This program and the accompanying materials -->
<!-- are made available under the terms of the Eclipse Public License v1.0 -->
<!-- which accompanies this distribution, and is available at -->
<!-- http://www.eclipse.org/legal/epl-v10.html -->
<!-- -->
<!-- Contributors: -->
<!-- Intel Corporation - initial implementation and documentation -->
<!-- -->
<template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="Bala Torati (Symbian)"
copyright="Copyright (c) 2007 Symbian Software Limited and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available athttp://www.eclipse.org/legal/epl-v10.html"
id="myHelloWorldCCProject" label="HelloWorld.CCtemplate.label" description="HelloWorld.CCtemplate.description"
help="help.html">
<property-group id="basics" label="HelloWorld.basics.label" description="HelloWorld.basics.description" type="PAGES-ONLY" help="help.html">
<property id="author"
label="HelloWorld.author.label"
description="HelloWorld.author.description"
type="input"
pattern=".*"
default=""
hidden="false"
persist="true"/>
<property id="copyright"
label="HelloWorld.copyright.label"
description="HelloWorld.copyright.description"
type="input"
pattern=".*"
default="HelloWorld.copyright.default"
hidden="false"
persist="true"/>
<property id="message"
label="HelloWorld.message.label"
description="HelloWorld.message.description"
type="input"
pattern=".*"
default="HelloWorld.message.default"
hidden="false"
persist="true"/>
<property id="sourceDir"
label="HelloWorld.sourceDir.label"
description="HelloWorld.sourceDir.description"
type="input"
default="HelloWorld.sourceDir.default"
pattern="[a-zA-Z0-9]+"
persist="true"/>
</property-group>
<process type="org.eclipse.cdt.managedbuilder.core.NewManagedProject">
<simple name="name" value="$(projectName)" />
<simple name="artifactExtension" value="exe" />
<simple name="isCProject" value="false" />
</process>
<process type="org.eclipse.cdt.core.CreateSourceFolder">
<simple name="projectName" value="$(projectName)"/>
<simple name="path" value="$(sourceDir)"/>
</process>
<process type="org.eclipse.cdt.core.AddFiles">
<simple name="projectName" value="$(projectName)"/>
<complex-array name="files">
<element>
<simple name="source" value="src/Basename.cpp"/>
<simple name="target" value="$(sourceDir)/$(projectName).cpp"/>
<simple name="replaceable" value="true"/>
</element>
</complex-array>
</process>
<process type="org.eclipse.cdt.ui.OpenFiles">
<simple name="projectName" value="$(projectName)"/>
<complex-array name="files">
<element>
<simple name="target" value="$(sourceDir)/$(projectName).cpp"/>
</element>
</complex-array>
</process>
</template>

View File

@ -1,109 +1,109 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- -->
<!-- Copyright (c) 2016 Intel Corporation. -->
<!-- -->
<!-- All rights reserved. This program and the accompanying materials -->
<!-- are made available under the terms of the Eclipse Public License v1.0 -->
<!-- which accompanies this distribution, and is available at -->
<!-- http://www.eclipse.org/legal/epl-v10.html -->
<!-- -->
<!-- Contributors: -->
<!-- Intel Corporation - initial implementation and documentation -->
<!-- -->
<template type="ProjTempl" version="1.0" supplier="Intel"
revision="1.0" author="Intel" id="%SGX.CXXStatictemplate.title.id" label="%SGX.CXXStatictemplate.title.label"
description="%SGX.CXXStatictemplate.title.description" help="help.html">
<property-group id="enclaveSettings" label="%SGX.CXXStatictemplate.enclaveSettings.label"
description="%SGX.CXXStatictemplate.enclaveSettings.description" type="PAGES-ONLY"
help="help.html" branding-icon="SGX.gif">
<property id="GenerateEdl" label="%SGX.CXXStatictemplate.requiresEdl.label"
description="%SGX.CXXStatictemplate.requiresEdl.description"
type="boolean" default="false" pattern="" hidden="false" mandatory="false"
persist="false">
</property>
</property-group>
<process type="org.eclipse.cdt.managedbuilder.core.NewManagedProject">
<simple name="name" value="$(projectName)" />
<simple name="location" value="$(location)" />
<simple name="artifactExtension" value="exe" />
<simple name="isCProject" value="true" />
</process>
<process type="org.eclipse.cdt.core.CreateSourceFolder">
<simple name="projectName" value="$(projectName)" />
<simple name="path" value="src" />
</process>
<if condition="$(GenerateEdl)!=false">
<process type="org.eclipse.cdt.core.AddFiles">
<simple name="projectName" value="$(projectName)" />
<complex-array name="files">
<element>
<simple name="source" value="../source/Basename.edl" />
<simple name="target" value="src/$(baseName).edl" />
<simple name="replaceable" value="true" />
</element>
<element>
<simple name="source" value="../include/Basename_t.h" />
<simple name="target" value="sgx/$(baseName)/$(baseName)_t.h" />
<simple name="replaceable" value="true" />
</element>
</complex-array>
</process>
</if>
<process type="com.intel.sgx.SetStaticCCNature">
<simple name="projectName" value="$(projectName)" />
</process>
<if condition="$(GenerateEdl)!=false">
<process type="org.eclipse.cdt.core.AddFiles">
<simple name="projectName" value="$(projectName)" />
<complex-array name="files">
<element>
<simple name="source" value="../source/Basename.edl" />
<simple name="target" value="src/$(baseName).edl" />
<simple name="replaceable" value="true" />
</element>
<element>
<simple name="source" value="../source/Basename.cpp" />
<simple name="target" value="src/$(baseName).cpp" />
<simple name="replaceable" value="true" />
</element>
<element>
<simple name="source" value="../include/Basename_t.h" />
<simple name="target" value="sgx/$(baseName)_trusted_stubs/$(baseName)_t.h" />
<simple name="replaceable" value="true" />
</element>
<element>
<simple name="source" value="../sgx/Enclave/SGXC++StaticLibLinuxMK/sgx.mk" />
<simple name="target" value="sgx/sgx.mk" />
<simple name="replaceable" value="true" />
</element>
<element>
<simple name="source" value="../sgx/Enclave/SGXC++StaticLibLinuxMK/Makefile" />
<simple name="target" value="sgx/Makefile" />
<simple name="replaceable" value="true" />
</element>
</complex-array>
</process>
</if>
<if condition="$(GenerateEdl)!=true">
<process type="org.eclipse.cdt.core.AddFiles">
<simple name="projectName" value="$(projectName)" />
<complex-array name="files">
<element>
<simple name="source" value="../source/Basename.cpp" />
<simple name="target" value="src/$(baseName).cpp" />
<simple name="replaceable" value="true" />
</element>
<element>
<simple name="source" value="../sgx/TrustedLibrary/C++StaticLibLinuxMK/sgx.mk" />
<simple name="target" value="sgx/sgx.mk" />
<simple name="replaceable" value="true" />
</element>
<element>
<simple name="source" value="../sgx/TrustedLibrary/C++StaticLibLinuxMK/Makefile" />
<simple name="target" value="sgx/Makefile" />
<simple name="replaceable" value="true" />
</element>
</complex-array>
</process>
</if>
</template>
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- -->
<!-- Copyright (c) 2016 Intel Corporation. -->
<!-- -->
<!-- All rights reserved. This program and the accompanying materials -->
<!-- are made available under the terms of the Eclipse Public License v1.0 -->
<!-- which accompanies this distribution, and is available at -->
<!-- http://www.eclipse.org/legal/epl-v10.html -->
<!-- -->
<!-- Contributors: -->
<!-- Intel Corporation - initial implementation and documentation -->
<!-- -->
<template type="ProjTempl" version="1.0" supplier="Intel"
revision="1.0" author="Intel" id="%SGX.CXXStatictemplate.title.id" label="%SGX.CXXStatictemplate.title.label"
description="%SGX.CXXStatictemplate.title.description" help="help.html">
<property-group id="enclaveSettings" label="%SGX.CXXStatictemplate.enclaveSettings.label"
description="%SGX.CXXStatictemplate.enclaveSettings.description" type="PAGES-ONLY"
help="help.html" branding-icon="SGX.gif">
<property id="GenerateEdl" label="%SGX.CXXStatictemplate.requiresEdl.label"
description="%SGX.CXXStatictemplate.requiresEdl.description"
type="boolean" default="false" pattern="" hidden="false" mandatory="false"
persist="false">
</property>
</property-group>
<process type="org.eclipse.cdt.managedbuilder.core.NewManagedProject">
<simple name="name" value="$(projectName)" />
<simple name="location" value="$(location)" />
<simple name="artifactExtension" value="exe" />
<simple name="isCProject" value="true" />
</process>
<process type="org.eclipse.cdt.core.CreateSourceFolder">
<simple name="projectName" value="$(projectName)" />
<simple name="path" value="src" />
</process>
<if condition="$(GenerateEdl)!=false">
<process type="org.eclipse.cdt.core.AddFiles">
<simple name="projectName" value="$(projectName)" />
<complex-array name="files">
<element>
<simple name="source" value="../source/Basename.edl" />
<simple name="target" value="src/$(baseName).edl" />
<simple name="replaceable" value="true" />
</element>
<element>
<simple name="source" value="../include/Basename_t.h" />
<simple name="target" value="sgx/$(baseName)/$(baseName)_t.h" />
<simple name="replaceable" value="true" />
</element>
</complex-array>
</process>
</if>
<process type="com.intel.sgx.SetStaticCCNature">
<simple name="projectName" value="$(projectName)" />
</process>
<if condition="$(GenerateEdl)!=false">
<process type="org.eclipse.cdt.core.AddFiles">
<simple name="projectName" value="$(projectName)" />
<complex-array name="files">
<element>
<simple name="source" value="../source/Basename.edl" />
<simple name="target" value="src/$(baseName).edl" />
<simple name="replaceable" value="true" />
</element>
<element>
<simple name="source" value="../source/Basename.cpp" />
<simple name="target" value="src/$(baseName).cpp" />
<simple name="replaceable" value="true" />
</element>
<element>
<simple name="source" value="../include/Basename_t.h" />
<simple name="target" value="sgx/$(baseName)_trusted_stubs/$(baseName)_t.h" />
<simple name="replaceable" value="true" />
</element>
<element>
<simple name="source" value="../sgx/Enclave/SGXC++StaticLibLinuxMK/sgx.mk" />
<simple name="target" value="sgx/sgx.mk" />
<simple name="replaceable" value="true" />
</element>
<element>
<simple name="source" value="../sgx/Enclave/SGXC++StaticLibLinuxMK/Makefile" />
<simple name="target" value="sgx/Makefile" />
<simple name="replaceable" value="true" />
</element>
</complex-array>
</process>
</if>
<if condition="$(GenerateEdl)!=true">
<process type="org.eclipse.cdt.core.AddFiles">
<simple name="projectName" value="$(projectName)" />
<complex-array name="files">
<element>
<simple name="source" value="../source/Basename.cpp" />
<simple name="target" value="src/$(baseName).cpp" />
<simple name="replaceable" value="true" />
</element>
<element>
<simple name="source" value="../sgx/TrustedLibrary/C++StaticLibLinuxMK/sgx.mk" />
<simple name="target" value="sgx/sgx.mk" />
<simple name="replaceable" value="true" />
</element>
<element>
<simple name="source" value="../sgx/TrustedLibrary/C++StaticLibLinuxMK/Makefile" />
<simple name="target" value="sgx/Makefile" />
<simple name="replaceable" value="true" />
</element>
</complex-array>
</process>
</if>
</template>

View File

@ -1,44 +1,44 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- -->
<!-- Copyright (c) 2016 Intel Corporation. -->
<!-- -->
<!-- All rights reserved. This program and the accompanying materials -->
<!-- are made available under the terms of the Eclipse Public License v1.0 -->
<!-- which accompanies this distribution, and is available at -->
<!-- http://www.eclipse.org/legal/epl-v10.html -->
<!-- -->
<!-- Contributors: -->
<!-- Intel Corporation - initial implementation and documentation -->
<!-- -->
<template type="ProjTempl" version="1.0" supplier="Intel"
revision="1.0" author="Intel" id="%SGX.CXXtemplate.title.id" label="%SGX.CXXtemplate.title.label"
description="%SGX.CXXtemplate.title.description" help="help.html">
<process type="org.eclipse.cdt.managedbuilder.core.NewManagedProject">
<simple name="name" value="$(projectName)" />
<simple name="location" value="$(location)" />
<simple name="artifactExtension" value="exe" />
<simple name="isCProject" value="true" />
</process>
<process type="org.eclipse.cdt.core.CreateSourceFolder">
<simple name="projectName" value="$(projectName)" />
<simple name="path" value="src" />
</process>
<process type="org.eclipse.cdt.core.CreateFolder">
<simple name="projectName" value="$(projectName)" />
<simple name="path" value="resources" />
</process>
<process type="com.intel.sgx.SetCCNature">
<simple name="projectName" value="$(projectName)" />
</process>
<process type="org.eclipse.cdt.core.AddFiles">
<simple name="projectName" value="$(projectName)" />
<complex-array name="files">
<element>
<simple name="source" value="../sgx/SGXNative/Makefile"/>
<simple name="target" value="sgx/Makefile" />
<simple name="replaceable" value="true" />
</element>
</complex-array>
</process>
</template>
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- -->
<!-- Copyright (c) 2016 Intel Corporation. -->
<!-- -->
<!-- All rights reserved. This program and the accompanying materials -->
<!-- are made available under the terms of the Eclipse Public License v1.0 -->
<!-- which accompanies this distribution, and is available at -->
<!-- http://www.eclipse.org/legal/epl-v10.html -->
<!-- -->
<!-- Contributors: -->
<!-- Intel Corporation - initial implementation and documentation -->
<!-- -->
<template type="ProjTempl" version="1.0" supplier="Intel"
revision="1.0" author="Intel" id="%SGX.CXXtemplate.title.id" label="%SGX.CXXtemplate.title.label"
description="%SGX.CXXtemplate.title.description" help="help.html">
<process type="org.eclipse.cdt.managedbuilder.core.NewManagedProject">
<simple name="name" value="$(projectName)" />
<simple name="location" value="$(location)" />
<simple name="artifactExtension" value="exe" />
<simple name="isCProject" value="true" />
</process>
<process type="org.eclipse.cdt.core.CreateSourceFolder">
<simple name="projectName" value="$(projectName)" />
<simple name="path" value="src" />
</process>
<process type="org.eclipse.cdt.core.CreateFolder">
<simple name="projectName" value="$(projectName)" />
<simple name="path" value="resources" />
</process>
<process type="com.intel.sgx.SetCCNature">
<simple name="projectName" value="$(projectName)" />
</process>
<process type="org.eclipse.cdt.core.AddFiles">
<simple name="projectName" value="$(projectName)" />
<complex-array name="files">
<element>
<simple name="source" value="../sgx/SGXNative/Makefile"/>
<simple name="target" value="sgx/Makefile" />
<simple name="replaceable" value="true" />
</element>
</complex-array>
</process>
</template>

View File

@ -1,9 +1,9 @@
<EnclaveConfiguration>
<ProdID>$(ProdID)</ProdID>
<ISVSVN>$(IsvSvn)</ISVSVN>
<StackMaxSize>$(ThreadStackSize)</StackMaxSize>
<HeapMaxSize>$(GlobalHeapSize)</HeapMaxSize>
<TCSNum>$(TcsNumber)</TCSNum>
<TCSPolicy>$(TcsPolicy)</TCSPolicy>
<DisableDebug>$(DisableDebug)</DisableDebug>
</EnclaveConfiguration>
<EnclaveConfiguration>
<ProdID>$(ProdID)</ProdID>
<ISVSVN>$(IsvSvn)</ISVSVN>
<StackMaxSize>$(ThreadStackSize)</StackMaxSize>
<HeapMaxSize>$(GlobalHeapSize)</HeapMaxSize>
<TCSNum>$(TcsNumber)</TCSNum>
<TCSPolicy>$(TcsPolicy)</TCSPolicy>
<DisableDebug>$(DisableDebug)</DisableDebug>
</EnclaveConfiguration>

View File

@ -1,23 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- -->
<!-- Copyright (c) 2016 Intel Corporation. -->
<!-- -->
<!-- All rights reserved. This program and the accompanying materials -->
<!-- are made available under the terms of the Eclipse Public License v1.0 -->
<!-- which accompanies this distribution, and is available at -->
<!-- http://www.eclipse.org/legal/epl-v10.html -->
<!-- -->
<!-- Contributors: -->
<!-- Intel Corporation - initial implementation and documentation -->
<!-- -->
<site>
<description name="Intel(R) Software Guard Extensions Plug-in" url="http://fso-dev-machine.rd.intel.com/sgx">
This website hosts an evaluation version of the Eclipse Plug-in developed for Secure Guard Extensions Application development for Linux platforms.
</description>
<feature url="features/com.intel.sgx.feature_1.0.1.qualifier.jar" id="com.intel.sgx.feature" version="1.0.1.qualifier">
<category name="com.intel.security.sgx"/>
</feature>
<category-def name="com.intel.security.sgx" label="Intel(R) SGX Eclipse Plugin">
<description>Intel(R) SGX Eclipse Plugin 1.0.1.qualifier</description>
</category-def>
</site>
<?xml version="1.0" encoding="UTF-8"?>
<!-- -->
<!-- Copyright (c) 2016 Intel Corporation. -->
<!-- -->
<!-- All rights reserved. This program and the accompanying materials -->
<!-- are made available under the terms of the Eclipse Public License v1.0 -->
<!-- which accompanies this distribution, and is available at -->
<!-- http://www.eclipse.org/legal/epl-v10.html -->
<!-- -->
<!-- Contributors: -->
<!-- Intel Corporation - initial implementation and documentation -->
<!-- -->
<site>
<description name="Intel(R) Software Guard Extensions Plug-in" url="http://fso-dev-machine.rd.intel.com/sgx">
This website hosts an evaluation version of the Eclipse Plug-in developed for Secure Guard Extensions Application development for Linux platforms.
</description>
<feature url="features/com.intel.sgx.feature_1.0.1.qualifier.jar" id="com.intel.sgx.feature" version="1.0.1.qualifier">
<category name="com.intel.security.sgx"/>
</feature>
<category-def name="com.intel.security.sgx" label="Intel(R) SGX Eclipse Plugin">
<description>Intel(R) SGX Eclipse Plugin 1.0.1.qualifier</description>
</category-def>
</site>

View File

@ -1,22 +1,22 @@
The eclipse plugin build from command line requires the following variables to be set.
$ECLIPSE_HOME - Path to eclipse home. In order to build the plugin eclipse needs to be installed.
$RELEASE_ID - The release id for the plugin. The release id should be changed for each source codes updates.
$DELETE_CURRENT_ECLIPSE - Delete current eclipse or not. Generally this variable is set to false.
The following plugins are pre-requisites to be installed in Eclipse before trying to build the plugin.
1. Eclipse IDE for C/C++ Developers 4.5.1.20150917-1200 (tested_version)
2. Eclipse PDE Plug-in Developer Resources 3.11.1.v20150904-0345 (tested_version)
run ./build.sh from command line under current directory.
Once the build script is run, the folder build_directory/updatesite/sgx-eclipse-plugin contains the update site. This is the path that needs to be provided to the eclipse while doing installation.
If the Intel(R) Software Guard Extensions (Intel(R) SGX) eclipse plugin is already installed to eclipse and to build and install a newer version, uninstall the old version and start eclipse with the -clean option.
Then try to build the new version of the plugin and install it in eclipse.
http://wiki.eclipse.org/FAQ_How_do_I_remove_a_plug-in%3F
The plugin has been tested with the following Eclipse ADT version
Build: v22.3.0-887826
The eclipse plugin build from command line requires the following variables to be set.
$ECLIPSE_HOME - Path to eclipse home. In order to build the plugin eclipse needs to be installed.
$RELEASE_ID - The release id for the plugin. The release id should be changed for each source codes updates.
$DELETE_CURRENT_ECLIPSE - Delete current eclipse or not. Generally this variable is set to false.
The following plugins are pre-requisites to be installed in Eclipse before trying to build the plugin.
1. Eclipse IDE for C/C++ Developers 4.5.1.20150917-1200 (tested_version)
2. Eclipse PDE Plug-in Developer Resources 3.11.1.v20150904-0345 (tested_version)
run ./build.sh from command line under current directory.
Once the build script is run, the folder build_directory/updatesite/sgx-eclipse-plugin contains the update site. This is the path that needs to be provided to the eclipse while doing installation.
If the Intel(R) Software Guard Extensions (Intel(R) SGX) eclipse plugin is already installed to eclipse and to build and install a newer version, uninstall the old version and start eclipse with the -clean option.
Then try to build the new version of the plugin and install it in eclipse.
http://wiki.eclipse.org/FAQ_How_do_I_remove_a_plug-in%3F
The plugin has been tested with the following Eclipse ADT version
Build: v22.3.0-887826

View File

@ -11,8 +11,6 @@ The Linux\* Intel(R) SGX software stack is comprised of the Intel(R) SGX driver,
The [linux-sgx-driver](https://github.com/01org/linux-sgx-driver) project hosts the out-of-tree driver for the Linux\* Intel(R) SGX software stack, which will be used until the driver upstreaming process is complete.
**Note** This repository includes a subset of the Intel(R) Integrated Performance Primitives (IPP) Cryptography library under [external/crypto_px](external/crypto_px). It is provided as reference implementation for the cryptographic primitives used in SDK and PSW. The primitives are written in pure C and are not optimized for performance. Instructions are provided below for building the SDK and PSW with both precompiled optimized IPP binaries and the non-optimized source code version.
License
-------
See [License.txt](License.txt) for details.
@ -30,12 +28,14 @@ Build and Install the Intel(R) SGX Driver
-----------------------------------------
Follow the instructions in the [linux-sgx-driver](https://github.com/01org/linux-sgx-driver) project to build and install the Intel(R) SGX driver.
**Note:** **SGX 2.0** feature support in the SDK and PSW depends on processor and driver support for the SGX 2.0 instruction set. Please consult the README in the driver for instructions on building the SGX 2.0 Linux Driver. Upcoming CPU releases will include hardware support for SGX 2.0.
Build the Intel(R) SGX SDK and Intel(R) SGX PSW Package
-------------------------------------------------------
### Prerequisites:
- Ensure that you have one of the following required operating systems:
* Ubuntu\* Desktop-16.04-LTS 64bits
* Red Hat Enterprise Linux Server release 7.3 64bits
* Red Hat Enterprise Linux Server release 7.4 64bits
* CentOS 7.3.1611 64bits
- Use the following command(s) to install the required tools to build the Intel(R) SGX SDK:
@ -43,7 +43,7 @@ Build the Intel(R) SGX SDK and Intel(R) SGX PSW Package
```
$ sudo apt-get install build-essential ocaml automake autoconf libtool wget python
```
* On Red Hat Enterprise Linux 7.3 and CentOS 7.3:
* On Red Hat Enterprise Linux 7.4 and CentOS 7.3:
```
$ sudo yum groupinstall 'Development Tools'
$ sudo yum install ocaml wget python
@ -53,9 +53,9 @@ Build the Intel(R) SGX SDK and Intel(R) SGX PSW Package
```
$ sudo apt-get install libssl-dev libcurl4-openssl-dev protobuf-compiler libprotobuf-dev
```
* On Red Hat Enterprise Linux 7.3 and CentOS 7.3:
* On Red Hat Enterprise Linux 7.4 and CentOS 7.3:
```
$ sudo yum install openssl-devel libcurl-devel protobuf-compiler protobuf-devel
$ sudo yum install openssl-devel libcurl-devel protobuf-devel
```
- Use the script ``download_prebuilt.sh`` inside source code package to download prebuilt binaries to prebuilt folder
You may need set an https proxy for the `wget` tool used by the script (such as ``export https_proxy=http://test-proxy:test-port``)
@ -72,11 +72,14 @@ The following steps describe how to build the Intel(R) SGX SDK and PSW. You can
You can find the tools and libraries generated in the `build/linux` directory.
**Note**: You can also go to the `sdk` folder and use the `make` command to build the Intel(R) SGX SDK component only. However, building the PSW component is dependent on the result of building the Intel(R) SGX SDK.
- The default build uses precompiled optimized libraries, which are downloaded by the script ``./download_prebuilt.sh``.
You can also use the non-optimized source code version implementation instead by entering the following command:
- This repository supports to build the Intel(R) SGX SDK based on either precompiled optimized IPP/string/math libraries or open sourced version of SGXSSL/string/math libraries.
The default build uses precompiled optimized libraries, which are downloaded by the script ``./download_prebuilt.sh``.
You can also use the open sourced version implementation instead by entering the following command:
```
$ make USE_OPT_LIBS=0
```
**Note**: Building the Intel(R) SGX PSW with open sourced SGXSSL/string/math libraries is not supported. The above command builds Intel(R) SGX SDK only and the build of PSW part will be skipped.
- To build Intel(R) SGX SDK and PSW with debug information, enter the following command:
```
$ make DEBUG=1
@ -123,14 +126,14 @@ Install the Intel(R) SGX SDK
### Prerequisites
- Ensure that you have one of the following operating systems:
* Ubuntu\* Desktop-16.04-LTS 64bits
* Red Hat Enterprise Linux Server release 7.3 64bits
* Red Hat Enterprise Linux Server release 7.4 64bits
* CentOS 7.3.1611 64bits
- Use the following command to install the required tool to use Intel(R) SGX SDK:
* On Ubuntu 16.04:
```
$ sudo apt-get install build-essential python
```
* On Red Hat Enterprise Linux 7.3 and CentOS 7.3:
* On Red Hat Enterprise Linux 7.4 and CentOS 7.3:
```
$ sudo yum groupinstall 'Development Tools'
$ sudo yum install python
@ -142,6 +145,10 @@ To install the Intel(R) SGX SDK, invoke the installer, as follows:
$ cd linux/installer/bin
$ ./sgx_linux_x64_sdk_${version}.bin
```
NOTE: You need to set up the needed environment variables before compiling your code. To do so, run:
```
$ source ${sgx-sdk-install-path}/environment
```
### Test the Intel(R) SGX SDK Package with the Code Samples
- Compile and run each code sample in Simulation mode to make sure the package works well:
```
@ -150,26 +157,26 @@ $ ./sgx_linux_x64_sdk_${version}.bin
$ ./app
```
Use similar commands for other sample codes.
### Compile and Run the Code Samples in the Hardware Mode
If you use an Intel SGX hardware enabled machine, you can run the code samples in Hardware mode.
Ensure that you install Intel(R) SGX driver and Intel(R) SGX PSW installer on the machine.
See the earlier topic, *Build and Install the Intel(R) SGX Driver*, for information on how to install the Intel(R) SGX driver.
See the later topic, *Install Intel(R) SGX PSW*, for information on how to install the PSW package.
- Compile and run each code sample in Hardware mode, debug build, as follows:
- Compile and run each code sample in Hardware mode, Debug build, as follows:
```
$ cd SampleCode/LocalAttestation
$ make
$ ./app
```
Use similar commands for other code samples.
Use similar commands for other code samples.
Install the Intel(R) SGX PSW
------------------------
----------------------------
### Prerequisites
- Ensure that you have one of the following operating systems:
* Ubuntu\* Desktop-16.04-LTS 64bits
* Red Hat Enterprise Linux Server release 7.3 64bits
* Red Hat Enterprise Linux Server release 7.4 64bits
* CentOS 7.3.1611 64bits
- Ensure that you have a system with the following required hardware:
* 6th Generation Intel(R) Core(TM) Processor or newer
@ -180,7 +187,7 @@ Install the Intel(R) SGX PSW
```
$ sudo apt-get install libssl-dev libcurl4-openssl-dev libprotobuf-dev
```
* On Red Hat Enterprise Linux 7.3 and CentOS 7.3:
* On Red Hat Enterprise Linux 7.4 and CentOS 7.3:
```
$ sudo yum install openssl-devel libcurl-devel protobuf-devel
```
@ -193,7 +200,7 @@ Install the Intel(R) SGX PSW
$ sudo alien --scripts iclsClient-1.45.449.12-1.x86_64.rpm
$ sudo dpkg -i iclsclient_1.45.449.12-2_amd64.deb
```
* On Red Hat Enterprise Linux 7.3 and CentOS 7.3:
* On Red Hat Enterprise Linux 7.4 and CentOS 7.3:
```
$ sudo yum install iclsClient-1.45.449.12-1.x86_64.rpm
```
@ -203,7 +210,7 @@ Install the Intel(R) SGX PSW
$ sudo apt-get install uuid-dev libxml2-dev cmake pkg-config
$ cmake .;make;sudo make install;sudo systemctl enable jhi
```
* On Red Hat Enterprise Linux 7.3 and CentOS 7.3:
* On Red Hat Enterprise Linux 7.4 and CentOS 7.3:
```
$ sudo yum install libuuid-devel libxml2-devel cmake pkgconfig
$ cmake .;make;sudo make install;sudo ldconfig;sudo systemctl enable jhi

View File

@ -41,7 +41,7 @@ enclave {
*/
from "TrustedLibrary/Libcxx.edl" import *;
from "sgx_tstdc.edl" import sgx_thread_wait_untrusted_event_ocall, sgx_thread_set_untrusted_event_ocall, sgx_thread_setwait_untrusted_events_ocall, sgx_thread_set_multiple_untrusted_events_ocall;
from "sgx_tstdc.edl" import *;
/*
* ocall_print_string - invokes OCALL to display string buffer inside the enclave.

View File

@ -330,7 +330,7 @@ void ecall_cxx11_algorithms_demo()
printf("[cxx11_algorithms] Some elements in { 0 1 2 3 4 5 } are even is %s. \n", are_any_of ? "true" : "false");
bool are_none_of = none_of(begin(v), end(v), [](int e) { return e % 2 == 0; });
printf("[cxx11_algorithms] Some elements in { 0 1 2 3 4 5 } are even is %s. \n", are_none_of ? "true" : "false");
printf("[cxx11_algorithms] None elements in { 0 1 2 3 4 5 } are even is %s. \n", are_none_of ? "true" : "false");
printf("\n"); // end of demo
}
@ -594,10 +594,10 @@ void ecall_new_container_classes_demo()
const int searchVal = 3;
std::unordered_set<int>::const_iterator got = set_of_numbers.find(searchVal);
if (got == set_of_numbers.end())
if (got != set_of_numbers.end())
printf("[new_container_classes] unordered_set { 0, 1, 2, 3, 4, 5} has value 3.\n");
else
printf("[new_container_classes] unordered_set { 0, 1, 2, 3, 4, 5} it does not have value 3.\n");
printf("[new_container_classes] unordered_set { 0, 1, 2, 3, 4, 5} does not have value 3.\n");
// unordered_multiset
// container used for fast acces that groups non unique elements in buckets based on their hash

View File

@ -26,7 +26,9 @@ The project demonstrates serveral C++11 features inside the Enclave:
How to Build/Execute the C++11 sample program
---------------------------------------------
1. Install Intel(R) Software Guard Extensions (Intel(R) SGX) SDK for Linux* OS
2. Build the project with the prepared Makefile:
2. Make sure your environment is set:
$ source ${sgx-sdk-install-path}/environment
3. Build the project with the prepared Makefile:
a. Hardware Mode, Debug build:
$ make
b. Hardware Mode, Pre-release build:
@ -39,6 +41,6 @@ How to Build/Execute the C++11 sample program
$ make SGX_MODE=SIM SGX_PRERELEASE=1 SGX_DEBUG=0
f. Simulation Mode, Release build:
$ make SGX_MODE=SIM SGX_DEBUG=0
3. Execute the binary directly:
4. Execute the binary directly:
$ ./app
4. Remember to "make clean" before switching build mode
5. Remember to "make clean" before switching build mode

View File

@ -118,7 +118,7 @@ int _tmain(int argc, _TCHAR* argv[])
printf("\nLoad Enclave Failure");
}
printf("\nAvaliable Enclaves");
printf("\nAvailable Enclaves");
printf("\nEnclave1 - EnclaveID %" PRIx64, e1_enclave_id);
printf("\nEnclave2 - EnclaveID %" PRIx64, e2_enclave_id);
printf("\nEnclave3 - EnclaveID %" PRIx64, e3_enclave_id);

View File

@ -9,7 +9,9 @@ The project demonstrates:
How to Build/Execute the Sample Code
------------------------------------
1. Install Intel(R) Software Guard Extensions (Intel(R) SGX) SDK for Linux* OS
2. Build the project with the prepared Makefile:
2. Make sure your environment is set:
$ source ${sgx-sdk-install-path}/environment
3. Build the project with the prepared Makefile:
a. Hardware Mode, Debug build:
$ make
b. Hardware Mode, Pre-release build:
@ -22,6 +24,6 @@ How to Build/Execute the Sample Code
$ make SGX_MODE=SIM SGX_PRERELEASE=1 SGX_DEBUG=0
f. Simulation Mode, Release build:
$ make SGX_MODE=SIM SGX_DEBUG=0
3. Execute the binary directly:
4. Execute the binary directly:
$ ./app
4. Remember to "make clean" before switching build mode
5. Remember to "make clean" before switching build mode

View File

@ -90,7 +90,7 @@ else
App_Compile_CFlags += -DNDEBUG -UEDEBUG -UDEBUG
endif
App_Compile_CXXFlags := -std=c++0x $(App_Compile_CFlags)
App_Compile_CXXFlags := -std=c++11 $(App_Compile_CFlags)
App_Link_Flags := -L$(SGX_LIBRARY_PATH) -l$(Urts_Library_Name) -lpthread
ifneq ($(SGX_MODE), HW)

View File

@ -8,7 +8,9 @@ Software Guard Extensions projects development.
How to Build/Execute the Sample Code
------------------------------------
1. Install Intel(R) Software Guard Extensions (Intel(R) SGX) SDK for Linux* OS
2. Build the project with the prepared Makefile:
2. Make sure your environment is set:
$ source ${sgx-sdk-install-path}/environment
3. Build the project with the prepared Makefile:
a. Hardware Mode, Debug build:
$ make
b. Hardware Mode, Pre-release build:
@ -21,6 +23,6 @@ How to Build/Execute the Sample Code
$ make SGX_MODE=SIM SGX_PRERELEASE=1 SGX_DEBUG=0
f. Simulation Mode, Release build:
$ make SGX_MODE=SIM SGX_DEBUG=0
3. Execute the binary directly:
4. Execute the binary directly:
$ ./app
4. Remember to "make clean" before switching build mode
5. Remember to "make clean" before switching build mode

View File

@ -9,7 +9,9 @@ The project demonstrates:
How to Build/Execute the Sample Code
------------------------------------
1. Install Intel(R) Software Guard Extensions (Intel(R) SGX) SDK for Linux* OS
2. Build the project with the prepared Makefile:
2. Make sure your environment is set:
$ source ${sgx-sdk-install-path}/environment
3. Build the project with the prepared Makefile:
a. Hardware Mode, Debug build:
$ make
b. Hardware Mode, Pre-release build:
@ -22,6 +24,6 @@ How to Build/Execute the Sample Code
$ make SGX_MODE=SIM SGX_PRERELEASE=1 SGX_DEBUG=0
f. Simulation Mode, Release build:
$ make SGX_MODE=SIM SGX_DEBUG=0
3. Execute the binary directly:
4. Execute the binary directly:
$ ./app
4. Remember to "make clean" before switching build mode
5. Remember to "make clean" before switching build mode

View File

@ -146,7 +146,7 @@ void print_error_message(sgx_status_t ret)
}
if (idx == ttl)
printf("Error: Unexpected error occurred.\n");
printf("Error code is 0x%X. Please refer to the \"Intel SGX SDK Developer Reference\" for more details.\n", ret);
}
/* Initialize the enclave:

View File

@ -44,7 +44,7 @@ void ecall_libc_functions(void)
if (ret != SGX_SUCCESS)
abort();
int cpuid[4] = {0x1, 0x0, 0x0, 0x0};
int cpuid[4] = {0x0, 0x0, 0x0, 0x0};
ret = ecall_sgx_cpuid(global_eid, cpuid, 0x0);
if (ret != SGX_SUCCESS)
abort();

View File

@ -50,6 +50,6 @@ enclave {
/*
* Utilize SGX version __cpuid() in enclave.
*/
public void ecall_sgx_cpuid([in, out] int cpuinfo[4], int leaf);
public void ecall_sgx_cpuid([out] int cpuinfo[4], int leaf);
};
};

View File

@ -0,0 +1,28 @@
<EnclaveConfiguration>
<ProdID>0</ProdID>
<ISVSVN>0</ISVSVN>
<!-- If TCSMaxNum == TCSNum == TCSMinPool, there is no dynamic thread -->
<!-- If TCSMaxNum is omitted, it defaults to TCSNum -->
<!-- According to this setting, there are 10 static threads available -->
<TCSMaxNum>10</TCSMaxNum>
<TCSNum>10</TCSNum>
<TCSMinPool>10</TCSMinPool>
<TCSPolicy>1</TCSPolicy>
<!-- Since there's no dynamic thread, only StackMaxSize is relevant here -->
<StackMaxSize>0x40000</StackMaxSize>
<!-- When there's no gap between HeapMinSize and HeapInitSize, or between
HeapInitSize and HeapMaxSize, no dynamic heap expansion will occur. -->
<!-- In this case, the total available heap is 1 MB-->
<HeapMaxSize>0x100000</HeapMaxSize>
<HeapInitSize>0x100000</HeapInitSize>
<HeapMinSize>0x100000</HeapMinSize>
<!-- Recommend changing 'DisableDebug' to 1 to make the enclave undebuggable for enclave release -->
<DisableDebug>0</DisableDebug>
<MiscSelect>0</MiscSelect>
<MiscMask>0xFFFFFFFF</MiscMask>
</EnclaveConfiguration>

View File

@ -0,0 +1,25 @@
<EnclaveConfiguration>
<ProdID>0</ProdID>
<ISVSVN>0</ISVSVN>
<StackMaxSize>0x40000</StackMaxSize>
<!-- On a system with SGX EDMM, the amount of available heap once the enclave
is initialized is HeapMinSize (0x1000 bytes). The gap between HeapMinSize
and HeapMaxSize will be expanded as necessary.
On a system without SGX EDMM, the amount of available heap once the enclave
is initialized is HeapInitSize (0x40000 bytes), and there is no heap expansion.
-->
<HeapMaxSize>0x100000</HeapMaxSize>
<HeapInitSize>0x40000</HeapInitSize>
<HeapMinSize>0x1000</HeapMinSize>
<TCSMaxNum>10</TCSMaxNum>
<TCSNum>10</TCSNum>
<TCSMinPool>10</TCSMinPool>
<TCSPolicy>1</TCSPolicy>
<!-- Recommend changing 'DisableDebug' to 1 to make the enclave undebuggable for enclave release -->
<DisableDebug>0</DisableDebug>
<MiscSelect>0</MiscSelect>
<MiscMask>0xFFFFFFFF</MiscMask>
</EnclaveConfiguration>

View File

@ -0,0 +1,27 @@
<EnclaveConfiguration>
<ProdID>0</ProdID>
<ISVSVN>0</ISVSVN>
<!--In this case, there will be 3 static threads available and up to 7 threads
can be created dynamically as necessary.
-->
<TCSNum>10</TCSNum>
<TCSMinPool>3</TCSMinPool>
<TCSPolicy>1</TCSPolicy>
<!-- For a static thread, total stack available is 0x40000 bytes. -->
<!-- For a dynamic thread, once it is created, total stack available is
0x40000 bytes and no stack expansion will occur.
-->
<StackMaxSize>0x40000</StackMaxSize>
<StackMinSize>0x40000</StackMinSize>
<!-- HeapMinSize is omitted, defaults to 0x1000 -->
<!-- HeapInitSize is omitted, defaults to HeapMaxSize -->
<HeapMaxSize>0x100000</HeapMaxSize>
<!-- Recommend changing 'DisableDebug' to 1 to make the enclave undebuggable for enclave release -->
<DisableDebug>0</DisableDebug>
<MiscSelect>0</MiscSelect>
<MiscMask>0xFFFFFFFF</MiscMask>
</EnclaveConfiguration>

View File

@ -0,0 +1,23 @@
<EnclaveConfiguration>
<ProdID>0</ProdID>
<ISVSVN>0</ISVSVN>
<TCSNum>10</TCSNum>
<TCSMinPool>3</TCSMinPool>
<TCSPolicy>1</TCSPolicy>
<!-- For a static thread, total available stack is 0x40000 -->
<!-- For a dynamic thread, once it is creted, available stack is
0x2000, the gap, that is 0x40000 - 0x2000, can be dynamically
expanded as necessary.
-->
<StackMaxSize>0x40000</StackMaxSize>
<StackMinSize>0x2000</StackMinSize>
<HeapMaxSize>0x100000</HeapMaxSize>
<!-- Recommend changing 'DisableDebug' to 1 to make the enclave undebuggable for enclave release -->
<DisableDebug>0</DisableDebug>
<MiscSelect>0</MiscSelect>
<MiscMask>0xFFFFFFFF</MiscMask>
</EnclaveConfiguration>

View File

@ -11,7 +11,9 @@ Extensions (Intel(R) SGX) SDK:
How to Build/Execute the Sample Code
------------------------------------
1. Install Intel(R) SGX SDK for Linux* OS
2. Build the project with the prepared Makefile:
2. Make sure your environment is set:
$ source ${sgx-sdk-install-path}/environment
3. Build the project with the prepared Makefile:
a. Hardware Mode, Debug build:
$ make
b. Hardware Mode, Pre-release build:
@ -24,7 +26,44 @@ How to Build/Execute the Sample Code
$ make SGX_MODE=SIM SGX_PRERELEASE=1 SGX_DEBUG=0
f. Simulation Mode, Release build:
$ make SGX_MODE=SIM SGX_DEBUG=0
3. Execute the binary directly:
4. Execute the binary directly:
$ ./app
4. Remember to "make clean" before switching build mode
5. Remember to "make clean" before switching build mode
------------------------------------------
Explanation about Configuration Parameters
------------------------------------------
TCSMaxNum, TCSNum, TCSMinPool
These three parameters will determine whether a thread will be created
dynamically when there is no available thread to do the work.
StackMaxSize, StackMinSize
For a dynamically created thread, StackMinSize is the amount of stack available
once the thread is created and StackMaxSize is the total amount of stack that
thread can use. The gap between StackMinSize and StackMaxSize is the stack
dynamically expanded as necessary at runtime.
For a static thread, only StackMaxSize is relevant which specifies the total
amount of stack available to the thread.
HeapMaxSize, HeapInitSize, HeapMinSize
HeapMinSize is the amount of heap available once the enclave is initialized.
HeapMaxSize is the total amount of heap an enclave can use. The gap between
HeapMinSize and HeapMaxSize is the heap dynamically expanded as necessary
at runtime.
HeapInitSize is here for compatibility.
-------------------------------------------------
Sample configuration files for the Sample Enclave
-------------------------------------------------
config.01.xml: There is no dynamic thread, no dynamic heap expansion.
config.02.xml: There is no dynamic thread. But dynamic heap expansion can happen.
config.03.xml: There are dynamic threads. For a dynamic thread, there's no stack expansion.
config.04.xml: There are dynamic threads. For a dynamic thread, stack will expanded as necessary.

View File

@ -114,11 +114,11 @@ static uint32_t verify_sealed_data(
break;
case SGX_ERROR_INVALID_ISVSVN:
/* Indicates isv_svn field of the sealed data is greater than
the enclaves ISVSVN. This is a downgraded enclave.*/
the enclave's ISVSVN. This is a downgraded enclave.*/
break;
case SGX_ERROR_INVALID_CPUSVN:
/* Indicates cpu_svn field of the sealed data is greater than
the platforms cpu_svn. enclave is on a downgraded platform.*/
the platform's cpu_svn. enclave is on a downgraded platform.*/
break;
case SGX_ERROR_INVALID_KEYNAME:
/*Indicates key_name field of the sealed data is incorrect.*/
@ -504,11 +504,11 @@ uint32_t perform_time_based_policy(const uint8_t* sealed_log,
break;
case SGX_ERROR_INVALID_ISVSVN:
/* Indicates isv_svn field of the sealed data is greater than the
enclaves ISVSVN. This is a downgraded enclave.*/
enclave's ISVSVN. This is a downgraded enclave.*/
break;
case SGX_ERROR_INVALID_CPUSVN:
/* Indicates cpu_svn field of the sealed data is greater than the
platforms cpu_svn. enclave is on a downgraded platform.*/
platform's cpu_svn. enclave is on a downgraded platform.*/
break;
case SGX_ERROR_INVALID_KEYNAME:
/*Indicates key_name field of the sealed data is incorrect.*/

View File

@ -11,7 +11,9 @@ replay-protected policy, and Trusted Time to enforce time based policy
How to Build/Execute the Sample Code
------------------------------------
1. Install Intel(R) Software Guard Extensions (Intel(R) SGX) SDK for Linux* OS
2. Build the project with the prepared Makefile:
2. Make sure your environment is set:
$ source ${sgx-sdk-install-path}/environment
3. Build the project with the prepared Makefile:
a. Hardware Mode, Debug build:
$ make
b. Hardware Mode, Pre-release build:
@ -24,6 +26,6 @@ How to Build/Execute the Sample Code
$ make SGX_MODE=SIM SGX_PRERELEASE=1 SGX_DEBUG=0
f. Simulation Mode, Release build:
$ make SGX_MODE=SIM SGX_DEBUG=0
3. Execute the binary directly:
4. Execute the binary directly:
$ ./app
4. Remember to "make clean" before switching build mode
5. Remember to "make clean" before switching build mode

View File

@ -75,10 +75,10 @@ else
endif
ifdef DEBUG
COMMON_FLAGS += -ggdb -DDEBUG -UNDEBUG
COMMON_FLAGS += -O0 -ggdb -DDEBUG -UNDEBUG
COMMON_FLAGS += -DSE_DEBUG_LEVEL=SE_TRACE_DEBUG
else
COMMON_FLAGS += -O2 -UDEBUG -DNDEBUG
COMMON_FLAGS += -O2 -D_FORTIFY_SOURCE=2 -UDEBUG -DNDEBUG
endif
ifdef SE_SIM
@ -99,13 +99,7 @@ CFLAGS += -Wjump-misses-init -Wstrict-prototypes -Wunsuffixed-float-constants
# additional warnings flags for C++
CXXFLAGS += -Wnon-virtual-dtor
# for static_assert()
CXXFLAGS += -std=c++0x
# Disable cxx11 abi
CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0
CXXFLAGS += $(EXTRA_CXXFLAGS)
CXXFLAGS += -std=c++11
.DEFAULT_GOAL := all
# this turns off the RCS / SCCS implicit rules of GNU Make
@ -153,6 +147,9 @@ endif
CFLAGS += $(COMMON_FLAGS)
CXXFLAGS += $(COMMON_FLAGS)
# Enable the security flags
COMMON_LDFLAGS := -Wl,-z,relro,-z,now,-z,noexecstack
# Compiler and linker options for an Enclave
#
# We are using '--export-dynamic' so that `g_global_data_sim' etc.
@ -163,31 +160,25 @@ CXXFLAGS += $(COMMON_FLAGS)
# as `global' in the LD version script.
ENCLAVE_CFLAGS = -ffreestanding -nostdinc -fvisibility=hidden -fpie
ENCLAVE_CXXFLAGS = $(ENCLAVE_CFLAGS) -nostdinc++
ENCLAVE_LDFLAGS = -Wl,-Bstatic -Wl,-Bsymbolic -Wl,--no-undefined \
ENCLAVE_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-Bstatic -Wl,-Bsymbolic -Wl,--no-undefined \
-Wl,-pie,-eenclave_entry -Wl,--export-dynamic \
-Wl,--defsym,__ImageBase=0
# Choose to use the optimized libraries (IPP/String/Math) by default.
# Users could also use the non-optimized source code version by
# Users could also use the source code version (SGXSSL/String/Math) by
# explicitly specifying 'USE_OPT_LIBS=0'
USE_OPT_LIBS ?= 1
ifeq ($(ARCH), x86_64)
IPP_SUBDIR = intel64
else
IPP_SUBDIR = ia32
endif
ifneq ($(USE_OPT_LIBS), 0)
SGX_IPP_DIR := $(ROOT_DIR)/external/ippcp_internal
SGX_IPP_INC := $(SGX_IPP_DIR)/inc
IPP_LIBS_DIR := $(SGX_IPP_DIR)/lib/linux/$(IPP_SUBDIR)
LD_IPP := -lippcp -lippcore
else
SGX_IPP_DIR := $(ROOT_DIR)/external/crypto_px
SGX_IPP_INC := $(SGX_IPP_DIR)/include
IPP_LIBS_DIR := $(SGX_IPP_DIR)
LD_IPP := -lcrypto_px
endif
SGX_IPP_DIR := $(ROOT_DIR)/external/ippcp_internal
SGX_IPP_INC := $(SGX_IPP_DIR)/inc
IPP_LIBS_DIR := $(SGX_IPP_DIR)/lib/linux/$(IPP_SUBDIR)
LD_IPP := -lippcp -lippcore

View File

@ -158,6 +158,10 @@ typedef uint64_t si_flags_t;
#define SI_FLAG_SECS (0x00<<SI_FLAG_PT_LOW_BIT) /* SECS */
#define SI_FLAG_TCS (0x01<<SI_FLAG_PT_LOW_BIT) /* TCS */
#define SI_FLAG_REG (0x02<<SI_FLAG_PT_LOW_BIT) /* Regular Page */
#define SI_FLAG_TRIM (0x04<<SI_FLAG_PT_LOW_BIT) /* Trim Page */
#define SI_FLAG_PENDING 0x8
#define SI_FLAG_MODIFIED 0x10
#define SI_FLAG_PR 0x20
#define SI_FLAGS_EXTERNAL (SI_FLAG_PT_MASK | SI_FLAG_R | SI_FLAG_W | SI_FLAG_X) /* Flags visible/usable by instructions */
#define SI_FLAGS_R (SI_FLAG_R|SI_FLAG_REG)
@ -190,6 +194,7 @@ typedef struct _page_info_t
#define SE_KEY_SIZE 384 /* in bytes */
#define SE_EXPONENT_SIZE 4 /* RSA public key exponent size in bytes */
typedef struct _css_header_t { /* 128 bytes */
uint8_t header[12]; /* (0) must be (06000000E100000000000100H) */
uint32_t type; /* (12) bit 31: 0 = prod, 1 = debug; Bit 30-0: Must be zero */

View File

@ -0,0 +1,52 @@
/*
* Copyright (C) 2011-2017 Intel Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef _CRYPTO_WRAPPER_H
#define _CRYPTO_WRAPPER_H
#include <openssl/evp.h>
#include "sgx_report.h"
#include "sgx_error.h"
#ifdef __cplusplus
extern "C" {
#endif
sgx_status_t sgx_EVP_Digest(const EVP_MD *type, const uint8_t *p_src, unsigned int src_len, uint8_t *digest, unsigned int *digest_len);
sgx_status_t sgx_cmac128_msg(const sgx_key_128bit_t key, const uint8_t *p_src, unsigned int src_len, sgx_mac_t *p_mac);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -49,6 +49,8 @@
#include "uncopyable.h"
#include <string.h>
#include "file.h"
#include "isgx_user.h"
// this is the interface to both hardware, simulation and signing mode
class EnclaveCreator : private Uncopyable
@ -68,12 +70,19 @@ public:
virtual int destroy_enclave(sgx_enclave_id_t enclave_id, uint64_t enclave_size = 0) = 0;
virtual int initialize(sgx_enclave_id_t enclave_id) = 0;
virtual bool use_se_hw() const = 0;
virtual bool is_EDMM_supported(sgx_enclave_id_t enclave_id) = 0;
virtual bool is_driver_compatible() = 0;
virtual int get_misc_attr(sgx_misc_attribute_t *sgx_misc_attr, metadata_t *metadata, SGXLaunchToken * const lc, uint32_t flag) = 0;
virtual bool get_plat_cap(sgx_misc_attribute_t *se_attr) = 0;
#ifdef SE_1P5_VERTICAL
virtual uint32_t handle_page_fault(uint64_t pf_address) { UNUSED(pf_address); return (uint32_t)SGX_ERROR_UNEXPECTED; }
#endif
virtual int emodpr(uint64_t addr, uint64_t size, uint64_t flag) = 0;
virtual int mktcs(uint64_t tcs_addr) = 0;
virtual int trim_range(uint64_t fromaddr, uint64_t toaddr) = 0;
virtual int trim_accept(uint64_t addr) = 0;
virtual int remove_range(uint64_t fromaddr, uint64_t numpages) = 0;
// destructor
virtual ~EnclaveCreator() {};
};

View File

@ -41,15 +41,21 @@
#include "se_types.h"
#include "thread_data.h"
#include "metadata.h"
#include "rts.h"
#define LAYOUT_ENTRY_NUM 38
typedef struct _global_data_t
{
sys_word_t enclave_size;
sys_word_t heap_offset;
sys_word_t heap_size;
uint32_t thread_policy;
uint32_t reserved;
sys_word_t thread_policy;
thread_data_t td_template;
uint8_t tcs_template[TCS_TEMPLATE_SIZE];
uint32_t layout_entry_num;
uint32_t reserved;
layout_t layout_table[LAYOUT_ENTRY_NUM];
} global_data_t;
#define ENCLAVE_INIT_NOT_STARTED 0
@ -62,7 +68,11 @@ extern "C" {
#endif
extern SE_DECLSPEC_EXPORT global_data_t const volatile g_global_data;
extern uint32_t g_enclave_state;
extern sdk_version_t g_sdk_version;
extern int EDMM_supported;
extern uint8_t __ImageBase;
extern int g_xsave_enabled;
#ifdef __cplusplus
}

View File

@ -40,6 +40,7 @@ extern "C" {
#endif
void init_global_object(void);
void uninit_global_object(void);
#ifdef __cplusplus
}

View File

@ -45,6 +45,7 @@ typedef enum {
SE_EENTER,
SE_ERESUME,
SE_EEXIT,
SE_EACCEPT,
SE_LAST_RING3,
SE_ECREATE = 0x0,

View File

@ -85,6 +85,9 @@
#define SE_EGETKEY 1
#define SE_EENTER 2
#define SE_EEXIT 4
#define SE_EACCEPT 5
#define SE_EMODPE 6
#define SE_ECREATE 0
#define SE_EADD 1

View File

@ -37,16 +37,22 @@
#pragma pack(1)
/* version of metadata */
#define MAJOR_VERSION 1 /* MAJOR_VERSION should not larger than 0ffffffff */
#define MINOR_VERSION 4 /* MINOR_VERSION should not larger than 0ffffffff */
#define MAJOR_VERSION 2 //MAJOR_VERSION should not larger than 0ffffffff
#define MINOR_VERSION 1 //MINOR_VERSION should not larger than 0ffffffff
#define SGX_1_9_MAJOR_VERSION 1 //MAJOR_VERSION should not larger than 0ffffffff
#define SGX_1_9_MINOR_VERSION 4 //MINOR_VERSION should not larger than 0ffffffff
#define SGX_1_5_MAJOR_VERSION 1 //MAJOR_VERSION should not larger than 0ffffffff
#define SGX_1_5_MINOR_VERSION 3 //MINOR_VERSION should not larger than 0ffffffff
#define META_DATA_MAKE_VERSION(major, minor) (((uint64_t)major)<<32 | minor)
#define METADATA_MAGIC 0x86A80294635D0E4CULL
#define METADATA_SIZE 0x1000
#define METADATA_SIZE 0x3000
#define TCS_TEMPLATE_SIZE 72
/* TCS Policy bit masks */
#define TCS_POLICY_BIND 0x00000000 /* If set, the TCS is bound to the application thread */
#define TCS_POLICY_UNBIND 0x00000001
@ -58,7 +64,9 @@
#define SSA_FRAME_SIZE_MIN 1
#define SSA_FRAME_SIZE_MAX 2
#define STACK_SIZE_MIN 0x1000
#define HEAP_SIZE_MIN 0
#define STACK_SIZE_MAX 0x40000
#define HEAP_SIZE_MIN 0x1000
#define HEAP_SIZE_MAX 0x1000000
#define DEFAULT_MISC_SELECT 0
#define DEFAULT_MISC_MASK 0xFFFFFFFF
@ -78,13 +86,27 @@ typedef enum
#define GROUP_FLAG (1<<12)
#define GROUP_ID(x) (GROUP_FLAG | x)
#define IS_GROUP_ID(x) !!((x) & GROUP_FLAG)
#define LAYOUT_ID_HEAP 1
#define LAYOUT_ID_TCS 2
#define LAYOUT_ID_TD 3
#define LAYOUT_ID_SSA 4
#define LAYOUT_ID_STACK 5
#define LAYOUT_ID_THREAD_GROUP GROUP_ID(6)
#define LAYOUT_ID_GUARD 7
#define LAYOUT_ID_HEAP_MIN 1
#define LAYOUT_ID_HEAP_INIT 2
#define LAYOUT_ID_HEAP_MAX 3
#define LAYOUT_ID_TCS 4
#define LAYOUT_ID_TD 5
#define LAYOUT_ID_SSA 6
#define LAYOUT_ID_STACK_MAX 7
#define LAYOUT_ID_STACK_MIN 8
#define LAYOUT_ID_THREAD_GROUP GROUP_ID(9)
#define LAYOUT_ID_GUARD 10
#define LAYOUT_ID_HEAP_DYN_MIN 11
#define LAYOUT_ID_HEAP_DYN_INIT 12
#define LAYOUT_ID_HEAP_DYN_MAX 13
#define LAYOUT_ID_TCS_DYN 14
#define LAYOUT_ID_TD_DYN 15
#define LAYOUT_ID_SSA_DYN 16
#define LAYOUT_ID_STACK_DYN_MAX 17
#define LAYOUT_ID_STACK_DYN_MIN 18
#define LAYOUT_ID_THREAD_GROUP_DYN GROUP_ID(19)
/*
** layout table example
@ -138,12 +160,12 @@ typedef struct _metadata_t
uint32_t ssa_frame_size; /* The size of SSA frame in page */
uint32_t max_save_buffer_size; /* Max buffer size is 2632 */
uint32_t desired_misc_select;
uint32_t reserved;
uint32_t tcs_min_pool; /* TCS min pool*/
uint64_t enclave_size; /* enclave virtual size */
sgx_attributes_t attributes; /* XFeatureMask to be set in SECS. */
enclave_css_t enclave_css; /* The enclave signature */
data_directory_t dirs[DIR_NUM];
uint8_t data[2208];
uint8_t data[10400];
}metadata_t;
se_static_assert(sizeof(metadata_t) == METADATA_SIZE);

View File

@ -63,12 +63,29 @@ typedef enum
SDK_VERSION_2_0
} sdk_version_t;
typedef struct _cpu_feature_sdk_version
typedef struct _system_features
{
uint64_t cpu_features;
sdk_version_t version;
}cpu_sdk_info_t;
/* system feature set array. MSb of each element indicates whether this is
* the last element. This will help tRTS to know when it can stop walking
* through the array searching for certain features.
*/
uint64_t system_feature_set[1];
}system_features_t;
// current system_feature_set only contains one element of type uint64_t, the highest
// bit is bit 63
#define SYS_FEATURE_MSb 63
#define OCALL_FLAG 0x4F434944
typedef enum
{
EDMM_TRIM = -2,
EDMM_TRIM_COMMIT = -3,
EDMM_MODPR = -4,
}edmm_ocall_t;
#define OCALL_FLAG 0x4F434944
#endif

View File

@ -30,10 +30,12 @@
*/
/* ECALL command */
#define ECMD_ECALL 0
#define ECMD_INIT_ENCLAVE -1
#define ECMD_ORET -2
#define ECMD_EXCEPT -3
#define ECMD_ECALL 0
#define ECMD_INIT_ENCLAVE -1
#define ECMD_ORET -2
#define ECMD_EXCEPT -3
#define ECMD_MKTCS -4
#define ECMD_UNINIT_ENCLAVE -5
/* OCALL command */
#define OCMD_ERET -1

View File

@ -49,6 +49,21 @@ private:
se_mutex_t m_mutex;
};
class Cond: private Uncopyable
{
public:
Cond(){se_mutex_init(&m_mutex); se_thread_cond_init(&m_cond);}
~Cond(){se_mutex_destroy(&m_mutex); se_thread_cond_destroy(&m_cond);}
void lock(){se_mutex_lock(&m_mutex);}
void unlock(){se_mutex_unlock(&m_mutex);}
void wait(){se_thread_cond_wait(&m_cond, &m_mutex);}
void signal(){se_thread_cond_signal(&m_cond);}
void broadcast(){se_thread_cond_broadcast(&m_cond);}
private:
se_mutex_t m_mutex;
se_cond_t m_cond;
};
class LockGuard: private Uncopyable
{
public:

View File

@ -32,16 +32,29 @@
#ifndef _SE_PAGE_ATTR_H_
#define _SE_PAGE_ATTR_H_
// layout.entry.attribute is 16-bit length
typedef enum
{
DoEADD = 0,
DoEEXTEND,
DoEREMOVE,
DoPostADD,
DoPostREMOVE,
DynTHREAD,
GrowDOWN,
} ATTRIBUTE_BITS_t;
typedef enum
{
ADD_PAGE_ONLY = 1<<DoEADD,
ADD_EXTEND_PAGE = 1<<DoEADD|1<<DoEEXTEND,
} EADD_BUFFER_IN_ATTRIBUTE_t;
#define PAGE_ATTR_EADD (1<<DoEADD)
#define PAGE_ATTR_EEXTEND (1<<DoEEXTEND)
#define PAGE_ATTR_EREMOVE (1<<DoEREMOVE)
#define PAGE_ATTR_POST_ADD (1<<DoPostADD)
#define PAGE_ATTR_POST_REMOVE (1<<DoPostREMOVE)
#define PAGE_ATTR_DYN_THREAD (1<<DynTHREAD)
#define PAGE_DIR_GROW_DOWN (1<<GrowDOWN)
#define ADD_PAGE_ONLY PAGE_ATTR_EADD
#define ADD_EXTEND_PAGE (PAGE_ATTR_EADD | PAGE_ATTR_EEXTEND)
#define PAGE_ATTR_MASK ~(PAGE_ATTR_EADD | PAGE_ATTR_EEXTEND | PAGE_ATTR_EREMOVE | PAGE_ATTR_POST_ADD | PAGE_ATTR_POST_REMOVE | PAGE_ATTR_DYN_THREAD | PAGE_DIR_GROW_DOWN)
#endif

View File

@ -0,0 +1,58 @@
/*
* Copyright (C) 2011-2017 Intel Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef _SE_TCRYPTO_COMMON_H_
#define _SE_TCRYPTO_COMMON_H_
#ifdef USE_SGXSSL
#ifdef DEBUG
extern unsigned long openssl_last_err;
#define CLEAR_OPENSSL_ERROR_QUEUE while ((openssl_last_err = ERR_get_error())) { } \
openssl_last_err = 0
#define GET_LAST_OPENSSL_ERROR openssl_last_err = ERR_get_error()
#else
#define CLEAR_OPENSSL_ERROR_QUEUE {}
#define GET_LAST_OPENSSL_ERROR {}
#endif //DEBUG
#endif //USE_SGXSSL
#endif //_SE_TCRYPTO_COMMON_H_

View File

@ -42,7 +42,8 @@
#include <unistd.h>
#include <sys/syscall.h>
#include <pthread.h>
typedef pthread_mutex_t se_mutex_t;
typedef pthread_mutex_t se_mutex_t;
typedef pthread_cond_t se_cond_t;
typedef pid_t se_thread_id_t;
typedef pthread_key_t se_tls_index_t;
@ -58,6 +59,12 @@ int se_mutex_lock(se_mutex_t* mutex);
int se_mutex_unlock(se_mutex_t* mutex);
int se_mutex_destroy(se_mutex_t* mutex);
void se_thread_cond_init(se_cond_t* cond);
int se_thread_cond_wait(se_cond_t *cond, se_mutex_t *mutex);
int se_thread_cond_signal(se_cond_t *cond);
int se_thread_cond_broadcast(se_cond_t *cond);
int se_thread_cond_destroy(se_cond_t* cond);
unsigned int se_get_threadid(void);
/* tls functions */

View File

@ -28,5 +28,5 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#define STRFILEVER "1.9.100.39124"
#define STRFILEVER "2.0.40950"

View File

@ -0,0 +1,63 @@
/*
* Copyright (C) 2011-2017 Intel Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef _SGX_ECC256_INTERNAL_H
#define _SGX_ECC256_INTERNAL_H
#include "sgx_tcrypto.h"
typedef struct _sgx_ec256_shared_point_t
{
uint8_t x[SGX_ECP256_KEY_SIZE];
uint8_t y[SGX_ECP256_KEY_SIZE];
} sgx_ec256_shared_point_t;
#ifdef __cplusplus
extern "C"
#endif
/* NOTE: The function is for internal use ONLY
*
* Computes a point with scalar multiplication based on private B key (local) and remote public Ga Key
* Parameters:
* Return: sgx_status_t - SGX_SUCCESS or failure as defined in sgx_error.h
* Inputs: sgx_ecc_state_handle_t ecc_handle - Handle to the ECC crypto system
* sgx_ec256_private_t *p_private_b - Pointer to the local private key
* sgx_ec256_public_t *p_public_ga - Pointer to the remote public key
* Output: sgx_ec256_shared_point_t *p_shared_key - Pointer to the target shared point
*/
sgx_status_t SGXAPI sgx_ecc256_compute_shared_point(sgx_ec256_private_t *p_private_b,
sgx_ec256_public_t *p_public_ga,
sgx_ec256_shared_point_t *p_shared_key,
sgx_ecc_state_handle_t ecc_handle);
#endif

View File

@ -93,8 +93,8 @@ typedef struct _thread_data_t
sys_word_t first_ssa_gpr; /* set by urts, relative to TCS */
sys_word_t stack_guard; /* GCC expects start_guard at 0x14 on x86 and 0x28 on x64 */
sys_word_t reserved;
sys_word_t ssa_frame_size; /* set by urts, in pages (se_ptrace.c needs to know its offset). */
sys_word_t reserved;
sys_word_t xsave_size; /* in bytes (se_ptrace.c needs to know its offset).*/
sys_word_t last_error; /* init to be 0. Used by trts. */
#ifdef TD_SUPPORT_MULTI_PLATFORM
@ -110,6 +110,7 @@ typedef struct _thread_data_t
intptr_t exception_flag;
#endif
sys_word_t cxx_thread_info[6];
sys_word_t stack_commit_addr;
} thread_data_t;
#ifdef __cplusplus

View File

@ -33,6 +33,7 @@
#define _TRTS_INST_H_
#include "sgx.h"
#include "arch.h"
/* Attention:
* if the following alignment requirement changes, go to selib to
@ -55,14 +56,28 @@ typedef enum _egetkey_status_t
EGETKEY_INVALID_KEYNAME = BIT_ERROR(8),
} egetkey_status_t;
struct ms_tcs
{
void * ptcs;
};
#ifdef __cplusplus
extern "C" {
#endif
int sgx_accept_forward(si_flags_t sfl, size_t lo, size_t hi);
void do_ereport(const sgx_target_info_t *target_info, const sgx_report_data_t *report_data, sgx_report_t *report);
int do_egetkey(const sgx_key_request_t *key_request, sgx_key_128bit_t *key);
uint32_t do_rdrand(uint32_t *rand);
int do_eaccept(const sec_info_t *, size_t);
int do_emodpe(const sec_info_t*, size_t);
int apply_EPC_pages(void *start_address, size_t page_number);
int apply_pages_within_exception(void *start_address, size_t page_count);
int trim_EPC_pages(void *start_address, size_t page_number);
sgx_status_t SGXAPI sgx_trts_mprotect(size_t start, size_t size, uint64_t perms);
sgx_status_t do_add_thread(void *ms);
int is_dynamic_thread(void *tcs);
uint32_t get_dynamic_stack_max_page(void);
#ifdef __cplusplus
}
#endif

View File

@ -52,8 +52,8 @@
#define SE_BULK_PAGE_FRAME_MASK (SE_BULK_PAGE_FRAME_SIZE-1)
#define SE_BULK_PAGE_SHIFT (SE_PAGE_SHIFT + SE_BULK_PAGE_FRAME_SHIFT)
#define SE_BULK_PAGE_SIZE (1 << SE_BULK_PAGE_SHIFT)
#define SE_GUARD_PAGE_SHIFT SE_PAGE_SHIFT
#define SE_GUARD_PAGE_SIZE SE_PAGE_SIZE
#define SE_GUARD_PAGE_SHIFT 16
#define SE_GUARD_PAGE_SIZE (1 << SE_GUARD_PAGE_SHIFT)
#define ROUND_TO(x, align) (((x) + ((align)-1)) & ~((align)-1))
#define ROUND_TO_PAGE(x) ROUND_TO(x, SE_PAGE_SIZE)

View File

@ -46,11 +46,8 @@
extern "C" {
#endif
#include "linux/xsave_gnu.h"
void init_xsave_info();
/* implemented in urts_xsave.cpp/trts_xsave.cpp */
void save_and_clean_xfeature_regs(uint8_t *buffer);
void restore_xfeature_regs(const uint8_t *buffer);
/* trts_xsave.cpp */
uint64_t get_xfeature_state();

View File

@ -1,33 +1,33 @@
/*
* Copyright 2011-2017 Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
* Copyright (C) 2011-2017 Intel Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#pragma once
@ -37,10 +37,6 @@
#include "sgx_error.h"
#include "sgx_defs.h"
#if defined(_MSC_VER)
#include <Windows.h>
#endif
typedef enum _sgx_device_status_t {
SGX_ENABLED,
SGX_DISABLED_REBOOT_REQUIRED, /* A reboot is required to finish enabling SGX */
@ -87,4 +83,3 @@ sgx_status_t SGXAPI sgx_cap_get_status(sgx_device_status_t* sgx_device_status);
#endif
#endif

View File

@ -65,6 +65,7 @@ typedef enum _status_t
SGX_ERROR_MODE_INCOMPATIBLE = SGX_MK_ERROR(0x200e), /* The target enclave 32/64 bit mode or sim/hw mode is incompatible with the mode of current uRTS. */
SGX_ERROR_ENCLAVE_FILE_ACCESS = SGX_MK_ERROR(0x200f), /* Can't open enclave file. */
SGX_ERROR_INVALID_MISC = SGX_MK_ERROR(0x2010), /* The MiscSelct/MiscMask settings are not correct.*/
SGX_ERROR_INVALID_LAUNCH_TOKEN = SGX_MK_ERROR(0x2011), /* The launch token is not correct.*/
SGX_ERROR_MAC_MISMATCH = SGX_MK_ERROR(0x3001), /* Indicates verification error for reports, sealed datas, etc */
SGX_ERROR_INVALID_ATTRIBUTE = SGX_MK_ERROR(0x3002), /* The enclave is not authorized */

View File

@ -30,7 +30,7 @@
*/
/**
* File: sgx_tcrypto.h
* Description:
@ -61,12 +61,6 @@ typedef struct _sgx_ec256_dh_shared_t
uint8_t s[SGX_ECP256_KEY_SIZE];
} sgx_ec256_dh_shared_t;
typedef struct _sgx_ec256_dh_shared512_t
{
uint8_t x[SGX_ECP256_KEY_SIZE];
uint8_t y[SGX_ECP256_KEY_SIZE];
} sgx_ec256_dh_shared512_t;
typedef struct _sgx_ec256_private_t
{
uint8_t r[SGX_ECP256_KEY_SIZE];
@ -90,11 +84,12 @@ typedef struct _sgx_rsa3072_public_key_t
uint8_t exp[SGX_RSA3072_PUB_EXP_SIZE];
} sgx_rsa3072_public_key_t;
typedef struct _sgx_rsa3072_private_key_t
typedef struct _sgx_rsa3072_key_t
{
uint8_t mod[SGX_RSA3072_KEY_SIZE];
uint8_t exp[SGX_RSA3072_PRI_EXP_SIZE];
} sgx_rsa3072_private_key_t;
uint8_t d[SGX_RSA3072_PRI_EXP_SIZE];
uint8_t e[SGX_RSA3072_PUB_EXP_SIZE];
} sgx_rsa3072_key_t;
typedef uint8_t sgx_rsa3072_signature_t[SGX_RSA3072_KEY_SIZE];
@ -310,8 +305,8 @@ extern "C" {
* Parameters:
* Return: sgx_status_t - SGX_SUCCESS or failure as defined in sgx_error.h
* Inputs: sgx_cmac_128bit_key_t *p_key - Pointer to the key used in encryption/decryption operation
* uint8_t *p_src - Pointer to the input stream to be MACd
* uint32_t src_len - Length of the input stream to be MACd
* uint8_t *p_src - Pointer to the input stream to be MAC'd
* uint32_t src_len - Length of the input stream to be MAC'd
* Output: sgx_cmac_gcm_128bit_tag_t *p_mac - Pointer to the resultant MAC
*/
sgx_status_t SGXAPI sgx_rijndael128_cmac_msg(const sgx_cmac_128bit_key_t *p_key,
@ -354,16 +349,17 @@ extern "C" {
*/
sgx_status_t SGXAPI sgx_cmac128_close(sgx_cmac_state_handle_t cmac_handle);
/** AES-CTR 128-bit - Only 128-bit key size is supported.
*
* These functions encrypt/decrypt the input data stream of a variable length according
* to the CTR mode as specified in [NIST SP 800-38A]. The counter can be thought of as
* an IV which increments on successive encryption or decrytion calls. For a given
* an IV which increments on successive encryption or decryption calls. For a given
* dataset or data stream the incremented counter block should be used on successive
* calls of the encryption/decryption process for that given stream. However for
* new or different datasets/streams, the same counter should not be reused, instead
* intialize the counter for the new data set.
* Note: SGXSSL based version doesn't support user given ctr_inc_bits. It use OpenSSL's implementation
* which divide the counter block into two parts ([IV][counter])
*
* sgx_aes_ctr_encrypt
* Return: If source, key, counter, or destination pointer is NULL,
@ -393,7 +389,7 @@ extern "C" {
* Output:
* uint8_t *p_dst - Pointer to the cipher text.
* Size of buffer should be >= src_len.
*/
*/
sgx_status_t SGXAPI sgx_aes_ctr_encrypt(
const sgx_aes_ctr_128bit_key_t *p_key,
const uint8_t *p_src,
@ -401,6 +397,7 @@ extern "C" {
uint8_t *p_ctr,
const uint32_t ctr_inc_bits,
uint8_t *p_dst);
sgx_status_t SGXAPI sgx_aes_ctr_decrypt(
const sgx_aes_ctr_128bit_key_t *p_key,
const uint8_t *p_src,
@ -410,6 +407,7 @@ extern "C" {
uint8_t *p_dst);
/**
* Elliptic Curve Cryptography based on GF(p), 256 bit.
*
@ -479,6 +477,7 @@ extern "C" {
sgx_ec256_public_t *p_public,
sgx_ecc_state_handle_t ecc_handle);
/** Checks whether the input point is a valid point on the given elliptic curve.
* Parameters:
* Return: sgx_status_t - SGX_SUCCESS or failure as defined sgx_error.h
@ -490,6 +489,7 @@ extern "C" {
const sgx_ecc_state_handle_t ecc_handle,
int *p_valid);
/** Computes DH shared key based on own (local) private key and remote public Ga Key.
* NOTE: Caller code allocates memory for Shared key pointer to be populated
*
@ -543,20 +543,8 @@ extern "C" {
sgx_ec256_dh_shared_t *p_shared_key,
sgx_ecc_state_handle_t ecc_handle);
/* Computes 512-bit DH shared key based on private B key (local) and remote public Ga Key
* Parameters:
* Return: sgx_status_t - SGX_SUCCESS or failure as defined in sgx_error.h
* Inputs: sgx_ecc_state_handle_t ecc_handle - Handle to the ECC crypto system
* sgx_ec256_private_t *p_private_b - Pointer to the local private key
* sgx_ec256_public_t *p_public_ga - Pointer to the remote public key
* Output: sgx_ec256_dh_shared512_t *p_shared_key - Pointer to the 512-bit shared DH key
*/
sgx_status_t SGXAPI sgx_ecc256_compute_shared_dhkey512(sgx_ec256_private_t *p_private_b,
sgx_ec256_public_t *p_public_ga,
sgx_ec256_dh_shared512_t *p_shared_key,
sgx_ecc_state_handle_t ecc_handle);
/** Computes signature for data based on private key.
/** Computes signature for data based on private key.
*
* A message digest is a fixed size number derived from the original message with
* an applied hash function over the binary code of the message. (SHA256 in this case)
@ -634,12 +622,13 @@ extern "C" {
* Return: sgx_status_t - SGX_SUCCESS or failure as defined in sgx_error.h
* Inputs: uint8_t *p_data - Pointer to the data to be signed
* uint32_t data_size - Size of the data to be signed
* sgx_rsa3072_private_key_t *p_private - Pointer to the private key
* sgx_rsa3072_key_t *p_key - Pointer to the RSA key.
* Note: In IPP based version p_key->e is unused, hence it can be NULL.
* Output: sgx_rsa3072_signature_t *p_signature - Pointer to the signature output
*/
sgx_status_t sgx_rsa3072_sign(const uint8_t *p_data,
uint32_t data_size,
const sgx_rsa3072_private_key_t *p_private,
const sgx_rsa3072_key_t *p_key,
sgx_rsa3072_signature_t *p_signature);
/** Verifies the signature for the given data based on the RSA 3072 public key.

View File

@ -31,7 +31,7 @@
enclave {
untrusted {
[cdecl] void sgx_oc_cpuidex([in, out] int cpuinfo[4], int leaf, int subleaf);
[cdecl] void sgx_oc_cpuidex([out] int cpuinfo[4], int leaf, int subleaf);
/* Go outside and wait on my untrusted event */
[cdecl] int sgx_thread_wait_untrusted_event_ocall([user_check] const void *self);

View File

@ -59,7 +59,7 @@ void* SGXAPI operator new (size_t, void*);
void* SGXAPI operator new[] (size_t, const std::nothrow_t&);
void* SGXAPI operator new[] (size_t, void*);
void SGXAPI operator delete (void*) throw ();
void SGXAPI operator delete (void*);
void SGXAPI operator delete (void*, const std::nothrow_t&);
void SGXAPI operator delete (void*, void*);
void SGXAPI operator delete[] (void*);

View File

@ -0,0 +1,83 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
/***
* mbusafecrt.h - public declarations for SafeCRT lib
*
*
* Purpose:
* This file contains the public declarations SafeCRT
* functions ported to MacOS. These are the safe versions of
* functions standard functions banned by SWI
*
****/
/* shields! */
#ifndef MBUSAFECRT_H
#define MBUSAFECRT_H
#include <string.h>
#include <stdarg.h>
#include <wchar.h>
typedef wchar_t WCHAR;
#ifdef __cplusplus
extern "C" {
#endif
extern errno_t strcat_s( char* ioDest, size_t inDestBufferSize, const char* inSrc );
extern errno_t wcscat_s( WCHAR* ioDest, size_t inDestBufferSize, const WCHAR* inSrc );
extern errno_t strncat_s( char* ioDest, size_t inDestBufferSize, const char* inSrc, size_t inCount );
extern errno_t wcsncat_s( WCHAR* ioDest, size_t inDestBufferSize, const WCHAR* inSrc, size_t inCount );
extern errno_t strcpy_s( char* outDest, size_t inDestBufferSize, const char* inSrc );
extern errno_t wcscpy_s( WCHAR* outDest, size_t inDestBufferSize, const WCHAR* inSrc );
extern errno_t strncpy_s( char* outDest, size_t inDestBufferSize, const char* inSrc, size_t inCount );
extern errno_t wcsncpy_s( WCHAR* outDest, size_t inDestBufferSize, const WCHAR* inSrc, size_t inCount );
extern char* strtok_s( char* inString, const char* inControl, char** ioContext );
extern WCHAR* wcstok_s( WCHAR* inString, const WCHAR* inControl, WCHAR** ioContext );
extern size_t wcsnlen( const WCHAR* inString, size_t inMaxSize );
extern errno_t _itoa_s( int inValue, char* outBuffer, size_t inDestBufferSize, int inRadix );
extern errno_t _itow_s( int inValue, WCHAR* outBuffer, size_t inDestBufferSize, int inRadix );
extern errno_t _ltoa_s( long inValue, char* outBuffer, size_t inDestBufferSize, int inRadix );
extern errno_t _ltow_s( long inValue, WCHAR* outBuffer, size_t inDestBufferSize, int inRadix );
extern errno_t _ultoa_s( unsigned long inValue, char* outBuffer, size_t inDestBufferSize, int inRadix );
extern errno_t _ultow_s( unsigned long inValue, WCHAR* outBuffer, size_t inDestBufferSize, int inRadix );
extern errno_t _i64toa_s( long long inValue, char* outBuffer, size_t inDestBufferSize, int inRadix );
extern errno_t _i64tow_s( long long inValue, WCHAR* outBuffer, size_t inDestBufferSize, int inRadix );
extern errno_t _ui64toa_s( unsigned long long inValue, char* outBuffer, size_t inDestBufferSize, int inRadix );
extern errno_t _ui64tow_s( unsigned long long inValue, WCHAR* outBuffer, size_t inDestBufferSize, int inRadix );
extern int sprintf_s( char *string, size_t sizeInBytes, const char *format, ... );
extern int swprintf_s( WCHAR *string, size_t sizeInWords, const WCHAR *format, ... );
extern int _snprintf_s( char *string, size_t sizeInBytes, size_t count, const char *format, ... );
extern int _snwprintf_s( WCHAR *string, size_t sizeInWords, size_t count, const WCHAR *format, ... );
extern int _vsprintf_s( char* string, size_t sizeInBytes, const char* format, va_list arglist );
extern int _vsnprintf_s( char* string, size_t sizeInBytes, size_t count, const char* format, va_list arglist );
extern int _vswprintf_s( WCHAR* string, size_t sizeInWords, const WCHAR* format, va_list arglist );
extern int _vsnwprintf_s( WCHAR* string, size_t sizeInWords, size_t count, const WCHAR* format, va_list arglist );
extern errno_t memcpy_s( void * dst, size_t sizeInBytes, const void * src, size_t count );
extern errno_t memmove_s( void * dst, size_t sizeInBytes, const void * src, size_t count );
#ifdef __cplusplus
}
#endif
#endif /* MBUSAFECRT_H */

View File

@ -93,25 +93,21 @@ typedef struct {
__BEGIN_DECLS
_TLIBC_NORETURN_ void _TLIBC_CDECL_ abort(void);
int _TLIBC_CDECL_ atexit(void (*)(void));
int _TLIBC_CDECL_ abs(int);
double _TLIBC_CDECL_ atof(const char *);
int _TLIBC_CDECL_ atoi(const char *);
long _TLIBC_CDECL_ atol(const char *);
void * _TLIBC_CDECL_ bsearch(const void *, const void *, size_t, size_t, int (*)(const void *, const void *));
div_t _TLIBC_CDECL_ div(int, int);
void * _TLIBC_CDECL_ calloc(size_t, size_t);
div_t _TLIBC_CDECL_ div(int, int);
void _TLIBC_CDECL_ free(void *);
void * _TLIBC_CDECL_ malloc(size_t);
void * _TLIBC_CDECL_ memalign(size_t, size_t);
void * _TLIBC_CDECL_ realloc(void *, size_t);
void * _TLIBC_CDECL_ __tlibc_calloc(size_t, size_t);
void _TLIBC_CDECL_ __tlibc_free(void *);
void * _TLIBC_CDECL_ __tlibc_malloc(size_t);
void * _TLIBC_CDECL_ __tlibc_memalign(size_t, size_t);
void * _TLIBC_CDECL_ __tlibc_realloc(void *, size_t);
long _TLIBC_CDECL_ labs(long);
ldiv_t _TLIBC_CDECL_ ldiv(long, long);
void * _TLIBC_CDECL_ malloc(size_t);
void * _TLIBC_CDECL_ memalign(size_t, size_t);
void _TLIBC_CDECL_ qsort(void *, size_t, size_t, int (*)(const void *, const void *));
void * _TLIBC_CDECL_ realloc(void *, size_t);
double _TLIBC_CDECL_ strtod(const char *, char **);
long _TLIBC_CDECL_ strtol(const char *, char **, int);
float _TLIBC_CDECL_ strtof(const char *, char **);

View File

@ -0,0 +1,71 @@
/*
* Copyright (C) 2011-2017 Intel Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "crypto_wrapper.h"
#include <openssl/cmac.h>
#include <openssl/evp.h>
#include <stdint.h>
#include <assert.h>
#include <se_memcpy.h>
sgx_status_t sgx_cmac128_msg(const sgx_key_128bit_t key, const uint8_t *p_src, unsigned int src_len, sgx_mac_t *p_mac)
{
if(!key || !p_src || src_len == 0 || !p_mac)
{
return SGX_ERROR_INVALID_PARAMETER;
}
CMAC_CTX *cmac_ctx = NULL;
size_t mac_len;
if(!(cmac_ctx = CMAC_CTX_new()))
{
return SGX_ERROR_OUT_OF_MEMORY;
}
if(!CMAC_Init(cmac_ctx, key, sizeof(sgx_key_128bit_t), EVP_aes_128_cbc(), NULL))
{
CMAC_CTX_free(cmac_ctx);
return SGX_ERROR_UNEXPECTED;
}
if(!CMAC_Update(cmac_ctx, p_src, src_len))
{
CMAC_CTX_free(cmac_ctx);
return SGX_ERROR_UNEXPECTED;
}
if(!CMAC_Final(cmac_ctx, (uint8_t *)p_mac, &mac_len))
{
CMAC_CTX_free(cmac_ctx);
return SGX_ERROR_UNEXPECTED;
}
CMAC_CTX_free(cmac_ctx);
assert(mac_len == sizeof(sgx_mac_t));
return SGX_SUCCESS;
}

View File

@ -0,0 +1,79 @@
/*
* Copyright (C) 2011-2017 Intel Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <openssl/evp.h>
#include <stdint.h>
#include <se_memcpy.h>
#include "crypto_wrapper.h"
sgx_status_t sgx_EVP_Digest(const EVP_MD *type, const uint8_t *p_src, unsigned int src_len, uint8_t *digest, unsigned int *digest_len)
{
if(!type || !p_src || src_len == 0 || !digest || digest_len == 0)
return SGX_ERROR_INVALID_PARAMETER;
uint8_t tmp_digest[EVP_MAX_MD_SIZE];
memset(tmp_digest, 0, EVP_MAX_MD_SIZE);
unsigned int tmp_digest_len;
unsigned int digest_buf_len = *digest_len;
EVP_MD_CTX *ctx;
if(NULL == (ctx = EVP_MD_CTX_create()))
return SGX_ERROR_OUT_OF_MEMORY;
if(!EVP_DigestInit_ex(ctx, type, NULL))
{
EVP_MD_CTX_destroy(ctx);
return SGX_ERROR_UNEXPECTED;
}
if(!EVP_DigestUpdate(ctx, p_src, src_len))
{
EVP_MD_CTX_destroy(ctx);
return SGX_ERROR_UNEXPECTED;
}
if(!EVP_DigestFinal_ex(ctx, tmp_digest, &tmp_digest_len))
{
EVP_MD_CTX_destroy(ctx);
return SGX_ERROR_UNEXPECTED;
}
EVP_MD_CTX_destroy(ctx);
if(tmp_digest_len > digest_buf_len)
{
return SGX_ERROR_UNEXPECTED;
}
if(memcpy_s(digest, digest_buf_len, tmp_digest, tmp_digest_len))
return SGX_ERROR_UNEXPECTED;
*digest_len = tmp_digest_len;
return SGX_SUCCESS;
}

View File

@ -0,0 +1,111 @@
/*
* Copyright (C) 2011-2017 Intel Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
.file "xsave_gnu.S"
#include "linux/linux-regs.h"
.macro DO_XSAVEC
#if defined(LINUX64)
.byte 0x48, 0x0f, 0xc7, 0x21
#else
.byte 0x0f, 0xc7, 0x21
#endif
.endm
.macro DO_XRSTOR
#if defined(LINUX64)
.byte 0x48, 0x0f, 0xae, 0x29
#else
.byte 0x0f, 0xae, 0x29
#endif
.endm
.macro DO_FXSAVE
#if defined(LINUX64)
.byte 0x48, 0x0f, 0xae, 0x01
#else
.byte 0x0f, 0xae, 0x01
#endif
.endm
.macro DO_FXRSTOR
#if defined(LINUX64)
.byte 0x48, 0x0f, 0xae, 0x09
#else
.byte 0x0f, 0xae, 0x09
#endif
.endm
.text
DECLARE_LOCAL_FUNC restore_xregs
#if defined(LINUX32)
mov SE_WORDSIZE(%esp), %ecx
lea g_xsave_enabled, %eax
#else
mov %rdi, %rcx
mov g_xsave_enabled@GOTPCREL(%rip), %rax
#endif
movl (%xax), %eax
cmpl $0, %eax
jz 1f
xor %xax, %xax
xor %xdx, %xdx
mov $0xFFFFFFFF, %eax
mov $0xFFFFFFFF, %edx
DO_XRSTOR
jmp 2f
1:
DO_FXRSTOR
2:
ret
DECLARE_LOCAL_FUNC save_xregs
#if defined(LINUX32)
mov SE_WORDSIZE(%esp), %ecx
lea g_xsave_enabled, %eax
#else
mov %rdi, %rcx
mov g_xsave_enabled@GOTPCREL(%rip), %rax
#endif
fwait
movl (%xax), %eax
cmpl $0, %eax
jz 1f
xor %xax, %xax
xor %xdx, %xdx
mov $0xFFFFFFFF, %eax
mov $0xFFFFFFFF, %edx
DO_XSAVEC
jmp 2f
1:
DO_FXSAVE
2:
ret

View File

@ -49,6 +49,17 @@ int se_mutex_lock(se_mutex_t* mutex) { return (0 == pthread_mutex_lock(mutex));
int se_mutex_unlock(se_mutex_t* mutex) { return (0 == pthread_mutex_unlock(mutex)); }
int se_mutex_destroy(se_mutex_t* mutex) { return (0 == pthread_mutex_destroy(mutex));}
void se_thread_cond_init(se_cond_t* cond)
{
se_cond_t tmp = PTHREAD_COND_INITIALIZER;
memcpy(cond, &tmp, sizeof(tmp));
}
int se_thread_cond_wait(se_cond_t *cond, se_mutex_t *mutex){return (0 == pthread_cond_wait(cond, mutex));}
int se_thread_cond_signal(se_cond_t *cond){return (0 == pthread_cond_signal(cond));}
int se_thread_cond_broadcast(se_cond_t *cond){return (0 == pthread_cond_broadcast(cond));}
int se_thread_cond_destroy(se_cond_t* cond){return (0 == pthread_cond_destroy(cond));}
unsigned int se_get_threadid(void) { return (unsigned)syscall(__NR_gettid);}
/* tls functions */
int se_tls_alloc(se_tls_index_t *tls_index) { return !pthread_key_create(tls_index, NULL); }

View File

@ -33,13 +33,13 @@
top_dir=`dirname $0`
out_dir=$top_dir
optlib_name=optimized_libs-1.9.100.39124.tar
ae_file_name=prebuilt-ae-1.9.100.39124.tar
server_url_path=https://download.01.org/intel-sgx/linux-1.9/
optlib_name=optimized_libs-2.0.tar
ae_file_name=prebuilt-ae-2.0.tar
server_url_path=https://download.01.org/intel-sgx/linux-2.0/
server_optlib_url=$server_url_path/$optlib_name
server_ae_url=$server_url_path/$ae_file_name
optlib_sha256=239cae39f87934d56c4eb919a4702c6ac82c19957b9a8d56c02b10eb4e27f573
ae_sha256=c2f86a1e8483b91c5517c99d196599492f3106d4b2f9f7523fd9eaf59b9ed37b
ae_sha256=3dfac14590a74aa860ea88ca9d1e2e112efb300c622e9ea02b3fa4bd69c50b07
rm -rf $out_dir/$optlib_name
wget $server_optlib_url -P $out_dir
if [ $? -ne 0 ]; then

View File

@ -518,4 +518,4 @@ JHI_GetVersionInfo (
#endif
#endif
#endif

View File

@ -98,4 +98,4 @@ typedef char FILECHAR;
#endif
#endif
#endif // _TYPEDEFS_H
#endif // _TYPEDEFS_H

View File

@ -1,195 +0,0 @@
/*
* Copyright (C) 2016 Intel Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef __IPPBASE_H__
#define __IPPBASE_H__
#ifdef __cplusplus
extern "C" {
#endif
#if defined( _WIN32 ) || defined ( _WIN64 )
#define __STDCALL __stdcall
#define __CDECL __cdecl
#define __INT64 __int64
#define __UINT64 unsigned __int64
#else
#define __STDCALL
#define __CDECL
#define __INT64 long long
#define __UINT64 unsigned long long
#endif
#define IPP_PI ( 3.14159265358979323846 ) /* ANSI C does not support M_PI */
#define IPP_2PI ( 6.28318530717958647692 ) /* 2*pi */
#define IPP_PI2 ( 1.57079632679489661923 ) /* pi/2 */
#define IPP_PI4 ( 0.78539816339744830961 ) /* pi/4 */
#define IPP_PI180 ( 0.01745329251994329577 ) /* pi/180 */
#define IPP_RPI ( 0.31830988618379067154 ) /* 1/pi */
#define IPP_SQRT2 ( 1.41421356237309504880 ) /* sqrt(2) */
#define IPP_SQRT3 ( 1.73205080756887729353 ) /* sqrt(3) */
#define IPP_LN2 ( 0.69314718055994530942 ) /* ln(2) */
#define IPP_LN3 ( 1.09861228866810969139 ) /* ln(3) */
#define IPP_E ( 2.71828182845904523536 ) /* e */
#define IPP_RE ( 0.36787944117144232159 ) /* 1/e */
#define IPP_EPS23 ( 1.19209289e-07f )
#define IPP_EPS52 ( 2.2204460492503131e-016 )
#define IPP_MAX_8U ( 0xFF )
#define IPP_MAX_16U ( 0xFFFF )
#define IPP_MAX_32U ( 0xFFFFFFFF )
#define IPP_MIN_8U ( 0 )
#define IPP_MIN_16U ( 0 )
#define IPP_MIN_32U ( 0 )
#define IPP_MIN_8S (-128 )
#define IPP_MAX_8S ( 127 )
#define IPP_MIN_16S (-32768 )
#define IPP_MAX_16S ( 32767 )
#define IPP_MIN_32S (-2147483647 - 1 )
#define IPP_MAX_32S ( 2147483647 )
#define IPP_MIN_64U ( 0 )
#if defined( _WIN32 ) || defined ( _WIN64 )
#define IPP_MAX_64S ( 9223372036854775807i64 )
#define IPP_MIN_64S (-9223372036854775807i64 - 1 )
#define IPP_MAX_64U ( 0xffffffffffffffffL ) /* 18446744073709551615 */
#else
#define IPP_MAX_64S ( 9223372036854775807LL )
#define IPP_MIN_64S (-9223372036854775807LL - 1 )
#define IPP_MAX_64U ( 0xffffffffffffffffLL ) /* 18446744073709551615 */
#endif
#define IPP_MINABS_32F ( 1.175494351e-38f )
#define IPP_MAXABS_32F ( 3.402823466e+38f )
#define IPP_EPS_32F ( 1.192092890e-07f )
#define IPP_MINABS_64F ( 2.2250738585072014e-308 )
#define IPP_MAXABS_64F ( 1.7976931348623158e+308 )
#define IPP_EPS_64F ( 2.2204460492503131e-016 )
#define IPP_MAX( a, b ) ( ((a) > (b)) ? (a) : (b) )
#define IPP_MIN( a, b ) ( ((a) < (b)) ? (a) : (b) )
#define IPP_ABS( a ) ( ((a) < 0) ? (-(a)) : (a) )
typedef struct {
int major; /* e.g. 1 */
int minor; /* e.g. 2 */
int majorBuild; /* e.g. 3 */
int build; /* e.g. 10, always >= majorBuild */
char targetCpu[4]; /* corresponding to Intel(R) processor */
const char* Name; /* e.g. "ippsw7" */
const char* Version; /* e.g. "v1.2 Beta" */
const char* BuildDate; /* e.g. "Jul 20 99" */
} IppLibraryVersion;
typedef unsigned char Ipp8u;
typedef unsigned short Ipp16u;
typedef unsigned int Ipp32u;
typedef signed char Ipp8s;
typedef signed short Ipp16s;
typedef signed int Ipp32s;
typedef float Ipp32f;
typedef __INT64 Ipp64s;
typedef __UINT64 Ipp64u;
typedef double Ipp64f;
typedef Ipp16s Ipp16f;
typedef struct {
Ipp8s re;
Ipp8s im;
} Ipp8sc;
typedef struct {
Ipp16s re;
Ipp16s im;
} Ipp16sc;
typedef struct {
Ipp16u re;
Ipp16u im;
} Ipp16uc;
typedef struct {
Ipp32s re;
Ipp32s im;
} Ipp32sc;
typedef struct {
Ipp32f re;
Ipp32f im;
} Ipp32fc;
typedef struct {
Ipp64s re;
Ipp64s im;
} Ipp64sc;
typedef struct {
Ipp64f re;
Ipp64f im;
} Ipp64fc;
typedef enum {
ippUndef = -1,
ipp1u = 0,
ipp8u = 1,
ipp8uc = 2,
ipp8s = 3,
ipp8sc = 4,
ipp16u = 5,
ipp16uc = 6,
ipp16s = 7,
ipp16sc = 8,
ipp32u = 9,
ipp32uc = 10,
ipp32s = 11,
ipp32sc = 12,
ipp32f = 13,
ipp32fc = 14,
ipp64u = 15,
ipp64uc = 16,
ipp64s = 17,
ipp64sc = 18,
ipp64f = 19,
ipp64fc = 20
} IppDataType;
typedef enum {
ippFalse = 0,
ippTrue = 1
} IppBool;
#ifdef __cplusplus
}
#endif
#endif /* __IPPBASE_H__ */

View File

@ -1,395 +0,0 @@
/*
* Copyright (C) 2016 Intel Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#if !defined( __IPPCORE_H__ ) || defined( _OWN_BLDPCS )
#define __IPPCORE_H__
#if defined (_WIN32_WCE) && defined (_M_IX86) && defined (__stdcall)
#define _IPP_STDCALL_CDECL
#undef __stdcall
#endif
#ifndef __IPPDEFS_H__
#include "ippdefs.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if !defined( _IPP_NO_DEFAULT_LIB )
#if defined( _IPP_SEQUENTIAL_DYNAMIC )
#pragma comment( lib, __FILE__ "/../../lib/" _INTEL_PLATFORM "ippcore" )
#elif defined( _IPP_SEQUENTIAL_STATIC )
#pragma comment( lib, __FILE__ "/../../lib/" _INTEL_PLATFORM "ippcoremt" )
#elif defined( _IPP_PARALLEL_DYNAMIC )
#pragma comment( lib, __FILE__ "/../../lib/" _INTEL_PLATFORM "threaded/ippcore" )
#elif defined( _IPP_PARALLEL_STATIC )
#pragma comment( lib, __FILE__ "/../../lib/" _INTEL_PLATFORM "threaded/ippcoremt" )
#endif
#endif
/* /////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// Functions declarations
////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////// */
/* /////////////////////////////////////////////////////////////////////////////
// Name: ippGetLibVersion
// Purpose: getting of the library version
// Returns: the structure of information about version
// of ippcore library
// Parameters:
//
// Notes: not necessary to release the returned structure
*/
IPPAPI( const IppLibraryVersion*, ippGetLibVersion, (void) )
/* /////////////////////////////////////////////////////////////////////////////
// Name: ippGetStatusString
// Purpose: convert the library status code to a readable string
// Parameters:
// StsCode IPP status code
// Returns: pointer to string describing the library status code
//
// Notes: don't free the pointer
*/
IPPAPI( const char*, ippGetStatusString, ( IppStatus StsCode ) )
/* /////////////////////////////////////////////////////////////////////////////
// Name: ippGetCpuClocks
// Purpose: reading of time stamp counter (TSC) register value
// Returns: TSC value
//
// Note: An hardware exception is possible if TSC reading is not supported by
/ the current chipset
*/
IPPAPI( Ipp64u, ippGetCpuClocks, (void) )
/* ///////////////////////////////////////////////////////////////////////////
// Names: ippSetFlushToZero,
// ippSetDenormAreZero.
//
// Purpose: ippSetFlushToZero enables or disables the flush-to-zero mode,
// ippSetDenormAreZero enables or disables the denormals-are-zeros
// mode.
//
// Arguments:
// value - !0 or 0 - set or clear the corresponding bit of MXCSR
// pUMask - pointer to user store current underflow exception mask
// ( may be NULL if don't want to store )
//
// Return:
// ippStsNoErr - Ok
// ippStsCpuNotSupportedErr - the mode is not supported
*/
IPPAPI( IppStatus, ippSetFlushToZero, ( int value, unsigned int* pUMask ))
IPPAPI( IppStatus, ippSetDenormAreZeros, ( int value ))
/* /////////////////////////////////////////////////////////////////////////////
// Name: ippAlignPtr
// Purpose: pointer aligning
// Returns: aligned pointer
//
// Parameter:
// ptr - pointer
// alignBytes - number of bytes to align
//
*/
IPPAPI( void*, ippAlignPtr, ( void * ptr, int alignBytes ) )
/* /////////////////////////////////////////////////////////////////////////////
// Functions to allocate and free memory
///////////////////////////////////////////////////////////////////////////// */
/* /////////////////////////////////////////////////////////////////////////////
// Name: ippMalloc
// Purpose: 64-byte aligned memory allocation
// Parameter:
// len number of bytes
// Returns: pointer to allocated memory
//
// Notes: the memory allocated by ippMalloc has to be free by ippFree
// function only.
*/
IPPAPI( void*, ippMalloc, (int length) )
/* /////////////////////////////////////////////////////////////////////////////
// Name: ippFree
// Purpose: free memory allocated by the ippMalloc function
// Parameter:
// ptr pointer to the memory allocated by the ippMalloc function
//
// Notes: use the function to free memory allocated by ippMalloc
*/
IPPAPI( void, ippFree, (void* ptr) )
/* /////////////////////////////////////////////////////////////////////////////
// Name: ippInit
// Purpose: Automatic switching to best for current cpu library code using.
// Returns:
// ippStsNoErr
//
// Parameter: nothing
//
// Notes: At the moment of this function execution no any other IPP function
// has to be working
*/
IPPAPI( IppStatus, ippInit, ( void ))
/* ////////////////////////////////////////////////////////////////////////////
// Name: ippGetCpuFreqMhz
//
// Purpose: the function estimates cpu frequency and returns
// its value in MHz as a integer
//
// Return:
// ippStsNoErr Ok
// ippStsNullPtrErr null pointer to the freq value
// ippStsSizeErr wrong num of tries, internal var
// Arguments:
// pMhz pointer to the integer to write
// cpu freq value estimated
//
// Notes: no exact value is guaranteed, the value could
// vary with cpu workloading
*/
IPPAPI(IppStatus, ippGetCpuFreqMhz, ( int* pMhz ) )
/* ////////////////////////////////////////////////////////////////////////////
// Name: ippSetNumThreads
//
// Purpose:
//
// Return:
// ippStsNoErr Ok
// ippStsNoOperation For static library internal threading is not supported
// ippStsSizeErr Desired number of threads less or equal zero
//
// Arguments:
// numThr Desired number of threads
*/
IPPAPI( IppStatus, ippSetNumThreads, ( int numThr ) )
/* ////////////////////////////////////////////////////////////////////////////
// Name: ippGetNumThreads
//
// Purpose:
//
// Return:
// ippStsNoErr Ok
// ippStsNullPtrErr Pointer to numThr is Null
// ippStsNoOperation For static library internal threading is not supported
// and return value is always == 1
//
// Arguments:
// pNumThr Pointer to memory location where to store current numThr
*/
IPPAPI( IppStatus, ippGetNumThreads, (int* pNumThr) )
/* ////////////////////////////////////////////////////////////////////////////
// Name: ippGetMaxCacheSizeB
//
// Purpose: Detects maximal from the sizes of L2 or L3 in bytes
//
// Return:
// ippStsNullPtrErr The result's pointer is NULL.
// ippStsNotSupportedCpu The cpu is not supported.
// ippStsUnknownCacheSize The cpu is supported, but the size of the cache is unknown.
// ippStsNoErr Ok
//
// Arguments:
// pSizeByte Pointer to the result
//
// Note:
// 1). Intel(R) processors are supported only.
// 2). Intel(R) Itanium(R) processors and platforms with Intel XScale(R) technology are unsupported
// 3). For unsupported processors the result is "0",
// and the return status is "ippStsNotSupportedCpu".
// 4). For supported processors the result is "0",
// and the return status is "ippStsUnknownCacheSize".
// if sizes of the cache is unknown.
//
*/
IPPAPI( IppStatus, ippGetMaxCacheSizeB, ( int* pSizeByte ) )
/*
// Name: ippGetCpuFeatures
// Purpose: Detects CPU features.
// Parameters:
// pFeaturesMask Pointer to the features mask.
// Nonzero value of bit means the corresponding feature is supported.
// Features mask values are defined in the ippdefs.h
// [ 0] - MMX ( ippCPUID_MMX )
// [ 1] - SSE ( ippCPUID_SSE )
// [ 2] - SSE2 ( ippCPUID_SSE2 )
// [ 3] - SSE3 ( ippCPUID_SSE3 )
// [ 4] - SSSE3 ( ippCPUID_SSSE3 )
// [ 5] - MOVBE ( ippCPUID_MOVBE )
// [ 6] - SSE41 ( ippCPUID_SSE41 )
// [ 7] - SSE42 ( ippCPUID_SSE42 )
// [ 8] - AVX ( ippCPUID_AVX )
// [ 9] - ENABLEDBYOS( ippAVX_ENABLEDBYOS )
// [10] - AES ( ippCPUID_AES )
// [11] - PCLMULQDQ ( ippCPUID_CLMUL )
// [12] - ABR ( ippCPUID_ABR )
// [13] - RDRAND ( ippCPUID_RDRAND )
// [14] - F16C ( ippCPUID_F16C )
// [15] - AVX2 ( ippCPUID_AVX2 )
// [16] - ADOX/ADCX ( ippCPUID_ADCOX ) ADCX and ADOX instructions
// [17] - RDSEED ( ippCPUID_RDSEED ) The RDSEED instruction
// [18] - PREFETCHW ( ippCPUID_PREFETCHW ) The PREFETCHW instruction
// [19] - SHA ( ippCPUID_SHA ) Intel (R) SHA Extensions
// [20:63] - Reserved
//
// pCpuidInfoRegs Pointer to the 4-element vector.
// Result of CPUID.1 are stored in this vector.
// [0] - register EAX
// [1] - register EBX
// [2] - register ECX
// [3] - register EDX
// If pointer pCpuidInfoRegs is set to NULL, registers are not stored.
//
// Returns:
// ippStsNullPtrErr The pointer to the features mask (pFeaturesMask) is NULL.
// ippStsNotSupportedCpu CPU is not supported.
// ippStsNoErr Ok
//
// Note: Only IA-32 and Intel(R) 64 are supported
*/
IPPAPI( IppStatus, ippGetCpuFeatures, ( Ipp64u* pFeaturesMask,
Ipp32u pCpuidInfoRegs[4] ) )
/*
// Name: ippGetEnabledCpuFeatures
// Purpose: Detects enabled features for loaded libraries
// Returns: Features mask
// Features mask values are defined in the ippdefs.h
// [ 0] - ippCPUID_MMX
// [ 1] - ippCPUID_SSE
// [ 2] - ippCPUID_SSE2
// [ 3] - ippCPUID_SSE3
// [ 4] - ippCPUID_SSSE3
// [ 5] - ippCPUID_MOVBE
// [ 6] - ippCPUID_SSE41
// [ 7] - ippCPUID_SSE42
// [ 8] - ippCPUID_AVX
// [ 9] - ippAVX_ENABLEDBYOS
// [10] - ippCPUID_AES
// [11] - ippCPUID_CLMUL
// [12] - ippCPUID_ABR
// [13] - ippCPUID_RDRAND
// [14] - ippCPUID_F16C
// [15] - ippCPUID_AVX2
// [16] - ippCPUID_ADCOX
// [17] - ippCPUID_RDSEED
// [18] - ippCPUID_PREFETCHW
// [19] - ippCPUID_SHA
// [20:63] - Reserved
//
*/
IPPAPI( Ipp64u, ippGetEnabledCpuFeatures, ( void ) )
/* ////////////////////////////////////////////////////////////////////////////
// Name: ippSetCpuFeatures
//
// Purpose: Changes the set of enabled/disabled CPU features.
// This function sets the processor-specific code of the Intel IPP
// library according to the processor features specified in cpuFeatures.
//
// Return:
// ippStsNoErr No errors.
// Warnings:
// ippStsFeatureNotSupported Current CPU doesn't support at least 1 of the
// desired features;
// ippStsUnknownFeature At least one of the desired features is unknown;
// ippStsFeaturesCombination Wrong combination of features;
// ippStsCpuMismatch Indicates that the specified processor features
// are not valid. Previously set code is used.
//
// Arguments:
// cpuFeatures Desired features to support by the library
// (see ippdefs.h for ippCPUID_XX definition)
//
// NOTE: this function can re-initializes dispatcher and after the
// call another library (letter) may work
// CAUTION: At the moment of this function excecution no any other IPP
// function has to be working
//
// The next pre-defined sets of features can be used:
// 32-bit code:
// #define PX_FM ( ippCPUID_MMX | ippCPUID_SSE )
// #define W7_FM ( PX_FM | ippCPUID_SSE2 )
// #define V8_FM ( W7_FM | ippCPUID_SSE3 | ippCPUID_SSSE3 )
// #define S8_FM ( V8_FM | ippCPUID_MOVBE )
// #define P8_FM ( V8_FM | ippCPUID_SSE41 | ippCPUID_SSE42 | ippCPUID_AES | ippCPUID_CLMUL | ippCPUID_SHA )
// #define G9_FM ( P8_FM | ippCPUID_AVX | ippAVX_ENABLEDBYOS | ippCPUID_RDRAND | ippCPUID_F16C )
// #define H9_FM ( G9_FM | ippCPUID_AVX2 | ippCPUID_MOVBE | ippCPUID_ADCOX | ippCPUID_RDSEED | ippCPUID_PREFETCHW )
//
// 64-bit code:
// #define PX_FM ( ippCPUID_MMX | ippCPUID_SSE | ippCPUID_SSE2 )
// #define M7_FM ( PX_FM | ippCPUID_SSE3 )
// #define N8_FM ( S8_FM )
// #define U8_FM ( V8_FM )
// #define Y8_FM ( P8_FM )
// #define E9_FM ( G9_FM )
// #define L9_FM ( H9_FM )
//
*/
IPPAPI( IppStatus, ippSetCpuFeatures,( Ipp64u cpuFeatures ))
#if defined (_IPP_STDCALL_CDECL)
#undef _IPP_STDCALL_CDECL
#define __stdcall __cdecl
#endif
#ifdef __cplusplus
}
#endif
#endif /* __IPPCORE_H__ */

View File

@ -1,327 +0,0 @@
/*
* Copyright (C) 2016 Intel Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#if !defined( __IPPCP_H__ ) || defined( _OWN_BLDPCS )
#define __IPPCP_H__
#if defined (_WIN32_WCE) && defined (_M_IX86) && defined (__stdcall)
#define _IPP_STDCALL_CDECL
#undef __stdcall
#endif
#ifndef __IPPDEFS_H__
#include "ippdefs.h"
#endif
#ifndef __IPPCPDEFS_H__
#include "ippcpdefs.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* /////////////////////////////////////////////////////////////////////////////
// Name: ippcpGetLibVersion
// Purpose: getting of the library version
// Returns: the structure of information about version of ippCP library
// Parameters:
//
// Notes: not necessary to release the returned structure
*/
IPPAPI( const IppLibraryVersion*, ippcpGetLibVersion, (void) )
/*
// AES
*/
IPPAPI(IppStatus, ippsAESGetSize,(int *pSize))
IPPAPI(IppStatus, ippsAESInit,(const Ipp8u* pKey, int keyLen, IppsAESSpec* pCtx, int ctxSize))
/* AES-CTR */
IPPAPI(IppStatus, ippsAESEncryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len,
const IppsAESSpec* pCtx,
Ipp8u* pCtrValue, int ctrNumBitSize))
IPPAPI(IppStatus, ippsAESDecryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len,
const IppsAESSpec* pCtx,
Ipp8u* pCtrValue, int ctrNumBitSize))
/* AES-GCM */
IPPAPI(IppStatus, ippsAES_GCMGetSize,(int * pSize))
IPPAPI(IppStatus, ippsAES_GCMInit,(const Ipp8u* pKey, int keyLen, IppsAES_GCMState* pState, int ctxSize))
IPPAPI(IppStatus, ippsAES_GCMReset,(IppsAES_GCMState* pState))
IPPAPI(IppStatus, ippsAES_GCMProcessIV,(const Ipp8u* pIV, int ivLen,
IppsAES_GCMState* pState))
IPPAPI(IppStatus, ippsAES_GCMProcessAAD,(const Ipp8u* pAAD, int ivAAD,
IppsAES_GCMState* pState))
IPPAPI(IppStatus, ippsAES_GCMStart,(const Ipp8u* pIV, int ivLen,
const Ipp8u* pAAD, int aadLen,
IppsAES_GCMState* pState))
IPPAPI(IppStatus, ippsAES_GCMEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_GCMState* pState))
IPPAPI(IppStatus, ippsAES_GCMDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_GCMState* pState))
IPPAPI(IppStatus, ippsAES_GCMGetTag,(Ipp8u* pDstTag, int tagLen, const IppsAES_GCMState* pState))
/* AES-CMAC */
IPPAPI(IppStatus, ippsAES_CMACGetSize,(int* pSize))
IPPAPI(IppStatus, ippsAES_CMACInit,(const Ipp8u* pKey, int keyLen, IppsAES_CMACState* pState, int ctxSize))
IPPAPI(IppStatus, ippsAES_CMACUpdate,(const Ipp8u* pSrc, int len, IppsAES_CMACState* pState))
IPPAPI(IppStatus, ippsAES_CMACFinal,(Ipp8u* pMD, int mdLen, IppsAES_CMACState* pState))
IPPAPI(IppStatus, ippsAES_CMACGetTag,(Ipp8u* pMD, int mdLen, const IppsAES_CMACState* pState))
/*
// hash
*/
IPPAPI(IppStatus, ippsHashGetSize,(int* pSize))
IPPAPI(IppStatus, ippsHashInit,(IppsHashState* pCtx, IppHashAlgId hashAlg))
IPPAPI(IppStatus, ippsHashUpdate,(const Ipp8u* pSrc, int len, IppsHashState* pCtx))
IPPAPI(IppStatus, ippsHashGetTag,(Ipp8u* pMD, int tagLen, const IppsHashState* pCtx))
IPPAPI(IppStatus, ippsHashFinal,(Ipp8u* pMD, IppsHashState* pCtx))
IPPAPI(IppStatus, ippsHashMessage,(const Ipp8u* pMsg, int len, Ipp8u* pMD, IppHashAlgId hashAlg))
IPPAPI(IppStatus, ippsMGF,(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int maskLen, IppHashAlgId hashAlg))
IPPAPI(IppStatus, ippsHMAC_GetSize,(int* pSize))
IPPAPI(IppStatus, ippsHMAC_Init,(const Ipp8u* pKey, int keyLen, IppsHMACState* pCtx, IppHashAlgId hashAlg))
IPPAPI(IppStatus, ippsHMAC_Update,(const Ipp8u* pSrc, int len, IppsHMACState* pCtx))
IPPAPI(IppStatus, ippsHMAC_Final,(Ipp8u* pMD, int mdLen, IppsHMACState* pCtx))
IPPAPI(IppStatus, ippsHMAC_GetTag,(Ipp8u* pMD, int mdLen, const IppsHMACState* pCtx))
IPPAPI(IppStatus, ippsHMAC_Message,(const Ipp8u* pMsg, int msgLen,
const Ipp8u* pKey, int keyLen,
Ipp8u* pMD, int mdLen,
IppHashAlgId hashAlg))
/*
// Big Number Integer Arithmetic
*/
IPPAPI(IppStatus, ippsBigNumGetSize,(int length, int* pSize))
IPPAPI(IppStatus, ippsBigNumInit,(int length, IppsBigNumState* pBN))
IPPAPI(IppStatus, ippsSet_BN,(IppsBigNumSGN sgn,
int length, const Ipp32u* pData,
IppsBigNumState* pBN))
IPPAPI(IppStatus, ippsRef_BN,(IppsBigNumSGN* pSgn, int* bitSize, Ipp32u** const ppData,
const IppsBigNumState* pBN))
IPPAPI(IppStatus, ippsAdd_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR))
IPPAPI(IppStatus, ippsSub_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR))
IPPAPI(IppStatus, ippsMod_BN, (IppsBigNumState* pA, IppsBigNumState* pM, IppsBigNumState* pR))
IPPAPI(IppStatus, ippsModInv_BN,(IppsBigNumState* pA, IppsBigNumState* pM, IppsBigNumState* pInv))
IPPAPI(IppStatus, ippsDiv_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pQ, IppsBigNumState* pR))
IPPAPI(IppStatus, ippsCmpZero_BN,(const IppsBigNumState* pBN, Ipp32u* pResult))
IPPAPI(IppStatus, ippsCmp_BN,(const IppsBigNumState* pA, const IppsBigNumState* pB, Ipp32u* pResult))
IPPAPI(IppStatus, ippsMul_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR))
IPPAPI(IppStatus, ippsGcd_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pGCD))
IPPAPI(IppStatus, ippsSetOctString_BN,(const Ipp8u* pStr, int strLen, IppsBigNumState* pBN))
IPPAPI(IppStatus, ippsGetOctString_BN,(Ipp8u* pStr, int strLen, const IppsBigNumState* pBN))
/*
// Montgomery Operations
*/
IPPAPI(IppStatus, ippsMontGetSize,(IppsExpMethod method, int length, int* pSize))
IPPAPI(IppStatus, ippsMontInit,(IppsExpMethod method, int length, IppsMontState* pCtx))
IPPAPI(IppStatus, ippsMontSet,(const Ipp32u* pModulo, int size, IppsMontState* pCtx))
IPPAPI(IppStatus, ippsMontMul, (const IppsBigNumState* pA, const IppsBigNumState* pB, IppsMontState* m, IppsBigNumState* pR))
/*
// PRNG
*/
IPPAPI(IppStatus, ippsPRNGGetSize,(int* pSize))
IPPAPI(IppStatus, ippsPRNGInit, (int seedBits, IppsPRNGState* pCtx))
IPPAPI(IppStatus, ippsPRNGen, (Ipp32u* pRand, int nBits, void* pCtx))
/*
// Prime Number Generation
*/
IPPAPI(IppStatus, ippsPrimeGetSize,(int nMaxBits, int* pSize))
IPPAPI(IppStatus, ippsPrimeInit, (int nMaxBits, IppsPrimeState* pCtx))
/*
// RSA
*/
IPPAPI(IppStatus, ippsRSA_GetSizePublicKey,(int rsaModulusBitSize, int pubicExpBitSize, int* pKeySize))
IPPAPI(IppStatus, ippsRSA_InitPublicKey,(int rsaModulusBitSize, int publicExpBitSize,
IppsRSAPublicKeyState* pKey, int keyCtxSize))
IPPAPI(IppStatus, ippsRSA_SetPublicKey,(const IppsBigNumState* pModulus,
const IppsBigNumState* pPublicExp,
IppsRSAPublicKeyState* pKey))
IPPAPI(IppStatus, ippsRSA_GetPublicKey,(IppsBigNumState* pModulus,
IppsBigNumState* pPublicExp,
const IppsRSAPublicKeyState* pKey))
IPPAPI(IppStatus, ippsRSA_GetSizePrivateKeyType1,(int rsaModulusBitSize, int privateExpBitSize, int* pKeySize))
IPPAPI(IppStatus, ippsRSA_InitPrivateKeyType1,(int rsaModulusBitSize, int privateExpBitSize,
IppsRSAPrivateKeyState* pKey, int keyCtxSize))
IPPAPI(IppStatus, ippsRSA_SetPrivateKeyType1,(const IppsBigNumState* pModulus,
const IppsBigNumState* pPrivateExp,
IppsRSAPrivateKeyState* pKey))
IPPAPI(IppStatus, ippsRSA_GetSizePrivateKeyType2,(int factorPbitSize, int factorQbitSize, int* pKeySize))
IPPAPI(IppStatus, ippsRSA_InitPrivateKeyType2,(int factorPbitSize, int factorQbitSize,
IppsRSAPrivateKeyState* pKey, int keyCtxSize))
IPPAPI(IppStatus, ippsRSA_SetPrivateKeyType2,(const IppsBigNumState* pFactorP,
const IppsBigNumState* pFactorQ,
const IppsBigNumState* pCrtExpP,
const IppsBigNumState* pCrtExpQ,
const IppsBigNumState* pInverseQ,
IppsRSAPrivateKeyState* pKey))
IPPAPI(IppStatus, ippsRSA_GetBufferSizePublicKey,(int* pBufferSize, const IppsRSAPublicKeyState* pKey))
IPPAPI(IppStatus, ippsRSA_GetBufferSizePrivateKey,(int* pBufferSize, const IppsRSAPrivateKeyState* pKey))
IPPAPI(IppStatus, ippsRSA_Encrypt,(const IppsBigNumState* pPtxt,
IppsBigNumState* pCtxt,
const IppsRSAPublicKeyState* pKey,
Ipp8u* pScratchBuffer))
IPPAPI(IppStatus, ippsRSA_Decrypt,(const IppsBigNumState* pCtxt,
IppsBigNumState* pPtxt,
const IppsRSAPrivateKeyState* pKey,
Ipp8u* pScratchBuffer))
IPPAPI(IppStatus, ippsRSA_ValidateKeys,(int* pResult,
const IppsRSAPublicKeyState* pPublicKey,
const IppsRSAPrivateKeyState* pPrivateKeyType2,
const IppsRSAPrivateKeyState* pPrivateKeyType1,
Ipp8u* pScratchBuffer,
int nTrials,
IppsPrimeState* pPrimeGen,
IppBitSupplier rndFunc, void* pRndParam))
/* encryption scheme: RSAES-OAEP */
IPPAPI(IppStatus, ippsRSAEncrypt_OAEP,(const Ipp8u* pSrc, int srcLen,
const Ipp8u* pLabel, int labLen,
const Ipp8u* pSeed,
Ipp8u* pDst,
const IppsRSAPublicKeyState* pKey,
IppHashAlgId hashAlg,
Ipp8u* pBuffer))
IPPAPI(IppStatus, ippsRSA_OAEPEncrypt_SHA256,(const Ipp8u* pSrc, int srcLen,
const Ipp8u* pLabel, int labLen,
const Ipp8u* pSeed,
Ipp8u* pDst,
const IppsRSAPublicKeyState* pKey,
Ipp8u* pBuffer))
/* signature scheme : RSA-SSA-PKCS1-v1_5 */
IPPAPI(IppStatus, ippsRSASign_PKCS1v15,(const Ipp8u* pMsg, int msgLen,
Ipp8u* pSign,
const IppsRSAPrivateKeyState* pPrvKey,
const IppsRSAPublicKeyState* pPubKey,
IppHashAlgId hashAlg,
Ipp8u* pBuffer))
IPPAPI(IppStatus, ippsRSAVerify_PKCS1v15,(const Ipp8u* pMsg, int msgLen,
const Ipp8u* pSign, int* pIsValid,
const IppsRSAPublicKeyState* pKey,
IppHashAlgId hashAlg,
Ipp8u* pBuffer))
/*
// EC Cryptography
*/
IPPAPI(IppStatus, ippsECCPGetSize,(int feBitSize, int* pSize))
IPPAPI(IppStatus, ippsECCPInit,(int feBitSize, IppsECCPState* pECC))
IPPAPI(IppStatus, ippsECCPSet,(const IppsBigNumState* pPrime,
const IppsBigNumState* pA, const IppsBigNumState* pB,
const IppsBigNumState* pGX,const IppsBigNumState* pGY,const IppsBigNumState* pOrder,
int cofactor,
IppsECCPState* pECC))
IPPAPI(IppStatus, ippsECCPSetStd,(IppECCType flag, IppsECCPState* pECC))
IPPAPI(IppStatus, ippsECCPPointGetSize,(int feBitSize, int* pSize))
IPPAPI(IppStatus, ippsECCPPointInit,(int feBitSize, IppsECCPPointState* pPoint))
IPPAPI(IppStatus, ippsECCPSetPoint,(const IppsBigNumState* pX, const IppsBigNumState* pY,
IppsECCPPointState* pPoint, IppsECCPState* pECC))
IPPAPI(IppStatus, ippsECCPSetPointAtInfinity,(IppsECCPPointState* pPoint, IppsECCPState* pECC))
IPPAPI(IppStatus, ippsECCPGetPoint,(IppsBigNumState* pX, IppsBigNumState* pY,
const IppsECCPPointState* pPoint, IppsECCPState* pECC))
IPPAPI(IppStatus, ippsECCPCheckPoint,(const IppsECCPPointState* pP,
IppECResult* pResult, IppsECCPState* pECC))
IPPAPI(IppStatus, ippsECCPComparePoint,(const IppsECCPPointState* pP, const IppsECCPPointState* pQ,
IppECResult* pResult, IppsECCPState* pECC))
IPPAPI(IppStatus, ippsECCPNegativePoint,(const IppsECCPPointState* pP,
IppsECCPPointState* pR, IppsECCPState* pECC))
IPPAPI(IppStatus, ippsECCPAddPoint,(const IppsECCPPointState* pP, const IppsECCPPointState* pQ,
IppsECCPPointState* pR, IppsECCPState* pECC))
IPPAPI(IppStatus, ippsECCPMulPointScalar,(const IppsECCPPointState* pP, const IppsBigNumState* pK,
IppsECCPPointState* pR, IppsECCPState* pECC))
IPPAPI(IppStatus, ippsECCPGenKeyPair,(IppsBigNumState* pPrivate, IppsECCPPointState* pPublic,
IppsECCPState* pECC,
IppBitSupplier rndFunc, void* pRndParam))
IPPAPI(IppStatus, ippsECCPPublicKey,(const IppsBigNumState* pPrivate,
IppsECCPPointState* pPublic,
IppsECCPState* pECC))
IPPAPI(IppStatus, ippsECCPSetKeyPair,(const IppsBigNumState* pPrivate, const IppsECCPPointState* pPublic,
IppBool regular,
IppsECCPState* pECC))
IPPAPI(IppStatus, ippsECCPSharedSecretDH,(const IppsBigNumState* pPrivateA,
const IppsECCPPointState* pPublicB,
IppsBigNumState* pShare,
IppsECCPState* pECC))
IPPAPI(IppStatus, ippsECCPSignDSA,(const IppsBigNumState* pMsgDigest,
const IppsBigNumState* pPrivate,
IppsBigNumState* pSignX, IppsBigNumState* pSignY,
IppsECCPState* pECC))
IPPAPI(IppStatus, ippsECCPVerifyDSA,(const IppsBigNumState* pMsgDigest,
const IppsBigNumState* pSignX, const IppsBigNumState* pSignY,
IppECResult* pResult,
IppsECCPState* pECC))
#ifdef __cplusplus
}
#endif
#if defined (_IPP_STDCALL_CDECL)
#undef _IPP_STDCALL_CDECL
#define __stdcall __cdecl
#endif
#endif /* __IPPCP_H__ */

View File

@ -1,211 +0,0 @@
/*
* Copyright (C) 2016 Intel Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef __IPPCPDEFS_H__
#define __IPPCPDEFS_H__
#ifdef __cplusplus
extern "C" {
#endif
/*
// AES
*/
#define IPP_AES_BLOCK_BITSIZE (128) /* cipher blocksizes (bits) */
typedef enum { /* cipher keysizes (bits) */
ippRijndaelKey128 = 128, IppsRijndaelKey128 = 128, /* 128-bit key */
ippRijndaelKey192 = 192, IppsRijndaelKey192 = 192, /* 192-bit key */
ippRijndaelKey256 = 256, IppsRijndaelKey256 = 256 /* 256-bit key */
} IppsRijndaelKeyLength;
typedef struct _cpRijndael128 IppsAESSpec;
typedef struct _cpAES_GCM IppsAES_GCMState;
typedef struct _cpAES_CMAC IppsAES_CMACState;
/*
// hash
*/
typedef enum {
ippHashAlg_Unknown,
ippHashAlg_SHA1,
ippHashAlg_SHA256,
ippHashAlg_SHA224,
ippHashAlg_SHA512,
ippHashAlg_SHA384,
ippHashAlg_MD5,
ippHashAlg_SHA512_224,
ippHashAlg_SHA512_256,
ippHashAlg_MaxNo
} IppHashAlgId;
#define IPP_ALG_HASH_UNKNOWN (ippHashAlg_Unknown) /* unknown */
#define IPP_ALG_HASH_SHA1 (ippHashAlg_SHA1) /* SHA1 */
#define IPP_ALG_HASH_SHA256 (ippHashAlg_SHA256) /* SHA256 */
#define IPP_ALG_HASH_SHA224 (ippHashAlg_SHA224) /* SHA224 or SHA256/224 */
#define IPP_ALG_HASH_SHA512 (ippHashAlg_SHA512) /* SHA512 */
#define IPP_ALG_HASH_SHA384 (ippHashAlg_SHA384) /* SHA384 or SHA512/384 */
#define IPP_ALG_HASH_MD5 (ippHashAlg_MD5) /* MD5 */
#define IPP_ALG_HASH_SHA512_224 (ippHashAlg_SHA512_224) /* SHA512/224 */
#define IPP_ALG_HASH_SHA512_256 (ippHashAlg_SHA512_256) /* SHA512/256 */
#define IPP_ALG_HASH_LIMIT (ippHashAlg_MaxNo) /* hash alg limiter*/
#define IPP_SHA1_DIGEST_BITSIZE 160 /* digest size (bits) */
#define IPP_SHA256_DIGEST_BITSIZE 256
#define IPP_SHA224_DIGEST_BITSIZE 224
#define IPP_SHA384_DIGEST_BITSIZE 384
#define IPP_SHA512_DIGEST_BITSIZE 512
#define IPP_MD5_DIGEST_BITSIZE 128
#define IPP_SHA512_224_DIGEST_BITSIZE 224
#define IPP_SHA512_256_DIGEST_BITSIZE 256
typedef struct _cpHashCtx IppsHashState;
typedef struct _cpHMAC IppsHMACState;
/*
// Big Number Integer Arithmetic
*/
#define BN_MAXBITSIZE (16*1024) /* bn max size (bits) */
/* operation results */
#define IPP_IS_EQ (0)
#define IPP_IS_GT (1)
#define IPP_IS_LT (2)
#define IPP_IS_NE (3)
#define IPP_IS_NA (4)
#define IPP_IS_PRIME (5)
#define IPP_IS_COMPOSITE (6)
#define IPP_IS_VALID (7)
#define IPP_IS_INVALID (8)
#define IPP_IS_INCOMPLETE (9)
#define IPP_IS_ATINFINITY (10)
#define IS_ZERO IPP_IS_EQ
#define GREATER_THAN_ZERO IPP_IS_GT
#define LESS_THAN_ZERO IPP_IS_LT
#define IS_PRIME IPP_IS_PRIME
#define IS_COMPOSITE IPP_IS_COMPOSITE
#define IS_VALID_KEY IPP_IS_VALID
#define IS_INVALID_KEY IPP_IS_INVALID
#define IS_INCOMPLETED_KEY IPP_IS_INCOMPLETE
typedef enum {
ippBigNumNEG = 0, IppsBigNumNEG = 0,
ippBigNumPOS = 1, IppsBigNumPOS = 1
} IppsBigNumSGN;
typedef enum {
ippBinaryMethod = 0, IppsBinaryMethod = 0,
ippSlidingWindows = 1, IppsSlidingWindows = 1
} IppsExpMethod;
typedef struct _cpBigNum IppsBigNumState;
typedef struct _cpMontgomery IppsMontState;
typedef struct _cpPRNG IppsPRNGState;
typedef struct _cpPrime IppsPrimeState;
/* External Bit Supplier */
typedef IppStatus (__STDCALL *IppBitSupplier)(Ipp32u* pRand, int nBits, void* pEbsParams);
/*
// RSA
*/
#define MIN_RSA_SIZE (8)
#define MAX_RSA_SIZE (4096)
typedef struct _cpRSA IppsRSAState;
typedef struct _cpRSA_public_key IppsRSAPublicKeyState;
typedef struct _cpRSA_private_key IppsRSAPrivateKeyState;
/*
// EC Cryptography
*/
#define EC_GFP_MAXBITSIZE (1024)
typedef struct _cpECCP IppsECCPState;
typedef struct _cpECCPPoint IppsECCPPointState;
/* operation result */
typedef enum {
ippECValid, /* validation pass successfully */
ippECCompositeBase, /* field based on composite */
ippECComplicatedBase, /* number of non-zero terms in the polynomial (> PRIME_ARR_MAX) */
ippECIsZeroDiscriminant,/* zero discriminant */
ippECCompositeOrder, /* composite order of base point */
ippECInvalidOrder, /* invalid base point order */
ippECIsWeakMOV, /* weak Meneze-Okamoto-Vanstone reduction attack */
ippECIsWeakSSSA, /* weak Semaev-Smart,Satoh-Araki reduction attack */
ippECIsSupersingular, /* supersingular curve */
ippECInvalidPrivateKey, /* !(0 < Private < order) */
ippECInvalidPublicKey, /* (order*PublicKey != Infinity) */
ippECInvalidKeyPair, /* (Private*BasePoint != PublicKey) */
ippECPointOutOfGroup, /* out of group (order*P != Infinity) */
ippECPointIsAtInfinite, /* point (P=(Px,Py)) at Infinity */
ippECPointIsNotValid, /* point (P=(Px,Py)) out-of EC */
ippECPointIsEqual, /* compared points are equal */
ippECPointIsNotEqual, /* compared points are different */
ippECInvalidSignature /* invalid signature */
} IppECResult;
typedef enum {
ippECarbitrary =0x00000, IppECCArbitrary = 0x00000, /* arbitrary ECC */
ippECPstd = 0x10000, IppECCPStd = 0x10000, /* random (recommended) EC over FG(p): */
ippECPstd112r1 = ippECPstd, IppECCPStd112r1 = IppECCPStd, /* secp112r1 curve */
ippECPstd112r2 = ippECPstd+1, IppECCPStd112r2 = IppECCPStd+1, /* secp112r2 curve */
ippECPstd128r1 = ippECPstd+2, IppECCPStd128r1 = IppECCPStd+2, /* secp128r1 curve */
ippECPstd128r2 = ippECPstd+3, IppECCPStd128r2 = IppECCPStd+3, /* secp128r2 curve */
ippECPstd160r1 = ippECPstd+4, IppECCPStd160r1 = IppECCPStd+4, /* secp160r1 curve */
ippECPstd160r2 = ippECPstd+5, IppECCPStd160r2 = IppECCPStd+5, /* secp160r2 curve */
ippECPstd192r1 = ippECPstd+6, IppECCPStd192r1 = IppECCPStd+6, /* secp192r1 curve */
ippECPstd224r1 = ippECPstd+7, IppECCPStd224r1 = IppECCPStd+7, /* secp224r1 curve */
ippECPstd256r1 = ippECPstd+8, IppECCPStd256r1 = IppECCPStd+8, /* secp256r1 curve */
ippECPstd384r1 = ippECPstd+9, IppECCPStd384r1 = IppECCPStd+9, /* secp384r1 curve */
ippECPstd521r1 = ippECPstd+10, IppECCPStd521r1 = IppECCPStd+10, /* secp521r1 curve */
} IppsECType, IppECCType;
#ifdef __cplusplus
}
#endif
#endif /* __IPPCPDEFS_H__ */

View File

@ -1,129 +0,0 @@
/*
* Copyright (C) 2016 Intel Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef __IPPDEFS_H__
#define __IPPDEFS_H__
#ifdef __cplusplus
extern "C" {
#endif
#if defined (_WIN64)
#define _INTEL_PLATFORM "intel64/"
#elif defined (_WIN32)
#define _INTEL_PLATFORM "ia32/"
#endif
#if !defined( IPPAPI )
#if defined( IPP_W32DLL ) && (defined( _WIN32 ) || defined( _WIN64 ))
#if defined( _MSC_VER ) || defined( __ICL )
#define IPPAPI( type,name,arg ) \
__declspec(dllimport) type __STDCALL name arg;
#else
#define IPPAPI( type,name,arg ) type __STDCALL name arg;
#endif
#else
#define IPPAPI( type,name,arg ) type __STDCALL name arg;
#endif
#endif
#if (defined( __ICL ) || defined( __ECL ) || defined(_MSC_VER)) && !defined( _PCS ) && !defined( _PCS_GENSTUBS )
#if( __INTEL_COMPILER >= 1100 ) /* icl 11.0 supports additional comment */
#if( _MSC_VER >= 1400 )
#define IPP_DEPRECATED( comment ) __declspec( deprecated ( comment ))
#else
#pragma message ("your icl version supports additional comment for deprecated functions but it can't be displayed")
#pragma message ("because internal _MSC_VER macro variable setting requires compatibility with MSVC7.1")
#pragma message ("use -Qvc8 switch for icl command line to see these additional comments")
#define IPP_DEPRECATED( comment ) __declspec( deprecated )
#endif
#elif( _MSC_FULL_VER >= 140050727 )&&( !defined( __INTEL_COMPILER )) /* VS2005 supports additional comment */
#define IPP_DEPRECATED( comment ) __declspec( deprecated ( comment ))
#elif( _MSC_VER <= 1200 )&&( !defined( __INTEL_COMPILER )) /* VS 6 doesn't support deprecation */
#define IPP_DEPRECATED( comment )
#else
#define IPP_DEPRECATED( comment ) __declspec( deprecated )
#endif
#elif (defined(__ICC) || defined(__ECC) || defined( __GNUC__ )) && !defined( _PCS ) && !defined( _PCS_GENSTUBS )
#if defined( __GNUC__ )
#if __GNUC__ >= 4 && __GNUC_MINOR__ >= 5
#define IPP_DEPRECATED( message ) __attribute__(( deprecated( message )))
#else
#define IPP_DEPRECATED( message ) __attribute__(( deprecated ))
#endif
#else
#define IPP_DEPRECATED( comment ) __attribute__(( deprecated ))
#endif
#else
#define IPP_DEPRECATED( comment )
#endif
#if (defined( __ICL ) || defined( __ECL ) || defined(_MSC_VER))
#if !defined( _IPP_NO_DEFAULT_LIB )
#if (( defined( _IPP_PARALLEL_DYNAMIC ) && !defined( _IPP_PARALLEL_STATIC ) && !defined( _IPP_SEQUENTIAL_DYNAMIC ) && !defined( _IPP_SEQUENTIAL_STATIC )) || \
(!defined( _IPP_PARALLEL_DYNAMIC ) && defined( _IPP_PARALLEL_STATIC ) && !defined( _IPP_SEQUENTIAL_DYNAMIC ) && !defined( _IPP_SEQUENTIAL_STATIC )) || \
(!defined( _IPP_PARALLEL_DYNAMIC ) && !defined( _IPP_PARALLEL_STATIC ) && defined( _IPP_SEQUENTIAL_DYNAMIC ) && !defined( _IPP_SEQUENTIAL_STATIC )) || \
(!defined( _IPP_PARALLEL_DYNAMIC ) && !defined( _IPP_PARALLEL_STATIC ) && !defined( _IPP_SEQUENTIAL_DYNAMIC ) && defined( _IPP_SEQUENTIAL_STATIC )))
#elif (!defined( _IPP_PARALLEL_DYNAMIC ) && !defined( _IPP_PARALLEL_STATIC ) && !defined( _IPP_SEQUENTIAL_DYNAMIC ) && !defined( _IPP_SEQUENTIAL_STATIC ))
#define _IPP_NO_DEFAULT_LIB
#else
#error Illegal combination of _IPP_PARALLEL_DYNAMIC/_IPP_PARALLEL_STATIC/_IPP_SEQUENTIAL_DYNAMIC/_IPP_SEQUENTIAL_STATIC, only one definition can be defined
#endif
#endif
#else
#define _IPP_NO_DEFAULT_LIB
#if (defined( _IPP_PARALLEL_DYNAMIC ) || defined( _IPP_PARALLEL_STATIC ) || defined(_IPP_SEQUENTIAL_DYNAMIC) || defined(_IPP_SEQUENTIAL_STATIC))
#pragma message ("defines _IPP_PARALLEL_DYNAMIC/_IPP_PARALLEL_STATIC/_IPP_SEQUENTIAL_DYNAMIC/_IPP_SEQUENTIAL_STATIC do not have any effect in current configuration")
#endif
#endif
#if !defined( _IPP_NO_DEFAULT_LIB )
#if defined( _IPP_PARALLEL_STATIC )
#pragma comment( lib, "libircmt" )
#pragma comment( lib, "libmmt" )
#pragma comment( lib, "svml_dispmt" )
#pragma comment( lib, "libiomp5md" )
#endif
#endif
#include "ippbase.h"
#include "ipptypes.h"
extern const IppiRect ippRectInfinite;
#ifdef __cplusplus
}
#endif
#endif /* __IPPDEFS_H__ */

File diff suppressed because it is too large Load Diff

View File

@ -1,41 +0,0 @@
/*
* Copyright (C) 2016 Intel Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#if !defined( __IPPVERSION_H__ )
#define __IPPVERSION_H__
#define IPP_VERSION_MAJOR 9
#define IPP_VERSION_MINOR 0
#define IPP_VERSION_UPDATE 2
#define IPP_VERSION_STR "9.0.2"
#endif /* __IPPVERSION_H__ */

View File

@ -1,264 +0,0 @@
/*
* Copyright (C) 2016 Intel Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef __CPUDEF_H__
#define __CPUDEF_H__
#include "ippcore.h"
#if defined( __cplusplus )
extern "C" {
#endif
#undef __CDECL
#if defined( _WIN32 ) || defined ( _WIN64 )
#define __CDECL __cdecl
#else
#define __CDECL
#endif
/* Intel CPU informator */
typedef struct {
int family;
int stepping;
int model;
int type;
int feature;
int tlb;
int cache;
int mmx;
int freq;
int ssx;
int wni;
int htt;
int pni;
int em64t;
int mni;
int phcores;
int sse41;
int sse42;
int ext_family;
int ext_model;
int movbe_instr;
int avx;
int xsavexgetbv;
} ippIntelCpuId;
int __CDECL ownGetMaskFeatures( Ipp64u* pFeaturesMask );
int __CDECL ownGetFeature( Ipp64u MaskOfFeature );
int __CDECL ipp_is_avx_extension( void );
__INT64 __CDECL ipp_get_pentium_counter (void);
int __CDECL ipp_is_mmx_extension (void);
int __CDECL ipp_is_ssx_extension (void);
int __CDECL ipp_is_wni_extension (void);
int __CDECL ipp_is_htt_extension( void );
int __CDECL ipp_is_pni_extension( void );
int __CDECL ipp_is_mni_extension( void );
int __CDECL ipp_is_sse41_extension( void );
int __CDECL ipp_is_sse42_extension( void );
int __CDECL ipp_is_movbe( void );
int __CDECL ipp_get_cores_on_die( void );
int __CDECL ipp_is_em64t_extension( void );
int __CDECL ipp_has_cpuid ( void );
int __CDECL ipp_has_rdtsc( void );
void __CDECL ipp_get_pentium_ident ( ippIntelCpuId* cpuid );
int __CDECL ipp_is_GenuineIntel ( void );
int __CDECL ipp_max_cpuid_input( void );
int __CDECL ipp_get_cpuid( int regs[4], int valEAX, int valECX );
void __CDECL ipp_get_cache_line_size( int* szCacheLine );
int __CDECL ipp_isnan( double x );
int __CDECL ipp_finite( double x );
int __CDECL ipp_isnan_32f( float x );
int __CDECL ipp_finite_32f( float x );
#define ipp_isfinite ipp_finite
unsigned int __CDECL ipp_control87 ( unsigned int newcw, unsigned int mask );
unsigned int __CDECL ipp_status87 ( void );
unsigned int __CDECL ipp_clear87 ( void );
unsigned int __CDECL ipp_clear_ssx (void);
/* topology/affinity */
/* here are definitions of the CW bits exactly as x87 and ssx have */
#define IPP_FPU_MASK_RC 0x0c00
#define IPP_FPU_MASK_PC 0x0300
#define IPP_FPU_MASK_RCPC 0x0f00
#define IPP_FPU_RC_NEAR 0x0000
#define IPP_FPU_RC_DOWN 0x0400
#define IPP_FPU_RC_UP 0x0800
#define IPP_FPU_RC_ZERO 0x0c00
#define IPP_FPU_PC_24 0x0000
#define IPP_FPU_PC_53 0x0200
#define IPP_FPU_PC_64 0x0300
unsigned int __CDECL ipp_set_rcpc_fpu( unsigned int newrcpc, unsigned int mask);
void __CDECL ipp_set_cw_fpu( unsigned int cw );
#define IPP_SSX_RC_NEAR 0x0000
#define IPP_SSX_RC_DOWN 0x2000
#define IPP_SSX_RC_UP 0x4000
#define IPP_SSX_RC_ZERO 0x6000
#define IPP_SSX_MASK_RC 0x6000
unsigned int __CDECL ipp_set_rc_ssx( unsigned int newrc );
void __CDECL ipp_set_cw_ssx( unsigned int cw );
/* ================= FPU section ===================== */
/* Control bits - disable exceptions */
#define FPU_EXC_MSK 0x003f /* Exception Masks Mask */
#define FPU_MSK_INVALID 0x0001 /* invalid operation */
#define FPU_MSK_DENORMAL 0x0002 /* denormalized operand */
#define FPU_MSK_ZERODIV 0x0004 /* zero divide */
#define FPU_MSK_OVERFLOW 0x0008 /* overflow */
#define FPU_MSK_UNDERFLOW 0x0010 /* underflow */
#define FPU_MSK_INEXACT 0x0020 /* inexact (precision) */
/* Status bits - exceptions */
#define FPU_EXC_FLG 0x003f /* Exception Flags Mask */
#define FPU_FLG_INVALID 0x0001 /* invalid operation */
#define FPU_FLG_DENORMAL 0x0002 /* denormalized operand */
#define FPU_FLG_ZERODIV 0x0004 /* zero divide */
#define FPU_FLG_OVERFLOW 0x0008 /* overflow */
#define FPU_FLG_UNDERFLOW 0x0010 /* underflow */
#define FPU_FLG_INEXACT 0x0020 /* inexact (precision) */
/* Control bits - rounding control */
#define FPU_RND 0x0c00 /* Rounding Control Mask */
#define FPU_RND_NEAR 0x0000 /* near */
#define FPU_RND_DOWN 0x0400 /* down */
#define FPU_RND_UP 0x0800 /* up */
#define FPU_RND_CHOP 0x0c00 /* chop */
/* Control bits - precision control */
#define FPU_PRC 0x0300 /* Precision Control Mask */
#define FPU_PRC_64 0x0300 /* 64 bits */
#define FPU_PRC_53 0x0200 /* 53 bits */
#define FPU_PRC_24 0x0000 /* 24 bits */
/* Control bits - all masks */
#define FPU_ALL 0x0f3f /* all masks */
/* ============= definition for control/status world ============== */
#define FPU_SET_EXC_MASK(mask) ps_set_cw_fpu(mask,FPU_EXC_MSK)
#define FPU_GET_EXC_MASK() (ps_set_cw_fpu(0,0) & FPU_EXC_MSK)
#define FPU_GET_EXC_FLAG() (ps_get_sw_fpu() & FPU_EXC_FLG)
#define FPU_SET_RND_MODE(mode) ps_set_cw_fpu(mode,FPU_RND)
#define FPU_GET_RND_MODE() (ps_set_cw_fpu(0,0) & FPU_RND)
#define FPU_SET_PRC_MODE(mode) ps_set_cw_fpu(mode,FPU_PRC)
#define FPU_GET_PRC_MODE() (ps_set_cw_fpu(0,0) & FPU_PRC)
unsigned int __CDECL ps_set_cw_fpu( unsigned int newcw, unsigned int msk);
unsigned int __CDECL ps_get_cw_fpu(void);
unsigned int __CDECL ps_get_sw_fpu(void);
unsigned int __CDECL ps_clear_fpu(void);
/* ======================= SSX section ============================ */
/* Control bits - disable exceptions */
#define SSX_EXC_MSK 0x1f80 /* Disabling exception mask */
#define SSX_MSK_INEXACT 0x1000 /* precision (inexact) */
#define SSX_MSK_UNDERFLOW 0x0800 /* underflow */
#define SSX_MSK_OVERFLOW 0x0400 /* overflow */
#define SSX_MSK_ZERODIV 0x0200 /* divide by zero */
#define SSX_MSK_DENORMAL 0x0100 /* denormalized */
#define SSX_MSK_INVALID 0x0080 /* invalid operation */
/* Status bits - exceptions */
#define SSX_EXC_FLG 0x003f /* Exception flags mask */
#define SSX_FLG_INEXACT 0x0020 /* precision (inexact) */
#define SSX_FLG_UNDERFLOW 0x0010 /* underflow */
#define SSX_FLG_OVERFLOW 0x0008 /* overflow */
#define SSX_FLG_ZERODIV 0x0004 /* divide by zero */
#define SSX_FLG_DENORMAL 0x0002 /* denormalized */
#define SSX_FLG_INVALID 0x0001 /* invalid operation */
/* Control bits - rounding control */
#define SSX_RND 0x6000 /* Rounding control mask */
#define SSX_RND_NEAR 0x0000 /* near */
#define SSX_RND_DOWN 0x2000 /* down */
#define SSX_RND_UP 0x4000 /* up */
#define SSX_RND_CHOP 0x6000 /* chop */
/* Control bits - flush to zero mode */
#define SSX_FZ 0x8000 /* Flush to zero mask */
#define SSX_FZ_ENABLE 0x8000 /* flush to zero */
#define SSX_FZ_DISABLE 0x0000 /* not flush to zero */
/* Control bits - denormals are zero mode */
#define SSX_DAZ 0x0040 /* denorm. are zero mask */
#define SSX_DAZ_ENABLE 0x0040 /* denorm. are zero */
#define SSX_DAZ_DISABLE 0x0000 /* denorm. are not zero */
#define SSX_ALL 0xffbf /* All masks */
/* ==================== definition for SSX register =============== */
#define SSX_SET_EXC_MASK(mask) ps_set_ssx(mask,SSX_EXC_MSK)
#define SSX_GET_EXC_MASK() (ps_get_ssx() & SSX_EXC_MSK)
#define SSX_SET_EXC_FLAG(flag) ps_set_ssx(flag,SSX_EXC_FLG)
#define SSX_GET_EXC_FLAG() (ps_get_ssx() & SSX_EXC_FLG)
#define SSX_SET_RND_MODE(mode) ps_set_ssx(mode,SSX_RND)
#define SSX_GET_RND_MODE() (ps_get_ssx() & SSX_RND)
#define SSX_SET_FZ_MODE(mode) ps_set_ssx(mode,SSX_FZ)
#define SSX_GET_FZ_MODE() (ps_get_ssx() & SSX_FZ)
#define SSX_SET_DAZ_MODE(mode) ps_set_ssx(mode,SSX_DAZ)
#define SSX_GET_DAZ_MODE() (ps_get_ssx() & SSX_DAZ)
unsigned int __CDECL ps_set_ssx(unsigned int newssx, unsigned int msk);
unsigned int __CDECL ps_get_ssx(void);
unsigned int __CDECL ipp_tst_daz_ssx(void);
#if defined( __cplusplus )
}
#endif
#endif /* __CPUDEF_H__ */
/* ////////////////////////// End of file "cpudef.h" //////////////////////// */

View File

@ -1,56 +0,0 @@
/*
* Copyright (C) 2016 Intel Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#if !defined(_IPP_DYNAMIC) || defined(_CORE)
#include "owndefs.h"
#ifndef _IPP_VERSION
#define _IPP_VERSION ""
#endif
#define GET_LIB_NAME01(pref) pref ## GetLibVersion
#define GET_LIB_NAME(pref) GET_LIB_NAME01(pref)
#define LIBVERNAME s_libVer
#define SLIBVERNAME LIBVERNAME
#include "ippverstr.gen"
#include "cpudef.h"
extern int ippJumpIndexForMergedDLL;
IPPFUN( const IppLibraryVersion*, GET_LIB_NAME(LIB_PREFIX), (void) )
{
return &LIBVERNAME;
}
#endif

View File

@ -1,46 +0,0 @@
/*
* Copyright (C) 2016 Intel Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "ippversion.h"
#ifndef BASE_VERSION
#define BASE_VERSION() IPP_VERSION_MAJOR,IPP_VERSION_MINOR,IPP_VERSION_UPDATE
#endif
#ifndef STR_VERSION
#ifdef IPP_REVISION
#define STR_VERSION() IPP_VERSION_STR " (r" STR( IPP_REVISION ) ")"
#else
#define STR_VERSION() IPP_VERSION_STR " (-)"
#endif
#endif
/* ////////////////////////////// End of file /////////////////////////////// */

Some files were not shown because too many files have changed in this diff Show More