diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json
index e996876..f658b73 100644
--- a/.vscode/c_cpp_properties.json
+++ b/.vscode/c_cpp_properties.json
@@ -9,14 +9,13 @@
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include",
"/usr/include",
"${workspaceRoot}",
- "${workspaceRoot}/lib/libcrypto/include",
- "${workspaceRoot}/lib/libcrypto/source/polarssl/libinclude",
- "${workspaceRoot}/lib/libcompress/include",
+ "${workspaceRoot}/lib/libfnd/include",
+ "${workspaceRoot}/lib/libpolarssl/include",
+ "${workspaceRoot}/lib/liblz4/include",
"${workspaceRoot}/lib/libes/include",
"${workspaceRoot}/lib/libpki/include",
- "${workspaceRoot}/lib/libfnd/include",
- "${workspaceRoot}/lib/libnx/include",
- "${workspaceRoot}/lib/libnx-hb/include"
+ "${workspaceRoot}/lib/libhac/include",
+ "${workspaceRoot}/lib/libhac-hb/include"
],
"defines": [],
"intelliSenseMode": "clang-x64",
diff --git a/LICENSE b/LICENSE
index cec2ef2..24d91e4 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-NXTools
+NNTools
Copyright (c) 2017-2018 Jack
Permission is hereby granted, free of charge, to any person obtaining a copy
diff --git a/NXTools.sln b/NNTools.sln
similarity index 70%
rename from NXTools.sln
rename to NNTools.sln
index 2305e4c..3abe916 100644
--- a/NXTools.sln
+++ b/NNTools.sln
@@ -3,49 +3,35 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27428.2015
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}"
- ProjectSection(SolutionItems) = preProject
- lib\makefile = lib\makefile
- EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Programs", "Programs", "{E0863FCC-8E72-490D-BE1B-458F12CA8298}"
- ProjectSection(SolutionItems) = preProject
- programs\makefile = programs\makefile
- EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8F6C846D-35E2-47FD-AF42-7A3FD036346E}"
ProjectSection(SolutionItems) = preProject
.gitignore = .gitignore
- KEYS.md = KEYS.md
LICENSE = LICENSE
makefile = makefile
README.md = README.md
+ SWITCH_KEYS.md = SWITCH_KEYS.md
EndProjectSection
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}"
- 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
-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
-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
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpki", "lib\libpki\libpki.vcxproj", "{B9113734-6E84-44FF-8CF7-58199AA815C5}"
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
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
@@ -54,38 +40,6 @@ Global
Release|x86 = Release|x86
EndGlobalSection
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.Build.0 = Debug|x64
{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|x86.ActiveCfg = Release|Win32
{AF09FA96-4463-417D-8FE6-526063F41349}.Release|x86.Build.0 = Release|Win32
- {CF01B5B7-730A-447F-9BB2-5EDA9B082177}.Debug|x64.ActiveCfg = Debug|x64
- {CF01B5B7-730A-447F-9BB2-5EDA9B082177}.Debug|x64.Build.0 = Debug|x64
- {CF01B5B7-730A-447F-9BB2-5EDA9B082177}.Debug|x86.ActiveCfg = Debug|Win32
- {CF01B5B7-730A-447F-9BB2-5EDA9B082177}.Debug|x86.Build.0 = Debug|Win32
- {CF01B5B7-730A-447F-9BB2-5EDA9B082177}.Release|x64.ActiveCfg = Release|x64
- {CF01B5B7-730A-447F-9BB2-5EDA9B082177}.Release|x64.Build.0 = Release|x64
- {CF01B5B7-730A-447F-9BB2-5EDA9B082177}.Release|x86.ActiveCfg = Release|Win32
- {CF01B5B7-730A-447F-9BB2-5EDA9B082177}.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
+ {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
+ {394EFC16-BD3A-4538-B33D-7BA1EDB8DAC1}.Debug|x64.ActiveCfg = Debug|x64
+ {394EFC16-BD3A-4538-B33D-7BA1EDB8DAC1}.Debug|x64.Build.0 = Debug|x64
+ {394EFC16-BD3A-4538-B33D-7BA1EDB8DAC1}.Debug|x86.ActiveCfg = Debug|Win32
+ {394EFC16-BD3A-4538-B33D-7BA1EDB8DAC1}.Debug|x86.Build.0 = Debug|Win32
+ {394EFC16-BD3A-4538-B33D-7BA1EDB8DAC1}.Release|x64.ActiveCfg = Release|x64
+ {394EFC16-BD3A-4538-B33D-7BA1EDB8DAC1}.Release|x64.Build.0 = Release|x64
+ {394EFC16-BD3A-4538-B33D-7BA1EDB8DAC1}.Release|x86.ActiveCfg = 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.Build.0 = Debug|x64
{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|x86.ActiveCfg = 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
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
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}
- {CF01B5B7-730A-447F-9BB2-5EDA9B082177} = {170B4A09-1B67-4A62-93AB-116EBCFF4A8C}
- {738CB4FC-CD9E-4B81-A04B-DEADBFA71C63} = {170B4A09-1B67-4A62-93AB-116EBCFF4A8C}
+ {4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B} = {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}
+ {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
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {07DCCACC-D10D-47C9-85AE-FB9C54DB7D62}
diff --git a/NXTools.vcxproj b/NNTools.vcxproj
similarity index 98%
rename from NXTools.vcxproj
rename to NNTools.vcxproj
index 647aa09..d764e1b 100644
--- a/NXTools.vcxproj
+++ b/NNTools.vcxproj
@@ -21,9 +21,9 @@
15.0
{0A4197A1-76AD-4BF7-A29D-5CED369B72FD}
- NXTools
+ NNTools
10.0.15063.0
- libnx
+ NNTools
diff --git a/NXTools.vcxproj.filters b/NNTools.vcxproj.filters
similarity index 100%
rename from NXTools.vcxproj.filters
rename to NNTools.vcxproj.filters
diff --git a/README.md b/README.md
index 377b1a2..48824a1 100644
--- a/README.md
+++ b/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)
# Tools
-
-* __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
+* [__nstool__](/programs/nstool/README.md) - General purpose read/extract tool for Nintendo Switch file formats.
# Libraries
-
-* __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)
+* __libfnd__ - Foundation library. Provides file IO, crypto, CLI utils, string conversion, etc.
* __libpki__ - Processes Nintendo's proprietary PKI.
-* __libes__ - Processes Nintendo's eShop file types.
-* __libnx__ - Processes NX file types.
-* __libnx-hb__ - Processes NX file types (homebrew extensions).
+* __libes__ - Processes Nintendo's eShop file formats.
+* __libhac__ - Processes Nintendo Switch file formats.
+* __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
-
On MacOS/Linux/WSL run `make`.
-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.
\ No newline at end of file
+For Windows, Visual Studio 2017 is supported.
\ No newline at end of file
diff --git a/KEYS.md b/SWITCH_KEYS.md
similarity index 75%
rename from KEYS.md
rename to SWITCH_KEYS.md
index 0a3098b..038dd1e 100644
--- a/KEYS.md
+++ b/SWITCH_KEYS.md
@@ -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
@@ -47,8 +61,8 @@ acid_sign_key_modulus : RSA2048 Modulus (0x100 bytes)
acid_sign_key_private : RSA2048 Private Exponent (0x100 bytes)
```
-# 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.
+## Compatibility with hactool keyset files
+`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
header_key_source : hactool alias for nca_header_key_source
diff --git a/lib/libcompress/source/lz4_wrapper.cpp b/lib/libcompress/source/lz4_wrapper.cpp
deleted file mode 100644
index aa340d2..0000000
--- a/lib/libcompress/source/lz4_wrapper.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-#include
-#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);
-}
-
-
\ No newline at end of file
diff --git a/lib/libcrypto/crypto.vcxproj b/lib/libcrypto/crypto.vcxproj
deleted file mode 100644
index 06dfa98..0000000
--- a/lib/libcrypto/crypto.vcxproj
+++ /dev/null
@@ -1,159 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Release
- Win32
-
-
- Debug
- x64
-
-
- Release
- x64
-
-
-
- 15.0
- {6ADBB60D-DBA0-411D-BD2D-A355EF8E0FE1}
- crypto
- 10.0.15063.0
- libcrypto
-
-
-
- StaticLibrary
- true
- v141
- MultiByte
-
-
- StaticLibrary
- false
- v141
- true
- MultiByte
-
-
- StaticLibrary
- true
- v141
- MultiByte
-
-
- StaticLibrary
- false
- v141
- true
- MultiByte
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Level3
- Disabled
- true
- ..\libfnd\include;..\libcrypto\include;..\libcrypto\source\libpolarssl\include;
- _MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
-
-
-
-
- Level3
- Disabled
- true
- ..\libfnd\include;..\libcrypto\include;..\libcrypto\source\libpolarssl\include;
- _MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
-
-
-
-
- Level3
- MaxSpeed
- true
- true
- true
- ..\libfnd\include;..\libcrypto\include;..\libcrypto\source\libpolarssl\include;
- _MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
-
-
- true
- true
-
-
-
-
- Level3
- MaxSpeed
- true
- true
- true
- ..\libfnd\include;..\libcrypto\include;..\libcrypto\source\libpolarssl\include;
- _MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
-
-
- true
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/lib/libcrypto/crypto.vcxproj.filters b/lib/libcrypto/crypto.vcxproj.filters
deleted file mode 100644
index 0110282..0000000
--- a/lib/libcrypto/crypto.vcxproj.filters
+++ /dev/null
@@ -1,114 +0,0 @@
-
-
-
-
- {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
- {93995380-89BD-4b04-88EB-625FBE52EBFB}
- h;hh;hpp;hxx;hm;inl;inc;xsd
-
-
- {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
- rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
-
-
- {c24d0e3f-1a38-486c-9bad-b7db5b39eee2}
-
-
- {50821199-d06b-4e82-b424-3f17b60f1a9e}
-
-
- {012a6f22-d10a-4ca3-b7c3-4c31c6ff1cc1}
-
-
-
-
- Header Files\crypto
-
-
- Header Files\crypto
-
-
- Header Files\crypto
-
-
- Header Files\polarssl
-
-
- Header Files\polarssl
-
-
- Header Files\polarssl
-
-
- Header Files\polarssl
-
-
- Header Files\polarssl
-
-
- Header Files\polarssl
-
-
- Header Files\polarssl
-
-
- Header Files\polarssl
-
-
- Header Files\polarssl
-
-
- Header Files\polarssl
-
-
- Header Files\crypto
-
-
- Header Files\crypto
-
-
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files\polarssl
-
-
- Source Files\polarssl
-
-
- Source Files\polarssl
-
-
- Source Files\polarssl
-
-
- Source Files\polarssl
-
-
- Source Files\polarssl
-
-
- Source Files\polarssl
-
-
- Source Files\polarssl
-
-
- Source Files
-
-
-
-
-
-
\ No newline at end of file
diff --git a/lib/libcrypto/source/base64_wrapper.cpp b/lib/libcrypto/source/base64_wrapper.cpp
deleted file mode 100644
index 1bc6f66..0000000
--- a/lib/libcrypto/source/base64_wrapper.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-#include
-#include
-
-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);
-}
\ No newline at end of file
diff --git a/lib/libcrypto/source/libpolarssl/makefile b/lib/libcrypto/source/libpolarssl/makefile
deleted file mode 100644
index f2d86c3..0000000
--- a/lib/libcrypto/source/libpolarssl/makefile
+++ /dev/null
@@ -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)
\ No newline at end of file
diff --git a/lib/libcrypto/source/sha_wrapper.cpp b/lib/libcrypto/source/sha_wrapper.cpp
deleted file mode 100644
index c625c95..0000000
--- a/lib/libcrypto/source/sha_wrapper.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-#include
-#include
-#include
-
-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);
-}
\ No newline at end of file
diff --git a/lib/libes/include/es/SectionHeader_V2.h b/lib/libes/include/nn/es/SectionHeader_V2.h
similarity index 96%
rename from lib/libes/include/es/SectionHeader_V2.h
rename to lib/libes/include/nn/es/SectionHeader_V2.h
index 35b1083..eb7558b 100644
--- a/lib/libes/include/es/SectionHeader_V2.h
+++ b/lib/libes/include/nn/es/SectionHeader_V2.h
@@ -1,8 +1,10 @@
#pragma once
#include
#include
-#include
+#include
+namespace nn
+{
namespace es
{
class SectionHeader_V2 :
@@ -52,5 +54,5 @@ namespace es
uint16_t mRecordNum;
ticket::SectionType mSectionType;
};
-
}
+}
\ No newline at end of file
diff --git a/lib/libes/include/es/TicketBody_V2.h b/lib/libes/include/nn/es/TicketBody_V2.h
similarity index 98%
rename from lib/libes/include/es/TicketBody_V2.h
rename to lib/libes/include/nn/es/TicketBody_V2.h
index 4741cac..6c7150a 100644
--- a/lib/libes/include/es/TicketBody_V2.h
+++ b/lib/libes/include/nn/es/TicketBody_V2.h
@@ -2,8 +2,10 @@
#include
#include
#include
-#include
+#include
+namespace nn
+{
namespace es
{
class TicketBody_V2 :
@@ -98,5 +100,4 @@ namespace es
uint16_t mSectEntrySize;
};
}
-
-
+}
\ No newline at end of file
diff --git a/lib/libes/include/es/ticket.h b/lib/libes/include/nn/es/ticket.h
similarity index 96%
rename from lib/libes/include/es/ticket.h
rename to lib/libes/include/nn/es/ticket.h
index 689ecce..d2e953d 100644
--- a/lib/libes/include/es/ticket.h
+++ b/lib/libes/include/nn/es/ticket.h
@@ -1,8 +1,10 @@
#pragma once
#include
#include
-#include
+#include
+namespace nn
+{
namespace es
{
namespace ticket
@@ -42,7 +44,7 @@ namespace es
static const size_t kIssuerSize = 0x40;
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 kRightsIdSize = 16;
}
@@ -105,4 +107,5 @@ namespace es
inline uint16_t get_group(uint16_t index) const { return index & kGroupMask; }
};
#pragma pack(pop)
+}
}
\ No newline at end of file
diff --git a/lib/libes/es.vcxproj b/lib/libes/libes.vcxproj
similarity index 89%
rename from lib/libes/es.vcxproj
rename to lib/libes/libes.vcxproj
index ae9f9c3..9c25a22 100644
--- a/lib/libes/es.vcxproj
+++ b/lib/libes/libes.vcxproj
@@ -20,9 +20,7 @@
{7BE99936-0D40-410D-944B-4513C2EFF8DC}
- es
8.1
- libes
@@ -75,7 +73,7 @@
Level3
Disabled
true
- ..\libfnd\include;..\libcrypto\include;..\libes\include;
+ ..\libfnd\include;..\libes\include;
_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
@@ -84,7 +82,7 @@
Level3
Disabled
true
- ..\libfnd\include;..\libcrypto\include;..\libes\include;
+ ..\libfnd\include;..\libes\include;
_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
@@ -95,7 +93,7 @@
true
true
true
- ..\libfnd\include;..\libcrypto\include;..\libes\include;
+ ..\libfnd\include;..\libes\include;
_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
@@ -110,7 +108,7 @@
true
true
true
- ..\libfnd\include;..\libcrypto\include;..\libes\include;
+ ..\libfnd\include;..\libes\include;
_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
@@ -122,9 +120,9 @@
-
-
-
+
+
+
diff --git a/lib/libes/es.vcxproj.filters b/lib/libes/libes.vcxproj.filters
similarity index 88%
rename from lib/libes/es.vcxproj.filters
rename to lib/libes/libes.vcxproj.filters
index f933a32..d55625c 100644
--- a/lib/libes/es.vcxproj.filters
+++ b/lib/libes/libes.vcxproj.filters
@@ -18,13 +18,13 @@
-
+
Header Files
-
+
Header Files
-
+
Header Files
diff --git a/lib/libcompress/libcompress.vcxproj.user b/lib/libes/libes.vcxproj.user
similarity index 100%
rename from lib/libcompress/libcompress.vcxproj.user
rename to lib/libes/libes.vcxproj.user
diff --git a/lib/libes/makefile b/lib/libes/makefile
index ba0b6e8..a6d2bf8 100644
--- a/lib/libes/makefile
+++ b/lib/libes/makefile
@@ -7,7 +7,6 @@ DEPENDS = fnd crypto
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-value
CFLAGS = -std=c11 $(INCS) -Wall -Wno-unused-value
diff --git a/lib/libes/source/SectionHeader_V2.cpp b/lib/libes/source/SectionHeader_V2.cpp
index 2fd18ac..ae5ad04 100644
--- a/lib/libes/source/SectionHeader_V2.cpp
+++ b/lib/libes/source/SectionHeader_V2.cpp
@@ -1,16 +1,14 @@
-#include
+#include
-
-
-es::SectionHeader_V2::SectionHeader_V2()
+nn::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;
}
-void es::SectionHeader_V2::operator=(const SectionHeader_V2 & other)
+void nn::es::SectionHeader_V2::operator=(const SectionHeader_V2 & other)
{
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) \
&& (mRecordSize == other.mRecordSize) \
@@ -36,12 +34,12 @@ bool es::SectionHeader_V2::operator==(const SectionHeader_V2 & other) const
&& (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);
}
-void es::SectionHeader_V2::toBytes()
+void nn::es::SectionHeader_V2::toBytes()
{
mRawBinary.alloc(sizeof(sSectionHeader_v2));
sSectionHeader_v2* hdr = (sSectionHeader_v2*)mRawBinary.data();
@@ -53,7 +51,7 @@ void es::SectionHeader_V2::toBytes()
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))
{
@@ -73,12 +71,12 @@ void es::SectionHeader_V2::fromBytes(const byte_t * bytes, size_t len)
mSectionType = (ticket::SectionType)hdr->section_type.get();
}
-const fnd::Vec& es::SectionHeader_V2::getBytes() const
+const fnd::Vec& nn::es::SectionHeader_V2::getBytes() const
{
return mRawBinary;
}
-void es::SectionHeader_V2::clear()
+void nn::es::SectionHeader_V2::clear()
{
mRawBinary.clear();
mSectionOffset = 0;
@@ -88,52 +86,52 @@ void es::SectionHeader_V2::clear()
mSectionType = ticket::SECTION_PERMANENT;
}
-uint32_t es::SectionHeader_V2::getSectionOffset() const
+uint32_t nn::es::SectionHeader_V2::getSectionOffset() const
{
return mSectionOffset;
}
-void es::SectionHeader_V2::setSectionOffset(uint32_t offset)
+void nn::es::SectionHeader_V2::setSectionOffset(uint32_t offset)
{
mSectionOffset = offset;
}
-uint32_t es::SectionHeader_V2::getRecordSize() const
+uint32_t nn::es::SectionHeader_V2::getRecordSize() const
{
return mRecordSize;
}
-void es::SectionHeader_V2::setRecordSize(uint32_t size)
+void nn::es::SectionHeader_V2::setRecordSize(uint32_t size)
{
mRecordSize = size;
}
-uint32_t es::SectionHeader_V2::getSectionSize() const
+uint32_t nn::es::SectionHeader_V2::getSectionSize() const
{
return mSectionSize;
}
-void es::SectionHeader_V2::getSectionSize(uint32_t size)
+void nn::es::SectionHeader_V2::getSectionSize(uint32_t size)
{
mSectionSize = size;
}
-uint16_t es::SectionHeader_V2::getRecordNum() const
+uint16_t nn::es::SectionHeader_V2::getRecordNum() const
{
return mRecordNum;
}
-void es::SectionHeader_V2::setRecordNum(uint16_t record_num)
+void nn::es::SectionHeader_V2::setRecordNum(uint16_t 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;
}
-void es::SectionHeader_V2::setSectionType(ticket::SectionType type)
+void nn::es::SectionHeader_V2::setSectionType(ticket::SectionType type)
{
mSectionType = type;
}
diff --git a/lib/libes/source/TicketBody_V2.cpp b/lib/libes/source/TicketBody_V2.cpp
index 93816c7..1a5302d 100644
--- a/lib/libes/source/TicketBody_V2.cpp
+++ b/lib/libes/source/TicketBody_V2.cpp
@@ -1,18 +1,16 @@
-#include
+#include
-
-
-es::TicketBody_V2::TicketBody_V2()
+nn::es::TicketBody_V2::TicketBody_V2()
{
clear();
}
-es::TicketBody_V2::TicketBody_V2(const TicketBody_V2 & other)
+nn::es::TicketBody_V2::TicketBody_V2(const TicketBody_V2 & 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())
{
@@ -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) \
&& (memcmp(mEncTitleKey, other.mEncTitleKey, ticket::kEncTitleKeySize) == 0) \
@@ -59,12 +57,12 @@ bool es::TicketBody_V2::operator==(const TicketBody_V2 & other) const
&& (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);
}
-void es::TicketBody_V2::toBytes()
+void nn::es::TicketBody_V2::toBytes()
{
mRawBinary.alloc(sizeof(sTicketBody_v2));
sTicketBody_v2* body = (sTicketBody_v2*)mRawBinary.data();
@@ -94,7 +92,7 @@ void es::TicketBody_V2::toBytes()
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))
{
@@ -134,12 +132,12 @@ void es::TicketBody_V2::fromBytes(const byte_t * bytes, size_t len)
mSectEntrySize = body->sect_entry_size.get();
}
-const fnd::Vec& es::TicketBody_V2::getBytes() const
+const fnd::Vec& nn::es::TicketBody_V2::getBytes() const
{
return mRawBinary;
}
-void es::TicketBody_V2::clear()
+void nn::es::TicketBody_V2::clear()
{
mRawBinary.clear();
mIssuer.clear();
@@ -160,12 +158,12 @@ void es::TicketBody_V2::clear()
mSectEntrySize = 0;
}
-const std::string & es::TicketBody_V2::getIssuer() const
+const std::string & nn::es::TicketBody_V2::getIssuer() const
{
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)
{
@@ -175,154 +173,154 @@ void es::TicketBody_V2::setIssuer(const std::string & issuer)
mIssuer = issuer;
}
-const byte_t * es::TicketBody_V2::getEncTitleKey() const
+const byte_t * nn::es::TicketBody_V2::getEncTitleKey() const
{
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);
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;
}
-void es::TicketBody_V2::setTitleKeyEncType(ticket::TitleKeyEncType type)
+void nn::es::TicketBody_V2::setTitleKeyEncType(ticket::TitleKeyEncType type)
{
mEncType = type;
}
-uint16_t es::TicketBody_V2::getTicketVersion() const
+uint16_t nn::es::TicketBody_V2::getTicketVersion() const
{
return mTicketVersion;
}
-void es::TicketBody_V2::setTicketVersion(uint16_t version)
+void nn::es::TicketBody_V2::setTicketVersion(uint16_t version)
{
mTicketVersion = version;
}
-es::ticket::LicenseType es::TicketBody_V2::getLicenseType() const
+nn::es::ticket::LicenseType nn::es::TicketBody_V2::getLicenseType() const
{
return mLicenseType;
}
-void es::TicketBody_V2::setLicenseType(ticket::LicenseType type)
+void nn::es::TicketBody_V2::setLicenseType(ticket::LicenseType type)
{
mLicenseType = type;
}
-byte_t es::TicketBody_V2::getCommonKeyId() const
+byte_t nn::es::TicketBody_V2::getCommonKeyId() const
{
return mCommonKeyId;
}
-void es::TicketBody_V2::setCommonKeyId(byte_t id)
+void nn::es::TicketBody_V2::setCommonKeyId(byte_t id)
{
mCommonKeyId = id;
}
-const fnd::List& es::TicketBody_V2::getPropertyFlags() const
+const fnd::List& nn::es::TicketBody_V2::getPropertyFlags() const
{
return mPropertyFlags;
}
-void es::TicketBody_V2::setPropertyFlags(const fnd::List& flags)
+void nn::es::TicketBody_V2::setPropertyFlags(const fnd::List& flags)
{
mPropertyFlags = flags;
}
-const byte_t * es::TicketBody_V2::getReservedRegion() const
+const byte_t * nn::es::TicketBody_V2::getReservedRegion() const
{
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);
memcpy(mReservedRegion, data, _MIN(len, ticket::kReservedRegionSize));
}
-uint64_t es::TicketBody_V2::getTicketId() const
+uint64_t nn::es::TicketBody_V2::getTicketId() const
{
return mTicketId;
}
-void es::TicketBody_V2::setTicketId(uint64_t id)
+void nn::es::TicketBody_V2::setTicketId(uint64_t id)
{
mTicketId = id;
}
-uint64_t es::TicketBody_V2::getDeviceId() const
+uint64_t nn::es::TicketBody_V2::getDeviceId() const
{
return mDeviceId;
}
-void es::TicketBody_V2::setDeviceId(uint64_t id)
+void nn::es::TicketBody_V2::setDeviceId(uint64_t id)
{
mDeviceId = id;
}
-const byte_t * es::TicketBody_V2::getRightsId() const
+const byte_t * nn::es::TicketBody_V2::getRightsId() const
{
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);
}
-uint32_t es::TicketBody_V2::getAccountId() const
+uint32_t nn::es::TicketBody_V2::getAccountId() const
{
return mAccountId;
}
-void es::TicketBody_V2::setAccountId(uint32_t id)
+void nn::es::TicketBody_V2::setAccountId(uint32_t id)
{
mAccountId = id;
}
-uint32_t es::TicketBody_V2::getSectionTotalSize() const
+uint32_t nn::es::TicketBody_V2::getSectionTotalSize() const
{
return mSectTotalSize;
}
-void es::TicketBody_V2::setSectionTotalSize(uint32_t size)
+void nn::es::TicketBody_V2::setSectionTotalSize(uint32_t size)
{
mSectTotalSize = size;
}
-uint32_t es::TicketBody_V2::getSectionHeaderOffset() const
+uint32_t nn::es::TicketBody_V2::getSectionHeaderOffset() const
{
return mSectHeaderOffset;
}
-void es::TicketBody_V2::setSectionHeaderOffset(uint32_t offset)
+void nn::es::TicketBody_V2::setSectionHeaderOffset(uint32_t offset)
{
mSectHeaderOffset = offset;
}
-uint16_t es::TicketBody_V2::getSectionNum() const
+uint16_t nn::es::TicketBody_V2::getSectionNum() const
{
return mSectNum;
}
-void es::TicketBody_V2::setSectionNum(uint16_t num)
+void nn::es::TicketBody_V2::setSectionNum(uint16_t num)
{
mSectNum = num;
}
-uint16_t es::TicketBody_V2::getSectionEntrySize() const
+uint16_t nn::es::TicketBody_V2::getSectionEntrySize() const
{
return mSectEntrySize;
}
-void es::TicketBody_V2::setSectionEntrySize(uint16_t size)
+void nn::es::TicketBody_V2::setSectionEntrySize(uint16_t size)
{
mSectEntrySize = size;
}
\ No newline at end of file
diff --git a/lib/libcrypto/include/crypto/aes.h b/lib/libfnd/include/fnd/aes.h
similarity index 99%
rename from lib/libcrypto/include/crypto/aes.h
rename to lib/libfnd/include/fnd/aes.h
index eb78ade..2c3016f 100644
--- a/lib/libcrypto/include/crypto/aes.h
+++ b/lib/libfnd/include/fnd/aes.h
@@ -2,7 +2,7 @@
#include
#include
-namespace crypto
+namespace fnd
{
namespace aes
{
diff --git a/lib/libcrypto/include/crypto/base64.h b/lib/libfnd/include/fnd/base64.h
similarity index 95%
rename from lib/libcrypto/include/crypto/base64.h
rename to lib/libfnd/include/fnd/base64.h
index 67c6ecd..f9bbc08 100644
--- a/lib/libcrypto/include/crypto/base64.h
+++ b/lib/libfnd/include/fnd/base64.h
@@ -2,7 +2,7 @@
#include
#include
-namespace crypto
+namespace fnd
{
namespace base64
{
diff --git a/lib/libcrypto/include/crypto/ecdsa.h b/lib/libfnd/include/fnd/ecdsa.h
similarity index 98%
rename from lib/libcrypto/include/crypto/ecdsa.h
rename to lib/libfnd/include/fnd/ecdsa.h
index 70f2803..e06880e 100644
--- a/lib/libcrypto/include/crypto/ecdsa.h
+++ b/lib/libfnd/include/fnd/ecdsa.h
@@ -2,7 +2,7 @@
#include
#include
-namespace crypto
+namespace fnd
{
namespace ecdsa
{
diff --git a/lib/libcompress/include/compress/lz4.h b/lib/libfnd/include/fnd/lz4.h
similarity index 94%
rename from lib/libcompress/include/compress/lz4.h
rename to lib/libfnd/include/fnd/lz4.h
index 482ee64..2d76857 100644
--- a/lib/libcompress/include/compress/lz4.h
+++ b/lib/libfnd/include/fnd/lz4.h
@@ -1,7 +1,7 @@
#pragma once
#include
-namespace compress
+namespace fnd
{
namespace lz4
{
diff --git a/lib/libcrypto/include/crypto/rsa.h b/lib/libfnd/include/fnd/rsa.h
similarity index 99%
rename from lib/libcrypto/include/crypto/rsa.h
rename to lib/libfnd/include/fnd/rsa.h
index 6588e8c..455fd21 100644
--- a/lib/libcrypto/include/crypto/rsa.h
+++ b/lib/libfnd/include/fnd/rsa.h
@@ -1,9 +1,9 @@
#pragma once
#include
#include
-#include
+#include
-namespace crypto
+namespace fnd
{
namespace rsa
{
diff --git a/lib/libcrypto/include/crypto/sha.h b/lib/libfnd/include/fnd/sha.h
similarity index 99%
rename from lib/libcrypto/include/crypto/sha.h
rename to lib/libfnd/include/fnd/sha.h
index fdd11ea..55d042d 100644
--- a/lib/libcrypto/include/crypto/sha.h
+++ b/lib/libfnd/include/fnd/sha.h
@@ -2,7 +2,7 @@
#include
#include
-namespace crypto
+namespace fnd
{
namespace sha
{
diff --git a/lib/libfnd/fnd.vcxproj b/lib/libfnd/libfnd.vcxproj
similarity index 87%
rename from lib/libfnd/fnd.vcxproj
rename to lib/libfnd/libfnd.vcxproj
index 703f93b..b7d30e7 100644
--- a/lib/libfnd/fnd.vcxproj
+++ b/lib/libfnd/libfnd.vcxproj
@@ -21,9 +21,7 @@
15.0
{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}
- fnd
10.0.15063.0
- libfnd
@@ -76,7 +74,7 @@
Level3
Disabled
true
- ..\libfnd\include;
+ ..\libfnd\include;..\libpolarssl\include;..\liblz4\include;
_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
@@ -85,7 +83,7 @@
Level3
Disabled
true
- ..\libfnd\include;
+ ..\libfnd\include;..\libpolarssl\include;..\liblz4\include;
_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
@@ -96,7 +94,7 @@
true
true
true
- ..\libfnd\include;
+ ..\libfnd\include;..\libpolarssl\include;..\liblz4\include;
_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
@@ -111,7 +109,7 @@
true
true
true
- ..\libfnd\include;
+ ..\libfnd\include;..\libpolarssl\include;..\liblz4\include;
_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
@@ -123,7 +121,10 @@
+
+
+
@@ -131,7 +132,10 @@
+
+
+
@@ -139,9 +143,14 @@
+
+
+
+
+
diff --git a/lib/libfnd/fnd.vcxproj.filters b/lib/libfnd/libfnd.vcxproj.filters
similarity index 73%
rename from lib/libfnd/fnd.vcxproj.filters
rename to lib/libfnd/libfnd.vcxproj.filters
index 5becb28..d13edab 100644
--- a/lib/libfnd/fnd.vcxproj.filters
+++ b/lib/libfnd/libfnd.vcxproj.filters
@@ -18,9 +18,18 @@
+
+ Header Files
+
+
+ Header Files
+
Header Files
+
+ Header Files
+
Header Files
@@ -42,9 +51,18 @@
Header Files
+
+ Header Files
+
Header Files
+
+ Header Files
+
+
+ Header Files
+
Header Files
@@ -62,15 +80,30 @@
+
+ Source Files
+
+
+ Source Files
+
Source Files
Source Files
+
+ Source Files
+
Source Files
+
+ Source Files
+
+
+ Source Files
+
Source Files
diff --git a/lib/libcrypto/crypto.vcxproj.user b/lib/libfnd/libfnd.vcxproj.user
similarity index 100%
rename from lib/libcrypto/crypto.vcxproj.user
rename to lib/libfnd/libfnd.vcxproj.user
diff --git a/lib/libfnd/makefile b/lib/libfnd/makefile
index a5a2c72..73af097 100644
--- a/lib/libfnd/makefile
+++ b/lib/libfnd/makefile
@@ -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)))
# External dependencies
-DEPENDS =
+DEPENDS = polarssl lz4
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-value
CFLAGS = -std=c11 $(INCS) -Wall -Wno-unused-value
diff --git a/lib/libcrypto/source/aes_wrapper.cpp b/lib/libfnd/source/aes_wrapper.cpp
similarity index 70%
rename from lib/libcrypto/source/aes_wrapper.cpp
rename to lib/libfnd/source/aes_wrapper.cpp
index 43f37d7..0013dce 100644
--- a/lib/libcrypto/source/aes_wrapper.cpp
+++ b/lib/libfnd/source/aes_wrapper.cpp
@@ -1,7 +1,7 @@
-#include
+#include
#include
-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])
{
@@ -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_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_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;
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);
}
-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);
@@ -78,21 +78,21 @@ void crypto::aes::AesIncrementCounter(const uint8_t in[kAesBlockSize], size_t bl
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_setkey_dec(&ctx, key, 128);
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_setkey_enc(&ctx, key, 128);
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_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_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);
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];
diff --git a/lib/libfnd/source/base64_wrapper.cpp b/lib/libfnd/source/base64_wrapper.cpp
new file mode 100644
index 0000000..cd3e48b
--- /dev/null
+++ b/lib/libfnd/source/base64_wrapper.cpp
@@ -0,0 +1,30 @@
+#include
+#include
+
+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);
+}
\ No newline at end of file
diff --git a/lib/libfnd/source/lz4_wrapper.cpp b/lib/libfnd/source/lz4_wrapper.cpp
new file mode 100644
index 0000000..7dee71e
--- /dev/null
+++ b/lib/libfnd/source/lz4_wrapper.cpp
@@ -0,0 +1,14 @@
+#include
+#include
+
+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);
+}
+
+
\ No newline at end of file
diff --git a/lib/libcrypto/source/rsa_wrapper.cpp b/lib/libfnd/source/rsa_wrapper.cpp
similarity index 77%
rename from lib/libcrypto/source/rsa_wrapper.cpp
rename to lib/libfnd/source/rsa_wrapper.cpp
index dc2fefc..197a813 100644
--- a/lib/libcrypto/source/rsa_wrapper.cpp
+++ b/lib/libfnd/source/rsa_wrapper.cpp
@@ -1,9 +1,9 @@
-#include
+#include
#include
#include
-using namespace crypto::rsa;
-using namespace crypto::sha;
+using namespace fnd::rsa;
+using namespace fnd::sha;
int getWrappedHashType(HashType type)
{
@@ -57,7 +57,7 @@ uint32_t getWrappedHashSize(HashType type)
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;
rsa_context ctx;
@@ -74,7 +74,7 @@ int crypto::rsa::pkcs::rsaSign(const sRsa1024Key & key, HashType hash_type, cons
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 };
@@ -93,7 +93,7 @@ int crypto::rsa::pkcs::rsaVerify(const sRsa1024Key & key, HashType hash_type, co
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;
rsa_context ctx;
@@ -110,7 +110,7 @@ int crypto::rsa::pkcs::rsaSign(const sRsa2048Key & key, HashType hash_type, cons
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 };
@@ -129,7 +129,7 @@ int crypto::rsa::pkcs::rsaVerify(const sRsa2048Key & key, HashType hash_type, co
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;
rsa_context ctx;
@@ -146,7 +146,7 @@ int crypto::rsa::pkcs::rsaSign(const sRsa4096Key & key, HashType hash_type, cons
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 };
@@ -165,7 +165,7 @@ int crypto::rsa::pkcs::rsaVerify(const sRsa4096Key & key, HashType hash_type, co
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 };
diff --git a/lib/libfnd/source/sha_wrapper.cpp b/lib/libfnd/source/sha_wrapper.cpp
new file mode 100644
index 0000000..a1c7eb4
--- /dev/null
+++ b/lib/libfnd/source/sha_wrapper.cpp
@@ -0,0 +1,15 @@
+#include
+#include
+#include
+
+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);
+}
\ No newline at end of file
diff --git a/lib/libnx-hb/include/nx/AssetHeader.h b/lib/libhac-hb/include/nn/hac/AssetHeader.h
similarity index 95%
rename from lib/libnx-hb/include/nx/AssetHeader.h
rename to lib/libhac-hb/include/nn/hac/AssetHeader.h
index 61deecb..bbef068 100644
--- a/lib/libnx-hb/include/nx/AssetHeader.h
+++ b/lib/libhac-hb/include/nn/hac/AssetHeader.h
@@ -1,9 +1,11 @@
#pragma once
-#include
+#include
#include
#include
-namespace nx
+namespace nn
+{
+namespace hac
{
class AssetHeader :
public fnd::ISerialisable
@@ -66,5 +68,5 @@ namespace nx
sSection mNacpInfo;
sSection mRomfsInfo;
};
-
+}
}
\ No newline at end of file
diff --git a/lib/libnx-hb/include/nx/aset.h b/lib/libhac-hb/include/nn/hac/aset.h
similarity index 88%
rename from lib/libnx-hb/include/nx/aset.h
rename to lib/libhac-hb/include/nn/hac/aset.h
index 9e821cb..f7c1bfd 100644
--- a/lib/libnx-hb/include/nx/aset.h
+++ b/lib/libhac-hb/include/nn/hac/aset.h
@@ -1,8 +1,10 @@
#pragma once
-
#include
-#include
-namespace nx
+#include
+
+namespace nn
+{
+namespace hac
{
namespace aset
{
@@ -27,4 +29,5 @@ namespace nx
sAssetSection romfs;
};
#pragma pack(pop)
+}
}
\ No newline at end of file
diff --git a/lib/libnx-hb/include/nx/nro-hb.h b/lib/libhac-hb/include/nn/hac/nro-hb.h
similarity index 60%
rename from lib/libnx-hb/include/nx/nro-hb.h
rename to lib/libhac-hb/include/nn/hac/nro-hb.h
index 5e5bd05..a1dcc67 100644
--- a/lib/libnx-hb/include/nx/nro-hb.h
+++ b/lib/libhac-hb/include/nn/hac/nro-hb.h
@@ -1,11 +1,14 @@
#pragma once
+#include
+#include
-#include
-#include
-namespace nx
+namespace nn
+{
+namespace hac
{
namespace nro
{
static const uint64_t kNroHomebrewStructMagic = _MAKE_STRUCT_MAGIC_U64("HOMEBREW");
}
+}
}
\ No newline at end of file
diff --git a/lib/libnx-hb/libnx-hb.vcxproj b/lib/libhac-hb/libhac-hb.vcxproj
similarity index 88%
rename from lib/libnx-hb/libnx-hb.vcxproj
rename to lib/libhac-hb/libhac-hb.vcxproj
index 927d5d9..bcee07e 100644
--- a/lib/libnx-hb/libnx-hb.vcxproj
+++ b/lib/libhac-hb/libhac-hb.vcxproj
@@ -21,7 +21,6 @@
15.0
{738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}
- libnxhb
10.0.16299.0
@@ -78,7 +77,7 @@
true
true
true
- ..\libfnd\include;..\libcrypto\include;..\libnx\include;..\libnx-hb\include;
+ ..\libfnd\include;..\libhac\include;..\libhac-hb\include;
true
@@ -91,7 +90,7 @@
Disabled
true
true
- ..\libfnd\include;..\libcrypto\include;..\libnx\include;..\libnx-hb\include;
+ ..\libfnd\include;..\libhac\include;..\libhac-hb\include;
@@ -100,7 +99,7 @@
Disabled
true
true
- ..\libfnd\include;..\libcrypto\include;..\libnx\include;..\libnx-hb\include;
+ ..\libfnd\include;..\libhac\include;..\libhac-hb\include;
@@ -111,7 +110,7 @@
true
true
true
- ..\libfnd\include;..\libcrypto\include;..\libnx\include;..\libnx-hb\include;
+ ..\libfnd\include;..\libhac\include;..\libhac-hb\include;
true
@@ -119,9 +118,9 @@
-
-
-
+
+
+
diff --git a/lib/libnx-hb/libnx-hb.vcxproj.filters b/lib/libhac-hb/libhac-hb.vcxproj.filters
similarity index 88%
rename from lib/libnx-hb/libnx-hb.vcxproj.filters
rename to lib/libhac-hb/libhac-hb.vcxproj.filters
index 01df9d5..02e64c2 100644
--- a/lib/libnx-hb/libnx-hb.vcxproj.filters
+++ b/lib/libhac-hb/libhac-hb.vcxproj.filters
@@ -15,13 +15,13 @@
-
+
Header Files
-
+
Header Files
-
+
Header Files
diff --git a/lib/libes/es.vcxproj.user b/lib/libhac-hb/libhac-hb.vcxproj.user
similarity index 100%
rename from lib/libes/es.vcxproj.user
rename to lib/libhac-hb/libhac-hb.vcxproj.user
diff --git a/lib/libnx-hb/makefile b/lib/libhac-hb/makefile
similarity index 97%
rename from lib/libnx-hb/makefile
rename to lib/libhac-hb/makefile
index f069c2b..c91b3df 100644
--- a/lib/libnx-hb/makefile
+++ b/lib/libhac-hb/makefile
@@ -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)))
# External dependencies
-DEPENDS = fnd crypto nx
+DEPENDS = fnd crypto hac
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-value
CFLAGS = -std=c11 $(INCS) -Wall -Wno-unused-value
diff --git a/lib/libnx-hb/source/AssetHeader.cpp b/lib/libhac-hb/source/AssetHeader.cpp
similarity index 64%
rename from lib/libnx-hb/source/AssetHeader.cpp
rename to lib/libhac-hb/source/AssetHeader.cpp
index 0f8eebb..666ebe0 100644
--- a/lib/libnx-hb/source/AssetHeader.cpp
+++ b/lib/libhac-hb/source/AssetHeader.cpp
@@ -1,16 +1,17 @@
-#include
+#include
+#include
-nx::AssetHeader::AssetHeader()
+nn::hac::AssetHeader::AssetHeader()
{
clear();
}
-nx::AssetHeader::AssetHeader(const AssetHeader& other)
+nn::hac::AssetHeader::AssetHeader(const AssetHeader& other)
{
*this = other;
}
-void nx::AssetHeader::operator=(const AssetHeader& other)
+void nn::hac::AssetHeader::operator=(const AssetHeader& other)
{
mRawBinary = other.mRawBinary;
mIconInfo = other.mIconInfo;
@@ -18,22 +19,22 @@ void nx::AssetHeader::operator=(const AssetHeader& other)
mRomfsInfo = other.mRomfsInfo;
}
-bool nx::AssetHeader::operator==(const AssetHeader& other) const
+bool nn::hac::AssetHeader::operator==(const AssetHeader& other) const
{
return (mIconInfo == other.mIconInfo) \
&& (mNacpInfo == other.mNacpInfo) \
&& (mRomfsInfo == other.mRomfsInfo);
}
-bool nx::AssetHeader::operator!=(const AssetHeader& other) const
+bool nn::hac::AssetHeader::operator!=(const AssetHeader& other) const
{
return !(*this == other);
}
-void nx::AssetHeader::toBytes()
+void nn::hac::AssetHeader::toBytes()
{
mRawBinary.alloc(sizeof(sAssetHeader));
- nx::sAssetHeader* hdr = (nx::sAssetHeader*)mRawBinary.data();
+ nn::hac::sAssetHeader* hdr = (nn::hac::sAssetHeader*)mRawBinary.data();
// set header identifers
hdr->st_magic = aset::kAssetStructMagic;
@@ -52,7 +53,7 @@ void nx::AssetHeader::toBytes()
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
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());
// 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
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();
}
-const fnd::Vec& nx::AssetHeader::getBytes() const
+const fnd::Vec& nn::hac::AssetHeader::getBytes() const
{
return mRawBinary;
}
-void nx::AssetHeader::clear()
+void nn::hac::AssetHeader::clear()
{
mRawBinary.clear();
memset(&mIconInfo, 0, sizeof(mIconInfo));
@@ -103,32 +104,32 @@ void nx::AssetHeader::clear()
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;
}
-void nx::AssetHeader::setIconInfo(const nx::AssetHeader::sSection& info)
+void nn::hac::AssetHeader::setIconInfo(const nn::hac::AssetHeader::sSection& info)
{
mIconInfo = info;
}
-const nx::AssetHeader::sSection& nx::AssetHeader::getNacpInfo() const
+const nn::hac::AssetHeader::sSection& nn::hac::AssetHeader::getNacpInfo() const
{
return mNacpInfo;
}
-void nx::AssetHeader::setNacpInfo(const sSection& info)
+void nn::hac::AssetHeader::setNacpInfo(const sSection& info)
{
mNacpInfo = info;
}
-const nx::AssetHeader::sSection& nx::AssetHeader::getRomfsInfo() const
+const nn::hac::AssetHeader::sSection& nn::hac::AssetHeader::getRomfsInfo() const
{
return mRomfsInfo;
}
-void nx::AssetHeader::setRomfsInfo(const sSection& info)
+void nn::hac::AssetHeader::setRomfsInfo(const sSection& info)
{
mRomfsInfo = info;
}
\ No newline at end of file
diff --git a/lib/libnx/include/nx/AccessControlInfoBinary.h b/lib/libhac/include/nn/hac/AccessControlInfoBinary.h
similarity index 63%
rename from lib/libnx/include/nx/AccessControlInfoBinary.h
rename to lib/libhac/include/nn/hac/AccessControlInfoBinary.h
index f16cc20..3fa1763 100644
--- a/lib/libnx/include/nx/AccessControlInfoBinary.h
+++ b/lib/libhac/include/nn/hac/AccessControlInfoBinary.h
@@ -2,12 +2,14 @@
#include
#include
#include
-#include
-#include
-#include
-#include
+#include
+#include
+#include
+#include
-namespace nx
+namespace nn
+{
+namespace hac
{
class AccessControlInfoBinary : public fnd::ISerialisable
{
@@ -30,13 +32,13 @@ namespace nx
uint64_t getProgramId() const;
void setProgramId(uint64_t program_id);
- const nx::FileSystemAccessControlBinary& getFileSystemAccessControl() const;
+ const nn::hac::FileSystemAccessControlBinary& getFileSystemAccessControl() const;
void setFileSystemAccessControl(const FileSystemAccessControlBinary& fac);
- const nx::ServiceAccessControlBinary& getServiceAccessControl() const;
+ const nn::hac::ServiceAccessControlBinary& getServiceAccessControl() const;
void setServiceAccessControl(const ServiceAccessControlBinary& sac);
- const nx::KernelCapabilityBinary& getKernelCapabilities() const;
+ const nn::hac::KernelCapabilityBinary& getKernelCapabilities() const;
void setKernelCapabilities(const KernelCapabilityBinary& kc);
private:
const std::string kModuleName = "ACCESS_CONTROL_INFO_BINARY";
@@ -46,8 +48,9 @@ namespace nx
// variables
uint64_t mProgramId;
- nx::FileSystemAccessControlBinary mFileSystemAccessControl;
- nx::ServiceAccessControlBinary mServiceAccessControl;
- nx::KernelCapabilityBinary mKernelCapabilities;
+ nn::hac::FileSystemAccessControlBinary mFileSystemAccessControl;
+ nn::hac::ServiceAccessControlBinary mServiceAccessControl;
+ nn::hac::KernelCapabilityBinary mKernelCapabilities;
};
+}
}
\ No newline at end of file
diff --git a/lib/libnx/include/nx/AccessControlInfoDescBinary.h b/lib/libhac/include/nn/hac/AccessControlInfoDescBinary.h
similarity index 65%
rename from lib/libnx/include/nx/AccessControlInfoDescBinary.h
rename to lib/libhac/include/nn/hac/AccessControlInfoDescBinary.h
index 53519a8..df7b004 100644
--- a/lib/libnx/include/nx/AccessControlInfoDescBinary.h
+++ b/lib/libhac/include/nn/hac/AccessControlInfoDescBinary.h
@@ -3,12 +3,14 @@
#include
#include
#include
-#include
-#include
-#include
-#include
+#include
+#include
+#include
+#include
-namespace nx
+namespace nn
+{
+namespace hac
{
class AccessControlInfoDescBinary : public fnd::ISerialisable
{
@@ -48,14 +50,14 @@ namespace nx
void fromBytes(const byte_t* data, size_t len);
const fnd::Vec& getBytes() const;
- void generateSignature(const crypto::rsa::sRsa2048Key& key);
- void validateSignature(const crypto::rsa::sRsa2048Key& key) const;
+ void generateSignature(const fnd::rsa::sRsa2048Key& key);
+ void validateSignature(const fnd::rsa::sRsa2048Key& key) const;
// variables
void clear();
- const crypto::rsa::sRsa2048Key& getNcaHeaderSignature2Key() const;
- void setNcaHeaderSignature2Key(const crypto::rsa::sRsa2048Key& key);
+ const fnd::rsa::sRsa2048Key& getNcaHeaderSignature2Key() const;
+ void setNcaHeaderSignature2Key(const fnd::rsa::sRsa2048Key& key);
const fnd::List& getFlagList() const;
void setFlagList(const fnd::List& flags);
@@ -63,13 +65,13 @@ namespace nx
const sProgramIdRestrict& getProgramIdRestrict() const;
void setProgramIdRestrict(const sProgramIdRestrict& pid_restrict);
- const nx::FileSystemAccessControlBinary& getFileSystemAccessControl() const;
+ const nn::hac::FileSystemAccessControlBinary& getFileSystemAccessControl() const;
void setFileSystemAccessControl(const FileSystemAccessControlBinary& fac);
- const nx::ServiceAccessControlBinary& getServiceAccessControl() const;
+ const nn::hac::ServiceAccessControlBinary& getServiceAccessControl() const;
void setServiceAccessControl(const ServiceAccessControlBinary& sac);
- const nx::KernelCapabilityBinary& getKernelCapabilities() const;
+ const nn::hac::KernelCapabilityBinary& getKernelCapabilities() const;
void setKernelCapabilities(const KernelCapabilityBinary& kc);
private:
const std::string kModuleName = "ACCESS_CONTROL_INFO_DESC_BINARY";
@@ -78,11 +80,12 @@ namespace nx
fnd::Vec mRawBinary;
// variables
- crypto::rsa::sRsa2048Key mNcaHeaderSignature2Key;
+ fnd::rsa::sRsa2048Key mNcaHeaderSignature2Key;
fnd::List mFlags;
sProgramIdRestrict mProgramIdRestrict;
- nx::FileSystemAccessControlBinary mFileSystemAccessControl;
- nx::ServiceAccessControlBinary mServiceAccessControl;
- nx::KernelCapabilityBinary mKernelCapabilities;
+ nn::hac::FileSystemAccessControlBinary mFileSystemAccessControl;
+ nn::hac::ServiceAccessControlBinary mServiceAccessControl;
+ nn::hac::KernelCapabilityBinary mKernelCapabilities;
};
+}
}
\ No newline at end of file
diff --git a/lib/libnx/include/nx/AesKeygen.h b/lib/libhac/include/nn/hac/AesKeygen.h
similarity index 92%
rename from lib/libnx/include/nx/AesKeygen.h
rename to lib/libhac/include/nn/hac/AesKeygen.h
index 64333a0..e3caef6 100644
--- a/lib/libnx/include/nx/AesKeygen.h
+++ b/lib/libhac/include/nn/hac/AesKeygen.h
@@ -1,9 +1,11 @@
#pragma once
#include
#include
-#include
+#include
-namespace nx
+namespace nn
+{
+namespace hac
{
class AesKeygen
{
@@ -16,4 +18,5 @@ namespace nx
// 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);
};
+}
}
\ No newline at end of file
diff --git a/lib/libnx/include/nx/ApplicationControlPropertyBinary.h b/lib/libhac/include/nn/hac/ApplicationControlPropertyBinary.h
similarity index 98%
rename from lib/libnx/include/nx/ApplicationControlPropertyBinary.h
rename to lib/libhac/include/nn/hac/ApplicationControlPropertyBinary.h
index ae28816..af69e42 100644
--- a/lib/libnx/include/nx/ApplicationControlPropertyBinary.h
+++ b/lib/libhac/include/nn/hac/ApplicationControlPropertyBinary.h
@@ -3,9 +3,11 @@
#include
#include
#include
-#include
+#include
-namespace nx
+namespace nn
+{
+namespace hac
{
class ApplicationControlPropertyBinary :
public fnd::ISerialisable
@@ -229,7 +231,7 @@ namespace nx
nacp::TouchScreenUsageMode mTouchScreenUsageMode;
nacp::AocRegistrationType mAocRegistrationType;
nacp::AttributeFlag mAttributeFlag;
- fnd::List mSupportedLanguages;
+ fnd::List mSupportedLanguages;
nacp::ParentalControlFlag mParentalControlFlag;
nacp::ScreenshotMode mScreenshotMode;
nacp::VideoCaptureMode mVideoCaptureMode;
@@ -263,4 +265,5 @@ namespace nx
nacp::RepairFlag mRepairFlag;
byte_t mProgramIndex;
};
+}
}
\ No newline at end of file
diff --git a/lib/libnx/include/nx/ApplicationControlPropertyUtils.h b/lib/libhac/include/nn/hac/ApplicationControlPropertyUtils.h
similarity index 77%
rename from lib/libnx/include/nx/ApplicationControlPropertyUtils.h
rename to lib/libhac/include/nn/hac/ApplicationControlPropertyUtils.h
index e6be804..9955de3 100644
--- a/lib/libnx/include/nx/ApplicationControlPropertyUtils.h
+++ b/lib/libhac/include/nn/hac/ApplicationControlPropertyUtils.h
@@ -1,7 +1,9 @@
#pragma once
-#include
+#include
-namespace nx
+namespace nn
+{
+namespace hac
{
class ApplicationControlPropertyUtils
{
@@ -9,4 +11,5 @@ namespace nx
static bool validateSaveDataSizeMax(int64_t size, int64_t alignment);
static bool validateSaveDataSize(int64_t size);
};
+}
}
\ No newline at end of file
diff --git a/lib/libnx/include/nx/ContentMetaBinary.h b/lib/libhac/include/nn/hac/ContentMetaBinary.h
similarity index 90%
rename from lib/libnx/include/nx/ContentMetaBinary.h
rename to lib/libhac/include/nn/hac/ContentMetaBinary.h
index 59eee5d..84f5d9c 100644
--- a/lib/libnx/include/nx/ContentMetaBinary.h
+++ b/lib/libhac/include/nn/hac/ContentMetaBinary.h
@@ -1,11 +1,13 @@
#pragma once
#include
+#include
#include
#include
-#include
+#include
-
-namespace nx
+namespace nn
+{
+namespace hac
{
class ContentMetaBinary :
public fnd::ISerialisable
@@ -13,7 +15,7 @@ namespace nx
public:
struct ContentInfo
{
- crypto::sha::sSha256Hash hash;
+ fnd::sha::sSha256Hash hash;
byte_t nca_id[cnmt::kContentIdLen];
size_t size;
cnmt::ContentType type;
@@ -200,17 +202,17 @@ namespace nx
const DeltaMetaExtendedHeader& getDeltaMetaExtendedHeader() const;
void setDeltaMetaExtendedHeader(const DeltaMetaExtendedHeader& exhdr);
- const fnd::List& getContentInfo() const;
- void setContentInfo(const fnd::List& info);
+ const fnd::List& getContentInfo() const;
+ void setContentInfo(const fnd::List& info);
- const fnd::List& getContentMetaInfo() const;
- void setContentMetaInfo(const fnd::List& info);
+ const fnd::List& getContentMetaInfo() const;
+ void setContentMetaInfo(const fnd::List& info);
const fnd::Vec& getExtendedData() const;
void setExtendedData(const fnd::Vec& data);
- const nx::sDigest& getDigest() const;
- void setDigest(const nx::sDigest& digest);
+ const nn::hac::sDigest& getDigest() const;
+ void setDigest(const nn::hac::sDigest& digest);
private:
@@ -232,10 +234,10 @@ namespace nx
AddOnContentMetaExtendedHeader mAddOnContentMetaExtendedHeader;
DeltaMetaExtendedHeader mDeltaMetaExtendedHeader;
- fnd::List mContentInfo;
- fnd::List mContentMetaInfo;
+ fnd::List mContentInfo;
+ fnd::List mContentMetaInfo;
fnd::Vec mExtendedData;
- nx::sDigest mDigest;
+ nn::hac::sDigest mDigest;
inline size_t getExtendedHeaderOffset() const { return sizeof(sContentMetaHeader); }
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;
void validateBinary(const byte_t* bytes, size_t len) const;
};
+}
}
\ No newline at end of file
diff --git a/lib/libnx/include/nx/FileSystemAccessControlBinary.h b/lib/libhac/include/nn/hac/FileSystemAccessControlBinary.h
similarity index 94%
rename from lib/libnx/include/nx/FileSystemAccessControlBinary.h
rename to lib/libhac/include/nn/hac/FileSystemAccessControlBinary.h
index 90d6663..dbf898a 100644
--- a/lib/libnx/include/nx/FileSystemAccessControlBinary.h
+++ b/lib/libhac/include/nn/hac/FileSystemAccessControlBinary.h
@@ -3,17 +3,18 @@
#include
#include
#include
-#include
+#include
-
-namespace nx
+namespace nn
+{
+namespace hac
{
class FileSystemAccessControlBinary : public fnd::ISerialisable
{
public:
struct sSaveDataOwnerId
{
- nx::fac::SaveDataOwnerIdAccessType access_type;
+ nn::hac::fac::SaveDataOwnerIdAccessType access_type;
uint64_t id;
void operator=(const sSaveDataOwnerId& other)
@@ -72,4 +73,5 @@ namespace nx
fnd::List mContentOwnerIdList;
fnd::List mSaveDataOwnerIdList;
};
+}
}
\ No newline at end of file
diff --git a/lib/libnx/include/nx/HandleTableSizeEntry.h b/lib/libhac/include/nn/hac/HandleTableSizeEntry.h
similarity index 94%
rename from lib/libnx/include/nx/HandleTableSizeEntry.h
rename to lib/libhac/include/nn/hac/HandleTableSizeEntry.h
index 18c92e8..5ef89df 100644
--- a/lib/libnx/include/nx/HandleTableSizeEntry.h
+++ b/lib/libhac/include/nn/hac/HandleTableSizeEntry.h
@@ -1,9 +1,11 @@
#pragma once
#include
#include
-#include
+#include
-namespace nx
+namespace nn
+{
+namespace hac
{
class HandleTableSizeEntry
{
@@ -44,4 +46,5 @@ namespace nx
mHandleTableSize = field & kMaxHandleTableSize;
}
};
+}
}
\ No newline at end of file
diff --git a/lib/libnx/include/nx/HandleTableSizeHandler.h b/lib/libhac/include/nn/hac/HandleTableSizeHandler.h
similarity index 87%
rename from lib/libnx/include/nx/HandleTableSizeHandler.h
rename to lib/libhac/include/nn/hac/HandleTableSizeHandler.h
index 3094df8..200036d 100644
--- a/lib/libnx/include/nx/HandleTableSizeHandler.h
+++ b/lib/libhac/include/nn/hac/HandleTableSizeHandler.h
@@ -1,8 +1,10 @@
#pragma once
-#include
-#include
+#include
+#include
-namespace nx
+namespace nn
+{
+namespace hac
{
class HandleTableSizeHandler :
public IKernelCapabilityHandler
@@ -32,4 +34,4 @@ namespace nx
HandleTableSizeEntry mEntry;
};
}
-
+}
\ No newline at end of file
diff --git a/lib/libnx/include/nx/HierarchicalIntegrityHeader.h b/lib/libhac/include/nn/hac/HierarchicalIntegrityHeader.h
similarity index 81%
rename from lib/libnx/include/nx/HierarchicalIntegrityHeader.h
rename to lib/libhac/include/nn/hac/HierarchicalIntegrityHeader.h
index b0d0945..953b225 100644
--- a/lib/libnx/include/nx/HierarchicalIntegrityHeader.h
+++ b/lib/libhac/include/nn/hac/HierarchicalIntegrityHeader.h
@@ -1,10 +1,12 @@
#pragma once
-#include
+#include
#include
#include
-#include
+#include
-namespace nx
+namespace nn
+{
+namespace hac
{
class HierarchicalIntegrityHeader :
public fnd::ISerialisable
@@ -52,8 +54,8 @@ namespace nx
const fnd::List& getLayerInfo() const;
void setLayerInfo(const fnd::List& layer_info);
- const fnd::List& getMasterHashList() const;
- void setMasterHashList(const fnd::List& master_hash_list);
+ const fnd::List& getMasterHashList() const;
+ void setMasterHashList(const fnd::List& master_hash_list);
private:
const std::string kModuleName = "HIERARCHICAL_INTEGRITY_HEADER";
@@ -62,7 +64,7 @@ namespace nx
// data
fnd::List mLayerInfo;
- fnd::List mMasterHashList;
+ fnd::List mMasterHashList;
};
-
+}
}
\ No newline at end of file
diff --git a/lib/libnx/include/nx/HierarchicalSha256Header.h b/lib/libhac/include/nn/hac/HierarchicalSha256Header.h
similarity index 85%
rename from lib/libnx/include/nx/HierarchicalSha256Header.h
rename to lib/libhac/include/nn/hac/HierarchicalSha256Header.h
index 4082916..fe38b87 100644
--- a/lib/libnx/include/nx/HierarchicalSha256Header.h
+++ b/lib/libhac/include/nn/hac/HierarchicalSha256Header.h
@@ -1,9 +1,11 @@
#pragma once
-#include
+#include
#include
#include
-namespace nx
+namespace nn
+{
+namespace hac
{
class HierarchicalSha256Header :
public fnd::ISerialisable
@@ -46,8 +48,8 @@ namespace nx
// variables
void clear();
- const crypto::sha::sSha256Hash& getMasterHash() const;
- void setMasterHash(const crypto::sha::sSha256Hash& master_hash);
+ const fnd::sha::sSha256Hash& getMasterHash() const;
+ void setMasterHash(const fnd::sha::sSha256Hash& master_hash);
size_t getHashBlockSize() const;
void setHashBlockSize(size_t hash_block_size);
@@ -61,9 +63,9 @@ namespace nx
fnd::Vec mRawBinary;
// data
- crypto::sha::sSha256Hash mMasterHash;
+ fnd::sha::sSha256Hash mMasterHash;
size_t mHashBlockSize;
fnd::List mLayerInfo;
};
-
+}
}
\ No newline at end of file
diff --git a/lib/libnx/include/nx/IKernelCapabilityHandler.h b/lib/libhac/include/nn/hac/IKernelCapabilityHandler.h
similarity index 83%
rename from lib/libnx/include/nx/IKernelCapabilityHandler.h
rename to lib/libhac/include/nn/hac/IKernelCapabilityHandler.h
index ad117c4..7437465 100644
--- a/lib/libnx/include/nx/IKernelCapabilityHandler.h
+++ b/lib/libhac/include/nn/hac/IKernelCapabilityHandler.h
@@ -1,9 +1,11 @@
#pragma once
#include
#include
-#include
+#include
-namespace nx
+namespace nn
+{
+namespace hac
{
class IKernelCapabilityHandler
{
@@ -14,4 +16,4 @@ namespace nx
virtual bool isSet() const = 0;
};
}
-
+}
\ No newline at end of file
diff --git a/lib/libnx/include/nx/InteruptEntry.h b/lib/libhac/include/nn/hac/InteruptEntry.h
similarity index 95%
rename from lib/libnx/include/nx/InteruptEntry.h
rename to lib/libhac/include/nn/hac/InteruptEntry.h
index 7633281..9998fb6 100644
--- a/lib/libnx/include/nx/InteruptEntry.h
+++ b/lib/libhac/include/nn/hac/InteruptEntry.h
@@ -1,9 +1,11 @@
#pragma once
#include
#include
-#include
+#include
-namespace nx
+namespace nn
+{
+namespace hac
{
class InteruptEntry
{
@@ -52,5 +54,5 @@ namespace nx
mInterupt[1] = (field >> kInteruptBits) & kInteruptMax;
}
};
-
+}
}
diff --git a/lib/libnx/include/nx/InteruptHandler.h b/lib/libhac/include/nn/hac/InteruptHandler.h
similarity index 87%
rename from lib/libnx/include/nx/InteruptHandler.h
rename to lib/libhac/include/nn/hac/InteruptHandler.h
index 529886f..156b992 100644
--- a/lib/libnx/include/nx/InteruptHandler.h
+++ b/lib/libhac/include/nn/hac/InteruptHandler.h
@@ -1,8 +1,10 @@
#pragma once
-#include
-#include
+#include
+#include
-namespace nx
+namespace nn
+{
+namespace hac
{
class InteruptHandler :
public IKernelCapabilityHandler
@@ -31,4 +33,4 @@ namespace nx
fnd::List mInterupts;
};
}
-
+}
\ No newline at end of file
diff --git a/lib/libnx/include/nx/KernelCapabilityBinary.h b/lib/libhac/include/nn/hac/KernelCapabilityBinary.h
similarity index 84%
rename from lib/libnx/include/nx/KernelCapabilityBinary.h
rename to lib/libhac/include/nn/hac/KernelCapabilityBinary.h
index d5369a3..72869c3 100644
--- a/lib/libnx/include/nx/KernelCapabilityBinary.h
+++ b/lib/libhac/include/nn/hac/KernelCapabilityBinary.h
@@ -3,16 +3,18 @@
#include
#include
#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
-namespace nx
+namespace nn
+{
+namespace hac
{
class KernelCapabilityBinary :
public fnd::ISerialisable
@@ -73,4 +75,4 @@ namespace nx
MiscFlagsHandler mMiscFlags;
};
}
-
+}
\ No newline at end of file
diff --git a/lib/libnx/include/nx/KernelCapabilityEntry.h b/lib/libhac/include/nn/hac/KernelCapabilityEntry.h
similarity index 95%
rename from lib/libnx/include/nx/KernelCapabilityEntry.h
rename to lib/libhac/include/nn/hac/KernelCapabilityEntry.h
index 9be2761..e8711e3 100644
--- a/lib/libnx/include/nx/KernelCapabilityEntry.h
+++ b/lib/libhac/include/nn/hac/KernelCapabilityEntry.h
@@ -1,8 +1,10 @@
#pragma once
#include
-#include
+#include
-namespace nx
+namespace nn
+{
+namespace hac
{
class KernelCapabilityEntry
{
@@ -47,4 +49,4 @@ namespace nx
}
};
}
-
+}
\ No newline at end of file
diff --git a/lib/libnx/include/nx/KernelVersionEntry.h b/lib/libhac/include/nn/hac/KernelVersionEntry.h
similarity index 95%
rename from lib/libnx/include/nx/KernelVersionEntry.h
rename to lib/libhac/include/nn/hac/KernelVersionEntry.h
index d0b339b..ed52714 100644
--- a/lib/libnx/include/nx/KernelVersionEntry.h
+++ b/lib/libhac/include/nn/hac/KernelVersionEntry.h
@@ -1,9 +1,11 @@
#pragma once
#include
#include
-#include
+#include
-namespace nx
+namespace nn
+{
+namespace hac
{
class KernelVersionEntry
{
@@ -53,4 +55,4 @@ namespace nx
}
};
}
-
+}
\ No newline at end of file
diff --git a/lib/libnx/include/nx/KernelVersionHandler.h b/lib/libhac/include/nn/hac/KernelVersionHandler.h
similarity index 88%
rename from lib/libnx/include/nx/KernelVersionHandler.h
rename to lib/libhac/include/nn/hac/KernelVersionHandler.h
index be9cc2e..fe43226 100644
--- a/lib/libnx/include/nx/KernelVersionHandler.h
+++ b/lib/libhac/include/nn/hac/KernelVersionHandler.h
@@ -1,8 +1,10 @@
#pragma once
-#include
-#include
+#include
+#include
-namespace nx
+namespace nn
+{
+namespace hac
{
class KernelVersionHandler :
public IKernelCapabilityHandler
@@ -34,4 +36,4 @@ namespace nx
KernelVersionEntry mEntry;
};
}
-
+}
\ No newline at end of file
diff --git a/lib/libnx/include/nx/MemoryMappingHandler.h b/lib/libhac/include/nn/hac/MemoryMappingHandler.h
similarity index 95%
rename from lib/libnx/include/nx/MemoryMappingHandler.h
rename to lib/libhac/include/nn/hac/MemoryMappingHandler.h
index 9b5e0d4..d4d73d7 100644
--- a/lib/libnx/include/nx/MemoryMappingHandler.h
+++ b/lib/libhac/include/nn/hac/MemoryMappingHandler.h
@@ -1,7 +1,9 @@
#pragma once
-#include
+#include
-namespace nx
+namespace nn
+{
+namespace hac
{
class MemoryMappingHandler :
public IKernelCapabilityHandler
@@ -75,4 +77,4 @@ namespace nx
fnd::List mMemPage;
};
}
-
+}
\ No newline at end of file
diff --git a/lib/libnx/include/nx/MemoryPageEntry.h b/lib/libhac/include/nn/hac/MemoryPageEntry.h
similarity index 95%
rename from lib/libnx/include/nx/MemoryPageEntry.h
rename to lib/libhac/include/nn/hac/MemoryPageEntry.h
index 9fc4536..368b233 100644
--- a/lib/libnx/include/nx/MemoryPageEntry.h
+++ b/lib/libhac/include/nn/hac/MemoryPageEntry.h
@@ -1,9 +1,11 @@
#pragma once
#include
#include
-#include
+#include
-namespace nx
+namespace nn
+{
+namespace hac
{
class MemoryPageEntry
{
@@ -56,5 +58,5 @@ namespace nx
mUseFlag = mCap.getType() == kc::KC_MEMORY_MAP;
}
};
-
}
+}
\ No newline at end of file
diff --git a/lib/libnx/include/nx/MiscFlagsEntry.h b/lib/libhac/include/nn/hac/MiscFlagsEntry.h
similarity index 93%
rename from lib/libnx/include/nx/MiscFlagsEntry.h
rename to lib/libhac/include/nn/hac/MiscFlagsEntry.h
index 34167e0..359589c 100644
--- a/lib/libnx/include/nx/MiscFlagsEntry.h
+++ b/lib/libhac/include/nn/hac/MiscFlagsEntry.h
@@ -1,9 +1,11 @@
#pragma once
#include
#include
-#include
+#include
-namespace nx
+namespace nn
+{
+namespace hac
{
class MiscFlagsEntry
{
@@ -44,5 +46,5 @@ namespace nx
mFlags = field & kMaxVal;
}
};
-
}
+}
\ No newline at end of file
diff --git a/lib/libnx/include/nx/MiscFlagsHandler.h b/lib/libhac/include/nn/hac/MiscFlagsHandler.h
similarity index 90%
rename from lib/libnx/include/nx/MiscFlagsHandler.h
rename to lib/libhac/include/nn/hac/MiscFlagsHandler.h
index 41d3bf9..8351120 100644
--- a/lib/libnx/include/nx/MiscFlagsHandler.h
+++ b/lib/libhac/include/nn/hac/MiscFlagsHandler.h
@@ -1,8 +1,10 @@
#pragma once
-#include
-#include
+#include
+#include
-namespace nx
+namespace nn
+{
+namespace hac
{
class MiscFlagsHandler :
public IKernelCapabilityHandler
@@ -51,5 +53,5 @@ namespace nx
bool mIsSet;
fnd::List mFlags;
};
-
}
+}
\ No newline at end of file
diff --git a/lib/libnx/include/nx/MiscParamsEntry.h b/lib/libhac/include/nn/hac/MiscParamsEntry.h
similarity index 93%
rename from lib/libnx/include/nx/MiscParamsEntry.h
rename to lib/libhac/include/nn/hac/MiscParamsEntry.h
index 04b5cc0..0925d16 100644
--- a/lib/libnx/include/nx/MiscParamsEntry.h
+++ b/lib/libhac/include/nn/hac/MiscParamsEntry.h
@@ -1,9 +1,11 @@
#pragma once
#include
#include
-#include
+#include
-namespace nx
+namespace nn
+{
+namespace hac
{
class MiscParamsEntry
{
@@ -44,6 +46,5 @@ namespace nx
mProgramType = field & kMaxProgramType;
}
};
-
-
+}
}
\ No newline at end of file
diff --git a/lib/libnx/include/nx/MiscParamsHandler.h b/lib/libhac/include/nn/hac/MiscParamsHandler.h
similarity index 87%
rename from lib/libnx/include/nx/MiscParamsHandler.h
rename to lib/libhac/include/nn/hac/MiscParamsHandler.h
index b88b522..063a22c 100644
--- a/lib/libnx/include/nx/MiscParamsHandler.h
+++ b/lib/libhac/include/nn/hac/MiscParamsHandler.h
@@ -1,8 +1,10 @@
#pragma once
-#include
-#include
+#include
+#include
-namespace nx
+namespace nn
+{
+namespace hac
{
class MiscParamsHandler :
public IKernelCapabilityHandler
@@ -32,4 +34,4 @@ namespace nx
MiscParamsEntry mEntry;
};
}
-
+}
\ No newline at end of file
diff --git a/lib/libnx/include/nx/NcaHeader.h b/lib/libhac/include/nn/hac/NcaHeader.h
similarity index 89%
rename from lib/libnx/include/nx/NcaHeader.h
rename to lib/libhac/include/nn/hac/NcaHeader.h
index 6a2f1fe..0ddbe76 100644
--- a/lib/libnx/include/nx/NcaHeader.h
+++ b/lib/libhac/include/nn/hac/NcaHeader.h
@@ -1,9 +1,11 @@
#pragma once
-#include
+#include
#include
#include
-namespace nx
+namespace nn
+{
+namespace hac
{
class NcaHeader :
public fnd::ISerialisable
@@ -20,7 +22,7 @@ namespace nx
byte_t index;
uint64_t offset;
uint64_t size;
- crypto::sha::sSha256Hash hash;
+ fnd::sha::sSha256Hash hash;
const sPartition& operator=(const sPartition& other)
{
@@ -53,9 +55,6 @@ namespace nx
bool operator==(const NcaHeader& other) const;
bool operator!=(const NcaHeader& other) const;
- // to be used after export
- size_t getSize() const;
-
// export/import binary
void toBytes();
void fromBytes(const byte_t* bytes, size_t len);
@@ -86,8 +85,8 @@ namespace nx
void setRightsId(const byte_t* rights_id);
const fnd::List& getPartitions() const;
void setPartitions(const fnd::List& partitions);
- const fnd::List& getEncAesKeys() const;
- void setEncAesKeys(const fnd::List& keys);
+ const fnd::List& getEncAesKeys() const;
+ void setEncAesKeys(const fnd::List& keys);
private:
const std::string kModuleName = "NCA_HEADER";
@@ -107,10 +106,10 @@ namespace nx
uint32_t mSdkAddonVersion;
byte_t mRightsId[nca::kRightsIdLen];
fnd::List mPartitions;
- fnd::List mEncAesKeys;
+ fnd::List