mirror of
https://github.com/jakcron/nstool
synced 2024-11-15 02:06:40 +00:00
Merge pull request #42 from jakcron/nntools-rebrand
Rebrand NXTools to NNTools.
This commit is contained in:
commit
21b5bdaca9
243 changed files with 3577 additions and 3438 deletions
11
.vscode/c_cpp_properties.json
vendored
11
.vscode/c_cpp_properties.json
vendored
|
@ -9,14 +9,13 @@
|
||||||
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include",
|
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include",
|
||||||
"/usr/include",
|
"/usr/include",
|
||||||
"${workspaceRoot}",
|
"${workspaceRoot}",
|
||||||
"${workspaceRoot}/lib/libcrypto/include",
|
"${workspaceRoot}/lib/libfnd/include",
|
||||||
"${workspaceRoot}/lib/libcrypto/source/polarssl/libinclude",
|
"${workspaceRoot}/lib/libpolarssl/include",
|
||||||
"${workspaceRoot}/lib/libcompress/include",
|
"${workspaceRoot}/lib/liblz4/include",
|
||||||
"${workspaceRoot}/lib/libes/include",
|
"${workspaceRoot}/lib/libes/include",
|
||||||
"${workspaceRoot}/lib/libpki/include",
|
"${workspaceRoot}/lib/libpki/include",
|
||||||
"${workspaceRoot}/lib/libfnd/include",
|
"${workspaceRoot}/lib/libhac/include",
|
||||||
"${workspaceRoot}/lib/libnx/include",
|
"${workspaceRoot}/lib/libhac-hb/include"
|
||||||
"${workspaceRoot}/lib/libnx-hb/include"
|
|
||||||
],
|
],
|
||||||
"defines": [],
|
"defines": [],
|
||||||
"intelliSenseMode": "clang-x64",
|
"intelliSenseMode": "clang-x64",
|
||||||
|
|
2
LICENSE
2
LICENSE
|
@ -1,4 +1,4 @@
|
||||||
NXTools
|
NNTools
|
||||||
Copyright (c) 2017-2018 Jack
|
Copyright (c) 2017-2018 Jack
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
|
|
@ -3,49 +3,35 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 15
|
# Visual Studio 15
|
||||||
VisualStudioVersion = 15.0.27428.2015
|
VisualStudioVersion = 15.0.27428.2015
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfnd", "lib\libfnd\fnd.vcxproj", "{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}"
|
|
||||||
EndProject
|
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcrypto", "lib\libcrypto\crypto.vcxproj", "{6ADBB60D-DBA0-411D-BD2D-A355EF8E0FE1}"
|
|
||||||
EndProject
|
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libnx", "lib\libnx\nx.vcxproj", "{91BA9E79-8242-4F7D-B997-0DFEC95EA22B}"
|
|
||||||
ProjectSection(ProjectDependencies) = postProject
|
|
||||||
{6ADBB60D-DBA0-411D-BD2D-A355EF8E0FE1} = {6ADBB60D-DBA0-411D-BD2D-A355EF8E0FE1}
|
|
||||||
{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B} = {4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}
|
|
||||||
EndProjectSection
|
|
||||||
EndProject
|
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{170B4A09-1B67-4A62-93AB-116EBCFF4A8C}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{170B4A09-1B67-4A62-93AB-116EBCFF4A8C}"
|
||||||
ProjectSection(SolutionItems) = preProject
|
|
||||||
lib\makefile = lib\makefile
|
|
||||||
EndProjectSection
|
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Programs", "Programs", "{E0863FCC-8E72-490D-BE1B-458F12CA8298}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Programs", "Programs", "{E0863FCC-8E72-490D-BE1B-458F12CA8298}"
|
||||||
ProjectSection(SolutionItems) = preProject
|
|
||||||
programs\makefile = programs\makefile
|
|
||||||
EndProjectSection
|
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8F6C846D-35E2-47FD-AF42-7A3FD036346E}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8F6C846D-35E2-47FD-AF42-7A3FD036346E}"
|
||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
.gitignore = .gitignore
|
.gitignore = .gitignore
|
||||||
KEYS.md = KEYS.md
|
|
||||||
LICENSE = LICENSE
|
LICENSE = LICENSE
|
||||||
makefile = makefile
|
makefile = makefile
|
||||||
README.md = README.md
|
README.md = README.md
|
||||||
|
SWITCH_KEYS.md = SWITCH_KEYS.md
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libes", "lib\libes\es.vcxproj", "{7BE99936-0D40-410D-944B-4513C2EFF8DC}"
|
|
||||||
EndProject
|
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nstool", "programs\nstool\nstool.vcxproj", "{AF09FA96-4463-417D-8FE6-526063F41349}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nstool", "programs\nstool\nstool.vcxproj", "{AF09FA96-4463-417D-8FE6-526063F41349}"
|
||||||
ProjectSection(ProjectDependencies) = postProject
|
|
||||||
{CF01B5B7-730A-447F-9BB2-5EDA9B082177} = {CF01B5B7-730A-447F-9BB2-5EDA9B082177}
|
|
||||||
{738CB4FC-CD9E-4B81-A04B-DEADBFA71C63} = {738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}
|
|
||||||
EndProjectSection
|
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcompress", "lib\libcompress\libcompress.vcxproj", "{CF01B5B7-730A-447F-9BB2-5EDA9B082177}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfnd", "lib\libfnd\libfnd.vcxproj", "{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libnx-hb", "lib\libnx-hb\libnx-hb.vcxproj", "{738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpolarssl", "lib\libpolarssl\libpolarssl.vcxproj", "{394EFC16-BD3A-4538-B33D-7BA1EDB8DAC1}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblz4", "lib\liblz4\liblz4.vcxproj", "{AB0C3362-63AB-480A-ADBC-2EF7D859778B}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpki", "lib\libpki\libpki.vcxproj", "{B9113734-6E84-44FF-8CF7-58199AA815C5}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpki", "lib\libpki\libpki.vcxproj", "{B9113734-6E84-44FF-8CF7-58199AA815C5}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libes", "lib\libes\libes.vcxproj", "{7BE99936-0D40-410D-944B-4513C2EFF8DC}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libhac", "lib\libhac\libhac.vcxproj", "{91BA9E79-8242-4F7D-B997-0DFEC95EA22B}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libhac-hb", "lib\libhac-hb\libhac-hb.vcxproj", "{738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|x64 = Debug|x64
|
Debug|x64 = Debug|x64
|
||||||
|
@ -54,38 +40,6 @@ Global
|
||||||
Release|x86 = Release|x86
|
Release|x86 = Release|x86
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}.Debug|x64.ActiveCfg = Debug|x64
|
|
||||||
{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}.Debug|x64.Build.0 = Debug|x64
|
|
||||||
{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}.Debug|x86.ActiveCfg = Debug|Win32
|
|
||||||
{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}.Debug|x86.Build.0 = Debug|Win32
|
|
||||||
{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}.Release|x64.ActiveCfg = Release|x64
|
|
||||||
{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}.Release|x64.Build.0 = Release|x64
|
|
||||||
{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}.Release|x86.ActiveCfg = Release|Win32
|
|
||||||
{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}.Release|x86.Build.0 = Release|Win32
|
|
||||||
{6ADBB60D-DBA0-411D-BD2D-A355EF8E0FE1}.Debug|x64.ActiveCfg = Debug|x64
|
|
||||||
{6ADBB60D-DBA0-411D-BD2D-A355EF8E0FE1}.Debug|x64.Build.0 = Debug|x64
|
|
||||||
{6ADBB60D-DBA0-411D-BD2D-A355EF8E0FE1}.Debug|x86.ActiveCfg = Debug|Win32
|
|
||||||
{6ADBB60D-DBA0-411D-BD2D-A355EF8E0FE1}.Debug|x86.Build.0 = Debug|Win32
|
|
||||||
{6ADBB60D-DBA0-411D-BD2D-A355EF8E0FE1}.Release|x64.ActiveCfg = Release|x64
|
|
||||||
{6ADBB60D-DBA0-411D-BD2D-A355EF8E0FE1}.Release|x64.Build.0 = Release|x64
|
|
||||||
{6ADBB60D-DBA0-411D-BD2D-A355EF8E0FE1}.Release|x86.ActiveCfg = Release|Win32
|
|
||||||
{6ADBB60D-DBA0-411D-BD2D-A355EF8E0FE1}.Release|x86.Build.0 = Release|Win32
|
|
||||||
{91BA9E79-8242-4F7D-B997-0DFEC95EA22B}.Debug|x64.ActiveCfg = Debug|x64
|
|
||||||
{91BA9E79-8242-4F7D-B997-0DFEC95EA22B}.Debug|x64.Build.0 = Debug|x64
|
|
||||||
{91BA9E79-8242-4F7D-B997-0DFEC95EA22B}.Debug|x86.ActiveCfg = Debug|Win32
|
|
||||||
{91BA9E79-8242-4F7D-B997-0DFEC95EA22B}.Debug|x86.Build.0 = Debug|Win32
|
|
||||||
{91BA9E79-8242-4F7D-B997-0DFEC95EA22B}.Release|x64.ActiveCfg = Release|x64
|
|
||||||
{91BA9E79-8242-4F7D-B997-0DFEC95EA22B}.Release|x64.Build.0 = Release|x64
|
|
||||||
{91BA9E79-8242-4F7D-B997-0DFEC95EA22B}.Release|x86.ActiveCfg = Release|Win32
|
|
||||||
{91BA9E79-8242-4F7D-B997-0DFEC95EA22B}.Release|x86.Build.0 = Release|Win32
|
|
||||||
{7BE99936-0D40-410D-944B-4513C2EFF8DC}.Debug|x64.ActiveCfg = Debug|x64
|
|
||||||
{7BE99936-0D40-410D-944B-4513C2EFF8DC}.Debug|x64.Build.0 = Debug|x64
|
|
||||||
{7BE99936-0D40-410D-944B-4513C2EFF8DC}.Debug|x86.ActiveCfg = Debug|Win32
|
|
||||||
{7BE99936-0D40-410D-944B-4513C2EFF8DC}.Debug|x86.Build.0 = Debug|Win32
|
|
||||||
{7BE99936-0D40-410D-944B-4513C2EFF8DC}.Release|x64.ActiveCfg = Release|x64
|
|
||||||
{7BE99936-0D40-410D-944B-4513C2EFF8DC}.Release|x64.Build.0 = Release|x64
|
|
||||||
{7BE99936-0D40-410D-944B-4513C2EFF8DC}.Release|x86.ActiveCfg = Release|Win32
|
|
||||||
{7BE99936-0D40-410D-944B-4513C2EFF8DC}.Release|x86.Build.0 = Release|Win32
|
|
||||||
{AF09FA96-4463-417D-8FE6-526063F41349}.Debug|x64.ActiveCfg = Debug|x64
|
{AF09FA96-4463-417D-8FE6-526063F41349}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{AF09FA96-4463-417D-8FE6-526063F41349}.Debug|x64.Build.0 = Debug|x64
|
{AF09FA96-4463-417D-8FE6-526063F41349}.Debug|x64.Build.0 = Debug|x64
|
||||||
{AF09FA96-4463-417D-8FE6-526063F41349}.Debug|x86.ActiveCfg = Debug|Win32
|
{AF09FA96-4463-417D-8FE6-526063F41349}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
@ -94,22 +48,30 @@ Global
|
||||||
{AF09FA96-4463-417D-8FE6-526063F41349}.Release|x64.Build.0 = Release|x64
|
{AF09FA96-4463-417D-8FE6-526063F41349}.Release|x64.Build.0 = Release|x64
|
||||||
{AF09FA96-4463-417D-8FE6-526063F41349}.Release|x86.ActiveCfg = Release|Win32
|
{AF09FA96-4463-417D-8FE6-526063F41349}.Release|x86.ActiveCfg = Release|Win32
|
||||||
{AF09FA96-4463-417D-8FE6-526063F41349}.Release|x86.Build.0 = Release|Win32
|
{AF09FA96-4463-417D-8FE6-526063F41349}.Release|x86.Build.0 = Release|Win32
|
||||||
{CF01B5B7-730A-447F-9BB2-5EDA9B082177}.Debug|x64.ActiveCfg = Debug|x64
|
{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{CF01B5B7-730A-447F-9BB2-5EDA9B082177}.Debug|x64.Build.0 = Debug|x64
|
{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}.Debug|x64.Build.0 = Debug|x64
|
||||||
{CF01B5B7-730A-447F-9BB2-5EDA9B082177}.Debug|x86.ActiveCfg = Debug|Win32
|
{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
{CF01B5B7-730A-447F-9BB2-5EDA9B082177}.Debug|x86.Build.0 = Debug|Win32
|
{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}.Debug|x86.Build.0 = Debug|Win32
|
||||||
{CF01B5B7-730A-447F-9BB2-5EDA9B082177}.Release|x64.ActiveCfg = Release|x64
|
{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}.Release|x64.ActiveCfg = Release|x64
|
||||||
{CF01B5B7-730A-447F-9BB2-5EDA9B082177}.Release|x64.Build.0 = Release|x64
|
{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}.Release|x64.Build.0 = Release|x64
|
||||||
{CF01B5B7-730A-447F-9BB2-5EDA9B082177}.Release|x86.ActiveCfg = Release|Win32
|
{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}.Release|x86.ActiveCfg = Release|Win32
|
||||||
{CF01B5B7-730A-447F-9BB2-5EDA9B082177}.Release|x86.Build.0 = Release|Win32
|
{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}.Release|x86.Build.0 = Release|Win32
|
||||||
{738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}.Debug|x64.ActiveCfg = Debug|x64
|
{394EFC16-BD3A-4538-B33D-7BA1EDB8DAC1}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}.Debug|x64.Build.0 = Debug|x64
|
{394EFC16-BD3A-4538-B33D-7BA1EDB8DAC1}.Debug|x64.Build.0 = Debug|x64
|
||||||
{738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}.Debug|x86.ActiveCfg = Debug|Win32
|
{394EFC16-BD3A-4538-B33D-7BA1EDB8DAC1}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
{738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}.Debug|x86.Build.0 = Debug|Win32
|
{394EFC16-BD3A-4538-B33D-7BA1EDB8DAC1}.Debug|x86.Build.0 = Debug|Win32
|
||||||
{738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}.Release|x64.ActiveCfg = Release|x64
|
{394EFC16-BD3A-4538-B33D-7BA1EDB8DAC1}.Release|x64.ActiveCfg = Release|x64
|
||||||
{738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}.Release|x64.Build.0 = Release|x64
|
{394EFC16-BD3A-4538-B33D-7BA1EDB8DAC1}.Release|x64.Build.0 = Release|x64
|
||||||
{738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}.Release|x86.ActiveCfg = Release|Win32
|
{394EFC16-BD3A-4538-B33D-7BA1EDB8DAC1}.Release|x86.ActiveCfg = Release|Win32
|
||||||
{738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}.Release|x86.Build.0 = Release|Win32
|
{394EFC16-BD3A-4538-B33D-7BA1EDB8DAC1}.Release|x86.Build.0 = Release|Win32
|
||||||
|
{AB0C3362-63AB-480A-ADBC-2EF7D859778B}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{AB0C3362-63AB-480A-ADBC-2EF7D859778B}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{AB0C3362-63AB-480A-ADBC-2EF7D859778B}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{AB0C3362-63AB-480A-ADBC-2EF7D859778B}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{AB0C3362-63AB-480A-ADBC-2EF7D859778B}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{AB0C3362-63AB-480A-ADBC-2EF7D859778B}.Release|x64.Build.0 = Release|x64
|
||||||
|
{AB0C3362-63AB-480A-ADBC-2EF7D859778B}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{AB0C3362-63AB-480A-ADBC-2EF7D859778B}.Release|x86.Build.0 = Release|Win32
|
||||||
{B9113734-6E84-44FF-8CF7-58199AA815C5}.Debug|x64.ActiveCfg = Debug|x64
|
{B9113734-6E84-44FF-8CF7-58199AA815C5}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{B9113734-6E84-44FF-8CF7-58199AA815C5}.Debug|x64.Build.0 = Debug|x64
|
{B9113734-6E84-44FF-8CF7-58199AA815C5}.Debug|x64.Build.0 = Debug|x64
|
||||||
{B9113734-6E84-44FF-8CF7-58199AA815C5}.Debug|x86.ActiveCfg = Debug|Win32
|
{B9113734-6E84-44FF-8CF7-58199AA815C5}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
@ -118,19 +80,43 @@ Global
|
||||||
{B9113734-6E84-44FF-8CF7-58199AA815C5}.Release|x64.Build.0 = Release|x64
|
{B9113734-6E84-44FF-8CF7-58199AA815C5}.Release|x64.Build.0 = Release|x64
|
||||||
{B9113734-6E84-44FF-8CF7-58199AA815C5}.Release|x86.ActiveCfg = Release|Win32
|
{B9113734-6E84-44FF-8CF7-58199AA815C5}.Release|x86.ActiveCfg = Release|Win32
|
||||||
{B9113734-6E84-44FF-8CF7-58199AA815C5}.Release|x86.Build.0 = Release|Win32
|
{B9113734-6E84-44FF-8CF7-58199AA815C5}.Release|x86.Build.0 = Release|Win32
|
||||||
|
{7BE99936-0D40-410D-944B-4513C2EFF8DC}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{7BE99936-0D40-410D-944B-4513C2EFF8DC}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{7BE99936-0D40-410D-944B-4513C2EFF8DC}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{7BE99936-0D40-410D-944B-4513C2EFF8DC}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{7BE99936-0D40-410D-944B-4513C2EFF8DC}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{7BE99936-0D40-410D-944B-4513C2EFF8DC}.Release|x64.Build.0 = Release|x64
|
||||||
|
{7BE99936-0D40-410D-944B-4513C2EFF8DC}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{7BE99936-0D40-410D-944B-4513C2EFF8DC}.Release|x86.Build.0 = Release|Win32
|
||||||
|
{91BA9E79-8242-4F7D-B997-0DFEC95EA22B}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{91BA9E79-8242-4F7D-B997-0DFEC95EA22B}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{91BA9E79-8242-4F7D-B997-0DFEC95EA22B}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{91BA9E79-8242-4F7D-B997-0DFEC95EA22B}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{91BA9E79-8242-4F7D-B997-0DFEC95EA22B}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{91BA9E79-8242-4F7D-B997-0DFEC95EA22B}.Release|x64.Build.0 = Release|x64
|
||||||
|
{91BA9E79-8242-4F7D-B997-0DFEC95EA22B}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{91BA9E79-8242-4F7D-B997-0DFEC95EA22B}.Release|x86.Build.0 = Release|Win32
|
||||||
|
{738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}.Release|x64.Build.0 = Release|x64
|
||||||
|
{738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}.Release|x86.Build.0 = Release|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(NestedProjects) = preSolution
|
GlobalSection(NestedProjects) = preSolution
|
||||||
{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B} = {170B4A09-1B67-4A62-93AB-116EBCFF4A8C}
|
|
||||||
{6ADBB60D-DBA0-411D-BD2D-A355EF8E0FE1} = {170B4A09-1B67-4A62-93AB-116EBCFF4A8C}
|
|
||||||
{91BA9E79-8242-4F7D-B997-0DFEC95EA22B} = {170B4A09-1B67-4A62-93AB-116EBCFF4A8C}
|
|
||||||
{7BE99936-0D40-410D-944B-4513C2EFF8DC} = {170B4A09-1B67-4A62-93AB-116EBCFF4A8C}
|
|
||||||
{AF09FA96-4463-417D-8FE6-526063F41349} = {E0863FCC-8E72-490D-BE1B-458F12CA8298}
|
{AF09FA96-4463-417D-8FE6-526063F41349} = {E0863FCC-8E72-490D-BE1B-458F12CA8298}
|
||||||
{CF01B5B7-730A-447F-9BB2-5EDA9B082177} = {170B4A09-1B67-4A62-93AB-116EBCFF4A8C}
|
{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B} = {170B4A09-1B67-4A62-93AB-116EBCFF4A8C}
|
||||||
{738CB4FC-CD9E-4B81-A04B-DEADBFA71C63} = {170B4A09-1B67-4A62-93AB-116EBCFF4A8C}
|
{394EFC16-BD3A-4538-B33D-7BA1EDB8DAC1} = {170B4A09-1B67-4A62-93AB-116EBCFF4A8C}
|
||||||
|
{AB0C3362-63AB-480A-ADBC-2EF7D859778B} = {170B4A09-1B67-4A62-93AB-116EBCFF4A8C}
|
||||||
{B9113734-6E84-44FF-8CF7-58199AA815C5} = {170B4A09-1B67-4A62-93AB-116EBCFF4A8C}
|
{B9113734-6E84-44FF-8CF7-58199AA815C5} = {170B4A09-1B67-4A62-93AB-116EBCFF4A8C}
|
||||||
|
{7BE99936-0D40-410D-944B-4513C2EFF8DC} = {170B4A09-1B67-4A62-93AB-116EBCFF4A8C}
|
||||||
|
{91BA9E79-8242-4F7D-B997-0DFEC95EA22B} = {170B4A09-1B67-4A62-93AB-116EBCFF4A8C}
|
||||||
|
{738CB4FC-CD9E-4B81-A04B-DEADBFA71C63} = {170B4A09-1B67-4A62-93AB-116EBCFF4A8C}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {07DCCACC-D10D-47C9-85AE-FB9C54DB7D62}
|
SolutionGuid = {07DCCACC-D10D-47C9-85AE-FB9C54DB7D62}
|
|
@ -21,9 +21,9 @@
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<VCProjectVersion>15.0</VCProjectVersion>
|
<VCProjectVersion>15.0</VCProjectVersion>
|
||||||
<ProjectGuid>{0A4197A1-76AD-4BF7-A29D-5CED369B72FD}</ProjectGuid>
|
<ProjectGuid>{0A4197A1-76AD-4BF7-A29D-5CED369B72FD}</ProjectGuid>
|
||||||
<RootNamespace>NXTools</RootNamespace>
|
<RootNamespace>NNTools</RootNamespace>
|
||||||
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
|
||||||
<ProjectName>libnx</ProjectName>
|
<ProjectName>NNTools</ProjectName>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
37
README.md
37
README.md
|
@ -1,35 +1,26 @@
|
||||||
# NXTools
|
# NNTools
|
||||||
|
|
||||||
Tools & Libraries for NX (Nintendo Switch).
|
Tools & Libraries for Nintendo devices.
|
||||||
|
|
||||||
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](/LICENSE)
|
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](/LICENSE)
|
||||||
|
|
||||||
# Tools
|
# Tools
|
||||||
|
* [__nstool__](/programs/nstool/README.md) - General purpose read/extract tool for Nintendo Switch file formats.
|
||||||
* __nstool__ - read *.npdm, read/extract PartitionFS (PFS0|HFS0) blobs (including *.nsp), read/extract RomFS blobs, read/extract *.xci, read/extract *.nca, read *.cnmt, read *.nso, read *.nro, read *.nacp
|
|
||||||
|
|
||||||
# Libraries
|
# Libraries
|
||||||
|
* __libfnd__ - Foundation library. Provides file IO, crypto, CLI utils, string conversion, etc.
|
||||||
* __libfnd__ - Foundation library.
|
|
||||||
* __libcrypto__ - Cryptographic functions (AES,SHA,RSA). Wrapper for [mbedTLS](https://github.com/ARMmbed/mbedtls)
|
|
||||||
* __libcompress__ - Compression algorithms (LZ4). Wrapper for [lz4](https://github.com/lz4/lz4)
|
|
||||||
* __libpki__ - Processes Nintendo's proprietary PKI.
|
* __libpki__ - Processes Nintendo's proprietary PKI.
|
||||||
* __libes__ - Processes Nintendo's eShop file types.
|
* __libes__ - Processes Nintendo's eShop file formats.
|
||||||
* __libnx__ - Processes NX file types.
|
* __libhac__ - Processes Nintendo Switch file formats.
|
||||||
* __libnx-hb__ - Processes NX file types (homebrew extensions).
|
* __libhac-hb__ - Processes Nintendo Switch file formats (homebrew extensions).
|
||||||
|
|
||||||
|
# Dependencies
|
||||||
|
* __libpolarssl__ - Cryptographic functions (AES,SHA,RSA). Clone of [polarssl](https://github.com/ARMmbed/mbedtls) (now mbedTLS).
|
||||||
|
* __liblz4__ - Compression algorithms (LZ4). Clone of [lz4](https://github.com/lz4/lz4).
|
||||||
|
|
||||||
|
(Copies of these are included locally and are statically linked libraries)
|
||||||
|
|
||||||
# Building
|
# Building
|
||||||
|
|
||||||
On MacOS/Linux/WSL run `make`.
|
On MacOS/Linux/WSL run `make`.
|
||||||
|
|
||||||
For Windows, Visual Studio 2017 is supported.
|
For Windows, Visual Studio 2017 is supported.
|
||||||
|
|
||||||
# External Keys
|
|
||||||
|
|
||||||
Programs/libraries don't embed any keys that are copyright protected. However keys can be imported via a keyset file.
|
|
||||||
|
|
||||||
For programs that support it, the keyset file can be provided via the command line (see program usage for details). Alternatively a keyset file located in ___$HOME/.switch/prod.keys___ (or ___$HOME/.switch/dev.keys___ for dev) will be imported automatically if one is not provided at the command line.
|
|
||||||
|
|
||||||
Keyset files are ASCII text files containing one key per line, in the form "__key_name = HEXADECIMALKEY__". Case and whitespace do not matter, ';' character can be used to insert comments.
|
|
||||||
|
|
||||||
See [KEYS.md](/KEYS.md) for more details.
|
|
|
@ -1,5 +1,19 @@
|
||||||
# Format
|
|
||||||
Programs in NXTools currently recognise the following keys (## represents a hexadecimal number between 00 and 1F):
|
# About
|
||||||
|
Keyset files are ASCII text files containing one key per line, in the form "__key_name = HEXADECIMALKEY__". Case and whitespace do not matter, ';' character can be used to insert comments.
|
||||||
|
|
||||||
|
# Loading keyset files automatically
|
||||||
|
If a keyset file is located in ___$HOME/.switch/___ it will be loaded automatically.
|
||||||
|
|
||||||
|
# General Keys (prod.keys and dev.keys)
|
||||||
|
Some switch files formats feature encryption and or cryptographic signatures. In order to process these file formats, some keys are required. These keys can be supplied via a keyfile: ___prod.keys___ (or ___dev.keys___ for devkit variants).
|
||||||
|
|
||||||
|
This keyset file can be provided via the command line (refer to usage for details).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Format
|
||||||
|
The following keys are recognised (## represents a hexadecimal number between 00 and 1F):
|
||||||
|
|
||||||
```
|
```
|
||||||
; Key Sources
|
; Key Sources
|
||||||
|
@ -47,8 +61,8 @@ acid_sign_key_modulus : RSA2048 Modulus (0x100 bytes)
|
||||||
acid_sign_key_private : RSA2048 Private Exponent (0x100 bytes)
|
acid_sign_key_private : RSA2048 Private Exponent (0x100 bytes)
|
||||||
```
|
```
|
||||||
|
|
||||||
# Compatibility with hactool keyset files
|
## Compatibility with hactool keyset files
|
||||||
NXTools keyset files share the same keyset file format as [hactool](https://github.com/SciresM/hactool/blob/master/KEYS.md), but names of keys may differ. For compatibility, hactool names for equivalent keys are accepted.
|
`prod.keys` (and `dev.keys`) keyset files share the same keyset file format as [hactool](https://github.com/SciresM/hactool/blob/master/KEYS.md), but names of keys may differ. For compatibility, hactool names for equivalent keys are accepted.
|
||||||
```
|
```
|
||||||
titlekek_source : hactool alias for ticket_commonkey_source
|
titlekek_source : hactool alias for ticket_commonkey_source
|
||||||
header_key_source : hactool alias for nca_header_key_source
|
header_key_source : hactool alias for nca_header_key_source
|
|
@ -1,14 +0,0 @@
|
||||||
#include <compress/lz4.h>
|
|
||||||
#include "lz4/lz4.h"
|
|
||||||
|
|
||||||
void compress::lz4::compressData(const uint8_t* src, uint32_t src_len, uint8_t* dst, uint32_t dst_capacity, uint32_t& compressed_size)
|
|
||||||
{
|
|
||||||
compressed_size = LZ4_compress_default((const char*)src, (char*)dst, (int)src_len, (int)dst_capacity);
|
|
||||||
}
|
|
||||||
|
|
||||||
void compress::lz4::decompressData(const uint8_t* src, uint32_t src_len, uint8_t* dst, uint32_t dst_capacity, uint32_t& decompressed_size)
|
|
||||||
{
|
|
||||||
decompressed_size = LZ4_decompress_safe((const char*)src, (char*)dst, (int)src_len, (int)dst_capacity);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -1,159 +0,0 @@
|
||||||
<?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="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>{6ADBB60D-DBA0-411D-BD2D-A355EF8E0FE1}</ProjectGuid>
|
|
||||||
<RootNamespace>crypto</RootNamespace>
|
|
||||||
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
|
|
||||||
<ProjectName>libcrypto</ProjectName>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
|
||||||
</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 />
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
||||||
<ClCompile>
|
|
||||||
<WarningLevel>Level3</WarningLevel>
|
|
||||||
<Optimization>Disabled</Optimization>
|
|
||||||
<SDLCheck>true</SDLCheck>
|
|
||||||
<AdditionalIncludeDirectories>..\libfnd\include;..\libcrypto\include;..\libcrypto\source\libpolarssl\include;</AdditionalIncludeDirectories>
|
|
||||||
<PreprocessorDefinitions>_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
</ClCompile>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
||||||
<ClCompile>
|
|
||||||
<WarningLevel>Level3</WarningLevel>
|
|
||||||
<Optimization>Disabled</Optimization>
|
|
||||||
<SDLCheck>true</SDLCheck>
|
|
||||||
<AdditionalIncludeDirectories>..\libfnd\include;..\libcrypto\include;..\libcrypto\source\libpolarssl\include;</AdditionalIncludeDirectories>
|
|
||||||
<PreprocessorDefinitions>_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
</ClCompile>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
||||||
<ClCompile>
|
|
||||||
<WarningLevel>Level3</WarningLevel>
|
|
||||||
<Optimization>MaxSpeed</Optimization>
|
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
|
||||||
<SDLCheck>true</SDLCheck>
|
|
||||||
<AdditionalIncludeDirectories>..\libfnd\include;..\libcrypto\include;..\libcrypto\source\libpolarssl\include;</AdditionalIncludeDirectories>
|
|
||||||
<PreprocessorDefinitions>_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
<ClCompile>
|
|
||||||
<WarningLevel>Level3</WarningLevel>
|
|
||||||
<Optimization>MaxSpeed</Optimization>
|
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
|
||||||
<SDLCheck>true</SDLCheck>
|
|
||||||
<AdditionalIncludeDirectories>..\libfnd\include;..\libcrypto\include;..\libcrypto\source\libpolarssl\include;</AdditionalIncludeDirectories>
|
|
||||||
<PreprocessorDefinitions>_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClInclude Include="include\crypto\aes.h" />
|
|
||||||
<ClInclude Include="include\crypto\base64.h" />
|
|
||||||
<ClInclude Include="include\crypto\ecdsa.h" />
|
|
||||||
<ClInclude Include="include\crypto\rsa.h" />
|
|
||||||
<ClInclude Include="include\crypto\sha.h" />
|
|
||||||
<ClInclude Include="source\libpolarssl\include\polarssl\aes.h" />
|
|
||||||
<ClInclude Include="source\libpolarssl\include\polarssl\base64.h" />
|
|
||||||
<ClInclude Include="source\libpolarssl\include\polarssl\bignum.h" />
|
|
||||||
<ClInclude Include="source\libpolarssl\include\polarssl\bn_mul.h" />
|
|
||||||
<ClInclude Include="source\libpolarssl\include\polarssl\config.h" />
|
|
||||||
<ClInclude Include="source\libpolarssl\include\polarssl\md.h" />
|
|
||||||
<ClInclude Include="source\libpolarssl\include\polarssl\md_wrap.h" />
|
|
||||||
<ClInclude Include="source\libpolarssl\include\polarssl\rsa.h" />
|
|
||||||
<ClInclude Include="source\libpolarssl\include\polarssl\sha1.h" />
|
|
||||||
<ClInclude Include="source\libpolarssl\include\polarssl\sha2.h" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClCompile Include="source\aes_wrapper.cpp" />
|
|
||||||
<ClCompile Include="source\base64_wrapper.cpp" />
|
|
||||||
<ClCompile Include="source\libpolarssl\source\aes.c" />
|
|
||||||
<ClCompile Include="source\libpolarssl\source\base64.c" />
|
|
||||||
<ClCompile Include="source\libpolarssl\source\bignum.c" />
|
|
||||||
<ClCompile Include="source\libpolarssl\source\md.c" />
|
|
||||||
<ClCompile Include="source\libpolarssl\source\md_wrap.c" />
|
|
||||||
<ClCompile Include="source\libpolarssl\source\rsa.c" />
|
|
||||||
<ClCompile Include="source\libpolarssl\source\sha1.c" />
|
|
||||||
<ClCompile Include="source\libpolarssl\source\sha2.c" />
|
|
||||||
<ClCompile Include="source\rsa_wrapper.cpp" />
|
|
||||||
<ClCompile Include="source\sha_wrapper.cpp" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="makefile" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
|
||||||
<ImportGroup Label="ExtensionTargets">
|
|
||||||
</ImportGroup>
|
|
||||||
</Project>
|
|
|
@ -1,114 +0,0 @@
|
||||||
<?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>
|
|
||||||
<Filter Include="Header Files\crypto">
|
|
||||||
<UniqueIdentifier>{c24d0e3f-1a38-486c-9bad-b7db5b39eee2}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Header Files\polarssl">
|
|
||||||
<UniqueIdentifier>{50821199-d06b-4e82-b424-3f17b60f1a9e}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Source Files\polarssl">
|
|
||||||
<UniqueIdentifier>{012a6f22-d10a-4ca3-b7c3-4c31c6ff1cc1}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClInclude Include="include\crypto\aes.h">
|
|
||||||
<Filter>Header Files\crypto</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="include\crypto\rsa.h">
|
|
||||||
<Filter>Header Files\crypto</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="include\crypto\sha.h">
|
|
||||||
<Filter>Header Files\crypto</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="source\libpolarssl\include\polarssl\aes.h">
|
|
||||||
<Filter>Header Files\polarssl</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="source\libpolarssl\include\polarssl\base64.h">
|
|
||||||
<Filter>Header Files\polarssl</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="source\libpolarssl\include\polarssl\bignum.h">
|
|
||||||
<Filter>Header Files\polarssl</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="source\libpolarssl\include\polarssl\bn_mul.h">
|
|
||||||
<Filter>Header Files\polarssl</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="source\libpolarssl\include\polarssl\config.h">
|
|
||||||
<Filter>Header Files\polarssl</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="source\libpolarssl\include\polarssl\rsa.h">
|
|
||||||
<Filter>Header Files\polarssl</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="source\libpolarssl\include\polarssl\sha1.h">
|
|
||||||
<Filter>Header Files\polarssl</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="source\libpolarssl\include\polarssl\sha2.h">
|
|
||||||
<Filter>Header Files\polarssl</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="source\libpolarssl\include\polarssl\md.h">
|
|
||||||
<Filter>Header Files\polarssl</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="source\libpolarssl\include\polarssl\md_wrap.h">
|
|
||||||
<Filter>Header Files\polarssl</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="include\crypto\ecdsa.h">
|
|
||||||
<Filter>Header Files\crypto</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="include\crypto\base64.h">
|
|
||||||
<Filter>Header Files\crypto</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClCompile Include="source\aes_wrapper.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="source\rsa_wrapper.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="source\sha_wrapper.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="source\libpolarssl\source\aes.c">
|
|
||||||
<Filter>Source Files\polarssl</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="source\libpolarssl\source\base64.c">
|
|
||||||
<Filter>Source Files\polarssl</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="source\libpolarssl\source\bignum.c">
|
|
||||||
<Filter>Source Files\polarssl</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="source\libpolarssl\source\md.c">
|
|
||||||
<Filter>Source Files\polarssl</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="source\libpolarssl\source\md_wrap.c">
|
|
||||||
<Filter>Source Files\polarssl</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="source\libpolarssl\source\rsa.c">
|
|
||||||
<Filter>Source Files\polarssl</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="source\libpolarssl\source\sha1.c">
|
|
||||||
<Filter>Source Files\polarssl</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="source\libpolarssl\source\sha2.c">
|
|
||||||
<Filter>Source Files\polarssl</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="source\base64_wrapper.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="makefile" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
|
@ -1,30 +0,0 @@
|
||||||
#include <crypto/base64.h>
|
|
||||||
#include <polarssl/base64.h>
|
|
||||||
|
|
||||||
size_t crypto::base64::B64_GetEncodeLen(const uint8_t* src, size_t slen)
|
|
||||||
{
|
|
||||||
size_t dlen = 0;
|
|
||||||
|
|
||||||
base64_encode(nullptr, &dlen, src, slen);
|
|
||||||
|
|
||||||
return dlen;
|
|
||||||
}
|
|
||||||
|
|
||||||
void crypto::base64::B64_Encode(const uint8_t* src, size_t slen, uint8_t* dst, size_t dlen)
|
|
||||||
{
|
|
||||||
base64_encode(dst, &dlen, src, slen);
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t crypto::base64::B64_GetDecodeLen(const uint8_t* src, size_t slen)
|
|
||||||
{
|
|
||||||
size_t dlen = 0;
|
|
||||||
|
|
||||||
base64_decode(nullptr, &dlen, src, slen);
|
|
||||||
|
|
||||||
return dlen;
|
|
||||||
}
|
|
||||||
|
|
||||||
void crypto::base64::B64_Decode(const uint8_t* src, size_t slen, uint8_t* dst, size_t dlen)
|
|
||||||
{
|
|
||||||
base64_decode(dst, &dlen, src, slen);
|
|
||||||
}
|
|
|
@ -1,37 +0,0 @@
|
||||||
# Sources
|
|
||||||
SRC_DIR = source
|
|
||||||
OBJS = $(foreach dir,$(SRC_DIR),$(subst .cpp,.o,$(wildcard $(dir)/*.cpp))) $(foreach dir,$(SRC_DIR),$(subst .c,.o,$(wildcard $(dir)/*.c)))
|
|
||||||
|
|
||||||
# External dependencies
|
|
||||||
DEPENDS =
|
|
||||||
LIB_DIR = ..
|
|
||||||
INCS = -I"include" $(foreach dep,$(DEPENDS), -I"$(LIB_DIR)/lib$(dep)/include")
|
|
||||||
|
|
||||||
|
|
||||||
# Compiler Settings
|
|
||||||
CXXFLAGS = -std=c++11 $(INCS) -D__STDC_FORMAT_MACROS -Wall -Wno-unused-but-set-variable -Wno-unused-value
|
|
||||||
CFLAGS = -std=c11 $(INCS) -Wall -Wno-unused-but-set-variable -Wno-unused-value
|
|
||||||
ifeq ($(OS),Windows_NT)
|
|
||||||
# Windows Only Flags/Libs
|
|
||||||
CC = x86_64-w64-mingw32-gcc
|
|
||||||
CXX = x86_64-w64-mingw32-g++
|
|
||||||
CFLAGS +=
|
|
||||||
CXXFLAGS +=
|
|
||||||
else
|
|
||||||
# *nix Only Flags/Libs
|
|
||||||
CFLAGS +=
|
|
||||||
CXXFLAGS +=
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Output
|
|
||||||
OUTPUT = $(shell basename $(CURDIR)).a
|
|
||||||
|
|
||||||
main: build
|
|
||||||
|
|
||||||
rebuild: clean build
|
|
||||||
|
|
||||||
build: $(OBJS)
|
|
||||||
ar cr -o $(OUTPUT) $(OBJS)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -rf $(OUTPUT) $(OBJS)
|
|
|
@ -1,15 +0,0 @@
|
||||||
#include <crypto/sha.h>
|
|
||||||
#include <polarssl/sha1.h>
|
|
||||||
#include <polarssl/sha2.h>
|
|
||||||
|
|
||||||
using namespace crypto::sha;
|
|
||||||
|
|
||||||
void crypto::sha::Sha1(const uint8_t* in, uint64_t size, uint8_t hash[kSha1HashLen])
|
|
||||||
{
|
|
||||||
sha1(in, size, hash);
|
|
||||||
}
|
|
||||||
|
|
||||||
void crypto::sha::Sha256(const uint8_t* in, uint64_t size, uint8_t hash[kSha256HashLen])
|
|
||||||
{
|
|
||||||
sha2(in, size, hash, false);
|
|
||||||
}
|
|
|
@ -1,8 +1,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/ISerialisable.h>
|
||||||
#include <es/ticket.h>
|
#include <nn/es/ticket.h>
|
||||||
|
|
||||||
|
namespace nn
|
||||||
|
{
|
||||||
namespace es
|
namespace es
|
||||||
{
|
{
|
||||||
class SectionHeader_V2 :
|
class SectionHeader_V2 :
|
||||||
|
@ -52,5 +54,5 @@ namespace es
|
||||||
uint16_t mRecordNum;
|
uint16_t mRecordNum;
|
||||||
ticket::SectionType mSectionType;
|
ticket::SectionType mSectionType;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -2,8 +2,10 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/ISerialisable.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
#include <es/ticket.h>
|
#include <nn/es/ticket.h>
|
||||||
|
|
||||||
|
namespace nn
|
||||||
|
{
|
||||||
namespace es
|
namespace es
|
||||||
{
|
{
|
||||||
class TicketBody_V2 :
|
class TicketBody_V2 :
|
||||||
|
@ -98,5 +100,4 @@ namespace es
|
||||||
uint16_t mSectEntrySize;
|
uint16_t mSectEntrySize;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <crypto/rsa.h>
|
#include <fnd/rsa.h>
|
||||||
|
|
||||||
|
namespace nn
|
||||||
|
{
|
||||||
namespace es
|
namespace es
|
||||||
{
|
{
|
||||||
namespace ticket
|
namespace ticket
|
||||||
|
@ -42,7 +44,7 @@ namespace es
|
||||||
|
|
||||||
static const size_t kIssuerSize = 0x40;
|
static const size_t kIssuerSize = 0x40;
|
||||||
static const byte_t kFormatVersion = 2;
|
static const byte_t kFormatVersion = 2;
|
||||||
static const size_t kEncTitleKeySize = crypto::rsa::kRsa2048Size;
|
static const size_t kEncTitleKeySize = fnd::rsa::kRsa2048Size;
|
||||||
static const size_t kReservedRegionSize = 8;
|
static const size_t kReservedRegionSize = 8;
|
||||||
static const size_t kRightsIdSize = 16;
|
static const size_t kRightsIdSize = 16;
|
||||||
}
|
}
|
||||||
|
@ -105,4 +107,5 @@ namespace es
|
||||||
inline uint16_t get_group(uint16_t index) const { return index & kGroupMask; }
|
inline uint16_t get_group(uint16_t index) const { return index & kGroupMask; }
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -20,9 +20,7 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<ProjectGuid>{7BE99936-0D40-410D-944B-4513C2EFF8DC}</ProjectGuid>
|
<ProjectGuid>{7BE99936-0D40-410D-944B-4513C2EFF8DC}</ProjectGuid>
|
||||||
<RootNamespace>es</RootNamespace>
|
|
||||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||||
<ProjectName>libes</ProjectName>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
@ -75,7 +73,7 @@
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>..\libfnd\include;..\libcrypto\include;..\libes\include;</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\libfnd\include;..\libes\include;</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
|
@ -84,7 +82,7 @@
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>..\libfnd\include;..\libcrypto\include;..\libes\include;</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\libfnd\include;..\libes\include;</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
|
@ -95,7 +93,7 @@
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>..\libfnd\include;..\libcrypto\include;..\libes\include;</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\libfnd\include;..\libes\include;</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
|
@ -110,7 +108,7 @@
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>..\libfnd\include;..\libcrypto\include;..\libes\include;</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\libfnd\include;..\libes\include;</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
|
@ -122,9 +120,9 @@
|
||||||
<None Include="makefile" />
|
<None Include="makefile" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="include\es\SectionHeader_V2.h" />
|
<ClInclude Include="include\nn\es\SectionHeader_V2.h" />
|
||||||
<ClInclude Include="include\es\ticket.h" />
|
<ClInclude Include="include\nn\es\ticket.h" />
|
||||||
<ClInclude Include="include\es\TicketBody_V2.h" />
|
<ClInclude Include="include\nn\es\TicketBody_V2.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="source\SectionHeader_V2.cpp" />
|
<ClCompile Include="source\SectionHeader_V2.cpp" />
|
|
@ -18,13 +18,13 @@
|
||||||
<None Include="makefile" />
|
<None Include="makefile" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="include\es\SectionHeader_V2.h">
|
<ClInclude Include="include\nn\es\SectionHeader_V2.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\es\ticket.h">
|
<ClInclude Include="include\nn\es\ticket.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\es\TicketBody_V2.h">
|
<ClInclude Include="include\nn\es\TicketBody_V2.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
|
@ -7,7 +7,6 @@ DEPENDS = fnd crypto
|
||||||
LIB_DIR = ..
|
LIB_DIR = ..
|
||||||
INCS = -I"include" $(foreach dep,$(DEPENDS), -I"$(LIB_DIR)/lib$(dep)/include")
|
INCS = -I"include" $(foreach dep,$(DEPENDS), -I"$(LIB_DIR)/lib$(dep)/include")
|
||||||
|
|
||||||
|
|
||||||
# Compiler Settings
|
# Compiler Settings
|
||||||
CXXFLAGS = -std=c++11 $(INCS) -D__STDC_FORMAT_MACROS -Wall -Wno-unused-value
|
CXXFLAGS = -std=c++11 $(INCS) -D__STDC_FORMAT_MACROS -Wall -Wno-unused-value
|
||||||
CFLAGS = -std=c11 $(INCS) -Wall -Wno-unused-value
|
CFLAGS = -std=c11 $(INCS) -Wall -Wno-unused-value
|
||||||
|
|
|
@ -1,16 +1,14 @@
|
||||||
#include <es/SectionHeader_V2.h>
|
#include <nn/es/SectionHeader_V2.h>
|
||||||
|
|
||||||
|
nn::es::SectionHeader_V2::SectionHeader_V2()
|
||||||
|
|
||||||
es::SectionHeader_V2::SectionHeader_V2()
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
es::SectionHeader_V2::SectionHeader_V2(const SectionHeader_V2 & other)
|
nn::es::SectionHeader_V2::SectionHeader_V2(const SectionHeader_V2 & other)
|
||||||
{
|
{
|
||||||
*this = other;
|
*this = other;
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::SectionHeader_V2::operator=(const SectionHeader_V2 & other)
|
void nn::es::SectionHeader_V2::operator=(const SectionHeader_V2 & other)
|
||||||
{
|
{
|
||||||
if (other.getBytes().size())
|
if (other.getBytes().size())
|
||||||
{
|
{
|
||||||
|
@ -27,7 +25,7 @@ void es::SectionHeader_V2::operator=(const SectionHeader_V2 & other)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool es::SectionHeader_V2::operator==(const SectionHeader_V2 & other) const
|
bool nn::es::SectionHeader_V2::operator==(const SectionHeader_V2 & other) const
|
||||||
{
|
{
|
||||||
return (mSectionOffset == other.mSectionOffset) \
|
return (mSectionOffset == other.mSectionOffset) \
|
||||||
&& (mRecordSize == other.mRecordSize) \
|
&& (mRecordSize == other.mRecordSize) \
|
||||||
|
@ -36,12 +34,12 @@ bool es::SectionHeader_V2::operator==(const SectionHeader_V2 & other) const
|
||||||
&& (mSectionType == other.mSectionType);
|
&& (mSectionType == other.mSectionType);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool es::SectionHeader_V2::operator!=(const SectionHeader_V2 & other) const
|
bool nn::es::SectionHeader_V2::operator!=(const SectionHeader_V2 & other) const
|
||||||
{
|
{
|
||||||
return !(*this ==other);
|
return !(*this ==other);
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::SectionHeader_V2::toBytes()
|
void nn::es::SectionHeader_V2::toBytes()
|
||||||
{
|
{
|
||||||
mRawBinary.alloc(sizeof(sSectionHeader_v2));
|
mRawBinary.alloc(sizeof(sSectionHeader_v2));
|
||||||
sSectionHeader_v2* hdr = (sSectionHeader_v2*)mRawBinary.data();
|
sSectionHeader_v2* hdr = (sSectionHeader_v2*)mRawBinary.data();
|
||||||
|
@ -53,7 +51,7 @@ void es::SectionHeader_V2::toBytes()
|
||||||
hdr->section_type = (mSectionType);
|
hdr->section_type = (mSectionType);
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::SectionHeader_V2::fromBytes(const byte_t * bytes, size_t len)
|
void nn::es::SectionHeader_V2::fromBytes(const byte_t * bytes, size_t len)
|
||||||
{
|
{
|
||||||
if (len < sizeof(sSectionHeader_v2))
|
if (len < sizeof(sSectionHeader_v2))
|
||||||
{
|
{
|
||||||
|
@ -73,12 +71,12 @@ void es::SectionHeader_V2::fromBytes(const byte_t * bytes, size_t len)
|
||||||
mSectionType = (ticket::SectionType)hdr->section_type.get();
|
mSectionType = (ticket::SectionType)hdr->section_type.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::Vec<byte_t>& es::SectionHeader_V2::getBytes() const
|
const fnd::Vec<byte_t>& nn::es::SectionHeader_V2::getBytes() const
|
||||||
{
|
{
|
||||||
return mRawBinary;
|
return mRawBinary;
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::SectionHeader_V2::clear()
|
void nn::es::SectionHeader_V2::clear()
|
||||||
{
|
{
|
||||||
mRawBinary.clear();
|
mRawBinary.clear();
|
||||||
mSectionOffset = 0;
|
mSectionOffset = 0;
|
||||||
|
@ -88,52 +86,52 @@ void es::SectionHeader_V2::clear()
|
||||||
mSectionType = ticket::SECTION_PERMANENT;
|
mSectionType = ticket::SECTION_PERMANENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t es::SectionHeader_V2::getSectionOffset() const
|
uint32_t nn::es::SectionHeader_V2::getSectionOffset() const
|
||||||
{
|
{
|
||||||
return mSectionOffset;
|
return mSectionOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::SectionHeader_V2::setSectionOffset(uint32_t offset)
|
void nn::es::SectionHeader_V2::setSectionOffset(uint32_t offset)
|
||||||
{
|
{
|
||||||
mSectionOffset = offset;
|
mSectionOffset = offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t es::SectionHeader_V2::getRecordSize() const
|
uint32_t nn::es::SectionHeader_V2::getRecordSize() const
|
||||||
{
|
{
|
||||||
return mRecordSize;
|
return mRecordSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::SectionHeader_V2::setRecordSize(uint32_t size)
|
void nn::es::SectionHeader_V2::setRecordSize(uint32_t size)
|
||||||
{
|
{
|
||||||
mRecordSize = size;
|
mRecordSize = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t es::SectionHeader_V2::getSectionSize() const
|
uint32_t nn::es::SectionHeader_V2::getSectionSize() const
|
||||||
{
|
{
|
||||||
return mSectionSize;
|
return mSectionSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::SectionHeader_V2::getSectionSize(uint32_t size)
|
void nn::es::SectionHeader_V2::getSectionSize(uint32_t size)
|
||||||
{
|
{
|
||||||
mSectionSize = size;
|
mSectionSize = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t es::SectionHeader_V2::getRecordNum() const
|
uint16_t nn::es::SectionHeader_V2::getRecordNum() const
|
||||||
{
|
{
|
||||||
return mRecordNum;
|
return mRecordNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::SectionHeader_V2::setRecordNum(uint16_t record_num)
|
void nn::es::SectionHeader_V2::setRecordNum(uint16_t record_num)
|
||||||
{
|
{
|
||||||
mRecordNum = record_num;
|
mRecordNum = record_num;
|
||||||
}
|
}
|
||||||
|
|
||||||
es::ticket::SectionType es::SectionHeader_V2::getSectionType() const
|
nn::es::ticket::SectionType nn::es::SectionHeader_V2::getSectionType() const
|
||||||
{
|
{
|
||||||
return mSectionType;
|
return mSectionType;
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::SectionHeader_V2::setSectionType(ticket::SectionType type)
|
void nn::es::SectionHeader_V2::setSectionType(ticket::SectionType type)
|
||||||
{
|
{
|
||||||
mSectionType = type;
|
mSectionType = type;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,16 @@
|
||||||
#include <es/TicketBody_V2.h>
|
#include <nn/es/TicketBody_V2.h>
|
||||||
|
|
||||||
|
nn::es::TicketBody_V2::TicketBody_V2()
|
||||||
|
|
||||||
es::TicketBody_V2::TicketBody_V2()
|
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
es::TicketBody_V2::TicketBody_V2(const TicketBody_V2 & other)
|
nn::es::TicketBody_V2::TicketBody_V2(const TicketBody_V2 & other)
|
||||||
{
|
{
|
||||||
*this = other;
|
*this = other;
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::TicketBody_V2::operator=(const TicketBody_V2 & other)
|
void nn::es::TicketBody_V2::operator=(const TicketBody_V2 & other)
|
||||||
{
|
{
|
||||||
if (other.getBytes().size())
|
if (other.getBytes().size())
|
||||||
{
|
{
|
||||||
|
@ -40,7 +38,7 @@ void es::TicketBody_V2::operator=(const TicketBody_V2 & other)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool es::TicketBody_V2::operator==(const TicketBody_V2 & other) const
|
bool nn::es::TicketBody_V2::operator==(const TicketBody_V2 & other) const
|
||||||
{
|
{
|
||||||
return (mIssuer == other.mIssuer) \
|
return (mIssuer == other.mIssuer) \
|
||||||
&& (memcmp(mEncTitleKey, other.mEncTitleKey, ticket::kEncTitleKeySize) == 0) \
|
&& (memcmp(mEncTitleKey, other.mEncTitleKey, ticket::kEncTitleKeySize) == 0) \
|
||||||
|
@ -59,12 +57,12 @@ bool es::TicketBody_V2::operator==(const TicketBody_V2 & other) const
|
||||||
&& (mSectEntrySize == other.mSectEntrySize);
|
&& (mSectEntrySize == other.mSectEntrySize);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool es::TicketBody_V2::operator!=(const TicketBody_V2 & other) const
|
bool nn::es::TicketBody_V2::operator!=(const TicketBody_V2 & other) const
|
||||||
{
|
{
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::TicketBody_V2::toBytes()
|
void nn::es::TicketBody_V2::toBytes()
|
||||||
{
|
{
|
||||||
mRawBinary.alloc(sizeof(sTicketBody_v2));
|
mRawBinary.alloc(sizeof(sTicketBody_v2));
|
||||||
sTicketBody_v2* body = (sTicketBody_v2*)mRawBinary.data();
|
sTicketBody_v2* body = (sTicketBody_v2*)mRawBinary.data();
|
||||||
|
@ -94,7 +92,7 @@ void es::TicketBody_V2::toBytes()
|
||||||
body->sect_entry_size = (mSectEntrySize);
|
body->sect_entry_size = (mSectEntrySize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::TicketBody_V2::fromBytes(const byte_t * bytes, size_t len)
|
void nn::es::TicketBody_V2::fromBytes(const byte_t * bytes, size_t len)
|
||||||
{
|
{
|
||||||
if (len < sizeof(sTicketBody_v2))
|
if (len < sizeof(sTicketBody_v2))
|
||||||
{
|
{
|
||||||
|
@ -134,12 +132,12 @@ void es::TicketBody_V2::fromBytes(const byte_t * bytes, size_t len)
|
||||||
mSectEntrySize = body->sect_entry_size.get();
|
mSectEntrySize = body->sect_entry_size.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::Vec<byte_t>& es::TicketBody_V2::getBytes() const
|
const fnd::Vec<byte_t>& nn::es::TicketBody_V2::getBytes() const
|
||||||
{
|
{
|
||||||
return mRawBinary;
|
return mRawBinary;
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::TicketBody_V2::clear()
|
void nn::es::TicketBody_V2::clear()
|
||||||
{
|
{
|
||||||
mRawBinary.clear();
|
mRawBinary.clear();
|
||||||
mIssuer.clear();
|
mIssuer.clear();
|
||||||
|
@ -160,12 +158,12 @@ void es::TicketBody_V2::clear()
|
||||||
mSectEntrySize = 0;
|
mSectEntrySize = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string & es::TicketBody_V2::getIssuer() const
|
const std::string & nn::es::TicketBody_V2::getIssuer() const
|
||||||
{
|
{
|
||||||
return mIssuer;
|
return mIssuer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::TicketBody_V2::setIssuer(const std::string & issuer)
|
void nn::es::TicketBody_V2::setIssuer(const std::string & issuer)
|
||||||
{
|
{
|
||||||
if (issuer.length() > ticket::kIssuerSize)
|
if (issuer.length() > ticket::kIssuerSize)
|
||||||
{
|
{
|
||||||
|
@ -175,154 +173,154 @@ void es::TicketBody_V2::setIssuer(const std::string & issuer)
|
||||||
mIssuer = issuer;
|
mIssuer = issuer;
|
||||||
}
|
}
|
||||||
|
|
||||||
const byte_t * es::TicketBody_V2::getEncTitleKey() const
|
const byte_t * nn::es::TicketBody_V2::getEncTitleKey() const
|
||||||
{
|
{
|
||||||
return mEncTitleKey;
|
return mEncTitleKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::TicketBody_V2::setEncTitleKey(const byte_t * data, size_t len)
|
void nn::es::TicketBody_V2::setEncTitleKey(const byte_t * data, size_t len)
|
||||||
{
|
{
|
||||||
memset(mEncTitleKey, 0, ticket::kEncTitleKeySize);
|
memset(mEncTitleKey, 0, ticket::kEncTitleKeySize);
|
||||||
memcpy(mEncTitleKey, data, _MIN(len, ticket::kEncTitleKeySize));
|
memcpy(mEncTitleKey, data, _MIN(len, ticket::kEncTitleKeySize));
|
||||||
}
|
}
|
||||||
|
|
||||||
es::ticket::TitleKeyEncType es::TicketBody_V2::getTitleKeyEncType() const
|
nn::es::ticket::TitleKeyEncType nn::es::TicketBody_V2::getTitleKeyEncType() const
|
||||||
{
|
{
|
||||||
return mEncType;
|
return mEncType;
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::TicketBody_V2::setTitleKeyEncType(ticket::TitleKeyEncType type)
|
void nn::es::TicketBody_V2::setTitleKeyEncType(ticket::TitleKeyEncType type)
|
||||||
{
|
{
|
||||||
mEncType = type;
|
mEncType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t es::TicketBody_V2::getTicketVersion() const
|
uint16_t nn::es::TicketBody_V2::getTicketVersion() const
|
||||||
{
|
{
|
||||||
return mTicketVersion;
|
return mTicketVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::TicketBody_V2::setTicketVersion(uint16_t version)
|
void nn::es::TicketBody_V2::setTicketVersion(uint16_t version)
|
||||||
{
|
{
|
||||||
mTicketVersion = version;
|
mTicketVersion = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
es::ticket::LicenseType es::TicketBody_V2::getLicenseType() const
|
nn::es::ticket::LicenseType nn::es::TicketBody_V2::getLicenseType() const
|
||||||
{
|
{
|
||||||
return mLicenseType;
|
return mLicenseType;
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::TicketBody_V2::setLicenseType(ticket::LicenseType type)
|
void nn::es::TicketBody_V2::setLicenseType(ticket::LicenseType type)
|
||||||
{
|
{
|
||||||
mLicenseType = type;
|
mLicenseType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte_t es::TicketBody_V2::getCommonKeyId() const
|
byte_t nn::es::TicketBody_V2::getCommonKeyId() const
|
||||||
{
|
{
|
||||||
return mCommonKeyId;
|
return mCommonKeyId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::TicketBody_V2::setCommonKeyId(byte_t id)
|
void nn::es::TicketBody_V2::setCommonKeyId(byte_t id)
|
||||||
{
|
{
|
||||||
mCommonKeyId = id;
|
mCommonKeyId = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::List<es::ticket::PropertyMaskFlags>& es::TicketBody_V2::getPropertyFlags() const
|
const fnd::List<nn::es::ticket::PropertyMaskFlags>& nn::es::TicketBody_V2::getPropertyFlags() const
|
||||||
{
|
{
|
||||||
return mPropertyFlags;
|
return mPropertyFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::TicketBody_V2::setPropertyFlags(const fnd::List<es::ticket::PropertyMaskFlags>& flags)
|
void nn::es::TicketBody_V2::setPropertyFlags(const fnd::List<nn::es::ticket::PropertyMaskFlags>& flags)
|
||||||
{
|
{
|
||||||
mPropertyFlags = flags;
|
mPropertyFlags = flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
const byte_t * es::TicketBody_V2::getReservedRegion() const
|
const byte_t * nn::es::TicketBody_V2::getReservedRegion() const
|
||||||
{
|
{
|
||||||
return mReservedRegion;
|
return mReservedRegion;
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::TicketBody_V2::setReservedRegion(const byte_t * data, size_t len)
|
void nn::es::TicketBody_V2::setReservedRegion(const byte_t * data, size_t len)
|
||||||
{
|
{
|
||||||
memset(mReservedRegion, 0, ticket::kReservedRegionSize);
|
memset(mReservedRegion, 0, ticket::kReservedRegionSize);
|
||||||
memcpy(mReservedRegion, data, _MIN(len, ticket::kReservedRegionSize));
|
memcpy(mReservedRegion, data, _MIN(len, ticket::kReservedRegionSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t es::TicketBody_V2::getTicketId() const
|
uint64_t nn::es::TicketBody_V2::getTicketId() const
|
||||||
{
|
{
|
||||||
return mTicketId;
|
return mTicketId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::TicketBody_V2::setTicketId(uint64_t id)
|
void nn::es::TicketBody_V2::setTicketId(uint64_t id)
|
||||||
{
|
{
|
||||||
mTicketId = id;
|
mTicketId = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t es::TicketBody_V2::getDeviceId() const
|
uint64_t nn::es::TicketBody_V2::getDeviceId() const
|
||||||
{
|
{
|
||||||
return mDeviceId;
|
return mDeviceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::TicketBody_V2::setDeviceId(uint64_t id)
|
void nn::es::TicketBody_V2::setDeviceId(uint64_t id)
|
||||||
{
|
{
|
||||||
mDeviceId = id;
|
mDeviceId = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
const byte_t * es::TicketBody_V2::getRightsId() const
|
const byte_t * nn::es::TicketBody_V2::getRightsId() const
|
||||||
{
|
{
|
||||||
return mRightsId;
|
return mRightsId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::TicketBody_V2::setRightsId(const byte_t * id)
|
void nn::es::TicketBody_V2::setRightsId(const byte_t * id)
|
||||||
{
|
{
|
||||||
memcpy(mRightsId, id, ticket::kRightsIdSize);
|
memcpy(mRightsId, id, ticket::kRightsIdSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t es::TicketBody_V2::getAccountId() const
|
uint32_t nn::es::TicketBody_V2::getAccountId() const
|
||||||
{
|
{
|
||||||
return mAccountId;
|
return mAccountId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::TicketBody_V2::setAccountId(uint32_t id)
|
void nn::es::TicketBody_V2::setAccountId(uint32_t id)
|
||||||
{
|
{
|
||||||
mAccountId = id;
|
mAccountId = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t es::TicketBody_V2::getSectionTotalSize() const
|
uint32_t nn::es::TicketBody_V2::getSectionTotalSize() const
|
||||||
{
|
{
|
||||||
return mSectTotalSize;
|
return mSectTotalSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::TicketBody_V2::setSectionTotalSize(uint32_t size)
|
void nn::es::TicketBody_V2::setSectionTotalSize(uint32_t size)
|
||||||
{
|
{
|
||||||
mSectTotalSize = size;
|
mSectTotalSize = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t es::TicketBody_V2::getSectionHeaderOffset() const
|
uint32_t nn::es::TicketBody_V2::getSectionHeaderOffset() const
|
||||||
{
|
{
|
||||||
return mSectHeaderOffset;
|
return mSectHeaderOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::TicketBody_V2::setSectionHeaderOffset(uint32_t offset)
|
void nn::es::TicketBody_V2::setSectionHeaderOffset(uint32_t offset)
|
||||||
{
|
{
|
||||||
mSectHeaderOffset = offset;
|
mSectHeaderOffset = offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t es::TicketBody_V2::getSectionNum() const
|
uint16_t nn::es::TicketBody_V2::getSectionNum() const
|
||||||
{
|
{
|
||||||
return mSectNum;
|
return mSectNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::TicketBody_V2::setSectionNum(uint16_t num)
|
void nn::es::TicketBody_V2::setSectionNum(uint16_t num)
|
||||||
{
|
{
|
||||||
mSectNum = num;
|
mSectNum = num;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t es::TicketBody_V2::getSectionEntrySize() const
|
uint16_t nn::es::TicketBody_V2::getSectionEntrySize() const
|
||||||
{
|
{
|
||||||
return mSectEntrySize;
|
return mSectEntrySize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::TicketBody_V2::setSectionEntrySize(uint16_t size)
|
void nn::es::TicketBody_V2::setSectionEntrySize(uint16_t size)
|
||||||
{
|
{
|
||||||
mSectEntrySize = size;
|
mSectEntrySize = size;
|
||||||
}
|
}
|
|
@ -2,7 +2,7 @@
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
namespace crypto
|
namespace fnd
|
||||||
{
|
{
|
||||||
namespace aes
|
namespace aes
|
||||||
{
|
{
|
|
@ -2,7 +2,7 @@
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
namespace crypto
|
namespace fnd
|
||||||
{
|
{
|
||||||
namespace base64
|
namespace base64
|
||||||
{
|
{
|
|
@ -2,7 +2,7 @@
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
namespace crypto
|
namespace fnd
|
||||||
{
|
{
|
||||||
namespace ecdsa
|
namespace ecdsa
|
||||||
{
|
{
|
|
@ -1,7 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace compress
|
namespace fnd
|
||||||
{
|
{
|
||||||
namespace lz4
|
namespace lz4
|
||||||
{
|
{
|
|
@ -1,9 +1,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <crypto/sha.h>
|
#include <fnd/sha.h>
|
||||||
|
|
||||||
namespace crypto
|
namespace fnd
|
||||||
{
|
{
|
||||||
namespace rsa
|
namespace rsa
|
||||||
{
|
{
|
|
@ -2,7 +2,7 @@
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
namespace crypto
|
namespace fnd
|
||||||
{
|
{
|
||||||
namespace sha
|
namespace sha
|
||||||
{
|
{
|
|
@ -21,9 +21,7 @@
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<VCProjectVersion>15.0</VCProjectVersion>
|
<VCProjectVersion>15.0</VCProjectVersion>
|
||||||
<ProjectGuid>{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}</ProjectGuid>
|
<ProjectGuid>{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}</ProjectGuid>
|
||||||
<RootNamespace>fnd</RootNamespace>
|
|
||||||
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
|
||||||
<ProjectName>libfnd</ProjectName>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
@ -76,7 +74,7 @@
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>..\libfnd\include;</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\libfnd\include;..\libpolarssl\include;..\liblz4\include;</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
|
@ -85,7 +83,7 @@
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>..\libfnd\include;</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\libfnd\include;..\libpolarssl\include;..\liblz4\include;</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
|
@ -96,7 +94,7 @@
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>..\libfnd\include;</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\libfnd\include;..\libpolarssl\include;..\liblz4\include;</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
|
@ -111,7 +109,7 @@
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>..\libfnd\include;</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\libfnd\include;..\libpolarssl\include;..\liblz4\include;</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
|
@ -123,7 +121,10 @@
|
||||||
<None Include="makefile" />
|
<None Include="makefile" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClInclude Include="include\fnd\aes.h" />
|
||||||
|
<ClInclude Include="include\fnd\base64.h" />
|
||||||
<ClInclude Include="include\fnd\BitMath.h" />
|
<ClInclude Include="include\fnd\BitMath.h" />
|
||||||
|
<ClInclude Include="include\fnd\ecdsa.h" />
|
||||||
<ClInclude Include="include\fnd\elf.h" />
|
<ClInclude Include="include\fnd\elf.h" />
|
||||||
<ClInclude Include="include\fnd\Endian.h" />
|
<ClInclude Include="include\fnd\Endian.h" />
|
||||||
<ClInclude Include="include\fnd\Exception.h" />
|
<ClInclude Include="include\fnd\Exception.h" />
|
||||||
|
@ -131,7 +132,10 @@
|
||||||
<ClInclude Include="include\fnd\io.h" />
|
<ClInclude Include="include\fnd\io.h" />
|
||||||
<ClInclude Include="include\fnd\ISerialisable.h" />
|
<ClInclude Include="include\fnd\ISerialisable.h" />
|
||||||
<ClInclude Include="include\fnd\List.h" />
|
<ClInclude Include="include\fnd\List.h" />
|
||||||
|
<ClInclude Include="include\fnd\lz4.h" />
|
||||||
<ClInclude Include="include\fnd\ResourceFileReader.h" />
|
<ClInclude Include="include\fnd\ResourceFileReader.h" />
|
||||||
|
<ClInclude Include="include\fnd\rsa.h" />
|
||||||
|
<ClInclude Include="include\fnd\sha.h" />
|
||||||
<ClInclude Include="include\fnd\SimpleFile.h" />
|
<ClInclude Include="include\fnd\SimpleFile.h" />
|
||||||
<ClInclude Include="include\fnd\SimpleTextOutput.h" />
|
<ClInclude Include="include\fnd\SimpleTextOutput.h" />
|
||||||
<ClInclude Include="include\fnd\StringConv.h" />
|
<ClInclude Include="include\fnd\StringConv.h" />
|
||||||
|
@ -139,9 +143,14 @@
|
||||||
<ClInclude Include="include\fnd\Vec.h" />
|
<ClInclude Include="include\fnd\Vec.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClCompile Include="source\aes_wrapper.cpp" />
|
||||||
|
<ClCompile Include="source\base64_wrapper.cpp" />
|
||||||
<ClCompile Include="source\Exception.cpp" />
|
<ClCompile Include="source\Exception.cpp" />
|
||||||
<ClCompile Include="source\io.cpp" />
|
<ClCompile Include="source\io.cpp" />
|
||||||
|
<ClCompile Include="source\lz4_wrapper.cpp" />
|
||||||
<ClCompile Include="source\ResourceFileReader.cpp" />
|
<ClCompile Include="source\ResourceFileReader.cpp" />
|
||||||
|
<ClCompile Include="source\rsa_wrapper.cpp" />
|
||||||
|
<ClCompile Include="source\sha_wrapper.cpp" />
|
||||||
<ClCompile Include="source\SimpleFile.cpp" />
|
<ClCompile Include="source\SimpleFile.cpp" />
|
||||||
<ClCompile Include="source\SimpleTextOutput.cpp" />
|
<ClCompile Include="source\SimpleTextOutput.cpp" />
|
||||||
<ClCompile Include="source\StringConv.cpp" />
|
<ClCompile Include="source\StringConv.cpp" />
|
|
@ -18,9 +18,18 @@
|
||||||
<None Include="makefile" />
|
<None Include="makefile" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClInclude Include="include\fnd\aes.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="include\fnd\base64.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="include\fnd\BitMath.h">
|
<ClInclude Include="include\fnd\BitMath.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="include\fnd\ecdsa.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="include\fnd\elf.h">
|
<ClInclude Include="include\fnd\elf.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
@ -42,9 +51,18 @@
|
||||||
<ClInclude Include="include\fnd\List.h">
|
<ClInclude Include="include\fnd\List.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="include\fnd\lz4.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="include\fnd\ResourceFileReader.h">
|
<ClInclude Include="include\fnd\ResourceFileReader.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="include\fnd\rsa.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="include\fnd\sha.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="include\fnd\SimpleFile.h">
|
<ClInclude Include="include\fnd\SimpleFile.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
@ -62,15 +80,30 @@
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClCompile Include="source\aes_wrapper.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="source\base64_wrapper.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="source\Exception.cpp">
|
<ClCompile Include="source\Exception.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\io.cpp">
|
<ClCompile Include="source\io.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="source\lz4_wrapper.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="source\ResourceFileReader.cpp">
|
<ClCompile Include="source\ResourceFileReader.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="source\rsa_wrapper.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="source\sha_wrapper.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="source\SimpleFile.cpp">
|
<ClCompile Include="source\SimpleFile.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
|
@ -3,11 +3,10 @@ SRC_DIR = source
|
||||||
OBJS = $(foreach dir,$(SRC_DIR),$(subst .cpp,.o,$(wildcard $(dir)/*.cpp))) $(foreach dir,$(SRC_DIR),$(subst .c,.o,$(wildcard $(dir)/*.c)))
|
OBJS = $(foreach dir,$(SRC_DIR),$(subst .cpp,.o,$(wildcard $(dir)/*.cpp))) $(foreach dir,$(SRC_DIR),$(subst .c,.o,$(wildcard $(dir)/*.c)))
|
||||||
|
|
||||||
# External dependencies
|
# External dependencies
|
||||||
DEPENDS =
|
DEPENDS = polarssl lz4
|
||||||
LIB_DIR = ..
|
LIB_DIR = ..
|
||||||
INCS = -I"include" $(foreach dep,$(DEPENDS), -I"$(LIB_DIR)/lib$(dep)/include")
|
INCS = -I"include" $(foreach dep,$(DEPENDS), -I"$(LIB_DIR)/lib$(dep)/include")
|
||||||
|
|
||||||
|
|
||||||
# Compiler Settings
|
# Compiler Settings
|
||||||
CXXFLAGS = -std=c++11 $(INCS) -D__STDC_FORMAT_MACROS -Wall -Wno-unused-value
|
CXXFLAGS = -std=c++11 $(INCS) -D__STDC_FORMAT_MACROS -Wall -Wno-unused-value
|
||||||
CFLAGS = -std=c11 $(INCS) -Wall -Wno-unused-value
|
CFLAGS = -std=c11 $(INCS) -Wall -Wno-unused-value
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <crypto/aes.h>
|
#include <fnd/aes.h>
|
||||||
#include <polarssl/aes.h>
|
#include <polarssl/aes.h>
|
||||||
|
|
||||||
using namespace crypto::aes;
|
using namespace fnd::aes;
|
||||||
|
|
||||||
inline void XorBlock(const uint8_t a[kAesBlockSize], const uint8_t b[kAesBlockSize], uint8_t out[kAesBlockSize])
|
inline void XorBlock(const uint8_t a[kAesBlockSize], const uint8_t b[kAesBlockSize], uint8_t out[kAesBlockSize])
|
||||||
{
|
{
|
||||||
|
@ -16,7 +16,7 @@ inline void putbe32(uint8_t* data, uint32_t val) { data[0] = val >> 24; data[1]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void crypto::aes::AesEcbDecrypt(const uint8_t * in, uint64_t size, const uint8_t key[kAes128KeySize], uint8_t * out)
|
void fnd::aes::AesEcbDecrypt(const uint8_t * in, uint64_t size, const uint8_t key[kAes128KeySize], uint8_t * out)
|
||||||
{
|
{
|
||||||
aes_context ctx;
|
aes_context ctx;
|
||||||
aes_setkey_dec(&ctx, key, 128);
|
aes_setkey_dec(&ctx, key, 128);
|
||||||
|
@ -28,7 +28,7 @@ void crypto::aes::AesEcbDecrypt(const uint8_t * in, uint64_t size, const uint8_t
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void crypto::aes::AesEcbEncrypt(const uint8_t * in, uint64_t size, const uint8_t key[kAes128KeySize], uint8_t * out)
|
void fnd::aes::AesEcbEncrypt(const uint8_t * in, uint64_t size, const uint8_t key[kAes128KeySize], uint8_t * out)
|
||||||
{
|
{
|
||||||
aes_context ctx;
|
aes_context ctx;
|
||||||
aes_setkey_enc(&ctx, key, 128);
|
aes_setkey_enc(&ctx, key, 128);
|
||||||
|
@ -38,7 +38,7 @@ void crypto::aes::AesEcbEncrypt(const uint8_t * in, uint64_t size, const uint8_t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void crypto::aes::AesCtr(const uint8_t* in, uint64_t size, const uint8_t key[kAes128KeySize], uint8_t ctr[kAesBlockSize], uint8_t* out)
|
void fnd::aes::AesCtr(const uint8_t* in, uint64_t size, const uint8_t key[kAes128KeySize], uint8_t ctr[kAesBlockSize], uint8_t* out)
|
||||||
{
|
{
|
||||||
aes_context ctx;
|
aes_context ctx;
|
||||||
uint8_t block[kAesBlockSize] = { 0 };
|
uint8_t block[kAesBlockSize] = { 0 };
|
||||||
|
@ -48,7 +48,7 @@ void crypto::aes::AesCtr(const uint8_t* in, uint64_t size, const uint8_t key[kAe
|
||||||
aes_crypt_ctr(&ctx, size, &counterOffset, ctr, block, in, out);
|
aes_crypt_ctr(&ctx, size, &counterOffset, ctr, block, in, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
void crypto::aes::AesIncrementCounter(const uint8_t in[kAesBlockSize], size_t block_num, uint8_t out[kAesBlockSize])
|
void fnd::aes::AesIncrementCounter(const uint8_t in[kAesBlockSize], size_t block_num, uint8_t out[kAesBlockSize])
|
||||||
{
|
{
|
||||||
memcpy(out, in, kAesBlockSize);
|
memcpy(out, in, kAesBlockSize);
|
||||||
|
|
||||||
|
@ -78,21 +78,21 @@ void crypto::aes::AesIncrementCounter(const uint8_t in[kAesBlockSize], size_t bl
|
||||||
putbe32(&out[12], ctr[0]);
|
putbe32(&out[12], ctr[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void crypto::aes::AesCbcDecrypt(const uint8_t* in, uint64_t size, const uint8_t key[kAes128KeySize], uint8_t iv[kAesBlockSize], uint8_t* out)
|
void fnd::aes::AesCbcDecrypt(const uint8_t* in, uint64_t size, const uint8_t key[kAes128KeySize], uint8_t iv[kAesBlockSize], uint8_t* out)
|
||||||
{
|
{
|
||||||
aes_context ctx;
|
aes_context ctx;
|
||||||
aes_setkey_dec(&ctx, key, 128);
|
aes_setkey_dec(&ctx, key, 128);
|
||||||
aes_crypt_cbc(&ctx, AES_DECRYPT, size, iv, in, out);
|
aes_crypt_cbc(&ctx, AES_DECRYPT, size, iv, in, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
void crypto::aes::AesCbcEncrypt(const uint8_t* in, uint64_t size, const uint8_t key[kAes128KeySize], uint8_t iv[kAesBlockSize], uint8_t* out)
|
void fnd::aes::AesCbcEncrypt(const uint8_t* in, uint64_t size, const uint8_t key[kAes128KeySize], uint8_t iv[kAesBlockSize], uint8_t* out)
|
||||||
{
|
{
|
||||||
aes_context ctx;
|
aes_context ctx;
|
||||||
aes_setkey_enc(&ctx, key, 128);
|
aes_setkey_enc(&ctx, key, 128);
|
||||||
aes_crypt_cbc(&ctx, AES_ENCRYPT, size, iv, in, out);
|
aes_crypt_cbc(&ctx, AES_ENCRYPT, size, iv, in, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
void crypto::aes::AesXtsDecryptSector(const uint8_t * in, uint64_t sector_size, const uint8_t key1[kAes128KeySize], const uint8_t key2[kAes128KeySize], uint8_t tweak[kAesBlockSize], uint8_t * out)
|
void fnd::aes::AesXtsDecryptSector(const uint8_t * in, uint64_t sector_size, const uint8_t key1[kAes128KeySize], const uint8_t key2[kAes128KeySize], uint8_t tweak[kAesBlockSize], uint8_t * out)
|
||||||
{
|
{
|
||||||
aes_context data_ctx;
|
aes_context data_ctx;
|
||||||
aes_setkey_dec(&data_ctx, key1, 128);
|
aes_setkey_dec(&data_ctx, key1, 128);
|
||||||
|
@ -116,7 +116,7 @@ void crypto::aes::AesXtsDecryptSector(const uint8_t * in, uint64_t sector_size,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void crypto::aes::AesXtsEncryptSector(const uint8_t * in, uint64_t sector_size, const uint8_t key1[kAes128KeySize], const uint8_t key2[kAes128KeySize], uint8_t tweak[kAesBlockSize], uint8_t * out)
|
void fnd::aes::AesXtsEncryptSector(const uint8_t * in, uint64_t sector_size, const uint8_t key1[kAes128KeySize], const uint8_t key2[kAes128KeySize], uint8_t tweak[kAesBlockSize], uint8_t * out)
|
||||||
{
|
{
|
||||||
aes_context data_ctx;
|
aes_context data_ctx;
|
||||||
aes_setkey_enc(&data_ctx, key1, 128);
|
aes_setkey_enc(&data_ctx, key1, 128);
|
||||||
|
@ -140,13 +140,13 @@ void crypto::aes::AesXtsEncryptSector(const uint8_t * in, uint64_t sector_size,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void crypto::aes::AesXtsMakeTweak(uint8_t tweak[kAesBlockSize], size_t block_index)
|
void fnd::aes::AesXtsMakeTweak(uint8_t tweak[kAesBlockSize], size_t block_index)
|
||||||
{
|
{
|
||||||
memset(tweak, 0, kAesBlockSize);
|
memset(tweak, 0, kAesBlockSize);
|
||||||
AesIncrementCounter(tweak, block_index, tweak);
|
AesIncrementCounter(tweak, block_index, tweak);
|
||||||
}
|
}
|
||||||
|
|
||||||
void crypto::aes::GaloisFunc(uint8_t x[kAesBlockSize])
|
void fnd::aes::GaloisFunc(uint8_t x[kAesBlockSize])
|
||||||
{
|
{
|
||||||
uint8_t t = x[15];
|
uint8_t t = x[15];
|
||||||
|
|
30
lib/libfnd/source/base64_wrapper.cpp
Normal file
30
lib/libfnd/source/base64_wrapper.cpp
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
#include <fnd/base64.h>
|
||||||
|
#include <polarssl/base64.h>
|
||||||
|
|
||||||
|
size_t fnd::base64::B64_GetEncodeLen(const uint8_t* src, size_t slen)
|
||||||
|
{
|
||||||
|
size_t dlen = 0;
|
||||||
|
|
||||||
|
base64_encode(nullptr, &dlen, src, slen);
|
||||||
|
|
||||||
|
return dlen;
|
||||||
|
}
|
||||||
|
|
||||||
|
void fnd::base64::B64_Encode(const uint8_t* src, size_t slen, uint8_t* dst, size_t dlen)
|
||||||
|
{
|
||||||
|
base64_encode(dst, &dlen, src, slen);
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t fnd::base64::B64_GetDecodeLen(const uint8_t* src, size_t slen)
|
||||||
|
{
|
||||||
|
size_t dlen = 0;
|
||||||
|
|
||||||
|
base64_decode(nullptr, &dlen, src, slen);
|
||||||
|
|
||||||
|
return dlen;
|
||||||
|
}
|
||||||
|
|
||||||
|
void fnd::base64::B64_Decode(const uint8_t* src, size_t slen, uint8_t* dst, size_t dlen)
|
||||||
|
{
|
||||||
|
base64_decode(dst, &dlen, src, slen);
|
||||||
|
}
|
14
lib/libfnd/source/lz4_wrapper.cpp
Normal file
14
lib/libfnd/source/lz4_wrapper.cpp
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
#include <fnd/lz4.h>
|
||||||
|
#include <lz4.h>
|
||||||
|
|
||||||
|
void fnd::lz4::compressData(const uint8_t* src, uint32_t src_len, uint8_t* dst, uint32_t dst_capacity, uint32_t& compressed_size)
|
||||||
|
{
|
||||||
|
compressed_size = LZ4_compress_default((const char*)src, (char*)dst, (int)src_len, (int)dst_capacity);
|
||||||
|
}
|
||||||
|
|
||||||
|
void fnd::lz4::decompressData(const uint8_t* src, uint32_t src_len, uint8_t* dst, uint32_t dst_capacity, uint32_t& decompressed_size)
|
||||||
|
{
|
||||||
|
decompressed_size = LZ4_decompress_safe((const char*)src, (char*)dst, (int)src_len, (int)dst_capacity);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#include <crypto/rsa.h>
|
#include <fnd/rsa.h>
|
||||||
#include <polarssl/rsa.h>
|
#include <polarssl/rsa.h>
|
||||||
#include <polarssl/md.h>
|
#include <polarssl/md.h>
|
||||||
|
|
||||||
using namespace crypto::rsa;
|
using namespace fnd::rsa;
|
||||||
using namespace crypto::sha;
|
using namespace fnd::sha;
|
||||||
|
|
||||||
int getWrappedHashType(HashType type)
|
int getWrappedHashType(HashType type)
|
||||||
{
|
{
|
||||||
|
@ -57,7 +57,7 @@ uint32_t getWrappedHashSize(HashType type)
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
int crypto::rsa::pkcs::rsaSign(const sRsa1024Key & key, HashType hash_type, const uint8_t * hash, uint8_t signature[kRsa1024Size])
|
int fnd::rsa::pkcs::rsaSign(const sRsa1024Key & key, HashType hash_type, const uint8_t * hash, uint8_t signature[kRsa1024Size])
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
rsa_context ctx;
|
rsa_context ctx;
|
||||||
|
@ -74,7 +74,7 @@ int crypto::rsa::pkcs::rsaSign(const sRsa1024Key & key, HashType hash_type, cons
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int crypto::rsa::pkcs::rsaVerify(const sRsa1024Key & key, HashType hash_type, const uint8_t * hash, const uint8_t signature[kRsa1024Size])
|
int fnd::rsa::pkcs::rsaVerify(const sRsa1024Key & key, HashType hash_type, const uint8_t * hash, const uint8_t signature[kRsa1024Size])
|
||||||
{
|
{
|
||||||
static const uint8_t public_exponent[3] = { 0x01, 0x00, 0x01 };
|
static const uint8_t public_exponent[3] = { 0x01, 0x00, 0x01 };
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ int crypto::rsa::pkcs::rsaVerify(const sRsa1024Key & key, HashType hash_type, co
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int crypto::rsa::pkcs::rsaSign(const sRsa2048Key & key, HashType hash_type, const uint8_t * hash, uint8_t signature[kRsa2048Size])
|
int fnd::rsa::pkcs::rsaSign(const sRsa2048Key & key, HashType hash_type, const uint8_t * hash, uint8_t signature[kRsa2048Size])
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
rsa_context ctx;
|
rsa_context ctx;
|
||||||
|
@ -110,7 +110,7 @@ int crypto::rsa::pkcs::rsaSign(const sRsa2048Key & key, HashType hash_type, cons
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int crypto::rsa::pkcs::rsaVerify(const sRsa2048Key & key, HashType hash_type, const uint8_t * hash, const uint8_t signature[kRsa2048Size])
|
int fnd::rsa::pkcs::rsaVerify(const sRsa2048Key & key, HashType hash_type, const uint8_t * hash, const uint8_t signature[kRsa2048Size])
|
||||||
{
|
{
|
||||||
static const uint8_t public_exponent[3] = { 0x01, 0x00, 0x01 };
|
static const uint8_t public_exponent[3] = { 0x01, 0x00, 0x01 };
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ int crypto::rsa::pkcs::rsaVerify(const sRsa2048Key & key, HashType hash_type, co
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int crypto::rsa::pkcs::rsaSign(const sRsa4096Key & key, HashType hash_type, const uint8_t * hash, uint8_t signature[kRsa4096Size])
|
int fnd::rsa::pkcs::rsaSign(const sRsa4096Key & key, HashType hash_type, const uint8_t * hash, uint8_t signature[kRsa4096Size])
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
rsa_context ctx;
|
rsa_context ctx;
|
||||||
|
@ -146,7 +146,7 @@ int crypto::rsa::pkcs::rsaSign(const sRsa4096Key & key, HashType hash_type, cons
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int crypto::rsa::pkcs::rsaVerify(const sRsa4096Key & key, HashType hash_type, const uint8_t * hash, const uint8_t signature[kRsa4096Size])
|
int fnd::rsa::pkcs::rsaVerify(const sRsa4096Key & key, HashType hash_type, const uint8_t * hash, const uint8_t signature[kRsa4096Size])
|
||||||
{
|
{
|
||||||
static const uint8_t public_exponent[3] = { 0x01, 0x00, 0x01 };
|
static const uint8_t public_exponent[3] = { 0x01, 0x00, 0x01 };
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ int crypto::rsa::pkcs::rsaVerify(const sRsa4096Key & key, HashType hash_type, co
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int crypto::rsa::pss::rsaVerify(const sRsa2048Key & key, HashType hash_type, const uint8_t * hash, const uint8_t signature[kRsa2048Size])
|
int fnd::rsa::pss::rsaVerify(const sRsa2048Key & key, HashType hash_type, const uint8_t * hash, const uint8_t signature[kRsa2048Size])
|
||||||
{
|
{
|
||||||
static const uint8_t public_exponent[3] = { 0x01, 0x00, 0x01 };
|
static const uint8_t public_exponent[3] = { 0x01, 0x00, 0x01 };
|
||||||
|
|
15
lib/libfnd/source/sha_wrapper.cpp
Normal file
15
lib/libfnd/source/sha_wrapper.cpp
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#include <fnd/sha.h>
|
||||||
|
#include <polarssl/sha1.h>
|
||||||
|
#include <polarssl/sha2.h>
|
||||||
|
|
||||||
|
using namespace fnd::sha;
|
||||||
|
|
||||||
|
void fnd::sha::Sha1(const uint8_t* in, uint64_t size, uint8_t hash[kSha1HashLen])
|
||||||
|
{
|
||||||
|
sha1(in, size, hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
void fnd::sha::Sha256(const uint8_t* in, uint64_t size, uint8_t hash[kSha256HashLen])
|
||||||
|
{
|
||||||
|
sha2(in, size, hash, false);
|
||||||
|
}
|
|
@ -1,9 +1,11 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <nx/aset.h>
|
#include <nn/hac/aset.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/ISerialisable.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
class AssetHeader :
|
class AssetHeader :
|
||||||
public fnd::ISerialisable
|
public fnd::ISerialisable
|
||||||
|
@ -66,5 +68,5 @@ namespace nx
|
||||||
sSection mNacpInfo;
|
sSection mNacpInfo;
|
||||||
sSection mRomfsInfo;
|
sSection mRomfsInfo;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,8 +1,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <nx/macro.h>
|
#include <nn/hac/macro.h>
|
||||||
namespace nx
|
|
||||||
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
namespace aset
|
namespace aset
|
||||||
{
|
{
|
||||||
|
@ -27,4 +29,5 @@ namespace nx
|
||||||
sAssetSection romfs;
|
sAssetSection romfs;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,11 +1,14 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#include <nn/hac/nro.h>
|
||||||
|
#include <nn/hac/macro.h>
|
||||||
|
|
||||||
#include <nx/nro.h>
|
namespace nn
|
||||||
#include <nx/macro.h>
|
{
|
||||||
namespace nx
|
namespace hac
|
||||||
{
|
{
|
||||||
namespace nro
|
namespace nro
|
||||||
{
|
{
|
||||||
static const uint64_t kNroHomebrewStructMagic = _MAKE_STRUCT_MAGIC_U64("HOMEBREW");
|
static const uint64_t kNroHomebrewStructMagic = _MAKE_STRUCT_MAGIC_U64("HOMEBREW");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -21,7 +21,6 @@
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<VCProjectVersion>15.0</VCProjectVersion>
|
<VCProjectVersion>15.0</VCProjectVersion>
|
||||||
<ProjectGuid>{738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}</ProjectGuid>
|
<ProjectGuid>{738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}</ProjectGuid>
|
||||||
<RootNamespace>libnxhb</RootNamespace>
|
|
||||||
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
@ -78,7 +77,7 @@
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<AdditionalIncludeDirectories>..\libfnd\include;..\libcrypto\include;..\libnx\include;..\libnx-hb\include;</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\libfnd\include;..\libhac\include;..\libhac-hb\include;</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
@ -91,7 +90,7 @@
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<AdditionalIncludeDirectories>..\libfnd\include;..\libcrypto\include;..\libnx\include;..\libnx-hb\include;</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\libfnd\include;..\libhac\include;..\libhac-hb\include;</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
@ -100,7 +99,7 @@
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<AdditionalIncludeDirectories>..\libfnd\include;..\libcrypto\include;..\libnx\include;..\libnx-hb\include;</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\libfnd\include;..\libhac\include;..\libhac-hb\include;</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
@ -111,7 +110,7 @@
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<AdditionalIncludeDirectories>..\libfnd\include;..\libcrypto\include;..\libnx\include;..\libnx-hb\include;</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\libfnd\include;..\libhac\include;..\libhac-hb\include;</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
@ -119,9 +118,9 @@
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="include\nx\aset.h" />
|
<ClInclude Include="include\nn\hac\aset.h" />
|
||||||
<ClInclude Include="include\nx\AssetHeader.h" />
|
<ClInclude Include="include\nn\hac\AssetHeader.h" />
|
||||||
<ClInclude Include="include\nx\nro-hb.h" />
|
<ClInclude Include="include\nn\hac\nro-hb.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="source\AssetHeader.cpp" />
|
<ClCompile Include="source\AssetHeader.cpp" />
|
|
@ -15,13 +15,13 @@
|
||||||
</Filter>
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="include\nx\aset.h">
|
<ClInclude Include="include\nn\hac\aset.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nx\AssetHeader.h">
|
<ClInclude Include="include\nn\hac\AssetHeader.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nx\nro-hb.h">
|
<ClInclude Include="include\nn\hac\nro-hb.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
|
@ -3,11 +3,10 @@ SRC_DIR = source
|
||||||
OBJS = $(foreach dir,$(SRC_DIR),$(subst .cpp,.o,$(wildcard $(dir)/*.cpp))) $(foreach dir,$(SRC_DIR),$(subst .c,.o,$(wildcard $(dir)/*.c)))
|
OBJS = $(foreach dir,$(SRC_DIR),$(subst .cpp,.o,$(wildcard $(dir)/*.cpp))) $(foreach dir,$(SRC_DIR),$(subst .c,.o,$(wildcard $(dir)/*.c)))
|
||||||
|
|
||||||
# External dependencies
|
# External dependencies
|
||||||
DEPENDS = fnd crypto nx
|
DEPENDS = fnd crypto hac
|
||||||
LIB_DIR = ..
|
LIB_DIR = ..
|
||||||
INCS = -I"include" $(foreach dep,$(DEPENDS), -I"$(LIB_DIR)/lib$(dep)/include")
|
INCS = -I"include" $(foreach dep,$(DEPENDS), -I"$(LIB_DIR)/lib$(dep)/include")
|
||||||
|
|
||||||
|
|
||||||
# Compiler Settings
|
# Compiler Settings
|
||||||
CXXFLAGS = -std=c++11 $(INCS) -D__STDC_FORMAT_MACROS -Wall -Wno-unused-value
|
CXXFLAGS = -std=c++11 $(INCS) -D__STDC_FORMAT_MACROS -Wall -Wno-unused-value
|
||||||
CFLAGS = -std=c11 $(INCS) -Wall -Wno-unused-value
|
CFLAGS = -std=c11 $(INCS) -Wall -Wno-unused-value
|
|
@ -1,16 +1,17 @@
|
||||||
#include <nx/AssetHeader.h>
|
#include <cstring>
|
||||||
|
#include <nn/hac/AssetHeader.h>
|
||||||
|
|
||||||
nx::AssetHeader::AssetHeader()
|
nn::hac::AssetHeader::AssetHeader()
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
nx::AssetHeader::AssetHeader(const AssetHeader& other)
|
nn::hac::AssetHeader::AssetHeader(const AssetHeader& other)
|
||||||
{
|
{
|
||||||
*this = other;
|
*this = other;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::AssetHeader::operator=(const AssetHeader& other)
|
void nn::hac::AssetHeader::operator=(const AssetHeader& other)
|
||||||
{
|
{
|
||||||
mRawBinary = other.mRawBinary;
|
mRawBinary = other.mRawBinary;
|
||||||
mIconInfo = other.mIconInfo;
|
mIconInfo = other.mIconInfo;
|
||||||
|
@ -18,22 +19,22 @@ void nx::AssetHeader::operator=(const AssetHeader& other)
|
||||||
mRomfsInfo = other.mRomfsInfo;
|
mRomfsInfo = other.mRomfsInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nx::AssetHeader::operator==(const AssetHeader& other) const
|
bool nn::hac::AssetHeader::operator==(const AssetHeader& other) const
|
||||||
{
|
{
|
||||||
return (mIconInfo == other.mIconInfo) \
|
return (mIconInfo == other.mIconInfo) \
|
||||||
&& (mNacpInfo == other.mNacpInfo) \
|
&& (mNacpInfo == other.mNacpInfo) \
|
||||||
&& (mRomfsInfo == other.mRomfsInfo);
|
&& (mRomfsInfo == other.mRomfsInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nx::AssetHeader::operator!=(const AssetHeader& other) const
|
bool nn::hac::AssetHeader::operator!=(const AssetHeader& other) const
|
||||||
{
|
{
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::AssetHeader::toBytes()
|
void nn::hac::AssetHeader::toBytes()
|
||||||
{
|
{
|
||||||
mRawBinary.alloc(sizeof(sAssetHeader));
|
mRawBinary.alloc(sizeof(sAssetHeader));
|
||||||
nx::sAssetHeader* hdr = (nx::sAssetHeader*)mRawBinary.data();
|
nn::hac::sAssetHeader* hdr = (nn::hac::sAssetHeader*)mRawBinary.data();
|
||||||
|
|
||||||
// set header identifers
|
// set header identifers
|
||||||
hdr->st_magic = aset::kAssetStructMagic;
|
hdr->st_magic = aset::kAssetStructMagic;
|
||||||
|
@ -52,7 +53,7 @@ void nx::AssetHeader::toBytes()
|
||||||
hdr->romfs.size = mRomfsInfo.size;
|
hdr->romfs.size = mRomfsInfo.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::AssetHeader::fromBytes(const byte_t* bytes, size_t len)
|
void nn::hac::AssetHeader::fromBytes(const byte_t* bytes, size_t len)
|
||||||
{
|
{
|
||||||
// check input data size
|
// check input data size
|
||||||
if (len < sizeof(sAssetHeader))
|
if (len < sizeof(sAssetHeader))
|
||||||
|
@ -68,7 +69,7 @@ void nx::AssetHeader::fromBytes(const byte_t* bytes, size_t len)
|
||||||
memcpy(mRawBinary.data(), bytes, mRawBinary.size());
|
memcpy(mRawBinary.data(), bytes, mRawBinary.size());
|
||||||
|
|
||||||
// get sAssetHeader ptr
|
// get sAssetHeader ptr
|
||||||
const nx::sAssetHeader* hdr = (const nx::sAssetHeader*)mRawBinary.data();
|
const nn::hac::sAssetHeader* hdr = (const nn::hac::sAssetHeader*)mRawBinary.data();
|
||||||
|
|
||||||
// check NRO signature
|
// check NRO signature
|
||||||
if (hdr->st_magic.get() != aset::kAssetStructMagic)
|
if (hdr->st_magic.get() != aset::kAssetStructMagic)
|
||||||
|
@ -90,12 +91,12 @@ void nx::AssetHeader::fromBytes(const byte_t* bytes, size_t len)
|
||||||
mRomfsInfo.size = hdr->romfs.size.get();
|
mRomfsInfo.size = hdr->romfs.size.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::Vec<byte_t>& nx::AssetHeader::getBytes() const
|
const fnd::Vec<byte_t>& nn::hac::AssetHeader::getBytes() const
|
||||||
{
|
{
|
||||||
return mRawBinary;
|
return mRawBinary;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::AssetHeader::clear()
|
void nn::hac::AssetHeader::clear()
|
||||||
{
|
{
|
||||||
mRawBinary.clear();
|
mRawBinary.clear();
|
||||||
memset(&mIconInfo, 0, sizeof(mIconInfo));
|
memset(&mIconInfo, 0, sizeof(mIconInfo));
|
||||||
|
@ -103,32 +104,32 @@ void nx::AssetHeader::clear()
|
||||||
memset(&mRomfsInfo, 0, sizeof(mRomfsInfo));
|
memset(&mRomfsInfo, 0, sizeof(mRomfsInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
const nx::AssetHeader::sSection& nx::AssetHeader::getIconInfo() const
|
const nn::hac::AssetHeader::sSection& nn::hac::AssetHeader::getIconInfo() const
|
||||||
{
|
{
|
||||||
return mIconInfo;
|
return mIconInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::AssetHeader::setIconInfo(const nx::AssetHeader::sSection& info)
|
void nn::hac::AssetHeader::setIconInfo(const nn::hac::AssetHeader::sSection& info)
|
||||||
{
|
{
|
||||||
mIconInfo = info;
|
mIconInfo = info;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nx::AssetHeader::sSection& nx::AssetHeader::getNacpInfo() const
|
const nn::hac::AssetHeader::sSection& nn::hac::AssetHeader::getNacpInfo() const
|
||||||
{
|
{
|
||||||
return mNacpInfo;
|
return mNacpInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::AssetHeader::setNacpInfo(const sSection& info)
|
void nn::hac::AssetHeader::setNacpInfo(const sSection& info)
|
||||||
{
|
{
|
||||||
mNacpInfo = info;
|
mNacpInfo = info;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nx::AssetHeader::sSection& nx::AssetHeader::getRomfsInfo() const
|
const nn::hac::AssetHeader::sSection& nn::hac::AssetHeader::getRomfsInfo() const
|
||||||
{
|
{
|
||||||
return mRomfsInfo;
|
return mRomfsInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::AssetHeader::setRomfsInfo(const sSection& info)
|
void nn::hac::AssetHeader::setRomfsInfo(const sSection& info)
|
||||||
{
|
{
|
||||||
mRomfsInfo = info;
|
mRomfsInfo = info;
|
||||||
}
|
}
|
|
@ -2,12 +2,14 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/ISerialisable.h>
|
||||||
#include <nx/aci.h>
|
#include <nn/hac/aci.h>
|
||||||
#include <nx/FileSystemAccessControlBinary.h>
|
#include <nn/hac/FileSystemAccessControlBinary.h>
|
||||||
#include <nx/ServiceAccessControlBinary.h>
|
#include <nn/hac/ServiceAccessControlBinary.h>
|
||||||
#include <nx/KernelCapabilityBinary.h>
|
#include <nn/hac/KernelCapabilityBinary.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
class AccessControlInfoBinary : public fnd::ISerialisable
|
class AccessControlInfoBinary : public fnd::ISerialisable
|
||||||
{
|
{
|
||||||
|
@ -30,13 +32,13 @@ namespace nx
|
||||||
uint64_t getProgramId() const;
|
uint64_t getProgramId() const;
|
||||||
void setProgramId(uint64_t program_id);
|
void setProgramId(uint64_t program_id);
|
||||||
|
|
||||||
const nx::FileSystemAccessControlBinary& getFileSystemAccessControl() const;
|
const nn::hac::FileSystemAccessControlBinary& getFileSystemAccessControl() const;
|
||||||
void setFileSystemAccessControl(const FileSystemAccessControlBinary& fac);
|
void setFileSystemAccessControl(const FileSystemAccessControlBinary& fac);
|
||||||
|
|
||||||
const nx::ServiceAccessControlBinary& getServiceAccessControl() const;
|
const nn::hac::ServiceAccessControlBinary& getServiceAccessControl() const;
|
||||||
void setServiceAccessControl(const ServiceAccessControlBinary& sac);
|
void setServiceAccessControl(const ServiceAccessControlBinary& sac);
|
||||||
|
|
||||||
const nx::KernelCapabilityBinary& getKernelCapabilities() const;
|
const nn::hac::KernelCapabilityBinary& getKernelCapabilities() const;
|
||||||
void setKernelCapabilities(const KernelCapabilityBinary& kc);
|
void setKernelCapabilities(const KernelCapabilityBinary& kc);
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "ACCESS_CONTROL_INFO_BINARY";
|
const std::string kModuleName = "ACCESS_CONTROL_INFO_BINARY";
|
||||||
|
@ -46,8 +48,9 @@ namespace nx
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
uint64_t mProgramId;
|
uint64_t mProgramId;
|
||||||
nx::FileSystemAccessControlBinary mFileSystemAccessControl;
|
nn::hac::FileSystemAccessControlBinary mFileSystemAccessControl;
|
||||||
nx::ServiceAccessControlBinary mServiceAccessControl;
|
nn::hac::ServiceAccessControlBinary mServiceAccessControl;
|
||||||
nx::KernelCapabilityBinary mKernelCapabilities;
|
nn::hac::KernelCapabilityBinary mKernelCapabilities;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -3,12 +3,14 @@
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/ISerialisable.h>
|
||||||
#include <nx/aci.h>
|
#include <nn/hac/aci.h>
|
||||||
#include <nx/FileSystemAccessControlBinary.h>
|
#include <nn/hac/FileSystemAccessControlBinary.h>
|
||||||
#include <nx/ServiceAccessControlBinary.h>
|
#include <nn/hac/ServiceAccessControlBinary.h>
|
||||||
#include <nx/KernelCapabilityBinary.h>
|
#include <nn/hac/KernelCapabilityBinary.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
class AccessControlInfoDescBinary : public fnd::ISerialisable
|
class AccessControlInfoDescBinary : public fnd::ISerialisable
|
||||||
{
|
{
|
||||||
|
@ -48,14 +50,14 @@ namespace nx
|
||||||
void fromBytes(const byte_t* data, size_t len);
|
void fromBytes(const byte_t* data, size_t len);
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
||||||
void generateSignature(const crypto::rsa::sRsa2048Key& key);
|
void generateSignature(const fnd::rsa::sRsa2048Key& key);
|
||||||
void validateSignature(const crypto::rsa::sRsa2048Key& key) const;
|
void validateSignature(const fnd::rsa::sRsa2048Key& key) const;
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
const crypto::rsa::sRsa2048Key& getNcaHeaderSignature2Key() const;
|
const fnd::rsa::sRsa2048Key& getNcaHeaderSignature2Key() const;
|
||||||
void setNcaHeaderSignature2Key(const crypto::rsa::sRsa2048Key& key);
|
void setNcaHeaderSignature2Key(const fnd::rsa::sRsa2048Key& key);
|
||||||
|
|
||||||
const fnd::List<aci::Flag>& getFlagList() const;
|
const fnd::List<aci::Flag>& getFlagList() const;
|
||||||
void setFlagList(const fnd::List<aci::Flag>& flags);
|
void setFlagList(const fnd::List<aci::Flag>& flags);
|
||||||
|
@ -63,13 +65,13 @@ namespace nx
|
||||||
const sProgramIdRestrict& getProgramIdRestrict() const;
|
const sProgramIdRestrict& getProgramIdRestrict() const;
|
||||||
void setProgramIdRestrict(const sProgramIdRestrict& pid_restrict);
|
void setProgramIdRestrict(const sProgramIdRestrict& pid_restrict);
|
||||||
|
|
||||||
const nx::FileSystemAccessControlBinary& getFileSystemAccessControl() const;
|
const nn::hac::FileSystemAccessControlBinary& getFileSystemAccessControl() const;
|
||||||
void setFileSystemAccessControl(const FileSystemAccessControlBinary& fac);
|
void setFileSystemAccessControl(const FileSystemAccessControlBinary& fac);
|
||||||
|
|
||||||
const nx::ServiceAccessControlBinary& getServiceAccessControl() const;
|
const nn::hac::ServiceAccessControlBinary& getServiceAccessControl() const;
|
||||||
void setServiceAccessControl(const ServiceAccessControlBinary& sac);
|
void setServiceAccessControl(const ServiceAccessControlBinary& sac);
|
||||||
|
|
||||||
const nx::KernelCapabilityBinary& getKernelCapabilities() const;
|
const nn::hac::KernelCapabilityBinary& getKernelCapabilities() const;
|
||||||
void setKernelCapabilities(const KernelCapabilityBinary& kc);
|
void setKernelCapabilities(const KernelCapabilityBinary& kc);
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "ACCESS_CONTROL_INFO_DESC_BINARY";
|
const std::string kModuleName = "ACCESS_CONTROL_INFO_DESC_BINARY";
|
||||||
|
@ -78,11 +80,12 @@ namespace nx
|
||||||
fnd::Vec<byte_t> mRawBinary;
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
crypto::rsa::sRsa2048Key mNcaHeaderSignature2Key;
|
fnd::rsa::sRsa2048Key mNcaHeaderSignature2Key;
|
||||||
fnd::List<aci::Flag> mFlags;
|
fnd::List<aci::Flag> mFlags;
|
||||||
sProgramIdRestrict mProgramIdRestrict;
|
sProgramIdRestrict mProgramIdRestrict;
|
||||||
nx::FileSystemAccessControlBinary mFileSystemAccessControl;
|
nn::hac::FileSystemAccessControlBinary mFileSystemAccessControl;
|
||||||
nx::ServiceAccessControlBinary mServiceAccessControl;
|
nn::hac::ServiceAccessControlBinary mServiceAccessControl;
|
||||||
nx::KernelCapabilityBinary mKernelCapabilities;
|
nn::hac::KernelCapabilityBinary mKernelCapabilities;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,9 +1,11 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <crypto/aes.h>
|
#include <fnd/aes.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
class AesKeygen
|
class AesKeygen
|
||||||
{
|
{
|
||||||
|
@ -16,4 +18,5 @@ namespace nx
|
||||||
// 3 stage key generation dst = ((src1_key.decrypt(src1)).decrypt(src2)).decrypt(src3)
|
// 3 stage key generation dst = ((src1_key.decrypt(src1)).decrypt(src2)).decrypt(src3)
|
||||||
static void generateKey(byte_t* dst, const byte_t* src1, const byte_t* src2, const byte_t* src3, const byte_t* src1_key);
|
static void generateKey(byte_t* dst, const byte_t* src1, const byte_t* src2, const byte_t* src3, const byte_t* src1_key);
|
||||||
};
|
};
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -3,9 +3,11 @@
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/ISerialisable.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
#include <nx/nacp.h>
|
#include <nn/hac/nacp.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
class ApplicationControlPropertyBinary :
|
class ApplicationControlPropertyBinary :
|
||||||
public fnd::ISerialisable
|
public fnd::ISerialisable
|
||||||
|
@ -229,7 +231,7 @@ namespace nx
|
||||||
nacp::TouchScreenUsageMode mTouchScreenUsageMode;
|
nacp::TouchScreenUsageMode mTouchScreenUsageMode;
|
||||||
nacp::AocRegistrationType mAocRegistrationType;
|
nacp::AocRegistrationType mAocRegistrationType;
|
||||||
nacp::AttributeFlag mAttributeFlag;
|
nacp::AttributeFlag mAttributeFlag;
|
||||||
fnd::List<nx::nacp::Language> mSupportedLanguages;
|
fnd::List<nn::hac::nacp::Language> mSupportedLanguages;
|
||||||
nacp::ParentalControlFlag mParentalControlFlag;
|
nacp::ParentalControlFlag mParentalControlFlag;
|
||||||
nacp::ScreenshotMode mScreenshotMode;
|
nacp::ScreenshotMode mScreenshotMode;
|
||||||
nacp::VideoCaptureMode mVideoCaptureMode;
|
nacp::VideoCaptureMode mVideoCaptureMode;
|
||||||
|
@ -263,4 +265,5 @@ namespace nx
|
||||||
nacp::RepairFlag mRepairFlag;
|
nacp::RepairFlag mRepairFlag;
|
||||||
byte_t mProgramIndex;
|
byte_t mProgramIndex;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <nx/nacp.h>
|
#include <nn/hac/nacp.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
class ApplicationControlPropertyUtils
|
class ApplicationControlPropertyUtils
|
||||||
{
|
{
|
||||||
|
@ -9,4 +11,5 @@ namespace nx
|
||||||
static bool validateSaveDataSizeMax(int64_t size, int64_t alignment);
|
static bool validateSaveDataSizeMax(int64_t size, int64_t alignment);
|
||||||
static bool validateSaveDataSize(int64_t size);
|
static bool validateSaveDataSize(int64_t size);
|
||||||
};
|
};
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,11 +1,13 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <cstring>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/ISerialisable.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
#include <nx/cnmt.h>
|
#include <nn/hac/cnmt.h>
|
||||||
|
|
||||||
|
namespace nn
|
||||||
namespace nx
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
class ContentMetaBinary :
|
class ContentMetaBinary :
|
||||||
public fnd::ISerialisable
|
public fnd::ISerialisable
|
||||||
|
@ -13,7 +15,7 @@ namespace nx
|
||||||
public:
|
public:
|
||||||
struct ContentInfo
|
struct ContentInfo
|
||||||
{
|
{
|
||||||
crypto::sha::sSha256Hash hash;
|
fnd::sha::sSha256Hash hash;
|
||||||
byte_t nca_id[cnmt::kContentIdLen];
|
byte_t nca_id[cnmt::kContentIdLen];
|
||||||
size_t size;
|
size_t size;
|
||||||
cnmt::ContentType type;
|
cnmt::ContentType type;
|
||||||
|
@ -200,17 +202,17 @@ namespace nx
|
||||||
const DeltaMetaExtendedHeader& getDeltaMetaExtendedHeader() const;
|
const DeltaMetaExtendedHeader& getDeltaMetaExtendedHeader() const;
|
||||||
void setDeltaMetaExtendedHeader(const DeltaMetaExtendedHeader& exhdr);
|
void setDeltaMetaExtendedHeader(const DeltaMetaExtendedHeader& exhdr);
|
||||||
|
|
||||||
const fnd::List<nx::ContentMetaBinary::ContentInfo>& getContentInfo() const;
|
const fnd::List<nn::hac::ContentMetaBinary::ContentInfo>& getContentInfo() const;
|
||||||
void setContentInfo(const fnd::List<nx::ContentMetaBinary::ContentInfo>& info);
|
void setContentInfo(const fnd::List<nn::hac::ContentMetaBinary::ContentInfo>& info);
|
||||||
|
|
||||||
const fnd::List<nx::ContentMetaBinary::ContentMetaInfo>& getContentMetaInfo() const;
|
const fnd::List<nn::hac::ContentMetaBinary::ContentMetaInfo>& getContentMetaInfo() const;
|
||||||
void setContentMetaInfo(const fnd::List<nx::ContentMetaBinary::ContentMetaInfo>& info);
|
void setContentMetaInfo(const fnd::List<nn::hac::ContentMetaBinary::ContentMetaInfo>& info);
|
||||||
|
|
||||||
const fnd::Vec<byte_t>& getExtendedData() const;
|
const fnd::Vec<byte_t>& getExtendedData() const;
|
||||||
void setExtendedData(const fnd::Vec<byte_t>& data);
|
void setExtendedData(const fnd::Vec<byte_t>& data);
|
||||||
|
|
||||||
const nx::sDigest& getDigest() const;
|
const nn::hac::sDigest& getDigest() const;
|
||||||
void setDigest(const nx::sDigest& digest);
|
void setDigest(const nn::hac::sDigest& digest);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -232,10 +234,10 @@ namespace nx
|
||||||
AddOnContentMetaExtendedHeader mAddOnContentMetaExtendedHeader;
|
AddOnContentMetaExtendedHeader mAddOnContentMetaExtendedHeader;
|
||||||
DeltaMetaExtendedHeader mDeltaMetaExtendedHeader;
|
DeltaMetaExtendedHeader mDeltaMetaExtendedHeader;
|
||||||
|
|
||||||
fnd::List<nx::ContentMetaBinary::ContentInfo> mContentInfo;
|
fnd::List<nn::hac::ContentMetaBinary::ContentInfo> mContentInfo;
|
||||||
fnd::List<nx::ContentMetaBinary::ContentMetaInfo> mContentMetaInfo;
|
fnd::List<nn::hac::ContentMetaBinary::ContentMetaInfo> mContentMetaInfo;
|
||||||
fnd::Vec<byte_t> mExtendedData;
|
fnd::Vec<byte_t> mExtendedData;
|
||||||
nx::sDigest mDigest;
|
nn::hac::sDigest mDigest;
|
||||||
|
|
||||||
inline size_t getExtendedHeaderOffset() const { return sizeof(sContentMetaHeader); }
|
inline size_t getExtendedHeaderOffset() const { return sizeof(sContentMetaHeader); }
|
||||||
inline size_t getContentInfoOffset(size_t exhdrSize) const { return getExtendedHeaderOffset() + exhdrSize; }
|
inline size_t getContentInfoOffset(size_t exhdrSize) const { return getExtendedHeaderOffset() + exhdrSize; }
|
||||||
|
@ -248,4 +250,5 @@ namespace nx
|
||||||
size_t getExtendedDataSize(cnmt::ContentMetaType type, const byte_t* data) const;
|
size_t getExtendedDataSize(cnmt::ContentMetaType type, const byte_t* data) const;
|
||||||
void validateBinary(const byte_t* bytes, size_t len) const;
|
void validateBinary(const byte_t* bytes, size_t len) const;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -3,17 +3,18 @@
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/ISerialisable.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
#include <nx/fac.h>
|
#include <nn/hac/fac.h>
|
||||||
|
|
||||||
|
namespace nn
|
||||||
namespace nx
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
class FileSystemAccessControlBinary : public fnd::ISerialisable
|
class FileSystemAccessControlBinary : public fnd::ISerialisable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct sSaveDataOwnerId
|
struct sSaveDataOwnerId
|
||||||
{
|
{
|
||||||
nx::fac::SaveDataOwnerIdAccessType access_type;
|
nn::hac::fac::SaveDataOwnerIdAccessType access_type;
|
||||||
uint64_t id;
|
uint64_t id;
|
||||||
|
|
||||||
void operator=(const sSaveDataOwnerId& other)
|
void operator=(const sSaveDataOwnerId& other)
|
||||||
|
@ -72,4 +73,5 @@ namespace nx
|
||||||
fnd::List<uint64_t> mContentOwnerIdList;
|
fnd::List<uint64_t> mContentOwnerIdList;
|
||||||
fnd::List<sSaveDataOwnerId> mSaveDataOwnerIdList;
|
fnd::List<sSaveDataOwnerId> mSaveDataOwnerIdList;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,9 +1,11 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <nx/KernelCapabilityEntry.h>
|
#include <nn/hac/KernelCapabilityEntry.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
class HandleTableSizeEntry
|
class HandleTableSizeEntry
|
||||||
{
|
{
|
||||||
|
@ -44,4 +46,5 @@ namespace nx
|
||||||
mHandleTableSize = field & kMaxHandleTableSize;
|
mHandleTableSize = field & kMaxHandleTableSize;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,8 +1,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <nx/IKernelCapabilityHandler.h>
|
#include <nn/hac/IKernelCapabilityHandler.h>
|
||||||
#include <nx/HandleTableSizeEntry.h>
|
#include <nn/hac/HandleTableSizeEntry.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
class HandleTableSizeHandler :
|
class HandleTableSizeHandler :
|
||||||
public IKernelCapabilityHandler
|
public IKernelCapabilityHandler
|
||||||
|
@ -32,4 +34,4 @@ namespace nx
|
||||||
HandleTableSizeEntry mEntry;
|
HandleTableSizeEntry mEntry;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -1,10 +1,12 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <nx/hierarchicalintegrity.h>
|
#include <nn/hac/hierarchicalintegrity.h>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/ISerialisable.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
#include <crypto/sha.h>
|
#include <fnd/sha.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
class HierarchicalIntegrityHeader :
|
class HierarchicalIntegrityHeader :
|
||||||
public fnd::ISerialisable
|
public fnd::ISerialisable
|
||||||
|
@ -52,8 +54,8 @@ namespace nx
|
||||||
const fnd::List<sLayer>& getLayerInfo() const;
|
const fnd::List<sLayer>& getLayerInfo() const;
|
||||||
void setLayerInfo(const fnd::List<sLayer>& layer_info);
|
void setLayerInfo(const fnd::List<sLayer>& layer_info);
|
||||||
|
|
||||||
const fnd::List<crypto::sha::sSha256Hash>& getMasterHashList() const;
|
const fnd::List<fnd::sha::sSha256Hash>& getMasterHashList() const;
|
||||||
void setMasterHashList(const fnd::List<crypto::sha::sSha256Hash>& master_hash_list);
|
void setMasterHashList(const fnd::List<fnd::sha::sSha256Hash>& master_hash_list);
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "HIERARCHICAL_INTEGRITY_HEADER";
|
const std::string kModuleName = "HIERARCHICAL_INTEGRITY_HEADER";
|
||||||
|
|
||||||
|
@ -62,7 +64,7 @@ namespace nx
|
||||||
|
|
||||||
// data
|
// data
|
||||||
fnd::List<sLayer> mLayerInfo;
|
fnd::List<sLayer> mLayerInfo;
|
||||||
fnd::List<crypto::sha::sSha256Hash> mMasterHashList;
|
fnd::List<fnd::sha::sSha256Hash> mMasterHashList;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,9 +1,11 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <nx/hierarchicalsha256.h>
|
#include <nn/hac/hierarchicalsha256.h>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/ISerialisable.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
class HierarchicalSha256Header :
|
class HierarchicalSha256Header :
|
||||||
public fnd::ISerialisable
|
public fnd::ISerialisable
|
||||||
|
@ -46,8 +48,8 @@ namespace nx
|
||||||
// variables
|
// variables
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
const crypto::sha::sSha256Hash& getMasterHash() const;
|
const fnd::sha::sSha256Hash& getMasterHash() const;
|
||||||
void setMasterHash(const crypto::sha::sSha256Hash& master_hash);
|
void setMasterHash(const fnd::sha::sSha256Hash& master_hash);
|
||||||
|
|
||||||
size_t getHashBlockSize() const;
|
size_t getHashBlockSize() const;
|
||||||
void setHashBlockSize(size_t hash_block_size);
|
void setHashBlockSize(size_t hash_block_size);
|
||||||
|
@ -61,9 +63,9 @@ namespace nx
|
||||||
fnd::Vec<byte_t> mRawBinary;
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
|
||||||
// data
|
// data
|
||||||
crypto::sha::sSha256Hash mMasterHash;
|
fnd::sha::sSha256Hash mMasterHash;
|
||||||
size_t mHashBlockSize;
|
size_t mHashBlockSize;
|
||||||
fnd::List<sLayer> mLayerInfo;
|
fnd::List<sLayer> mLayerInfo;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,9 +1,11 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
#include <nx/KernelCapabilityEntry.h>
|
#include <nn/hac/KernelCapabilityEntry.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
class IKernelCapabilityHandler
|
class IKernelCapabilityHandler
|
||||||
{
|
{
|
||||||
|
@ -14,4 +16,4 @@ namespace nx
|
||||||
virtual bool isSet() const = 0;
|
virtual bool isSet() const = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -1,9 +1,11 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <nx/KernelCapabilityEntry.h>
|
#include <nn/hac/KernelCapabilityEntry.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
class InteruptEntry
|
class InteruptEntry
|
||||||
{
|
{
|
||||||
|
@ -52,5 +54,5 @@ namespace nx
|
||||||
mInterupt[1] = (field >> kInteruptBits) & kInteruptMax;
|
mInterupt[1] = (field >> kInteruptBits) & kInteruptMax;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,8 +1,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <nx/IKernelCapabilityHandler.h>
|
#include <nn/hac/IKernelCapabilityHandler.h>
|
||||||
#include <nx/InteruptEntry.h>
|
#include <nn/hac/InteruptEntry.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
class InteruptHandler :
|
class InteruptHandler :
|
||||||
public IKernelCapabilityHandler
|
public IKernelCapabilityHandler
|
||||||
|
@ -31,4 +33,4 @@ namespace nx
|
||||||
fnd::List<uint16_t> mInterupts;
|
fnd::List<uint16_t> mInterupts;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -3,16 +3,18 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/ISerialisable.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
#include <nx/ThreadInfoHandler.h>
|
#include <nn/hac/ThreadInfoHandler.h>
|
||||||
#include <nx/SystemCallHandler.h>
|
#include <nn/hac/SystemCallHandler.h>
|
||||||
#include <nx/MemoryMappingHandler.h>
|
#include <nn/hac/MemoryMappingHandler.h>
|
||||||
#include <nx/InteruptHandler.h>
|
#include <nn/hac/InteruptHandler.h>
|
||||||
#include <nx/MiscParamsHandler.h>
|
#include <nn/hac/MiscParamsHandler.h>
|
||||||
#include <nx/KernelVersionHandler.h>
|
#include <nn/hac/KernelVersionHandler.h>
|
||||||
#include <nx/HandleTableSizeHandler.h>
|
#include <nn/hac/HandleTableSizeHandler.h>
|
||||||
#include <nx/MiscFlagsHandler.h>
|
#include <nn/hac/MiscFlagsHandler.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
class KernelCapabilityBinary :
|
class KernelCapabilityBinary :
|
||||||
public fnd::ISerialisable
|
public fnd::ISerialisable
|
||||||
|
@ -73,4 +75,4 @@ namespace nx
|
||||||
MiscFlagsHandler mMiscFlags;
|
MiscFlagsHandler mMiscFlags;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -1,8 +1,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <nx/kc.h>
|
#include <nn/hac/kc.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
class KernelCapabilityEntry
|
class KernelCapabilityEntry
|
||||||
{
|
{
|
||||||
|
@ -47,4 +49,4 @@ namespace nx
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -1,9 +1,11 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <nx/KernelCapabilityEntry.h>
|
#include <nn/hac/KernelCapabilityEntry.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
class KernelVersionEntry
|
class KernelVersionEntry
|
||||||
{
|
{
|
||||||
|
@ -53,4 +55,4 @@ namespace nx
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -1,8 +1,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <nx/IKernelCapabilityHandler.h>
|
#include <nn/hac/IKernelCapabilityHandler.h>
|
||||||
#include <nx/KernelVersionEntry.h>
|
#include <nn/hac/KernelVersionEntry.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
class KernelVersionHandler :
|
class KernelVersionHandler :
|
||||||
public IKernelCapabilityHandler
|
public IKernelCapabilityHandler
|
||||||
|
@ -34,4 +36,4 @@ namespace nx
|
||||||
KernelVersionEntry mEntry;
|
KernelVersionEntry mEntry;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -1,7 +1,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <nx/IKernelCapabilityHandler.h>
|
#include <nn/hac/IKernelCapabilityHandler.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
class MemoryMappingHandler :
|
class MemoryMappingHandler :
|
||||||
public IKernelCapabilityHandler
|
public IKernelCapabilityHandler
|
||||||
|
@ -75,4 +77,4 @@ namespace nx
|
||||||
fnd::List<sMemoryMapping> mMemPage;
|
fnd::List<sMemoryMapping> mMemPage;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -1,9 +1,11 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <nx/KernelCapabilityEntry.h>
|
#include <nn/hac/KernelCapabilityEntry.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
class MemoryPageEntry
|
class MemoryPageEntry
|
||||||
{
|
{
|
||||||
|
@ -56,5 +58,5 @@ namespace nx
|
||||||
mUseFlag = mCap.getType() == kc::KC_MEMORY_MAP;
|
mUseFlag = mCap.getType() == kc::KC_MEMORY_MAP;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -1,9 +1,11 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <nx/KernelCapabilityEntry.h>
|
#include <nn/hac/KernelCapabilityEntry.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
class MiscFlagsEntry
|
class MiscFlagsEntry
|
||||||
{
|
{
|
||||||
|
@ -44,5 +46,5 @@ namespace nx
|
||||||
mFlags = field & kMaxVal;
|
mFlags = field & kMaxVal;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -1,8 +1,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <nx/IKernelCapabilityHandler.h>
|
#include <nn/hac/IKernelCapabilityHandler.h>
|
||||||
#include <nx/MiscFlagsEntry.h>
|
#include <nn/hac/MiscFlagsEntry.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
class MiscFlagsHandler :
|
class MiscFlagsHandler :
|
||||||
public IKernelCapabilityHandler
|
public IKernelCapabilityHandler
|
||||||
|
@ -51,5 +53,5 @@ namespace nx
|
||||||
bool mIsSet;
|
bool mIsSet;
|
||||||
fnd::List<Flags> mFlags;
|
fnd::List<Flags> mFlags;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -1,9 +1,11 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <nx/KernelCapabilityEntry.h>
|
#include <nn/hac/KernelCapabilityEntry.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
class MiscParamsEntry
|
class MiscParamsEntry
|
||||||
{
|
{
|
||||||
|
@ -44,6 +46,5 @@ namespace nx
|
||||||
mProgramType = field & kMaxProgramType;
|
mProgramType = field & kMaxProgramType;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,8 +1,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <nx/IKernelCapabilityHandler.h>
|
#include <nn/hac/IKernelCapabilityHandler.h>
|
||||||
#include <nx/MiscParamsEntry.h>
|
#include <nn/hac/MiscParamsEntry.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
class MiscParamsHandler :
|
class MiscParamsHandler :
|
||||||
public IKernelCapabilityHandler
|
public IKernelCapabilityHandler
|
||||||
|
@ -32,4 +34,4 @@ namespace nx
|
||||||
MiscParamsEntry mEntry;
|
MiscParamsEntry mEntry;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -1,9 +1,11 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <nx/nca.h>
|
#include <nn/hac/nca.h>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/ISerialisable.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
class NcaHeader :
|
class NcaHeader :
|
||||||
public fnd::ISerialisable
|
public fnd::ISerialisable
|
||||||
|
@ -20,7 +22,7 @@ namespace nx
|
||||||
byte_t index;
|
byte_t index;
|
||||||
uint64_t offset;
|
uint64_t offset;
|
||||||
uint64_t size;
|
uint64_t size;
|
||||||
crypto::sha::sSha256Hash hash;
|
fnd::sha::sSha256Hash hash;
|
||||||
|
|
||||||
const sPartition& operator=(const sPartition& other)
|
const sPartition& operator=(const sPartition& other)
|
||||||
{
|
{
|
||||||
|
@ -53,9 +55,6 @@ namespace nx
|
||||||
bool operator==(const NcaHeader& other) const;
|
bool operator==(const NcaHeader& other) const;
|
||||||
bool operator!=(const NcaHeader& other) const;
|
bool operator!=(const NcaHeader& other) const;
|
||||||
|
|
||||||
// to be used after export
|
|
||||||
size_t getSize() const;
|
|
||||||
|
|
||||||
// export/import binary
|
// export/import binary
|
||||||
void toBytes();
|
void toBytes();
|
||||||
void fromBytes(const byte_t* bytes, size_t len);
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
|
@ -86,8 +85,8 @@ namespace nx
|
||||||
void setRightsId(const byte_t* rights_id);
|
void setRightsId(const byte_t* rights_id);
|
||||||
const fnd::List<sPartition>& getPartitions() const;
|
const fnd::List<sPartition>& getPartitions() const;
|
||||||
void setPartitions(const fnd::List<sPartition>& partitions);
|
void setPartitions(const fnd::List<sPartition>& partitions);
|
||||||
const fnd::List<crypto::aes::sAes128Key>& getEncAesKeys() const;
|
const fnd::List<fnd::aes::sAes128Key>& getEncAesKeys() const;
|
||||||
void setEncAesKeys(const fnd::List<crypto::aes::sAes128Key>& keys);
|
void setEncAesKeys(const fnd::List<fnd::aes::sAes128Key>& keys);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "NCA_HEADER";
|
const std::string kModuleName = "NCA_HEADER";
|
||||||
|
@ -107,10 +106,10 @@ namespace nx
|
||||||
uint32_t mSdkAddonVersion;
|
uint32_t mSdkAddonVersion;
|
||||||
byte_t mRightsId[nca::kRightsIdLen];
|
byte_t mRightsId[nca::kRightsIdLen];
|
||||||
fnd::List<sPartition> mPartitions;
|
fnd::List<sPartition> mPartitions;
|
||||||
fnd::List<crypto::aes::sAes128Key> mEncAesKeys;
|
fnd::List<fnd::aes::sAes128Key> mEncAesKeys;
|
||||||
|
|
||||||
uint64_t blockNumToSize(uint32_t block_num) const;
|
uint64_t blockNumToSize(uint32_t block_num) const;
|
||||||
uint32_t sizeToBlockNum(uint64_t real_size) const;
|
uint32_t sizeToBlockNum(uint64_t real_size) const;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,14 +1,17 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <nx/nca.h>
|
#include <nn/hac/nca.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
class NcaUtils
|
class NcaUtils
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static inline size_t sectorToOffset(size_t sector_index) { return sector_index * nx::nca::kSectorSize; }
|
static inline size_t sectorToOffset(size_t sector_index) { return sector_index * nn::hac::nca::kSectorSize; }
|
||||||
static void decryptNcaHeader(const byte_t* src, byte_t* dst, const crypto::aes::sAesXts128Key& key);
|
static void decryptNcaHeader(const byte_t* src, byte_t* dst, const fnd::aes::sAesXts128Key& key);
|
||||||
static byte_t getMasterKeyRevisionFromKeyGeneration(byte_t key_generation);
|
static byte_t getMasterKeyRevisionFromKeyGeneration(byte_t key_generation);
|
||||||
static void getNcaPartitionAesCtr(const nx::sNcaFsHeader* hdr, byte_t* ctr);
|
static void getNcaPartitionAesCtr(const nn::hac::sNcaFsHeader* hdr, byte_t* ctr);
|
||||||
};
|
};
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -2,12 +2,13 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/ISerialisable.h>
|
||||||
#include <nx/npdm.h>
|
#include <nn/hac/npdm.h>
|
||||||
#include <nx/AccessControlInfoBinary.h>
|
#include <nn/hac/AccessControlInfoBinary.h>
|
||||||
#include <nx/AccessControlInfoDescBinary.h>
|
#include <nn/hac/AccessControlInfoDescBinary.h>
|
||||||
|
|
||||||
|
namespace nn
|
||||||
namespace nx
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
class NpdmBinary :
|
class NpdmBinary :
|
||||||
public fnd::ISerialisable
|
public fnd::ISerialisable
|
||||||
|
@ -75,5 +76,5 @@ namespace nx
|
||||||
AccessControlInfoBinary mAci;
|
AccessControlInfoBinary mAci;
|
||||||
AccessControlInfoDescBinary mAcid;
|
AccessControlInfoDescBinary mAcid;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -1,9 +1,12 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <nx/nro.h>
|
#include <cstring>
|
||||||
|
#include <nn/hac/nro.h>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/ISerialisable.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
class NroHeader :
|
class NroHeader :
|
||||||
public fnd::ISerialisable
|
public fnd::ISerialisable
|
||||||
|
@ -134,5 +137,5 @@ namespace nx
|
||||||
sSection mRoDynStrInfo;
|
sSection mRoDynStrInfo;
|
||||||
sSection mRoDynSymInfo;
|
sSection mRoDynSymInfo;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,9 +1,12 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <nx/nso.h>
|
#include <cstring>
|
||||||
|
#include <nn/hac/nso.h>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/ISerialisable.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
class NsoHeader :
|
class NsoHeader :
|
||||||
public fnd::ISerialisable
|
public fnd::ISerialisable
|
||||||
|
@ -58,7 +61,7 @@ namespace nx
|
||||||
sLayout memory_layout;
|
sLayout memory_layout;
|
||||||
bool is_compressed;
|
bool is_compressed;
|
||||||
bool is_hashed;
|
bool is_hashed;
|
||||||
crypto::sha::sSha256Hash hash;
|
fnd::sha::sSha256Hash hash;
|
||||||
|
|
||||||
void operator=(const sCodeSegment& other)
|
void operator=(const sCodeSegment& other)
|
||||||
{
|
{
|
||||||
|
@ -142,5 +145,5 @@ namespace nx
|
||||||
sLayout mRoDynStrInfo;
|
sLayout mRoDynStrInfo;
|
||||||
sLayout mRoDynSymInfo;
|
sLayout mRoDynSymInfo;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -3,10 +3,11 @@
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/ISerialisable.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
#include <nx/pfs.h>
|
#include <nn/hac/pfs.h>
|
||||||
|
|
||||||
|
namespace nn
|
||||||
namespace nx
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
class PfsHeader :
|
class PfsHeader :
|
||||||
public fnd::ISerialisable
|
public fnd::ISerialisable
|
||||||
|
@ -24,7 +25,7 @@ namespace nx
|
||||||
size_t offset;
|
size_t offset;
|
||||||
size_t size;
|
size_t size;
|
||||||
size_t hash_protected_size;
|
size_t hash_protected_size;
|
||||||
crypto::sha::sSha256Hash hash;
|
fnd::sha::sSha256Hash hash;
|
||||||
|
|
||||||
sFile& operator=(const sFile& other)
|
sFile& operator=(const sFile& other)
|
||||||
{
|
{
|
||||||
|
@ -68,9 +69,6 @@ namespace nx
|
||||||
bool operator==(const PfsHeader& other) const;
|
bool operator==(const PfsHeader& other) const;
|
||||||
bool operator!=(const PfsHeader& other) const;
|
bool operator!=(const PfsHeader& other) const;
|
||||||
|
|
||||||
// to be used after export
|
|
||||||
size_t getSize() const;
|
|
||||||
|
|
||||||
// export/import binary
|
// export/import binary
|
||||||
void toBytes();
|
void toBytes();
|
||||||
void fromBytes(const byte_t* bytes, size_t len);
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
|
@ -83,7 +81,7 @@ namespace nx
|
||||||
void setFsType(FsType type);
|
void setFsType(FsType type);
|
||||||
const fnd::List<sFile>& getFileList() const;
|
const fnd::List<sFile>& getFileList() const;
|
||||||
void addFile(const std::string& name, size_t size);
|
void addFile(const std::string& name, size_t size);
|
||||||
void addFile(const std::string& name, size_t size, size_t hash_protected_size, const crypto::sha::sSha256Hash& hash);
|
void addFile(const std::string& name, size_t size, size_t hash_protected_size, const fnd::sha::sSha256Hash& hash);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "PFS_HEADER";
|
const std::string kModuleName = "PFS_HEADER";
|
||||||
|
@ -99,4 +97,4 @@ namespace nx
|
||||||
void calculateOffsets(size_t data_offset);
|
void calculateOffsets(size_t data_offset);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -3,9 +3,11 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/ISerialisable.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
#include <nx/ServiceAccessControlEntry.h>
|
#include <nn/hac/ServiceAccessControlEntry.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
class ServiceAccessControlBinary :
|
class ServiceAccessControlBinary :
|
||||||
public fnd::ISerialisable
|
public fnd::ISerialisable
|
||||||
|
@ -36,5 +38,5 @@ namespace nx
|
||||||
// variables
|
// variables
|
||||||
fnd::List<ServiceAccessControlEntry> mServices;
|
fnd::List<ServiceAccessControlEntry> mServices;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -3,7 +3,9 @@
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/ISerialisable.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
class ServiceAccessControlEntry :
|
class ServiceAccessControlEntry :
|
||||||
public fnd::ISerialisable
|
public fnd::ISerialisable
|
||||||
|
@ -44,8 +46,6 @@ namespace nx
|
||||||
// variables
|
// variables
|
||||||
bool mIsServer;
|
bool mIsServer;
|
||||||
std::string mName;
|
std::string mName;
|
||||||
|
|
||||||
bool isEqual(const ServiceAccessControlEntry& other) const;
|
|
||||||
void copyFrom(const ServiceAccessControlEntry& other);
|
|
||||||
};
|
};
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,9 +1,11 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <nx/KernelCapabilityEntry.h>
|
#include <nn/hac/KernelCapabilityEntry.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
class SystemCallEntry
|
class SystemCallEntry
|
||||||
{
|
{
|
||||||
|
@ -54,4 +56,4 @@ namespace nx
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -1,7 +1,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <nx/IKernelCapabilityHandler.h>
|
#include <nn/hac/IKernelCapabilityHandler.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
class SystemCallHandler :
|
class SystemCallHandler :
|
||||||
public IKernelCapabilityHandler
|
public IKernelCapabilityHandler
|
||||||
|
@ -32,5 +34,5 @@ namespace nx
|
||||||
bool mIsSet;
|
bool mIsSet;
|
||||||
fnd::List<uint8_t> mSystemCalls;
|
fnd::List<uint8_t> mSystemCalls;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,9 +1,11 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <nx/KernelCapabilityEntry.h>
|
#include <nn/hac/KernelCapabilityEntry.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
class ThreadInfoEntry
|
class ThreadInfoEntry
|
||||||
{
|
{
|
||||||
|
@ -64,3 +66,4 @@ namespace nx
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -1,8 +1,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <nx/IKernelCapabilityHandler.h>
|
#include <nn/hac/IKernelCapabilityHandler.h>
|
||||||
#include <nx/ThreadInfoEntry.h>
|
#include <nn/hac/ThreadInfoEntry.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
class ThreadInfoHandler :
|
class ThreadInfoHandler :
|
||||||
public IKernelCapabilityHandler
|
public IKernelCapabilityHandler
|
||||||
|
@ -38,4 +40,4 @@ namespace nx
|
||||||
ThreadInfoEntry mEntry;
|
ThreadInfoEntry mEntry;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -1,9 +1,11 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <nx/xci.h>
|
#include <nn/hac/xci.h>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/ISerialisable.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
class XciHeader :
|
class XciHeader :
|
||||||
public fnd::ISerialisable
|
public fnd::ISerialisable
|
||||||
|
@ -41,16 +43,16 @@ namespace nx
|
||||||
void setPackageId(uint64_t id);
|
void setPackageId(uint64_t id);
|
||||||
uint32_t getValidDataEndPage() const;
|
uint32_t getValidDataEndPage() const;
|
||||||
void setValidDataEndPage(uint32_t page);
|
void setValidDataEndPage(uint32_t page);
|
||||||
const crypto::aes::sAesIvCtr& getAesCbcIv() const;
|
const fnd::aes::sAesIvCtr& getAesCbcIv() const;
|
||||||
void setAesCbcIv(const crypto::aes::sAesIvCtr& iv);
|
void setAesCbcIv(const fnd::aes::sAesIvCtr& iv);
|
||||||
uint64_t getPartitionFsAddress() const;
|
uint64_t getPartitionFsAddress() const;
|
||||||
void setPartitionFsAddress(uint64_t address);
|
void setPartitionFsAddress(uint64_t address);
|
||||||
uint64_t getPartitionFsSize() const;
|
uint64_t getPartitionFsSize() const;
|
||||||
void setPartitionFsSize(uint64_t size);
|
void setPartitionFsSize(uint64_t size);
|
||||||
const crypto::sha::sSha256Hash& getPartitionFsHash() const;
|
const fnd::sha::sSha256Hash& getPartitionFsHash() const;
|
||||||
void setPartitionFsHash(const crypto::sha::sSha256Hash& hash);
|
void setPartitionFsHash(const fnd::sha::sSha256Hash& hash);
|
||||||
const crypto::sha::sSha256Hash& getInitialDataHash() const;
|
const fnd::sha::sSha256Hash& getInitialDataHash() const;
|
||||||
void setInitialDataHash(const crypto::sha::sSha256Hash& hash);
|
void setInitialDataHash(const fnd::sha::sSha256Hash& hash);
|
||||||
uint32_t getSelSec() const;
|
uint32_t getSelSec() const;
|
||||||
void setSelSec(uint32_t sel_sec);
|
void setSelSec(uint32_t sel_sec);
|
||||||
uint32_t getSelT1Key() const;
|
uint32_t getSelT1Key() const;
|
||||||
|
@ -99,11 +101,11 @@ namespace nx
|
||||||
byte_t mFlags;
|
byte_t mFlags;
|
||||||
uint64_t mPackageId;
|
uint64_t mPackageId;
|
||||||
uint32_t mValidDataEndPage;
|
uint32_t mValidDataEndPage;
|
||||||
crypto::aes::sAesIvCtr mAesCbcIv;
|
fnd::aes::sAesIvCtr mAesCbcIv;
|
||||||
uint64_t mPartitionFsHeaderAddress;
|
uint64_t mPartitionFsHeaderAddress;
|
||||||
uint64_t mPartitionFsHeaderSize;
|
uint64_t mPartitionFsHeaderSize;
|
||||||
crypto::sha::sSha256Hash mPartitionFsHeaderHash;
|
fnd::sha::sSha256Hash mPartitionFsHeaderHash;
|
||||||
crypto::sha::sSha256Hash mInitialDataHash;
|
fnd::sha::sSha256Hash mInitialDataHash;
|
||||||
uint32_t mSelSec;
|
uint32_t mSelSec;
|
||||||
uint32_t mSelT1Key;
|
uint32_t mSelT1Key;
|
||||||
uint32_t mSelKey;
|
uint32_t mSelKey;
|
||||||
|
@ -121,5 +123,5 @@ namespace nx
|
||||||
byte_t mUppHash[8];
|
byte_t mUppHash[8];
|
||||||
uint64_t mUppId;
|
uint64_t mUppId;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,13 +1,16 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <nx/xci.h>
|
#include <nn/hac/xci.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
class XciUtils
|
class XciUtils
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static inline uint64_t blockToAddr(uint32_t block) { return ((uint64_t)block) << 9; }
|
static inline uint64_t blockToAddr(uint32_t block) { return ((uint64_t)block) << 9; }
|
||||||
static void getXciHeaderAesIv(const nx::sXciHeader* hdr, byte_t* iv);
|
static void getXciHeaderAesIv(const nn::hac::sXciHeader* hdr, byte_t* iv);
|
||||||
static void decryptXciHeader(const byte_t* src, byte_t* dst, const byte_t* key);
|
static void decryptXciHeader(const byte_t* src, byte_t* dst, const byte_t* key);
|
||||||
};
|
};
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,9 +1,11 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <crypto/rsa.h>
|
#include <fnd/rsa.h>
|
||||||
#include <nx/macro.h>
|
#include <nn/hac/macro.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
namespace aci
|
namespace aci
|
||||||
{
|
{
|
||||||
|
@ -37,8 +39,8 @@ namespace nx
|
||||||
|
|
||||||
struct sAciDescHeader
|
struct sAciDescHeader
|
||||||
{
|
{
|
||||||
byte_t signature[crypto::rsa::kRsa2048Size];
|
byte_t signature[fnd::rsa::kRsa2048Size];
|
||||||
byte_t nca_rsa_signature2_modulus[crypto::rsa::kRsa2048Size];
|
byte_t nca_rsa_signature2_modulus[fnd::rsa::kRsa2048Size];
|
||||||
le_uint32_t st_magic;
|
le_uint32_t st_magic;
|
||||||
le_uint32_t signed_size;
|
le_uint32_t signed_size;
|
||||||
byte_t reserved_00[0x4];
|
byte_t reserved_00[0x4];
|
||||||
|
@ -50,4 +52,5 @@ namespace nx
|
||||||
sAciSection kc;
|
sAciSection kc;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,8 +1,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <crypto/sha.h>
|
#include <fnd/sha.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
namespace cnmt
|
namespace cnmt
|
||||||
{
|
{
|
||||||
|
@ -81,7 +83,7 @@ namespace nx
|
||||||
|
|
||||||
struct sContentInfo
|
struct sContentInfo
|
||||||
{
|
{
|
||||||
crypto::sha::sSha256Hash content_hash;
|
fnd::sha::sSha256Hash content_hash;
|
||||||
byte_t content_id[cnmt::kContentIdLen];
|
byte_t content_id[cnmt::kContentIdLen];
|
||||||
le_uint32_t size_lower;
|
le_uint32_t size_lower;
|
||||||
le_uint16_t size_higher;
|
le_uint16_t size_higher;
|
||||||
|
@ -132,4 +134,5 @@ namespace nx
|
||||||
byte_t data[cnmt::kDigestLen];
|
byte_t data[cnmt::kDigestLen];
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
namespace elf
|
namespace elf
|
||||||
{
|
{
|
||||||
|
@ -64,4 +66,5 @@ namespace nx
|
||||||
le_uint64_t size;
|
le_uint64_t size;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
namespace fac
|
namespace fac
|
||||||
{
|
{
|
||||||
|
@ -54,4 +56,5 @@ namespace nx
|
||||||
} content_owner_ids, save_data_owner_ids; // the data for these follow later in binary. start/end relative to base of FacData instance
|
} content_owner_ids, save_data_owner_ids; // the data for these follow later in binary. start/end relative to base of FacData instance
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,8 +1,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <nx/macro.h>
|
#include <nn/hac/macro.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
namespace hierarchicalintegrity
|
namespace hierarchicalintegrity
|
||||||
{
|
{
|
||||||
|
@ -30,3 +32,4 @@ namespace nx
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -1,8 +1,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <crypto/sha.h>
|
#include <fnd/sha.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
namespace hierarchicalsha256
|
namespace hierarchicalsha256
|
||||||
{
|
{
|
||||||
|
@ -13,7 +15,7 @@ namespace nx
|
||||||
#pragma pack(push,1)
|
#pragma pack(push,1)
|
||||||
struct sHierarchicalSha256Header
|
struct sHierarchicalSha256Header
|
||||||
{
|
{
|
||||||
crypto::sha::sSha256Hash master_hash;
|
fnd::sha::sSha256Hash master_hash;
|
||||||
le_uint32_t hash_block_size;
|
le_uint32_t hash_block_size;
|
||||||
le_uint32_t layer_num;
|
le_uint32_t layer_num;
|
||||||
struct sLayer
|
struct sLayer
|
||||||
|
@ -24,3 +26,4 @@ namespace nx
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -1,9 +1,11 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <crypto/rsa.h>
|
#include <fnd/rsa.h>
|
||||||
#include <nx/macro.h>
|
#include <nn/hac/macro.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
namespace kc
|
namespace kc
|
||||||
{
|
{
|
||||||
|
@ -21,4 +23,5 @@ namespace nx
|
||||||
KC_MISC_FLAGS = 16
|
KC_MISC_FLAGS = 16
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
namespace nacp
|
namespace nacp
|
||||||
{
|
{
|
||||||
|
@ -217,4 +219,5 @@ namespace nx
|
||||||
byte_t reserved_04[0xDED];
|
byte_t reserved_04[0xDED];
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,11 +1,13 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <crypto/aes.h>
|
#include <fnd/aes.h>
|
||||||
#include <crypto/sha.h>
|
#include <fnd/sha.h>
|
||||||
#include <crypto/rsa.h>
|
#include <fnd/rsa.h>
|
||||||
#include <nx/macro.h>
|
#include <nn/hac/macro.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
namespace nca
|
namespace nca
|
||||||
{
|
{
|
||||||
|
@ -106,8 +108,8 @@ namespace nx
|
||||||
byte_t enabled;
|
byte_t enabled;
|
||||||
byte_t reserved[7];
|
byte_t reserved[7];
|
||||||
} partition[nca::kPartitionNum];
|
} partition[nca::kPartitionNum];
|
||||||
crypto::sha::sSha256Hash partition_hash[nca::kPartitionNum];
|
fnd::sha::sSha256Hash partition_hash[nca::kPartitionNum];
|
||||||
crypto::aes::sAes128Key enc_aes_key[nca::kAesKeyNum];
|
fnd::aes::sAes128Key enc_aes_key[nca::kAesKeyNum];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sNcaFsHeader
|
struct sNcaFsHeader
|
||||||
|
@ -124,11 +126,12 @@ namespace nx
|
||||||
|
|
||||||
struct sNcaHeaderBlock
|
struct sNcaHeaderBlock
|
||||||
{
|
{
|
||||||
byte_t signature_main[crypto::rsa::kRsa2048Size];
|
byte_t signature_main[fnd::rsa::kRsa2048Size];
|
||||||
byte_t signature_acid[crypto::rsa::kRsa2048Size];
|
byte_t signature_acid[fnd::rsa::kRsa2048Size];
|
||||||
sNcaHeader header;
|
sNcaHeader header;
|
||||||
sNcaFsHeader fs_header[nx::nca::kPartitionNum];
|
sNcaFsHeader fs_header[nn::hac::nca::kPartitionNum];
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -1,8 +1,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <nx/macro.h>
|
#include <nn/hac/macro.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
namespace npdm
|
namespace npdm
|
||||||
{
|
{
|
||||||
|
@ -51,4 +53,5 @@ namespace nx
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,8 +1,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <nx/macro.h>
|
#include <nn/hac/macro.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
namespace nro
|
namespace nro
|
||||||
{
|
{
|
||||||
|
@ -40,3 +42,4 @@ namespace nx
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -1,9 +1,11 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <crypto/rsa.h>
|
#include <fnd/rsa.h>
|
||||||
#include <nx/macro.h>
|
#include <nn/hac/macro.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
namespace nrr
|
namespace nrr
|
||||||
{
|
{
|
||||||
|
@ -15,8 +17,8 @@ namespace nx
|
||||||
{
|
{
|
||||||
le_uint64_t application_id_mask;
|
le_uint64_t application_id_mask;
|
||||||
le_uint64_t application_id_pattern;
|
le_uint64_t application_id_pattern;
|
||||||
byte_t nrr_body_modulus[crypto::rsa::kRsa2048Size];
|
byte_t nrr_body_modulus[fnd::rsa::kRsa2048Size];
|
||||||
byte_t nrr_cert_signature[crypto::rsa::kRsa2048Size];
|
byte_t nrr_cert_signature[fnd::rsa::kRsa2048Size];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sNrrHeader
|
struct sNrrHeader
|
||||||
|
@ -24,7 +26,7 @@ namespace nx
|
||||||
le_uint32_t st_magic;
|
le_uint32_t st_magic;
|
||||||
byte_t reserved_0[28];
|
byte_t reserved_0[28];
|
||||||
sNrrCertificate certificate;
|
sNrrCertificate certificate;
|
||||||
byte_t nrr_body_signature[crypto::rsa::kRsa2048Size];
|
byte_t nrr_body_signature[fnd::rsa::kRsa2048Size];
|
||||||
le_uint64_t application_id;
|
le_uint64_t application_id;
|
||||||
le_uint32_t size;
|
le_uint32_t size;
|
||||||
byte_t reserved_1[4];
|
byte_t reserved_1[4];
|
||||||
|
@ -34,3 +36,4 @@ namespace nx
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -1,9 +1,11 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <crypto/sha.h>
|
#include <fnd/sha.h>
|
||||||
#include <nx/macro.h>
|
#include <nn/hac/macro.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
namespace nso
|
namespace nso
|
||||||
{
|
{
|
||||||
|
@ -56,10 +58,11 @@ namespace nx
|
||||||
sNsoSection embedded;
|
sNsoSection embedded;
|
||||||
sNsoSection dyn_str;
|
sNsoSection dyn_str;
|
||||||
sNsoSection dyn_sym;
|
sNsoSection dyn_sym;
|
||||||
crypto::sha::sSha256Hash text_hash;
|
fnd::sha::sSha256Hash text_hash;
|
||||||
crypto::sha::sSha256Hash ro_hash;
|
fnd::sha::sSha256Hash ro_hash;
|
||||||
crypto::sha::sSha256Hash data_hash;
|
fnd::sha::sSha256Hash data_hash;
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -1,8 +1,11 @@
|
||||||
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <crypto/sha.h>
|
#include <fnd/sha.h>
|
||||||
#include <nx/macro.h>
|
#include <nn/hac/macro.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
namespace pfs
|
namespace pfs
|
||||||
{
|
{
|
||||||
|
@ -35,7 +38,8 @@ namespace nx
|
||||||
le_uint32_t name_offset;
|
le_uint32_t name_offset;
|
||||||
le_uint32_t hash_protected_size;
|
le_uint32_t hash_protected_size;
|
||||||
byte_t padding[8];
|
byte_t padding[8];
|
||||||
crypto::sha::sSha256Hash hash;
|
fnd::sha::sSha256Hash hash;
|
||||||
}; // sizeof(0x40)
|
}; // sizeof(0x40)
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -1,7 +1,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
namespace romfs
|
namespace romfs
|
||||||
{
|
{
|
||||||
|
@ -55,3 +57,4 @@ namespace nx
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -1,12 +1,14 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
#include <crypto/aes.h>
|
#include <fnd/aes.h>
|
||||||
#include <crypto/sha.h>
|
#include <fnd/sha.h>
|
||||||
#include <crypto/rsa.h>
|
#include <fnd/rsa.h>
|
||||||
#include <nx/macro.h>
|
#include <nn/hac/macro.h>
|
||||||
|
|
||||||
namespace nx
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
{
|
{
|
||||||
namespace xci
|
namespace xci
|
||||||
{
|
{
|
||||||
|
@ -78,11 +80,11 @@ namespace nx
|
||||||
le_uint64_t package_id;
|
le_uint64_t package_id;
|
||||||
le_uint32_t valid_data_end_page;
|
le_uint32_t valid_data_end_page;
|
||||||
byte_t reserved_00[4];
|
byte_t reserved_00[4];
|
||||||
crypto::aes::sAesIvCtr aescbc_iv;
|
fnd::aes::sAesIvCtr aescbc_iv;
|
||||||
le_uint64_t partition_fs_header_address;
|
le_uint64_t partition_fs_header_address;
|
||||||
le_uint64_t partition_fs_header_size;
|
le_uint64_t partition_fs_header_size;
|
||||||
crypto::sha::sSha256Hash partition_fs_header_hash;
|
fnd::sha::sSha256Hash partition_fs_header_hash;
|
||||||
crypto::sha::sSha256Hash initial_data_hash;
|
fnd::sha::sSha256Hash initial_data_hash;
|
||||||
le_uint32_t sel_sec;
|
le_uint32_t sel_sec;
|
||||||
le_uint32_t sel_t1_key;
|
le_uint32_t sel_t1_key;
|
||||||
le_uint32_t sel_key;
|
le_uint32_t sel_key;
|
||||||
|
@ -105,7 +107,7 @@ namespace nx
|
||||||
|
|
||||||
struct sXciHeaderPage
|
struct sXciHeaderPage
|
||||||
{
|
{
|
||||||
byte_t signature[crypto::rsa::kRsa2048Size];
|
byte_t signature[fnd::rsa::kRsa2048Size];
|
||||||
sXciHeader header;
|
sXciHeader header;
|
||||||
}; // sizeof() = 512 (1 page)
|
}; // sizeof() = 512 (1 page)
|
||||||
|
|
||||||
|
@ -122,9 +124,10 @@ namespace nx
|
||||||
{
|
{
|
||||||
sInitialData initial_data; // AES128-CCM encrypted {titlekey[16]}
|
sInitialData initial_data; // AES128-CCM encrypted {titlekey[16]}
|
||||||
byte_t encrypted_00[xci::kPageSize * 6]; // AES128-CTR encrypted {titlekey[16]}
|
byte_t encrypted_00[xci::kPageSize * 6]; // AES128-CTR encrypted {titlekey[16]}
|
||||||
byte_t encrypted_00_aesctr_data[crypto::rsa::kRsa2048Size]; // RSA2048-OAEP-SHA256 encrypted AES-CTR data used for encrypted_00 {key[16],iv[16]}
|
byte_t encrypted_00_aesctr_data[fnd::rsa::kRsa2048Size]; // RSA2048-OAEP-SHA256 encrypted AES-CTR data used for encrypted_00 {key[16],iv[16]}
|
||||||
byte_t reserved[xci::kPageSize - crypto::rsa::kRsa2048Size];
|
byte_t reserved[xci::kPageSize - fnd::rsa::kRsa2048Size];
|
||||||
}; // sizeof() = 512*8 (8 pages)
|
}; // sizeof() = 512*8 (8 pages)
|
||||||
|
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
}
|
}
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue