Skip to content

Commit

Permalink
Move Mbed TLS to submodule + Update Java Libraries
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
PixelyIon committed Jul 12, 2021
1 parent ec1da1b commit 1ad5ea6
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 78 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@
[submodule "app/libraries/vkma"]
path = app/libraries/vkma
url = https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
[submodule "app/libraries/mbedtls"]
path = app/libraries/mbedtls
url = https://github.com/ARMmbed/mbedtls
45 changes: 0 additions & 45 deletions .idea/jarRepositories.xml

This file was deleted.

20 changes: 0 additions & 20 deletions .idea/vcs.xml

This file was deleted.

8 changes: 6 additions & 2 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ include_directories("libraries/pugixml/src")
include_directories("libraries/frozen/include")

# 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
include_directories(libraries/perfetto/sdk)
Expand Down Expand Up @@ -213,5 +217,5 @@ add_library(skyline SHARED
${source_DIR}/skyline/services/mmnv/IRequest.cpp
)
# 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)
14 changes: 4 additions & 10 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -110,20 +110,17 @@ afterEvaluate {
}

dependencies {
/* Filetrees */
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])

/* Google */
implementation "androidx.core:core-ktx:1.3.2"
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation "androidx.core:core-ktx:1.6.0"
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
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.swiperefreshlayout:swiperefreshlayout:1.1.0'
implementation "androidx.lifecycle:lifecycle-viewmodel-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"
kapt "com.google.dagger:hilt-android-compiler:$hilt_version"
implementation 'com.google.android:flexbox:2.0.1'
Expand All @@ -133,7 +130,4 @@ dependencies {

/* Other Java */
implementation 'info.debatty:java-string-similarity:2.0.0'

/* NDK */
implementation files("libraries/mbedtls.aar")
}
1 change: 1 addition & 0 deletions app/libraries/mbedtls
Submodule mbedtls added at 8df2f8
Binary file removed app/libraries/mbedtls.aar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -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
// 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);

response.Push<UUID>(UUID::GenerateUuidV5(hashBuf));
Expand Down

0 comments on commit 1ad5ea6

Please sign in to comment.