Skip to content

Commit

Permalink
Add Code Signing (#111)
Browse files Browse the repository at this point in the history
* Update OpenSSL
* Move soup exe to sub folder
* Add signing scripts
  • Loading branch information
mwasplund authored Jan 4, 2022
1 parent 243d341 commit 9a0dd28
Show file tree
Hide file tree
Showing 27 changed files with 111 additions and 110 deletions.
2 changes: 1 addition & 1 deletion Dependencies/openssl
Submodule openssl updated 8266 files
6 changes: 3 additions & 3 deletions Docs/Developer-Setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* [Latest Release](https://github.com/mwasplund/Soup/releases)

### OpenSSL Requirements
* Perl. We recommend Strawberry http://strawberryperl.com/
* Perl. We recommend Strawberry https://strawberryperl.com/download/5.30.3.1/strawberry-perl-5.30.3.1-64bit.msi
* Netwide Assembler, a.k.a. NASM, available from https://www.nasm.us

## Setup
Expand All @@ -22,10 +22,10 @@ git clone --recursive https://github.com/mwasplund/Soup.git
## Build

### Build openssl
using x64 Native Tools Command Prompt for VS 2019
using x64 Native Tools Command Prompt for VS 2022
```
cd Dependencies/openssl
PATH=%PATH%;"C:\Program Files\NASM"
PATH=%PATH%;"C:\NASM"
perl Configure VC-WIN64A
nmake
nmake test
Expand Down
2 changes: 1 addition & 1 deletion Docs/Samples/CSharp/Build-Extension.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Source = [
[Dependencies]
Runtime = [
{ Reference = "[email protected]", ExcludeRuntime = true },
{ Reference = "[email protected].7" },
{ Reference = "[email protected].8" },
{ Reference = "[email protected]" },
]
```
Expand Down
2 changes: 1 addition & 1 deletion Docs/Samples/Cpp/Build-Extension.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Source = [
[Dependencies]
Runtime = [
{ Reference = "[email protected]", ExcludeRuntime = true },
{ Reference = "[email protected].7" },
{ Reference = "[email protected].8" },
{ Reference = "[email protected]" },
]
```
Expand Down
2 changes: 1 addition & 1 deletion Samples/CSharp/BuildExtension/Extension/Recipe.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ Source = [
[Dependencies]
Runtime = [
{ Reference = "[email protected]", ExcludeRuntime = true },
{ Reference = "[email protected].7" },
{ Reference = "[email protected].8" },
{ Reference = "[email protected]" },
]
2 changes: 1 addition & 1 deletion Samples/Cpp/BuildExtension/Extension/Recipe.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ Source = [
[Dependencies]
Runtime = [
{ Reference = "[email protected]", ExcludeRuntime = true },
{ Reference = "[email protected].7" },
{ Reference = "[email protected].8" },
{ Reference = "[email protected]" },
]
4 changes: 4 additions & 0 deletions Scripts/Install/soup.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@echo off
SET ScriptsDir=%~dp0

"%ScriptsDir%\Soup\soup.exe" %*
9 changes: 9 additions & 0 deletions Scripts/SignInstaller.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@echo off
SET ScriptsDir=%~dp0
SET SourceDir=%ScriptsDir%..\Source
SET InstallerDir=%SourceDir%\Installer\SoupInstaller\msi

SET CertPath=[SECRET]
SET Password=[SECRET]

signtool sign /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /f %CertPath% /p %Password% %InstallerDir%\*.msi
19 changes: 19 additions & 0 deletions Scripts/SignRuntime.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@echo off
SET ScriptsDir=%~dp0
SET RootDir=%ScriptsDir%..
SET OutDir=%RootDir%\out
SET RunDir=%OutDir%\run

SET CertPath=[SECRET]
SET Password=[SECRET]

signtool sign /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /f %CertPath% /p %Password% %RunDir%\Soup\*.dll
signtool sign /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /f %CertPath% /p %Password% %RunDir%\Soup\*.exe
signtool sign /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /f %CertPath% /p %Password% %RunDir%\Soup\Generate\*.dll
signtool sign /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /f %CertPath% /p %Password% %RunDir%\Soup\Generate\*.exe
signtool sign /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /f %CertPath% /p %Password% %RunDir%\Soup\Generate\Extensions\Soup.Cpp\*.dll
signtool sign /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /f %CertPath% /p %Password% %RunDir%\Soup\Generate\Extensions\Soup.CSharp\*.dll
signtool sign /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /f %CertPath% /p %Password% %RunDir%\Soup\PackageManager\*.dll
signtool sign /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /f %CertPath% /p %Password% %RunDir%\Soup\PackageManager\*.exe
signtool sign /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /f %CertPath% /p %Password% %RunDir%\Swhere\*.dll
signtool sign /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /f %CertPath% /p %Password% %RunDir%\Swhere\*.exe
14 changes: 7 additions & 7 deletions Scripts/soup.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ SET RootDir=%ScriptsDir%..
SET OutDir=%RootDir%\out
SET RunDir=%OutDir%\run
REM - Use a copy of the final binary in case we are re-buiding itself
robocopy %OutDir%\C++\Soup\1281a639dd5d393781f4188942c6bc05544b7c2c0124eae4cc59236248e36\bin\ %RunDir%\ /MIR /NJH /NJS /NDL > NUL
robocopy %ScriptsDir%\Install\ %RunDir%\ /NJH /NJS /NDL > NUL
robocopy %OutDir%\msbuild\bin\Soup.Build.Generate\Release\net5.0\ %RunDir%\Generate\ /MIR /NJH /NJS /NDL > NUL
robocopy %OutDir%\C#\Soup.Cpp\1281a639dd5d393781f4188942c6bc05544b7c2c0124eae4cc59236248e36\bin %RunDir%\Generate\Extensions\Soup.Cpp\ /MIR /NJH /NJS /NDL > NUL
robocopy %OutDir%\C#\Soup.CSharp\1281a639dd5d393781f4188942c6bc05544b7c2c0124eae4cc59236248e36\bin %RunDir%\Generate\Extensions\Soup.CSharp\ /MIR /NJH /NJS /NDL > NUL
robocopy %OutDir%\msbuild\bin\Soup.Build.PackageManager\Release\net5-windows10.0.17763.0\ %RunDir%\PackageManager\ /MIR /NJH /NJS /NDL > NUL
robocopy %ScriptsDir%\Install\ %RunDir%\ /MIR /NJH /NJS /NDL > NUL
robocopy %OutDir%\C++\Soup\1281a639dd5d393781f4188942c6bc05544b7c2c0124eae4cc59236248e36\bin\ %RunDir%\Soup\ /MIR /NJH /NJS /NDL > NUL
robocopy %OutDir%\msbuild\bin\Soup.Build.Generate\Release\net5.0\ %RunDir%\Soup\Generate\ /MIR /NJH /NJS /NDL > NUL
robocopy %OutDir%\C#\Soup.Cpp\1281a639dd5d393781f4188942c6bc05544b7c2c0124eae4cc59236248e36\bin %RunDir%\Soup\Generate\Extensions\Soup.Cpp\ /MIR /NJH /NJS /NDL > NUL
robocopy %OutDir%\C#\Soup.CSharp\1281a639dd5d393781f4188942c6bc05544b7c2c0124eae4cc59236248e36\bin %RunDir%\Soup\Generate\Extensions\Soup.CSharp\ /MIR /NJH /NJS /NDL > NUL
robocopy %OutDir%\msbuild\bin\Soup.Build.PackageManager\Release\net5-windows10.0.17763.0\ %RunDir%\Soup\PackageManager\ /MIR /NJH /NJS /NDL > NUL
robocopy %OutDir%\msbuild\bin\Swhere\Release\net5-windows10.0.17763.0\ %RunDir%\Swhere\ /MIR /NJH /NJS /NDL > NUL
%RunDir%\Soup.exe %*
%RunDir%\Soup.cmd %*
14 changes: 7 additions & 7 deletions Scripts/soupd.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ SET RootDir=%ScriptsDir%..
SET OutDir=%RootDir%\out
SET RunDir=%OutDir%\run
REM - Use a copy of the final binary in case we are re-buiding itself
robocopy %OutDir%\C++\Soup\3d80717e7d2695f0a7aa5c38e2849624beeaa5714331ca96898fe4b8b8023fe\bin\ %RunDir%\ /MIR /NJH /NJS /NDL > NUL
robocopy %ScriptsDir%\Install\ %RunDir%\ /NJH /NJS /NDL > NUL
robocopy %OutDir%\msbuild\bin\Soup.Build.Generate\Debug\net5.0\ %RunDir%\Generate\ /MIR /NJH /NJS /NDL > NUL
robocopy %OutDir%\C#\Soup.Cpp\3d80717e7d2695f0a7aa5c38e2849624beeaa5714331ca96898fe4b8b8023fe\bin %RunDir%\Generate\Extensions\Soup.Cpp\ /MIR /NJH /NJS /NDL > NUL
robocopy %OutDir%\C#\Soup.CSharp\3d80717e7d2695f0a7aa5c38e2849624beeaa5714331ca96898fe4b8b8023fe\bin %RunDir%\Generate\Extensions\Soup.CSharp\ /MIR /NJH /NJS /NDL > NUL
robocopy %OutDir%\msbuild\bin\Soup.Build.PackageManager\Debug\net5-windows10.0.17763.0\ %RunDir%\PackageManager\ /MIR /NJH /NJS /NDL > NUL
robocopy %ScriptsDir%\Install\ %RunDir%\ /MIR /NJH /NJS /NDL > NUL
robocopy %OutDir%\C++\Soup\3d80717e7d2695f0a7aa5c38e2849624beeaa5714331ca96898fe4b8b8023fe\bin\ %RunDir%\Soup\ /MIR /NJH /NJS /NDL > NUL
robocopy %OutDir%\msbuild\bin\Soup.Build.Generate\Debug\net5.0\ %RunDir%\Soup\Generate\ /MIR /NJH /NJS /NDL > NUL
robocopy %OutDir%\C#\Soup.Cpp\3d80717e7d2695f0a7aa5c38e2849624beeaa5714331ca96898fe4b8b8023fe\bin %RunDir%\Soup\Generate\Extensions\Soup.Cpp\ /MIR /NJH /NJS /NDL > NUL
robocopy %OutDir%\C#\Soup.CSharp\3d80717e7d2695f0a7aa5c38e2849624beeaa5714331ca96898fe4b8b8023fe\bin %RunDir%\Soup\Generate\Extensions\Soup.CSharp\ /MIR /NJH /NJS /NDL > NUL
robocopy %OutDir%\msbuild\bin\Soup.Build.PackageManager\Debug\net5-windows10.0.17763.0\ %RunDir%\Soup\PackageManager\ /MIR /NJH /NJS /NDL > NUL
robocopy %OutDir%\msbuild\bin\Swhere\Debug\net5-windows10.0.17763.0\ %RunDir%\Swhere\ /MIR /NJH /NJS /NDL > NUL
%RunDir%\Soup.exe %*
%RunDir%\Soup.cmd %*
2 changes: 1 addition & 1 deletion Source/Client/CLI/Recipe.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Name = "Soup"
Language = "C++"
Version = "0.16.0"
Version = "0.16.1"
Type = "Executable"

Source = [
Expand Down
2 changes: 1 addition & 1 deletion Source/Client/CLI/Source/Commands/VersionCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace Soup::Client

// TODO var version = Assembly.GetExecutingAssembly().GetName().Version;
// Log::Message($"{version.Major}.{version.Minor}.{version.Build}");
Log::HighPriority("0.16.0");
Log::HighPriority("0.16.2");
}

private:
Expand Down
4 changes: 2 additions & 2 deletions Source/Client/Core/Recipe.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ LinkLibraries = [
]
RuntimeDependencies = [
# Copy the dynamic libraries
"../../../Dependencies/OpenSSL/libcrypto-3.dll",
"../../../Dependencies/OpenSSL/libssl-3.dll",
"../../../Dependencies/OpenSSL/libcrypto-3-x64.dll",
"../../../Dependencies/OpenSSL/libssl-3-x64.dll",
]

[Dependencies]
Expand Down
2 changes: 1 addition & 1 deletion Source/GenerateSharp/Build.Extensions/Recipe.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Name = "Soup.Build.Extensions"
Language = "C#"
Version = "0.1.7"
Version = "0.1.8"
Source = [
"BuildOperation.cs",
"IBuildStateExtensions.cs",
Expand Down
4 changes: 2 additions & 2 deletions Source/GenerateSharp/Build.Extensions/SharedOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static BuildOperation CreateCopyFileOperation(
var title = $"Copy [{source}] -> [{destination}]";

var moduleName = LifetimeManager.Get<IProcessManager>().GetCurrentProcessFileName();
var moduleFolder = moduleName.GetParent().GetParent();
var moduleFolder = moduleName.GetParent().GetParent().GetParent().GetParent();

var program = moduleFolder + new Path("copy.exe");
var inputFiles = new List<Path>()
Expand Down Expand Up @@ -62,7 +62,7 @@ public static BuildOperation CreateCreateDirectoryOperation(
var title = $"MakeDir [{directory}]";

var moduleName = LifetimeManager.Get<IProcessManager>().GetCurrentProcessFileName();
var moduleFolder = moduleName.GetParent().GetParent();
var moduleFolder = moduleName.GetParent().GetParent().GetParent().GetParent();

var program = moduleFolder + new Path("mkdir.exe");
var inputFiles = new List<Path>()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Name = "Soup.CSharp.Compiler"
Language = "C#"
Version = "0.1.4"
Version = "0.1.5"
Source = [
"BuildArguments.cs",
"BuildEngine.cs",
Expand All @@ -14,5 +14,5 @@ Source = [
Runtime = [
{ Reference = "[email protected]" },
{ Reference = "[email protected]", ExcludeRuntime = true },
{ Reference = "[email protected].7" },
{ Reference = "[email protected].8" },
]
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Name = "Soup.CSharp.Compiler.Roslyn"
Language = "C#"
Version = "0.1.5"
Version = "0.1.6"
Source = [
"ArgumentBuilder.cs",
"Compiler.cs",
Expand All @@ -9,6 +9,6 @@ Source = [
[Dependencies]
Runtime = [
"[email protected]",
"[email protected].4",
"[email protected].7",
"[email protected].5",
"[email protected].8",
]
6 changes: 3 additions & 3 deletions Source/GenerateSharp/Extensions/CSharp/Extension/Recipe.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Source = [
Runtime = [
{ Reference = "[email protected]" },
{ Reference = "[email protected]", ExcludeRuntime = true },
{ Reference = "[email protected].7" },
{ Reference = "[email protected].4" },
{ Reference = "[email protected].5" },
{ Reference = "[email protected].8" },
{ Reference = "[email protected].5" },
{ Reference = "[email protected].6" },
]
4 changes: 2 additions & 2 deletions Source/GenerateSharp/Extensions/Cpp/Compiler/Core/Recipe.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Name = "Soup.Cpp.Compiler"
Language = "C#"
Version = "0.1.5"
Version = "0.1.6"
Source = [
"BuildArguments.cs",
"BuildEngine.cs",
Expand All @@ -15,5 +15,5 @@ Source = [
Runtime = [
{ Reference = "[email protected]" },
{ Reference = "[email protected]", ExcludeRuntime = true },
{ Reference = "[email protected].7" },
{ Reference = "[email protected].8" },
]
6 changes: 3 additions & 3 deletions Source/GenerateSharp/Extensions/Cpp/Compiler/MSVC/Recipe.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Name = "Soup.Cpp.Compiler.MSVC"
Language = "C#"
Version = "0.1.6"
Version = "0.1.7"
Source = [
"ArgumentBuilder.cs",
"Compiler.cs",
Expand All @@ -9,6 +9,6 @@ Source = [
[Dependencies]
Runtime = [
"[email protected]",
"[email protected].5",
"[email protected].7",
"[email protected].6",
"[email protected].8",
]
6 changes: 3 additions & 3 deletions Source/GenerateSharp/Extensions/Cpp/Extension/Recipe.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Source = [
Runtime = [
{ Reference = "[email protected]" },
{ Reference = "[email protected]", ExcludeRuntime = true },
{ Reference = "[email protected].7" },
{ Reference = "[email protected].5" },
{ Reference = "[email protected].6" },
{ Reference = "[email protected].8" },
{ Reference = "[email protected].6" },
{ Reference = "[email protected].7" },
]
6 changes: 3 additions & 3 deletions Source/Installer/SoupInstaller/App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
</configuration>
</configuration>
2 changes: 1 addition & 1 deletion Source/Installer/SoupInstaller/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SoupInstaller")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand Down
58 changes: 27 additions & 31 deletions Source/Installer/SoupInstaller/Setup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,47 +5,43 @@ class Script
{
static public void Main()
{
var soupScriptsFolder = @"..\..\..\Scripts\Install\";
var soupBinFolder = @"..\..\..\out\C++\Soup\1281a639dd5d393781f4188942c6bc05544b7c2c0124eae4cc59236248e36\bin\";
var soupExtensionCppBinFolder = @"..\..\..\out\C#\Soup.Cpp\1281a639dd5d393781f4188942c6bc05544b7c2c0124eae4cc59236248e36\bin\";
var soupExtensionCSharpBinFolder = @"..\..\..\out\C#\Soup.CSharp\1281a639dd5d393781f4188942c6bc05544b7c2c0124eae4cc59236248e36\bin\";
var soupBinGenerateFolder = @"..\..\..\out\msbuild\bin\Soup.Build.Generate\Release\net5.0\";
var soupBinPackageManagerFolder = @"..\..\..\out\msbuild\bin\Soup.Build.PackageManager\Release\net5-windows10.0.17763.0\";
var soupBinSwhereFolder = @"..\..\..\out\msbuild\bin\Swhere\Release\net5-windows10.0.17763.0\";
var soupRunFolder = @"../../../out/run";
var project = new Project(
"Soup Build",
new Dir(
@"%ProgramFiles%\SoupBuild\Soup",
new DirFiles(System.IO.Path.Combine(soupScriptsFolder, "*.*")),
new DirFiles(System.IO.Path.Combine(soupBinFolder, "*.*")),
new DirFiles($"{soupRunFolder}/*.*"),
new Dir(
@"Generate",
new DirFiles(System.IO.Path.Combine(soupBinGenerateFolder, "*.*")),
@"Soup",
new DirFiles($"{soupRunFolder}/Soup/*.*"),
new Dir(
@"Extensions",
@"Generate",
new DirFiles($"{soupRunFolder}/Soup/Generate/*.*"),
new Dir(
@"Soup.Cpp",
new DirFiles(System.IO.Path.Combine(soupExtensionCppBinFolder, "*.*"))),
new Dir(
@"Soup.CSharp",
new DirFiles(System.IO.Path.Combine(soupExtensionCSharpBinFolder, "*.*"))))),
new Dir(
@"PackageManager",
new DirFiles(System.IO.Path.Combine(soupBinPackageManagerFolder, "*.*")),
@"Extensions",
new Dir(
@"Soup.Cpp",
new DirFiles($"{soupRunFolder}/Soup/Generate/Extensions/Soup.Cpp/*.*")),
new Dir(
@"Soup.CSharp",
new DirFiles($"{soupRunFolder}/Soup/Generate/Extensions/Soup.CSharp/*.*")))),
new Dir(
@"runtimes",
new Dir(
@"win-arm64\native",
new DirFiles(System.IO.Path.Combine(soupBinPackageManagerFolder, @"runtimes\win-arm64\native\", "*.*"))),
new Dir(
@"win-x64\native",
new DirFiles(System.IO.Path.Combine(soupBinPackageManagerFolder, @"runtimes\win-x64\native\", "*.*"))),
@"PackageManager",
new DirFiles($"{soupRunFolder}/Soup/PackageManager/*.*"),
new Dir(
@"win-x86\native",
new DirFiles(System.IO.Path.Combine(soupBinPackageManagerFolder, @"runtimes\win-x86\native\", "*.*"))))),
@"runtimes",
new Dir(
@"win-arm64\native",
new DirFiles($"{soupRunFolder}/Soup/PackageManager/runtimes/win-arm64/native/*.*")),
new Dir(
@"win-x64\native",
new DirFiles($"{soupRunFolder}/Soup/PackageManager/runtimes/win-x64/native/*.*")),
new Dir(
@"win-x86\native",
new DirFiles($"{soupRunFolder}/Soup/PackageManager/runtimes/win-x86/native/*.*"))))),
new Dir(
@"Swhere",
new DirFiles(System.IO.Path.Combine(soupBinSwhereFolder, "*.*")))),
new DirFiles($"{soupRunFolder}/Swhere/*.*"))),
new EnvironmentVariable("PATH", "[INSTALLDIR]")
{
System = true,
Expand All @@ -69,7 +65,7 @@ static public void Main()
};

// Upgrade values
project.Version = new Version(0, 16, 0);
project.Version = new Version(0, 16, 2);

Compiler.BuildMsi(project);
}
Expand Down
Loading

0 comments on commit 9a0dd28

Please sign in to comment.