Move Mbed TLS to submodule + Update Java Libraries

We've moved from using an AAR for Mbed TLS to a submodule as the AAR was packaged manually and used from a local repository which ended up being very hacky and resulted in Linter errors, it could also not be updated with ease as it would need to be repackaged. All of these issues have been solved by moving to a git submodule tied to the official Mbed TLS GitHub repository.
This commit is contained in:
PixelyIon 2021-07-11 23:47:59 +05:30 committed by ◱ Mark
parent ec1da1b3f5
commit 1ad5ea6867
8 changed files with 15 additions and 78 deletions

3
.gitmodules vendored
View File

@ -28,3 +28,6 @@
[submodule "app/libraries/vkma"] [submodule "app/libraries/vkma"]
path = app/libraries/vkma path = app/libraries/vkma
url = https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator url = https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
[submodule "app/libraries/mbedtls"]
path = app/libraries/mbedtls
url = https://github.com/ARMmbed/mbedtls

View File

@ -1,45 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="BintrayJCenter" />
<option name="name" value="BintrayJCenter" />
<option name="url" value="https://jcenter.bintray.com/" />
</remote-repository>
<remote-repository>
<option name="id" value="Google" />
<option name="name" value="Google" />
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
</remote-repository>
<remote-repository>
<option name="id" value="MavenRepo" />
<option name="name" value="MavenRepo" />
<option name="url" value="https://repo.maven.apache.org/maven2/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven" />
<option name="name" value="maven" />
<option name="url" value="file:/$PROJECT_DIR$/app/libraries/" />
</remote-repository>
<remote-repository>
<option name="id" value="MavenLocal" />
<option name="name" value="MavenLocal" />
<option name="url" value="file:/$USER_HOME$/.m2/repository/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven" />
<option name="name" value="maven" />
<option name="url" value="https://google.bintray.com/flexbox-layout" />
</remote-repository>
</component>
</project>

View File

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
<mapping directory="$PROJECT_DIR$/app/libraries/fmt" vcs="Git" />
<mapping directory="$PROJECT_DIR$/app/libraries/frozen" vcs="Git" />
<mapping directory="$PROJECT_DIR$/app/libraries/lz4" vcs="Git" />
<mapping directory="$PROJECT_DIR$/app/libraries/oboe" vcs="Git" />
<mapping directory="$PROJECT_DIR$/app/libraries/perfetto" vcs="Git" />
<mapping directory="$PROJECT_DIR$/app/libraries/pugixml" vcs="Git" />
<mapping directory="$PROJECT_DIR$/app/libraries/tzcode" vcs="Git" />
<mapping directory="$PROJECT_DIR$/app/libraries/vkhpp" vcs="Git" />
<mapping directory="$PROJECT_DIR$/app/libraries/vkhpp/Vulkan-Headers" vcs="Git" />
<mapping directory="$PROJECT_DIR$/app/libraries/vkhpp/glfw" vcs="Git" />
<mapping directory="$PROJECT_DIR$/app/libraries/vkhpp/glm" vcs="Git" />
<mapping directory="$PROJECT_DIR$/app/libraries/vkhpp/glslang" vcs="Git" />
<mapping directory="$PROJECT_DIR$/app/libraries/vkhpp/tinyxml2" vcs="Git" />
<mapping directory="$PROJECT_DIR$/app/libraries/vkma" vcs="Git" />
</component>
</project>

View File

@ -53,7 +53,11 @@ include_directories("libraries/pugixml/src")
include_directories("libraries/frozen/include") include_directories("libraries/frozen/include")
# MbedTLS # MbedTLS
find_package(mbedtls REQUIRED CONFIG) set(ENABLE_TESTING OFF CACHE BOOL "Build mbed TLS tests." FORCE)
set(ENABLE_PROGRAMS OFF CACHE BOOL "Build mbed TLS programs." FORCE)
set(UNSAFE_BUILD ON CACHE BOOL "Allow unsafe builds. These builds ARE NOT SECURE." FORCE)
add_subdirectory("libraries/mbedtls")
include_directories("libraries/mbedtls/include")
# Perfetto SDK # Perfetto SDK
include_directories(libraries/perfetto/sdk) include_directories(libraries/perfetto/sdk)
@ -213,5 +217,5 @@ add_library(skyline SHARED
${source_DIR}/skyline/services/mmnv/IRequest.cpp ${source_DIR}/skyline/services/mmnv/IRequest.cpp
) )
# target_precompile_headers(skyline PRIVATE ${source_DIR}/skyline/common.h) # PCH will currently break Intellisense # target_precompile_headers(skyline PRIVATE ${source_DIR}/skyline/common.h) # PCH will currently break Intellisense
target_link_libraries(skyline android perfetto fmt lz4_static tzcode oboe vkma mbedtls::mbedcrypto) target_link_libraries(skyline android perfetto fmt lz4_static tzcode oboe vkma mbedcrypto)
target_compile_options(skyline PRIVATE -Wall -Wno-unknown-attributes -Wno-c++20-extensions -Wno-c++17-extensions -Wno-c99-designator -Wno-reorder -Wno-missing-braces -Wno-unused-variable -Wno-unused-private-field) target_compile_options(skyline PRIVATE -Wall -Wno-unknown-attributes -Wno-c++20-extensions -Wno-c++17-extensions -Wno-c99-designator -Wno-reorder -Wno-missing-braces -Wno-unused-variable -Wno-unused-private-field)

View File

@ -110,20 +110,17 @@ afterEvaluate {
} }
dependencies { dependencies {
/* Filetrees */
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
/* Google */ /* Google */
implementation "androidx.core:core-ktx:1.3.2" implementation "androidx.core:core-ktx:1.6.0"
implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4' implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.preference:preference-ktx:1.1.1' implementation 'androidx.preference:preference-ktx:1.1.1'
implementation 'com.google.android.material:material:1.3.0' implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.documentfile:documentfile:1.0.1' implementation 'androidx.documentfile:documentfile:1.0.1'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
implementation 'androidx.fragment:fragment-ktx:1.3.2' implementation 'androidx.fragment:fragment-ktx:1.3.5'
implementation "com.google.dagger:hilt-android:$hilt_version" implementation "com.google.dagger:hilt-android:$hilt_version"
kapt "com.google.dagger:hilt-android-compiler:$hilt_version" kapt "com.google.dagger:hilt-android-compiler:$hilt_version"
implementation 'com.google.android:flexbox:2.0.1' implementation 'com.google.android:flexbox:2.0.1'
@ -133,7 +130,4 @@ dependencies {
/* Other Java */ /* Other Java */
implementation 'info.debatty:java-string-similarity:2.0.0' implementation 'info.debatty:java-string-similarity:2.0.0'
/* NDK */
implementation files("libraries/mbedtls.aar")
} }

1
app/libraries/mbedtls Submodule

@ -0,0 +1 @@
Subproject commit 8df2f8e7b9c7bb9390ac74bb7bace27edca81a2b

Binary file not shown.

View File

@ -47,7 +47,7 @@ namespace skyline::service::am {
// On HOS the seed from control.ncap is hashed together with the device specific device ID seed // On HOS the seed from control.ncap is hashed together with the device specific device ID seed
// for us it's enough to just hash the seed from control.nacp as it provides the same guarantees // for us it's enough to just hash the seed from control.nacp as it provides the same guarantees
if (int err{mbedtls_sha1_ret(seedForPseudoDeviceId.data(), seedForPseudoDeviceId.size(), hashBuf.data())}; err < 0) if (int err{mbedtls_sha1(seedForPseudoDeviceId.data(), seedForPseudoDeviceId.size(), hashBuf.data())}; err < 0)
throw exception("Failed to hash device ID, err: {}", err); throw exception("Failed to hash device ID, err: {}", err);
response.Push<UUID>(UUID::GenerateUuidV5(hashBuf)); response.Push<UUID>(UUID::GenerateUuidV5(hashBuf));