Skip to content

Commit

Permalink
Windows: Split assembly language components into seperate static lib.
Browse files Browse the repository at this point in the history
  • Loading branch information
briansmith committed Aug 15, 2016
1 parent 078d3c2 commit f8bb867
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 41 deletions.
2 changes: 2 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ fn build_c_code(out_dir: &str) -> Result<(), std::env::VarError> {
format!("/p:Configuration={}", configuration),
format!("/p:OutRootDir={}/", out_dir),
];

println!("cargo:rustc-link-lib=static={}-asm", LIB_NAME);
}

if !std::process::Command::new(command_name)
Expand Down
60 changes: 60 additions & 0 deletions crypto/libring-asm.Windows.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="GenerateAsm;Build" ToolsVersion="14.0"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals">
<ProjectGuid>{5A09BA1C-748F-40A2-B7F0-8108A08FE6A8}</ProjectGuid>
<ProjectName>libring-asm.Windows</ProjectName>
<TargetName>ring-asm</TargetName>
</PropertyGroup>
<PropertyGroup Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
</PropertyGroup>
<ImportGroup Label="PropertySheets">
<Import Project="..\mk\Windows.props" />
</ImportGroup>
<PropertyGroup Label="Configuration">
<OutDir>$(OutRootDir)lib\</OutDir>
</PropertyGroup>
<ItemGroup Condition="'$(ProcessorArchitecture)' == 'x86'">
<PerlAsm Include="aes/asm/aes-586.pl" />
<PerlAsm Include="aes/asm/aesni-x86.pl" />
<PerlAsm Include="aes/asm/vpaes-x86.pl" />
<PerlAsm Include="bn/asm/x86-mont.pl" />
<PerlAsm Include="chacha/asm/chacha-x86.pl" />
<PerlAsm Include="ec/asm/ecp_nistz256-x86.pl" />
<PerlAsm Include="modes/asm/ghash-x86.pl" />
<PerlAsm Include="poly1305/asm/poly1305-x86.pl" />
<PerlAsm Include="sha/asm/sha256-586.pl" />
<PerlAsm Include="sha/asm/sha512-586.pl" />
</ItemGroup>
<ItemGroup Condition="'$(ProcessorArchitecture)' == 'amd64'">
<PerlAsm Include="aes/asm/aes-x86_64.pl" />
<PerlAsm Include="aes/asm/aesni-x86_64.pl" />
<PerlAsm Include="aes/asm/bsaes-x86_64.pl" />
<PerlAsm Include="aes/asm/vpaes-x86_64.pl" />
<PerlAsm Include="bn/asm/rsaz-avx2.pl" />
<PerlAsm Include="bn/asm/x86_64-mont.pl" />
<PerlAsm Include="bn/asm/x86_64-mont5.pl" />
<PerlAsm Include="chacha/asm/chacha-x86_64.pl" />
<!-- XXX: curve25519/asm/x25519-asm-x86_64.S doesn't support Windows. -->
<PerlAsm Include="ec/asm/ecp_nistz256-x86_64.pl" />
<PerlAsm Include="ec/asm/p256-x86_64-asm.pl" />
<PerlAsm Include="modes/asm/aesni-gcm-x86_64.pl" />
<PerlAsm Include="modes/asm/ghash-x86_64.pl" />
<PerlAsm Include="poly1305/asm/poly1305-x86_64.pl" />
<PerlAsm Include="sha/asm/sha256-x86_64.pl">
<AdditionalDependencies>sha/asm/sha-x86_64.pl</AdditionalDependencies>
</PerlAsm>
<PerlAsm Include="sha/asm/sha512-x86_64.pl">
<AdditionalDependencies>sha/asm/sha-x86_64.pl</AdditionalDependencies>
</PerlAsm>
</ItemGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\include</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<Import Project="..\mk\perlasm-msbuild.targets" />
</Project>
42 changes: 2 additions & 40 deletions crypto/libring.Windows.vcxproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="GenerateAsm;Build" ToolsVersion="14.0"
<Project DefaultTargets="Build" ToolsVersion="14.0"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals">
<ProjectGuid>{F4C0A1B6-5E09-41C8-8242-3E1F6762FB18}</ProjectGuid>
Expand Down Expand Up @@ -64,49 +64,11 @@
<ClInclude Include="rand\internal.h" />
<ClInclude Include="rsa\internal.h" />
</ItemGroup>
<ItemGroup Condition="'$(ProcessorArchitecture)' == 'x86'">
<PerlAsm Include="aes/asm/aes-586.pl" />
<PerlAsm Include="aes/asm/aesni-x86.pl" />
<PerlAsm Include="aes/asm/vpaes-x86.pl" />
<PerlAsm Include="bn/asm/x86-mont.pl" />
<PerlAsm Include="chacha/asm/chacha-x86.pl" />
<PerlAsm Include="ec/asm/ecp_nistz256-x86.pl" />
<PerlAsm Include="modes/asm/ghash-x86.pl" />
<PerlAsm Include="poly1305/asm/poly1305-x86.pl" />
<PerlAsm Include="sha/asm/sha256-586.pl" />
<PerlAsm Include="sha/asm/sha512-586.pl" />
</ItemGroup>
<ItemGroup Condition="'$(ProcessorArchitecture)' == 'amd64'">
<PerlAsm Include="aes/asm/aes-x86_64.pl" />
<PerlAsm Include="aes/asm/aesni-x86_64.pl" />
<PerlAsm Include="aes/asm/bsaes-x86_64.pl" />
<PerlAsm Include="aes/asm/vpaes-x86_64.pl" />
<PerlAsm Include="bn/asm/rsaz-avx2.pl" />
<PerlAsm Include="bn/asm/x86_64-mont.pl" />
<PerlAsm Include="bn/asm/x86_64-mont5.pl" />
<PerlAsm Include="chacha/asm/chacha-x86_64.pl" />
<!-- XXX: curve25519/asm/x25519-asm-x86_64.S doesn't support Windows. -->
<ClCompile Include="curve25519\x25519-x86_64.c" />
<PerlAsm Include="ec/asm/ecp_nistz256-x86_64.pl" />
<PerlAsm Include="ec/asm/p256-x86_64-asm.pl" />
<PerlAsm Include="modes/asm/aesni-gcm-x86_64.pl" />
<PerlAsm Include="modes/asm/ghash-x86_64.pl" />
<PerlAsm Include="poly1305/asm/poly1305-x86_64.pl" />
<PerlAsm Include="sha/asm/sha256-x86_64.pl">
<AdditionalDependencies>sha/asm/sha-x86_64.pl</AdditionalDependencies>
</PerlAsm>
<PerlAsm Include="sha/asm/sha512-x86_64.pl">
<AdditionalDependencies>sha/asm/sha-x86_64.pl</AdditionalDependencies>
</PerlAsm>
</ItemGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\include</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\mk\perlasm-msbuild.targets" />
</ImportGroup>
</Project>
</Project>
12 changes: 11 additions & 1 deletion ring.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 12.0.21005.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libring.Windows", "crypto\libring.Windows.vcxproj", "{F4C0A1B6-5E09-41C8-8242-3E1F6762FB18}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libring-test.Windows", "crypto\libring-test.Windows.vcxproj", "{1DACE503-6498-492D-B1FF-F9EE18624443}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libring-asm.Windows", "crypto\libring-asm.Windows.vcxproj", "{5A09BA1C-748F-40A2-B7F0-8108A08FE6A8}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtest.Windows", "crypto\libring-test.Windows.vcxproj", "{1DACE503-6498-492D-B1FF-F9EE18624443}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -31,6 +33,14 @@ Global
{1DACE503-6498-492D-B1FF-F9EE18624443}.Release|Win32.Build.0 = Release|Win32
{1DACE503-6498-492D-B1FF-F9EE18624443}.Release|x64.ActiveCfg = Release|x64
{1DACE503-6498-492D-B1FF-F9EE18624443}.Release|x64.Build.0 = Release|x64
{5A09BA1C-748F-40A2-B7F0-8108A08FE6A8}.Debug|Win32.ActiveCfg = Debug|Win32
{5A09BA1C-748F-40A2-B7F0-8108A08FE6A8}.Debug|Win32.Build.0 = Debug|Win32
{5A09BA1C-748F-40A2-B7F0-8108A08FE6A8}.Debug|x64.ActiveCfg = Debug|x64
{5A09BA1C-748F-40A2-B7F0-8108A08FE6A8}.Debug|x64.Build.0 = Debug|x64
{5A09BA1C-748F-40A2-B7F0-8108A08FE6A8}.Release|Win32.ActiveCfg = Release|Win32
{5A09BA1C-748F-40A2-B7F0-8108A08FE6A8}.Release|Win32.Build.0 = Release|Win32
{5A09BA1C-748F-40A2-B7F0-8108A08FE6A8}.Release|x64.ActiveCfg = Release|x64
{5A09BA1C-748F-40A2-B7F0-8108A08FE6A8}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down

0 comments on commit f8bb867

Please sign in to comment.