Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
werasik2aa authored Nov 24, 2023
1 parent 0fffe22 commit 58dc19d
Show file tree
Hide file tree
Showing 7 changed files with 139 additions and 41 deletions.
23 changes: 20 additions & 3 deletions SPDVbmetaSigner/CORE.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public static List<string> ReadAllPartitions()
{
if (index - pattern.Length - 16 > 0)
{
string rawhex = readedfileHex.Substring(index - pattern.Length - 16, 32).Trim('0');
string rawhex = readedfileHex.Substring(index - pattern.Length - 20, 34).Trim('0');
string text = Encoding.ASCII.GetString(HexStringToBytes(rawhex));
text = Regex.Replace(text, "(?i)[^А-ЯЁA-Z_]", string.Empty);
if (text.Length >= 3 && !string.IsNullOrWhiteSpace(text) && !string.IsNullOrEmpty(text) && !text.Contains("AVB"))
Expand All @@ -225,9 +225,26 @@ public static void KeyGenMeta(int rsalen = 4096)
string subcommand = AvbCmd + "extract_public_key --key Tools\\rsa" + rsalen + "_vbmeta.pem --output Work\\vbmeta.avbpubkey";
SyncRUN(command, subcommand);
}
public static void VbmetaCreate(int size = 4096, int rsalen = 4096)
public static void VbmetaCreate(int av, int rsalen = 4096)
{
SyncRUN(command, AvbCmd + "make_vbmeta_image --output Work\\vbmeta_unchecksummed.img --key Tools\\rsa" + rsalen + "_vbmeta.pem --algorithm SHA256_RSA" + rsalen + " --padding_size " + size + " --rollback_index 0 --flags 2" + vbmetacreate);
int padd = 12288;
switch (av)
{
case 8:
padd = 12288;
break;
case 9:
padd = 16384;
break;
case 10:
padd = 20480;
break;
case 11:
padd = 20480;
break;
}

SyncRUN(command, AvbCmd + "make_vbmeta_image --output Work\\vbmeta_unchecksummed.img --key Tools\\rsa" + rsalen + "_vbmeta.pem --algorithm SHA256_RSA" + rsalen + " --padding_size " + padd + " --rollback_index 0 --flags 2" + vbmetacreate);
FileStream fileStream = File.Open("Work\\vbmeta_unchecksummed.img", FileMode.Open);
fileStream.SetLength(12288);
fileStream.Close();
Expand Down
67 changes: 67 additions & 0 deletions SPDVbmetaSigner/ILMerge.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8" ?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- -->
<!-- ILMerge project-specific settings. Almost never need to be set explicitly. -->
<!-- for details, see http://research.microsoft.com/en-us/people/mbarnett/ilmerge.aspx -->
<!-- -->
<!-- *** set this file to Type=None, CopyToOutput=Never *** -->

<!-- If True, all copy local dependencies will also be merged from referenced projects whether they are referenced in the current project explicitly or not -->
<ILMergeTransitive>true</ILMergeTransitive>

<!-- Extra ILMerge library paths (semicolon-separated). Dont put your package dependencies here, they will be added automagically -->
<ILMergeLibraryPath></ILMergeLibraryPath>

<!-- The solution NuGet package directory if not standard 'SOLUTION\packages' -->
<ILMergePackagesPath></ILMergePackagesPath>

<!-- The merge order file name if differs from standard 'ILMergeOrder.txt' -->
<ILMergeOrderFile></ILMergeOrderFile>

<!-- The strong key file name if not specified in the project -->
<ILMergeKeyFile></ILMergeKeyFile>

<!-- The assembly version if differs for the version of the main assembly -->
<ILMergeAssemblyVersion></ILMergeAssemblyVersion>

<!-- added in Version 1.0.4 -->
<ILMergeFileAlignment></ILMergeFileAlignment>

<!-- added in Version 1.0.4, default=none -->
<ILMergeAllowDuplicateType></ILMergeAllowDuplicateType>

<!-- If the <see cref="CopyAttributes"/> is also set, any assembly-level attributes names that have the same type are copied over into the target assembly -->
<ILMergeAllowMultipleAssemblyLevelAttributes></ILMergeAllowMultipleAssemblyLevelAttributes>

<!-- See ILMerge documentation -->
<ILMergeAllowZeroPeKind></ILMergeAllowZeroPeKind>

<!-- The assembly level attributes of each input assembly are copied over into the target assembly -->
<ILMergeCopyAttributes></ILMergeCopyAttributes>

<!-- Creates a .pdb file for the output assembly and merges into it any .pdb files found for input assemblies, default=true -->
<ILMergeDebugInfo>false</ILMergeDebugInfo>

<!-- Target assembly will be delay signed -->
<ILMergeDelaySign></ILMergeDelaySign>

<!-- Types in assemblies other than the primary assembly have their visibility modified -->
<ILMergeInternalize></ILMergeInternalize>

<!-- The path name of the file that will be used to identify types that are not to have their visibility modified -->
<ILMergeInternalizeExcludeFile></ILMergeInternalizeExcludeFile>

<!-- XML documentation files are merged to produce an XML documentation file for the target assembly -->
<ILMergeXmlDocumentation></ILMergeXmlDocumentation>

<!-- External assembly references in the manifest of the target assembly will use full public keys (false) or public key tokens (true, default value) -->
<ILMergePublicKeyTokens></ILMergePublicKeyTokens>

<!-- Types with the same name are all merged into a single type in the target assembly -->
<ILMergeUnionMerge></ILMergeUnionMerge>

<!-- The version of the target framework, default 40 (works for 45 too) -->
<ILTargetPlatform></ILTargetPlatform>
</PropertyGroup>
</Project>
4 changes: 4 additions & 0 deletions SPDVbmetaSigner/ILMergeOrder.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# this file contains the partial list of the merged assemblies in the merge order
# you can fill it from the obj\CONFIG\PROJECT.ilmerge generated on every build
# and finetune merge order to your satisfaction

8 changes: 8 additions & 0 deletions SPDVbmetaSigner/SPDVbmetaSigner.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\ILMerge.3.0.41\build\ILMerge.props" Condition="Exists('..\packages\ILMerge.3.0.41\build\ILMerge.props')" />
<Import Project="..\packages\MSBuild.ILMerge.Task.1.1.3\build\MSBuild.ILMerge.Task.props" Condition="Exists('..\packages\MSBuild.ILMerge.Task.1.1.3\build\MSBuild.ILMerge.Task.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand Down Expand Up @@ -86,6 +87,7 @@
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="ILMerge.props" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
Expand All @@ -100,11 +102,17 @@
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Content Include="ILMergeOrder.txt" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\MSBuild.ILMerge.Task.1.1.3\build\MSBuild.ILMerge.Task.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSBuild.ILMerge.Task.1.1.3\build\MSBuild.ILMerge.Task.props'))" />
<Error Condition="!Exists('..\packages\MSBuild.ILMerge.Task.1.1.3\build\MSBuild.ILMerge.Task.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSBuild.ILMerge.Task.1.1.3\build\MSBuild.ILMerge.Task.targets'))" />
<Error Condition="!Exists('..\packages\ILMerge.3.0.41\build\ILMerge.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\ILMerge.3.0.41\build\ILMerge.props'))" />
</Target>
<Import Project="..\packages\MSBuild.ILMerge.Task.1.1.3\build\MSBuild.ILMerge.Task.targets" Condition="Exists('..\packages\MSBuild.ILMerge.Task.1.1.3\build\MSBuild.ILMerge.Task.targets')" />
</Project>
74 changes: 37 additions & 37 deletions SPDVbmetaSigner/Window.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion SPDVbmetaSigner/Window.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public Window()
LOG(1, "Default RSA: RSA_4096 for most devices! RSA_2048 use it, if RSA_4096 doesn't works!");
LOG(0, "This use modified avbtool.py");
PGG = nProgressBar1;
AndrverBOX.SelectedIndex = RSALEN.SelectedIndex = 0;
}

private void SignNowBtn_Click(object sender, EventArgs e)
Expand Down Expand Up @@ -118,7 +119,7 @@ private void SignNowBtn_Click(object sender, EventArgs e)
}
Progress(50);
LOG(0, "Generating Vbmeta Image");
VbmetaCreate(rsaleng, rsaleng);
VbmetaCreate(andrver, rsaleng);
Progress(80);
LOG(0, "Padding Vbmeta Image");
Android_PAD(andrver);
Expand Down
1 change: 1 addition & 0 deletions SPDVbmetaSigner/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
<packages>
<package id="ILMerge" version="3.0.41" targetFramework="net472" />
<package id="LibUsbDotNet" version="2.2.29" targetFramework="net472" />
<package id="MSBuild.ILMerge.Task" version="1.1.3" targetFramework="net472" />
</packages>

0 comments on commit 58dc19d

Please sign in to comment.