Add files via upload
This commit is contained in:
parent
70de9ae022
commit
7b3abfa728
|
@ -0,0 +1,48 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.26228.76
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CHOVY", "CHOVY\CHOVY.csproj", "{D46AA2C2-2BDC-45C7-ACA5-D7A2295564E8}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KIRK", "KIRK\KIRK.vcxproj", "{C441ACC2-EC4E-424B-AA99-3F5D1A997A4F}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{D46AA2C2-2BDC-45C7-ACA5-D7A2295564E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D46AA2C2-2BDC-45C7-ACA5-D7A2295564E8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D46AA2C2-2BDC-45C7-ACA5-D7A2295564E8}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{D46AA2C2-2BDC-45C7-ACA5-D7A2295564E8}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{D46AA2C2-2BDC-45C7-ACA5-D7A2295564E8}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{D46AA2C2-2BDC-45C7-ACA5-D7A2295564E8}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{D46AA2C2-2BDC-45C7-ACA5-D7A2295564E8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D46AA2C2-2BDC-45C7-ACA5-D7A2295564E8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D46AA2C2-2BDC-45C7-ACA5-D7A2295564E8}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{D46AA2C2-2BDC-45C7-ACA5-D7A2295564E8}.Release|x64.Build.0 = Release|Any CPU
|
||||
{D46AA2C2-2BDC-45C7-ACA5-D7A2295564E8}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{D46AA2C2-2BDC-45C7-ACA5-D7A2295564E8}.Release|x86.Build.0 = Release|Any CPU
|
||||
{C441ACC2-EC4E-424B-AA99-3F5D1A997A4F}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||
{C441ACC2-EC4E-424B-AA99-3F5D1A997A4F}.Debug|Any CPU.Build.0 = Debug|Win32
|
||||
{C441ACC2-EC4E-424B-AA99-3F5D1A997A4F}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{C441ACC2-EC4E-424B-AA99-3F5D1A997A4F}.Debug|x64.Build.0 = Debug|x64
|
||||
{C441ACC2-EC4E-424B-AA99-3F5D1A997A4F}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{C441ACC2-EC4E-424B-AA99-3F5D1A997A4F}.Debug|x86.Build.0 = Debug|Win32
|
||||
{C441ACC2-EC4E-424B-AA99-3F5D1A997A4F}.Release|Any CPU.ActiveCfg = Release|Win32
|
||||
{C441ACC2-EC4E-424B-AA99-3F5D1A997A4F}.Release|Any CPU.Build.0 = Release|Win32
|
||||
{C441ACC2-EC4E-424B-AA99-3F5D1A997A4F}.Release|x64.ActiveCfg = Release|x64
|
||||
{C441ACC2-EC4E-424B-AA99-3F5D1A997A4F}.Release|x64.Build.0 = Release|x64
|
||||
{C441ACC2-EC4E-424B-AA99-3F5D1A997A4F}.Release|x86.ActiveCfg = Release|Win32
|
||||
{C441ACC2-EC4E-424B-AA99-3F5D1A997A4F}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,176 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="CHOVY|Win32">
|
||||
<Configuration>CHOVY</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="CHOVY|x64">
|
||||
<Configuration>CHOVY</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>15.0</VCProjectVersion>
|
||||
<ProjectGuid>{C441ACC2-EC4E-424B-AA99-3F5D1A997A4F}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>KIRK</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='CHOVY|Win32'">
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='CHOVY|x64'">
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)CHOVY\bin\$(Configuration)</OutDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;KIRK_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;KIRK_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;KIRK_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;KIRK_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="amctrl.c" />
|
||||
<ClCompile Include="bn.c" />
|
||||
<ClCompile Include="crypto.c" />
|
||||
<ClCompile Include="ec.c" />
|
||||
<ClCompile Include="kirk_engine.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="amctrl.h" />
|
||||
<ClInclude Include="crypto.h" />
|
||||
<ClInclude Include="ecdsa.h" />
|
||||
<ClInclude Include="kirk_engine.h" />
|
||||
<ClInclude Include="psp_headers.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -0,0 +1,54 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="amctrl.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="bn.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="crypto.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ec.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="kirk_engine.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="kirk_engine.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="amctrl.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="crypto.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ecdsa.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="psp_headers.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
<LocalDebuggerCommand>C:\Users\earsy\Documents\Visual Studio 2017\Projects\CHOVEY\CHOVY\bin\Debug\CHOVY.exe</LocalDebuggerCommand>
|
||||
<LocalDebuggerDebuggerType>Mixed</LocalDebuggerDebuggerType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
<LocalDebuggerCommand>C:\Users\earsy\Documents\Visual Studio 2017\Projects\CHOVEY\CHOVY\bin\Debug\CHOVY.exe</LocalDebuggerCommand>
|
||||
<LocalDebuggerDebuggerType>ManagedOnly</LocalDebuggerDebuggerType>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -0,0 +1,694 @@
|
|||
/*
|
||||
* amctrl.c -- Reverse engineering of amctrl.prx
|
||||
* written by tpu.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "crypto.h"
|
||||
#include "kirk_engine.h"
|
||||
#include "psp_headers.h"
|
||||
#include "amctrl.h"
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
static u8 loc_1CD4[16] = {0xE3, 0x50, 0xED, 0x1D, 0x91, 0x0A, 0x1F, 0xD0, 0x29, 0xBB, 0x1C, 0x3E, 0xF3, 0x40, 0x77, 0xFB};
|
||||
static u8 loc_1CE4[16] = {0x13, 0x5F, 0xA4, 0x7C, 0xAB, 0x39, 0x5B, 0xA4, 0x76, 0xB8, 0xCC, 0xA9, 0x8F, 0x3A, 0x04, 0x45};
|
||||
static u8 loc_1CF4[16] = {0x67, 0x8D, 0x7F, 0xA3, 0x2A, 0x9C, 0xA0, 0xD1, 0x50, 0x8A, 0xD8, 0x38, 0x5E, 0x4B, 0x01, 0x7E};
|
||||
|
||||
static u8 kirk_buf[0x0814]; // 1DC0 1DD4
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
static int kirk4(u8 *buf, int size, int type)
|
||||
{
|
||||
int retv;
|
||||
u32 *header = (u32*)buf;
|
||||
|
||||
header[0] = 4;
|
||||
header[1] = 0;
|
||||
header[2] = 0;
|
||||
header[3] = type;
|
||||
header[4] = size;
|
||||
|
||||
retv = sceUtilsBufferCopyWithRange(buf, size+0x14, buf, size, 4);
|
||||
|
||||
if(retv)
|
||||
return 0x80510311;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int kirk7(u8 *buf, int size, int type)
|
||||
{
|
||||
int retv;
|
||||
u32 *header = (u32*)buf;
|
||||
|
||||
header[0] = 5;
|
||||
header[1] = 0;
|
||||
header[2] = 0;
|
||||
header[3] = type;
|
||||
header[4] = size;
|
||||
|
||||
retv = sceUtilsBufferCopyWithRange(buf, size+0x14, buf, size, 7);
|
||||
if(retv)
|
||||
return 0x80510311;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int kirk5(u8 *buf, int size)
|
||||
{
|
||||
int retv;
|
||||
u32 *header = (u32*)buf;
|
||||
|
||||
header[0] = 4;
|
||||
header[1] = 0;
|
||||
header[2] = 0;
|
||||
header[3] = 0x0100;
|
||||
header[4] = size;
|
||||
|
||||
retv = sceUtilsBufferCopyWithRange(buf, size+0x14, buf, size, 5);
|
||||
if(retv)
|
||||
return 0x80510312;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int kirk8(u8 *buf, int size)
|
||||
{
|
||||
int retv;
|
||||
u32 *header = (u32*)buf;
|
||||
|
||||
header[0] = 5;
|
||||
header[1] = 0;
|
||||
header[2] = 0;
|
||||
header[3] = 0x0100;
|
||||
header[4] = size;
|
||||
|
||||
retv = sceUtilsBufferCopyWithRange(buf, size+0x14, buf, size, 8);
|
||||
if(retv)
|
||||
return 0x80510312;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int kirk14(u8 *buf)
|
||||
{
|
||||
int retv;
|
||||
|
||||
retv = sceUtilsBufferCopyWithRange(buf, 0x14, 0, 0, 14);
|
||||
if(retv)
|
||||
return 0x80510315;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
// Called by sceDrmBBMacUpdate
|
||||
// encrypt_buf
|
||||
static int sub_158(u8 *buf, int size, u8 *key, int key_type)
|
||||
{
|
||||
int i, retv;
|
||||
|
||||
for(i=0; i<16; i++){
|
||||
buf[0x14+i] ^= key[i];
|
||||
}
|
||||
|
||||
retv = kirk4(buf, size, key_type);
|
||||
if(retv)
|
||||
return retv;
|
||||
|
||||
// copy last 16 bytes to keys
|
||||
memcpy(key, buf+size+4, 16);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// type:
|
||||
// 2: use fuse id
|
||||
// 3: use fixed id
|
||||
__declspec(dllexport) int sceDrmBBMacInit(MAC_KEY *mkey, int type)
|
||||
{
|
||||
mkey->type = type;
|
||||
mkey->pad_size = 0;
|
||||
|
||||
memset(mkey->key, 0, 16);
|
||||
memset(mkey->pad, 0, 16);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
__declspec(dllexport) int sceDrmBBMacUpdate(MAC_KEY *mkey, u8 *buf, int size)
|
||||
{
|
||||
int retv = 0, ksize, p, type;
|
||||
u8 *kbuf;
|
||||
|
||||
if(mkey->pad_size>16){
|
||||
retv = 0x80510302;
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
if(mkey->pad_size+size<=16){
|
||||
memcpy(mkey->pad+mkey->pad_size, buf, size);
|
||||
mkey->pad_size += size;
|
||||
retv = 0;
|
||||
}else{
|
||||
kbuf = kirk_buf+0x14;
|
||||
// copy pad data first
|
||||
memcpy(kbuf, mkey->pad, mkey->pad_size);
|
||||
|
||||
p = mkey->pad_size;
|
||||
|
||||
mkey->pad_size += size;
|
||||
mkey->pad_size &= 0x0f;
|
||||
if(mkey->pad_size==0)
|
||||
mkey->pad_size = 16;
|
||||
|
||||
size -= mkey->pad_size;
|
||||
// save last data to pad buf
|
||||
memcpy(mkey->pad, buf+size, mkey->pad_size);
|
||||
|
||||
type = (mkey->type==2)? 0x3A : 0x38;
|
||||
|
||||
while(size){
|
||||
ksize = (size+p>=0x0800)? 0x0800 : size+p;
|
||||
memcpy(kbuf+p, buf, ksize-p);
|
||||
retv = sub_158(kirk_buf, ksize, mkey->key, type);
|
||||
if(retv)
|
||||
goto _exit;
|
||||
size -= (ksize-p);
|
||||
buf += ksize-p;
|
||||
p = 0;
|
||||
}
|
||||
}
|
||||
|
||||
_exit:
|
||||
return retv;
|
||||
|
||||
}
|
||||
|
||||
__declspec(dllexport) int sceDrmBBMacFinal(MAC_KEY *mkey, u8 *buf, u8 *vkey)
|
||||
{
|
||||
int i, retv, code;
|
||||
u8 *kbuf, tmp[16], tmp1[16];
|
||||
u32 t0, v0, v1;
|
||||
|
||||
if(mkey->pad_size>16)
|
||||
return 0x80510302;
|
||||
|
||||
code = (mkey->type==2)? 0x3A : 0x38;
|
||||
kbuf = kirk_buf+0x14;
|
||||
|
||||
memset(kbuf, 0, 16);
|
||||
retv = kirk4(kirk_buf, 16, code);
|
||||
if(retv)
|
||||
goto _exit;
|
||||
memcpy(tmp, kbuf, 16);
|
||||
|
||||
// left shift tmp 1 bit
|
||||
t0 = (tmp[0]&0x80)? 0x87 : 0;
|
||||
for(i=0; i<15; i++){
|
||||
v1 = tmp[i+0];
|
||||
v0 = tmp[i+1];
|
||||
v1 <<= 1;
|
||||
v0 >>= 7;
|
||||
v0 |= v1;
|
||||
tmp[i+0] = v0;
|
||||
}
|
||||
v0 = tmp[15];
|
||||
v0 <<= 1;
|
||||
v0 ^= t0;
|
||||
tmp[15] = v0;
|
||||
|
||||
// padding remain data
|
||||
if(mkey->pad_size<16){
|
||||
// left shift tmp 1 bit
|
||||
t0 = (tmp[0]&0x80)? 0x87 : 0;
|
||||
for(i=0; i<15; i++){
|
||||
v1 = tmp[i+0];
|
||||
v0 = tmp[i+1];
|
||||
v1 <<= 1;
|
||||
v0 >>= 7;
|
||||
v0 |= v1;
|
||||
tmp[i+0] = v0;
|
||||
}
|
||||
v0 = tmp[15];
|
||||
v0 <<= 1;
|
||||
v0 ^= t0;
|
||||
tmp[15] = v0;
|
||||
|
||||
mkey->pad[mkey->pad_size] = 0x80;
|
||||
if(mkey->pad_size+1<16)
|
||||
memset(mkey->pad+mkey->pad_size+1, 0, 16-mkey->pad_size-1);
|
||||
}
|
||||
|
||||
for(i=0; i<16; i++){
|
||||
mkey->pad[i] ^= tmp[i];
|
||||
}
|
||||
|
||||
memcpy(kbuf, mkey->pad, 16);
|
||||
memcpy(tmp1, mkey->key, 16);
|
||||
|
||||
retv = sub_158(kirk_buf, 0x10, tmp1, code);
|
||||
if(retv)
|
||||
return retv;
|
||||
|
||||
for(i=0; i<0x10; i++){
|
||||
tmp1[i] ^= loc_1CD4[i];
|
||||
}
|
||||
|
||||
if(mkey->type==2){
|
||||
memcpy(kbuf, tmp1, 16);
|
||||
|
||||
retv = kirk5(kirk_buf, 0x10);
|
||||
if(retv)
|
||||
goto _exit;
|
||||
|
||||
retv = kirk4(kirk_buf, 0x10, code);
|
||||
if(retv)
|
||||
goto _exit;
|
||||
|
||||
memcpy(tmp1, kbuf, 16);
|
||||
}
|
||||
|
||||
if(vkey){
|
||||
for(i=0; i<0x10; i++){
|
||||
tmp1[i] ^= vkey[i];
|
||||
}
|
||||
memcpy(kbuf, tmp1, 16);
|
||||
|
||||
retv = kirk4(kirk_buf, 0x10, code);
|
||||
if(retv)
|
||||
goto _exit;
|
||||
|
||||
memcpy(tmp1, kbuf, 16);
|
||||
}
|
||||
|
||||
memcpy(buf, tmp1, 16);
|
||||
|
||||
memset(mkey->key, 0, 16);
|
||||
memset(mkey->pad, 0, 16);
|
||||
|
||||
mkey->pad_size = 0;
|
||||
mkey->type = 0;
|
||||
retv = 0;
|
||||
|
||||
_exit:
|
||||
return retv;
|
||||
}
|
||||
|
||||
__declspec(dllexport) int sceDrmBBMacFinal2(MAC_KEY *mkey, u8 *out, u8 *vkey)
|
||||
{
|
||||
int i, retv, type;
|
||||
u8 *kbuf, tmp[16];
|
||||
|
||||
type = mkey->type;
|
||||
retv = sceDrmBBMacFinal(mkey, tmp, vkey);
|
||||
if(retv)
|
||||
return retv;
|
||||
|
||||
kbuf = kirk_buf+0x14;
|
||||
|
||||
// decrypt bbmac
|
||||
if(type==3){
|
||||
memcpy(kbuf, out, 0x10);
|
||||
kirk7(kirk_buf, 0x10, 0x63);
|
||||
}else{
|
||||
memcpy(kirk_buf, out, 0x10);
|
||||
}
|
||||
|
||||
retv = 0;
|
||||
for(i=0; i<0x10; i++){
|
||||
if(kirk_buf[i]!=tmp[i]){
|
||||
retv = 0x80510300;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return retv;
|
||||
}
|
||||
|
||||
__declspec(dllexport) int bbmac_build_final2(int type, u8 *mac)
|
||||
{
|
||||
u8 *kbuf = kirk_buf+0x14;
|
||||
|
||||
if(type==3){
|
||||
memcpy(kbuf, mac, 16);
|
||||
kirk4(kirk_buf, 0x10, 0x63);
|
||||
memcpy(mac, kbuf, 16);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// get key from bbmac
|
||||
__declspec(dllexport) int bbmac_getkey(MAC_KEY *mkey, u8 *bbmac, u8 *vkey)
|
||||
{
|
||||
int i, retv, type, code;
|
||||
u8 *kbuf, tmp[16], tmp1[16];
|
||||
|
||||
type = mkey->type;
|
||||
retv = sceDrmBBMacFinal(mkey, tmp, NULL);
|
||||
if(retv)
|
||||
return retv;
|
||||
|
||||
kbuf = kirk_buf+0x14;
|
||||
|
||||
// decrypt bbmac
|
||||
if(type==3){
|
||||
memcpy(kbuf, bbmac, 0x10);
|
||||
kirk7(kirk_buf, 0x10, 0x63);
|
||||
}else{
|
||||
memcpy(kirk_buf, bbmac, 0x10);
|
||||
}
|
||||
|
||||
memcpy(tmp1, kirk_buf, 16);
|
||||
memcpy(kbuf, tmp1, 16);
|
||||
|
||||
code = (type==2)? 0x3A : 0x38;
|
||||
kirk7(kirk_buf, 0x10, code);
|
||||
|
||||
for(i=0; i<0x10; i++){
|
||||
vkey[i] = tmp[i] ^ kirk_buf[i];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
__declspec(dllexport) int bbmac_forge(MAC_KEY *mkey, u8 *bbmac, u8 *vkey, u8 *buf)
|
||||
{
|
||||
int i, retv, type;
|
||||
u8 *kbuf, tmp[16], tmp1[16];
|
||||
u32 t0, v0, v1;
|
||||
|
||||
if(mkey->pad_size>16)
|
||||
return 0x80510302;
|
||||
|
||||
type = (mkey->type==2)? 0x3A : 0x38;
|
||||
kbuf = kirk_buf+0x14;
|
||||
|
||||
memset(kbuf, 0, 16);
|
||||
retv = kirk4(kirk_buf, 16, type);
|
||||
if(retv)
|
||||
return retv;
|
||||
memcpy(tmp, kbuf, 16);
|
||||
|
||||
// left shift tmp 1 bit
|
||||
t0 = (tmp[0]&0x80)? 0x87 : 0;
|
||||
for(i=0; i<15; i++){
|
||||
v1 = tmp[i+0];
|
||||
v0 = tmp[i+1];
|
||||
v1 <<= 1;
|
||||
v0 >>= 7;
|
||||
v0 |= v1;
|
||||
tmp[i+0] = v0;
|
||||
}
|
||||
v0 = tmp[15];
|
||||
v0 <<= 1;
|
||||
v0 ^= t0;
|
||||
tmp[15] = v0;
|
||||
|
||||
// padding remain data
|
||||
if(mkey->pad_size<16){
|
||||
// left shift tmp 1 bit
|
||||
t0 = (tmp[0]&0x80)? 0x87 : 0;
|
||||
for(i=0; i<15; i++){
|
||||
v1 = tmp[i+0];
|
||||
v0 = tmp[i+1];
|
||||
v1 <<= 1;
|
||||
v0 >>= 7;
|
||||
v0 |= v1;
|
||||
tmp[i+0] = v0;
|
||||
}
|
||||
v0 = tmp[15];
|
||||
v0 <<= 1;
|
||||
v0 ^= t0;
|
||||
tmp[15] = t0;
|
||||
|
||||
mkey->pad[mkey->pad_size] = 0x80;
|
||||
if(mkey->pad_size+1<16)
|
||||
memset(mkey->pad+mkey->pad_size+1, 0, 16-mkey->pad_size-1);
|
||||
}
|
||||
|
||||
for(i=0; i<16; i++){
|
||||
mkey->pad[i] ^= tmp[i];
|
||||
}
|
||||
for(i=0; i<0x10; i++){
|
||||
mkey->pad[i] ^= mkey->key[i];
|
||||
}
|
||||
|
||||
// reverse order
|
||||
memcpy(kbuf, bbmac, 0x10);
|
||||
kirk7(kirk_buf, 0x10, 0x63);
|
||||
|
||||
memcpy(kbuf, kirk_buf, 0x10);
|
||||
kirk7(kirk_buf, 0x10, type);
|
||||
|
||||
memcpy(tmp1, kirk_buf, 0x10);
|
||||
for(i=0; i<0x10; i++){
|
||||
tmp1[i] ^= vkey[i];
|
||||
}
|
||||
for(i=0; i<0x10; i++){
|
||||
tmp1[i] ^= loc_1CD4[i];
|
||||
}
|
||||
|
||||
memcpy(kbuf, tmp1, 0x10);
|
||||
kirk7(kirk_buf, 0x10, type);
|
||||
|
||||
memcpy(tmp1, kirk_buf, 0x10);
|
||||
for(i=0; i<16; i++){
|
||||
mkey->pad[i] ^= tmp1[i];
|
||||
}
|
||||
|
||||
// modify the last 16 bytes
|
||||
for(i=0; i<16; i++){
|
||||
buf[i] ^= mkey->pad[i];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
static int sub_1F8(u8 *buf, int size, u8 *key, int key_type)
|
||||
{
|
||||
int i, retv;
|
||||
u8 tmp[16];
|
||||
|
||||
// copy last 16 bytes to tmp
|
||||
memcpy(tmp, buf+size+0x14-16, 16);
|
||||
|
||||
retv = kirk7(buf, size, key_type);
|
||||
if(retv)
|
||||
return retv;
|
||||
|
||||
for(i=0; i<16; i++){
|
||||
buf[i] ^= key[i];
|
||||
}
|
||||
|
||||
// copy last 16 bytes to keys
|
||||
memcpy(key, tmp, 16);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int sub_428(u8 *kbuf, u8 *dbuf, int size, CIPHER_KEY *ckey)
|
||||
{
|
||||
int i, retv;
|
||||
u8 tmp1[16], tmp2[16];
|
||||
|
||||
memcpy(kbuf+0x14, ckey->key, 16);
|
||||
|
||||
for(i=0; i<16; i++){
|
||||
kbuf[0x14+i] ^= loc_1CF4[i];
|
||||
}
|
||||
|
||||
if(ckey->type==2)
|
||||
retv = kirk8(kbuf, 16);
|
||||
else
|
||||
retv = kirk7(kbuf, 16, 0x39);
|
||||
if(retv)
|
||||
return retv;
|
||||
|
||||
for(i=0; i<16; i++){
|
||||
kbuf[i] ^= loc_1CE4[i];
|
||||
}
|
||||
|
||||
memcpy(tmp2, kbuf, 0x10);
|
||||
|
||||
if(ckey->seed==1){
|
||||
memset(tmp1, 0, 0x10);
|
||||
}else{
|
||||
memcpy(tmp1, tmp2, 0x10);
|
||||
*(u32*)(tmp1+0x0c) = ckey->seed-1;
|
||||
}
|
||||
|
||||
for(i=0; i<size; i+=16){
|
||||
memcpy(kbuf+0x14+i, tmp2, 12);
|
||||
*(u32*)(kbuf+0x14+i+12) = ckey->seed;
|
||||
ckey->seed += 1;
|
||||
}
|
||||
|
||||
retv = sub_1F8(kbuf, size, tmp1, 0x63);
|
||||
if(retv)
|
||||
return retv;
|
||||
|
||||
for(i=0; i<size; i++){
|
||||
dbuf[i] ^= kbuf[i];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// type: 1 use fixed key
|
||||
// 2 use fuse id
|
||||
// mode: 1 for encrypt
|
||||
// 2 for decrypt
|
||||
__declspec(dllexport) int sceDrmBBCipherInit(CIPHER_KEY *ckey, int type, int mode, u8 *header_key, u8 *version_key, u32 seed)
|
||||
{
|
||||
int i, retv;
|
||||
u8 *kbuf;
|
||||
|
||||
kbuf = kirk_buf+0x14;
|
||||
ckey->type = type;
|
||||
if(mode==2){
|
||||
ckey->seed = seed+1;
|
||||
for(i=0; i<16; i++){
|
||||
ckey->key[i] = header_key[i];
|
||||
}
|
||||
if(version_key){
|
||||
for(i=0; i<16; i++){
|
||||
ckey->key[i] ^= version_key[i];
|
||||
}
|
||||
}
|
||||
retv = 0;
|
||||
}else if(mode==1){
|
||||
ckey->seed = 1;
|
||||
retv = kirk14(kirk_buf);
|
||||
if(retv)
|
||||
return retv;
|
||||
|
||||
memcpy(kbuf, kirk_buf, 0x10);
|
||||
memset(kbuf+0x0c, 0, 4);
|
||||
|
||||
if(ckey->type==2){
|
||||
for(i=0; i<16; i++){
|
||||
kbuf[i] ^= loc_1CE4[i];
|
||||
}
|
||||
retv = kirk5(kirk_buf, 0x10);
|
||||
for(i=0; i<16; i++){
|
||||
kbuf[i] ^= loc_1CF4[i];
|
||||
}
|
||||
}else{
|
||||
for(i=0; i<16; i++){
|
||||
kbuf[i] ^= loc_1CE4[i];
|
||||
}
|
||||
retv = kirk4(kirk_buf, 0x10, 0x39);
|
||||
for(i=0; i<16; i++){
|
||||
kbuf[i] ^= loc_1CF4[i];
|
||||
}
|
||||
}
|
||||
if(retv)
|
||||
return retv;
|
||||
|
||||
memcpy(ckey->key, kbuf, 0x10);
|
||||
memcpy(header_key, kbuf, 0x10);
|
||||
|
||||
if(version_key){
|
||||
for(i=0; i<16; i++){
|
||||
ckey->key[i] ^= version_key[i];
|
||||
}
|
||||
}
|
||||
}else{
|
||||
retv = 0;
|
||||
}
|
||||
|
||||
return retv;
|
||||
}
|
||||
|
||||
__declspec(dllexport) int sceDrmBBCipherUpdate(CIPHER_KEY *ckey, u8 *data, int size)
|
||||
{
|
||||
int p, retv, dsize;
|
||||
|
||||
retv = 0;
|
||||
p = 0;
|
||||
|
||||
while(size>0){
|
||||
dsize = (size>=0x0800)? 0x0800 : size;
|
||||
retv = sub_428(kirk_buf, data+p, dsize, ckey);
|
||||
if(retv)
|
||||
break;
|
||||
size -= dsize;
|
||||
p += dsize;
|
||||
}
|
||||
|
||||
return retv;
|
||||
}
|
||||
|
||||
__declspec(dllexport) int sceDrmBBCipherFinal(CIPHER_KEY *ckey)
|
||||
{
|
||||
memset(ckey->key, 0, 16);
|
||||
ckey->type = 0;
|
||||
ckey->seed = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
// AES128 encrypt key
|
||||
static u8 key_357C[0x30] = {
|
||||
0x07,0x3D,0x9E,0x9D,0xA8,0xFD,0x3B,0x2F,0x63,0x18,0x93,0x2E,0xF8,0x57,0xA6,0x64,
|
||||
0x37,0x49,0xB7,0x01,0xCA,0xE2,0xE0,0xC5,0x44,0x2E,0x06,0xB6,0x1E,0xFF,0x84,0xF2,
|
||||
0x9D,0x31,0xB8,0x5A,0xC8,0xFA,0x16,0x80,0x73,0x60,0x18,0x82,0x18,0x77,0x91,0x9D,
|
||||
};
|
||||
|
||||
static u8 key_363C[16] = {
|
||||
0x38,0x20,0xD0,0x11,0x07,0xA3,0xFF,0x3E,0x0A,0x4C,0x20,0x85,0x39,0x10,0xB5,0x54,
|
||||
};
|
||||
|
||||
int sceNpDrmGetFixedKey(u8 *key, char *npstr, int type)
|
||||
{
|
||||
AES_ctx akey;
|
||||
MAC_KEY mkey;
|
||||
char strbuf[0x30];
|
||||
int retv;
|
||||
|
||||
if((type&0x01000000)==0)
|
||||
return 0x80550901;
|
||||
type &= 0x000000ff;
|
||||
|
||||
memset(strbuf, 0, 0x30);
|
||||
strncpy(strbuf, npstr, 0x30);
|
||||
|
||||
retv = sceDrmBBMacInit(&mkey, 1);
|
||||
if(retv)
|
||||
return retv;
|
||||
|
||||
retv = sceDrmBBMacUpdate(&mkey, (u8*)strbuf, 0x30);
|
||||
if(retv)
|
||||
return retv;
|
||||
|
||||
retv = sceDrmBBMacFinal(&mkey, key, key_363C);
|
||||
if(retv)
|
||||
return 0x80550902;
|
||||
|
||||
if(type==0)
|
||||
return 0;
|
||||
if(type>3)
|
||||
return 0x80550901;
|
||||
type = (type-1)*16;
|
||||
|
||||
AES_set_key(&akey, &key_357C[type], 128);
|
||||
AES_encrypt(&akey, key, key);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
#ifndef AMCTRL_H
|
||||
#define AMCTRL_H
|
||||
|
||||
typedef struct {
|
||||
int type;
|
||||
u8 key[16];
|
||||
u8 pad[16];
|
||||
int pad_size;
|
||||
} MAC_KEY;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u32 type;
|
||||
u32 seed;
|
||||
u8 key[16];
|
||||
} CIPHER_KEY;
|
||||
|
||||
// type:
|
||||
// 2: use fuse id
|
||||
// 3: use fixed key. MAC need encrypt again
|
||||
__declspec(dllexport) int sceDrmBBMacInit(MAC_KEY *mkey, int type);
|
||||
__declspec(dllexport) int sceDrmBBMacUpdate(MAC_KEY *mkey, u8 *buf, int size);
|
||||
__declspec(dllexport) int sceDrmBBMacFinal(MAC_KEY *mkey, u8 *buf, u8 *vkey);
|
||||
__declspec(dllexport) int sceDrmBBMacFinal2(MAC_KEY *mkey, u8 *out, u8 *vkey);
|
||||
|
||||
__declspec(dllexport) int bbmac_build_final2(int type, u8 *mac);
|
||||
__declspec(dllexport) int bbmac_getkey(MAC_KEY *mkey, u8 *bbmac, u8 *vkey);
|
||||
__declspec(dllexport) int bbmac_forge(MAC_KEY *mkey, u8 *bbmac, u8 *vkey, u8 *buf);
|
||||
|
||||
// type: 1 use fixed key
|
||||
// 2 use fuse id
|
||||
// mode: 1 for encrypt
|
||||
// 2 for decrypt
|
||||
__declspec(dllexport) int sceDrmBBCipherInit(CIPHER_KEY *ckey, int type, int mode, u8 *header_key, u8 *version_key, u32 seed);
|
||||
__declspec(dllexport) int sceDrmBBCipherUpdate(CIPHER_KEY *ckey, u8 *data, int size);
|
||||
__declspec(dllexport) int sceDrmBBCipherFinal(CIPHER_KEY *ckey);
|
||||
|
||||
// npdrm.prx
|
||||
__declspec(dllexport) int sceNpDrmGetFixedKey(u8 *key, char *npstr, int type);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,308 @@
|
|||
// Copyright 2007,2008,2010 Segher Boessenkool <segher@kernel.crashing.org>
|
||||
// Licensed under the terms of the GNU GPL, version 2
|
||||
// http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "kirk_engine.h"
|
||||
#include "ecdsa.h"
|
||||
|
||||
|
||||
void bn_dump(char *str, u8 *buf, u32 size)
|
||||
{
|
||||
u32 i;
|
||||
|
||||
printf("%16s: ", str);
|
||||
for(i=0; i<size; i++){
|
||||
printf("%02x", buf[i]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
static void bn_zero(u8 *d, u32 n)
|
||||
{
|
||||
memset(d, 0, n);
|
||||
}
|
||||
|
||||
int bn_is_zero(u8 *d, u32 n)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i=0; i<n; i++){
|
||||
if(d[i])
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void bn_copy(u8 *d, u8 *a, u32 n)
|
||||
{
|
||||
memcpy(d, a, n);
|
||||
}
|
||||
|
||||
int bn_compare(u8 *a, u8 *b, u32 n)
|
||||
{
|
||||
u32 i;
|
||||
|
||||
for (i = 0; i<n; i++) {
|
||||
if (a[i] < b[i])
|
||||
return -1;
|
||||
if (a[i] > b[i])
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u8 bn_add_1(u8 *d, u8 *a, u8 *b, u32 n)
|
||||
{
|
||||
u32 i;
|
||||
u32 dig;
|
||||
u8 c;
|
||||
|
||||
c = 0;
|
||||
for (i = n - 1; i < n; i--) {
|
||||
dig = a[i] + b[i] + c;
|
||||
c = dig >> 8;
|
||||
d[i] = dig;
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
static u8 bn_sub_1(u8 *d, u8 *a, u8 *b, u32 n)
|
||||
{
|
||||
u32 i;
|
||||
u32 dig;
|
||||
u8 c;
|
||||
|
||||
c = 1;
|
||||
for (i = n - 1; i < n; i--) {
|
||||
dig = a[i] + 255 - b[i] + c;
|
||||
c = dig >> 8;
|
||||
d[i] = dig;
|
||||
}
|
||||
|
||||
return 1 - c;
|
||||
}
|
||||
|
||||
void bn_reduce(u8 *d, u8 *N, u32 n)
|
||||
{
|
||||
if (bn_compare(d, N, n) >= 0)
|
||||
bn_sub_1(d, d, N, n);
|
||||
}
|
||||
|
||||
void bn_add(u8 *d, u8 *a, u8 *b, u8 *N, u32 n)
|
||||
{
|
||||
if (bn_add_1(d, a, b, n))
|
||||
bn_sub_1(d, d, N, n);
|
||||
|
||||
bn_reduce(d, N, n);
|
||||
}
|
||||
|
||||
void bn_sub(u8 *d, u8 *a, u8 *b, u8 *N, u32 n)
|
||||
{
|
||||
if (bn_sub_1(d, a, b, n))
|
||||
bn_add_1(d, d, N, n);
|
||||
}
|
||||
|
||||
static const u8 inv256[0x80] = {
|
||||
0x01, 0xab, 0xcd, 0xb7, 0x39, 0xa3, 0xc5, 0xef,
|
||||
0xf1, 0x1b, 0x3d, 0xa7, 0x29, 0x13, 0x35, 0xdf,
|
||||
0xe1, 0x8b, 0xad, 0x97, 0x19, 0x83, 0xa5, 0xcf,
|
||||
0xd1, 0xfb, 0x1d, 0x87, 0x09, 0xf3, 0x15, 0xbf,
|
||||
0xc1, 0x6b, 0x8d, 0x77, 0xf9, 0x63, 0x85, 0xaf,
|
||||
0xb1, 0xdb, 0xfd, 0x67, 0xe9, 0xd3, 0xf5, 0x9f,
|
||||
0xa1, 0x4b, 0x6d, 0x57, 0xd9, 0x43, 0x65, 0x8f,
|
||||
0x91, 0xbb, 0xdd, 0x47, 0xc9, 0xb3, 0xd5, 0x7f,
|
||||
0x81, 0x2b, 0x4d, 0x37, 0xb9, 0x23, 0x45, 0x6f,
|
||||
0x71, 0x9b, 0xbd, 0x27, 0xa9, 0x93, 0xb5, 0x5f,
|
||||
0x61, 0x0b, 0x2d, 0x17, 0x99, 0x03, 0x25, 0x4f,
|
||||
0x51, 0x7b, 0x9d, 0x07, 0x89, 0x73, 0x95, 0x3f,
|
||||
0x41, 0xeb, 0x0d, 0xf7, 0x79, 0xe3, 0x05, 0x2f,
|
||||
0x31, 0x5b, 0x7d, 0xe7, 0x69, 0x53, 0x75, 0x1f,
|
||||
0x21, 0xcb, 0xed, 0xd7, 0x59, 0xc3, 0xe5, 0x0f,
|
||||
0x11, 0x3b, 0x5d, 0xc7, 0x49, 0x33, 0x55, 0xff,
|
||||
};
|
||||
|
||||
static void bn_mon_muladd_dig(u8 *d, u8 *a, u8 b, u8 *N, u32 n)
|
||||
{
|
||||
u32 dig;
|
||||
u32 i;
|
||||
|
||||
u8 z = -(d[n-1] + a[n-1]*b) * inv256[N[n-1]/2];
|
||||
|
||||
dig = d[n-1] + a[n-1]*b + N[n-1]*z;
|
||||
dig >>= 8;
|
||||
|
||||
for (i = n - 2; i < n; i--) {
|
||||
dig += d[i] + a[i]*b + N[i]*z;
|
||||
d[i+1] = dig;
|
||||
dig >>= 8;
|
||||
}
|
||||
|
||||
d[0] = dig;
|
||||
dig >>= 8;
|
||||
|
||||
if (dig)
|
||||
bn_sub_1(d, d, N, n);
|
||||
|
||||
bn_reduce(d, N, n);
|
||||
}
|
||||
|
||||
void bn_mon_mul(u8 *d, u8 *a, u8 *b, u8 *N, u32 n)
|
||||
{
|
||||
u8 t[512];
|
||||
u32 i;
|
||||
|
||||
bn_zero(t, n);
|
||||
|
||||
for (i = n - 1; i < n; i--)
|
||||
bn_mon_muladd_dig(t, a, b[i], N, n);
|
||||
|
||||
bn_copy(d, t, n);
|
||||
}
|
||||
|
||||
void bn_to_mon(u8 *d, u8 *N, u32 n)
|
||||
{
|
||||
u32 i;
|
||||
|
||||
for (i = 0; i < 8*n; i++)
|
||||
bn_add(d, d, d, N, n);
|
||||
}
|
||||
|
||||
void bn_from_mon(u8 *d, u8 *N, u32 n)
|
||||
{
|
||||
u8 t[512];
|
||||
|
||||
bn_zero(t, n);
|
||||
t[n-1] = 1;
|
||||
bn_mon_mul(d, d, t, N, n);
|
||||
}
|
||||
|
||||
static void bn_mon_exp(u8 *d, u8 *a, u8 *N, u32 n, u8 *e, u32 en)
|
||||
{
|
||||
u8 t[512];
|
||||
u32 i;
|
||||
u8 mask;
|
||||
|
||||
bn_zero(d, n);
|
||||
d[n-1] = 1;
|
||||
bn_to_mon(d, N, n);
|
||||
|
||||
for (i = 0; i < en; i++)
|
||||
for (mask = 0x80; mask != 0; mask >>= 1) {
|
||||
bn_mon_mul(t, d, d, N, n);
|
||||
if ((e[i] & mask) != 0)
|
||||
bn_mon_mul(d, t, a, N, n);
|
||||
else
|
||||
bn_copy(d, t, n);
|
||||
}
|
||||
}
|
||||
|
||||
void bn_mon_inv(u8 *d, u8 *a, u8 *N, u32 n)
|
||||
{
|
||||
u8 t[512], s[512];
|
||||
|
||||
bn_zero(s, n);
|
||||
s[n-1] = 2;
|
||||
bn_sub_1(t, N, s, n);
|
||||
bn_mon_exp(d, a, N, n, t, n);
|
||||
}
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
void bn_mul(u8 *d, u8 *a, u8 *b, u8 *N, u32 n)
|
||||
{
|
||||
u32 i;
|
||||
u8 mask;
|
||||
u8 td[512];
|
||||
|
||||
bn_zero(td, 512);
|
||||
|
||||
for (i = 0; i < n; i++){
|
||||
for (mask = 0x80; mask != 0; mask >>= 1) {
|
||||
bn_add(td, td, td, N, n);
|
||||
if ((a[i] & mask) != 0)
|
||||
bn_add(td, td, b, N, n);
|
||||
}
|
||||
}
|
||||
|
||||
bn_copy(d, td, n);
|
||||
}
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
static int bn_is_odd(u8 *d, u32 n)
|
||||
{
|
||||
return (d[n-1])&1;
|
||||
}
|
||||
|
||||
static void bn_rshift1(u8 *d, u8 *a, u32 n)
|
||||
{
|
||||
u8 b, c;
|
||||
int i;
|
||||
|
||||
c = 0;
|
||||
for(i=0; i<n; i++){
|
||||
b = a[i];
|
||||
a[i] = (b>>1)|c;
|
||||
c = (b<<7)&0x80;
|
||||
}
|
||||
}
|
||||
|
||||
void bn_gcd(u8 *out_d, u8 *in_a, u8 *in_b, u32 n)
|
||||
{
|
||||
u8 a[512], b[512], t[512], mn[512];
|
||||
int shift;
|
||||
|
||||
shift = 0;
|
||||
memset(mn, 0, 512);
|
||||
mn[0] = 0x80;
|
||||
|
||||
memcpy(a, in_a, n);
|
||||
memcpy(b, in_b, n);
|
||||
|
||||
if(bn_compare(a, b, n)<0){
|
||||
memcpy(t, a, n);
|
||||
memcpy(a, b, n);
|
||||
memcpy(b, t, n);
|
||||
}
|
||||
|
||||
while(!bn_is_zero(b, n)){
|
||||
if(bn_is_odd(a, n)){
|
||||
if(bn_is_odd(b, n)){
|
||||
bn_sub(a, a, b, mn, n);
|
||||
bn_rshift1(a, a, n);
|
||||
if(bn_compare(a, b, n)<0){
|
||||
memcpy(t, a, n);
|
||||
memcpy(a, b, n);
|
||||
memcpy(b, t, n);
|
||||
}
|
||||
}else{
|
||||
bn_rshift1(b, b, n);
|
||||
}
|
||||
}else{
|
||||
if(bn_is_odd(b, n)){
|
||||
bn_rshift1(a, a, n);
|
||||
if(bn_compare(a, b, n)<0){
|
||||
memcpy(t, a, n);
|
||||
memcpy(a, b, n);
|
||||
memcpy(b, t, n);
|
||||
}
|
||||
}else{
|
||||
bn_rshift1(a, a, n);
|
||||
bn_rshift1(b, b, n);
|
||||
shift += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// skip this step
|
||||
//bn_lshift(a, a, shift, n);
|
||||
|
||||
memcpy(out_d, a, n);
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,52 @@
|
|||
#ifndef __RIJNDAEL_H
|
||||
#define __RIJNDAEL_H
|
||||
|
||||
#include "kirk_engine.h"
|
||||
|
||||
#define AES_KEY_LEN_128 (128)
|
||||
#define AES_KEY_LEN_192 (192)
|
||||
#define AES_KEY_LEN_256 (256)
|
||||
|
||||
#define AES_BUFFER_SIZE (16)
|
||||
|
||||
#define AES_MAXKEYBITS (256)
|
||||
#define AES_MAXKEYBYTES (AES_MAXKEYBITS/8)
|
||||
/* for 256-bit keys, fewer for less */
|
||||
#define AES_MAXROUNDS 14
|
||||
|
||||
/* The structure for key information */
|
||||
typedef struct
|
||||
{
|
||||
int enc_only; /* context contains only encrypt schedule */
|
||||
int Nr; /* key-length-dependent number of rounds */
|
||||
u32 ek[4*(AES_MAXROUNDS + 1)]; /* encrypt key schedule */
|
||||
u32 dk[4*(AES_MAXROUNDS + 1)]; /* decrypt key schedule */
|
||||
} AES_ctx;
|
||||
|
||||
int AES_set_key(AES_ctx *ctx, const u8 *key, int bits);
|
||||
void AES_encrypt(AES_ctx *ctx, const u8 *src, u8 *dst);
|
||||
void AES_decrypt(AES_ctx *ctx, const u8 *src, u8 *dst);
|
||||
void AES_cbc_encrypt(AES_ctx *ctx, u8 *src, u8 *dst, int size);
|
||||
void AES_cbc_decrypt(AES_ctx *ctx, u8 *src, u8 *dst, int size);
|
||||
void AES_CMAC(AES_ctx *ctx, unsigned char *input, int length, unsigned char *mac);
|
||||
|
||||
typedef struct SHA1Context
|
||||
{
|
||||
unsigned Message_Digest[5]; /* Message Digest (output) */
|
||||
unsigned Length_Low; /* Message length in bits */
|
||||
unsigned Length_High; /* Message length in bits */
|
||||
unsigned char Message_Block[64]; /* 512-bit message blocks */
|
||||
int Message_Block_Index; /* Index into message block array */
|
||||
int Computed; /* Is the digest computed? */
|
||||
int Corrupted; /* Is the message digest corruped? */
|
||||
} SHA1Context;
|
||||
|
||||
/*
|
||||
* Function Prototypes
|
||||
*/
|
||||
void SHA1Reset(SHA1Context *);
|
||||
void SHA1Input(SHA1Context *, const unsigned char *, unsigned);
|
||||
int SHA1Result(SHA1Context *);
|
||||
void SHA1(unsigned char *d, size_t n, unsigned char *md);
|
||||
|
||||
#endif /* __RIJNDAEL_H */
|
|
@ -0,0 +1,406 @@
|
|||
// Copyright 2007,2008,2010 Segher Boessenkool <segher@kernel.crashing.org>
|
||||
// Licensed under the terms of the GNU GPL, version 2
|
||||
// http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "kirk_engine.h"
|
||||
#include "ecdsa.h"
|
||||
|
||||
struct point {
|
||||
u8 x[20];
|
||||
u8 y[20];
|
||||
};
|
||||
|
||||
static u8 ec_p[20];
|
||||
static u8 ec_a[20]; // mon
|
||||
static u8 ec_b[20]; // mon
|
||||
static u8 ec_N[20];
|
||||
static struct point ec_G; // mon
|
||||
static struct point ec_Q; // mon
|
||||
static u8 ec_k[20]; // private key
|
||||
|
||||
static void elt_copy(u8 *d, u8 *a)
|
||||
{
|
||||
memcpy(d, a, 20);
|
||||
}
|
||||
|
||||
static void elt_zero(u8 *d)
|
||||
{
|
||||
memset(d, 0, 20);
|
||||
}
|
||||
|
||||
static int elt_is_zero(u8 *d)
|
||||
{
|
||||
u32 i;
|
||||
|
||||
for (i = 0; i < 20; i++)
|
||||
if (d[i] != 0)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void elt_add(u8 *d, u8 *a, u8 *b)
|
||||
{
|
||||
bn_add(d, a, b, ec_p, 20);
|
||||
}
|
||||
|
||||
static void elt_sub(u8 *d, u8 *a, u8 *b)
|
||||
{
|
||||
bn_sub(d, a, b, ec_p, 20);
|
||||
}
|
||||
|
||||
static void elt_mul(u8 *d, u8 *a, u8 *b)
|
||||
{
|
||||
bn_mon_mul(d, a, b, ec_p, 20);
|
||||
}
|
||||
|
||||
static void elt_square(u8 *d, u8 *a)
|
||||
{
|
||||
elt_mul(d, a, a);
|
||||
}
|
||||
|
||||
static void elt_inv(u8 *d, u8 *a)
|
||||
{
|
||||
u8 s[20];
|
||||
elt_copy(s, a);
|
||||
bn_mon_inv(d, s, ec_p, 20);
|
||||
}
|
||||
|
||||
static void point_to_mon(struct point *p)
|
||||
{
|
||||
bn_to_mon(p->x, ec_p, 20);
|
||||
bn_to_mon(p->y, ec_p, 20);
|
||||
}
|
||||
|
||||
static void point_from_mon(struct point *p)
|
||||
{
|
||||
bn_from_mon(p->x, ec_p, 20);
|
||||
bn_from_mon(p->y, ec_p, 20);
|
||||
}
|
||||
|
||||
static void point_zero(struct point *p)
|
||||
{
|
||||
elt_zero(p->x);
|
||||
elt_zero(p->y);
|
||||
}
|
||||
|
||||
static int point_is_zero(struct point *p)
|
||||
{
|
||||
return elt_is_zero(p->x) && elt_is_zero(p->y);
|
||||
}
|
||||
|
||||
static void point_double(struct point *r, struct point *p)
|
||||
{
|
||||
u8 s[20], t[20];
|
||||
struct point pp;
|
||||
u8 *px, *py, *rx, *ry;
|
||||
|
||||
pp = *p;
|
||||
|
||||
px = pp.x;
|
||||
py = pp.y;
|
||||
rx = r->x;
|
||||
ry = r->y;
|
||||
|
||||
if (elt_is_zero(py)) {
|
||||
point_zero(r);
|
||||
return;
|
||||
}
|
||||
|
||||
elt_square(t, px); // t = px*px
|
||||
elt_add(s, t, t); // s = 2*px*px
|
||||
elt_add(s, s, t); // s = 3*px*px
|
||||
elt_add(s, s, ec_a);// s = 3*px*px + a
|
||||
elt_add(t, py, py); // t = 2*py
|
||||
elt_inv(t, t); // t = 1/(2*py)
|
||||
elt_mul(s, s, t); // s = (3*px*px+a)/(2*py)
|
||||
|
||||
elt_square(rx, s); // rx = s*s
|
||||
elt_add(t, px, px); // t = 2*px
|
||||
elt_sub(rx, rx, t); // rx = s*s - 2*px
|
||||
|
||||
elt_sub(t, px, rx); // t = -(rx-px)
|
||||
elt_mul(ry, s, t); // ry = -s*(rx-px)
|
||||
elt_sub(ry, ry, py);// ry = -s*(rx-px) - py
|
||||
}
|
||||
|
||||
static void point_add(struct point *r, struct point *p, struct point *q)
|
||||
{
|
||||
u8 s[20], t[20], u[20];
|
||||
u8 *px, *py, *qx, *qy, *rx, *ry;
|
||||
struct point pp, qq;
|
||||
|
||||
pp = *p;
|
||||
qq = *q;
|
||||
|
||||
px = pp.x;
|
||||
py = pp.y;
|
||||
qx = qq.x;
|
||||
qy = qq.y;
|
||||
rx = r->x;
|
||||
ry = r->y;
|
||||
|
||||
if (point_is_zero(&pp)) {
|
||||
elt_copy(rx, qx);
|
||||
elt_copy(ry, qy);
|
||||
return;
|
||||
}
|
||||
|
||||
if (point_is_zero(&qq)) {
|
||||
elt_copy(rx, px);
|
||||
elt_copy(ry, py);
|
||||
return;
|
||||
}
|
||||
|
||||
elt_sub(u, qx, px);
|
||||
|
||||
if (elt_is_zero(u)) {
|
||||
elt_sub(u, qy, py);
|
||||
if (elt_is_zero(u))
|
||||
point_double(r, &pp);
|
||||
else
|
||||
point_zero(r);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
elt_inv(t, u); // t = 1/(qx-px)
|
||||
elt_sub(u, qy, py); // u = qy-py
|
||||
elt_mul(s, t, u); // s = (qy-py)/(qx-px)
|
||||
|
||||
elt_square(rx, s); // rx = s*s
|
||||
elt_add(t, px, qx); // t = px+qx
|
||||
elt_sub(rx, rx, t); // rx = s*s - (px+qx)
|
||||
|
||||
elt_sub(t, px, rx); // t = -(rx-px)
|
||||
elt_mul(ry, s, t); // ry = -s*(rx-px)
|
||||
elt_sub(ry, ry, py);// ry = -s*(rx-px) - py
|
||||
}
|
||||
|
||||
static void point_mul(struct point *d, u8 *a, struct point *b)
|
||||
{
|
||||
u32 i;
|
||||
u8 mask;
|
||||
|
||||
point_zero(d);
|
||||
|
||||
for (i = 0; i < 20; i++)
|
||||
for (mask = 0x80; mask != 0; mask >>= 1) {
|
||||
point_double(d, d);
|
||||
if ((a[i] & mask) != 0)
|
||||
point_add(d, d, b);
|
||||
}
|
||||
}
|
||||
|
||||
static void generate_ecdsa(u8 *R, u8 *S, u8 *k, u8 *hash, u8 *random)
|
||||
{
|
||||
u8 e[20];
|
||||
u8 kk[20];
|
||||
u8 m[20];
|
||||
u8 minv[20];
|
||||
struct point mG;
|
||||
|
||||
memcpy(e, hash, 20);
|
||||
bn_reduce(e, ec_N, 20);
|
||||
|
||||
if(random==NULL){
|
||||
do{
|
||||
kirk_CMD14(m, 20);
|
||||
}while(bn_compare(m, ec_N, 20) >= 0);
|
||||
}else{
|
||||
memcpy(m, random, 20);
|
||||
}
|
||||
|
||||
point_mul(&mG, m, &ec_G);
|
||||
point_from_mon(&mG);
|
||||
elt_copy(R, mG.x);
|
||||
|
||||
bn_copy(kk, k, 20);
|
||||
bn_reduce(kk, ec_N, 20);
|
||||
bn_to_mon(m, ec_N, 20);
|
||||
bn_to_mon(e, ec_N, 20);
|
||||
bn_to_mon(R, ec_N, 20);
|
||||
bn_to_mon(kk, ec_N, 20);
|
||||
|
||||
bn_mon_mul(S, R, kk, ec_N, 20);
|
||||
bn_add(kk, S, e, ec_N, 20);
|
||||
bn_mon_inv(minv, m, ec_N, 20);
|
||||
bn_mon_mul(S, minv, kk, ec_N, 20);
|
||||
|
||||
bn_from_mon(R, ec_N, 20);
|
||||
bn_from_mon(S, ec_N, 20);
|
||||
}
|
||||
|
||||
static int check_ecdsa(struct point *Q, u8 *R, u8 *S, u8 *hash)
|
||||
{
|
||||
u8 Sinv[20];
|
||||
u8 e[20];
|
||||
u8 w1[20], w2[20];
|
||||
struct point r1, r2, r3;
|
||||
u8 rr[20];
|
||||
|
||||
memcpy(e, hash, 20);
|
||||
bn_reduce(e, ec_N, 20);
|
||||
|
||||
// Sinv = INV(s)
|
||||
bn_to_mon(S, ec_N, 20);
|
||||
bn_mon_inv(Sinv, S, ec_N, 20);
|
||||
|
||||
// w1 = e*Sinv
|
||||
bn_to_mon(e, ec_N, 20);
|
||||
bn_mon_mul(w1, e, Sinv, ec_N, 20);
|
||||
bn_from_mon(w1, ec_N, 20);
|
||||
|
||||
// w2 = R*Sinv
|
||||
bn_to_mon(R, ec_N, 20);
|
||||
bn_mon_mul(w2, R, Sinv, ec_N, 20);
|
||||
bn_from_mon(w2, ec_N, 20);
|
||||
|
||||
// r1 = w1*G
|
||||
point_mul(&r1, w1, &ec_G);
|
||||
// r2 = w2*Q
|
||||
point_mul(&r2, w2, Q);
|
||||
// r3 = r1+r2
|
||||
point_add(&r3, &r1, &r2);
|
||||
|
||||
point_from_mon(&r3);
|
||||
memcpy(rr, r3.x, 20);
|
||||
bn_reduce(rr, ec_N, 20);
|
||||
|
||||
bn_from_mon(R, ec_N, 20);
|
||||
bn_from_mon(S, ec_N, 20);
|
||||
|
||||
return bn_compare(rr, R, 20);
|
||||
}
|
||||
|
||||
void ecdsa_sign_fixed(u8 *hash, u8 *fixed_m, u8 *fixed_r, u8 *S)
|
||||
{
|
||||
u8 minv[20], m[20], k[20], r[20], z[20];
|
||||
|
||||
memcpy(z, hash, 20);
|
||||
memcpy(k, ec_k, 20);
|
||||
memcpy(m, fixed_m, 20);
|
||||
memcpy(r, fixed_r, 20);
|
||||
|
||||
bn_to_mon(m, ec_N, 20);
|
||||
bn_mon_inv(minv, m, ec_N, 20);
|
||||
|
||||
bn_to_mon(k, ec_N, 20);
|
||||
bn_to_mon(r, ec_N, 20);
|
||||
bn_mon_mul(z, k, r, ec_N, 20);
|
||||
bn_from_mon(z, ec_N, 20);
|
||||
|
||||
bn_add(z, z, hash, ec_N, 20);
|
||||
|
||||
bn_to_mon(z, ec_N, 20);
|
||||
bn_mon_mul(S, minv, z, ec_N, 20);
|
||||
bn_from_mon(S, ec_N, 20);
|
||||
}
|
||||
|
||||
void ecdsa_set_curve(ECDSA_PARAM *param)
|
||||
{
|
||||
memcpy(ec_p, param->p, 20);
|
||||
memcpy(ec_a, param->a, 20);
|
||||
memcpy(ec_b, param->b, 20);
|
||||
memcpy(ec_N, param->N, 20);
|
||||
memcpy(ec_G.x, param->Gx, 20);
|
||||
memcpy(ec_G.y, param->Gy, 20);
|
||||
|
||||
bn_to_mon(ec_a, ec_p, 20);
|
||||
bn_to_mon(ec_b, ec_p, 20);
|
||||
|
||||
point_to_mon(&ec_G);
|
||||
}
|
||||
|
||||
void ecdsa_set_N(u8 *N)
|
||||
{
|
||||
memcpy(ec_N, N, 20);
|
||||
}
|
||||
|
||||
void ecdsa_set_pub(u8 *Qx, u8 *Qy)
|
||||
{
|
||||
memcpy(ec_Q.x, Qx, 20);
|
||||
memcpy(ec_Q.y, Qy, 20);
|
||||
point_to_mon(&ec_Q);
|
||||
}
|
||||
|
||||
void ecdsa_set_priv(u8 *k)
|
||||
{
|
||||
memcpy(ec_k, k, sizeof ec_k);
|
||||
}
|
||||
|
||||
int ecdsa_verify(u8 *hash, u8 *R, u8 *S)
|
||||
{
|
||||
return check_ecdsa(&ec_Q, R, S, hash);
|
||||
}
|
||||
|
||||
void ecdsa_sign(u8 *hash, u8 *R, u8 *S, u8 *random)
|
||||
{
|
||||
generate_ecdsa(R, S, ec_k, hash, random);
|
||||
}
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
// calculate the random and private key from signs with same r value
|
||||
void ecdsa_find_m_k(u8 *sig_r, u8 *sig_s1, u8 *hash1, u8 *sig_s2, u8 *hash2, u8 *N, u8 *ret_m, u8 *ret_k)
|
||||
{
|
||||
u8 e1[20], e2[20];
|
||||
u8 s1[20], s2[20];
|
||||
u8 sinv[20], m[20];
|
||||
u8 r[20], rinv[20], kk[20];
|
||||
|
||||
// e1
|
||||
memcpy(e1, hash1, 20);
|
||||
// e2
|
||||
memcpy(e2, hash2, 20);
|
||||
// s1, s2
|
||||
memcpy(s1, sig_s1, 20);
|
||||
memcpy(s2, sig_s2, 20);
|
||||
|
||||
// restore random m
|
||||
// s1 = s1-s2
|
||||
bn_sub(s1, s1, s2, N, 20);
|
||||
// e1 = e1-e2
|
||||
bn_sub(e1, e1, e2, N, 20);
|
||||
|
||||
bn_to_mon(s1, N, 20);
|
||||
bn_to_mon(e1, N, 20);
|
||||
|
||||
// m = (e1-e2)/(s1-s2)
|
||||
bn_mon_inv(sinv, s1, N, 20);
|
||||
bn_mon_mul(m, sinv, e1, N, 20);
|
||||
bn_from_mon(m, N, 20);
|
||||
|
||||
bn_dump("random m", m, 20);
|
||||
memcpy(ret_m, m, 20);
|
||||
|
||||
// restore private key
|
||||
memcpy(e1, hash1, 20);
|
||||
memcpy(s1, sig_s1, 20);
|
||||
memcpy(r, sig_r, 20);
|
||||
|
||||
// kk = m*s
|
||||
bn_to_mon(s1, N, 20);
|
||||
bn_to_mon(m, N, 20);
|
||||
bn_mon_mul(kk, m, s1, N, 20);
|
||||
|
||||
// kk = m*s-e
|
||||
bn_from_mon(kk, N, 20);
|
||||
bn_sub(kk, kk, e1, N, 20);
|
||||
bn_to_mon(kk, N, 20);
|
||||
|
||||
// kk = (m*s-e)/r
|
||||
bn_to_mon(r, N, 20);
|
||||
bn_mon_inv(rinv, r, N, 20);
|
||||
bn_mon_mul(kk, rinv, kk, N, 20);
|
||||
bn_from_mon(kk, N, 20);
|
||||
|
||||
bn_dump("private key", kk, 20);
|
||||
memcpy(ret_k, kk, 20);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
// Copyright 2010 Sven Peter <svenpeter@gmail.com>
|
||||
// Copyright 2007,2008,2010 Segher Boessenkool <segher@kernel.crashing.org>
|
||||
// Licensed under the terms of the GNU GPL, version 2
|
||||
// http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
|
||||
|
||||
#ifndef ECDSA_H__
|
||||
#define ECDSA_H__ 1
|
||||
|
||||
typedef struct {
|
||||
u8 p[20];
|
||||
u8 a[20];
|
||||
u8 b[20];
|
||||
u8 N[20];
|
||||
u8 Gx[20];
|
||||
u8 Gy[20];
|
||||
}ECDSA_PARAM;
|
||||
|
||||
void ecdsa_set_curve(ECDSA_PARAM *param);
|
||||
void ecdsa_set_N(u8 *N);
|
||||
void ecdsa_set_pub(u8 *Qx, u8 *Qy);
|
||||
void ecdsa_set_priv(u8 *k);
|
||||
int ecdsa_verify(u8 *hash, u8 *R, u8 *S);
|
||||
void ecdsa_sign(u8 *hash, u8 *R, u8 *S, u8 *random);
|
||||
void ecdsa_sign_fixed(u8 *hash, u8 *fixed_m, u8 *fixed_r, u8 *S);
|
||||
void ecdsa_find_m_k(u8 *sig_r, u8 *sig_s1, u8 *hash1, u8 *sig_s2, u8 *hash2, u8 *N, u8 *ret_m, u8 *ret_k);
|
||||
|
||||
void bn_dump(char *msg, u8 *d, u32 n);
|
||||
int bn_is_zero(u8 *d, u32 n);
|
||||
void bn_copy(u8 *d, u8 *a, u32 n);
|
||||
int bn_compare(u8 *a, u8 *b, u32 n);
|
||||
void bn_reduce(u8 *d, u8 *N, u32 n);
|
||||
void bn_add(u8 *d, u8 *a, u8 *b, u8 *N, u32 n);
|
||||
void bn_sub(u8 *d, u8 *a, u8 *b, u8 *N, u32 n);
|
||||
void bn_to_mon(u8 *d, u8 *N, u32 n);
|
||||
void bn_from_mon(u8 *d, u8 *N, u32 n);
|
||||
void bn_mon_mul(u8 *d, u8 *a, u8 *b, u8 *N, u32 n);
|
||||
void bn_mon_inv(u8 *d, u8 *a, u8 *N, u32 n);
|
||||
|
||||
void bn_mul(u8 *d, u8 *a, u8 *b, u8 *N, u32 n);
|
||||
void bn_gcd(u8 *out_d, u8 *in_a, u8 *in_b, u32 n);
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,474 @@
|
|||
/*
|
||||
KIRK ENGINE CODE
|
||||
Thx for coyotebean, Davee, hitchhikr, kgsws, Mathieulh, SilverSpring, Proxima
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "crypto.h"
|
||||
#include "ecdsa.h"
|
||||
|
||||
/* ------------------------- KEY VAULT ------------------------- */
|
||||
|
||||
|
||||
|
||||
// ECDSA param of kirk1
|
||||
ECDSA_PARAM ecdsa_kirk1 = {
|
||||
.p = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x01,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF},
|
||||
.a = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x01,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC},
|
||||
.b = {0x65,0xD1,0x48,0x8C,0x03,0x59,0xE2,0x34,0xAD,0xC9,0x5B,0xD3,0x90,0x80,0x14,0xBD,0x91,0xA5,0x25,0xF9},
|
||||
.N = {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x01,0xb5,0xc6,0x17,0xf2,0x90,0xea,0xe1,0xdb,0xad,0x8f},
|
||||
.Gx = {0x22,0x59,0xAC,0xEE,0x15,0x48,0x9C,0xB0,0x96,0xA8,0x82,0xF0,0xAE,0x1C,0xF9,0xFD,0x8E,0xE5,0xF8,0xFA},
|
||||
.Gy = {0x60,0x43,0x58,0x45,0x6D,0x0A,0x1C,0xB2,0x90,0x8D,0xE9,0x0F,0x27,0xD7,0x5C,0x82,0xBE,0xC1,0x08,0xC0},
|
||||
};
|
||||
|
||||
// ECDSA private key of kirk1
|
||||
u8 priv_key_kirk1[20] = {0xF3,0x92,0xE2,0x64,0x90,0xB8,0x0F,0xD8,0x89,0xF2,0xD9,0x72,0x2C,0x1F,0x34,0xD7,0x27,0x4F,0x98,0x3D};
|
||||
|
||||
// ECDSA public key of kirk1
|
||||
u8 pub_key_kirk1_x[20] = {0xED,0x9C,0xE5,0x82,0x34,0xE6,0x1A,0x53,0xC6,0x85,0xD6,0x4D,0x51,0xD0,0x23,0x6B,0xC3,0xB5,0xD4,0xB9 };
|
||||
u8 pub_key_kirk1_y[20] = {0x04,0x9D,0xF1,0xA0,0x75,0xC0,0xE0,0x4F,0xB3,0x44,0x85,0x8B,0x61,0xB7,0x9B,0x69,0xA6,0x3D,0x2C,0x39 };
|
||||
|
||||
|
||||
u8 kirk1_ec_m_header[20] = {0x7D,0x7E,0x46,0x85,0x4D,0x07,0xFA,0x0B,0xC6,0xE8,0xED,0x62,0x99,0x89,0x26,0x14,0x39,0x5F,0xEA,0xFC};
|
||||
u8 kirk1_ec_r_header[20] = {0x66,0x4f,0xe1,0xf2,0xe9,0xd6,0x63,0x36,0xf7,0x33,0x0b,0xca,0xb9,0x55,0x6d,0xb6,0xeb,0xe8,0x05,0xdc};
|
||||
|
||||
u8 kirk1_ec_m_data[20] = {0x15,0xee,0x16,0x24,0x12,0x09,0x58,0x16,0x0f,0x8b,0x1a,0x21,0x33,0x7a,0x38,0xf8,0x29,0xf7,0x2e,0x58};
|
||||
u8 kirk1_ec_r_data[20] = {0xcd,0xe3,0x88,0xa6,0x3c,0x1d,0x57,0xdc,0x5e,0x94,0xee,0xac,0x2e,0x6c,0x9f,0x2e,0x81,0xc7,0x1c,0x58};
|
||||
|
||||
// ECDSA param of applations
|
||||
ECDSA_PARAM ecdsa_app = {
|
||||
.p = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x01,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF},
|
||||
.a = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x01,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC},
|
||||
.b = {0xA6,0x8B,0xED,0xC3,0x34,0x18,0x02,0x9C,0x1D,0x3C,0xE3,0x3B,0x9A,0x32,0x1F,0xCC,0xBB,0x9E,0x0F,0x0B},
|
||||
.N = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xB5,0xAE,0x3C,0x52,0x3E,0x63,0x94,0x4F,0x21,0x27},
|
||||
.Gx = {0x12,0x8E,0xC4,0x25,0x64,0x87,0xFD,0x8F,0xDF,0x64,0xE2,0x43,0x7B,0xC0,0xA1,0xF6,0xD5,0xAF,0xDE,0x2C},
|
||||
.Gy = {0x59,0x58,0x55,0x7E,0xB1,0xDB,0x00,0x12,0x60,0x42,0x55,0x24,0xDB,0xC3,0x79,0xD5,0xAC,0x5F,0x4A,0xDF},
|
||||
};
|
||||
|
||||
// ECDSA private key of EDATA
|
||||
u8 priv_key_edata[20] = {0xe5,0xc4,0xd0,0xa8,0x24,0x9a,0x6f,0x27,0xe5,0xe0,0xc9,0xd5,0x34,0xf4,0xda,0x15,0x22,0x3f,0x42,0xad};
|
||||
|
||||
|
||||
// AES key for kirk1
|
||||
u8 kirk1_key[16] = {0x98, 0xC9, 0x40, 0x97, 0x5C, 0x1D, 0x10, 0xE8, 0x7F, 0xE6, 0x0E, 0xA3, 0xFD, 0x03, 0xA8, 0xBA};
|
||||
|
||||
// AES key for kirk4/7
|
||||
u8 kirk7_key03[] = {0x98, 0x02, 0xC4, 0xE6, 0xEC, 0x9E, 0x9E, 0x2F, 0xFC, 0x63, 0x4C, 0xE4, 0x2F, 0xBB, 0x46, 0x68};
|
||||
u8 kirk7_key04[] = {0x99, 0x24, 0x4C, 0xD2, 0x58, 0xF5, 0x1B, 0xCB, 0xB0, 0x61, 0x9C, 0xA7, 0x38, 0x30, 0x07, 0x5F};
|
||||
u8 kirk7_key05[] = {0x02, 0x25, 0xD7, 0xBA, 0x63, 0xEC, 0xB9, 0x4A, 0x9D, 0x23, 0x76, 0x01, 0xB3, 0xF6, 0xAC, 0x17};
|
||||
u8 kirk7_key0C[] = {0x84, 0x85, 0xC8, 0x48, 0x75, 0x08, 0x43, 0xBC, 0x9B, 0x9A, 0xEC, 0xA7, 0x9C, 0x7F, 0x60, 0x18};
|
||||
u8 kirk7_key0D[] = {0xB5, 0xB1, 0x6E, 0xDE, 0x23, 0xA9, 0x7B, 0x0E, 0xA1, 0x7C, 0xDB, 0xA2, 0xDC, 0xDE, 0xC4, 0x6E};
|
||||
u8 kirk7_key0E[] = {0xC8, 0x71, 0xFD, 0xB3, 0xBC, 0xC5, 0xD2, 0xF2, 0xE2, 0xD7, 0x72, 0x9D, 0xDF, 0x82, 0x68, 0x82};
|
||||
u8 kirk7_key0F[] = {0x0A, 0xBB, 0x33, 0x6C, 0x96, 0xD4, 0xCD, 0xD8, 0xCB, 0x5F, 0x4B, 0xE0, 0xBA, 0xDB, 0x9E, 0x03};
|
||||
u8 kirk7_key10[] = {0x32, 0x29, 0x5B, 0xD5, 0xEA, 0xF7, 0xA3, 0x42, 0x16, 0xC8, 0x8E, 0x48, 0xFF, 0x50, 0xD3, 0x71};
|
||||
u8 kirk7_key11[] = {0x46, 0xF2, 0x5E, 0x8E, 0x4D, 0x2A, 0xA5, 0x40, 0x73, 0x0B, 0xC4, 0x6E, 0x47, 0xEE, 0x6F, 0x0A};
|
||||
u8 kirk7_key12[] = {0x5D, 0xC7, 0x11, 0x39, 0xD0, 0x19, 0x38, 0xBC, 0x02, 0x7F, 0xDD, 0xDC, 0xB0, 0x83, 0x7D, 0x9D};
|
||||
u8 kirk7_key38[] = {0x12, 0x46, 0x8D, 0x7E, 0x1C, 0x42, 0x20, 0x9B, 0xBA, 0x54, 0x26, 0x83, 0x5E, 0xB0, 0x33, 0x03};
|
||||
u8 kirk7_key39[] = {0xC4, 0x3B, 0xB6, 0xD6, 0x53, 0xEE, 0x67, 0x49, 0x3E, 0xA9, 0x5F, 0xBC, 0x0C, 0xED, 0x6F, 0x8A};
|
||||
u8 kirk7_key3A[] = {0x2C, 0xC3, 0xCF, 0x8C, 0x28, 0x78, 0xA5, 0xA6, 0x63, 0xE2, 0xAF, 0x2D, 0x71, 0x5E, 0x86, 0xBA};
|
||||
u8 kirk7_key4B[] = {0x0C, 0xFD, 0x67, 0x9A, 0xF9, 0xB4, 0x72, 0x4F, 0xD7, 0x8D, 0xD6, 0xE9, 0x96, 0x42, 0x28, 0x8B}; //1.xx game eboot.bin
|
||||
u8 kirk7_key53[] = {0xAF, 0xFE, 0x8E, 0xB1, 0x3D, 0xD1, 0x7E, 0xD8, 0x0A, 0x61, 0x24, 0x1C, 0x95, 0x92, 0x56, 0xB6};
|
||||
u8 kirk7_key57[] = {0x1C, 0x9B, 0xC4, 0x90, 0xE3, 0x06, 0x64, 0x81, 0xFA, 0x59, 0xFD, 0xB6, 0x00, 0xBB, 0x28, 0x70};
|
||||
u8 kirk7_key5D[] = {0x11, 0x5A, 0x5D, 0x20, 0xD5, 0x3A, 0x8D, 0xD3, 0x9C, 0xC5, 0xAF, 0x41, 0x0F, 0x0F, 0x18, 0x6F};
|
||||
u8 kirk7_key63[] = {0x9C, 0x9B, 0x13, 0x72, 0xF8, 0xC6, 0x40, 0xCF, 0x1C, 0x62, 0xF5, 0xD5, 0x92, 0xDD, 0xB5, 0x82};
|
||||
u8 kirk7_key64[] = {0x03, 0xB3, 0x02, 0xE8, 0x5F, 0xF3, 0x81, 0xB1, 0x3B, 0x8D, 0xAA, 0x2A, 0x90, 0xFF, 0x5E, 0x61};
|
||||
|
||||
|
||||
/* ------------------------- INTERNAL STUFF ------------------------- */
|
||||
|
||||
typedef struct header_keys
|
||||
{
|
||||
u8 AES[16];
|
||||
u8 CMAC[16];
|
||||
}header_keys;
|
||||
|
||||
AES_ctx aes_kirk1;
|
||||
|
||||
int is_kirk_initialized = 0;
|
||||
|
||||
|
||||
|
||||
/* ------------------------- IMPLEMENTATION ------------------------- */
|
||||
|
||||
/*****************************************************************************/
|
||||
/* KIRK initial */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
__declspec(dllexport) int kirk_init()
|
||||
{
|
||||
AES_set_key(&aes_kirk1, kirk1_key, 128);
|
||||
is_kirk_initialized = 1;
|
||||
srand(time(0));
|
||||
return KIRK_OPERATION_SUCCESS;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* KIRK 0x01 */
|
||||
/*****************************************************************************/
|
||||
|
||||
int kirk_CMD0(void* outbuff, void* inbuff, int size)
|
||||
{
|
||||
KIRK_CMD1_HEADER *header;
|
||||
header_keys *keys;
|
||||
AES_ctx k1, cmac_key;
|
||||
int chk_size;
|
||||
u8 cmac_header_hash[16];
|
||||
u8 cmac_data_hash[16];
|
||||
|
||||
if(is_kirk_initialized == 0)
|
||||
kirk_init();
|
||||
|
||||
header = (KIRK_CMD1_HEADER*)outbuff;
|
||||
memcpy(outbuff, inbuff, size);
|
||||
|
||||
if(header->mode != KIRK_MODE_CMD1)
|
||||
return KIRK_INVALID_MODE;
|
||||
|
||||
//0-15 AES key, 16-31 CMAC key
|
||||
keys = (header_keys *)outbuff;
|
||||
|
||||
//Make sure data is 16 aligned
|
||||
chk_size = header->data_size;
|
||||
if(chk_size%16)
|
||||
chk_size += 16-(chk_size%16);
|
||||
|
||||
//Encrypt data
|
||||
AES_set_key(&k1, keys->AES, 128);
|
||||
AES_cbc_encrypt(&k1, (char*)inbuff + sizeof(KIRK_CMD1_HEADER) + header->data_offset, (char*)outbuff + sizeof(KIRK_CMD1_HEADER) + header->data_offset, chk_size);
|
||||
|
||||
if(header->ecdsa==1){
|
||||
//ECDSA hash
|
||||
u8 *sign_s, *sign_r;
|
||||
u8 sign_e[20];
|
||||
|
||||
ecdsa_set_curve(&ecdsa_kirk1);
|
||||
ecdsa_set_priv(priv_key_kirk1);
|
||||
|
||||
SHA1((char*)outbuff+0x60, 0x30, sign_e);
|
||||
sign_r = (char*)outbuff+0x10;
|
||||
sign_s = (char*)outbuff+0x10+0x14;
|
||||
ecdsa_sign(sign_e, sign_r, sign_s, NULL);
|
||||
|
||||
SHA1((char*)outbuff+0x60, 0x30+chk_size+header->data_offset, sign_e);
|
||||
sign_r = (char*)outbuff+0x10+0x28;
|
||||
sign_s = (char*)outbuff+0x10+0x3C;
|
||||
ecdsa_sign(sign_e, sign_r, sign_s, NULL);
|
||||
|
||||
|
||||
//Encrypt keys
|
||||
AES_cbc_encrypt(&aes_kirk1, inbuff, outbuff, 16);
|
||||
}else{
|
||||
//CMAC hash
|
||||
AES_set_key(&cmac_key, keys->CMAC, 128);
|
||||
|
||||
AES_CMAC(&cmac_key, (char*)outbuff+0x60, 0x30, cmac_header_hash);
|
||||
AES_CMAC(&cmac_key, (char*)outbuff+0x60, 0x30+chk_size+header->data_offset, cmac_data_hash);
|
||||
|
||||
memcpy(header->CMAC_header_hash, cmac_header_hash, 16);
|
||||
memcpy(header->CMAC_data_hash, cmac_data_hash, 16);
|
||||
|
||||
//Encrypt keys
|
||||
AES_cbc_encrypt(&aes_kirk1, inbuff, outbuff, 16*2);
|
||||
}
|
||||
|
||||
return KIRK_OPERATION_SUCCESS;
|
||||
}
|
||||
|
||||
int kirk_CMD1(void* outbuff, void* inbuff, int size)
|
||||
{
|
||||
KIRK_CMD1_HEADER* header;
|
||||
header_keys keys; //0-15 AES key, 16-31 CMAC key
|
||||
AES_ctx k1;
|
||||
int retv;
|
||||
|
||||
if(is_kirk_initialized == 0)
|
||||
kirk_init();
|
||||
|
||||
header = (KIRK_CMD1_HEADER*)inbuff;
|
||||
if(header->mode != KIRK_MODE_CMD1)
|
||||
return KIRK_INVALID_MODE;
|
||||
|
||||
if(size < header->data_size)
|
||||
size = header->data_size;
|
||||
size = (size+15)&~15;
|
||||
|
||||
//decrypt AES & CMAC key to temp buffer
|
||||
AES_cbc_decrypt(&aes_kirk1, inbuff, (u8*)&keys, 16*2);
|
||||
|
||||
if(header->ecdsa==0){
|
||||
retv = kirk_CMD10(inbuff, size);
|
||||
if(retv != KIRK_OPERATION_SUCCESS)
|
||||
return retv;
|
||||
}else if(header->ecdsa==1){
|
||||
u8 *sign_s, *sign_r;
|
||||
u8 sign_e[20];
|
||||
|
||||
ecdsa_set_curve(&ecdsa_kirk1);
|
||||
ecdsa_set_pub(pub_key_kirk1_x, pub_key_kirk1_y);
|
||||
|
||||
SHA1((char*)inbuff+0x60, 0x30, sign_e);
|
||||
sign_r = (char*)inbuff+0x10;
|
||||
sign_s = (char*)inbuff+0x10+0x14;
|
||||
retv = ecdsa_verify(sign_e, sign_r, sign_s);
|
||||
if(retv){
|
||||
return KIRK_HEADER_HASH_INVALID;
|
||||
}
|
||||
|
||||
size = 0x30+header->data_size+header->data_offset;
|
||||
size = (size+15)&~15;
|
||||
SHA1((char*)inbuff+0x60, size, sign_e);
|
||||
sign_r = (char*)inbuff+0x10+0x28;
|
||||
sign_s = (char*)inbuff+0x10+0x3C;
|
||||
retv = ecdsa_verify(sign_e, sign_r, sign_s);
|
||||
if(retv){
|
||||
return KIRK_HEADER_HASH_INVALID;
|
||||
}
|
||||
}
|
||||
|
||||
AES_set_key(&k1, keys.AES, 128);
|
||||
AES_cbc_decrypt(&k1, (char*)inbuff+sizeof(KIRK_CMD1_HEADER)+header->data_offset, outbuff, header->data_size);
|
||||
|
||||
return KIRK_OPERATION_SUCCESS;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* KIRK 0x04 0x05 0x06 0x07 0x08 0x09 */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
u8* kirk_4_7_get_key(int key_type)
|
||||
{
|
||||
switch(key_type)
|
||||
{
|
||||
case(0x03): return kirk7_key03; break;
|
||||
case(0x04): return kirk7_key04; break;
|
||||
case(0x05): return kirk7_key05; break;
|
||||
case(0x0C): return kirk7_key0C; break;
|
||||
case(0x0D): return kirk7_key0D; break;
|
||||
case(0x0E): return kirk7_key0E; break;
|
||||
case(0x0F): return kirk7_key0F; break;
|
||||
case(0x10): return kirk7_key10; break;
|
||||
case(0x11): return kirk7_key11; break;
|
||||
case(0x12): return kirk7_key12; break;
|
||||
case(0x38): return kirk7_key38; break;
|
||||
case(0x39): return kirk7_key39; break;
|
||||
case(0x3A): return kirk7_key3A; break;
|
||||
case(0x4B): return kirk7_key4B; break;
|
||||
case(0x53): return kirk7_key53; break;
|
||||
case(0x57): return kirk7_key57; break;
|
||||
case(0x5D): return kirk7_key5D; break;
|
||||
case(0x63): return kirk7_key63; break;
|
||||
case(0x64): return kirk7_key64; break;
|
||||
default:
|
||||
return NULL;
|
||||
//need to get the real error code for that, placeholder now :)
|
||||
}
|
||||
}
|
||||
|
||||
int kirk_CMD4(void* outbuff, void* inbuff, int size)
|
||||
{
|
||||
KIRK_AES128CBC_HEADER *header;
|
||||
AES_ctx aesKey;
|
||||
u8 *key;
|
||||
|
||||
if(is_kirk_initialized == 0)
|
||||
kirk_init();
|
||||
|
||||
header = (KIRK_AES128CBC_HEADER*)inbuff;
|
||||
|
||||
if(header->mode != KIRK_MODE_ENCRYPT_CBC)
|
||||
return KIRK_INVALID_MODE;
|
||||
|
||||
if(header->data_size==0)
|
||||
return KIRK_DATA_SIZE_ZERO;
|
||||
|
||||
key = kirk_4_7_get_key(header->keyseed);
|
||||
if(key==NULL)
|
||||
return KIRK_INVALID_SIZE;
|
||||
|
||||
//Set the key
|
||||
AES_set_key(&aesKey, key, 128);
|
||||
AES_cbc_encrypt(&aesKey, (char*)inbuff+0x14, (char*)outbuff+0x14, header->data_size);
|
||||
|
||||
memcpy(outbuff, inbuff, 0x14);
|
||||
*(u32*)outbuff = KIRK_MODE_DECRYPT_CBC;
|
||||
|
||||
return KIRK_OPERATION_SUCCESS;
|
||||
}
|
||||
|
||||
int kirk_CMD7(void* outbuff, void* inbuff, int size)
|
||||
{
|
||||
KIRK_AES128CBC_HEADER *header;
|
||||
AES_ctx aesKey;
|
||||
u8 *key;
|
||||
|
||||
if(is_kirk_initialized == 0)
|
||||
kirk_init();
|
||||
|
||||
header = (KIRK_AES128CBC_HEADER*)inbuff;
|
||||
|
||||
if(header->mode != KIRK_MODE_DECRYPT_CBC)
|
||||
return KIRK_INVALID_MODE;
|
||||
|
||||
if(header->data_size==0)
|
||||
return KIRK_DATA_SIZE_ZERO;
|
||||
|
||||
key = kirk_4_7_get_key(header->keyseed);
|
||||
if(key==NULL)
|
||||
return KIRK_INVALID_SIZE;
|
||||
|
||||
size = size < header->data_size ? size : header->data_size;
|
||||
|
||||
//Set the key
|
||||
AES_set_key(&aesKey, key, 128);
|
||||
AES_cbc_decrypt(&aesKey, (char*)inbuff+0x14, outbuff, header->data_size);
|
||||
|
||||
return KIRK_OPERATION_SUCCESS;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* KIRK 0x0A */
|
||||
/*****************************************************************************/
|
||||
|
||||
int kirk_CMD10(void* inbuff, int insize)
|
||||
{
|
||||
KIRK_CMD1_HEADER *header;
|
||||
header_keys keys; //0-15 AES key, 16-31 CMAC key
|
||||
AES_ctx cmac_key;
|
||||
u8 cmac_header_hash[16];
|
||||
u8 cmac_data_hash[16];
|
||||
int chk_size;
|
||||
|
||||
if(is_kirk_initialized == 0)
|
||||
kirk_init();
|
||||
|
||||
header = (KIRK_CMD1_HEADER*)inbuff;
|
||||
|
||||
if(!(header->mode == KIRK_MODE_CMD1 || header->mode == KIRK_MODE_CMD2 || header->mode == KIRK_MODE_CMD3))
|
||||
return KIRK_INVALID_MODE;
|
||||
|
||||
if(header->data_size==0)
|
||||
return KIRK_DATA_SIZE_ZERO;
|
||||
|
||||
if(header->mode == KIRK_MODE_CMD1) {
|
||||
//decrypt AES & CMAC key to temp buffer
|
||||
AES_cbc_decrypt(&aes_kirk1, inbuff, (u8*)&keys, 32);
|
||||
|
||||
AES_set_key(&cmac_key, keys.CMAC, 128);
|
||||
AES_CMAC(&cmac_key, (char*)inbuff+0x60, 0x30, cmac_header_hash);
|
||||
|
||||
//Make sure data is 16 aligned
|
||||
chk_size = header->data_size;
|
||||
if(chk_size % 16)
|
||||
chk_size += 16 - (chk_size % 16);
|
||||
|
||||
AES_CMAC(&cmac_key, (char*)inbuff+0x60, 0x30 + chk_size + header->data_offset, cmac_data_hash);
|
||||
|
||||
if(memcmp(cmac_header_hash, header->CMAC_header_hash, 16) != 0) {
|
||||
printf("header hash invalid\n");
|
||||
return KIRK_HEADER_HASH_INVALID;
|
||||
}
|
||||
|
||||
if(memcmp(cmac_data_hash, header->CMAC_data_hash, 16) != 0) {
|
||||
printf("data hash invalid\n");
|
||||
return KIRK_DATA_HASH_INVALID;
|
||||
}
|
||||
|
||||
return KIRK_OPERATION_SUCCESS;
|
||||
}
|
||||
|
||||
//Checks for cmd 2 & 3 not included right now
|
||||
return KIRK_SIG_CHECK_INVALID;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* KIRK 0x0B */
|
||||
/*****************************************************************************/
|
||||
|
||||
int kirk_CMD11(void* outbuff, void* inbuff, int size)
|
||||
{
|
||||
int data_size;
|
||||
|
||||
if(is_kirk_initialized == 0)
|
||||
kirk_init();
|
||||
|
||||
data_size = *(int*)(inbuff);
|
||||
if(data_size==0 || size==0)
|
||||
return KIRK_DATA_SIZE_ZERO;
|
||||
|
||||
size = size<data_size ? size : data_size;
|
||||
SHA1((char*)inbuff+4, size, outbuff);
|
||||
|
||||
return KIRK_OPERATION_SUCCESS;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* KIRK 0x0C: generate priv and pub */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
int kirk_CMD12(void *outbuff, int size)
|
||||
{
|
||||
u8 *priv_key = (u8*)outbuff;
|
||||
//u8 *pub_key = (u8*)outbuff+20;
|
||||
|
||||
if(size!=0x3c)
|
||||
return KIRK_INVALID_SIZE;
|
||||
|
||||
ecdsa_set_curve(&ecdsa_app);
|
||||
|
||||
kirk_CMD14(priv_key, 20);
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* KIRK 0x0E */
|
||||
/*****************************************************************************/
|
||||
|
||||
int kirk_CMD14(void* outbuff, int size)
|
||||
{
|
||||
int i;
|
||||
u8* buf = (u8*)outbuff;
|
||||
|
||||
if(is_kirk_initialized == 0)
|
||||
kirk_init();
|
||||
|
||||
for(i=0; i<size; i++){
|
||||
buf[i] = rand()%256;
|
||||
}
|
||||
|
||||
return KIRK_OPERATION_SUCCESS;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* sceUtilsBufferCopyWithRange */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
int sceUtilsBufferCopyWithRange(void* outbuff, int outsize, void* inbuff, int insize, int cmd)
|
||||
{
|
||||
switch(cmd)
|
||||
{
|
||||
case KIRK_CMD_DECRYPT_PRIVATE:
|
||||
if(insize % 16) return SUBCWR_NOT_16_ALGINED;
|
||||
int ret = kirk_CMD1(outbuff, inbuff, insize);
|
||||
if(ret == KIRK_HEADER_HASH_INVALID) return SUBCWR_HEADER_HASH_INVALID;
|
||||
return ret;
|
||||
break;
|
||||
case KIRK_CMD_ENCRYPT_IV_0: return kirk_CMD4(outbuff, inbuff, insize); break;
|
||||
case KIRK_CMD_DECRYPT_IV_0: return kirk_CMD7(outbuff, inbuff, insize); break;
|
||||
case KIRK_CMD_PRIV_SIG_CHECK: return kirk_CMD10(inbuff, insize); break;
|
||||
case KIRK_CMD_SHA1_HASH: return kirk_CMD11(outbuff, inbuff, insize); break;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,127 @@
|
|||
#ifndef KIRK_ENGINE
|
||||
#define KIRK_ENGINE
|
||||
|
||||
typedef unsigned char u8;
|
||||
typedef unsigned short int u16;
|
||||
typedef unsigned int u32;
|
||||
|
||||
//Kirk return values
|
||||
#define KIRK_OPERATION_SUCCESS 0
|
||||
#define KIRK_NOT_ENABLED 1
|
||||
#define KIRK_INVALID_MODE 2
|
||||
#define KIRK_HEADER_HASH_INVALID 3
|
||||
#define KIRK_DATA_HASH_INVALID 4
|
||||
#define KIRK_SIG_CHECK_INVALID 5
|
||||
#define KIRK_UNK_1 6
|
||||
#define KIRK_UNK_2 7
|
||||
#define KIRK_UNK_3 8
|
||||
#define KIRK_UNK_4 9
|
||||
#define KIRK_UNK_5 0xA
|
||||
#define KIRK_UNK_6 0xB
|
||||
#define KIRK_NOT_INITIALIZED 0xC
|
||||
#define KIRK_INVALID_OPERATION 0xD
|
||||
#define KIRK_INVALID_SEED_CODE 0xE
|
||||
#define KIRK_INVALID_SIZE 0xF
|
||||
#define KIRK_DATA_SIZE_ZERO 0x10
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int mode; //0
|
||||
int unk_4; //4
|
||||
int unk_8; //8
|
||||
int keyseed; //C
|
||||
int data_size; //10
|
||||
} KIRK_AES128CBC_HEADER; //0x14
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u8 AES_key[16]; //0
|
||||
u8 CMAC_key[16]; //10
|
||||
u8 CMAC_header_hash[16]; //20
|
||||
u8 CMAC_data_hash[16]; //30
|
||||
u8 unused[32]; //40
|
||||
u32 mode; //60
|
||||
u32 ecdsa; //64
|
||||
u8 unk3[8]; //68
|
||||
u32 data_size; //70
|
||||
u32 data_offset; //74
|
||||
u8 unk4[8]; //78
|
||||
u8 unk5[16]; //80
|
||||
} KIRK_CMD1_HEADER; //0x90
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u32 data_size; //0
|
||||
} KIRK_SHA1_HEADER; //4
|
||||
|
||||
//mode passed to sceUtilsBufferCopyWithRange
|
||||
#define KIRK_CMD_DECRYPT_PRIVATE 1
|
||||
#define KIRK_CMD_ENCRYPT_IV_0 4
|
||||
#define KIRK_CMD_ENCRYPT_IV_FUSE 5
|
||||
#define KIRK_CMD_ENCRYPT_IV_USER 6
|
||||
#define KIRK_CMD_DECRYPT_IV_0 7
|
||||
#define KIRK_CMD_DECRYPT_IV_FUSE 8
|
||||
#define KIRK_CMD_DECRYPT_IV_USER 9
|
||||
#define KIRK_CMD_PRIV_SIG_CHECK 10
|
||||
#define KIRK_CMD_SHA1_HASH 11
|
||||
|
||||
//"mode" in header
|
||||
#define KIRK_MODE_CMD1 1
|
||||
#define KIRK_MODE_CMD2 2
|
||||
#define KIRK_MODE_CMD3 3
|
||||
#define KIRK_MODE_ENCRYPT_CBC 4
|
||||
#define KIRK_MODE_DECRYPT_CBC 5
|
||||
|
||||
//sceUtilsBufferCopyWithRange errors
|
||||
#define SUBCWR_NOT_16_ALGINED 0x90A
|
||||
#define SUBCWR_HEADER_HASH_INVALID 0x920
|
||||
#define SUBCWR_BUFFER_TOO_SMALL 0x1000
|
||||
|
||||
/*
|
||||
// Private Sig + Cipher
|
||||
0x01: Super-Duper decryption (no inverse)
|
||||
0x02: Encrypt Operation (inverse of 0x03)
|
||||
0x03: Decrypt Operation (inverse of 0x02)
|
||||
|
||||
// Cipher
|
||||
0x04: Encrypt Operation (inverse of 0x07) (IV=0)
|
||||
0x05: Encrypt Operation (inverse of 0x08) (IV=FuseID)
|
||||
0x06: Encrypt Operation (inverse of 0x09) (IV=UserDefined)
|
||||
0x07: Decrypt Operation (inverse of 0x04)
|
||||
0x08: Decrypt Operation (inverse of 0x05)
|
||||
0x09: Decrypt Operation (inverse of 0x06)
|
||||
|
||||
// Sig Gens
|
||||
0x0A: Private Signature Check (checks for private SCE sig)
|
||||
0x0B: SHA1 Hash
|
||||
0x0C: Mul1
|
||||
0x0D: Mul2
|
||||
0x0E: Random Number Gen
|
||||
0x0F: (absolutely no idea – could be KIRK initialization)
|
||||
0x10: Signature Gen
|
||||
// Sig Checks
|
||||
0x11: Signature Check (checks for generated sigs)
|
||||
0x12: Certificate Check (idstorage signatures)
|
||||
*/
|
||||
|
||||
//kirk-like funcs
|
||||
int kirk_CMD0(void* outbuff, void* inbuff, int size);
|
||||
int kirk_CMD1(void* outbuff, void* inbuff, int size);
|
||||
int kirk_CMD4(void* outbuff, void* inbuff, int size);
|
||||
int kirk_CMD7(void* outbuff, void* inbuff, int size);
|
||||
int kirk_CMD10(void* inbuff, int insize);
|
||||
int kirk_CMD11(void* outbuff, void* inbuff, int size);
|
||||
int kirk_CMD14(void* outbuff, int size);
|
||||
__declspec(dllexport) int kirk_init(); //CMD 0xF?
|
||||
|
||||
//helper funcs
|
||||
u8* kirk_4_7_get_key(int key_type);
|
||||
|
||||
//kirk "ex" functions
|
||||
int kirk_CMD1_ex(void* outbuff, void* inbuff, int size, KIRK_CMD1_HEADER* header);
|
||||
|
||||
//sce-like funcs
|
||||
int sceUtilsSetFuseID(void*fuse);
|
||||
int sceUtilsBufferCopyWithRange(void* outbuff, int outsize, void* inbuff, int insize, int cmd);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,156 @@
|
|||
|
||||
#define PACK( __Declaration__ ) __pragma( pack(push, 1) ) __Declaration__ __pragma( pack(pop) )
|
||||
|
||||
/*************************************************************/
|
||||
PACK(
|
||||
typedef struct
|
||||
{
|
||||
u32 e_magic;
|
||||
u8 e_class;
|
||||
u8 e_data;
|
||||
u8 e_idver;
|
||||
u8 e_pad[9];
|
||||
u16 e_type;
|
||||
u16 e_machine;
|
||||
u32 e_version;
|
||||
u32 e_entry;
|
||||
u32 e_phoff;
|
||||
u32 e_shoff;
|
||||
u32 e_flags;
|
||||
u16 e_ehsize;
|
||||
u16 e_phentsize;
|
||||
u16 e_phnum;
|
||||
u16 e_shentsize;
|
||||
u16 e_shnum;
|
||||
u16 e_shstrndx;
|
||||
}Elf32_Ehdr);
|
||||
|
||||
PACK(
|
||||
typedef struct
|
||||
{
|
||||
u32 p_type;
|
||||
u32 p_offset;
|
||||
u32 p_vaddr;
|
||||
u32 p_paddr;
|
||||
u32 p_filesz;
|
||||
u32 p_memsz;
|
||||
u32 p_flags;
|
||||
u32 p_align;
|
||||
} Elf32_Phdr);
|
||||
PACK(
|
||||
typedef struct
|
||||
{
|
||||
u32 sh_name;
|
||||
u32 sh_type;
|
||||
u32 sh_flags;
|
||||
u32 sh_addr;
|
||||
u32 sh_offset;
|
||||
u32 sh_size;
|
||||
u32 sh_link;
|
||||
u32 sh_info;
|
||||
u32 sh_addralign;
|
||||
u32 sh_entsize;
|
||||
} Elf32_Shdr);
|
||||
|
||||
typedef struct {
|
||||
u32 r_offset;
|
||||
u32 r_info; /* sym, type: ELF32_R_... */
|
||||
} Elf32_Rel;
|
||||
|
||||
/* Values for p_type. */
|
||||
#define PT_LOAD 1 /* Loadable segment. */
|
||||
|
||||
/* Values for p_flags. */
|
||||
#define PF_X 0x1 /* Executable. */
|
||||
#define PF_W 0x2 /* Writable. */
|
||||
#define PF_R 0x4 /* Readable. */
|
||||
#define PF_RW (PF_R|PF_W)
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
typedef struct {
|
||||
u16 modattribute;
|
||||
u8 modversion[2]; /* minor, major, etc... */
|
||||
char modname[28];
|
||||
void *gp_value;
|
||||
void *ent_top;
|
||||
void *ent_end;
|
||||
void *stub_top;
|
||||
void *stub_end;
|
||||
} SceModuleInfo;
|
||||
|
||||
PACK(
|
||||
typedef struct
|
||||
{
|
||||
u32 signature; //0
|
||||
u16 mod_attribute; //4
|
||||
u16 comp_attribute; //6 compress method:
|
||||
// 0x0001=PRX Compress
|
||||
// 0x0002=ELF Packed
|
||||
// 0x0008=GZIP overlap
|
||||
// 0x0200=KL4E(if not set, GZIP)
|
||||
u8 module_ver_lo; //8
|
||||
u8 module_ver_hi; //9
|
||||
char modname[28]; //0xA
|
||||
u8 mod_version; //0x26
|
||||
u8 nsegments; //0x27
|
||||
u32 elf_size; //0x28
|
||||
u32 psp_size; //0x2C
|
||||
u32 boot_entry; //0x30
|
||||
u32 modinfo_offset; //0x34
|
||||
int bss_size; //0x38
|
||||
u16 seg_align[4]; //0x3C
|
||||
u32 seg_address[4]; //0x44
|
||||
int seg_size[4]; //0x54
|
||||
u32 reserved[5]; //0x64
|
||||
u32 devkit_version; //0x78
|
||||
u8 decrypt_mode; //0x7C
|
||||
u8 padding; //0x7D
|
||||
u16 overlap_size; //0x7E
|
||||
u8 key_data[0x30]; //0x80
|
||||
u32 comp_size; //0xB0 kirk data_size
|
||||
int _80; //0xB4 kirk data_offset
|
||||
u32 unk_B8; //0xB8
|
||||
u32 unk_BC; //0xBC
|
||||
u8 key_data2[0x10]; //0xC0
|
||||
u32 tag; //0xD0
|
||||
u8 scheck[0x58]; //0xD4
|
||||
u8 sha1_hash[0x14]; //0x12C
|
||||
u8 key_data4[0x10]; //0x140
|
||||
} PSP_Header2); //0x150
|
||||
|
||||
PACK(
|
||||
typedef struct
|
||||
{
|
||||
u32 signature; // 0
|
||||
u16 attribute;
|
||||
u8 module_ver_lo;
|
||||
u8 module_ver_hi;
|
||||
char modname[28];
|
||||
u8 version; // 26
|
||||
u8 nsegments; // 27
|
||||
int elf_size; // 28
|
||||
int psp_size; // 2C
|
||||
u32 entry; // 30
|
||||
u32 modinfo_offset; // 34
|
||||
int bss_size; // 38
|
||||
u16 seg_align[4]; // 3C
|
||||
u32 seg_address[4]; // 44
|
||||
int seg_size[4]; // 54
|
||||
u32 reserved[5]; // 64
|
||||
u32 devkitversion; // 78
|
||||
u32 decrypt_mode; // 7C
|
||||
u8 key_data0[0x30]; // 80
|
||||
int comp_size; // B0
|
||||
int _80; // B4
|
||||
int reserved2[2]; // B8
|
||||
u8 key_data1[0x10]; // C0
|
||||
u32 tag; // D0
|
||||
u8 scheck[0x58]; // D4
|
||||
u32 key_data2; // 12C
|
||||
u32 oe_tag; // 130
|
||||
u8 key_data3[0x1C]; // 134
|
||||
} PSP_Header);
|
||||
|
||||
/*************************************************************/
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
TARGET = chovy-gen
|
||||
OBJS = main.o
|
||||
|
||||
|
||||
LIBS = -lssl -lcrypto -lole32 -lgdi32 -lws2_32
|
||||
|
||||
|
||||
CFLAGS = -s -static -Wall -Wextra -std=c99
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): $(OBJS)
|
||||
@echo "Creating binary $(TARGET)"
|
||||
$(CXX) $(OBJS) -o $@ $(LIBS) -static -static-libgcc
|
||||
|
||||
%.o: %.cpp
|
||||
@echo "Compiling $^"
|
||||
$(CXX) $(CFLAGS) -c $^ -o $@ -static -static-libgcc
|
||||
|
||||
clean:
|
||||
@echo "Removing all the .o files"
|
||||
@$(RM) $(OBJS)
|
||||
|
||||
mrproper: clean
|
||||
@echo "Removing binary"
|
||||
@$(RM) $(TARGET)
|
||||
|
||||
install: all
|
||||
@cp $(TARGET) ../bin
|
|
@ -0,0 +1,17 @@
|
|||
uint8_t keyvault_ec_p[0x1c] = {0xA5, 0x3E, 0x11, 0x3E, 0x46, 0xD8, 0xC9, 0xC1, 0xF0, 0x9D, 0x9B, 0xCB, 0x2A, 0x53, 0x73, 0xD3, 0x79, 0xF6, 0x9D, 0xA2, 0x8D, 0x09, 0x99, 0x9F, 0xED, 0x57, 0xA9, 0x0F};
|
||||
uint8_t keyvault_ec_a[0x1c] = {0xA5, 0x3E, 0x11, 0x3E, 0x46, 0xD8, 0xC9, 0xC1, 0xF0, 0x9D, 0x9B, 0xCB, 0x2A, 0x53, 0x73, 0xD3, 0x79, 0xF6, 0x9D, 0xA2, 0x8D, 0x09, 0x99, 0x9F, 0xED, 0x57, 0xA9, 0x0C};
|
||||
uint8_t keyvault_ec_b[0x1c] = {0x90, 0x65, 0x94, 0x1D, 0x29, 0x37, 0x4A, 0x8F, 0x11, 0xDD, 0x1E, 0x54, 0x01, 0x89, 0x43, 0x4E, 0x4A, 0x6E, 0xBF, 0xAF, 0x54, 0x77, 0xF6, 0xC1, 0x72, 0xF6, 0x85, 0x5E};
|
||||
uint8_t keyvault_ec_N[0x1c] = { 0xA5, 0x3E, 0x11, 0x3E, 0x46, 0xD8, 0xC9, 0xC1, 0xF0, 0x9D, 0x9B, 0xCB, 0x2A, 0x52, 0x26, 0x98, 0xDE, 0xEF, 0x58, 0xDB, 0x1A, 0xD9, 0xAB, 0x7F, 0x04, 0xE3, 0xAE, 0x7F};
|
||||
uint8_t keyvault_ec_Gx[0x1c] = {0x7E, 0x06, 0x09, 0x82, 0x47, 0xE6, 0xB5, 0x9F, 0x31, 0x10, 0xBC, 0xBB, 0x3A, 0xB6, 0xC2, 0x50, 0xBC, 0x5A, 0xB0, 0x6C, 0x03, 0x2D, 0xAD, 0x43, 0x68, 0x4C, 0x24, 0x8F};
|
||||
uint8_t keyvault_ec_Gy[0x1c] = {0x0B, 0xD9, 0x41, 0x8D, 0xE8, 0xE3, 0xE4, 0x5D, 0x2D, 0x70, 0x1E, 0x02, 0x37, 0xFD, 0x7F, 0x2A, 0xDE, 0x0D, 0x48, 0xB7, 0x4C, 0xEE, 0xF2, 0xF1, 0xC8, 0xAC, 0x48, 0x4E};
|
||||
uint8_t keyvault_ec_pubkey[2][0x38] = {
|
||||
{0x5F, 0x9D, 0x17, 0x1A, 0x2B, 0xDD, 0xA8, 0xD4, 0x08, 0x78, 0xBF, 0x98, 0x5A, 0xC3, 0x26, 0xED, 0x5E, 0xFF, 0x43, 0xC9, 0x37, 0x6C, 0x77, 0xEC, 0x0A, 0x00, 0xC7, 0xBB, 0xA3, 0x44, 0xE4, 0x4E, 0x6E, 0xAC, 0x25, 0x52, 0x35, 0xF9, 0x54, 0xF5, 0xB6, 0x17, 0xC7, 0xBD, 0x49, 0xF1, 0x80, 0x26, 0x24, 0x54, 0xAA, 0xE1, 0xB6, 0x2A, 0x9F, 0x2C},
|
||||
{0x67, 0x00, 0x2D, 0x9B, 0xB8, 0xE4, 0x2D, 0x2B, 0xF9, 0x61, 0x0B, 0x27, 0xFE, 0xAB, 0x9B, 0x34, 0x56, 0x15, 0x50, 0x92, 0x13, 0x12, 0xDF, 0xEE, 0x7A, 0x3A, 0x86, 0xEC, 0x6C, 0xA7, 0x14, 0x42, 0x6F, 0x6D, 0x4E, 0x96, 0x09, 0xA6, 0x38, 0xBF, 0x4A, 0xFB, 0x18, 0x2B, 0xFA, 0x50, 0xC8, 0x2F, 0xF2, 0xB4, 0xC5, 0xEC, 0x6C, 0xCD, 0x97, 0x65}
|
||||
};
|
||||
|
||||
uint8_t keyvault_ec_privkey[2][0x1c] = {
|
||||
{0x76, 0x74, 0x36, 0xA6, 0x99, 0x9D, 0x88, 0x48, 0x0E, 0xC8, 0x56, 0xF5, 0x5C, 0xEA, 0xBB, 0x43, 0x96, 0x85, 0x9E, 0x37, 0x45, 0x99, 0x40, 0x39, 0x21, 0xF5, 0x55, 0x98},
|
||||
{0x60, 0x7A, 0x2E, 0x55, 0x68, 0xB4, 0xB9, 0xA0, 0x32, 0xF4, 0x52, 0x53, 0xCF, 0xED, 0x20, 0xDB, 0x2E, 0x6E, 0x44, 0x6C, 0x37, 0x82, 0xE8, 0x2A, 0x1A, 0xB9, 0xC9, 0x23}
|
||||
};
|
||||
|
||||
uint8_t hmac_key_0x22[0x40] = {0x54, 0x88, 0xA9, 0x81, 0x1C, 0x9A, 0x2C, 0xBC, 0xCC, 0x59, 0x6B, 0x1F, 0xAD, 0x1A, 0x7E, 0x29, 0xE0, 0x75, 0x84, 0x0F, 0x47, 0x43, 0x1F, 0x37, 0xAC, 0x06, 0x02, 0x46, 0x4A, 0x27, 0x9E, 0x02, 0xDF, 0x2E, 0x71, 0x65, 0xF1, 0x13, 0x7B, 0xF6, 0x9A, 0xE6, 0xDC, 0xB9, 0xDC, 0x38, 0x8C, 0x9D, 0xCC, 0xB3, 0x64, 0xC4, 0xCA, 0x26, 0xCB, 0x8F, 0x1A, 0xF0, 0x63, 0x8A, 0x6E, 0xAD, 0xB5, 0x4D};
|
|
@ -0,0 +1,301 @@
|
|||
//Project Chovy - __sce_ebootpbp generator by @dots_tb and motoharu
|
||||
// With CBPS help especially: @SiliCart, @nyaaasen, @notzecoxao (and his friends?)
|
||||
|
||||
//Check out motoharu's project: https://github.com/motoharu-gosuto/psvcmd56/blob/master/src/CMD56Reversed/F00D/GcAuthMgrService.cpp#L1102
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/hmac.h>
|
||||
#include <openssl/sha.h>
|
||||
#include <openssl/obj_mac.h>
|
||||
#include <openssl/ec.h>
|
||||
|
||||
#include "key_vault.h"
|
||||
typedef struct
|
||||
{
|
||||
uint8_t r[0x1c];
|
||||
uint8_t s[0x1c];
|
||||
} __attribute__((packed)) ECDSA_SIG_0x1c;
|
||||
|
||||
typedef struct sce_ebootpbp {
|
||||
uint64_t magic;
|
||||
uint32_t key_type;// set to 1 (maybe keytype?)
|
||||
uint32_t type;// 03 - ps1, 02 - psp
|
||||
char np_title[0x30];
|
||||
uint64_t aid;
|
||||
uint64_t secure_tick;
|
||||
uint64_t filesz;
|
||||
uint64_t sw_ver;
|
||||
char padding[0xf8];
|
||||
ECDSA_SIG_0x1c ebootpbp_hdr_sig;
|
||||
ECDSA_SIG_0x1c NPUMDIMG_sig;
|
||||
ECDSA_SIG_0x1c sceebootpbp_sig;
|
||||
} __attribute__((packed)) sce_ebootpbp;
|
||||
|
||||
|
||||
typedef struct pbp_hdr {
|
||||
uint32_t magic;
|
||||
uint32_t unk;
|
||||
uint32_t sfo_offset;
|
||||
uint32_t icon0_offset;
|
||||
uint32_t icon1_offset;
|
||||
uint32_t pic0_offset;
|
||||
uint32_t pic1_offset;
|
||||
uint32_t snd0_offset;
|
||||
uint32_t data_psp_offset;
|
||||
uint32_t data_psar_offset;
|
||||
} pbp_hdr;
|
||||
|
||||
|
||||
#define PSAR_SZ 0x1C0000
|
||||
#define WORK_BUF_SZ 0x7c0
|
||||
|
||||
|
||||
//based motoharu
|
||||
int can_be_reversed_80C17A(const uint8_t* src, int some_size, uint8_t* iv, uint8_t* src_xored_digest)
|
||||
{
|
||||
unsigned char src_xored[0x20];
|
||||
memcpy(src_xored, iv, 0x20);
|
||||
|
||||
if (some_size > 0x20)
|
||||
return 0x12;
|
||||
|
||||
for(int i = 0; i < some_size; i++)
|
||||
src_xored[i] = src[i] ^ iv[i];
|
||||
|
||||
int r0;
|
||||
|
||||
SHA256_CTX sha256_ctx;
|
||||
SHA256_Init(&sha256_ctx);
|
||||
SHA256_Update(&sha256_ctx, src_xored, 0x20);
|
||||
r0 = SHA256_Final(src_xored_digest, &sha256_ctx);
|
||||
if(r0 != 1)
|
||||
return 0x11;
|
||||
|
||||
for(int i = 0; i < 0x20; i++)
|
||||
iv[i] = src_xored_digest[i] ^ iv[i];
|
||||
|
||||
for(int i = 0; i < 0x20; i++)
|
||||
{
|
||||
if(iv[i] != 0xFF)
|
||||
{
|
||||
iv[i] = iv[i] + 1;
|
||||
break;
|
||||
}
|
||||
|
||||
iv[i] = 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int f00d_KIRK0x22(const uint8_t *hash, ECDSA_SIG_0x1c *signature, int key_sel) {
|
||||
|
||||
|
||||
uint8_t hmac_in[0x38];
|
||||
uint8_t hmac_hash_iv[0x38];
|
||||
memcpy(&hmac_in, hash, 0x1c);
|
||||
memcpy(&hmac_in[0x1c], &keyvault_ec_privkey[key_sel], 0x1c);
|
||||
|
||||
HMAC_CTX *hmac_ctx = HMAC_CTX_new();
|
||||
HMAC_Init_ex(hmac_ctx, &hmac_key_0x22, 0x40, EVP_sha256(), NULL);
|
||||
HMAC_Update(hmac_ctx, &hmac_in, 0x1c << 1);
|
||||
unsigned int len;
|
||||
HMAC_Final(hmac_ctx, &hmac_hash_iv, &len);
|
||||
HMAC_CTX_free(hmac_ctx);
|
||||
|
||||
uint8_t sha256_out[0x40];
|
||||
int ret = 0;
|
||||
do {
|
||||
ret = can_be_reversed_80C17A(hash, 0x1c, hmac_hash_iv, &sha256_out[0]);
|
||||
if(ret != 0 || (ret = can_be_reversed_80C17A(hash, 0x1c, hmac_hash_iv, &sha256_out[0x20])) != 0)
|
||||
return 0;
|
||||
|
||||
} while(ret != 0);
|
||||
|
||||
//ECDSA
|
||||
|
||||
BIGNUM *a = BN_bin2bn(keyvault_ec_a, 0x1c, NULL),
|
||||
*b = BN_bin2bn(keyvault_ec_b, 0x1c, NULL),
|
||||
*p = BN_bin2bn(keyvault_ec_p, 0x1c, NULL),
|
||||
*order = BN_bin2bn(keyvault_ec_N, 0x1c, NULL),
|
||||
*x = BN_bin2bn(keyvault_ec_Gx, 0x1c, NULL),
|
||||
*y = BN_bin2bn(keyvault_ec_Gy, 0x1c, NULL),
|
||||
*priv_key = BN_bin2bn(keyvault_ec_privkey[key_sel], 0x1c, NULL),
|
||||
*m = BN_bin2bn(sha256_out, 0x3c, NULL);
|
||||
|
||||
BN_CTX *bn_ctx = BN_CTX_new();
|
||||
BN_MONT_CTX *bn_mon_ctx = BN_MONT_CTX_new();
|
||||
BN_MONT_CTX_set(bn_mon_ctx, order, bn_ctx);
|
||||
|
||||
EC_GROUP *curve = EC_GROUP_new_curve_GFp(p, a, b, bn_ctx);
|
||||
EC_POINT *generator = EC_POINT_new(curve);
|
||||
EC_POINT_set_affine_coordinates_GFp(curve, generator, x, y, bn_ctx);
|
||||
EC_GROUP_set_generator(curve, generator, order, NULL);
|
||||
|
||||
EC_KEY *eckey=EC_KEY_new();
|
||||
EC_KEY_set_group(eckey,curve);
|
||||
EC_KEY_set_private_key(eckey, priv_key);
|
||||
|
||||
|
||||
m = BN_bin2bn(sha256_out, 0x3c, NULL);
|
||||
BN_mod(m, m, order, bn_ctx);
|
||||
|
||||
|
||||
|
||||
//Generate R in order to get custom "random number"
|
||||
BIGNUM *sig_r = BN_new();
|
||||
EC_POINT_mul(curve, generator, m, NULL, NULL, bn_ctx);
|
||||
EC_POINT_get_affine_coordinates(curve, generator, sig_r, NULL, bn_ctx);
|
||||
BN_nnmod(sig_r, sig_r, order, bn_ctx);
|
||||
|
||||
//Generate M^-1
|
||||
BIGNUM *exp = BN_new();
|
||||
BIGNUM *minv = BN_new();
|
||||
|
||||
BN_set_word(exp, (BN_ULONG)2);
|
||||
BN_sub(exp, order, exp);
|
||||
BN_mod_exp_mont(minv, m, exp, order, bn_ctx, bn_mon_ctx);
|
||||
|
||||
|
||||
ECDSA_SIG *sig = ECDSA_do_sign_ex(hash, 0x1c, minv, sig_r, eckey);
|
||||
|
||||
|
||||
if(!sig) {
|
||||
ret = 0;
|
||||
goto error;
|
||||
|
||||
}
|
||||
BIGNUM *sig_s;
|
||||
ECDSA_SIG_get0(sig, NULL, &sig_s);
|
||||
BN_bn2bin(sig_r, &signature->r);
|
||||
BN_bn2bin(sig_s, &signature->s);
|
||||
ECDSA_SIG_free(sig);
|
||||
BN_free(sig_s);
|
||||
ret = 1;
|
||||
|
||||
error:
|
||||
BN_free(sig_r);
|
||||
|
||||
EC_POINT_free(generator);
|
||||
BN_free(y);
|
||||
BN_free(x);
|
||||
BN_free(order);
|
||||
BN_free(p);
|
||||
BN_free(b);
|
||||
BN_free(a);
|
||||
BN_free(minv);
|
||||
BN_free(exp);
|
||||
BN_free(priv_key);
|
||||
BN_CTX_free(bn_ctx);
|
||||
BN_MONT_CTX_free(bn_mon_ctx);
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
static void usage(char *argv[])
|
||||
{
|
||||
printf("Project Chovy - __sce_ebootpbp generator by @dots_tb and motoharu\n");
|
||||
printf("With CBPS help especially: @SiliCart, @nyaaasen, @notzecoxao (and his friends?)\n");
|
||||
printf("%s <aid> <EBOOT.pbp>\n\n",argv[0]);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
|
||||
|
||||
FILE *fin = 0, *fout = 0;
|
||||
if (argc != 3) {
|
||||
usage(argv);
|
||||
return 1;
|
||||
}
|
||||
uint8_t *work_buf = (unsigned char*) calloc (1, WORK_BUF_SZ);
|
||||
sce_ebootpbp *sceebootpbp_file = (unsigned char*) calloc (1, sizeof(sce_ebootpbp));
|
||||
|
||||
printf("Input: %s\n", argv[2]);
|
||||
fin = fopen(argv[2], "rb");
|
||||
if (!fin) {
|
||||
perror("Failed to open input file");
|
||||
goto error;
|
||||
}
|
||||
|
||||
memcpy(&sceebootpbp_file->magic, "NPUMDSIG", 0x8);
|
||||
sceebootpbp_file->type = 2;
|
||||
sceebootpbp_file->key_type = 1;
|
||||
sceebootpbp_file->aid = __builtin_bswap64(strtoull(argv[1], NULL, 0x10));
|
||||
|
||||
printf("AID set to: %llx\n", sceebootpbp_file->aid);
|
||||
|
||||
fseek(fin, 0, SEEK_END);
|
||||
sceebootpbp_file->filesz = ftell(fin);
|
||||
|
||||
pbp_hdr hdr;
|
||||
fseek(fin, 0, SEEK_SET);
|
||||
fread(&hdr, sizeof(pbp_hdr),1,fin);
|
||||
|
||||
|
||||
fseek(fin, 0, SEEK_SET);
|
||||
fread(work_buf, hdr.icon0_offset, 1,fin);
|
||||
|
||||
char work_hash[0x1c];
|
||||
SHA256_CTX sha256_ctx;
|
||||
SHA224_Init(&sha256_ctx);
|
||||
SHA224_Update(&sha256_ctx, work_buf, hdr.icon0_offset);
|
||||
SHA224_Final(work_hash, &sha256_ctx);
|
||||
f00d_KIRK0x22(work_hash, &sceebootpbp_file->ebootpbp_hdr_sig, sceebootpbp_file->key_type);
|
||||
|
||||
SHA224_Init(&sha256_ctx);
|
||||
fseek(fin, hdr.data_psar_offset, SEEK_SET);
|
||||
|
||||
size_t size = PSAR_SZ;
|
||||
int to_read = size > WORK_BUF_SZ ? WORK_BUF_SZ : size;
|
||||
fread(work_buf, to_read, 1,fin);
|
||||
|
||||
if(memcmp(work_buf, "NPUMDIMG", 0x8) == 0)
|
||||
memcpy(&sceebootpbp_file->np_title, work_buf + 0x10, sizeof(sceebootpbp_file->np_title));
|
||||
else {
|
||||
memcpy(&sceebootpbp_file->magic, "NPPS1SIG", sizeof(sceebootpbp_file->magic));
|
||||
sceebootpbp_file->type = 3;
|
||||
}
|
||||
|
||||
do {
|
||||
size -= to_read;
|
||||
SHA224_Update(&sha256_ctx, work_buf, to_read);
|
||||
to_read = size > WORK_BUF_SZ ? WORK_BUF_SZ : size;
|
||||
fread(work_buf, to_read, 1,fin);
|
||||
} while(size > 0);
|
||||
|
||||
SHA224_Final(work_hash, &sha256_ctx);
|
||||
|
||||
f00d_KIRK0x22(work_hash, &sceebootpbp_file->NPUMDIMG_sig, sceebootpbp_file->key_type);
|
||||
|
||||
SHA224_Init(&sha256_ctx);
|
||||
SHA224_Update(&sha256_ctx, sceebootpbp_file, 0x1C8);
|
||||
SHA224_Final(work_hash, &sha256_ctx);
|
||||
|
||||
f00d_KIRK0x22(work_hash, &sceebootpbp_file->sceebootpbp_sig, sceebootpbp_file->key_type);
|
||||
|
||||
fout = fopen("__sce_ebootpbp", "wb");
|
||||
if (!fout) {
|
||||
perror("Failed to open output file");
|
||||
goto error;
|
||||
}
|
||||
fwrite(sceebootpbp_file, 1, sizeof(sce_ebootpbp), fout);
|
||||
printf("Written to: __sce_ebootpbp\n");
|
||||
|
||||
error:
|
||||
if (fin)
|
||||
fclose(fin);
|
||||
if (fout)
|
||||
fclose(fout);
|
||||
free(work_buf);
|
||||
free(sceebootpbp_file);
|
||||
exit(0);
|
||||
return 0;
|
||||
}
|
Binary file not shown.
|
@ -0,0 +1,43 @@
|
|||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>DiscUtils.Common</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:DiscUtils.Common.HexDump">
|
||||
<summary>
|
||||
Provides utility methods to produce hex dumps of binary data.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:DiscUtils.Common.HexDump.Generate(System.Byte[],System.IO.TextWriter)">
|
||||
<summary>
|
||||
Creates a hex dump from a byte array.
|
||||
</summary>
|
||||
<param name="data">The buffer to generate the hex dump from.</param>
|
||||
<param name="output">The destination for the hex dump.</param>
|
||||
</member>
|
||||
<member name="M:DiscUtils.Common.HexDump.Generate(System.Byte[],System.Int32,System.Int32,System.IO.TextWriter)">
|
||||
<summary>
|
||||
Creates a hex dump from a byte array.
|
||||
</summary>
|
||||
<param name="data">The buffer to generate the hex dump from.</param>
|
||||
<param name="offset">Offset of the first byte to hex dump.</param>
|
||||
<param name="count">The number of bytes to hex dump</param>
|
||||
<param name="output">The destination for the hex dump.</param>
|
||||
</member>
|
||||
<member name="M:DiscUtils.Common.HexDump.Generate(System.IO.Stream,System.IO.TextWriter)">
|
||||
<summary>
|
||||
Creates a hex dump from a stream.
|
||||
</summary>
|
||||
<param name="stream">The stream to generate the hex dump from.</param>
|
||||
<param name="output">The destination for the hex dump.</param>
|
||||
</member>
|
||||
<member name="M:DiscUtils.Common.HexDump.Generate(DiscUtils.SparseStream,System.IO.TextWriter)">
|
||||
<summary>
|
||||
Creates a hex dump from a stream.
|
||||
</summary>
|
||||
<param name="stream">The stream to generate the hex dump from.</param>
|
||||
<param name="output">The destination for the hex dump.</param>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,43 @@
|
|||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>DiscUtils.Common</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:DiscUtils.Common.HexDump">
|
||||
<summary>
|
||||
Provides utility methods to produce hex dumps of binary data.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:DiscUtils.Common.HexDump.Generate(System.Byte[],System.IO.TextWriter)">
|
||||
<summary>
|
||||
Creates a hex dump from a byte array.
|
||||
</summary>
|
||||
<param name="data">The buffer to generate the hex dump from.</param>
|
||||
<param name="output">The destination for the hex dump.</param>
|
||||
</member>
|
||||
<member name="M:DiscUtils.Common.HexDump.Generate(System.Byte[],System.Int32,System.Int32,System.IO.TextWriter)">
|
||||
<summary>
|
||||
Creates a hex dump from a byte array.
|
||||
</summary>
|
||||
<param name="data">The buffer to generate the hex dump from.</param>
|
||||
<param name="offset">Offset of the first byte to hex dump.</param>
|
||||
<param name="count">The number of bytes to hex dump</param>
|
||||
<param name="output">The destination for the hex dump.</param>
|
||||
</member>
|
||||
<member name="M:DiscUtils.Common.HexDump.Generate(System.IO.Stream,System.IO.TextWriter)">
|
||||
<summary>
|
||||
Creates a hex dump from a stream.
|
||||
</summary>
|
||||
<param name="stream">The stream to generate the hex dump from.</param>
|
||||
<param name="output">The destination for the hex dump.</param>
|
||||
</member>
|
||||
<member name="M:DiscUtils.Common.HexDump.Generate(DiscUtils.SparseStream,System.IO.TextWriter)">
|
||||
<summary>
|
||||
Creates a hex dump from a stream.
|
||||
</summary>
|
||||
<param name="stream">The stream to generate the hex dump from.</param>
|
||||
<param name="output">The destination for the hex dump.</param>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
Binary file not shown.
|
@ -0,0 +1,338 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
|
||||
<!--
|
||||
Copyright (c) 2008-2009, Kenneth Bell
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Based on the files FileSystem.format.ps1xml and Registry.format.ps1xml:
|
||||
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
||||
THIS SAMPLE CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND,WHETHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
|
||||
PURPOSE. IF THIS CODE AND INFORMATION IS MODIFIED, THE ENTIRE RISK OF USE
|
||||
OR RESULTS IN CONNECTION WITH THE USE OF THIS CODE AND INFORMATION
|
||||
REMAINS WITH THE USER.
|
||||
|
||||
-->
|
||||
|
||||
<Configuration>
|
||||
<Controls>
|
||||
<Control>
|
||||
<Name>VirtualRegistry-GroupingFormat</Name>
|
||||
<CustomControl>
|
||||
<CustomEntries>
|
||||
<CustomEntry>
|
||||
<CustomItem>
|
||||
<Frame>
|
||||
<LeftIndent>4</LeftIndent>
|
||||
<CustomItem>
|
||||
<Text>Hive: </Text>
|
||||
<ExpressionBinding>
|
||||
<ScriptBlock>$_.PSParentPath.Replace("VirtualRegistry::", "")</ScriptBlock>
|
||||
</ExpressionBinding>
|
||||
<NewLine/>
|
||||
</CustomItem>
|
||||
</Frame>
|
||||
</CustomItem>
|
||||
</CustomEntry>
|
||||
</CustomEntries>
|
||||
</CustomControl>
|
||||
</Control>
|
||||
</Controls>
|
||||
|
||||
<ViewDefinitions>
|
||||
|
||||
<!-- View for DiscUtils.VirtualDisk -->
|
||||
<View>
|
||||
<Name>VirtualDiskTable</Name>
|
||||
<ViewSelectedBy>
|
||||
<TypeName>DiscUtils.VirtualDisk</TypeName>
|
||||
</ViewSelectedBy>
|
||||
<GroupBy>
|
||||
<PropertyName>PSParentPath</PropertyName>
|
||||
<CustomControlName>FileSystemTypes-GroupingFormat</CustomControlName>
|
||||
</GroupBy>
|
||||
<TableControl>
|
||||
<TableHeaders>
|
||||
<TableColumnHeader>
|
||||
<Label>Name</Label>
|
||||
</TableColumnHeader>
|
||||
<TableColumnHeader>
|
||||
<Width>13</Width>
|
||||
</TableColumnHeader>
|
||||
<TableColumnHeader>
|
||||
<Width>15</Width>
|
||||
</TableColumnHeader>
|
||||
<TableColumnHeader>
|
||||
<Width>15</Width>
|
||||
</TableColumnHeader>
|
||||
<TableColumnHeader>
|
||||
<Label>Signature</Label>
|
||||
<Width>10</Width>
|
||||
</TableColumnHeader>
|
||||
<TableColumnHeader>
|
||||
<Label>Partitions</Label>
|
||||
</TableColumnHeader>
|
||||
</TableHeaders>
|
||||
<TableRowEntries>
|
||||
<TableRowEntry>
|
||||
<TableColumnItems>
|
||||
<TableColumnItem>
|
||||
<PropertyName>PSChildName</PropertyName>
|
||||
</TableColumnItem>
|
||||
<TableColumnItem>
|
||||
<PropertyName>Capacity</PropertyName>
|
||||
</TableColumnItem>
|
||||
<TableColumnItem>
|
||||
<PropertyName>Geometry</PropertyName>
|
||||
</TableColumnItem>
|
||||
<TableColumnItem>
|
||||
<PropertyName>BIOSGeometry</PropertyName>
|
||||
</TableColumnItem>
|
||||
<TableColumnItem>
|
||||
<ScriptBlock>[string]::Format("{0:X8}",$_.Signature)</ScriptBlock>
|
||||
</TableColumnItem>
|
||||
<TableColumnItem>
|
||||
<ScriptBlock>if($_.IsPartitioned) {$_.Partitions.Count} else {0}</ScriptBlock>
|
||||
</TableColumnItem>
|
||||
</TableColumnItems>
|
||||
</TableRowEntry>
|
||||
</TableRowEntries>
|
||||
</TableControl>
|
||||
</View>
|
||||
|
||||
|
||||
<!-- View for DiscUtils.LogicalVolumeInfo -->
|
||||
<View>
|
||||
<Name>LogicalVolumeInfoTable</Name>
|
||||
<ViewSelectedBy>
|
||||
<TypeName>DiscUtils.LogicalVolumeInfo</TypeName>
|
||||
</ViewSelectedBy>
|
||||
<GroupBy>
|
||||
<PropertyName>PSParentPath</PropertyName>
|
||||
<CustomControlName>FileSystemTypes-GroupingFormat</CustomControlName>
|
||||
</GroupBy>
|
||||
<TableControl>
|
||||
<TableHeaders>
|
||||
<TableColumnHeader>
|
||||
<Label>Name</Label>
|
||||
</TableColumnHeader>
|
||||
<TableColumnHeader>
|
||||
</TableColumnHeader>
|
||||
<TableColumnHeader>
|
||||
</TableColumnHeader>
|
||||
<TableColumnHeader>
|
||||
</TableColumnHeader>
|
||||
<TableColumnHeader>
|
||||
</TableColumnHeader>
|
||||
</TableHeaders>
|
||||
<TableRowEntries>
|
||||
<TableRowEntry>
|
||||
<TableColumnItems>
|
||||
<TableColumnItem>
|
||||
<PropertyName>PSChildName</PropertyName>
|
||||
</TableColumnItem>
|
||||
<TableColumnItem>
|
||||
<PropertyName>Identity</PropertyName>
|
||||
</TableColumnItem>
|
||||
<TableColumnItem>
|
||||
<PropertyName>BIOSType</PropertyName>
|
||||
</TableColumnItem>
|
||||
<TableColumnItem>
|
||||
<PropertyName>Status</PropertyName>
|
||||
</TableColumnItem>
|
||||
<TableColumnItem>
|
||||
<PropertyName>Length</PropertyName>
|
||||
</TableColumnItem>
|
||||
</TableColumnItems>
|
||||
</TableRowEntry>
|
||||
</TableRowEntries>
|
||||
</TableControl>
|
||||
</View>
|
||||
|
||||
|
||||
|
||||
<!-- Views for DiscUtils.DiscFileSystemInfo -->
|
||||
<View>
|
||||
<Name>DiscFileSystemInfoTable</Name>
|
||||
<ViewSelectedBy>
|
||||
<TypeName>DiscUtils.DiscFileSystemInfo</TypeName>
|
||||
</ViewSelectedBy>
|
||||
<GroupBy>
|
||||
<PropertyName>PSParentPath</PropertyName>
|
||||
<CustomControlName>FileSystemTypes-GroupingFormat</CustomControlName>
|
||||
</GroupBy>
|
||||
<TableControl>
|
||||
<TableHeaders>
|
||||
<TableColumnHeader>
|
||||
<Label>Mode</Label>
|
||||
<Width>7</Width>
|
||||
<Alignment>left</Alignment>
|
||||
</TableColumnHeader>
|
||||
<TableColumnHeader>
|
||||
<Label>LastWriteTime</Label>
|
||||
<Width>25</Width>
|
||||
<Alignment>right</Alignment>
|
||||
</TableColumnHeader>
|
||||
<TableColumnHeader>
|
||||
<Label>Length</Label>
|
||||
<Width>10</Width>
|
||||
<Alignment>right</Alignment>
|
||||
</TableColumnHeader>
|
||||
<TableColumnHeader/>
|
||||
</TableHeaders>
|
||||
<TableRowEntries>
|
||||
<TableRowEntry>
|
||||
<Wrap/>
|
||||
<TableColumnItems>
|
||||
<TableColumnItem>
|
||||
<PropertyName>Mode</PropertyName>
|
||||
</TableColumnItem>
|
||||
<TableColumnItem>
|
||||
<ScriptBlock>
|
||||
[String]::Format("{0,10} {1,8}", $_.LastWriteTime.ToString("d"), $_.LastWriteTime.ToString("t"))
|
||||
</ScriptBlock>
|
||||
</TableColumnItem>
|
||||
<TableColumnItem>
|
||||
<PropertyName>Length</PropertyName>
|
||||
</TableColumnItem>
|
||||
<TableColumnItem>
|
||||
<PropertyName>Name</PropertyName>
|
||||
</TableColumnItem>
|
||||
</TableColumnItems>
|
||||
</TableRowEntry>
|
||||
</TableRowEntries>
|
||||
</TableControl>
|
||||
</View>
|
||||
<View>
|
||||
<Name>DiscFileSystemInfoList</Name>
|
||||
<ViewSelectedBy>
|
||||
<TypeName>DiscUtils.DiscFileSystemInfo</TypeName>
|
||||
</ViewSelectedBy>
|
||||
<GroupBy>
|
||||
<PropertyName>PSParentPath</PropertyName>
|
||||
<CustomControlName>FileSystemTypes-GroupingFormat</CustomControlName>
|
||||
</GroupBy>
|
||||
<ListControl>
|
||||
<ListEntries>
|
||||
<ListEntry>
|
||||
<ListItems>
|
||||
<ListItem>
|
||||
<PropertyName>Name</PropertyName>
|
||||
</ListItem>
|
||||
<ListItem>
|
||||
<PropertyName>Length</PropertyName>
|
||||
</ListItem>
|
||||
<ListItem>
|
||||
<PropertyName>CreationTime</PropertyName>
|
||||
</ListItem>
|
||||
<ListItem>
|
||||
<PropertyName>LastWriteTime</PropertyName>
|
||||
</ListItem>
|
||||
<ListItem>
|
||||
<PropertyName>LastAccessTime</PropertyName>
|
||||
</ListItem>
|
||||
</ListItems>
|
||||
</ListEntry>
|
||||
</ListEntries>
|
||||
</ListControl>
|
||||
</View>
|
||||
<View>
|
||||
<Name>DiscFileSystemInfoWide</Name>
|
||||
<ViewSelectedBy>
|
||||
<TypeName>DiscUtils.DiscFileSystemInfo</TypeName>
|
||||
</ViewSelectedBy>
|
||||
<GroupBy>
|
||||
<PropertyName>PSParentPath</PropertyName>
|
||||
<CustomControlName>FileSystemTypes-GroupingFormat</CustomControlName>
|
||||
</GroupBy>
|
||||
<WideControl>
|
||||
<WideEntries>
|
||||
<WideEntry>
|
||||
<WideItem>
|
||||
<PropertyName>Name</PropertyName>
|
||||
</WideItem>
|
||||
</WideEntry>
|
||||
<WideEntry>
|
||||
<EntrySelectedBy>
|
||||
<TypeName>DiscUtils.DiscDirectoryInfo</TypeName>
|
||||
</EntrySelectedBy>
|
||||
<WideItem>
|
||||
<PropertyName>Name</PropertyName>
|
||||
<FormatString>[{0}]</FormatString>
|
||||
</WideItem>
|
||||
</WideEntry>
|
||||
</WideEntries>
|
||||
</WideControl>
|
||||
</View>
|
||||
|
||||
|
||||
<!-- Views for DiscUtils.Registry.RegistryKey -->
|
||||
<View>
|
||||
<Name>VR-children</Name>
|
||||
<ViewSelectedBy>
|
||||
<TypeName>DiscUtils.Registry.RegistryKey</TypeName>
|
||||
</ViewSelectedBy>
|
||||
<GroupBy>
|
||||
<PropertyName>PSParentPath</PropertyName>
|
||||
<CustomControlName>VirtualRegistry-GroupingFormat</CustomControlName>
|
||||
</GroupBy>
|
||||
<TableControl>
|
||||
<TableHeaders>
|
||||
<TableColumnHeader>
|
||||
<Width>3</Width>
|
||||
<Label>SKC</Label>
|
||||
<Alignment>right</Alignment>
|
||||
</TableColumnHeader>
|
||||
<TableColumnHeader>
|
||||
<Width>3</Width>
|
||||
<Alignment>right</Alignment>
|
||||
<Label>VC</Label>
|
||||
</TableColumnHeader>
|
||||
<TableColumnHeader>
|
||||
<Width>30</Width>
|
||||
<Label>Name</Label>
|
||||
</TableColumnHeader>
|
||||
<TableColumnHeader/>
|
||||
</TableHeaders>
|
||||
<TableRowEntries>
|
||||
<TableRowEntry>
|
||||
<TableColumnItems>
|
||||
<TableColumnItem>
|
||||
<PropertyName>SubKeyCount</PropertyName>
|
||||
</TableColumnItem>
|
||||
<TableColumnItem>
|
||||
<PropertyName>ValueCount</PropertyName>
|
||||
</TableColumnItem>
|
||||
<TableColumnItem>
|
||||
<ScriptBlock>if($_.PSParentPath.IndexOf("!") -lt 0) { $_.PSChildName.TrimEnd("!") } else { $_.PSChildName }</ScriptBlock>
|
||||
</TableColumnItem>
|
||||
<TableColumnItem>
|
||||
<PropertyName>Property</PropertyName>
|
||||
</TableColumnItem>
|
||||
</TableColumnItems>
|
||||
</TableRowEntry>
|
||||
</TableRowEntries>
|
||||
</TableControl>
|
||||
</View>
|
||||
</ViewDefinitions>
|
||||
</Configuration>
|
|
@ -0,0 +1,69 @@
|
|||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>DiscUtils.MSBuild</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="P:MSBuildTask.CreateIso.FileName">
|
||||
<summary>
|
||||
The name of the ISO file to create.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:MSBuildTask.CreateIso.UseJoliet">
|
||||
<summary>
|
||||
Whether to use Joliet encoding for the ISO (default true).
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:MSBuildTask.CreateIso.VolumeLabel">
|
||||
<summary>
|
||||
The label for the ISO (may be truncated if too long)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:MSBuildTask.CreateIso.SourceFiles">
|
||||
<summary>
|
||||
The files to add to the ISO.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:MSBuildTask.CreateIso.BootImage">
|
||||
<summary>
|
||||
The boot image to add to the ISO.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:MSBuildTask.CreateIso.UpdateIsolinuxBootTable">
|
||||
<summary>
|
||||
Whether to patch to boot image (per ISOLINUX requireents).
|
||||
</summary>
|
||||
<remarks>
|
||||
Unless patched, ISOLINUX will indicate a checksum error upon boot.
|
||||
</remarks>
|
||||
</member>
|
||||
<member name="P:MSBuildTask.CreateIso.RemoveRoots">
|
||||
<summary>
|
||||
Sets the root to remove from the source files.
|
||||
</summary>
|
||||
<remarks>
|
||||
If the source file is C:\MyDir\MySubDir\file.txt, and RemoveRoot is C:\MyDir, the ISO will
|
||||
contain \MySubDir\file.txt. If not specified, the file would be named \MyDir\MySubDir\file.txt.
|
||||
</remarks>
|
||||
</member>
|
||||
<member name="P:MSBuildTask.CreateSquashFileSystem.FileName">
|
||||
<summary>
|
||||
The name of the file to create, containing the filesystem image.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:MSBuildTask.CreateSquashFileSystem.SourceFiles">
|
||||
<summary>
|
||||
The files to add to the filesystem image.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:MSBuildTask.CreateSquashFileSystem.RemoveRoot">
|
||||
<summary>
|
||||
Sets the root to remove from the source files.
|
||||
</summary>
|
||||
<remarks>
|
||||
If the source file is C:\MyDir\MySubDir\file.txt, and RemoveRoot is C:\MyDir, the filesystem will
|
||||
contain \MySubDir\file.txt. If not specified, the file would be named \MyDir\MySubDir\file.txt.
|
||||
</remarks>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
Binary file not shown.
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>DiscUtils.PowerShell</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="M:DiscUtils.PowerShell.Utilities.NormalizePath(System.String)">
|
||||
<summary>
|
||||
Replace all ':' characters with '#'.
|
||||
</summary>
|
||||
<param name="path">The path to normalize</param>
|
||||
<returns>The normalized path</returns>
|
||||
<remarks>
|
||||
PowerShell has a bug that prevents tab-completion if the paths contain ':'
|
||||
characters, so in the external path for this provider we encode ':' as '#'.
|
||||
</remarks>
|
||||
</member>
|
||||
<member name="M:DiscUtils.PowerShell.Utilities.DenormalizePath(System.String)">
|
||||
<summary>
|
||||
Replace all '#' characters with ':'.
|
||||
</summary>
|
||||
<param name="path">The path to normalize</param>
|
||||
<returns>The normalized path</returns>
|
||||
<remarks>
|
||||
PowerShell has a bug that prevents tab-completion if the paths contain ':'
|
||||
characters, so in the external path for this provider we encode ':' as '#'.
|
||||
</remarks>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
Binary file not shown.
|
@ -0,0 +1,77 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
|
||||
<!--
|
||||
Copyright (c) 2008-2009, Kenneth Bell
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Based on the file types.ps1xml:
|
||||
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
||||
THIS SAMPLE CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND,WHETHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
|
||||
PURPOSE. IF THIS CODE AND INFORMATION IS MODIFIED, THE ENTIRE RISK OF USE
|
||||
OR RESULTS IN CONNECTION WITH THE USE OF THIS CODE AND INFORMATION
|
||||
REMAINS WITH THE USER.
|
||||
|
||||
-->
|
||||
|
||||
<Types>
|
||||
<Type>
|
||||
<Name>DiscUtils.DiscFileInfo</Name>
|
||||
<Members>
|
||||
<CodeProperty>
|
||||
<Name>Mode</Name>
|
||||
<GetCodeReference>
|
||||
<TypeName>DiscUtils.PowerShell.VirtualDiskProvider.Provider</TypeName>
|
||||
<MethodName>Mode</MethodName>
|
||||
</GetCodeReference>
|
||||
</CodeProperty>
|
||||
</Members>
|
||||
</Type>
|
||||
<Type>
|
||||
<Name>DiscUtils.DiscDirectoryInfo</Name>
|
||||
<Members>
|
||||
<CodeProperty>
|
||||
<Name>Mode</Name>
|
||||
<GetCodeReference>
|
||||
<TypeName>DiscUtils.PowerShell.VirtualDiskProvider.Provider</TypeName>
|
||||
<MethodName>Mode</MethodName>
|
||||
</GetCodeReference>
|
||||
</CodeProperty>
|
||||
<ScriptProperty>
|
||||
<Name>BaseName</Name>
|
||||
<GetScriptBlock>
|
||||
$this.Name
|
||||
</GetScriptBlock>
|
||||
</ScriptProperty>
|
||||
<MemberSet>
|
||||
<Name>PSStandardMembers</Name>
|
||||
<Members>
|
||||
<NoteProperty>
|
||||
<Name>DefaultDisplayProperty</Name>
|
||||
<Value>Name</Value>
|
||||
</NoteProperty>
|
||||
</Members>
|
||||
</MemberSet>
|
||||
</Members>
|
||||
</Type>
|
||||
</Types>
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
@ -0,0 +1,105 @@
|
|||
#
|
||||
# PowerShell module manifest for module 'DiscUtils'
|
||||
#
|
||||
#
|
||||
# Copyright (c) 2008-2009, Kenneth Bell
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
# copy of this software and associated documentation files (the "Software"),
|
||||
# to deal in the Software without restriction, including without limitation
|
||||
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
# and/or sell copies of the Software, and to permit persons to whom the
|
||||
# Software is furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
# DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
@{
|
||||
|
||||
# Script module or binary module file associated with this manifest
|
||||
ModuleToProcess = 'DiscUtils.PowerShell.dll'
|
||||
|
||||
# Version number of this module.
|
||||
ModuleVersion = '0.8.0.0'
|
||||
|
||||
# ID used to uniquely identify this module
|
||||
GUID = '464120bc-c6c2-4cd2-92c3-68532193590d'
|
||||
|
||||
# Author of this module
|
||||
Author = 'Kenneth Bell'
|
||||
|
||||
# Company or vendor of this module
|
||||
CompanyName = 'http://discutils.codeplex.com'
|
||||
|
||||
# Copyright statement for this module
|
||||
Copyright = 'Copyright © Kenneth Bell 2008-2009'
|
||||
|
||||
# Description of the functionality provided by this module
|
||||
Description = 'This is the DiscUtils PowerShell module for accessing virtual disk images'
|
||||
|
||||
# Minimum version of the Windows PowerShell engine required by this module
|
||||
PowerShellVersion = '2.0'
|
||||
|
||||
# Name of the Windows PowerShell host required by this module
|
||||
PowerShellHostName = ''
|
||||
|
||||
# Minimum version of the Windows PowerShell host required by this module
|
||||
PowerShellHostVersion = ''
|
||||
|
||||
# Minimum version of the .NET Framework required by this module
|
||||
DotNetFrameworkVersion = ''
|
||||
|
||||
# Minimum version of the common language runtime (CLR) required by this module
|
||||
CLRVersion = ''
|
||||
|
||||
# Processor architecture (None, X86, Amd64, IA64) required by this module
|
||||
ProcessorArchitecture = 'None'
|
||||
|
||||
# Modules that must be imported into the global environment prior to importing this module
|
||||
RequiredModules = @()
|
||||
|
||||
# Assemblies that must be loaded prior to importing this module
|
||||
RequiredAssemblies = @('DiscUtils.PowerShell.dll')
|
||||
|
||||
# Script files (.ps1) that are run in the caller's environment prior to importing this module
|
||||
ScriptsToProcess = @()
|
||||
|
||||
# Type files (.ps1xml) to be loaded when importing this module
|
||||
TypesToProcess = @('DiscUtils.Types.ps1xml')
|
||||
|
||||
# Format files (.ps1xml) to be loaded when importing this module
|
||||
FormatsToProcess = @('DiscUtils.Format.ps1xml')
|
||||
|
||||
# Modules to import as nested modules of the module specified in ModuleToProcess
|
||||
NestedModules = @()
|
||||
|
||||
# Functions to export from this module
|
||||
FunctionsToExport = '*'
|
||||
|
||||
# Cmdlets to export from this module
|
||||
CmdletsToExport = '*'
|
||||
|
||||
# Variables to export from this module
|
||||
VariablesToExport = '*'
|
||||
|
||||
# Aliases to export from this module
|
||||
AliasesToExport = '*'
|
||||
|
||||
# List of all files packaged with this module
|
||||
FileList = @('DiscUtils.psd1','DiscUtils.dll','DiscUtils.PowerShell.dll', 'DiscUtils.Common.dll',
|
||||
'DiscUtils.Format.ps1xml','DiscUtils.Types.ps1xml','DiscUtils.PowerShell.dll-Help.xml',
|
||||
'LICENSE.TXT')
|
||||
|
||||
# Private data to pass to the module specified in ModuleToProcess
|
||||
PrivateData = ''
|
||||
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue