add Windows build for SGX

This commit is contained in:
Jacob Barthelmeh 2016-12-14 10:41:52 -07:00
parent 483e461c49
commit e16f2c0722
11 changed files with 519 additions and 13 deletions

33
IDE/WIN-SGX/ReadMe.txt Executable file
View File

@ -0,0 +1,33 @@
==================================================================================================
Static Library : wolfssl Project Overview
==================================================================================================
Requirements:
This code was created to use Intel's SGX hardware. It is expected that the user has gone through the
steps of both turning on the hardware in bios if needed and has installed the necesary software
from Intel to make use of the hardware. (https://software.intel.com/en-us/sgx) If these steps have
not been done then it is expected that the user is familure with simiulation software being used in
place of hardware.
Overview and Build:
This project creates a static library to then link with Enclaves. A simple example of an Enclave
linking to the created wolfSSL library can be found in wolfssl-examples on github. By default
the Platform Toolset is set to "Intel C++ Compiler 16.0", this may need adjusted depending on
available compilers on the system being built on.
Testing and development was done with Visual Studio 2013. This project may build with other versions
of Visual Studio but has not been tested with them.
To link with the created library with Visual Studio first open the wolfSSL_SGX project in Visual Studio.
Select platform desired from build configuration ie Win32 or x64. (note the architecture of the library
should match that of the Enclave/application being linked to it) Select Debug or PreSales, if looking
to build in Release mode look at Intels documentation for farther steps on creating a Release build.
Next select Build->Build Solution. This will create a library named wolfssl.lib in the directory
wolfssl-root/IDE/WIN-SGX/<Configuration>/<Platform>. Move this library to the search path of Enclave
linking to. Next create an Enclave using the library.
Limitations:
Single Threaded (multiple threaded applications have not been tested)
Crypto Only (network communication from trusted Enclave has not been added yet)
No ASN/Certificates (handling getting the system time has not yet been added)
AES-NI use with SGX has not been added in yet

10
IDE/WIN-SGX/include.am Normal file
View File

@ -0,0 +1,10 @@
# vim:ft=automake
# included from Top Level Makefile.am
# All paths should be given relative to the root
EXTRA_DIST+= IDE/WIN-SGX/ReadMe.txt
EXTRA_DIST+= IDE/WIN-SGX/wolfSSL_SGX.edl
EXTRA_DIST+= IDE/WIN-SGX/wolfSSL_SGX.sln
EXTRA_DIST+= IDE/WIN-SGX/wolfSSL_SGX.suo
EXTRA_DIST+= IDE/WIN-SGX/wolfSSL_SGX.vcxproj
EXTRA_DIST+= IDE/WIN-SGX/wolfSSL_SGX.vcxproj.filters

11
IDE/WIN-SGX/wolfSSL_SGX.edl Executable file
View File

@ -0,0 +1,11 @@
enclave {
trusted {
};
untrusted {
/* define OCALLs here. */
};
};

40
IDE/WIN-SGX/wolfSSL_SGX.sln Executable file
View File

@ -0,0 +1,40 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wolfSSL_SGX", "wolfSSL_SGX.vcxproj", "{D4D81C31-1404-4E8C-8E8C-19C3A74F66F3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Prerelease|Win32 = Prerelease|Win32
Prerelease|x64 = Prerelease|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
Simulation|Win32 = Simulation|Win32
Simulation|x64 = Simulation|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D4D81C31-1404-4E8C-8E8C-19C3A74F66F3}.Debug|Win32.ActiveCfg = Debug|Win32
{D4D81C31-1404-4E8C-8E8C-19C3A74F66F3}.Debug|Win32.Build.0 = Debug|Win32
{D4D81C31-1404-4E8C-8E8C-19C3A74F66F3}.Debug|x64.ActiveCfg = Debug|x64
{D4D81C31-1404-4E8C-8E8C-19C3A74F66F3}.Debug|x64.Build.0 = Debug|x64
{D4D81C31-1404-4E8C-8E8C-19C3A74F66F3}.Prerelease|Win32.ActiveCfg = Prerelease|Win32
{D4D81C31-1404-4E8C-8E8C-19C3A74F66F3}.Prerelease|Win32.Build.0 = Prerelease|Win32
{D4D81C31-1404-4E8C-8E8C-19C3A74F66F3}.Prerelease|x64.ActiveCfg = Prerelease|x64
{D4D81C31-1404-4E8C-8E8C-19C3A74F66F3}.Prerelease|x64.Build.0 = Prerelease|x64
{D4D81C31-1404-4E8C-8E8C-19C3A74F66F3}.Release|Win32.ActiveCfg = Release|Win32
{D4D81C31-1404-4E8C-8E8C-19C3A74F66F3}.Release|Win32.Build.0 = Release|Win32
{D4D81C31-1404-4E8C-8E8C-19C3A74F66F3}.Release|x64.ActiveCfg = Release|x64
{D4D81C31-1404-4E8C-8E8C-19C3A74F66F3}.Release|x64.Build.0 = Release|x64
{D4D81C31-1404-4E8C-8E8C-19C3A74F66F3}.Simulation|Win32.ActiveCfg = Simulation|Win32
{D4D81C31-1404-4E8C-8E8C-19C3A74F66F3}.Simulation|Win32.Build.0 = Simulation|Win32
{D4D81C31-1404-4E8C-8E8C-19C3A74F66F3}.Simulation|x64.ActiveCfg = Simulation|x64
{D4D81C31-1404-4E8C-8E8C-19C3A74F66F3}.Simulation|x64.Build.0 = Simulation|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

321
IDE/WIN-SGX/wolfSSL_SGX.vcxproj Executable file
View File

@ -0,0 +1,321 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Prerelease|Win32">
<Configuration>Prerelease</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Prerelease|x64">
<Configuration>Prerelease</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Simulation|Win32">
<Configuration>Simulation</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Simulation|x64">
<Configuration>Simulation</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{D4D81C31-1404-4E8C-8E8C-19C3A74F66F3}</ProjectGuid>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<ProjectName>wolfSSL_SGX</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>Intel C++ Compiler 16.0</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>Intel C++ Compiler 16.0</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>Intel C++ Compiler 16.0</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>Intel C++ Compiler 16.0</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Prerelease|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Prerelease|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Prerelease|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>Intel C++ Compiler 16.0</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Prerelease|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>Intel C++ Compiler 16.0</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>Intel C++ Compiler 16.0</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>Intel C++ Compiler 16.0</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(LocalAppData)\Microsoft\VisualStudio\12.0\SecureEnclave.$(Platform).props" Condition="exists('$(LocalAppData)\Microsoft\VisualStudio\11.0\SecureEnclave.$(Platform).props')" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(LocalAppData)\Microsoft\VisualStudio\12.0\SecureEnclave.$(Platform).props" Condition="exists('$(LocalAppData)\Microsoft\VisualStudio\11.0\SecureEnclave.$(Platform).props')" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'" Label="PropertySheets">
<Import Project="$(LocalAppData)\Microsoft\VisualStudio\12.0\SecureEnclave.$(Platform).props" Condition="exists('$(LocalAppData)\Microsoft\VisualStudio\11.0\SecureEnclave.$(Platform).props')" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'" Label="PropertySheets">
<Import Project="$(LocalAppData)\Microsoft\VisualStudio\12.0\SecureEnclave.$(Platform).props" Condition="exists('$(LocalAppData)\Microsoft\VisualStudio\11.0\SecureEnclave.$(Platform).props')" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(LocalAppData)\Microsoft\VisualStudio\12.0\SecureEnclave.$(Platform).props" Condition="exists('$(LocalAppData)\Microsoft\VisualStudio\11.0\SecureEnclave.$(Platform).props')" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(LocalAppData)\Microsoft\VisualStudio\12.0\SecureEnclave.$(Platform).props" Condition="exists('$(LocalAppData)\Microsoft\VisualStudio\11.0\SecureEnclave.$(Platform).props')" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Prerelease|Win32'" Label="PropertySheets">
<Import Project="$(LocalAppData)\Microsoft\VisualStudio\12.0\SecureEnclave.$(Platform).props" Condition="exists('$(LocalAppData)\Microsoft\VisualStudio\11.0\SecureEnclave.$(Platform).props')" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Prerelease|x64'" Label="PropertySheets">
<Import Project="$(LocalAppData)\Microsoft\VisualStudio\12.0\SecureEnclave.$(Platform).props" Condition="exists('$(LocalAppData)\Microsoft\VisualStudio\11.0\SecureEnclave.$(Platform).props')" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Prerelease|Win32'" Label="PropertySheets">
<Import Project="$(LocalAppData)\Microsoft\VisualStudio\12.0\SecureEnclave.$(Platform).props" Condition="exists('$(LocalAppData)\Microsoft\VisualStudio\11.0\SecureEnclave.$(Platform).props')" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Prerelease|x64'" Label="PropertySheets">
<Import Project="$(LocalAppData)\Microsoft\VisualStudio\12.0\SecureEnclave.$(Platform).props" Condition="exists('$(LocalAppData)\Microsoft\VisualStudio\11.0\SecureEnclave.$(Platform).props')" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">
<Import Project="$(LocalAppData)\Microsoft\VisualStudio\12.0\SecureEnclave.$(Platform).props" Condition="exists('$(LocalAppData)\Microsoft\VisualStudio\11.0\SecureEnclave.$(Platform).props')" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'" Label="PropertySheets">
<Import Project="$(LocalAppData)\Microsoft\VisualStudio\12.0\SecureEnclave.$(Platform).props" Condition="exists('$(LocalAppData)\Microsoft\VisualStudio\11.0\SecureEnclave.$(Platform).props')" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IncludePath>$(NoInherit)</IncludePath>
<LibraryPath>$(NoInherit)</LibraryPath>
<IntDir>$(Configuration)\$(Platform)\obj\</IntDir>
<OutDir>$(SolutionDir)$(Configuration)\$(Platform)\</OutDir>
<TargetName>wolfssl</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<IncludePath>$(NoInherit)</IncludePath>
<LibraryPath>$(NoInherit)</LibraryPath>
<OutDir>$(SolutionDir)$(Configuration)\$(Platform)\</OutDir>
<IntDir>$(Configuration)\$(Platform\obj\</IntDir>
<TargetName>wolfssl</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">
<IncludePath>$(NoInherit)</IncludePath>
<LibraryPath>$(NoInherit)</LibraryPath>
<IntDir>$(Configuration)\$(Platform)\obj\</IntDir>
<OutDir>$(SolutionDir)$(Configuration)\$(Platform)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">
<IncludePath>$(NoInherit)</IncludePath>
<LibraryPath>$(NoInherit)</LibraryPath>
<OutDir>$(SolutionDir)$(Configuration)\$(Platform)\</OutDir>
<IntDir>$(Configuration)\$(Platform\obj\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IncludePath>$(NoInherit)</IncludePath>
<LibraryPath>$(NoInherit)</LibraryPath>
<IntDir>$(Configuration)\$(Platform)\obj\</IntDir>
<OutDir>$(SolutionDir)$(Configuration)\$(Platform)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IncludePath>$(NoInherit)</IncludePath>
<LibraryPath>$(NoInherit)</LibraryPath>
<OutDir>$(SolutionDir)$(Configuration)\$(Platform)\</OutDir>
<IntDir>$(Configuration)\$(Platform\obj\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Prerelease|Win32'">
<IncludePath>$(NoInherit)</IncludePath>
<LibraryPath>$(NoInherit)</LibraryPath>
<IntDir>$(Configuration)\$(Platform)\obj\</IntDir>
<OutDir>$(SolutionDir)$(Configuration)\$(Platform)\</OutDir>
<TargetName>wolfssl</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Prerelease|x64'">
<IncludePath>$(NoInherit)</IncludePath>
<LibraryPath>$(NoInherit)</LibraryPath>
<OutDir>$(SolutionDir)$(Configuration)\$(Platform)\</OutDir>
<IntDir>$(Configuration)\$(Platform\obj\</IntDir>
<TargetName>wolfssl</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<Optimization>Disabled</Optimization>
<WarningLevel>Level4</WarningLevel>
<AdditionalIncludeDirectories>../../;$(SGXSDKInstallPath)include;$(SGXSDKInstallPath)include\tlibc;$(SGXSDKInstallPath)include\stlport;$(SolutionDir)wolfssl-3.9.6;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WOLFSSL_LIB;WOLFSSL_SGX</PreprocessorDefinitions>
</ClCompile>
<Lib>
<LinkTimeCodeGeneration>true</LinkTimeCodeGeneration>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<Optimization>Disabled</Optimization>
<WarningLevel>Level4</WarningLevel>
<AdditionalIncludeDirectories>../../;$(SGXSDKInstallPath)include;$(SGXSDKInstallPath)include\tlibc;$(SGXSDKInstallPath)include\stlport;$(SolutionDir)wolfssl-3.9.6;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WOLFSSL_LIB;WOLFSSL_SGX</PreprocessorDefinitions>
</ClCompile>
<Lib>
<LinkTimeCodeGeneration>true</LinkTimeCodeGeneration>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">
<ClCompile>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<Optimization>Disabled</Optimization>
<WarningLevel>Level4</WarningLevel>
<AdditionalIncludeDirectories>../../;$(SGXSDKInstallPath)include;$(SGXSDKInstallPath)include\tlibc;$(SGXSDKInstallPath)include\stlport;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WOLFSSL_LIB;WOLFSSL_SGX</PreprocessorDefinitions>
</ClCompile>
<Lib>
<LinkTimeCodeGeneration>true</LinkTimeCodeGeneration>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">
<ClCompile>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<Optimization>Disabled</Optimization>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>../../;$(SGXSDKInstallPath)include;$(SGXSDKInstallPath)include\tlibc;$(SGXSDKInstallPath)include\stlport;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WOLFSSL_LIB;WOLFSSL_SGX</PreprocessorDefinitions>
</ClCompile>
<Lib>
<LinkTimeCodeGeneration>true</LinkTimeCodeGeneration>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<Optimization>MaxSpeed</Optimization>
<WarningLevel>Level4</WarningLevel>
<AdditionalIncludeDirectories>../../;$(SGXSDKInstallPath)include;$(SGXSDKInstallPath)include\tlibc;$(SGXSDKInstallPath)include\stlport;$(SolutionDir)wolfssl-3.9.6;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PreprocessorDefinitions>WOLFSSL_LIB;WOLFSSL_SGX</PreprocessorDefinitions>
</ClCompile>
<Lib>
<LinkTimeCodeGeneration>true</LinkTimeCodeGeneration>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<Optimization>MaxSpeed</Optimization>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>../../;$(SGXSDKInstallPath)include;$(SGXSDKInstallPath)include\tlibc;$(SGXSDKInstallPath)include\stlport;$(SolutionDir)wolfssl-3.9.6;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PreprocessorDefinitions>WOLFSSL_LIB;WOLFSSL_SGX</PreprocessorDefinitions>
</ClCompile>
<Lib>
<LinkTimeCodeGeneration>true</LinkTimeCodeGeneration>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Prerelease|Win32'">
<ClCompile>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<Optimization>MaxSpeed</Optimization>
<WarningLevel>Level4</WarningLevel>
<AdditionalIncludeDirectories>../../;$(SGXSDKInstallPath)include;$(SGXSDKInstallPath)include\tlibc;$(SGXSDKInstallPath)include\stlport;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PreprocessorDefinitions>WOLFSSL_LIB;WOLFSSL_SGX</PreprocessorDefinitions>
</ClCompile>
<Lib>
<LinkTimeCodeGeneration>true</LinkTimeCodeGeneration>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Prerelease|x64'">
<ClCompile>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<Optimization>MaxSpeed</Optimization>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>../../;$(SGXSDKInstallPath)include;$(SGXSDKInstallPath)include\tlibc;$(SGXSDKInstallPath)include\stlport;$(SolutionDir)wolfssl-3.9.6;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PreprocessorDefinitions>WOLFSSL_LIB;WOLFSSL_SGX</PreprocessorDefinitions>
</ClCompile>
<Lib>
<LinkTimeCodeGeneration>true</LinkTimeCodeGeneration>
</Lib>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="wolfSSLEnclaveLib_t.h" />
</ItemGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\wolfcrypt\src\aes.c" />
<ClCompile Include="..\..\wolfcrypt\src\asn.c" />
<ClCompile Include="..\..\wolfcrypt\src\hash.c" />
<ClCompile Include="..\..\wolfcrypt\src\hmac.c">
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..;$(SGXSDKInstallPath)include;$(SGXSDKInstallPath)include\tlibc;$(SGXSDKInstallPath)include\stlport;$(SolutionDir)wolfssl-3.9.6;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">..\..;$(SGXSDKInstallPath)include;$(SGXSDKInstallPath)include\tlibc;$(SGXSDKInstallPath)include\stlport;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Prerelease|x64'">..\..;$(SGXSDKInstallPath)include;$(SGXSDKInstallPath)include\tlibc;$(SGXSDKInstallPath)include\stlport;$(SolutionDir)wolfssl-3.9.6;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..;$(SGXSDKInstallPath)include;$(SGXSDKInstallPath)include\tlibc;$(SGXSDKInstallPath)include\stlport;$(SolutionDir)wolfssl-3.9.6;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<ClCompile Include="..\..\wolfcrypt\src\memory.c" />
<ClCompile Include="..\..\wolfcrypt\src\pwdbased.c" />
<ClCompile Include="..\..\wolfcrypt\src\random.c" />
<ClCompile Include="..\..\wolfcrypt\src\rsa.c" />
<ClCompile Include="..\..\wolfcrypt\src\sha256.c" />
<ClCompile Include="..\..\wolfcrypt\src\tfm.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Generated Files">
<UniqueIdentifier>{750b7ded-415e-41ff-a260-cdeed365e21c}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files">
<UniqueIdentifier>{14d1a4f3-1b3b-4e74-be2c-af4e52bd5c11}</UniqueIdentifier>
<Extensions>cpp;c;edl;def; .. and other options</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{22d38e35-4cca-4899-9551-3809351f7aa5}</UniqueIdentifier>
<Extensions>h;hpp; .. and other options</Extensions>
</Filter>
<Filter Include="Source Files\Resource Files">
<UniqueIdentifier>{e5d0cd71-716c-402b-a23c-4a161912a7b1}</UniqueIdentifier>
<Extensions>rc;xml;pem; .. and other options</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="wolfSSLEnclaveLib_t.h">
<Filter>Generated Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\wolfcrypt\src\hmac.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\wolfcrypt\src\rsa.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\wolfcrypt\src\sha256.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\wolfcrypt\src\aes.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\wolfcrypt\src\asn.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\wolfcrypt\src\hash.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\wolfcrypt\src\pwdbased.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\wolfcrypt\src\tfm.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\wolfcrypt\src\memory.c" />
<ClCompile Include="..\..\wolfcrypt\src\random.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@ -4,6 +4,7 @@
include IDE/iOS/include.am
include IDE/WIN/include.am
include IDE/WIN-SGX/include.am
include IDE/WORKBENCH/include.am
include IDE/ROWLEY-CROSSWORKS-ARM/include.am
include IDE/ARDUINO/include.am

View File

@ -135,7 +135,9 @@ int wc_FreeRng(WC_RNG* rng)
#endif
#endif /* HAVE_HASHDRBG || NO_RC4 */
#if defined(USE_WINDOWS_API)
#if defined(WOLFSSL_SGX)
#include <sgx_trts.h>
#elif defined(USE_WINDOWS_API)
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0400
#endif
@ -1167,6 +1169,20 @@ static int wc_GenerateRand_IntelRD(OS_Seed* os, byte* output, word32 sz)
return CUSTOM_RAND_GENERATE_SEED_OS(os, output, sz);
}
#elif defined(WOLFSSL_SGX)
int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
{
int ret = !SGX_SUCCESS;
int i, read_max = 10;
for (i = 0; i < read_max && ret != SGX_SUCCESS; i++) {
ret = sgx_read_rand(output, sz);
}
(void)os;
return (ret == SGX_SUCCESS) ? 0 : 1;
}
#elif defined(USE_WINDOWS_API)

View File

@ -1226,6 +1226,20 @@ static char *fgets(char *buff, int sz, FILE *fp)
#endif
#endif
#ifdef WOLFSSL_SGX
#define WOLFCRYPT_ONLY /* limitation until IO resolved */
#define SINGLE_THREADED
#define NO_ASN_TIME /* can not use headers such as windows.h */
/* options used in created example */
#define HAVE_AESGCM
#define USE_CERT_BUFFERS_2048
#define USE_FAST_MATH
#define NO_RC4
#define NO_DES3
#define NO_SHA
#define NO_MD5
#endif /* WOLFSSL_SGX */
/* FreeScale MMCAU hardware crypto has 4 byte alignment.
However, fsl_mmcau.h gives API with no alignment requirements (4 byte alignment is managed internally by fsl_mmcau.c) */

View File

@ -132,18 +132,18 @@
#endif
/* set up rotate style */
#if defined(_MSC_VER) || defined(__BCPLUSPLUS__)
#define INTEL_INTRINSICS
#define FAST_ROTATE
#elif defined(__MWERKS__) && TARGET_CPU_PPC
#define PPC_INTRINSICS
#define FAST_ROTATE
#elif defined(__GNUC__) && defined(__i386__)
/* GCC does peephole optimizations which should result in using rotate
instructions */
#define FAST_ROTATE
#endif
/* set up rotate style */
#if (defined(_MSC_VER) || defined(__BCPLUSPLUS__)) && !defined(WOLFSSL_SGX)
#define INTEL_INTRINSICS
#define FAST_ROTATE
#elif defined(__MWERKS__) && TARGET_CPU_PPC
#define PPC_INTRINSICS
#define FAST_ROTATE
#elif defined(__GNUC__) && defined(__i386__)
/* GCC does peephole optimizations which should result in using rotate
instructions */
#define FAST_ROTATE
#endif
/* set up thread local storage if available */

View File

@ -38,12 +38,14 @@
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#ifndef WOLFCRYPT_ONLY
#if defined(_WIN32_WCE) || defined(WIN32_LEAN_AND_MEAN)
/* On WinCE winsock2.h must be included before windows.h */
#include <winsock2.h>
#endif
#include <windows.h>
#endif
#endif /* WOLFCRYPT_ONLY */
#elif defined(THREADX)
#ifndef SINGLE_THREADED
#include "tx_api.h"