Add 'sgx-jvm/linux-sgx/' from commit '2df43c54f3a215b2fe927995c7a8869054cccf8f'
git-subtree-dir: sgx-jvm/linux-sgx git-subtree-mainline:d52accb52c
git-subtree-split:2df43c54f3
19
sgx-jvm/linux-sgx/.gitignore
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
#object file
|
||||
*.o
|
||||
|
||||
#library
|
||||
*.a
|
||||
|
||||
#share object
|
||||
*.so
|
||||
*.so.*
|
||||
|
||||
#generated proxy
|
||||
*_u.c
|
||||
*_u.h
|
||||
*_t.c
|
||||
*_t.h
|
||||
|
||||
#output files
|
||||
/build/
|
||||
/linux/installer/bin/*.bin
|
79
sgx-jvm/linux-sgx/CONTRIBUTING.md
Normal file
@ -0,0 +1,79 @@
|
||||
# Contributing
|
||||
|
||||
## Issues
|
||||
|
||||
GitHub Issues tracks SGX SDK and PSW design and development issues, bugs, and feature requests.
|
||||
For usage, installation, or other requests for help, please use the [01.org](https://01.org/intel-software-guard-extensions/forum/forum) forum instead.
|
||||
|
||||
When reporting a bug, please provide the following information, where applicable:
|
||||
|
||||
* What are the steps to reproduce the bug?
|
||||
* Can you reproduce the bug using the latest [master](https://github.com/01org/linux-sgx/tree/master)?
|
||||
* What CPU, platform, operating system/distribution, and SGX driver are you running? The more specific, the better.
|
||||
* For crashes, please provide the backtrace (use gdb).
|
||||
|
||||
|
||||
### Contribution Guide
|
||||
|
||||
We accept contributions as pull requests on GitHub. More detailed guidelines will be added later. Please follow these simple rules for now:
|
||||
|
||||
* A PR should have a clear purpose, and do one thing only, and nothing more. This will enable us review your PR more quickly.
|
||||
* Each commit in PR should be a small, atomic change representing one step in development.
|
||||
* Please squash intermediate steps within PR for bugfixes, style cleanups, reversions, etc., so they would not appear in merged PR history.
|
||||
* Please explain anything non-obvious from the code in comments, commit messages, or the PR description, as appropriate.
|
||||
|
||||
### License
|
||||
|
||||
linux-sgx is licensed under the terms in [LICENSE](https://github.com/01org/linux-sgx/blob/master/License.txt). By contributing to the project, you agree to the license and copyright terms therein and release your contribution under these terms.
|
||||
|
||||
### Sign your work
|
||||
|
||||
Please use the sign-off line at the end of the patch. Your signature certifies that you wrote the patch or otherwise have the right to pass it on as an open-source patch. The rules are pretty simple: if you can certify
|
||||
the below (from [developercertificate.org](http://developercertificate.org/)):
|
||||
|
||||
```
|
||||
Developer Certificate of Origin
|
||||
Version 1.1
|
||||
|
||||
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
|
||||
660 York Street, Suite 102,
|
||||
San Francisco, CA 94110 USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this
|
||||
license document, but changing it is not allowed.
|
||||
|
||||
Developer's Certificate of Origin 1.1
|
||||
|
||||
By making a contribution to this project, I certify that:
|
||||
|
||||
(a) The contribution was created in whole or in part by me and I
|
||||
have the right to submit it under the open source license
|
||||
indicated in the file; or
|
||||
|
||||
(b) The contribution is based upon previous work that, to the best
|
||||
of my knowledge, is covered under an appropriate open source
|
||||
license and I have the right under that license to submit that
|
||||
work with modifications, whether created in whole or in part
|
||||
by me, under the same open source license (unless I am
|
||||
permitted to submit under a different license), as indicated
|
||||
in the file; or
|
||||
|
||||
(c) The contribution was provided directly to me by some other
|
||||
person who certified (a), (b) or (c) and I have not modified
|
||||
it.
|
||||
|
||||
(d) I understand and agree that this project and the contribution
|
||||
are public and that a record of the contribution (including all
|
||||
personal information I submit with it, including my sign-off) is
|
||||
maintained indefinitely and may be redistributed consistent with
|
||||
this project or the open source license(s) involved.
|
||||
```
|
||||
|
||||
Then you just add a line to every git commit message:
|
||||
|
||||
Signed-off-by: Joe Smith <joe.smith@email.com>
|
||||
|
||||
Use your real name (sorry, no pseudonyms or anonymous contributions.)
|
||||
|
||||
If you set your `user.name` and `user.email` git configs, you can sign your
|
||||
commit automatically with `git commit -s`.
|
1396
sgx-jvm/linux-sgx/License.txt
Normal file
251
sgx-jvm/linux-sgx/Linux_SGXEclipsePlugin/build.sh
Executable file
@ -0,0 +1,251 @@
|
||||
#!/bin/bash
|
||||
export PATH=/home/jenkins/jdk/bin/:$PATH
|
||||
|
||||
|
||||
# Get the Eclipse launcher and build script to use
|
||||
set -x
|
||||
set -e
|
||||
|
||||
TRUNK_HOME=$(cd $(pwd)/../../ ; pwd)
|
||||
#gives you the posibility to overwrite eclipse, if you do not use URL
|
||||
[ -n "${ECLIPSE_HOME}" ] || { echo "using default ECLIPSE_HOME=${TRUNK_HOME}/eclipse"; ECLIPSE_HOME=${TRUNK_HOME}/eclipse; }
|
||||
|
||||
|
||||
BUILD_RELEASE_ID_PREFIX=Linux_SGX_1.5
|
||||
|
||||
if [ "$RELEASE_ID" != "${RELEASE_ID%$BUILD_RELEASE_ID_PREFIX*}" ]; then
|
||||
echo "$BUILD_RELEASE_ID_PREFIX IS in $RELEASE_ID, so it is an triggered build. Change the RELEASE_ID to an accepted form."
|
||||
temp=${RELEASE_ID#$BUILD_RELEASE_ID_PREFIX}
|
||||
RELEASE_ID=v`echo ${temp} | tr -d _ | tr -d -`
|
||||
else
|
||||
echo "$BUILD_RELEASE_ID_PREFIX is NOT in $RELEASE_ID. Keeping the user specified RELEASE_ID."
|
||||
fi
|
||||
|
||||
function main() {
|
||||
validate-jenkins-parameters
|
||||
cleanupPreBuild
|
||||
checkEnvironment
|
||||
buildPlugin
|
||||
archivePlugin
|
||||
}
|
||||
|
||||
function validate-jenkins-parameters {
|
||||
validate-parameter "DELETE_CURRENT_ECLIPSE" "$DELETE_CURRENT_ECLIPSE"
|
||||
[[ "ECLIPSE_DOWNLOAD_URL" != "" ]] &&
|
||||
echo "[WARNING] ECLIPSE_DOWNLOAD_URL is not set; assume eclipse archive is already downloaded"
|
||||
}
|
||||
|
||||
function validate-parameter {
|
||||
local NAME="$1"
|
||||
local VALUE="$2"
|
||||
[[ ! -z "$VALUE" ]] || {
|
||||
echo "Mandatory Jenkins parameter '\$$NAME' not set !"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
function cleanupPreBuild() {
|
||||
./clean.sh
|
||||
|
||||
[[ "false" == "${DELETE_CURRENT_ECLIPSE}" ]] || {
|
||||
forceRemoveEclipse
|
||||
}
|
||||
}
|
||||
|
||||
function forceRemoveEclipse() {
|
||||
pushd ${TRUNK_HOME}
|
||||
rm -fr eclipse
|
||||
popd
|
||||
}
|
||||
|
||||
function checkEnvironment() {
|
||||
if [ ! -d "${ECLIPSE_HOME}" ]; then
|
||||
echo "Eclipse does not exist"
|
||||
echo "Downloading eclipse"
|
||||
|
||||
getEclipse
|
||||
fi
|
||||
|
||||
if [ -z "$RELEASE_ID" ]; then
|
||||
echo "Mandatory variable RELEASE_ID not defined; exiting"
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
function getEclipse() {
|
||||
local eclipseArchiveURL="${ECLIPSE_DOWNLOAD_URL}"
|
||||
|
||||
pushd $TRUNK_HOME
|
||||
cleanupEclipseArchive
|
||||
downloadEclipse "${eclipseArchiveURL}"
|
||||
unzipEclipse
|
||||
installPDE
|
||||
cleanupEclipseArchive
|
||||
popd
|
||||
}
|
||||
|
||||
function cleanupEclipseArchive() {
|
||||
find . -maxdepth 1 -mindepth 1 -name "*eclipse*.zip*" | xargs rm -f
|
||||
}
|
||||
|
||||
function downloadEclipse() {
|
||||
local URL="$1"
|
||||
if [[ "$1" != "" ]] ; then
|
||||
echo " wget --no-proxy "$1""
|
||||
wget --no-proxy "$1"
|
||||
else
|
||||
echo "skip downloaded empty url"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
function unzipEclipse() {
|
||||
pwd
|
||||
rm -fr eclipse
|
||||
local eclipseArchiveName="$(find . -maxdepth 1 -mindepth 1 -name "*eclipse*.zip*")"
|
||||
unzip "${eclipseArchiveName}"
|
||||
|
||||
[[ -d eclipse ]] || {
|
||||
echo "Eclipse directory does not exist!"
|
||||
exit
|
||||
}
|
||||
|
||||
# local eclipseFolderName=${eclipseArchiveName%.zip}
|
||||
# local eclipseArchiveName="eclipse"
|
||||
# mv "${eclipseFolderName}" eclipse
|
||||
}
|
||||
|
||||
function installPDE() {
|
||||
echo "~~~~>"
|
||||
pwd
|
||||
${ECLIPSE_HOME}/eclipse -nosplash \
|
||||
-application org.eclipse.equinox.p2.director \
|
||||
-repository http://download.eclipse.org/eclipse/updates/4.4 \
|
||||
-destination ${ECLIPSE_HOME} \
|
||||
-installIU org.eclipse.pde.source.feature.group \
|
||||
-installIU org.eclipse.pde.feature.group
|
||||
}
|
||||
|
||||
function preBuild() {
|
||||
local BUILDDIR="$1"
|
||||
local BUILDDIRWORK="$2"
|
||||
|
||||
local SITEFILE="$BUILDDIRWORK/sites/site.xml"
|
||||
local FEATUREDIR="$BUILDDIRWORK/features"
|
||||
local FEATUREFILE="feature.xml"
|
||||
local PLUGINDIR="$BUILDDIRWORK/plugins"
|
||||
local PLUGINFILE="META-INF/MANIFEST.MF"
|
||||
|
||||
local ROOTDIR=$(dirname "$0")"/.."
|
||||
local VERSION=$(awk '/STRFILEVER/ {print $3}' ${ROOTDIR}/common/inc/internal/se_version.h|sed 's/^\"\(.*\)\"$/\1/')
|
||||
VERSION=$(echo "$VERSION" | awk -F'.' '{for(i=1; i<=NF&&i<=3; i++) if(i==1){version=$i} else{version=version"."$i}}; END{print version}')
|
||||
|
||||
if [[ "$VERSION" =~ ^[0-9]{1,}(.[0-9]{1,}){2}$ ]]; then
|
||||
rm -fr "$BUILDDIRWORK"
|
||||
cp -fr "$BUILDDIR" "$BUILDDIRWORK"
|
||||
|
||||
#site.xml
|
||||
sed -i "s#[0-9]\{1,\}\(\.[0-9]\{1,\}\)\{0,2\}\.qualifier#$VERSION\.qualifier#g" "$SITEFILE"
|
||||
|
||||
#feature
|
||||
for DIR in $(ls "$FEATUREDIR"); do
|
||||
sed -i "s#[0-9]\{1,\}\(\.[0-9]\{1,\}\)\{0,2\}\.qualifier#$VERSION\.qualifier#g" "$FEATUREDIR/$DIR/$FEATUREFILE"
|
||||
done
|
||||
|
||||
#plugin
|
||||
for DIR in $(ls "$PLUGINDIR"); do
|
||||
sed -i "s#[0-9]\{1,\}\(\.[0-9]\{1,\}\)\{0,2\}\.qualifier#$VERSION\.qualifier#g" "$PLUGINDIR/$DIR/$PLUGINFILE"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
function postBuild() {
|
||||
local BUILDDIR="$1"
|
||||
local BUILDDIRWORK="$2"
|
||||
local UPDATESITEDIR="updatesite"
|
||||
|
||||
if [[ -d "$BUILDDIRWORK" ]] && [[ -d "$BUILDDIRWORK/$UPDATESITEDIR" ]]; then
|
||||
rm -fr "$BUILDDIR/$UPDATESITEDIR"
|
||||
cp -fr "$BUILDDIRWORK/$UPDATESITEDIR" "$BUILDDIR/$UPDATESITEDIR"
|
||||
rm -fr "$BUILDDIRWORK"
|
||||
fi
|
||||
}
|
||||
|
||||
function buildPlugin() {
|
||||
pwd
|
||||
|
||||
echo "PWD=`pwd`"
|
||||
echo "ECLIPSE_HOME=$ECLIPSE_HOME"
|
||||
|
||||
#BASELOCATION="$PWD/target_platform"
|
||||
BASELOCATION="$ECLIPSE_HOME"
|
||||
BUILDVERSION="$RELEASE_ID"
|
||||
BUILDDIR="$PWD/build_directory"
|
||||
BUILDDIRWORK="$PWD/.build_directory"
|
||||
BUILDCONFIG="$PWD/build_config"
|
||||
LAUNCHER=`findFirst "$ECLIPSE_HOME"/plugins/org.eclipse.equinox.launcher_*.jar`
|
||||
BUILDFILE=`findFirst "$ECLIPSE_HOME"/plugins/org.eclipse.pde.build_*/scripts/build.xml`
|
||||
|
||||
# make sure we found valid files
|
||||
if [ ! -f "$LAUNCHER" ]; then
|
||||
echo "Installation Error: Eclipse plugin org.eclipse.equinox.launcher...jar not detected. " \
|
||||
"Found '$LAUNCHER'. Aborting."
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -f "$BUILDFILE" ]; then
|
||||
echo "Installation Error: Eclipse build file org.eclipse.pde.build_.../scripts/build.xml " \
|
||||
"not detected. Found '$BUILDFILE'. Aborting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
preBuild "$BUILDDIR" "$BUILDDIRWORK"
|
||||
|
||||
#
|
||||
# -- Print configuration used and actually execute the build --
|
||||
#
|
||||
echo "Eclipse configuration found:"
|
||||
echo " Eclipse Home: $ECLIPSE_HOME"
|
||||
echo " Launcher: $LAUNCHER"
|
||||
echo " Build File: $BUILDFILE"
|
||||
echo " Build Config: $BUILDCONFIG"
|
||||
echo " Base Location: $BASELOCATION"
|
||||
echo " Build Directory: $BUILDDIRWORK"
|
||||
echo " Build Version: $BUILDVERSION"
|
||||
echo " Java: " $(which java)
|
||||
java -version
|
||||
|
||||
# CURRENT_DIR=$(pwd)
|
||||
# ${ECLIPSE_HOME}/eclipse -application org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher -metadataRepository file:/${CURRENT_DIR}/build_directory/updatesite/sgx-eclipse-plugin -artifactRepository file:/${CURRENT_DIR}/build_directory/updatesite/featuresAndBundles -source ${CURRENT_DIR}/build_directory/ -config gtk.linux.x86 -compress -publishArtifacts
|
||||
# cp ./build_directory/updatesite/featuresAndBundles/artifacts.jar ./build_directory/updatesite/sgx-eclipse-plugin/
|
||||
|
||||
java \
|
||||
-jar $LAUNCHER \
|
||||
-application org.eclipse.ant.core.antRunner \
|
||||
-buildfile $BUILDFILE \
|
||||
-DbuildDirectory=$BUILDDIRWORK \
|
||||
-DbaseLocation=$BASELOCATION \
|
||||
-Dbuilder=$BUILDCONFIG \
|
||||
-DforceContextQualifier=$BUILDVERSION \
|
||||
-v -v -v -v
|
||||
|
||||
postBuild "$BUILDDIR" "$BUILDDIRWORK"
|
||||
}
|
||||
|
||||
function findFirst() {
|
||||
echo "enter Find First, $@" 1>&2
|
||||
for i in "$@"; do
|
||||
if [ -f "$i" ]; then
|
||||
echo "found $i" 1>&2
|
||||
echo "$i"
|
||||
return
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
function archivePlugin() {
|
||||
pushd build_directory/updatesite/sgx-eclipse-plugin
|
||||
zip -r Intel-sgx-eclipse-plugin.zip *
|
||||
popd
|
||||
}
|
||||
|
||||
main
|
@ -0,0 +1,52 @@
|
||||
<project name="allElements Delegator">
|
||||
<property name="defaultAssemblyEnabled" value="true" />
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Run a given ${target} on all elements being built -->
|
||||
<!-- By default ${topLevelElementType} and ${topLevelElementId} should be -->
|
||||
<!-- defined in the builder's build.properties file. You can customize by -->
|
||||
<!-- setting the type/id values directly here. -->
|
||||
<!-- You can add additional calls to ${genericTargets} to build more top -->
|
||||
<!-- level elements. -->
|
||||
<!-- -->
|
||||
<!-- The top level must exist in the ${buildDirectory}, ${baseLocation} or -->
|
||||
<!-- ${pluginPath} locations. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="allElementsDelegator">
|
||||
<ant antfile="${genericTargets}" target="${target}">
|
||||
<property name="type" value="${topLevelElementType}" />
|
||||
<property name="id" value="${topLevelElementId}" />
|
||||
</ant>
|
||||
</target>
|
||||
|
||||
<!-- ====================================================================== -->
|
||||
<!-- The default assemble target, this will be called to assemble each -->
|
||||
<!-- config if a custom assemble target is not defined. -->
|
||||
<!-- The following properties will be defined: -->
|
||||
<!-- config : The configuration being assembled eg "win32.win32.x86" -->
|
||||
<!-- element: The element being assembled eg "org.eclipse.sdk" -->
|
||||
<!-- assembleScriptName: The assemble script to be called -->
|
||||
<!-- ====================================================================== -->
|
||||
<target name="defaultAssemble">
|
||||
<ant antfile="${assembleScriptName}" dir="${buildDirectory}" />
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Custom targets to assemble the built elements for particular -->
|
||||
<!-- configurations. These generally call the generated assemble scripts -->
|
||||
<!-- (named in ${assembleScriptName}) but may also add pre and post -->
|
||||
<!-- processing -->
|
||||
<!-- Add one target for each root element and each configuration for which -->
|
||||
<!-- custom processing is desired. Replace element.id with the id of the -->
|
||||
<!-- top level element being built. A property with a matching name must -->
|
||||
<!-- be defined for this custom target to be called instead of the -->
|
||||
<!-- defaultAssemble target above. -->
|
||||
<!-- Example: name="assemble.org.eclipse.sdk" -->
|
||||
<!-- Example: name="assemble.org.eclipse.sdk.win32.win32.x86" -->
|
||||
<!-- ====================================================================== -->
|
||||
<property name="assemble.element.id[.config.spec]" value="true" />
|
||||
<target name="assemble.element.id[.config.spec]">
|
||||
<ant antfile="${assembleScriptName}" dir="${buildDirectory}"/>
|
||||
</target>
|
||||
|
||||
</project>
|
@ -0,0 +1,307 @@
|
||||
|
||||
###############################################################################
|
||||
# Copyright (c) 2003, 2011 IBM Corporation 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 at
|
||||
# http://www.eclipse.org/legal/epl-v10.html
|
||||
#
|
||||
# Contributors:
|
||||
# IBM Corporation - initial API and implementation
|
||||
# Compuware Corporation - Sebastien Angers <sebastien.angers@compuware.com>
|
||||
# - Enabled additional mirror slicingOptions in Headless PDE Build
|
||||
# - Enabled 'raw' attribute for mirror step in Headless PDE Build
|
||||
# - https://bugs.eclipse.org/338878
|
||||
###############################################################################
|
||||
#####################
|
||||
# Parameters describing how and where to execute the build.
|
||||
# Typical users need only update the following properties:
|
||||
# baseLocation - where things you are building against are installed
|
||||
# bootclasspath - The base jars to compile against (typicaly rt.jar)
|
||||
# configs - the list of {os, ws, arch} configurations to build.
|
||||
#
|
||||
# Of course any of the settings here can be overridden by spec'ing
|
||||
# them on the command line (e.g., -DbaseLocation=d:/eclipse
|
||||
|
||||
#The type of the top level element we are building, generally "feature"
|
||||
topLevelElementType = feature
|
||||
#The id of the top level element we are building
|
||||
# the following feature will not be include in the final archive
|
||||
topLevelElementId = com.intel.sgx.build.driver
|
||||
|
||||
############# PRODUCT/PACKAGING CONTROL #############
|
||||
#product=/plugin or feature id/path/to/.product
|
||||
#product=com.intel.sgx.feature
|
||||
runPackager=false
|
||||
|
||||
#Set the name of the archive that will result from the product build.
|
||||
#archiveNamePrefix=
|
||||
|
||||
# The prefix that will be used in the generated archive.
|
||||
archivePrefix=sgx-eclipse-plugin
|
||||
|
||||
# The location underwhich all of the build output will be collected.
|
||||
collectingFolder=${archivePrefix}
|
||||
|
||||
# The list of {os, ws, arch} configurations to build. This
|
||||
# value is a '&' separated list of ',' separate triples. For example,
|
||||
# configs=win32,win32,x86 & linux,motif,x86
|
||||
# By default the value is *,*,*
|
||||
configs = *, *, *
|
||||
#configs=win32, win32, x86 & \
|
||||
# win32,win32,x86_64 & \
|
||||
# win32,win32,wpf & \
|
||||
# linux, gtk, ppc & \
|
||||
# linux, gtk, x86 & \
|
||||
# linux, gtk, x86_64 & \
|
||||
# linux, motif, x86 & \
|
||||
# solaris, motif, sparc & \
|
||||
# solaris, gtk, sparc & \
|
||||
# aix, motif, ppc & \
|
||||
# hpux, motif, ia64_32 & \
|
||||
# macosx, carbon, ppc & \
|
||||
# macosx, carbon, x86 & \
|
||||
# macosx, cocoa, ppc & \
|
||||
# macosx, cocoa, x86 & \
|
||||
# macosx, cocoa, x86_64
|
||||
|
||||
# By default PDE creates one archive (result) per entry listed in the configs property.
|
||||
# Setting this value to true will cause PDE to only create one output containing all
|
||||
# artifacts for all the platforms listed in the configs property.
|
||||
# To control the output format for the group, add a "group, group, group - <format>" entry to the
|
||||
# archivesFormat.
|
||||
#groupConfigurations=true
|
||||
|
||||
#The format of the archive. By default a zip is created using antZip.
|
||||
#The list can only contain the configuration for which the desired format is different than zip.
|
||||
#archivesFormat=win32, win32, x86 - antZip& \
|
||||
# linux, gtk, ppc - antZip &\
|
||||
# linux, gtk, x86 - antZip& \
|
||||
# linux, gtk, x86_64 - antZip& \
|
||||
# linux, motif, x86 - antZip& \
|
||||
# solaris, motif, sparc - antZip& \
|
||||
# solaris, gtk, sparc - antZip& \
|
||||
# aix, motif, ppc - antZip& \
|
||||
# hpux, motif, PA_RISC - antZip& \
|
||||
# macosx, carbon, ppc - antZip
|
||||
|
||||
#Allow cycles involving at most one bundle that needs to be compiled with the rest being binary bundles.
|
||||
allowBinaryCycles = true
|
||||
|
||||
#Sort bundles depenedencies across all features instead of just within a given feature.
|
||||
#flattenDependencies = true
|
||||
|
||||
#Parallel compilation, requires flattenedDependencies=true
|
||||
#parallelCompilation=true
|
||||
#parallelThreadCount=
|
||||
#parallelThreadsPerProcessor=
|
||||
|
||||
#Set to true if you want the output to be ready for an update jar (no site.xml generated)
|
||||
outputUpdateJars = true
|
||||
|
||||
#Set to true for Jnlp generation
|
||||
#codebase should be a URL that will be used as the root of all relative URLs in the output.
|
||||
#generateJnlp=false
|
||||
#jnlp.codebase=<codebase url>
|
||||
#jnlp.j2se=<j2se version>
|
||||
#jnlp.locale=<a locale>
|
||||
#jnlp.generateOfflineAllowed=true or false generate <offlineAllowed/> attribute in the generated features
|
||||
#jnlp.configs=${configs} #uncomment to filter the content of the generated jnlp files based on the configuration being built
|
||||
|
||||
#Set to true if you want to sign jars
|
||||
#signJars=false
|
||||
#sign.alias=<alias>
|
||||
#sign.keystore=<keystore location>
|
||||
#sign.storepass=<keystore password>
|
||||
#sign.keypass=<key password>
|
||||
|
||||
#Arguments to send to the zip executable
|
||||
zipargs=
|
||||
|
||||
#Arguments to send to the tar executable
|
||||
tarargs=
|
||||
|
||||
#individualSourceBundles=true
|
||||
|
||||
#Control the creation of a file containing the version included in each configuration - on by default
|
||||
#generateVersionsLists=false
|
||||
|
||||
############ REPO MIRROR OPTIONS CONTROL ############
|
||||
# Default values for the slicingOptions and raw attribute of the p2.mirror Ant target used to generate the p2 repo (buildRepo)
|
||||
# Note that the default values used by PDE/Build are different from the default values for p2.mirror's slicingOptions and raw attribute
|
||||
# See http://help.eclipse.org/topic//org.eclipse.platform.doc.isv/guide/p2_repositorytasks.htm for the details
|
||||
# of each setting.
|
||||
#p2.mirror.slicing.filter=
|
||||
#p2.mirror.slicing.followOnlyFilteredRequirements=false
|
||||
#p2.mirror.slicing.followStrict=false
|
||||
#p2.mirror.slicing.includeFeatures=true
|
||||
#p2.mirror.slicing.includeNonGreedy=false
|
||||
#p2.mirror.slicing.includeOptional=true
|
||||
#p2.mirror.slicing.platformFilter=
|
||||
#p2.mirror.slicing.latestVersionOnly=false
|
||||
|
||||
#p2.mirror.raw=false
|
||||
|
||||
############## SOURCE BUNDLE CONTROL ################
|
||||
# Set this property to have source bundles created and output into build repository.
|
||||
# This does NOT put them in the build output (e.g., product) itself.
|
||||
# Valid values are: not set, built, all.
|
||||
# built = only source for bundles that are actually built/compiled in this run are output
|
||||
# all = all available source is collected and output
|
||||
#sourceBundleMode=all
|
||||
|
||||
# When outputting autogenerated source bundles a feature is created to contain all the automatic
|
||||
# source bundles. Typically this feature is not needed and can be ignored. As such, it is given a default
|
||||
# name and version. These properties can be used to override the defaults.
|
||||
# sourceBundleTemplateFeature - can specify an existing feature which will be augmented to form the generated source feature
|
||||
# sourceBundleFeatureId - will be the id of generated source feature which contains all the generated source bundles, default value
|
||||
# is sourceBundleTemplateFeature + ".source" if sourceBundleTemplateFeature is specified
|
||||
#sourceBundleTemplateFeature=
|
||||
#sourceBundleFeatureId=
|
||||
#sourceBundleFeatureVersion=
|
||||
|
||||
############## BUILD NAMING CONTROL ################
|
||||
# The directory into which the build elements are fetched and where
|
||||
# the build takes place.
|
||||
#buildDirectory=
|
||||
|
||||
# Type of build. Used in naming the build output. Typically this value is
|
||||
# one of I, N, M, S, ...
|
||||
buildType=build
|
||||
|
||||
# ID of the build. Used in naming the build output.
|
||||
buildId=${forceContextQualifier}
|
||||
|
||||
# Label for the build. Used in naming the build output
|
||||
buildLabel=${buildId}
|
||||
|
||||
# Timestamp for the build. Used in naming the build output
|
||||
timestamp=007
|
||||
|
||||
#The value to be used for the qualifier of a plugin or feature when you want to override the value computed by pde.
|
||||
#The value will only be applied to plugin or features indicating build.properties, qualifier = context
|
||||
#forceContextQualifier=
|
||||
|
||||
#Enable / disable the generation of a suffix for the features that use .qualifier.
|
||||
#The generated suffix is computed according to the content of the feature
|
||||
#generateFeatureVersionSuffix=true
|
||||
|
||||
############# BASE CONTROL #############
|
||||
# Settings for the base Eclipse components and Java class libraries
|
||||
# against which you are building.
|
||||
# Base location for anything the build needs to compile against. For example,
|
||||
# in most RCP app or a plug-in, the baseLocation should be the location of a previously
|
||||
# installed Eclipse against which the application or plug-in code will be compiled and the RCP delta pack.
|
||||
|
||||
base=<path/to/parent/of/eclipse>
|
||||
#baseLocation=
|
||||
|
||||
#Folder containing repositories whose content is needed to compile against
|
||||
#repoBaseLocation=${base}/repos
|
||||
#Folder where the content of the repositories from ${repoBaseLocation} will be made available as a form suitable to be compiled against
|
||||
#transformedRepoLocation=${base}/transformedRepos
|
||||
|
||||
#Os/Ws/Arch/nl of the eclipse specified by baseLocation
|
||||
baseos=win32
|
||||
basews=win32
|
||||
basearch=x86
|
||||
|
||||
#this property indicates whether you want the set of plug-ins and features to be considered during the build to be limited to the ones reachable from the features / plugins being built
|
||||
filteredDependencyCheck=false
|
||||
|
||||
#this property indicates whether the resolution should be done in development mode (i.e. ignore multiple bundles with singletons)
|
||||
resolution.devMode=false
|
||||
|
||||
#pluginPath is a list of locations in which to find plugins and features. This list is separated by the platform file separator (; or :)
|
||||
#a location is one of:
|
||||
#- the location of the jar or folder that is the plugin or feature : /path/to/foo.jar or /path/to/foo
|
||||
#- a directory that contains a /plugins or /features subdirectory
|
||||
#- the location of a feature.xml, or for 2.1 style plugins, the plugin.xml or fragment.xml
|
||||
#pluginPath=
|
||||
|
||||
skipBase=true
|
||||
eclipseURL=<url for eclipse download site>
|
||||
eclipseBuildId=<Id of Eclipse build to get>
|
||||
eclipseBaseURL=${eclipseURL}/eclipse-platform-${eclipseBuildId}-win32.zip
|
||||
|
||||
|
||||
############# MAP FILE CONTROL ################
|
||||
# This section defines CVS tags to use when fetching the map files from the repository.
|
||||
# If you want to fetch the map file from repository / location, change the getMapFiles target in the customTargets.xml
|
||||
|
||||
skipMaps=true
|
||||
mapsRepo=:pserver:anonymous@example.com/path/to/repo
|
||||
mapsRoot=path/to/maps
|
||||
mapsCheckoutTag=HEAD
|
||||
|
||||
#tagMaps=true
|
||||
mapsTagTag=v${buildId}
|
||||
|
||||
|
||||
############ REPOSITORY CONTROL ###############
|
||||
# This section defines properties parameterizing the repositories where plugins, fragments
|
||||
# bundles and features are being obtained from.
|
||||
|
||||
# The tags to use when fetching elements to build.
|
||||
# By default thebuilder will use whatever is in the maps.
|
||||
# This value takes the form of a comma separated list of repository identifier (like used in the map files) and the
|
||||
# overriding value
|
||||
# For example fetchTag=CVS=HEAD, SVN=v20050101
|
||||
# fetchTag=HEAD
|
||||
skipFetch=true
|
||||
|
||||
|
||||
############# JAVA COMPILER OPTIONS ##############
|
||||
# The location of the Java jars to compile against. Typically the rt.jar for your JDK/JRE
|
||||
#bootclasspath=${java.home}/lib/rt.jar
|
||||
|
||||
# specific JRE locations to compile against. These values are used to compile bundles specifying a
|
||||
# Bundle-RequiredExecutionEnvironment. Uncomment and set values for environments that you support
|
||||
#CDC-1.0/Foundation-1.0= /path/to/rt.jar
|
||||
#CDC-1.1/Foundation-1.1=
|
||||
#OSGi/Minimum-1.0=
|
||||
#OSGi/Minimum-1.1=
|
||||
#JRE-1.1=
|
||||
#J2SE-1.2=
|
||||
#J2SE-1.3=
|
||||
#J2SE-1.4=
|
||||
#J2SE-1.5=
|
||||
#JavaSE-1.6=
|
||||
#PersonalJava-1.1=
|
||||
#PersonalJava-1.2=
|
||||
#CDC-1.0/PersonalBasis-1.0=
|
||||
#CDC-1.0/PersonalJava-1.0=
|
||||
#CDC-1.1/PersonalBasis-1.1=
|
||||
#CDC-1.1/PersonalJava-1.1=
|
||||
|
||||
# Specify the output format of the compiler log when eclipse jdt is used
|
||||
logExtension=.log
|
||||
|
||||
# Whether or not to include debug info in the output jars
|
||||
javacDebugInfo=false
|
||||
|
||||
# Whether or not to fail the build if there are compiler errors
|
||||
javacFailOnError=true
|
||||
|
||||
# Enable or disable verbose mode of the compiler
|
||||
javacVerbose=true
|
||||
|
||||
# Extra arguments for the compiler. These are specific to the java compiler being used.
|
||||
#compilerArg=
|
||||
|
||||
# Default value for the version of the source code. This value is used when compiling plug-ins that do not set the Bundle-RequiredExecutionEnvironment or set javacSource in build.properties
|
||||
javacSource=1.6
|
||||
|
||||
# Default value for the version of the byte code targeted. This value is used when compiling plug-ins that do not set the Bundle-RequiredExecutionEnvironment or set javacTarget in build.properties.
|
||||
javacTarget=1.6
|
||||
|
||||
################### CUSTOM PROPERTIES #######################################
|
||||
# repository location for update site
|
||||
# comment out - this is passed in from command line
|
||||
updateSiteSource=${buildDirectory}/sites
|
||||
# where to place update site build
|
||||
#updateSiteRoot=${user.home}/www/no_crawl/
|
||||
updateSiteRoot=${buildDirectory}/updatesite
|
||||
updateSiteFolder=${archivePrefix}
|
||||
updateSiteDestination=${updateSiteRoot}/${updateSiteFolder}
|
||||
|
@ -0,0 +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>
|
@ -0,0 +1,66 @@
|
||||
<project name="customAssembly.template" default="noDefault">
|
||||
|
||||
<!-- =====================================================================
|
||||
|
||||
The Following Properties are available in all targets:
|
||||
- eclipse.base : the base folder everything will be collected into
|
||||
- eclipse.plugins : the plugins folder
|
||||
- eclipse.features: the features folder
|
||||
- archiveFullPath : the full path of the final archive once it is created
|
||||
|
||||
===================================================================== -->
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Called after each invocation of the gather.bin.parts target on the -->
|
||||
<!-- individual plugins and features. -->
|
||||
<!-- Available properties are: -->
|
||||
<!-- projectLocation: location of the project being gathered -->
|
||||
<!-- projectName: symbolic name with version (org.eclipse.foo_1.0.0.v123) -->
|
||||
<!-- target.folder: the destination, eclipse/plugins or eclipse/features -->
|
||||
<!-- -->
|
||||
<!-- The generated pattern is that plugins/features are gathered into the -->
|
||||
<!-- folder ${target.folder}/${projectName} -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="gather.bin.parts">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Called after invoking the gather.bin.parts targets for all plugins -->
|
||||
<!-- and features. Results exist as folders and have not yet been jarred. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="post.gather.bin.parts">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Called just prior to signing a jar -->
|
||||
<!-- In addititon to the properties listed above: -->
|
||||
<!-- - source : plugins or features directory -->
|
||||
<!-- - elementName: element being signed without .jar -->
|
||||
<!-- (eg "org.eclipse.foo_1.0.0" -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="pre.jarSigning">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Called after all plugins and features have been jarred -->
|
||||
<!-- (and potentially signed) -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="post.jarUp">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Called just before the archive file is built -->
|
||||
<!-- In addititon to the properties listed above: -->
|
||||
<!-- - rootFolder : the folder containing the root files -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="pre.archive">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Default target -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="noDefault">
|
||||
<echo message="You must specify a target when invoking this file" />
|
||||
</target>
|
||||
|
||||
</project>
|
@ -0,0 +1,208 @@
|
||||
<project name="customTargets.template" default="noDefault">
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Run a given ${target} on all elements being built -->
|
||||
<!-- Add on <ant> task for each top level element being built. -->
|
||||
<!-- ===================================================================== -->
|
||||
<available property="allElementsFile" file="${builder}/allElements.xml" value="${builder}/allElements.xml"/>
|
||||
<property name="allElementsFile" location="${eclipse.pdebuild.templates}/headless-build/allElements.xml"/>
|
||||
<property name="eclipse.running" value="false"/>
|
||||
|
||||
<import file="${allElementsFile}" />
|
||||
<target name="allElements">
|
||||
<antcall target="allElementsDelegator" />
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="getBaseComponents" depends="checkLocalBase" unless="skipBase">
|
||||
<get src="${eclipseBaseURL}" dest="${buildDirectory}/../temp-base.zip" />
|
||||
<unzip dest="${base}" overwrite="true" src="${buildDirectory}/../temp-base.zip" />
|
||||
</target>
|
||||
|
||||
<target name="checkLocalBase">
|
||||
<available file="${base}" property="skipBase" />
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Check out map files from correct repository -->
|
||||
<!-- Replace values for mapsCheckoutTag as desired. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="getMapFiles" depends="checkLocalMaps" unless="skipMaps">
|
||||
<property name="mapsCheckoutTag" value="HEAD" />
|
||||
<cvs cvsRoot="${mapsRepo}" package="${mapsRoot}" dest="${buildDirectory}/maps" tag="${mapsCheckoutTag}" />
|
||||
</target>
|
||||
|
||||
<target name="checkLocalMaps">
|
||||
<available property="skipMaps" file="${buildDirectory}/maps" />
|
||||
</target>
|
||||
|
||||
<target name="tagMapFiles" if="tagMaps">
|
||||
<cvs dest="${buildDirectory}/maps/${mapsRoot}" command="tag ${mapsTagTag}" />
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
|
||||
<target name="clean" unless="noclean">
|
||||
<antcall target="allElements">
|
||||
<param name="target" value="cleanElement" />
|
||||
</antcall>
|
||||
</target>
|
||||
|
||||
<target name="gatherLogs">
|
||||
<mkdir dir="${buildDirectory}/${buildLabel}/compilelogs" />
|
||||
<antcall target="allElements">
|
||||
<param name="target" value="gatherLogs" />
|
||||
</antcall>
|
||||
<unzip dest="${buildDirectory}/${buildLabel}/compilelogs" overwrite="true">
|
||||
<fileset dir="${buildDirectory}/features">
|
||||
<include name="**/*.log.zip" />
|
||||
</fileset>
|
||||
</unzip>
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do before setup -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="preSetup">
|
||||
<eclipse.generateFeature
|
||||
featureId="com.intel.sgx.build.driver"
|
||||
buildDirectory="${buildDirectory}"
|
||||
baseLocation="${baseLocation}"
|
||||
productFile="${product}"
|
||||
verify="false"
|
||||
pluginPath="${pluginPath}"
|
||||
configInfo="${configs}"
|
||||
pluginList="com.intel.sgx,com.intel.sgx.userguide"
|
||||
featureList="com.intel.sgx.feature"
|
||||
includeLaunchers="false"
|
||||
/>
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do after setup but before starting the build proper -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="postSetup">
|
||||
<antcall target="getBaseComponents" />
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do before fetching the build elements -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="preFetch">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do after fetching the build elements -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="postFetch">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do before the repositories are being processed -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="preProcessRepos">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do after the repositories have been processed -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="postProcessRepos">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do before generating the build scripts. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="preGenerate">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do after generating the build scripts. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="postGenerate">
|
||||
<antcall target="clean" />
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do before running the build.xmls for the elements being built. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="preProcess">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do after running the build.xmls for the elements being built. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="postProcess">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do before running assemble. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="preAssemble">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do after running assemble. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="postAssemble">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do before running package. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="prePackage">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do after running package. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="postPackage">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do after the build is done. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="postBuild">
|
||||
<antcall target="gatherLogs" />
|
||||
<!-- Added this custom target ! -->
|
||||
<antcall target="generateUpdateSite" />
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do to test the build results -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="test">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do to publish the build results -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="publish">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Default target -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="noDefault">
|
||||
<echo message="You must specify a target when invoking this file" />
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Custom target: -->
|
||||
<!-- 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 -->
|
||||
|
||||
<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>
|
||||
</target>
|
||||
|
||||
</project>
|
@ -0,0 +1,28 @@
|
||||
<?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.feature</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.FeatureBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.FeatureNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
@ -0,0 +1,15 @@
|
||||
#########################################################################
|
||||
# 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 #
|
||||
#########################################################################
|
||||
|
||||
bin.includes = feature.xml,\
|
||||
build.properties
|
||||
generate.plugin@com.intel.sgx.source = com.intel.sgx.feature
|
@ -0,0 +1,145 @@
|
||||
<?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 -->
|
||||
<!-- -->
|
||||
<feature
|
||||
id="com.intel.sgx.feature"
|
||||
label="Software Guard Extensions Plugin"
|
||||
version="1.0.1.qualifier"
|
||||
provider-name="INTEL">
|
||||
|
||||
<description url="http://fso-dev-machine.ed.intel.com">
|
||||
The Software Guard Extensions Plug-in enables Independent Service
|
||||
Vendors in developing Linux applications
|
||||
with Software Guard Extensions. The Plug-in extends the C/C++ Development
|
||||
tools Plug-in to allow ISVs develop secure extensions in C or
|
||||
C++. The Plug-in also allows conversion of an Linux Application
|
||||
project into an Linux Application project with Software Guard
|
||||
Extensions.
|
||||
Using the Plug-in features and SGX Plug-in Menu options, a developer
|
||||
can modify the Signing keys and Enclave Configuration for an
|
||||
Enclave project and can add enclaves inside a project with SGX Nature.
|
||||
Once development is complete, the developer can build the Enclave
|
||||
and the Linux project using the SGX SDK for Linux with Release/Debug Configurations in Simulation/Hardware
|
||||
mode and Hardware Prerelease mode.
|
||||
</description>
|
||||
|
||||
<copyright url="http://fso-dev-machine.ed.intel.com/copyright">
|
||||
All rights reserved with Intel Corporation and its Licensors.
|
||||
</copyright>
|
||||
|
||||
<license url="http://fso-dev-machine.ed.intel.com/license">
|
||||
Eclipse Public License - v 1.0
|
||||
|
||||
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
|
||||
|
||||
1. DEFINITIONS
|
||||
|
||||
"Contribution" means:
|
||||
|
||||
a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
|
||||
b) in the case of each subsequent Contributor:
|
||||
i) changes to the Program, and
|
||||
ii) additions to the Program;
|
||||
where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program.
|
||||
"Contributor" means any person or entity that distributes the Program.
|
||||
|
||||
"Licensed Patents" mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program.
|
||||
|
||||
"Program" means the Contributions distributed in accordance with this Agreement.
|
||||
|
||||
"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
|
||||
|
||||
2. GRANT OF RIGHTS
|
||||
|
||||
a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form.
|
||||
b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
|
||||
c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program.
|
||||
d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement.
|
||||
3. REQUIREMENTS
|
||||
|
||||
A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
|
||||
|
||||
a) it complies with the terms and conditions of this Agreement; and
|
||||
b) its license agreement:
|
||||
i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;
|
||||
ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits;
|
||||
iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and
|
||||
iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.
|
||||
When the Program is made available in source code form:
|
||||
|
||||
a) it must be made available under this Agreement; and
|
||||
b) a copy of this Agreement must be included with each copy of the Program.
|
||||
Contributors may not remove or alter any copyright notices contained within the Program.
|
||||
|
||||
Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution.
|
||||
|
||||
4. COMMERCIAL DISTRIBUTION
|
||||
|
||||
Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense.
|
||||
|
||||
For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages.
|
||||
|
||||
5. NO WARRANTY
|
||||
|
||||
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
|
||||
|
||||
6. DISCLAIMER OF LIABILITY
|
||||
|
||||
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), 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 OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
7. GENERAL
|
||||
|
||||
If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
|
||||
|
||||
If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed.
|
||||
|
||||
All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive.
|
||||
|
||||
Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
|
||||
|
||||
This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.
|
||||
</license>
|
||||
|
||||
<url>
|
||||
<update label="Software Guard Extensions Eclipse Plug-in" url="http://fso-dev-machine.rd.intel.com/sgx"/>
|
||||
</url>
|
||||
|
||||
<requires>
|
||||
<import plugin="org.eclipse.cdt.ui" version="5.11.0" match="compatible"/>
|
||||
<import plugin="org.eclipse.core.expressions" version="3.5.0" match="compatible"/>
|
||||
<import plugin="org.eclipse.ui.ide" version="3.11.0" match="compatible"/>
|
||||
<import plugin="org.eclipse.cdt.core" version="5.11.0" match="compatible"/>
|
||||
<import plugin="org.eclipse.core.runtime" version="3.11.1" match="compatible"/>
|
||||
<import plugin="org.eclipse.ui" version="3.107.0" match="compatible"/>
|
||||
<import plugin="org.eclipse.cdt.managedbuilder.ui" version="8.2.2" match="compatible"/>
|
||||
<import plugin="org.eclipse.cdt.managedbuilder.core" version="8.3.0" match="compatible"/>
|
||||
<import plugin="org.eclipse.core.resources" version="3.10.1" match="compatible"/>
|
||||
</requires>
|
||||
|
||||
<plugin
|
||||
id="com.intel.sgx"
|
||||
os="win32,x86_64,linux"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="com.intel.sgx.userguide"
|
||||
os="win32,x86_64,linux"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
|
||||
</feature>
|
@ -0,0 +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>
|
@ -0,0 +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>
|
@ -0,0 +1,11 @@
|
||||
License: Eclipse Public License Version 1.0 ("EPL")
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: SGX Eclipse Plugin Userguide
|
||||
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,
|
||||
org.eclipse.core.runtime
|
||||
Bundle-ActivationPolicy: lazy
|
@ -0,0 +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
|
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 31 KiB |
After Width: | Height: | Size: 116 KiB |
After Width: | Height: | Size: 143 KiB |
After Width: | Height: | Size: 29 KiB |
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 51 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 106 KiB |
After Width: | Height: | Size: 81 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 53 KiB |
After Width: | Height: | Size: 81 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 29 KiB |
After Width: | Height: | Size: 120 KiB |
After Width: | Height: | Size: 41 KiB |
After Width: | Height: | Size: 31 KiB |
After Width: | Height: | Size: 171 KiB |
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 60 KiB |
After Width: | Height: | Size: 44 KiB |
After Width: | Height: | Size: 55 KiB |
After Width: | Height: | Size: 54 KiB |
@ -0,0 +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;
|
||||
}
|
||||
|
@ -0,0 +1,557 @@
|
||||
<?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
|
||||
|
||||
|
||||
-->
|
||||
<html xmlns:MadCap='http://www.madcapsoftware.com/Schemas/MadCap.xsd' MadCap:lastBlockDepth='4' MadCap:lastHeight='1043' MadCap:lastWidth='652'>
|
||||
<head>
|
||||
<link href='Resources/Stylesheets/intel_css_styles.css' rel='stylesheet' type='text/css' />
|
||||
</head>
|
||||
<body>
|
||||
<div id='SGX_title'>
|
||||
<h1 class="firsttitle">Intel(R) Software Guard Extensions Plug-in for Eclipse*</h1>
|
||||
<h2>Developer Guide</h2>
|
||||
<p>Intel(R) Software Guard Extensions (Intel(R) SGX) is an Intel technology for application developers seeking to protect select code and data from disclosure or
|
||||
modification. Intel(R) SGX makes such protections possible through the use of
|
||||
enclaves. Enclaves are protected areas of execution. Application code can be put
|
||||
into an enclave through special instructions and software made available to
|
||||
developers by the Intel(R) SGX SDK.</p>
|
||||
<p><a href="#Legal_Information">Legal Information</a>
|
||||
</p>
|
||||
</div>
|
||||
<div id='Legal_Information'>
|
||||
<h1>Legal Information</h1>
|
||||
<p>No license (express or implied, by estoppel or otherwise) to any intellectual
|
||||
property rights is granted by this document.</p>
|
||||
<p>Intel disclaims all express and implied warranties, including without
|
||||
limitation, the implied warranties of merchantability, fitness for a particular
|
||||
purpose, and non-infringement, as well as any warranty arising from course
|
||||
of performance, course of dealing, or usage in trade.</p>
|
||||
<p>This document contains information on products, services and/or processes
|
||||
in development.  All information provided here is subject to change
|
||||
without notice. Contact your Intel representative to obtain the latest
|
||||
forecast, schedule, specifications and roadmaps.</p>
|
||||
<p>The products and services described may contain defects or errors known
|
||||
as errata which may cause deviations from published specifications. Current
|
||||
characterized errata are available on request.</p>
|
||||
<p>Intel technologies features and benefits depend on system configuration
|
||||
and may require enabled hardware, software or service activation. Learn
|
||||
more at Intel.com, or from the OEM or retailer.</p>
|
||||
<p>Copies of documents which have an order number and are referenced in
|
||||
this document may be obtained by calling 1-800-548-4725 or by visiting
|
||||
<a href="http://www.intel.com/design/literature.htm">www.intel.com/design/literature.htm</a>.</p>
|
||||
<p>Intel, the Intel logo, Xeon, and Xeon Phi are trademarks of Intel Corporation
|
||||
in the U.S. and/or other countries. </p>
|
||||
<table style="border-left-style: solid;border-left-width: 1px;border-right-style: solid;border-right-width: 1px;border-top-style: solid;border-top-width: 1px;border-bottom-style: solid;border-bottom-width: 1px;">
|
||||
<col />
|
||||
<tr>
|
||||
<th>
|
||||
<p>Optimization Notice</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr bgcolor="#CCECFF">
|
||||
<td>
|
||||
<p>Intel's compilers may or may not optimize to the same degree
|
||||
for non-Intel microprocessors for optimizations that are not unique
|
||||
to Intel microprocessors. These optimizations include SSE2, SSE3,
|
||||
and SSSE3 instruction sets and other optimizations. Intel does
|
||||
not guarantee the availability, functionality, or effectiveness
|
||||
of any optimization on microprocessors not manufactured by Intel.
|
||||
Microprocessor-dependent optimizations in this product are intended
|
||||
for use with Intel microprocessors. Certain optimizations not
|
||||
specific to Intel microarchitecture are reserved for Intel microprocessors.
|
||||
Please refer to the applicable product User and Reference Guides
|
||||
for more information regarding the specific instruction sets covered
|
||||
by this notice.</p>
|
||||
<p style="text-align: right;">Notice revision #20110804</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>* Other names and brands may be claimed as the property of others.</p>
|
||||
<p>© 2016 Intel Corporation.</p>
|
||||
</div>
|
||||
<div id='Introduction'>
|
||||
<h1>Introduction</h1>
|
||||
<p>This <i>Developer Guide</i> is intended for use by Independent Service Vendors who wish to harden their Linux* applications using Intel(R) SGX Technology, code named Intel(R) Software Guard Extensions. The guide describes the procedure for installation of Intel(R) SGX Plugin for Eclipse* IDE and development of Intel(R) SGX components using the plugin. The Intel(R) SGX Plugin for Eclipse leverages on the Intel(R) Software Guard Extensions SDK, which is a collection of APIs, libraries and tools that enable you to develop, build and debug Intel(R) SGX applications in C/C++.</p>
|
||||
<p>To learn more about the Intel(R) Software Guard Extensions SDK, see the <i>Intel(R) Software Guard Extensions SDK for Linux* OS Developer Reference</i>.</p> </div>
|
||||
<div id='Introducing_Intel_Software_Guard _Extensions_Eclipse_Plugin'>
|
||||
<h2>Introducing Intel(R) Software Guard Extensions</h2>
|
||||
<p>Intel(R) Software Guard Extensions is a new Intel technology, whose objective is to enable a high level of protection of secrets. It operates by allocating hardware-protected memory where code and data reside. The protected memory area within an application process is called an enclave. Data within the enclave memory can only be accessed by code that resides within that enclave. Enclave code can be invoked by special instructions.</p>
|
||||
<p>An enclave can be built and loaded as a shared object.</p>
|
||||
<p>Throughout this document, Intel(R) SGX refers to Intel(R) Software Guard Extensions.</p>
|
||||
<p>An Intel(R) SGX application design is different from the design of non- Intel(R) SGX application as it specifies dividing the application into two logical parts:</p>
|
||||
<ul>
|
||||
<li><i>Trusted</i> part. The code that accesses the secret resides here and it is called an enclave. More than one enclave can exist in an application.</li>
|
||||
<li><i>Untrusted</i> part. This includes the rest of the modules in the application, that is outside in an enclave.</li>
|
||||
</ul>
|
||||
<p>The trusted components and untrusted components are developed as separate modules.</p>
|
||||
<p>The trusted part or the enclave is implemented in C or C++. It is supplied as a collection of functions and data packaged in the form of a dynamically loaded library, a DLL in Windows* OS and a shared object in Linux* OS. It may be supplied either as a pre-built signed library or as a signed shared library built during compilation of the untrusted component.</p>
|
||||
<p>Enclave functions within an enclave library are wrapped by auto-generated proxy and bridge functions that simplify the mechanism of using the Intel(R) SGX technology by developers.</p>
|
||||
<p>The role of these functions is to handle the following tasks:</p>
|
||||
<ul>
|
||||
<li>Call an enclave function from untrusted code, also called an ECALL (enclave call).</li>
|
||||
<li>Call an untrusted function from within an enclave, also called an OCALL (outside call).</li>
|
||||
<li>Handle interrupts.</li>
|
||||
<li>Handle exceptions.</li>
|
||||
</ul>
|
||||
<p>The proxy and bridge functions are generated by the <code>sgx_edger8r</code> tool provided by Intel(R) SGX SDK. It reads an <i>edl</i> file (Enclave Descriptor Language) which describes the functions that form the <i>trusted</i> and <i>untrusted</i> component boundaries within the application.</p>
|
||||
<p>After the enclave is built, a signed version of it is created using the tool <code>sgx_sign</code> also provided by Intel(R) SGX SDK. It is this signed version may be loaded and executed in the encrypted memory.</p>
|
||||
<p>Enclaves may have some specific properties which are added as meta-information during the signing process. The meta-information is stored in one configuration xml file per enclave. See more details about meta-information in <i>Intel(R) Software Guard Extensions SDK for Linux* OS Developer Reference</i>.</p>
|
||||
</div>
|
||||
<div id='Introducing_Intel_Software_Guard_Extensions'>
|
||||
<h2>Introducing Intel(R) Software Guard Extensions Eclipse* Plug-in</h2>
|
||||
<p>The Intel(R) Software Guard Extensions Eclipse* Plug-in helps the enclave developer to maintain enclaves and untrusted related code inside Eclipse* C/C++ projects. To use this support, add SGX nature to the C/C++ project. See <a href="#Adding_SGX_Nature_to_a_Project">Adding SGX Nature to a Project</a> for details.</p>
|
||||
<p>Once the SGX nature is added to a project, you will have access to the SGX commands. SGX nature adds also a folder called <code>sgx</code> to the root of the project, and a Makefile inside it. All resources of the project managed by Intel(R) Software Guard Extensions Eclipse Plug-inare located inside this directory. You can build and run enclaves related code using GNU* Make tool through the Makefile.</p>
|
||||
<p>The plugin is generating minimal but ready-to-work code skeletons, complete with their own Makefile having all the required make targets as to call <code>sgx_edger8r</code> tool to generate the proxies and bridges, compile these source, generate a shared object and finally, to sign the enclave with the <code>sgx_sign</code> tool. This provide a starting point you may build upon.</p>
|
||||
</div>
|
||||
<div id='Getting_Started'>
|
||||
<h1>Getting Started with Intel(R) Software Guard Extensions Eclipse* Plug-in</h1>
|
||||
<p>This section contains steps to set up your Intel(R) Software Guard Extensions Eclipse* Plug-in on a Linux* system, including necessary softwares, steps to install the product, and steps to configure your preferred product directory.</p>
|
||||
<p>• Pre-requisites</p>
|
||||
<p>• Installing Intel(R) Software Guard Extensions Eclipse* Plug-in</p>
|
||||
<p>• Configuring Intel(R) Software Guard Extensions Eclipse* Plug-in</p> </div>
|
||||
<div id='Prerequisites'>
|
||||
<h2>Pre-requisites</h2>
|
||||
<p>To use Intel(R) Software Guard Extensions Eclipse Plug-in, install the following softwares:</p>
|
||||
<ul>
|
||||
<li>Eclipse* Mars 1 with CDT IDE for C/C++ Developpers (version 4.5.1). To use this version, install Java* Development Kit (JDK) or Java* Runtime Environment (JRE) version 1.8 or above.</li>
|
||||
<li>gcc/g++ tools</li>
|
||||
<li>Openssl*</li>
|
||||
<li>Intel(R) SGX SDK for Linux* OS</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id='Installing_Intel_Software_Guard_Extensions_Eclipse_Plugin'>
|
||||
<h2>Installing Intel(R) Software Guard Extensions Eclipse* Plug-in</h2>
|
||||
<p>Install Intel(R) Software Guard Extensions Eclipse* Plug-in as a regular Eclipse Plugin:</p>
|
||||
<ol>
|
||||
<li>Download the zip archive of Intel(R) Software Guard Extensions Eclipse Plug-in from Intel Site</li>
|
||||
<li>
|
||||
<p>Go to <b>Help menu -> Install New Software</b>. Click the <b>Add</b> button for the <b>Work with</b> field to open the <b>Add Repository</b> dialog as shown in the following graphic:</p>
|
||||
<p>
|
||||
<img src="Resources/Images/Add_Repository_Dialog.png" />
|
||||
</p>
|
||||
<p class="figcap">Add Repository Dialog</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Enter <code>SGX Archive</code> in the <b>Name</b> field . Click the <b>Archive...</b> button and select the location of the downloaded archive as shown in the following graphic:</p>
|
||||
<p>
|
||||
<img src="Resources/Images/The_Location_of_the_Plugin_zip_Archive.png" />
|
||||
</p>
|
||||
<p class="figcap">The Location of the Plugin zip Archive</p>
|
||||
</li>
|
||||
<li>Press <b>OK</b> to add the archive as a repository.</li>
|
||||
<li>In the <b>Install</b> dialog, select the <b>Software Guard Extensions Plugin</b> check-box and proceed with the usual steps.</li>
|
||||
</ol>
|
||||
</div>
|
||||
<div id='Configuring_Intel_Software_Guard_Extensions_Eclipse_Plug-in'>
|
||||
<h2>Configuring Intel(R) Software Guard Extensions Eclipse* Plug-in</h2>
|
||||
<p>If you do not install Intel(R) SGX SDK for Linux* OS in the default location, you need to specify the path for Intel SGX SDK using the following steps:</p>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Go to <b>Window menu ->Preferences</b>. Enter SGX in the filter text field to quickly locate the <b>SGX Preferences</b> page.</p>
|
||||
<p>
|
||||
<img src="Resources/Images/SGX_Preference_Page.png" />
|
||||
</p>
|
||||
<p class="figcap">SGX Preference Page</p>
|
||||
</li>
|
||||
<li>Enter the path for Intel SGX SDK for Linux OS in the <b>SGX SDK Directory</b> field.</li>
|
||||
</ol>
|
||||
</div>
|
||||
<div id='Command_Reference'>
|
||||
<h1>Command Reference</h1>
|
||||
<p>This topic provides the command reference for the following scenarios of using Intel(R) Software Guard Extensions Eclipse* Plug-in:</p>
|
||||
<ul>
|
||||
<li>Adding SGX nature to a project</li>
|
||||
<li>Adding an SGX enclave</li>
|
||||
<li>Adding an SGX trusted library</li>
|
||||
<li>Adding an SGX untrusted module</li>
|
||||
<li>Updating SGX enclave signing key</li>
|
||||
<li>Updating enclave configuration files</li>
|
||||
<li>Two steps sign enclave</li>
|
||||
</ul>
|
||||
<p>All commands brought by Intel(R) Software Guard Extensions Eclipse Plug-in are available by right-clicking on the Project root in Project explorer view in menu <b>Software Guard Extension Tools</b>:</p> <p><img src="Resources/Images/Project_Explorer.png" /></p><p class="figcap">Project Explorer</p> </div>
|
||||
<div id='Adding_SGX_Nature_to_a_Project'>
|
||||
<h2>Adding SGX Nature to a Project</h2>
|
||||
<p>The <i>nature</i> of an Eclipse project is a concept defined by an Eclipse Platform which allows a plug-in to tag a project as a specific kind of project. Intel(R) Software Guard Extensions uses an <i>SGX nature</i> to add SGX-specific behavior to projects. Project natures are defined by plug-ins, and are typically added or removed per-project when the user performs some action defined by the plug-in.</p>
|
||||
<p>To use Intel(R) Software Guard Extensions Eclipse Plug-in in your project, you need to add SGX nature to it. You may either add SGX nature to a pre-existing C/C++ project or create a project with SGX nature from start. See <a href="#Adding_SGX_Nature_to_a_non_SGX_project">Adding SGX Nature to a non-SGX project</a> and <a href="#Creating_a_New_C_C_Project_with_SGX_Nature">Creating a New C/C++ Project with SGX Nature</a> for how to complete these tasks.</p>
|
||||
</div>
|
||||
<div id='Adding_SGX_Nature_to_a_non_SGX_project'>
|
||||
<h3>Adding SGX Nature to a non-SGX project</h3>
|
||||
<p>When you have a C/C++ project created without Intel SGX, you cannot use Intel SGX support. In this case, you need to add SGX nature to this project to use Intel SGX support:</p>
|
||||
<ol>
|
||||
<li>Right-click on the project root <![CDATA[ ]]></li>
|
||||
<li>
|
||||
<p>Select <b>Software Guard Extension Tools → Add SGX Nature</b></p>
|
||||
<p>
|
||||
<img src="Resources/Images/Add_SGX_Nature.png" />
|
||||
</p>
|
||||
<p class="figcap">Add SGX Nature</p>
|
||||
</li>
|
||||
</ol>
|
||||
<p>After you add the SGX nature to your project, you should see:</p>
|
||||
<ul>
|
||||
<li>
|
||||
<p>A subdirectory <code>sgx</code> in the project which contains a Makefile file.</p>
|
||||
<p>
|
||||
<img src="Resources/Images/Makefile_for_Intel_SGX.png" />
|
||||
</p>
|
||||
<p class="figcap">Makefile for Intel(R) SGX</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>The Intel SGX tools as shown in the following graphic:</p>
|
||||
<p>
|
||||
<img src="Resources/Images/Intel_SGX_Tools.png" />
|
||||
</p>
|
||||
<p class="figcap">Intel(R) SGX Tools</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>New configurations specific to SGX technology. You may see the configurations for the project by clicking to the down arrow of button <img src="Resources/Images/Down_Arrow_Button.png" /> usually found at the top of the Eclipse window:</p>
|
||||
<p>
|
||||
<img src="Resources/Images/Configurations_Specific_to_Intel_SGX_Technology.png" />
|
||||
</p>
|
||||
<p class="figcap">Configurations Specific to Intel(R) SGX Technology</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id='Creating_a_New_C_C_Project_with_SGX_Nature'>
|
||||
<h3>Creating a New C/C++ Project with SGX Nature</h3>
|
||||
<p>You can create a new project with SGX nature. To create such a project, follow these steps:</p>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Open a standard Eclipse new project: <b>File menu → Project...</b> . If you have installed Intel® Software Guard Extensions Eclipse Plug-in, you can see the category C/C++ with SGX Enabled in the <b>New Project</b> dialog.</p>
|
||||
<p>
|
||||
<img src="Resources/Images/New_Project.png" />
|
||||
</p>
|
||||
<p class="figcap">New Project</p>
|
||||
<p>This category has 2 sub-categories, <b>SGX C project</b> and <b>SGX C++ project</b>. These sub-categories are similar to the sub-categories C Project and C++ Project of standard C/C++ category.</p>
|
||||
</li>
|
||||
<li>Select one of the 2 sub-categories, SGX C project or SGX C++ project, and click <b>Next</b>.</li>
|
||||
<li>Complete creating the project using the regular process of creating a standard C or C++ project.</li>
|
||||
</ol>
|
||||
<div class="NoteCont">
|
||||
<p class="NoteTipHead">NOTE:</p>
|
||||
<p>Projects created following the subcategories under <b>C/C++ with SGX Enabled</b> are identical with their standard counterparts, except that they have SGX Nature added. There is no difference between creating a C or C++ project with SGX enabled, or creating a standard C/C++ project and launch <b>Add SGX nature</b> from it, as described in precedent paragraph.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div id='Adding_an_SGX_Enclave'>
|
||||
<h2>Adding an SGX Enclave</h2>
|
||||
<p>After you add the SGX nature to a project, you can start creating a minimal but complete skeleton for a new enclave:</p>
|
||||
<ol>
|
||||
<li>Right-click on the project root in <b>Project Explorer</b>.</li>
|
||||
<li>
|
||||
<p>Open the dialog <b>Add New SGX Enclave</b> by selecting <b>Software Guard Extensions Tools → Add SGX Enclave</b> from the contextual menu.</p>
|
||||
<p>
|
||||
<img src="Resources/Images/Add_New_Intel_SGX_Enclave_Dialog.png" />
|
||||
</p>
|
||||
<p class="figcap">Add New Intel® SGX Enclave Dialog</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Choose a name for the enclave in <b>Enclave name</b> field. This name is used in the process of generation of the skeleton to give unicity to the source files and the name of the resulting executable, so you can add more than one enclave to the same project.</p>
|
||||
<ul>
|
||||
<li>
|
||||
<p>If you do not select the <b>Generate sample untrusted application</b> checkbox, the plugin generates only a trusted file and a Makefile fragment to build and compile the trusted part. See the following graphic. All the code for the enclave, including build Makefile, is put in a directory <code><root>/sgx/enclave_<name></code> . C/C++ code for the enclave proper are in <code><root>/sgx/enclave_<name>/trusted</code>.</p>
|
||||
<p>
|
||||
<img src="Resources/Images/Generated_Skeleton_for_an_Enclave.png" />
|
||||
</p>
|
||||
<p class="figcap">Generated Skeleton for an Enclave. The option to Generate Sample was not Used</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>If you select <b>Generate sample untrusted application</b> checkbox, a simple ready to work sample application is generated, including untrusted stubs and implementation for a sample OCALL and ECALL.</p>
|
||||
<p>
|
||||
<img src="Resources/Images/Generated_Sample_Untrusted_Application.png" />
|
||||
</p>
|
||||
<p class="figcap">Generated Sample Untrusted Application</p>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ol>
|
||||
<div class="NoteCont">
|
||||
<p class="NoteTipHead">NOTE:</p>
|
||||
<p>If you select the <b>Generate sample untrusted application</b> checkbox, ecalls from the untrusted part are not be resolved by Eclipse C/C++ indexer. These functions are marked with a red line. The declaration of these ecalls resides in the unstrusted stub header which is generated during the build proces and is not indexed by Eclipse. To resolve this problem, right-click on project root and select <b>Index → Freshen All Files</b>.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div id='Adding_an_SGX_Trusted_Library'>
|
||||
<h2>Adding an SGX Trusted Library</h2>
|
||||
<p>Trusted Static Libraries helps enclave author have libraries of shared code to be reused by enclaves, in exactly the same manner as usual static <code>libxxx.a</code> libraries are used to share code between regular non-SGX applications. The plugin adds a command to generate the skeleton of a trusted shared library.</p>
|
||||
<p>To add a new SGX Trusted Library:</p>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Open <b>Add New SGX Static Trusted Library</b> dialog by right-click on the root of the project and select the appropriate command from <b>Software Guard Extensions Tools</b> menu:</p>
|
||||
<p>
|
||||
<img src="Resources/Images/Add_New_SGX_Static_Trusted_Library_Dialog.png" />
|
||||
</p>
|
||||
<p class="figcap">Add New SGX Static Trusted Library Dialog</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Choose a name for the library and click <b>OK</b>. A skeleton for a trusted library is generated in directory <code><root>/sgx/trustedlib_<name></code>:</p>
|
||||
<p>
|
||||
<img src="Resources/Images/A_Generated_Trusted_Library.png" />
|
||||
</p>
|
||||
<p class="figcap">A Generated Trusted Library</p>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
<div id='Adding_an_SGX_Untrusted_Module'>
|
||||
<h2>Adding an SGX Untrusted Module</h2>
|
||||
<p>Add an untrusted module to generate the untrusted stubs so you use an enclave, provided you have access to its <code>.edl</code> file. The enclave might have been built in the current project or in a different project.</p>
|
||||
<p>To use trusted functionality of an enclave for which its <code>*.edl</code> is known, use the command <b>Add SGX Untrusted Module</b>:</p>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Open dialog <b>Add Sgx Untrusted Module</b> by right-click-ing the project root in <b>Package Explorer</b> and chose the command from <b>Software Guard Extension Tools</b>.</p>
|
||||
<p>
|
||||
<img src="Resources/Images/Add_SGX_Untrusted_Module.png" />
|
||||
</p>
|
||||
<p class="figcap">Add SGX Untrusted Module</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Use the <b>Browse</b> button to navigate the file system using a file dialog, and click <b>OK</b>. The untrusted module is copied to <code><root>/sgx/untrusted_<edl file name></code>. The selected <code>*.edl</code> is copied to the project.</p>
|
||||
<p>
|
||||
<img src="Resources/Images/Copying_the_Untrusted_Module_to_a_Project.png" />
|
||||
</p>
|
||||
<p class="figcap">Copying the Untrusted Module to a Project</p>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
<div id='Updating_SGX_Enclave_Signing_Key'>
|
||||
<h2>Updating SGX Enclave Signing Key</h2>
|
||||
<p>All skeletons enclave samples produced by the plugin contain a sample signing key. You might want to import another sign key that you already have, or generate a new one. Use the command <b>Update SGX Enclave Signing Key</b> to complete this task.</p>
|
||||
<ol>
|
||||
<li>Choose <b>Update SGX Enclave Signing Key</b> by right-click on the project in <b>Project Explorer -> Software Guard Extension Tools</b> menu. The <b>Import or (Re)Generate Enclave Signing Key</b> dialog appears.</li>
|
||||
<li>In the <b>Import or (Re)Generate Enclave Signing Key</b> dialog, click <b>Select</b> to open a file dialog to select the output key.</li>
|
||||
<li>
|
||||
<p>Click <b>Improt Key</b> to update a selected signing key by copying another existing key or click <b>Generate Key</b> to update the selected signing key by generating a new key. In both cases, the new signature key is put into the file in text field <b>Enclave Signing Key</b>.</p>
|
||||
<p>
|
||||
<img src="Resources/Images/Import_or_Re_Generate_Enclave_Signing_Key.png" />
|
||||
</p>
|
||||
<p class="figcap">Import or (Re)Generate Enclave Signing Key</p>
|
||||
</li>
|
||||
<li>Click <b>OK</b> to update the enclave signing key.</li>
|
||||
</ol>
|
||||
<p>Under the hood, a new key is generated using openssl*, which needs to be installed on the machine:</p>
|
||||
<p><code>openssl genrsa -out ../../../encl1_private.pem.key.pem -3 3072</code>
|
||||
</p>
|
||||
<p><![CDATA[ ]]></p>
|
||||
</div>
|
||||
<div id='Updating_Enclave_Configuration_Files'>
|
||||
<h2>Updating Enclave Configuration Files</h2>
|
||||
<p>A configuration file is an important part in the definition of an enclave. Intel(R) SGX SDK signer tool requires such *.xml configuration file as necessary input.</p>
|
||||
<p>To update this configuration file, use the <b>Update Config</b> command:</p>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Right-click on the root project, <b>Software Extension Guards Tools->Select Config File</b>.</p>
|
||||
<p>
|
||||
<img src="Resources/Images/Select_Configuration_File.png" />
|
||||
</p>
|
||||
<p class="figcap">Select Configuration File</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Click <b>OK</b> or double-click the selected configuration file to open the <b>Enclave Configuration Settings</b> dialog.</p>
|
||||
<p>
|
||||
<img src="Resources/Images/Enclave_Configuration_Settings.png" />
|
||||
</p>
|
||||
<p class="figcap">Enclave Configuration Settings</p>
|
||||
<p>For details on the meaning of the fields, see <i>Intel(R) Software Guard Extensions Developer Guide</i>.</p>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
<div id='Two_Steps_Sign_Enclave'>
|
||||
<h2>Two Steps Sign Enclave</h2>
|
||||
<p>To help you develop enclaves, Intel(R) Software Guard Extensions Eclipse Plug-in generates all required structure including:</p>
|
||||
<ul>
|
||||
<li>c/c++ files and header files</li>
|
||||
<li><code>.edl</code> file</li>
|
||||
<li><code>*.config.xml</code> file</li>
|
||||
<li>a sample Makefile</li>
|
||||
<li>a sample signing key</li>
|
||||
</ul>
|
||||
<p>While these structure might be appropriate for development and debugging, you need a 2-step process to integrate your own signing schema for generating production enclaves.</p>
|
||||
<ol>
|
||||
<li>Generate hash: the signer tool generates signing material from the unsigned compiled enclave and from the configuration file for the enclave. The signed material comes as an opaque sequence of bytes which are put in a file with extension <code>.hex</code>. This file is used with the external signing facility. You come back with a signature for the <code>.hex</code> file plus the public key of your signing facility, and proceed to Step 2.</li>
|
||||
<li>Generate signed enclaves : the signer tool generates the final signed enclave.</li>
|
||||
</ol>
|
||||
<p>To complete this task, provide the following input parameters:</p>
|
||||
<ul>
|
||||
<li>The unsigned enclave</li>
|
||||
<li>The configuration file</li>
|
||||
<li>The output file produced when you generate hash (the <code>.hex</code> file)</li>
|
||||
<li>The files produced by the external signing facility: the signature of the .hex file and public key for it</li>
|
||||
<li>The plugin checks if the input parameters are consistent:</li>
|
||||
<li>The <code>.hex</code> file matches the unsigned enclave and the configuration file,</li>
|
||||
<li>The signed material is verified with the public key</li>
|
||||
</ul>
|
||||
<p>If the parameters are consistenet, the production signed enclave is produced.</p>
|
||||
<div class="NoteCont">
|
||||
<p class="NoteTipHead">NOTE:</p>
|
||||
<p>If you generate signed enclave right after generating hash, you can only enter the parameters specific for generating signed enclave.</p>
|
||||
</div>
|
||||
<p>To use the two-step signing function, activate the configuration <b>SGX Hardware Release mode</b>. When this configuration is active, the compilation does not produce a signed enclave, as in the other SGX configurations; the process only produces unsigned enclaves.</p>
|
||||
<p>
|
||||
<img src="Resources/Images/Configure_SGX_Hardware_Release_Mode.png" />
|
||||
</p>
|
||||
<p class="figcap">Configure SGX Hardware Release Mode</p>
|
||||
<p>When you configure the plugin in the <b>SGX Hardware Release Mode</b>, you can see the <b>Generate Hash</b> and <b>Generate Signed Enclave</b> options through <b>Software Guard Extension Tools->Two Step Sign Enclave</b>.</p>
|
||||
<p>
|
||||
<img src="Resources/Images/Two_Step_Sign_Enclave_Menu.png" />
|
||||
</p>
|
||||
<p class="figcap">Two Step Sign Enclave Menu</p>
|
||||
</div>
|
||||
<div id='Generate_Hash'>
|
||||
<h3>Generate Hash</h3>
|
||||
<p>Generating hash is the first step in the 2-Steps signing process.To generate hash, use the following steps:</p>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Right-click on project root, go to <b>Software Guard Extensions Tools menu → Two StepSigne Enclave → Generate Hash</b></p>
|
||||
<p>
|
||||
<img src="Resources/Images/Two_StepSigne_Enclave_Generate_Hash.png" />
|
||||
</p>
|
||||
<p class="figcap">Two StepSigne Enclave - Generate Hash</p>
|
||||
</li>
|
||||
<li> In the <b>Generate Hash</b> dialog, enter the required inputs to the corresponding fields:<ul><li>Enter the path to the compiled enclave to be signed in the <b>Enclave Path</b> field. Click <b>Select Enclave</b> to open a file dialog to select the enclave.</li><li>In the <b>Hash File Location</b> field , enter the path of the output file that will contain signing materials. By default this file has the same file name as the unsigned enclave, with <code>.hex</code> extension added. To change the path, click <b>Select File Path</b> to open a file dialog to select the file path.</li><li>In the <b>Configuration File</b> path field, enter the path of the configuration filefor the generated hash. Click <b>Select Config</b> to open a dialog to select from all enclave configuration files in the project (similar with the one of the command <b>Update Config</b>).</li></ul></li>
|
||||
<li>
|
||||
<p>Click <b>OK</b> after you fill in all the fields. The Intel(R) SGX SDK is launched under the hood with the provided parameters and the hash file is generated. A dialog box appears to confirm the completion:</p>
|
||||
<p>
|
||||
<img src="Resources/Images/Generating_Hash_Completion_Dialog.png" />
|
||||
</p>
|
||||
<p class="figcap">Generating Hash Completion Dialog</p>
|
||||
</li>
|
||||
</ol>
|
||||
<p>You complete the first step, generating hash, in the two step signing enclave. The <code>*.hex</code> file may be signed with the external facility, which generates a signature for it and a public verification key.</p>
|
||||
<p>If you click <b>OK</b>, the <b>Generate Signed Enclave</b> dialog appears. The required fileds in this dialog have been pre-configured with the paths of the unsigned enclave, the configuration file and of the <code>*.hex</code> file. To generated the final signed enclave ready for production immediately, click <b>OK</b>.</p>
|
||||
<p>
|
||||
<img src="Resources/Images/Generate_Signed_Enclave_Dialog_with_Pre_configurations.png" />
|
||||
</p>
|
||||
<p class="figcap">Generate Signed Enclave Dialog with Pre-configurations</p>
|
||||
<p>If you click <b>Cancel</b> in the <b>Generate Signed Enclave</b> dialog, you can continue the signing process later using the <b>Generate Signed Enclave</b> command.</p>
|
||||
</div>
|
||||
<div id='Generate_Signed_Enclaves'>
|
||||
<h3>Generate Signed Enclaves</h3>
|
||||
<p>Generating signed enclave is the second step in the 2-Steps signing process. You should have the following files to complete this step:</p>
|
||||
<ul>
|
||||
<li>The <code>.hex</code> file generated with <b>Generate Hash</b> command</li>
|
||||
<li>The files produced from the external signing facility</li>
|
||||
<li>The signature of the <code>.hex</code> file</li>
|
||||
<li>The public verification key</li>
|
||||
</ul>
|
||||
<p>To generate signed encalves, use the following steps:</p>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Right-click on the project root, and go to <b>Software Guard Extensions Tools menu → Two Step Sign Enclave → Generate Signed Enclave</b>.</p>
|
||||
<p>
|
||||
<img src="Resources/Images/Generate_Signed_Enclave_Dialog.png" />
|
||||
</p>
|
||||
<p>Generate Signed Enclave Dialog</p>
|
||||
</li>
|
||||
<li>Enter the inputs to all the fields and click <b>OK</b>.</li>
|
||||
</ol>
|
||||
</div>
|
||||
<div id='Building_and_Running_SGX_Code'>
|
||||
<h1>Building and Running SGX Code</h1>
|
||||
<p>This section describes the following topics about building and running SGX code:</p>
|
||||
<ul>
|
||||
<li>SGX build configurations</li>
|
||||
<li>Running samples generated for enclaves</li>
|
||||
</ul> </div>
|
||||
<div id='SGX_Build_Configurations'>
|
||||
<h2>SGX Build Configurations</h2>
|
||||
<p>There are usually two types of builds that a regular non-SGX project defines:</p>
|
||||
<ul>
|
||||
<li>Debug</li>
|
||||
<li>Release</li>
|
||||
</ul>
|
||||
<p>SGX-enabled projects add to this picture support to build and test SGX-enabled application on non-SGX platforms (or emulator) using simulation libraries. This approach doubles the set of build types, creating four possible combinations. For these combinations, you need to use different sets of compilation and linking flags and link different libraries.</p>
|
||||
<p>The non-debug hardware build is meant to give production code, so it requires the maximum attention when signed. The Two Steps Sign schema is required for production enclaves, which involves an external signing facility, not part of Intel SGX SDK. The other configurations are not meant for production but they have to be signed too. The simplest and more convenient Single Step schema is used for them.</p>
|
||||
<p>Again for testing purpose, you might want to experiment with a non-production enclave built with release compilation and linking flags, on a real hardware SGX-enabled platform. That would be an enclave built exactly as a production enclave, except for the sign process which would be Single Step. To support the construction of such enclave, there is a hardware non-debug build configuration dubbed <i>Prerelease</i>.</p>
|
||||
<p>So there are five SGX related configurations when SGX Nature is added to a project:</p>
|
||||
<p>
|
||||
<img src="Resources/Images/Intel_SGX_Configurations.png" />
|
||||
</p>
|
||||
<p>Intel(R) SGX Configurations</p>
|
||||
<p>The following table resumes the existing SGX configurations and relate them with compilation/linking flags (debug/non-debug) and signing scheme (single vs. two steps):</p>
|
||||
<p class="tablecap">Intel(R) SGX Configurations</p>
|
||||
<table style="width: 100%;border-left-style: solid;border-left-width: 1px;border-right-style: solid;border-right-width: 1px;border-top-style: solid;border-top-width: 1px;border-bottom-style: solid;border-bottom-width: 1px;">
|
||||
<col />
|
||||
<col />
|
||||
<col />
|
||||
<col />
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Configuration Name</th>
|
||||
<th>Simulation?</th>
|
||||
<th>Debug?</th>
|
||||
<th>Signing Schema</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SGX Hardware Debug</td>
|
||||
<td>Hardware</td>
|
||||
<td>Debug</td>
|
||||
<td>Single Step</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SGX Hardware Pre-release</td>
|
||||
<td>Hardware</td>
|
||||
<td>Non-debug</td>
|
||||
<td>Single Step</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SGX Hardware Release</td>
|
||||
<td>Hardware</td>
|
||||
<td>Non-debug</td>
|
||||
<td>Two Step</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SGX Simulation</td>
|
||||
<td>Simulation</td>
|
||||
<td>Non-debug</td>
|
||||
<td>Single Step</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SGX Simulation</td>
|
||||
<td>Debug Simulation</td>
|
||||
<td>Debug</td>
|
||||
<td>Single step</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>Intel® Software Guard Extensions Eclipse Plug-in uses standard GNU* make tool to build the trusted and the untrusted code, using the generated file <code>sgx/Makefile</code>.</p>
|
||||
<p>This fact does not impose any restriction on the build tool chosen for the hosting project. Intel® Software Guard Extensions Eclipse* Plug-in uses its own build configurations which do not interfere with the configurations that you might have in your project.</p>
|
||||
<p>When SGX configurations are selected, by default only code under <code><root>/sgx</code> directory get built.</p>
|
||||
<p>You can customize SGX configurations as any other Eclipse build configurations from the project properties dialog. For example:</p>
|
||||
<ol>
|
||||
<li>Right-click in Project Explorer Properties → C/C++ Build</li>
|
||||
<li>Uncheck the Use default build command checkbox.</li>
|
||||
</ol>
|
||||
<p>Then you can customize and integrate SGX build process. You can use Makefile instead of <code>sgx/Makefile</code> in the example shown in the following figure:</p>
|
||||
<p>
|
||||
<img src="Resources/Images/Customization_of_SGX_build_command.png" />
|
||||
</p>
|
||||
<p class="figcap">Customization of SGX Build Command </p>
|
||||
<p>The build process is done using standard Eclipse interface for build, by example from the main <b>Project</b> menu: </p>
|
||||
<p>
|
||||
<img src="Resources/Images/Project_Menu.png" />
|
||||
</p>
|
||||
<p class="figcap">Project Menu </p>
|
||||
</div>
|
||||
<div id='Running_Samples_Generated_for_Enclaves'>
|
||||
<h2>Running Samples Generated for Enclaves</h2>
|
||||
<p>Intel(R) Software Guard Extensions Eclipse* Plugin provides an option to generate a sample application together with the enclave code when the enclave is created. After the project is build, the sample application is built also and ready to run. You can see the sample application named sample in the enclave directory in Project Explorer. You can run this sample as a local C/C++ application as shown in the following figure:</p>
|
||||
<p>
|
||||
<img src="Resources/Images/Sample_Application.png" />
|
||||
</p>
|
||||
<p class="figcap">Sample Application</p>
|
||||
<p>See the result of the execution in Eclipse console window as shown below:</p>
|
||||
<p>
|
||||
<img src="Resources/Images/The_Result_of_Running_Samples_Generated_for_Enclaves.png" />
|
||||
</p>
|
||||
<p class="figcap">The Result of Running Samples Generated for Enclaves</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +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>
|
@ -0,0 +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);
|
||||
}
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
<?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
|
||||
|
||||
|
||||
-->
|
||||
<toc href='html/content.html#SGX_title' label='Intel(R) SGX Plugin Developer Guide'>
|
||||
<topic label='Legal Information' href='html/content.html#Legal_Information' />
|
||||
<topic label='Introduction' href='html/content.html#Introduction'>
|
||||
<topic label='Introducing Intel(R) SGX' href='html/content.html#Introducing_Intel_Software_Guard _Extensions_Eclipse_Plugin' />
|
||||
<topic label='Introducing Intel(R) SGX Plug-in' href='html/content.html#Introducing_Intel_Software_Guard_Extensions' />
|
||||
</topic>
|
||||
<topic label='Getting Started with Intel(R) SGX Plug-in' href='html/content.html#Getting_Started'>
|
||||
<topic label='Pre-requisites' href='html/content.html#Prerequisites' />
|
||||
<topic label='Installing Intel(R) SGX Plug-in' href='html/content.html#Installing_Intel_Software_Guard_Extensions_Eclipse_Plugin' />
|
||||
<topic label='Configuring Intel(R) SGX Plug-in' href='html/content.html#Configuring_Intel_Software_Guard_Extensions_Eclipse_Plug-in' />
|
||||
</topic>
|
||||
<topic label='Command Reference' href='html/content.html#Command_Reference'>
|
||||
<topic label='Adding SGX Nature to a Project' href='html/content.html#Adding_SGX_Nature_to_a_Project'>
|
||||
<topic label='Adding SGX Nature to a non-SGX project' href='html/content.html#Adding_SGX_Nature_to_a_non_SGX_project' />
|
||||
<topic label='Creating a New C/C++ Project with SGX Nature' href='html/content.html#Creating_a_New_C_C_Project_with_SGX_Nature' />
|
||||
</topic>
|
||||
<topic label='Adding an SGX Enclave' href='html/content.html#Adding_an_SGX_Enclave' />
|
||||
<topic label='Adding an SGX Trusted Library' href='html/content.html#Adding_an_SGX_Trusted_Library' />
|
||||
<topic label='Adding an SGX Untrusted Module' href='html/content.html#Adding_an_SGX_Untrusted_Module' />
|
||||
<topic label='Updating SGX Enclave Signing Key' href='html/content.html#Updating_SGX_Enclave_Signing_Key' />
|
||||
<topic label='Updating Enclave Configuration Files' href='html/content.html#Updating_Enclave_Configuration_Files' />
|
||||
<topic label='Two Steps Sign Enclave' href='html/content.html#Two_Steps_Sign_Enclave'>
|
||||
<topic label='Generate Hash' href='html/content.html#Generate_Hash' />
|
||||
<topic label='Generate Signed Enclaves' href='html/content.html#Generate_Signed_Enclaves' />
|
||||
</topic>
|
||||
</topic>
|
||||
<topic label='Building and Running SGX Code' href='html/content.html#Building_and_Running_SGX_Code'>
|
||||
<topic label='SGX Build Configurations' href='html/content.html#SGX_Build_Configurations' />
|
||||
<topic label='Running Samples Generated for Enclaves' href='html/content.html#Running_Samples_Generated_for_Enclaves' />
|
||||
</topic>
|
||||
</toc>
|
@ -0,0 +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.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
@ -0,0 +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</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>
|
@ -0,0 +1,12 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
@ -0,0 +1,26 @@
|
||||
License: Eclipse Public License Version 1.0 ("EPL")
|
||||
bundle-ManifestVersion: 2
|
||||
Bundle-Name: %Bundle-Name
|
||||
Bundle-SymbolicName: com.intel.sgx;singleton:=true
|
||||
Bundle-Version: 1.0.1.qualifier
|
||||
Bundle-Activator: com.intel.sgx.Activator
|
||||
Bundle-Vendor: %Bundle-Vendor
|
||||
Require-Bundle: org.eclipse.cdt.core;bundle-version="5.11.0",
|
||||
org.eclipse.core.runtime;bundle-version="3.11.1",
|
||||
org.eclipse.ui;bundle-version="3.107.0",
|
||||
org.eclipse.cdt.managedbuilder.ui;bundle-version="8.2.2",
|
||||
org.eclipse.cdt.managedbuilder.core;bundle-version="8.3.0",
|
||||
org.eclipse.core.resources;bundle-version="3.10.1",
|
||||
org.eclipse.cdt.ui;bundle-version="5.11.0",
|
||||
org.eclipse.core.expressions;bundle-version="3.5.0",
|
||||
org.eclipse.ui.ide;bundle-version="3.11.0"
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Export-Package: com.intel.sgx,
|
||||
com.intel.sgx.build,
|
||||
com.intel.sgx.dialogs,
|
||||
com.intel.sgx.discovery,
|
||||
com.intel.sgx.handlers,
|
||||
com.intel.sgx.natures,
|
||||
com.intel.sgx.preferences,
|
||||
com.intel.sgx.templates
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
@ -0,0 +1,15 @@
|
||||
#########################################################################
|
||||
# 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 #
|
||||
#########################################################################
|
||||
|
||||
|
||||
Bundle-Vendor = Intel Corporation
|
||||
Bundle-Name = SGX(R) Linux Eclipse Plugin
|
@ -0,0 +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
|
@ -0,0 +1,2 @@
|
||||
|
||||
|
@ -0,0 +1,2 @@
|
||||
|
||||
|
@ -0,0 +1,786 @@
|
||||
<?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 id="com.intel.sgx.sgxbuilderdefinitions" name="Software Guard Extensions Builder Definition"
|
||||
point="org.eclipse.cdt.managedbuilder.core.buildDefinitions">
|
||||
<toolChain configurationEnvironmentSupplier="com.linux.ide.eclipse.ndk.internal.build.NdkEnvSupplier"
|
||||
id="com.intel.sgx.SGXtoolChain" isAbstract="false" name="SGX GCC"
|
||||
supportsManagedBuild="false">
|
||||
<builder cleanBuildTarget="clean" command="make"
|
||||
commandLauncher="com.intel.sgx.build.SGXSDKCommandLauncher" id="com.intel.sgx.sgxbuilder"
|
||||
isAbstract="false" isVariableCaseSensitive="false"
|
||||
name="Software Guard Extensions Linux Builder">
|
||||
</builder>
|
||||
<targetPlatform binaryParser="org.eclipse.cdt.core.ELF"
|
||||
id="com.intel.sgx.targetEnclave" isAbstract="false">
|
||||
</targetPlatform>
|
||||
<tool id="com.intel.sgx.compiler" isAbstract="false" name="SGX GCC Compiler"
|
||||
natureFilter="both">
|
||||
<option browseType="directory" id="com.intel.sgx.option.includePath"
|
||||
isAbstract="false" resourceFilter="all" valueType="includePath">
|
||||
</option>
|
||||
<inputType id="com.intel.sgx.inputType"
|
||||
scannerConfigDiscoveryProfileId="com.intel.sgx.SGXPerProjectProfile"
|
||||
sources="c,cpp">
|
||||
</inputType>
|
||||
</tool>
|
||||
</toolChain>
|
||||
|
||||
|
||||
|
||||
<configuration id="com.intel.sgx.configuration.Sim.Debug" name="SGX Simulation Debug">
|
||||
<toolChain id="com.intel.sgx.toolChain.Sim.Debug" isAbstract="false"
|
||||
name="SGX GCC" superClass="com.intel.sgx.SGXtoolChain">
|
||||
<builder arguments="SGX_DEBUG=1 SGX_MODE=SIM -f sgx/Makefile" command="make"
|
||||
id="com.intel.sgx.builder2" isAbstract="false"
|
||||
isVariableCaseSensitive="false" name="Software Guard Extensions Linux Builder"
|
||||
superClass="com.intel.sgx.sgxbuilder">
|
||||
</builder>
|
||||
</toolChain>
|
||||
</configuration>
|
||||
|
||||
<configuration id="com.intel.sgx.configuration.HW.Debug" name="SGX Hardware Debug">
|
||||
<toolChain id="com.intel.sgx.toolChain.HW.Debug" isAbstract="false"
|
||||
name="SGX GCC" superClass="com.intel.sgx.SGXtoolChain">
|
||||
<builder arguments="SGX_DEBUG=1 SGX_MODE=HW -f sgx/Makefile" command="make"
|
||||
id="com.intel.sgx.builder1" isAbstract="false"
|
||||
isVariableCaseSensitive="false" name="Software Guard Extensions Linux Builder"
|
||||
superClass="com.intel.sgx.sgxbuilder">
|
||||
</builder>
|
||||
</toolChain>
|
||||
</configuration>
|
||||
|
||||
<configuration id="com.intel.sgx.configuration.Sim.Release" name="SGX Simulation">
|
||||
<toolChain id="com.intel.sgx.toolChain.Sim.Release" isAbstract="false"
|
||||
name="SGX GCC" superClass="com.intel.sgx.SGXtoolChain">
|
||||
<builder arguments="SGX_DEBUG=0 SGX_MODE=SIM -f sgx/Makefile" command="make"
|
||||
id="com.intel.sgx.builder3" isAbstract="false"
|
||||
isVariableCaseSensitive="false" name="Software Guard Extensions Linux Builder"
|
||||
superClass="com.intel.sgx.sgxbuilder">
|
||||
</builder>
|
||||
</toolChain>
|
||||
</configuration>
|
||||
|
||||
<configuration id="com.intel.sgx.configuration.HW.Prerelease" name="SGX Hardware Prerelease">
|
||||
<toolChain id="com.intel.sgx.toolChain.HW.Prerelease" isAbstract="false"
|
||||
name="SGX GCC" superClass="com.intel.sgx.SGXtoolChain">
|
||||
<builder arguments="SGX_PRERELEASE=1 SGX_MODE=HW -f sgx/Makefile" command="make"
|
||||
id="com.intel.sgx.builder5" isAbstract="false"
|
||||
isVariableCaseSensitive="false" name="Software Guard Extensions Linux Builder"
|
||||
superClass="com.intel.sgx.sgxbuilder">
|
||||
</builder>
|
||||
</toolChain>
|
||||
</configuration>
|
||||
|
||||
<configuration id="com.intel.sgx.configuration.HW.Release" name="SGX Hardware Release">
|
||||
<toolChain id="com.intel.sgx.toolChain.HW.Release" isAbstract="false"
|
||||
name="SGX GCC" superClass="com.intel.sgx.SGXtoolChain">
|
||||
<builder arguments="SGX_DEBUG=0 SGX_MODE=HW -f sgx/Makefile" command="make"
|
||||
id="com.intel.sgx.builder6" isAbstract="false"
|
||||
isVariableCaseSensitive="false" name="Software Guard Extensions Linux Builder"
|
||||
superClass="com.intel.sgx.sgxbuilder">
|
||||
</builder>
|
||||
</toolChain>
|
||||
</configuration>
|
||||
|
||||
</extension>
|
||||
<extension id="com.intel.sgx.SGXPerProjectProfile" name="SGX Per Project Profile"
|
||||
point="org.eclipse.cdt.make.core.ScannerConfigurationDiscoveryProfile">
|
||||
<scannerInfoCollector
|
||||
class="com.intel.sgx.discovery.SGXSDKScannerInfoCollector" scope="project">
|
||||
</scannerInfoCollector>
|
||||
</extension>
|
||||
<extension id="com.intel.sgx.commands" name="SGX Commands"
|
||||
point="org.eclipse.ui.commands">
|
||||
<category id="com.intel.sgx.category.enclaveIF" name="SGX Untrusted Enclave Interface">
|
||||
</category>
|
||||
<category id="com.intel.sgx.category.trustedIF" name="SGX Trusted Enclave Interface">
|
||||
</category>
|
||||
<command categoryId="com.intel.sgx.category.enclaveIF" id="com.intel.sgx.command.addEnclave"
|
||||
name="Add SGX Enclave">
|
||||
<commandParameter id="com.intel.sgx.commandParameter3"
|
||||
name="name" optional="true">
|
||||
</commandParameter>
|
||||
</command>
|
||||
<command categoryId="com.intel.sgx.category.enclaveIF" id="com.intel.sgx.command.addTrustedStaticLib"
|
||||
name="Add SGX Trusted Static Library">
|
||||
<commandParameter id="com.intel.sgx.commandParameter3"
|
||||
name="name" optional="true">
|
||||
</commandParameter>
|
||||
</command>
|
||||
<command categoryId="com.intel.sgx.category.enclaveIF" id="com.intel.sgx.command.removeEnclave"
|
||||
name="Remove SGX Enclave">
|
||||
</command>
|
||||
<command categoryId="com.intel.sgx.category.enclaveIF" id="com.intel.sgx.command.addUntrustedModule"
|
||||
name="Add SGX Untrusted Module">
|
||||
</command>
|
||||
<command categoryId="com.intel.sgx.category.enclaveIF" id="com.intel.sgx.command.addSGXNature"
|
||||
name="Add SGX Nature">
|
||||
</command>
|
||||
<command categoryId="com.intel.sgx.category.enclaveIF" id="com.intel.sgx.command.updateSigningKey"
|
||||
name="Update SGX Enclave Signing Key">
|
||||
</command>
|
||||
<command categoryId="com.intel.sgx.category.enclaveIF"
|
||||
id="com.intel.sgx.command.enclaveConfigHandler" name="Update Config">
|
||||
</command>
|
||||
<command categoryId="com.intel.sgx.category.enclaveIF"
|
||||
id="com.intel.sgx.command.twoStepSignStep1" name="Generate Hash">
|
||||
</command>
|
||||
<command categoryId="com.intel.sgx.category.enclaveIF"
|
||||
id="com.intel.sgx.command.twoStepSignStep2" name="Generate Signed Enclave">
|
||||
</command>
|
||||
</extension>
|
||||
<extension point="org.eclipse.ui.menus">
|
||||
<menuContribution allPopups="false"
|
||||
locationURI="popup:org.eclipse.ui.popup.any?after=additions">
|
||||
<menu label="Software Guard Extension Tools">
|
||||
<visibleWhen checkEnabled="false">
|
||||
<with variable="selection">
|
||||
<test property="com.intel.sgx.testers.sgxNatureAdded"
|
||||
value="true"
|
||||
forcePluginActivation="true"
|
||||
/>
|
||||
</with>
|
||||
</visibleWhen>
|
||||
<command commandId="com.intel.sgx.command.addSGXNature"
|
||||
style="push">
|
||||
<visibleWhen checkEnabled="false">
|
||||
<with variable="selection">
|
||||
<iterate operator="or">
|
||||
<adapt type="org.eclipse.core.resources.IProject">
|
||||
<not>
|
||||
<test property="org.eclipse.core.resources.projectNature"
|
||||
value="com.intel.sgx.sgxnature">
|
||||
</test>
|
||||
</not>
|
||||
<test property="org.eclipse.core.resources.projectNature"
|
||||
value="org.eclipse.cdt.core.cnature">
|
||||
</test>
|
||||
</adapt>
|
||||
</iterate>
|
||||
</with>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
<command commandId="com.intel.sgx.command.addEnclave" style="push">
|
||||
<visibleWhen checkEnabled="false">
|
||||
<with variable="selection">
|
||||
<iterate operator="or">
|
||||
<adapt type="org.eclipse.core.resources.IProject">
|
||||
<test property="org.eclipse.core.resources.projectNature"
|
||||
value="com.intel.sgx.sgxnature">
|
||||
</test>
|
||||
</adapt>
|
||||
</iterate>
|
||||
</with>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
<command commandId="com.intel.sgx.command.addTrustedStaticLib" style="push">
|
||||
<visibleWhen checkEnabled="false">
|
||||
<with variable="selection">
|
||||
<iterate operator="or">
|
||||
<adapt type="org.eclipse.core.resources.IProject">
|
||||
<test property="org.eclipse.core.resources.projectNature"
|
||||
value="com.intel.sgx.sgxnature">
|
||||
</test>
|
||||
</adapt>
|
||||
</iterate>
|
||||
</with>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
<command commandId="com.intel.sgx.command.addUntrustedModule" style="push">
|
||||
<visibleWhen checkEnabled="false">
|
||||
<with variable="selection">
|
||||
<iterate operator="or">
|
||||
<adapt type="org.eclipse.core.resources.IProject">
|
||||
<test property="org.eclipse.core.resources.projectNature"
|
||||
value="com.intel.sgx.sgxnature">
|
||||
</test>
|
||||
</adapt>
|
||||
</iterate>
|
||||
</with>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
<command commandId="com.intel.sgx.command.updateSigningKey"
|
||||
style="push">
|
||||
<visibleWhen checkEnabled="false">
|
||||
<with variable="selection">
|
||||
<iterate operator="or">
|
||||
<adapt type="org.eclipse.core.resources.IProject">
|
||||
<test property="org.eclipse.core.resources.projectNature"
|
||||
value="com.intel.sgx.sgxnature">
|
||||
</test>
|
||||
</adapt>
|
||||
</iterate>
|
||||
</with>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
|
||||
<command commandId="com.intel.sgx.command.enclaveConfigHandler"
|
||||
style="push">
|
||||
<visibleWhen checkEnabled="false">
|
||||
<with variable="selection">
|
||||
<iterate operator="or">
|
||||
<adapt type="org.eclipse.core.resources.IProject">
|
||||
<test property="org.eclipse.core.resources.projectNature"
|
||||
value="com.intel.sgx.sgxnature">
|
||||
</test>
|
||||
</adapt>
|
||||
</iterate>
|
||||
</with>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
|
||||
<menu label="Two Step Sign Enclave">
|
||||
<visibleWhen checkEnabled="false">
|
||||
<with variable="selection">
|
||||
<test property="com.intel.sgx.testers.twoStepsActive"
|
||||
value="true"
|
||||
forcePluginActivation="true"
|
||||
/>
|
||||
</with>
|
||||
</visibleWhen>
|
||||
<command commandId="com.intel.sgx.command.twoStepSignStep1"
|
||||
style="push">
|
||||
<!-- <visibleWhen checkEnabled="false"> -->
|
||||
<!-- <with variable="selection"> -->
|
||||
<!-- <iterate operator="or"> -->
|
||||
<!-- <adapt type="org.eclipse.core.resources.IProject"> -->
|
||||
<!-- <test property="org.eclipse.core.resources.projectNature" -->
|
||||
<!-- value="com.intel.sgx.sgxccnature"> -->
|
||||
<!-- </test> -->
|
||||
<!-- </adapt> -->
|
||||
<!-- </iterate> -->
|
||||
<!-- </with> -->
|
||||
<!-- </visibleWhen> -->
|
||||
</command>
|
||||
<command commandId="com.intel.sgx.command.twoStepSignStep2"
|
||||
style="push">
|
||||
<!-- <visibleWhen checkEnabled="false"> -->
|
||||
<!-- <with variable="selection"> -->
|
||||
<!-- <iterate operator="or"> -->
|
||||
<!-- <adapt type="org.eclipse.core.resources.IProject"> -->
|
||||
<!-- <test property="org.eclipse.core.resources.projectNature" -->
|
||||
<!-- value="com.intel.sgx.sgxccnature"> -->
|
||||
<!-- </test> -->
|
||||
<!-- </adapt> -->
|
||||
<!-- </iterate> -->
|
||||
<!-- </with> -->
|
||||
<!-- </visibleWhen> -->
|
||||
</command>
|
||||
</menu>
|
||||
|
||||
</menu>
|
||||
<menu label="Software Guard Extension Options">
|
||||
<visibleWhen checkEnabled="false">
|
||||
<with variable="selection">
|
||||
<iterate ifEmpty="false" operator="or">
|
||||
<adapt type="org.eclipse.core.resources.IProject">
|
||||
<test property="org.eclipse.core.resources.projectNature"
|
||||
value="com.intel.sgx.sgxccnature">
|
||||
</test>
|
||||
</adapt>
|
||||
</iterate>
|
||||
</with>
|
||||
</visibleWhen>
|
||||
<command commandId="com.intel.sgx.command.updateSigningKey"
|
||||
style="push">
|
||||
<visibleWhen checkEnabled="false">
|
||||
<with variable="selection">
|
||||
<iterate operator="or">
|
||||
<adapt type="org.eclipse.core.resources.IProject">
|
||||
<test property="org.eclipse.core.resources.projectNature"
|
||||
value="com.intel.sgx.sgxccnature">
|
||||
</test>
|
||||
</adapt>
|
||||
</iterate>
|
||||
</with>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
<command commandId="com.intel.sgx.command.enclaveConfigHandler"
|
||||
style="push">
|
||||
<visibleWhen checkEnabled="false">
|
||||
<with variable="selection">
|
||||
<iterate operator="or">
|
||||
<adapt type="org.eclipse.core.resources.IProject">
|
||||
<test property="org.eclipse.core.resources.projectNature"
|
||||
value="com.intel.sgx.sgxccnature">
|
||||
</test>
|
||||
</adapt>
|
||||
</iterate>
|
||||
</with>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
<menu label="Two Step Sign Enclave">
|
||||
<visibleWhen checkEnabled="false">
|
||||
<with variable="selection">
|
||||
<iterate ifEmpty="false" operator="or">
|
||||
<adapt type="org.eclipse.core.resources.IProject">
|
||||
<test property="org.eclipse.core.resources.projectNature"
|
||||
value="com.intel.sgx.sgxccnature">
|
||||
</test>
|
||||
</adapt>
|
||||
</iterate>
|
||||
</with>
|
||||
</visibleWhen>
|
||||
<command commandId="com.intel.sgx.command.twoStepSignStep1"
|
||||
style="push">
|
||||
<visibleWhen checkEnabled="false">
|
||||
<with variable="selection">
|
||||
<iterate operator="or">
|
||||
<adapt type="org.eclipse.core.resources.IProject">
|
||||
<test property="org.eclipse.core.resources.projectNature"
|
||||
value="com.intel.sgx.sgxccnature">
|
||||
</test>
|
||||
</adapt>
|
||||
</iterate>
|
||||
</with>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
<command commandId="com.intel.sgx.command.twoStepSignStep2"
|
||||
style="push">
|
||||
<visibleWhen checkEnabled="false">
|
||||
<with variable="selection">
|
||||
<iterate operator="or">
|
||||
<adapt type="org.eclipse.core.resources.IProject">
|
||||
<test property="org.eclipse.core.resources.projectNature"
|
||||
value="com.intel.sgx.sgxnature">
|
||||
</test>
|
||||
</adapt>
|
||||
</iterate>
|
||||
</with>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
</menu>
|
||||
</menu>
|
||||
</menuContribution>
|
||||
</extension>
|
||||
<extension point="org.eclipse.ui.preferencePages">
|
||||
<page class="com.intel.sgx.preferences.SGXPreferencePage" id="com.intel.sgx.preferences.SGXPreferencePage"
|
||||
name="SGX Preferences">
|
||||
</page>
|
||||
</extension>
|
||||
<extension point="org.eclipse.core.runtime.preferences">
|
||||
<initializer class="com.intel.sgx.preferences.PreferenceInitializer">
|
||||
</initializer>
|
||||
</extension>
|
||||
<extension point="org.eclipse.ui.handlers">
|
||||
<handler class="com.intel.sgx.handlers.AddEnclave" commandId="com.intel.sgx.command.addEnclave">
|
||||
<activeWhen>
|
||||
<with variable="selection">
|
||||
<!--<iterate operator="or"> <adapt type="org.eclipse.core.resources.IProject">
|
||||
<and> <test property="org.eclipse.core.resources.projectNature" value="org.eclipse.cdt.core.cnature">
|
||||
</test> <test property="org.eclipse.core.resources.projectNature" value="com.linux.ide.eclipse.adt.LinuxNature">
|
||||
</test> </and> <test property="org.eclipse.core.resources.projectNature"
|
||||
value="com.intel.sgx.sgxnature"> </test> </adapt> </iterate> -->
|
||||
<iterate operator="or">
|
||||
<instanceof value="org.eclipse.core.resources.IProject">
|
||||
</instanceof>
|
||||
</iterate>
|
||||
</with>
|
||||
</activeWhen>
|
||||
<enabledWhen>
|
||||
<with variable="selection">
|
||||
<!--<iterate operator="or"> <adapt type="org.eclipse.core.resources.IProject">
|
||||
<and> <test property="org.eclipse.core.resources.projectNature" value="org.eclipse.cdt.core.cnature">
|
||||
</test> <test property="org.eclipse.core.resources.projectNature" value="com.linux.ide.eclipse.adt.LinuxNature">
|
||||
</test> </and> <test property="org.eclipse.core.resources.projectNature"
|
||||
value="com.intel.sgx.sgxnature"> </test> </adapt> </iterate> -->
|
||||
<iterate operator="or">
|
||||
<instanceof value="org.eclipse.core.resources.IProject">
|
||||
</instanceof>
|
||||
</iterate>
|
||||
</with>
|
||||
</enabledWhen>
|
||||
</handler>
|
||||
<handler class="com.intel.sgx.handlers.AddTrustedStaticLib" commandId="com.intel.sgx.command.addTrustedStaticLib">
|
||||
<activeWhen>
|
||||
<with variable="selection">
|
||||
<!--<iterate operator="or"> <adapt type="org.eclipse.core.resources.IProject">
|
||||
<and> <test property="org.eclipse.core.resources.projectNature" value="org.eclipse.cdt.core.cnature">
|
||||
</test> <test property="org.eclipse.core.resources.projectNature" value="com.linux.ide.eclipse.adt.LinuxNature">
|
||||
</test> </and> <test property="org.eclipse.core.resources.projectNature"
|
||||
value="com.intel.sgx.sgxnature"> </test> </adapt> </iterate> -->
|
||||
<iterate operator="or">
|
||||
<instanceof value="org.eclipse.core.resources.IProject">
|
||||
</instanceof>
|
||||
</iterate>
|
||||
</with>
|
||||
</activeWhen>
|
||||
<enabledWhen>
|
||||
<with variable="selection">
|
||||
<!--<iterate operator="or"> <adapt type="org.eclipse.core.resources.IProject">
|
||||
<and> <test property="org.eclipse.core.resources.projectNature" value="org.eclipse.cdt.core.cnature">
|
||||
</test> <test property="org.eclipse.core.resources.projectNature" value="com.linux.ide.eclipse.adt.LinuxNature">
|
||||
</test> </and> <test property="org.eclipse.core.resources.projectNature"
|
||||
value="com.intel.sgx.sgxnature"> </test> </adapt> </iterate> -->
|
||||
<iterate operator="or">
|
||||
<instanceof value="org.eclipse.core.resources.IProject">
|
||||
</instanceof>
|
||||
</iterate>
|
||||
</with>
|
||||
</enabledWhen>
|
||||
</handler>
|
||||
<handler class="com.intel.sgx.handlers.RemoveEnclave"
|
||||
commandId="com.intel.sgx.command.removeEnclave">
|
||||
<activeWhen>
|
||||
<with variable="selection">
|
||||
<!--<iterate operator="or"> <adapt type="org.eclipse.core.resources.IProject">
|
||||
<and> <test property="org.eclipse.core.resources.projectNature" value="org.eclipse.cdt.core.cnature">
|
||||
</test> <test property="org.eclipse.core.resources.projectNature" value="com.linux.ide.eclipse.adt.LinuxNature">
|
||||
</test> </and> <test property="org.eclipse.core.resources.projectNature"
|
||||
value="com.intel.sgx.sgxnature"> </test> </adapt> </iterate> -->
|
||||
<iterate operator="or">
|
||||
<instanceof value="org.eclipse.core.resources.IProject">
|
||||
</instanceof>
|
||||
</iterate>
|
||||
</with>
|
||||
</activeWhen>
|
||||
<enabledWhen>
|
||||
<with variable="selection">
|
||||
<!--<iterate operator="or"> <adapt type="org.eclipse.core.resources.IProject">
|
||||
<and> <test property="org.eclipse.core.resources.projectNature" value="org.eclipse.cdt.core.cnature">
|
||||
</test> <test property="org.eclipse.core.resources.projectNature" value="com.linux.ide.eclipse.adt.LinuxNature">
|
||||
</test> </and> <test property="org.eclipse.core.resources.projectNature"
|
||||
value="com.intel.sgx.sgxnature"> </test> </adapt> </iterate> -->
|
||||
<iterate operator="or">
|
||||
<instanceof value="org.eclipse.core.resources.IProject">
|
||||
</instanceof>
|
||||
</iterate>
|
||||
</with>
|
||||
</enabledWhen>
|
||||
</handler>
|
||||
<handler class="com.intel.sgx.handlers.AddUntrustedModule" commandId="com.intel.sgx.command.addUntrustedModule">
|
||||
<activeWhen>
|
||||
<with variable="selection">
|
||||
<!--<iterate operator="or"> <adapt type="org.eclipse.core.resources.IProject">
|
||||
<and> <test property="org.eclipse.core.resources.projectNature" value="org.eclipse.cdt.core.cnature">
|
||||
</test> <test property="org.eclipse.core.resources.projectNature" value="com.linux.ide.eclipse.adt.LinuxNature">
|
||||
</test> </and> <test property="org.eclipse.core.resources.projectNature"
|
||||
value="com.intel.sgx.sgxnature"> </test> </adapt> </iterate> -->
|
||||
<iterate operator="or">
|
||||
<instanceof value="org.eclipse.core.resources.IProject">
|
||||
</instanceof>
|
||||
</iterate>
|
||||
</with>
|
||||
</activeWhen>
|
||||
<enabledWhen>
|
||||
<with variable="selection">
|
||||
<!--<iterate operator="or"> <adapt type="org.eclipse.core.resources.IProject">
|
||||
<and> <test property="org.eclipse.core.resources.projectNature" value="org.eclipse.cdt.core.cnature">
|
||||
</test> <test property="org.eclipse.core.resources.projectNature" value="com.linux.ide.eclipse.adt.LinuxNature">
|
||||
</test> </and> <test property="org.eclipse.core.resources.projectNature"
|
||||
value="com.intel.sgx.sgxnature"> </test> </adapt> </iterate> -->
|
||||
<iterate operator="or">
|
||||
<instanceof value="org.eclipse.core.resources.IProject">
|
||||
</instanceof>
|
||||
</iterate>
|
||||
</with>
|
||||
</enabledWhen>
|
||||
</handler>
|
||||
<handler class="com.intel.sgx.handlers.AddSGXNature"
|
||||
commandId="com.intel.sgx.command.addSGXNature">
|
||||
<activeWhen>
|
||||
<with variable="selection">
|
||||
<iterate operator="or">
|
||||
<instanceof value="org.eclipse.core.resources.IProject">
|
||||
</instanceof>
|
||||
</iterate>
|
||||
</with>
|
||||
</activeWhen>
|
||||
<enabledWhen>
|
||||
<with variable="selection">
|
||||
<iterate operator="or">
|
||||
<instanceof value="org.eclipse.core.resources.IProject">
|
||||
</instanceof>
|
||||
</iterate>
|
||||
</with>
|
||||
</enabledWhen>
|
||||
</handler>
|
||||
<handler class="com.intel.sgx.handlers.UpdateSigningKey"
|
||||
commandId="com.intel.sgx.command.updateSigningKey">
|
||||
<activeWhen>
|
||||
<with variable="selection">
|
||||
<iterate operator="or">
|
||||
<adapt type="org.eclipse.core.resources.IProject">
|
||||
<and>
|
||||
<test property="org.eclipse.core.resources.projectNature"
|
||||
value="com.intel.sgx.sgxnature">
|
||||
</test>
|
||||
</and>
|
||||
</adapt>
|
||||
</iterate>
|
||||
</with>
|
||||
</activeWhen>
|
||||
<enabledWhen>
|
||||
<with variable="selection">
|
||||
<iterate operator="or">
|
||||
<adapt type="org.eclipse.core.resources.IProject">
|
||||
<and>
|
||||
<test property="org.eclipse.core.resources.projectNature"
|
||||
value="com.intel.sgx.sgxnature">
|
||||
</test>
|
||||
</and>
|
||||
</adapt>
|
||||
</iterate>
|
||||
</with>
|
||||
</enabledWhen>
|
||||
</handler>
|
||||
<handler class="com.intel.sgx.handlers.EnclaveConfigHandler"
|
||||
commandId="com.intel.sgx.command.enclaveConfigHandler">
|
||||
<activeWhen>
|
||||
<with variable="selection">
|
||||
<iterate operator="or">
|
||||
<adapt type="org.eclipse.core.resources.IProject">
|
||||
<and>
|
||||
<test property="org.eclipse.core.resources.projectNature"
|
||||
value="com.intel.sgx.sgxnature">
|
||||
</test>
|
||||
</and>
|
||||
</adapt>
|
||||
</iterate>
|
||||
</with>
|
||||
</activeWhen>
|
||||
<enabledWhen>
|
||||
<with variable="selection">
|
||||
<iterate operator="or">
|
||||
<adapt type="org.eclipse.core.resources.IProject">
|
||||
<and>
|
||||
<test property="org.eclipse.core.resources.projectNature"
|
||||
value="com.intel.sgx.sgxnature">
|
||||
</test>
|
||||
</and>
|
||||
</adapt>
|
||||
</iterate>
|
||||
</with>
|
||||
</enabledWhen>
|
||||
</handler>
|
||||
<handler class="com.intel.sgx.handlers.TwoStepSignStep1"
|
||||
commandId="com.intel.sgx.command.twoStepSignStep1">
|
||||
<activeWhen>
|
||||
<with variable="selection">
|
||||
<iterate operator="or">
|
||||
<adapt type="org.eclipse.core.resources.IProject">
|
||||
<and>
|
||||
<test property="org.eclipse.core.resources.projectNature"
|
||||
value="com.intel.sgx.sgxnature">
|
||||
</test>
|
||||
</and>
|
||||
</adapt>
|
||||
</iterate>
|
||||
</with>
|
||||
</activeWhen>
|
||||
<enabledWhen>
|
||||
<with variable="selection">
|
||||
<iterate operator="or">
|
||||
<adapt type="org.eclipse.core.resources.IProject">
|
||||
<and>
|
||||
<test property="org.eclipse.core.resources.projectNature"
|
||||
value="com.intel.sgx.sgxnature">
|
||||
</test>
|
||||
</and>
|
||||
</adapt>
|
||||
</iterate>
|
||||
</with>
|
||||
</enabledWhen>
|
||||
</handler>
|
||||
<handler class="com.intel.sgx.handlers.TwoStepSignStep2"
|
||||
commandId="com.intel.sgx.command.twoStepSignStep2">
|
||||
<activeWhen>
|
||||
<with variable="selection">
|
||||
<iterate operator="or">
|
||||
<adapt type="org.eclipse.core.resources.IProject">
|
||||
<and>
|
||||
<test property="org.eclipse.core.resources.projectNature"
|
||||
value="com.intel.sgx.sgxnature">
|
||||
</test>
|
||||
</and>
|
||||
</adapt>
|
||||
</iterate>
|
||||
</with>
|
||||
</activeWhen>
|
||||
<enabledWhen>
|
||||
<with variable="selection">
|
||||
<iterate operator="or">
|
||||
<adapt type="org.eclipse.core.resources.IProject">
|
||||
<and>
|
||||
<test property="org.eclipse.core.resources.projectNature"
|
||||
value="com.intel.sgx.sgxnature">
|
||||
</test>
|
||||
</and>
|
||||
</adapt>
|
||||
</iterate>
|
||||
</with>
|
||||
</enabledWhen>
|
||||
</handler>
|
||||
<!--<handler class="com.intel.sgx.handlers.RemoveSGXNature" commandId="com.intel.sgx.command.removeSGXNature">
|
||||
<activeWhen> <with variable="selection"> <iterate operator="or"> <instanceof
|
||||
value="org.eclipse.core.resources.IProject"> </instanceof> </iterate> </with>
|
||||
</activeWhen> <enabledWhen> <with variable="selection"> <iterate operator="or">
|
||||
<instanceof value="org.eclipse.core.resources.IProject"> </instanceof> </iterate>
|
||||
</with> </enabledWhen> </handler> -->
|
||||
</extension>
|
||||
<extension id="com.intel.sgx.templates" point="org.eclipse.cdt.core.templates">
|
||||
|
||||
<template id="com.intel.sgx.SGXEnclaveCWithSample" location="templates/SGXtemplates/c/with_sample/enclavetemplate.xml" projectType="none">
|
||||
</template>
|
||||
|
||||
<template id="com.intel.sgx.SGXEnclaveCMinimal" location="templates/SGXtemplates/c/minimal/enclavetemplate.xml" projectType="none">
|
||||
</template>
|
||||
|
||||
<template id="com.intel.sgx.SGXEnclaveC++WithSample" location="templates/SGXtemplates/c++/with_sample/enclavetemplate.xml" projectType="none">
|
||||
</template>
|
||||
|
||||
<template id="com.intel.sgx.SGXEnclaveC++Minimal" location="templates/SGXtemplates/c++/minimal/enclavetemplate.xml" projectType="none">
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
<template id="com.intel.sgx.SGXTrustedStaticCMinimal" location="templates/SGXtemplates/c/minimal/trustedstatictemplate.xml" projectType="none">
|
||||
</template>
|
||||
|
||||
<template id="com.intel.sgx.SGXTrustedStaticC++Minimal" location="templates/SGXtemplates/c++/minimal/trustedstatictemplate.xml" projectType="none">
|
||||
</template>
|
||||
|
||||
|
||||
<template
|
||||
id="com.intel.sgx.templates.HelloWorldCCProject"
|
||||
filterPattern=".*g.*"
|
||||
location="templates/SGXtemplates/ctemplate.xml"
|
||||
projectType="my.build.property"
|
||||
|
||||
>
|
||||
</template>
|
||||
|
||||
<template filterPattern=".*" id="com.intel.sgx.SGXCPPProject"
|
||||
isCategory="false" location="templates/SGXtemplates/cxxtemplate.xml"
|
||||
projectType="none"
|
||||
>
|
||||
</template>
|
||||
|
||||
|
||||
<template id="com.intel.sgx.SGXUntrustedModuleCMinimal" location="templates/SGXtemplates/c/minimal/untrusted_module_template.xml" projectType="none">
|
||||
</template>
|
||||
<template id="com.intel.sgx.SGXUntrustedModuleC++Minimal" location="templates/SGXtemplates/c++/minimal/untrusted_module_template.xml" projectType="none">
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
<template id="com.intel.sgx.AddSGXNature" location="templates/SGXtemplates/common/addnaturetemplate.xml"
|
||||
projectType="Software Guard Extensions Project">
|
||||
</template>
|
||||
|
||||
<template id="com.intel.sgx.SGXEnclaveConfig" location="templates/SGXtemplates/configtemplate.xml"
|
||||
projectType="none">
|
||||
</template>
|
||||
<!--<template id="com.intel.sgx.template1" isCategory="false" location="templates/template.xml"
|
||||
pagesAfterTemplateSelectionProvider="com.intel.sgx.handlers.templatepagesafter"
|
||||
projectType="com.intel.sgx.SGXProjectType"> </template> -->
|
||||
</extension>
|
||||
<extension point="org.eclipse.cdt.core.templateProcessTypes">
|
||||
<processType name="CreateNativeFolders"
|
||||
processRunner="com.intel.sgx.templates.CreateNativeFolders">
|
||||
<simple name="projectName">
|
||||
</simple>
|
||||
<simpleArray name="sourceFolders">
|
||||
</simpleArray>
|
||||
<simpleArray name="outputFolders">
|
||||
</simpleArray>
|
||||
</processType>
|
||||
<processType name="SetCCNature" processRunner="com.intel.sgx.templates.SetCCNature">
|
||||
<simple name="projectName" />
|
||||
</processType>
|
||||
<processType name="SetStaticCCNature" processRunner="com.intel.sgx.templates.SetStaticCCNature">
|
||||
<simple name="projectName" />
|
||||
</processType>
|
||||
</extension>
|
||||
<extension point="org.eclipse.core.resources.variableResolvers">
|
||||
<variableResolver class="com.intel.sgx.SdkPathVariableProvider"
|
||||
variable="SGXSdkDirPath">
|
||||
</variableResolver>
|
||||
</extension>
|
||||
<extension id="id2"
|
||||
point="org.eclipse.cdt.core.CConfigurationDataProvider">
|
||||
<provider class="com.intel.sgx.CConfigurationDataProvider2"
|
||||
natures="org.eclipse.cdt.core.cnature">
|
||||
</provider>
|
||||
</extension>
|
||||
<extension id="sgxnature" name="SGX Nature"
|
||||
point="org.eclipse.core.resources.natures">
|
||||
<runtime>
|
||||
<run class="com.intel.sgx.natures.SGXNature" />
|
||||
</runtime>
|
||||
</extension>
|
||||
<extension id="sgxccnature" name="SGX CCNature"
|
||||
point="org.eclipse.core.resources.natures">
|
||||
<runtime>
|
||||
<run class="com.intel.sgx.natures.SGXCCNature" />
|
||||
</runtime>
|
||||
</extension>
|
||||
<extension id="sgxstaticccnature" name="SGX StaticCCNature"
|
||||
point="org.eclipse.core.resources.natures">
|
||||
<runtime>
|
||||
<run class="com.intel.sgx.natures.SGXStaticCCNature" />
|
||||
</runtime>
|
||||
</extension>
|
||||
<extension point="org.eclipse.core.expressions.propertyTesters">
|
||||
<propertyTester class="com.intel.sgx.testers.SGXPropertyTester"
|
||||
id="com.intel.sgx.testers.SGXPropertyTester"
|
||||
properties="sgxNatureAdded,twoStepsActive"
|
||||
type="java.lang.Object"
|
||||
namespace="com.intel.sgx.testers"
|
||||
>
|
||||
</propertyTester>
|
||||
</extension>
|
||||
|
||||
|
||||
<extension point="org.eclipse.ui.newWizards">
|
||||
<category
|
||||
id = "com.intel.sgx.wizzards"
|
||||
|
||||
name="C/C++ projects with SGX Enabled">
|
||||
</category>
|
||||
|
||||
<wizard
|
||||
canFinishEarly="false"
|
||||
category="com.intel.sgx.wizzards"
|
||||
class="com.intel.sgx.wizards.SGXCProjectWizard"
|
||||
finalPerspective="org.eclipse.cdt.ui.CPerspective"
|
||||
hasPages="true"
|
||||
icon="templates/newmngc_app.gif"
|
||||
id="com.intel.sgx.wizards.SGXCProjectWizard"
|
||||
name="C Project"
|
||||
project="true">
|
||||
<description>
|
||||
An C project, with SGX Commands and Configurations
|
||||
</description>
|
||||
</wizard>
|
||||
|
||||
<wizard
|
||||
canFinishEarly="false"
|
||||
category="com.intel.sgx.wizzards"
|
||||
class="com.intel.sgx.wizards.SGXCCProjectWizard"
|
||||
finalPerspective="org.eclipse.cdt.ui.CPerspective"
|
||||
hasPages="true"
|
||||
id="com.intel.sgx.wizards.SGXCDProjectWizard"
|
||||
icon="templates/newmngcc_app.gif"
|
||||
name="C++ Project"
|
||||
project="true">
|
||||
<description>
|
||||
An C++ project, with SGX Commands and Configurations
|
||||
</description>
|
||||
</wizard>
|
||||
|
||||
</extension>
|
||||
|
||||
</plugin>
|
@ -0,0 +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;
|
||||
}
|
||||
}
|
@ -0,0 +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) {
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 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.osgi.util.NLS;
|
||||
|
||||
public class Messages extends NLS {
|
||||
|
||||
private static final String BUNDLE_NAME = "com.intel.sgx.messages";//$NON-NLS-1$
|
||||
|
||||
/*
|
||||
* TODO - These Strings can be used all through the package to control what messages are displayed.
|
||||
* Todo here is to identify any message that needs to be made configurable.
|
||||
*/
|
||||
public static String CreateNativeFolders_No_folders;
|
||||
public static String CreateNativeFolders_Missing_project_name;
|
||||
public static String CreateNativeFolders_Project_does_not_exist;
|
||||
|
||||
static{
|
||||
//Bundle initialization.
|
||||
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
|
||||
}
|
||||
|
||||
private Messages(){
|
||||
}
|
||||
}
|
@ -0,0 +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();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +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);
|
||||
}
|
||||
}
|
@ -0,0 +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 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();
|
||||
}
|
||||
}
|
@ -0,0 +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 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();
|
||||
}
|
||||
}
|
@ -0,0 +1,138 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 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 java.io.File;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import org.eclipse.jface.dialogs.Dialog;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.events.SelectionListener;
|
||||
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.FileDialog;
|
||||
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.AddUntrustedModule;
|
||||
|
||||
public class AddUntrustedModuleDialog extends Dialog {
|
||||
|
||||
private Text fileNameField,makeFilePathField;
|
||||
private Shell shell;
|
||||
private AddUntrustedModule addHandler;
|
||||
private boolean generateApp = false;
|
||||
|
||||
public AddUntrustedModuleDialog(Shell shell, AddUntrustedModule 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);
|
||||
|
||||
final Label messageLabel = new Label(container, SWT.NONE);
|
||||
messageLabel.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 3, 1));
|
||||
messageLabel.setText("Enter the path to the Enclave Descriptor file (*.edl) of the enclave to host.");
|
||||
|
||||
|
||||
final Label fileNameLabel = new Label(container, SWT.NONE);
|
||||
fileNameLabel.setText("Filename:");
|
||||
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);
|
||||
|
||||
final Button browseButton = new Button(container, SWT.PUSH);
|
||||
browseButton.setText("Browse");
|
||||
GridData buttonGridData1 = new GridData(GridData.END);
|
||||
buttonGridData1.horizontalAlignment = SWT.RIGHT;
|
||||
buttonGridData1.horizontalSpan = 1;
|
||||
buttonGridData1.minimumWidth = 120;
|
||||
browseButton.setLayoutData(buttonGridData1);
|
||||
browseButton.addSelectionListener(new SelectionListener() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
String result = null;
|
||||
shell = new Shell();
|
||||
FileDialog dialog = new FileDialog(shell, SWT.OPEN);
|
||||
dialog.setFilterExtensions(new String [] {"*.edl"});
|
||||
dialog.setFilterPath("");
|
||||
result = dialog.open();
|
||||
fileNameField.setText(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void widgetDefaultSelected(SelectionEvent e) {
|
||||
}
|
||||
});
|
||||
|
||||
return composite;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configureShell(Shell newShell) {
|
||||
super.configureShell(newShell);
|
||||
newShell.setText("Add SGX Untrusted Module.");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected
|
||||
void okPressed(){
|
||||
addHandler.edlFilename = fileNameField.getText();
|
||||
if(!fileNameField.getText().isEmpty())
|
||||
if((new File(fileNameField.getText())).isFile())
|
||||
super.okPressed();
|
||||
else
|
||||
JOptionPane.showMessageDialog(null, "EDL file does not exist.", "Error",
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Point getInitialSize(){
|
||||
return new Point(675,200);
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
return fileNameField.getText();
|
||||
}
|
||||
}
|
@ -0,0 +1,257 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 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.jface.preference.JFacePreferences;
|
||||
import org.eclipse.jface.resource.JFaceResources;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.ModifyEvent;
|
||||
import org.eclipse.swt.events.ModifyListener;
|
||||
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.Combo;
|
||||
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.EnclaveConfigHandler;
|
||||
|
||||
public class EnclaveConfigDialog extends SGXDialogBase {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private Shell shell;
|
||||
private EnclaveConfigHandler enclaveConfig;
|
||||
private Label statusLabel;
|
||||
private Text prodID;
|
||||
private Text isvSvn;
|
||||
private Text threadStackSize;
|
||||
private Text globalHeapSize;
|
||||
private Text tcsNum;
|
||||
private Combo tcsPolicy;
|
||||
private Button disableDebug;
|
||||
|
||||
public EnclaveConfigDialog(Shell parentshell,EnclaveConfigHandler enclaveConfigHandler) {
|
||||
super(parentshell);
|
||||
this.shell = parentshell;
|
||||
this.enclaveConfig = enclaveConfigHandler;
|
||||
setShellStyle(SWT.RESIZE | SWT.TITLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Control createDialogArea(Composite parent) {
|
||||
|
||||
Composite container = (Composite) super.createDialogArea(parent);
|
||||
final GridLayout gridLayout = new GridLayout(3,false);
|
||||
container.setLayout(gridLayout);
|
||||
|
||||
final Group groupLabel1 = new Group(container, SWT.None);
|
||||
groupLabel1.setLayout(new GridLayout(3,false));
|
||||
GridData innergrid1 = new GridData(GridData.FILL_HORIZONTAL);
|
||||
innergrid1.horizontalSpan = 3;
|
||||
groupLabel1.setLayoutData(innergrid1);
|
||||
|
||||
Label warningLabel = new Label(groupLabel1,SWT.BEGINNING | SWT.WRAP);
|
||||
warningLabel.setText("Note: Use this Menu to change the Enclave settings.");
|
||||
|
||||
statusLabel = new Label(container,SWT.BEGINNING | SWT.WRAP);
|
||||
GridData statusGrid = new GridData(GridData.FILL_HORIZONTAL);
|
||||
statusGrid.horizontalSpan = 3;
|
||||
statusLabel.setLayoutData(statusGrid);
|
||||
statusLabel.setText("");
|
||||
statusLabel.setForeground(JFaceResources.getColorRegistry().get(JFacePreferences.ERROR_COLOR));
|
||||
|
||||
final Group groupLabel2 = new Group(container, SWT.None);
|
||||
groupLabel2.setLayout(new GridLayout(3,false));
|
||||
groupLabel2.setText("Modify the Enclave Settings here...");
|
||||
GridData innergrid = new GridData(GridData.FILL_HORIZONTAL);
|
||||
innergrid.horizontalSpan = 3;
|
||||
groupLabel2.setLayoutData(innergrid);
|
||||
|
||||
final Label messageLabel0 = new Label(groupLabel2, SWT.NONE);
|
||||
messageLabel0.setText("Product ID:");
|
||||
messageLabel0.setLayoutData(new GridData(GridData.BEGINNING));
|
||||
|
||||
prodID = new Text(groupLabel2, SWT.SINGLE | SWT.BORDER);
|
||||
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
|
||||
gridData.horizontalSpan = 2;
|
||||
gridData.widthHint = 400;
|
||||
prodID.setLayoutData(gridData);
|
||||
prodID.setText(enclaveConfig.prodId);
|
||||
prodID.addModifyListener(new ModifyListener() {
|
||||
@Override
|
||||
public void modifyText(ModifyEvent modifyEvent) {
|
||||
statusLabel.setText("");
|
||||
enclaveConfig.prodId = prodID.getText();
|
||||
}
|
||||
});
|
||||
|
||||
final Label messageLabel1 = new Label(groupLabel2, SWT.NONE);
|
||||
messageLabel1.setText("ISV SVN:");
|
||||
messageLabel1.setLayoutData(new GridData(GridData.BEGINNING));
|
||||
|
||||
isvSvn = new Text(groupLabel2, SWT.SINGLE | SWT.BORDER);
|
||||
isvSvn.setLayoutData(gridData);
|
||||
isvSvn.setText(enclaveConfig.isvSvn);
|
||||
isvSvn.addModifyListener(new ModifyListener() {
|
||||
@Override
|
||||
public void modifyText(ModifyEvent modifyEvent) {
|
||||
statusLabel.setText("");
|
||||
enclaveConfig.isvSvn = isvSvn.getText();
|
||||
}
|
||||
});
|
||||
|
||||
final Label messageLabel2 = new Label(groupLabel2, SWT.NONE);
|
||||
messageLabel2.setText("Thread Stack Size:");
|
||||
messageLabel2.setLayoutData(new GridData(GridData.BEGINNING));
|
||||
|
||||
threadStackSize = new Text(groupLabel2, SWT.SINGLE | SWT.BORDER);
|
||||
threadStackSize.setLayoutData(gridData);
|
||||
threadStackSize.setText(enclaveConfig.threadStackSize);
|
||||
threadStackSize.addModifyListener(new ModifyListener() {
|
||||
@Override
|
||||
public void modifyText(ModifyEvent modifyEvent) {
|
||||
enclaveConfig.threadStackSize = threadStackSize.getText();
|
||||
if(!(threadStackSize.getText().matches("0x[0-9a-fA-F]{1,}000")))
|
||||
{
|
||||
statusLabel.setText("Error: The Thread Stack Size value must be Page Aligned.");
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!(enclaveConfig.globalHeapSize.matches("0x[0-9a-fA-F]{1,}000")))
|
||||
statusLabel.setText("Error: The Global Heap Size value must be Page Aligned.");
|
||||
else
|
||||
statusLabel.setText("");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
final Label messageLabel3 = new Label(groupLabel2, SWT.NONE);
|
||||
messageLabel3.setText("Global Heap Size:");
|
||||
messageLabel3.setLayoutData(new GridData(GridData.BEGINNING));
|
||||
|
||||
globalHeapSize = new Text(groupLabel2, SWT.SINGLE | SWT.BORDER);
|
||||
globalHeapSize.setLayoutData(gridData);
|
||||
globalHeapSize.setText(enclaveConfig.globalHeapSize);
|
||||
globalHeapSize.addModifyListener(new ModifyListener() {
|
||||
@Override
|
||||
public void modifyText(ModifyEvent modifyEvent) {
|
||||
enclaveConfig.globalHeapSize = globalHeapSize.getText();
|
||||
if(!(globalHeapSize.getText().matches("0x[0-9a-fA-F]{1,}000")))
|
||||
{
|
||||
statusLabel.setText("Error: The Global Heap Size value must be Page Aligned.");
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!(enclaveConfig.threadStackSize.matches("0x[0-9a-fA-F]{1,}000")))
|
||||
statusLabel.setText("Error: The Thread Stack Size value must be Page Aligned.");
|
||||
else
|
||||
statusLabel.setText("");
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
final Label messageLabel4 = new Label(groupLabel2, SWT.NONE);
|
||||
messageLabel4.setText("TCS Number:");
|
||||
messageLabel4.setLayoutData(new GridData(GridData.BEGINNING));
|
||||
|
||||
tcsNum = new Text(groupLabel2, SWT.SINGLE | SWT.BORDER);
|
||||
tcsNum.setLayoutData(gridData);
|
||||
tcsNum.setText(enclaveConfig.tcsNum);
|
||||
tcsNum.addModifyListener(new ModifyListener() {
|
||||
@Override
|
||||
public void modifyText(ModifyEvent modifyEvent) {
|
||||
statusLabel.setText("");
|
||||
enclaveConfig.tcsNum = tcsNum.getText();
|
||||
}
|
||||
});
|
||||
|
||||
final Label messageLabel5 = new Label(groupLabel2, SWT.NONE);
|
||||
messageLabel5.setText("TCS Policy:");
|
||||
messageLabel5.setLayoutData(new GridData(GridData.BEGINNING));
|
||||
|
||||
final String[] items = {"Unbound","Bound"};
|
||||
tcsPolicy = new Combo(groupLabel2, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER);
|
||||
tcsPolicy.setItems(items);
|
||||
String item = items[Integer.parseInt(enclaveConfig.tcsPolicy)];
|
||||
int index = tcsPolicy.indexOf(item);
|
||||
tcsPolicy.select(index < 0 ? 0 : index);
|
||||
tcsPolicy.setLayoutData(gridData);
|
||||
tcsPolicy.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent e){
|
||||
statusLabel.setText("");
|
||||
enclaveConfig.tcsPolicy = (tcsPolicy.getSelectionIndex() == 0 ? "0" : "1");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
final Label messageLabel6 = new Label(groupLabel2, SWT.NONE);
|
||||
messageLabel6.setText("Disable Debug:");
|
||||
messageLabel6.setLayoutData(new GridData(GridData.BEGINNING));
|
||||
|
||||
disableDebug = new Button(groupLabel2,SWT.CHECK);
|
||||
GridData gridData1 = new GridData(GridData.FILL_HORIZONTAL);
|
||||
disableDebug.setLayoutData(gridData1);
|
||||
disableDebug.setSelection(enclaveConfig.disableDebug.equals("1")?true:false);
|
||||
disableDebug.addSelectionListener(new SelectionAdapter(){
|
||||
public void widgetSelected(SelectionEvent e){
|
||||
statusLabel.setText("");
|
||||
enclaveConfig.disableDebug = disableDebug.getSelection()?"1":"0";
|
||||
}
|
||||
});
|
||||
|
||||
if(statusLabel.getText() != null){
|
||||
statusLabel.setVisible(true);
|
||||
}
|
||||
else{
|
||||
statusLabel.setVisible(false);
|
||||
}
|
||||
|
||||
return container;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configureShell(Shell newShell) {
|
||||
super.configureShell(newShell);
|
||||
newShell.setText("Enclave Configuration Settings:");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Point getInitialSize(){
|
||||
return new Point(450,400);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected
|
||||
void okPressed(){
|
||||
enclaveConfig.prodId = this.prodID.getText();
|
||||
enclaveConfig.isvSvn = this.isvSvn.getText();
|
||||
enclaveConfig.threadStackSize = this.threadStackSize.getText();
|
||||
enclaveConfig.globalHeapSize = this.globalHeapSize.getText();
|
||||
enclaveConfig.tcsNum = this.tcsNum.getText();
|
||||
enclaveConfig.tcsPolicy = this.tcsPolicy.getSelectionIndex() == 0 ? "0" : "1";
|
||||
enclaveConfig.disableDebug = disableDebug.getSelection()?"1":"0";
|
||||
|
||||
|
||||
if((statusLabel.getText() == "") && (enclaveConfig.globalHeapSize.matches("0x[0-9a-fA-F]{1,}000")) && (enclaveConfig.threadStackSize.matches("0x[0-9a-fA-F]{1,}000")))
|
||||
super.okPressed();
|
||||
}
|
||||
}
|
@ -0,0 +1,122 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 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.jface.dialogs.Dialog;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.events.SelectionListener;
|
||||
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.DirectoryDialog;
|
||||
//import org.eclipse.swt.widgets.FileDialog;
|
||||
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.RemoveEnclave;
|
||||
|
||||
public class RemoveEnclaveFileDialog extends Dialog{
|
||||
|
||||
private Text fileNameField;
|
||||
private Shell shell;
|
||||
private RemoveEnclave removeHandler;
|
||||
|
||||
public RemoveEnclaveFileDialog(Shell shell, RemoveEnclave removeHandler) {
|
||||
super(shell);
|
||||
this.removeHandler = removeHandler;
|
||||
this.shell = shell;
|
||||
setShellStyle(SWT.RESIZE | SWT.TITLE);
|
||||
}
|
||||
|
||||
@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);
|
||||
container.setText("Path to Enclave directory:");
|
||||
|
||||
final Label messageLabel = new Label(container, SWT.NONE);
|
||||
messageLabel.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 3, 1));
|
||||
messageLabel.setText("Enter the name of the Enclave Or Navigate to the Enclave folder to be removed from the host.");
|
||||
|
||||
final Label fileNameLabel = new Label(container, SWT.NONE);
|
||||
fileNameLabel.setLayoutData(new GridData(GridData.BEGINNING,GridData.CENTER, false, false));
|
||||
fileNameLabel.setText("Enclave Name:");
|
||||
|
||||
fileNameField = new Text(container, SWT.SINGLE | SWT.BORDER);
|
||||
GridData textGridData1 = new GridData(GridData.FILL_HORIZONTAL);
|
||||
textGridData1.minimumWidth = 400;
|
||||
textGridData1.grabExcessHorizontalSpace = true;
|
||||
fileNameField.setLayoutData(textGridData1);
|
||||
|
||||
final Button browseButton = new Button(container, SWT.PUSH);
|
||||
browseButton.setText("Browse");
|
||||
GridData buttonGridData1 = new GridData(GridData.END);
|
||||
buttonGridData1.horizontalAlignment = SWT.RIGHT;
|
||||
buttonGridData1.horizontalSpan = 1;
|
||||
buttonGridData1.minimumWidth = 120;
|
||||
browseButton.setLayoutData(buttonGridData1);
|
||||
browseButton.addSelectionListener(new SelectionListener() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
String result = fileNameField.getText();
|
||||
|
||||
DirectoryDialog dialog = new DirectoryDialog(shell, SWT.OPEN);
|
||||
dialog.setMessage("Select the Enclave Directory to remove.");
|
||||
dialog.setFilterPath("");
|
||||
result = dialog.open();
|
||||
fileNameField.setText(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void widgetDefaultSelected(SelectionEvent e) {
|
||||
}
|
||||
});
|
||||
|
||||
return container;
|
||||
}
|
||||
@Override
|
||||
protected void configureShell(Shell newShell) {
|
||||
super.configureShell(newShell);
|
||||
newShell.setText("Remove an Imported Enclave");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void okPressed(){
|
||||
removeHandler.edlFilename = fileNameField.getText();
|
||||
if(!fileNameField.getText().isEmpty())
|
||||
super.okPressed();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Point getInitialSize(){
|
||||
return new Point(675,205);
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
return fileNameField.getText();
|
||||
}
|
||||
}
|
@ -0,0 +1,222 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 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 java.io.InputStream;
|
||||
import java.util.Scanner;
|
||||
|
||||
import org.eclipse.core.resources.IContainer;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.jface.dialogs.Dialog;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.window.IShellProvider;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.events.SelectionListener;
|
||||
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.Group;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
import org.eclipse.ui.IWorkbenchWindow;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.dialogs.FilteredResourcesSelectionDialog;
|
||||
|
||||
import com.intel.sgx.Activator;
|
||||
|
||||
public abstract class SGXDialogBase extends Dialog {
|
||||
|
||||
protected Shell shell;
|
||||
public Text configFileField;
|
||||
public static FilteredResourcesSelectionDialog dialogForConfig(Shell shell) {
|
||||
// final IContainer container = ResourcesPlugin.getWorkspace().getRoot();
|
||||
|
||||
final IContainer container = SGXDialogBase.getCurrentProject();
|
||||
|
||||
FilteredResourcesSelectionDialog d = new FilteredResourcesSelectionDialog(
|
||||
shell, false, container, IResource.FILE) {
|
||||
{
|
||||
setInitialPattern("**");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IStatus validateItem(Object item) {
|
||||
// return Status.OK_STATUS;
|
||||
IFile f = (IFile) item;
|
||||
if (f.getParent() instanceof IProject) {
|
||||
return new Status(IStatus.ERROR, Activator.PLUGIN_ID,
|
||||
"The selected resource has to be part of the source folder");
|
||||
}
|
||||
|
||||
|
||||
return super.validateItem(item);
|
||||
}
|
||||
|
||||
protected ItemsFilter createFilter() {
|
||||
return new ResourceFilter(container, true, IResource.FILE) {
|
||||
|
||||
@Override
|
||||
public boolean matchItem(Object item) {
|
||||
return isConfigFile(item);
|
||||
}
|
||||
|
||||
private boolean isConfigFile(Object item) {
|
||||
if (!(item.toString().endsWith(".xml") && super
|
||||
.matchItem(item))) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
IFile iFile = (IFile) item;
|
||||
return streamContainsString(iFile.getContents(),
|
||||
"<EnclaveConfiguration>");
|
||||
} catch (Throwable e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
public boolean streamContainsString(InputStream is,
|
||||
String searchString) {
|
||||
Scanner streamScanner = new Scanner(is);
|
||||
if (streamScanner.findWithinHorizon(searchString, 0) != null) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
return d;
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected SelectionListener configFileSelectionListener = new SelectionListener() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
|
||||
FilteredResourcesSelectionDialog d = dialogForConfig(shell);
|
||||
d.setTitle("Select Config File");
|
||||
if (d.open() == Dialog.OK) {
|
||||
IFile target = (IFile) d.getResult()[0];
|
||||
configFileField.setText(target.getLocation().toOSString());
|
||||
}
|
||||
;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void widgetDefaultSelected(SelectionEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
public SGXDialogBase(Shell parentShell) {
|
||||
super(parentShell);
|
||||
}
|
||||
|
||||
public SGXDialogBase(IShellProvider parentShell) {
|
||||
super(parentShell);
|
||||
}
|
||||
|
||||
protected Text addGroup(Composite composite, String title, String subtitle,
|
||||
String label, String selectButtonLabel, SelectionListener selectionListener) {
|
||||
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(title);
|
||||
|
||||
final Label messageLabel = new Label(container, SWT.NONE);
|
||||
messageLabel.setLayoutData(new GridData(GridData.BEGINNING,
|
||||
GridData.CENTER, false, false, 3, 1));
|
||||
messageLabel.setText(subtitle);
|
||||
|
||||
final Label messageLabel1 = new Label(container, SWT.NONE);
|
||||
messageLabel1.setText(label);
|
||||
messageLabel1.setLayoutData(new GridData(GridData.BEGINNING));
|
||||
|
||||
Text directoryNameField = new Text(container, SWT.SINGLE | SWT.BORDER);
|
||||
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
|
||||
gridData.horizontalSpan = 1;
|
||||
gridData.widthHint = 400;
|
||||
directoryNameField.setLayoutData(gridData);
|
||||
|
||||
final Button selectButton = new Button(container, SWT.PUSH);
|
||||
selectButton.setText(selectButtonLabel);
|
||||
GridData buttonGridData = new GridData(GridData.END);
|
||||
buttonGridData.horizontalAlignment = SWT.RIGHT;
|
||||
buttonGridData.horizontalSpan = 1;
|
||||
buttonGridData.minimumWidth = 120;
|
||||
selectButton.setLayoutData(buttonGridData);
|
||||
selectButton.addSelectionListener(selectionListener);
|
||||
return directoryNameField;
|
||||
}
|
||||
|
||||
|
||||
public IPath getCurrentProjectPath() {
|
||||
IProject project = getCurrentProject();
|
||||
|
||||
IPath path = null;
|
||||
if (project != null) {
|
||||
path = project.getLocation();
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
static public IProject getCurrentProject() {
|
||||
IProject project = null;
|
||||
|
||||
|
||||
IWorkbenchWindow window = PlatformUI.getWorkbench()
|
||||
.getActiveWorkbenchWindow();
|
||||
if (window != null) {
|
||||
IStructuredSelection selection = (IStructuredSelection) window
|
||||
.getSelectionService().getSelection();
|
||||
Object firstElement = selection.getFirstElement();
|
||||
if (firstElement instanceof IAdaptable) {
|
||||
project = (IProject) ((IAdaptable) firstElement)
|
||||
.getAdapter(IProject.class);
|
||||
}
|
||||
}
|
||||
return project;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configureShell(Shell newShell){
|
||||
super.configureShell(newShell);
|
||||
}
|
||||
|
||||
protected void addLabel(final Group container, String labelText) {
|
||||
final Label messageLabel = new Label(container, SWT.NONE);
|
||||
messageLabel.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 3, 1));
|
||||
messageLabel.setText(labelText);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,174 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 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 java.io.File;
|
||||
import java.util.Scanner;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.events.SelectionListener;
|
||||
import org.eclipse.swt.widgets.FileDialog;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
public abstract class TwoStepSignDialogBase extends SGXDialogBase {
|
||||
|
||||
public Text enclaveFileField;
|
||||
public Text hashFileField;
|
||||
public Text externalSignPublicKeyFileField;
|
||||
public Text externalSignedHashFileField;
|
||||
public Text outputSignedEnclaveFileField;
|
||||
|
||||
public TwoStepSignDialogBase(Shell parentShell) {
|
||||
super(parentShell);
|
||||
setShellStyle(SWT.RESIZE | SWT.TITLE);
|
||||
this.shell = TwoStepSignDialogBase.this.getParentShell();
|
||||
|
||||
}
|
||||
|
||||
// for each field, a corresponding listener
|
||||
protected SelectionListener enclaveFileSelectionListener = new SelectionListener() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
String result = enclaveFileField.getText();
|
||||
FileDialog dialog = new FileDialog(shell, SWT.OPEN);
|
||||
|
||||
|
||||
|
||||
dialog.setFilterExtensions(new String[]{"*.so"} );
|
||||
dialog.setFilterPath(getCurrentProjectPath().toOSString());
|
||||
|
||||
if (result != null && !result.isEmpty()) {
|
||||
dialog.setFilterPath(new File(result).getParent());
|
||||
} else {
|
||||
dialog.setFilterPath(getCurrentProjectPath().toOSString());
|
||||
}
|
||||
|
||||
result = dialog.open();
|
||||
|
||||
enclaveFileField.setText(result);
|
||||
|
||||
hashFileField.setText(result + ".hex");
|
||||
|
||||
if (outputSignedEnclaveFileField != null){
|
||||
String outputSignedEnclavePath = result;
|
||||
if(outputSignedEnclavePath.endsWith(".so"))
|
||||
{
|
||||
outputSignedEnclavePath =
|
||||
outputSignedEnclavePath.substring(0,outputSignedEnclavePath.length() - ".so".length());
|
||||
outputSignedEnclaveFileField.setText(outputSignedEnclavePath+".signed.so");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void widgetDefaultSelected(SelectionEvent arg0) {
|
||||
}
|
||||
};
|
||||
|
||||
protected SelectionListener hashFileSelectionListener = new SelectionListener() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
String result = hashFileField.getText();
|
||||
|
||||
FileDialog dialog = new FileDialog(shell, SWT.OPEN);
|
||||
|
||||
if (result != null && !result.isEmpty()) {
|
||||
dialog.setFilterPath(new File(result).getParent());
|
||||
} else {
|
||||
dialog.setFilterPath(getCurrentProjectPath().toOSString());
|
||||
}
|
||||
|
||||
result = dialog.open();
|
||||
|
||||
hashFileField.setText(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void widgetDefaultSelected(SelectionEvent arg0) {
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
protected SelectionListener publicKeyLocationSelectionListener = new SelectionListener() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
String result = externalSignPublicKeyFileField.getText();
|
||||
FileDialog dialog = new FileDialog(shell, SWT.OPEN);
|
||||
dialog.setFilterExtensions(new String [] {"*.pem", "*"});
|
||||
dialog.setFilterPath(getCurrentProjectPath().toOSString());
|
||||
result = dialog.open();
|
||||
externalSignPublicKeyFileField.setText(result);
|
||||
}
|
||||
@Override
|
||||
public void widgetDefaultSelected(SelectionEvent e) {
|
||||
}
|
||||
};
|
||||
|
||||
protected SelectionListener externalSignedHashFileSelectionListener = new SelectionListener() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
String result = externalSignedHashFileField.getText();
|
||||
FileDialog dialog = new FileDialog(shell, SWT.OPEN);
|
||||
dialog.setFilterPath(getCurrentProjectPath().toOSString());
|
||||
result = dialog.open();
|
||||
externalSignedHashFileField.setText(result);
|
||||
}
|
||||
@Override
|
||||
public void widgetDefaultSelected(SelectionEvent e) {
|
||||
}
|
||||
};
|
||||
|
||||
protected SelectionListener outputSignedEnclaveListener = new SelectionListener() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
String result = outputSignedEnclaveFileField.getText();
|
||||
FileDialog dialog = new FileDialog(shell, SWT.OPEN);
|
||||
|
||||
|
||||
dialog.setFilterExtensions(new String[]{"*.so", } );
|
||||
dialog.setFilterPath(getCurrentProjectPath().toOSString());
|
||||
|
||||
if (result != null && !result.isEmpty()) {
|
||||
dialog.setFilterPath(new File(result).getParent());
|
||||
} else {
|
||||
dialog.setFilterPath(getCurrentProjectPath().toOSString());
|
||||
}
|
||||
|
||||
result = dialog.open();
|
||||
|
||||
outputSignedEnclaveFileField.setText(result);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void widgetDefaultSelected(SelectionEvent arg0) {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@Override
|
||||
protected void configureShell(Shell newShell) {
|
||||
super.configureShell(newShell);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +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");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +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");
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +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");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +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");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,191 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 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 java.io.File;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import org.eclipse.jface.dialogs.InputDialog;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.events.SelectionListener;
|
||||
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.FileDialog;
|
||||
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.UpdateSigningKey;
|
||||
|
||||
public class UpdateSignKeyDialog extends SGXDialogBase {
|
||||
|
||||
private Shell shell;
|
||||
public Text sourceKeyFileField;
|
||||
public Text destinationKeyFileField;
|
||||
public static boolean regenerate = false;
|
||||
|
||||
private final SelectionListener destinationKeyFileSelectionListener = new SelectionListener() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
String result = destinationKeyFileField.getText();
|
||||
FileDialog dialog = new FileDialog(shell, SWT.OPEN);
|
||||
dialog.setFilterPath(getCurrentProjectPath().toOSString());
|
||||
dialog.setFilterExtensions(new String [] {"*.pem", "*"});
|
||||
result = dialog.open();
|
||||
destinationKeyFileField.setText(result);
|
||||
}
|
||||
@Override
|
||||
public void widgetDefaultSelected(SelectionEvent e) {
|
||||
}
|
||||
};
|
||||
|
||||
private final SelectionListener sourceKeyFileSelectionListener = new SelectionListener() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
String result = sourceKeyFileField.getText();
|
||||
FileDialog dialog = new FileDialog(shell, SWT.OPEN);
|
||||
dialog.setFilterExtensions(new String [] {"*.pem", "*"});
|
||||
dialog.setFilterPath(getCurrentProjectPath().toOSString());
|
||||
result = dialog.open();
|
||||
sourceKeyFileField.setText(result);
|
||||
}
|
||||
@Override
|
||||
public void widgetDefaultSelected(SelectionEvent e) {
|
||||
}
|
||||
};
|
||||
final private UpdateSigningKey handler;
|
||||
|
||||
public UpdateSignKeyDialog(Shell parentShell, UpdateSigningKey handler) {
|
||||
super(parentShell);
|
||||
this.shell = parentShell;
|
||||
this.handler = handler;
|
||||
setShellStyle(SWT.RESIZE | SWT.TITLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Control createDialogArea(Composite parent) {
|
||||
Composite composite = (Composite) super.createDialogArea(parent);
|
||||
final GridLayout gridLayout = new GridLayout(1,false);
|
||||
composite.setLayout(gridLayout);
|
||||
|
||||
destinationKeyFileField = addGroup(composite, "Enclave Signing Key:",
|
||||
"Select the Signing Key to be Updated or Generated.",
|
||||
"Enclave Signing Key:", "Select", destinationKeyFileSelectionListener);
|
||||
|
||||
sourceKeyFileField = addGroup(composite, "Import:",
|
||||
"To import your own Signing Key use the Import Signing Key option.",
|
||||
"Import Signing Key:", "Import Key", sourceKeyFileSelectionListener);
|
||||
|
||||
addGroup2(composite);
|
||||
|
||||
return composite;
|
||||
}
|
||||
|
||||
protected void addGroup2(Composite composite) {
|
||||
final Group container2 = new Group(composite, SWT.None);
|
||||
container2.setLayout(new GridLayout(3,false));
|
||||
GridData innergrid2 = new GridData(GridData.FILL_HORIZONTAL);
|
||||
innergrid2.horizontalSpan = 3;
|
||||
container2.setLayoutData(innergrid2);
|
||||
container2.setText("Generate:");
|
||||
|
||||
final Label messageLabel3 = new Label(container2, SWT.NONE);
|
||||
messageLabel3.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 3, 1));
|
||||
messageLabel3.setText("To Generate a new Signing Key use the Generate Signing Key option.");
|
||||
|
||||
Label warningLabel2 = new Label(container2,SWT.FILL | SWT.WRAP);
|
||||
warningLabel2.setText("Generate a new Signing Key:");
|
||||
warningLabel2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
|
||||
Label dummy2 = new Label(container2,0);
|
||||
dummy2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
final Button updateSigningKey = new Button(container2, SWT.PUSH);
|
||||
updateSigningKey.setText("Generate Key");
|
||||
GridData buttonGridData2 = new GridData(GridData.END);
|
||||
buttonGridData2.horizontalAlignment = SWT.RIGHT;
|
||||
buttonGridData2.horizontalSpan = 1;
|
||||
buttonGridData2.minimumWidth = 120;
|
||||
updateSigningKey.setLayoutData(buttonGridData2);
|
||||
updateSigningKey.addSelectionListener(new SelectionListener() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
if( !destinationKeyFileField.getText().isEmpty())
|
||||
{
|
||||
regenerate = true;
|
||||
UpdateSignKeyDialog.this.setReturnCode(InputDialog.OK);
|
||||
okPressed();
|
||||
UpdateSignKeyDialog.this.close();
|
||||
}
|
||||
else
|
||||
JOptionPane.showMessageDialog(null, "Enclave Signing Key field is not provided.", "Error",
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void widgetDefaultSelected(SelectionEvent e) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void configureShell(Shell newShell) {
|
||||
super.configureShell(newShell);
|
||||
newShell.setText("Import or (Re)Generate Enclave Signing Key");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void okPressed() {
|
||||
|
||||
handler.sourceKeyFile = sourceKeyFileField.getText();
|
||||
handler.destinationKeyFile = destinationKeyFileField.getText();
|
||||
if((!sourceKeyFileField.getText().isEmpty() && !destinationKeyFileField.getText().isEmpty() &&
|
||||
(new File(sourceKeyFileField.getText())).isFile())
|
||||
|| regenerate == true )
|
||||
{
|
||||
System.out.println("regenerate = " + regenerate);
|
||||
super.okPressed();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(sourceKeyFileField.getText().isEmpty() && destinationKeyFileField.getText().isEmpty())
|
||||
JOptionPane.showMessageDialog(null, "Enclave Signing Key and Import Singing Key are not provided.", "Error",
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
else
|
||||
{
|
||||
if(sourceKeyFileField.getText().isEmpty())
|
||||
JOptionPane.showMessageDialog(null, "Import Singing Key is not provided.", "Error",
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
else
|
||||
if(!(new File(sourceKeyFileField.getText())).isFile())
|
||||
JOptionPane.showMessageDialog(null, "Invalid Import Singing Key.", "Error",
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
|
||||
if(destinationKeyFileField.getText().isEmpty())
|
||||
JOptionPane.showMessageDialog(null, "Enclave Signing Key is not provided.", "Error",
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,103 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 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.util.Map;
|
||||
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector3;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorCleaner;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.InfoContext;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes;
|
||||
import org.eclipse.cdt.managedbuilder.scannerconfig.IManagedScannerInfoCollector;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
|
||||
/*
|
||||
* 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 SGXSDKScannerInfoCollector implements IScannerInfoCollector3,IScannerInfoCollectorCleaner,IManagedScannerInfoCollector{
|
||||
|
||||
private SGXSDKDiscoveredPathInfo sgxPathInfo;
|
||||
|
||||
@Override
|
||||
public void setProject(IProject project) {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateScannerConfiguration(IProgressMonitor monitor)
|
||||
throws CoreException {
|
||||
sgxPathInfo.update(monitor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDiscoveredPathInfo createPathInfoObject() {
|
||||
return sgxPathInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void contributeToScannerConfig(Object resource, @SuppressWarnings("rawtypes") Map scannerInfo) {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public List getCollectedScannerInfo(Object resource, ScannerInfoTypes type) {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getDefinedSymbols() {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getIncludePaths() {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAllPaths(IResource resource) {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAllSymbols(IResource resource) {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePath(IResource resource, String path) {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSymbol(IResource resource, String symbol) {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(IResource resource) {
|
||||
sgxPathInfo.delete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInfoContext(InfoContext context) {
|
||||
sgxPathInfo = new SGXSDKDiscoveredPathInfo(context.getProject());
|
||||
}
|
||||
}
|
@ -0,0 +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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,163 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 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.lang.reflect.InvocationTargetException;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.core.templateengine.TemplateCore;
|
||||
import org.eclipse.cdt.core.templateengine.TemplateEngine;
|
||||
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.IProjectDescription;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IWorkspace;
|
||||
//import org.eclipse.core.resources.IWorkspaceRunnable;
|
||||
//import org.eclipse.core.resources.IWorkspaceRunnable;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
//import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.ui.handlers.HandlerUtil;
|
||||
|
||||
import com.intel.sgx.Activator;
|
||||
import com.intel.sgx.natures.SGXNature;
|
||||
|
||||
public class AddSGXNature implements IHandler {
|
||||
|
||||
private IProject project;
|
||||
|
||||
public AddSGXNature() {
|
||||
project = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addHandlerListener(IHandlerListener arg0) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
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;
|
||||
} else {
|
||||
try {
|
||||
TemplateCore template = TemplateEngine.getDefault().getTemplateById("AddSGXNature");
|
||||
|
||||
Map<String,String> valueStore = template.getValueStore();
|
||||
valueStore.put("projectName",project.getName());
|
||||
valueStore.put("baseName",project.getName());
|
||||
|
||||
IProgressMonitor monitor = new NullProgressMonitor();
|
||||
template.executeTemplateProcesses(monitor, false);
|
||||
|
||||
IWorkspace workspace = ResourcesPlugin.getWorkspace();
|
||||
try{
|
||||
IProjectDescription description = project.getDescription();
|
||||
String[] natures = description.getNatureIds();
|
||||
|
||||
String[] newNatures = new String[natures.length + 1];
|
||||
System.arraycopy(natures, 0, newNatures, 0, natures.length);
|
||||
newNatures[natures.length] = SGXNature.NATURE_ID;
|
||||
IStatus status = workspace.validateNatureSet(newNatures);
|
||||
|
||||
if (status.getCode() == IStatus.OK) {
|
||||
description.setNatureIds(newNatures);
|
||||
project.setDescription(description, null);
|
||||
}
|
||||
|
||||
project.refreshLocal(IResource.DEPTH_ONE,null);
|
||||
} catch(CoreException e){
|
||||
Activator.log(e);
|
||||
throw new InvocationTargetException(e);
|
||||
}
|
||||
} catch(InvocationTargetException e){
|
||||
Activator.log(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
try {
|
||||
project.refreshLocal(IResource.DEPTH_INFINITE,null);
|
||||
} catch (CoreException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHandled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeHandlerListener(IHandlerListener arg0) {
|
||||
}
|
||||
|
||||
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());
|
||||
|
||||
} finally {
|
||||
try {
|
||||
if (in != null)
|
||||
in.close();
|
||||
} finally {
|
||||
if (out != null)
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,231 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 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.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.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
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.AddUntrustedModuleDialog;
|
||||
import com.intel.sgx.preferences.PreferenceConstants;
|
||||
|
||||
public class AddUntrustedModule extends ModuleCreationBaseHandler implements IHandler {
|
||||
|
||||
public String edlFilename = "";
|
||||
public String libPath = "";
|
||||
private IPath edlCanonicalFilename;
|
||||
private IPath libCanonicalPathname;
|
||||
|
||||
@Override
|
||||
public void addHandlerListener(IHandlerListener handlerListener) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
String edlBasename,edlPath,linuxLibPath,modulePath,enclaveBasename;
|
||||
IProject project = null;
|
||||
|
||||
//Display display = Display.getCurrent();
|
||||
Shell shell = null;
|
||||
|
||||
AddUntrustedModuleDialog dialog = new AddUntrustedModuleDialog(shell, this);
|
||||
if (dialog.open() != InputDialog.OK) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if((edlFilename.isEmpty() && libPath.isEmpty())){
|
||||
System.err.println("No Enclave selected to Import.");
|
||||
return null;
|
||||
}
|
||||
if( edlFilename.isEmpty() ){
|
||||
System.err.println("Edl File not selected.");
|
||||
return null;
|
||||
}
|
||||
edlCanonicalFilename = Path.fromOSString(edlFilename);
|
||||
if (!edlCanonicalFilename.getFileExtension().toLowerCase().equals("edl")) {
|
||||
System.err.println("Error: EDL file extension = "+ edlCanonicalFilename.getFileExtension());
|
||||
return null;
|
||||
}
|
||||
edlBasename = edlCanonicalFilename.removeFileExtension().lastSegment();
|
||||
|
||||
|
||||
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("untrusted_" + edlBasename);
|
||||
|
||||
try {
|
||||
for (int i = 1; i <= targetRelPath.segmentCount(); i++) {
|
||||
IFolder subfolder = project.getFolder(targetRelPath.uptoSegment(i));
|
||||
|
||||
if (!subfolder.exists()) {
|
||||
subfolder.create(true, true, null);
|
||||
}
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
System.err.println("Error: Error creating enclave directory.");
|
||||
Activator.log(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
IPath edlRelPath = (Path.fromOSString(edlFilename)).makeRelativeTo(project.getLocation().append("sgx"));
|
||||
edlPath = edlRelPath.toOSString();
|
||||
IPath linuxLibRelPath = (Path.fromOSString(libPath)).makeRelativeTo(project.getLocation().append("sgx"));
|
||||
|
||||
if(linuxLibRelPath.removeLastSegments(1).lastSegment().toString().equalsIgnoreCase("sgx")){
|
||||
linuxLibPath = linuxLibRelPath.removeLastSegments(3).toOSString();
|
||||
modulePath = linuxLibRelPath.removeFirstSegments(linuxLibRelPath.segmentCount()-3).removeLastSegments(1).toOSString();
|
||||
}
|
||||
else if(linuxLibRelPath.removeLastSegments(1).lastSegment().toString().equalsIgnoreCase("src")){
|
||||
linuxLibPath = linuxLibRelPath.removeLastSegments(3).toOSString();
|
||||
modulePath = linuxLibRelPath.removeFirstSegments(linuxLibRelPath.segmentCount()-3).removeLastSegments(1).toOSString();
|
||||
}
|
||||
else{
|
||||
linuxLibPath = linuxLibRelPath.removeLastSegments(2).toOSString();
|
||||
modulePath = linuxLibRelPath.removeFirstSegments(linuxLibRelPath.segmentCount()-2).removeLastSegments(1).toOSString();
|
||||
}
|
||||
|
||||
IProgressMonitor monitor = new NullProgressMonitor();
|
||||
TemplateCore template = null;
|
||||
if(isCPProject(project))
|
||||
template = TemplateEngine.getDefault().getTemplateById("SGXUntrustedModuleC++Minimal");
|
||||
else
|
||||
template = TemplateEngine.getDefault().getTemplateById("SGXUntrustedModuleCMinimal");
|
||||
|
||||
|
||||
|
||||
Map<String, String> valueStore = template.getValueStore();
|
||||
|
||||
|
||||
valueStore.put("projectName", project.getName());
|
||||
valueStore.put("sourcepath",linuxLibPath);
|
||||
valueStore.put("edlPath", edlPath);
|
||||
valueStore.put("baseName", edlBasename);
|
||||
valueStore.put("workspacePath", linuxLibPath);//deprecate
|
||||
valueStore.put("modPath", modulePath);
|
||||
valueStore.put("ENCLAVENAME",edlBasename.toUpperCase());
|
||||
valueStore.put("libPath",libPath);
|
||||
valueStore.put("SdkPathFromPlugin", Activator.getDefault().getPreferenceStore().getString(PreferenceConstants.SDK_PATH));
|
||||
|
||||
IStatus[] statuses = template.executeTemplateProcesses(monitor, false);
|
||||
|
||||
try {
|
||||
copyFile(new File(edlFilename), project.getLocation().append("sgx").append("untrusted_"+edlBasename).append(edlBasename+".edl").toFile());
|
||||
} catch (IOException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
ManagedBuildManager.saveBuildInfo(project, true);
|
||||
try {
|
||||
project.refreshLocal(IResource.DEPTH_INFINITE, null);
|
||||
} catch (CoreException e) {
|
||||
Activator.log(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,156 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 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.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import org.eclipse.cdt.core.templateengine.TemplateCore;
|
||||
import org.eclipse.cdt.core.templateengine.TemplateEngine;
|
||||
import org.eclipse.core.commands.IHandlerListener;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
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.jface.dialogs.Dialog;
|
||||
import org.eclipse.jface.dialogs.InputDialog;
|
||||
import org.eclipse.ui.dialogs.FilteredResourcesSelectionDialog;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import com.intel.sgx.Activator;
|
||||
import com.intel.sgx.dialogs.EnclaveConfigDialog;
|
||||
import com.intel.sgx.dialogs.SGXDialogBase;
|
||||
|
||||
public class EnclaveConfigHandler extends SGXHandler {
|
||||
|
||||
public String prodId;
|
||||
public String isvSvn;
|
||||
public String threadStackSize;
|
||||
public String globalHeapSize;
|
||||
public String tcsNum;
|
||||
public String tcsPolicy;
|
||||
public String disableDebug;
|
||||
private IFile configPath;
|
||||
|
||||
@Override
|
||||
public void addHandlerListener(IHandlerListener arg0) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object executeSGXStuff() throws CancelException, ErrorException {
|
||||
|
||||
FilteredResourcesSelectionDialog d = SGXDialogBase
|
||||
.dialogForConfig(shell);
|
||||
d.setTitle("Select Config File");
|
||||
if (d.open() != Dialog.OK) {
|
||||
cancel();
|
||||
}
|
||||
|
||||
configPath = ((IFile) d.getResult()[0]);
|
||||
|
||||
readConfig(configPath.getLocation());
|
||||
EnclaveConfigDialog dialog = new EnclaveConfigDialog(shell, this);
|
||||
if (dialog.open() != InputDialog.OK) {
|
||||
return null;
|
||||
}
|
||||
writeConfig();
|
||||
refreshProject();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void writeConfig() {
|
||||
IProgressMonitor monitor = new NullProgressMonitor();
|
||||
TemplateCore template = TemplateEngine.getDefault().getTemplateById("SGXEnclaveConfig");
|
||||
|
||||
Map<String, String> valueStore = template.getValueStore();
|
||||
valueStore.put("projectName", project.getName());
|
||||
valueStore.put("configFile", configPath.getProjectRelativePath().toOSString());
|
||||
valueStore.put("ProdID", this.prodId);
|
||||
valueStore.put("IsvSvn", this.isvSvn);
|
||||
valueStore.put("ThreadStackSize", this.threadStackSize);
|
||||
valueStore.put("GlobalHeapSize", this.globalHeapSize);
|
||||
valueStore.put("TcsNumber", this.tcsNum);
|
||||
valueStore.put("TcsPolicy", this.tcsPolicy);
|
||||
valueStore.put("DisableDebug", this.disableDebug);
|
||||
IStatus[] result = template.executeTemplateProcesses(monitor, true);
|
||||
|
||||
for (IStatus status: result) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected void readConfig(IPath configPath) throws ErrorException {
|
||||
|
||||
try {
|
||||
String xmlFile = configPath.toString();
|
||||
File configFile = new File(xmlFile);
|
||||
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder dBuilder;
|
||||
dBuilder = dbFactory.newDocumentBuilder();
|
||||
Document doc = dBuilder.parse(configFile);
|
||||
doc.getDocumentElement().normalize();
|
||||
|
||||
NodeList nList = doc.getElementsByTagName("EnclaveConfiguration");
|
||||
Node nNode = nList.item(0);
|
||||
|
||||
if (nNode.getNodeType() == Node.ELEMENT_NODE) {
|
||||
Element e = (Element) nNode;
|
||||
this.prodId = e.getElementsByTagName("ProdID").item(0)
|
||||
.getTextContent();
|
||||
this.isvSvn = e.getElementsByTagName("ISVSVN").item(0)
|
||||
.getTextContent();
|
||||
this.threadStackSize = e.getElementsByTagName("StackMaxSize")
|
||||
.item(0).getTextContent();
|
||||
this.globalHeapSize = e.getElementsByTagName("HeapMaxSize")
|
||||
.item(0).getTextContent();
|
||||
this.tcsNum = e.getElementsByTagName("TCSNum").item(0)
|
||||
.getTextContent();
|
||||
this.tcsPolicy = e.getElementsByTagName("TCSPolicy").item(0)
|
||||
.getTextContent();
|
||||
this.disableDebug = e.getElementsByTagName("DisableDebug")
|
||||
.item(0).getTextContent();
|
||||
}
|
||||
|
||||
} catch (ParserConfigurationException e) {
|
||||
Activator.log(e);
|
||||
e.printStackTrace();
|
||||
quitWithError("Could not parse '"+configPath.toOSString()+"'");
|
||||
} catch (SAXException e) {
|
||||
Activator.log(e);
|
||||
e.printStackTrace();
|
||||
quitWithError("Could not parse '"+configPath.toOSString()+"'");
|
||||
} catch (IOException e) {
|
||||
Activator.log(e);
|
||||
e.printStackTrace();
|
||||
quitWithError("Could not read'"+configPath.toOSString()+"'");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +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.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IProjectDescription;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
public class ModuleCreationBaseHandler {
|
||||
public boolean isCPProject(IProject project)
|
||||
{
|
||||
boolean isCPProject = false;
|
||||
IProjectDescription description;
|
||||
try {
|
||||
description = project.getDescription();
|
||||
String[] natures = description.getNatureIds();
|
||||
for(String nature: natures){
|
||||
if(nature.equals("org.eclipse.cdt.core.ccnature"))
|
||||
isCPProject = true;
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return isCPProject;
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,206 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 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 javax.swing.JOptionPane;
|
||||
|
||||
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.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.handlers.HandlerUtil;
|
||||
|
||||
/**
|
||||
* Utility base class for all Handlers The derived classes must implement
|
||||
* executeSgxStuff() instead of execute(). The user may call methods cancel(),
|
||||
* quitWithError() & info()
|
||||
*
|
||||
* @author mlutescu
|
||||
*
|
||||
*/
|
||||
public abstract class SGXHandler implements IHandler {
|
||||
|
||||
public String projectPath = null;
|
||||
protected IProject project;
|
||||
protected Shell shell;
|
||||
|
||||
/**
|
||||
* Throwing this IS an error. Means that the process can't continue
|
||||
*
|
||||
* @author mlutescu
|
||||
*
|
||||
*/
|
||||
static protected class ErrorException extends Exception {
|
||||
|
||||
public ErrorException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Throwing this is not an error; just signals stop of execution because the
|
||||
* user cancels
|
||||
*
|
||||
* @author mlutescu
|
||||
*
|
||||
*/
|
||||
static protected class CancelException extends Exception {
|
||||
|
||||
public CancelException() {
|
||||
super();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
try {
|
||||
initializeShell();
|
||||
initializeProject(event);
|
||||
return executeSGXStuff();
|
||||
} catch (ErrorException e) {
|
||||
e.printStackTrace();
|
||||
} catch (CancelException e) {
|
||||
// do nothing by design ; it's Ok to not handle this exception.
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected abstract Object executeSGXStuff() throws ErrorException,
|
||||
CancelException;
|
||||
|
||||
public SGXHandler() {
|
||||
super();
|
||||
}
|
||||
|
||||
public static void copyFile(File source, File dest) throws ErrorException {
|
||||
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 (IOException e) {
|
||||
System.err.println("Error: " + e.toString());
|
||||
quitWithError("Could not copy from\n" + "'"
|
||||
+ source.getAbsolutePath() + "'\n" + "to\n" + "'"
|
||||
+ dest.getAbsolutePath());
|
||||
} finally {
|
||||
try {
|
||||
if (in != null) {
|
||||
in.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (out != null) {
|
||||
try {
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected static void quitWithError(String message) throws ErrorException {
|
||||
JOptionPane.showMessageDialog(null, message, "Two Step Enclave Sign",
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
throw new ErrorException(message);
|
||||
}
|
||||
|
||||
static protected void cancel() throws CancelException {
|
||||
throw new CancelException();
|
||||
}
|
||||
|
||||
protected void initializeProject(ExecutionEvent event)
|
||||
throws ErrorException {
|
||||
project = 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()) {
|
||||
quitWithError("Project not found");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHandled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeHandlerListener(IHandlerListener arg0) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addHandlerListener(IHandlerListener arg0) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
}
|
||||
|
||||
protected void initializeShell() {
|
||||
shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
|
||||
}
|
||||
|
||||
protected void refreshProject() throws ErrorException {
|
||||
try {
|
||||
project.refreshLocal(IResource.DEPTH_INFINITE, null);
|
||||
} catch (CoreException e1) {
|
||||
quitWithError(e1.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
protected void info(String windowName, String message) {
|
||||
JOptionPane.showMessageDialog(null, message,windowName,
|
||||
JOptionPane.INFORMATION_MESSAGE);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +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();
|
||||
}
|
||||
}
|
@ -0,0 +1,196 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 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.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
import com.intel.sgx.preferences.PreferenceConstants;
|
||||
|
||||
public abstract class TwoStepSignHandlerBase extends SGXHandler {
|
||||
|
||||
public String hashFile = null;
|
||||
public String configFile = null;
|
||||
public String enclaveFile = null;
|
||||
public String externalSignPublicKeyFile = null;
|
||||
public String externallySignedHashFile = null;
|
||||
public String outputSignedEnclaveFile = null;
|
||||
|
||||
protected File signtool;
|
||||
|
||||
public TwoStepSignHandlerBase() {
|
||||
super();
|
||||
}
|
||||
|
||||
protected void executeGenData() throws ErrorException {
|
||||
validateConfigFile();
|
||||
validateEnclaveFile();
|
||||
|
||||
refreshProject();
|
||||
executeSignTool(new String[] { "gendata",
|
||||
"-enclave", enclaveFile,
|
||||
"-config", configFile,
|
||||
"-out", hashFile });
|
||||
refreshProject();
|
||||
|
||||
validateHashFile();
|
||||
|
||||
}
|
||||
|
||||
protected void executeCatSig() throws ErrorException {
|
||||
validateEnclaveFile();
|
||||
validateConfigFile();
|
||||
validateHashFile();
|
||||
|
||||
validateExternalSignPublicKeyFile();
|
||||
validateExternallySignedHashFile();
|
||||
|
||||
executeSignTool("catsig",
|
||||
// enclave data:
|
||||
"-enclave", enclaveFile,
|
||||
"-config", configFile,
|
||||
// previously generated:
|
||||
"-unsigned", hashFile,
|
||||
// externally generated
|
||||
"-key", externalSignPublicKeyFile,
|
||||
"-sig", externallySignedHashFile,
|
||||
// output
|
||||
"-out", outputSignedEnclaveFile
|
||||
|
||||
);
|
||||
|
||||
refreshProject();
|
||||
|
||||
validateOutputSignedEnclaveFile();
|
||||
|
||||
info("Two Step Enclave Sign","Enclave signed successfully !");
|
||||
}
|
||||
|
||||
void initializeSigntool() throws ErrorException {
|
||||
signtool = PreferenceConstants.getSDKDescriptor().getSignerPath();
|
||||
if (!signtool.exists() || signtool.isDirectory()) {
|
||||
quitWithError("Error generating hash! Sign Tool Not Found !\n Please make sure to have written in the box the value for SGX SDK Directory in Window->Preferences->SGX Preferences. \n Usually the path is in /opt/intel/sgxsdk/" );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void validateEnclaveFile() throws ErrorException {
|
||||
File enclave = new File(enclaveFile);
|
||||
if (!enclave.exists() || enclave.isDirectory()) {
|
||||
quitWithError("Error generating hash! Unsigned Enclave File Not Found! Try building the enclave first");
|
||||
}
|
||||
}
|
||||
|
||||
protected void validateConfigFile() throws ErrorException {
|
||||
if (configFile == null || configFile.isEmpty()) {
|
||||
quitWithError("Error Enclave Configuration File Not Found !");
|
||||
}
|
||||
File config = new File(configFile);
|
||||
if (!config.exists() || config.isDirectory()) {
|
||||
quitWithError("Enclave Config File Not Found !");
|
||||
}
|
||||
}
|
||||
|
||||
protected void validateExternallySignedHashFile() throws ErrorException {
|
||||
if (externallySignedHashFile == null || externallySignedHashFile.isEmpty()) {
|
||||
quitWithError("Error signing enclave! Signature File Not Found !");
|
||||
}
|
||||
|
||||
File signature = new File(externallySignedHashFile);
|
||||
if (!signature.exists() || signature.isDirectory()) {
|
||||
quitWithError("Error signing enclave! Signature File Not Found !");
|
||||
}
|
||||
}
|
||||
|
||||
protected void validateExternalSignPublicKeyFile() throws ErrorException {
|
||||
if (externalSignPublicKeyFile == null || externalSignPublicKeyFile.isEmpty()) {
|
||||
quitWithError("Public Key File Not Found !");
|
||||
}
|
||||
|
||||
File publickkey = new File(externalSignPublicKeyFile);
|
||||
if (!publickkey.exists() || publickkey.isDirectory()) {
|
||||
quitWithError("Error signing enclave! Public Key File Not Found !");
|
||||
}
|
||||
}
|
||||
|
||||
private void validateOutputSignedEnclaveFile() throws ErrorException {
|
||||
if(outputSignedEnclaveFile == null || outputSignedEnclaveFile.isEmpty())
|
||||
{
|
||||
quitWithError("Output Signed File Not Found !");
|
||||
}
|
||||
File outputSignedEnclave = new File(outputSignedEnclaveFile);
|
||||
if(!outputSignedEnclave.exists() || outputSignedEnclave.isDirectory())
|
||||
{
|
||||
quitWithError("Output Signed File Not Found !");
|
||||
}
|
||||
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
protected void validateHashFile() throws ErrorException {
|
||||
if(hashFile == null || hashFile.isEmpty())
|
||||
{
|
||||
quitWithError("Hash File Not Found !");
|
||||
}
|
||||
File hash = new File(hashFile);
|
||||
if(!hash.exists() || hash.isDirectory())
|
||||
{
|
||||
quitWithError("Hash File Not Found !");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void executeSignTool(String... args) throws ErrorException {
|
||||
|
||||
Process q;
|
||||
try {
|
||||
|
||||
String[] allArgs = new String[args.length+1];
|
||||
allArgs[0] = signtool.getAbsolutePath();
|
||||
System.arraycopy(args, 0, allArgs, 1, args.length);
|
||||
|
||||
for (String arg : args){
|
||||
}
|
||||
String fullOutput = "";
|
||||
q = Runtime.getRuntime().exec(allArgs);
|
||||
|
||||
BufferedReader stdInput = new BufferedReader(new InputStreamReader(
|
||||
q.getInputStream()));
|
||||
BufferedReader stdErr = new BufferedReader(new InputStreamReader(
|
||||
q.getErrorStream()));
|
||||
String s = null;
|
||||
while ((s = stdInput.readLine()) != null) {
|
||||
}
|
||||
String[] out = new String[20];
|
||||
int i = 0;
|
||||
while ((out[i] = stdErr.readLine()) != null) {
|
||||
fullOutput += out[i]+"\n";
|
||||
i++;
|
||||
}
|
||||
String result = out[i - 1];
|
||||
|
||||
if (!result.equals("Succeed.")) {
|
||||
// quitWithError("Error generating hash! " + out[i - 2]);
|
||||
quitWithError("Error generating hash! " + fullOutput);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
quitWithError(e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +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();
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +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;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,101 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 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.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
//import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
//import java.security.KeyPair;
|
||||
//import java.security.KeyPairGenerator;
|
||||
//import java.security.NoSuchAlgorithmException;
|
||||
|
||||
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.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.Shell;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.handlers.HandlerUtil;
|
||||
|
||||
//import org.bouncycastle.openssl.PEMWriter;
|
||||
import com.intel.sgx.Activator;
|
||||
import com.intel.sgx.dialogs.UpdateSignKeyDialog;
|
||||
|
||||
public class UpdateSigningKey extends SGXHandler {
|
||||
|
||||
public String sourceKeyFile = null;
|
||||
public String destinationKeyFile = null;
|
||||
public String projectPath = null;
|
||||
|
||||
@Override
|
||||
protected Object executeSGXStuff() throws ErrorException, CancelException {
|
||||
|
||||
UpdateSignKeyDialog dialog = new UpdateSignKeyDialog(shell, this);
|
||||
int result = dialog.open();
|
||||
if (result != InputDialog.OK) {
|
||||
cancel();
|
||||
}
|
||||
|
||||
if(UpdateSignKeyDialog.regenerate == false)
|
||||
{
|
||||
IPath sourceFile = Path.fromOSString(sourceKeyFile);
|
||||
IPath destFile = Path.fromOSString(destinationKeyFile);
|
||||
copyFile(sourceFile.toFile(), destFile.toFile());
|
||||
refreshProject();
|
||||
info("Update SGX Enclave Signing Key","copied \n'" + sourceKeyFile + "' into \n'" + destFile + "'");
|
||||
} else {
|
||||
UpdateSignKeyDialog.regenerate = false;
|
||||
try {
|
||||
Process q;
|
||||
String opensslCmd = "openssl genrsa -out " + destinationKeyFile
|
||||
+ " -3 3072";
|
||||
q = Runtime.getRuntime().exec(opensslCmd);
|
||||
BufferedReader stdInput = new BufferedReader(
|
||||
new InputStreamReader(q.getInputStream()));
|
||||
BufferedReader stdErr = new BufferedReader(
|
||||
new InputStreamReader(q.getErrorStream()));
|
||||
String s = null;
|
||||
while ((s = stdInput.readLine()) != null) {
|
||||
}
|
||||
while ((s = stdErr.readLine()) != null) {
|
||||
}
|
||||
project.refreshLocal(IResource.DEPTH_INFINITE, null);
|
||||
if (q.exitValue() == 0){
|
||||
info("Update SGX Enclave Signing Key","'"+destinationKeyFile+"'"+" was generated!");
|
||||
} else {
|
||||
quitWithError("Could not generate '"+destinationKeyFile+"'!!!");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Activator.log(e);
|
||||
e.printStackTrace();
|
||||
} catch (CoreException e) {
|
||||
Activator.log(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
<!--------------------------------------------------------------------------->
|
||||
<!-- 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 -->
|
||||
<!--------------------------------------------------------------------------->
|
||||
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"><head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>About</title></head>
|
||||
|
||||
<body lang="EN-US">
|
||||
<h2>About This Content</h2>
|
||||
|
||||
<p>June 22, 2007</p>
|
||||
<h3>License</h3>
|
||||
|
||||
<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
|
||||
indicated below, the Content is provided to you under the terms and conditions of the
|
||||
Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
|
||||
at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
|
||||
For purposes of the EPL, "Program" will mean the Content.</p>
|
||||
|
||||
<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
|
||||
being redistributed by another party ("Redistributor") and different terms and conditions may
|
||||
apply to your use of any object code in the Content. Check the Redistributor's license that was
|
||||
provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
|
||||
indicated below, the terms and conditions of the EPL still apply to any source code in the Content
|
||||
and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
|
||||
|
||||
</body></html>
|
@ -0,0 +1,16 @@
|
||||
#########################################################################
|
||||
# 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 #
|
||||
#########################################################################
|
||||
|
||||
|
||||
CreateNativeFolders_No_folders=No folders.
|
||||
CreateNativeFolders_Missing_project_name=Missing project Name.
|
||||
CreateNativeFolders_Project_does_not_exist=Project does not exist.
|
@ -0,0 +1,45 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 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.natures;
|
||||
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IProjectNature;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
public class SGXCCNature implements IProjectNature {
|
||||
|
||||
private IProject project;
|
||||
public static final String NATURE_ID = "com.intel.sgx.sgxccnature";
|
||||
|
||||
public SGXCCNature() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure() throws CoreException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deconfigure() throws CoreException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IProject getProject() {
|
||||
return project;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProject(IProject project) {
|
||||
this.project = project;
|
||||
}
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 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.natures;
|
||||
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IProjectNature;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
public class SGXNature implements IProjectNature {
|
||||
|
||||
private IProject project;
|
||||
public static final String NATURE_ID = "com.intel.sgx.sgxnature";
|
||||
|
||||
public SGXNature() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure() throws CoreException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deconfigure() throws CoreException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IProject getProject() {
|
||||
return project;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProject(IProject project) {
|
||||
this.project = project;
|
||||
}
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 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.natures;
|
||||
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IProjectNature;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
public class SGXStaticCCNature implements IProjectNature {
|
||||
|
||||
private IProject project;
|
||||
public static final String NATURE_ID = "com.intel.sgx.sgxstaticccnature";
|
||||
|
||||
public SGXStaticCCNature() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure() throws CoreException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deconfigure() throws CoreException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IProject getProject() {
|
||||
return project;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProject(IProject project) {
|
||||
this.project = project;
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 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.preferences;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
|
||||
public interface ISDKDescriptor {
|
||||
|
||||
public abstract File getSdkDir();
|
||||
|
||||
public abstract File getToolsDir();
|
||||
|
||||
public abstract File getSignerPath();
|
||||
|
||||
public abstract File getEdger8rPath();
|
||||
|
||||
}
|