From f5e2d2dece666714c90e4061757f2a6230af6778 Mon Sep 17 00:00:00 2001 From: Tad Date: Wed, 14 Mar 2018 14:30:40 -0400 Subject: [PATCH] Many fixes --- .../LineageOS-14.1/Fennec_DOS-Shim/Android.mk | 7 +- .../0001-Backport_Fixes.patch | 28 ++++++ .../0002-Backport_Fixes.patch | 96 +++++++++++++++++++ .../LineageOS-15.1/Fennec_DOS-Shim/Android.mk | 7 +- PrebuiltApps | 2 +- Scripts/LineageOS-14.1/Patch.sh | 4 + Scripts/LineageOS-14.1/Rebrand.sh | 2 +- Scripts/LineageOS-15.1/Rebrand.sh | 2 +- 8 files changed, 139 insertions(+), 9 deletions(-) create mode 100644 Patches/LineageOS-14.1/android_system_keymaster/0001-Backport_Fixes.patch create mode 100644 Patches/LineageOS-14.1/android_system_keymaster/0002-Backport_Fixes.patch diff --git a/Patches/LineageOS-14.1/Fennec_DOS-Shim/Android.mk b/Patches/LineageOS-14.1/Fennec_DOS-Shim/Android.mk index 5afdcd72..9a572af8 100644 --- a/Patches/LineageOS-14.1/Fennec_DOS-Shim/Android.mk +++ b/Patches/LineageOS-14.1/Fennec_DOS-Shim/Android.mk @@ -1,5 +1,5 @@ # -# Copyright (C) 2014 The Android Open Source Project +# Copyright (C) 2016 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -23,11 +23,12 @@ include $(CLEAR_VARS) LOCAL_MODULE := FennecDOS LOCAL_MODULE_CLASS := APPS -LOCAL_MULTILIB := both LOCAL_CERTIFICATE := PRESIGNED +LOCAL_DEX_PREOPT := false +LOCAL_MODULE_TARGET_ARCH := arm LOCAL_OVERRIDES_PACKAGES := Jelly -LOCAL_DEX_PREOPT := false + LOCAL_SRC_FILES := prebuilt/Fennec_DOS-Shim.apk include $(BUILD_PREBUILT) diff --git a/Patches/LineageOS-14.1/android_system_keymaster/0001-Backport_Fixes.patch b/Patches/LineageOS-14.1/android_system_keymaster/0001-Backport_Fixes.patch new file mode 100644 index 00000000..980fa992 --- /dev/null +++ b/Patches/LineageOS-14.1/android_system_keymaster/0001-Backport_Fixes.patch @@ -0,0 +1,28 @@ +diff --git a/keymaster_configuration.cpp b/keymaster_configuration.cpp +index 428197c..42df7d6 100644 +--- a/keymaster_configuration.cpp ++++ b/keymaster_configuration.cpp +@@ -89,7 +89,10 @@ + } + + regmatch_t matches[kPlatformVersionMatchCount]; +- if (regexec(®ex, version_str, kPlatformVersionMatchCount, matches, 0 /* flags */)) { ++ int not_match ++ = regexec(®ex, version_str, kPlatformVersionMatchCount, matches, 0 /* flags */); ++ regfree(®ex); ++ if (not_match) { + ALOGI("Platform version string does not match expected format. Using version 0."); + return 0; + } +@@ -109,7 +112,10 @@ + } + + regmatch_t matches[kPlatformPatchlevelMatchCount]; +- if (regexec(®ex, patchlevel_str, kPlatformPatchlevelMatchCount, matches, 0 /* flags */)) { ++ int not_match ++ = regexec(®ex, patchlevel_str, kPlatformPatchlevelMatchCount, matches, 0 /* flags */); ++ regfree(®ex); ++ if (not_match) { + ALOGI("Platform patchlevel string does not match expected format. Using patchlevel 0"); + return 0; + } diff --git a/Patches/LineageOS-14.1/android_system_keymaster/0002-Backport_Fixes.patch b/Patches/LineageOS-14.1/android_system_keymaster/0002-Backport_Fixes.patch new file mode 100644 index 00000000..4adaef3d --- /dev/null +++ b/Patches/LineageOS-14.1/android_system_keymaster/0002-Backport_Fixes.patch @@ -0,0 +1,96 @@ +diff --git a/include/keymaster/keymaster_configuration.h b/include/keymaster/keymaster_configuration.h +index 97b7fa5..69738fd 100644 +--- a/include/keymaster/keymaster_configuration.h ++++ b/include/keymaster/keymaster_configuration.h +@@ -40,12 +40,24 @@ + uint32_t GetOsVersion(const char* version_string); + + /** ++ * Retrieves and parses OS version information from build properties. Returns 0 if the string ++ * doesn't contain a numeric version number. ++ */ ++uint32_t GetOsVersion(); ++ ++/** + * Parses OS patch level string, returning year and month in integer form. For example, "2016-03-25" + * will be returned as 201603. Returns 0 if the string doesn't contain a date in the form + * YYYY-MM-DD. + */ + uint32_t GetOsPatchlevel(const char* patchlevel_string); + ++/** ++ * Retrieves and parses OS patch level from build properties. Returns 0 if the string doesn't ++ * contain a date in the form YYYY-MM-DD. ++ */ ++uint32_t GetOsPatchlevel(); ++ + } // namespace keymaster + + #endif // SYSTEM_KEYMASTER_KEYMASTER_CONFIGURATION_H_ +diff --git a/keymaster_configuration.cpp b/keymaster_configuration.cpp +index 42df7d6..ac6d3c1 100644 +--- a/keymaster_configuration.cpp ++++ b/keymaster_configuration.cpp +@@ -70,15 +70,7 @@ + } + + keymaster_error_t ConfigureDevice(keymaster2_device_t* dev) { +- char version_str[PROPERTY_VALUE_MAX]; +- property_get(kPlatformVersionProp, version_str, "" /* default */); +- uint32_t version = GetOsVersion(version_str); +- +- char patchlevel_str[PROPERTY_VALUE_MAX]; +- property_get(kPlatformPatchlevelProp, patchlevel_str, "" /* default */); +- uint32_t patchlevel = GetOsPatchlevel(patchlevel_str); +- +- return ConfigureDevice(dev, version, patchlevel); ++ return ConfigureDevice(dev, GetOsVersion(), GetOsPatchlevel()); + } + + uint32_t GetOsVersion(const char* version_str) { +@@ -89,8 +81,8 @@ + } + + regmatch_t matches[kPlatformVersionMatchCount]; +- int not_match +- = regexec(®ex, version_str, kPlatformVersionMatchCount, matches, 0 /* flags */); ++ int not_match = ++ regexec(®ex, version_str, kPlatformVersionMatchCount, matches, 0 /* flags */); + regfree(®ex); + if (not_match) { + ALOGI("Platform version string does not match expected format. Using version 0."); +@@ -104,6 +96,12 @@ + return (major * 100 + minor) * 100 + subminor; + } + ++uint32_t GetOsVersion() { ++ char version_str[PROPERTY_VALUE_MAX]; ++ property_get(kPlatformVersionProp, version_str, "" /* default */); ++ return GetOsVersion(version_str); ++} ++ + uint32_t GetOsPatchlevel(const char* patchlevel_str) { + regex_t regex; + if (regcomp(®ex, kPlatformPatchlevelRegex, REG_EXTENDED) != 0) { +@@ -112,8 +110,8 @@ + } + + regmatch_t matches[kPlatformPatchlevelMatchCount]; +- int not_match +- = regexec(®ex, patchlevel_str, kPlatformPatchlevelMatchCount, matches, 0 /* flags */); ++ int not_match = ++ regexec(®ex, patchlevel_str, kPlatformPatchlevelMatchCount, matches, 0 /* flags */); + regfree(®ex); + if (not_match) { + ALOGI("Platform patchlevel string does not match expected format. Using patchlevel 0"); +@@ -130,4 +128,10 @@ + return year * 100 + month; + } + ++uint32_t GetOsPatchlevel() { ++ char patchlevel_str[PROPERTY_VALUE_MAX]; ++ property_get(kPlatformPatchlevelProp, patchlevel_str, "" /* default */); ++ return GetOsPatchlevel(patchlevel_str); ++} ++ + } // namespace keymaster diff --git a/Patches/LineageOS-15.1/Fennec_DOS-Shim/Android.mk b/Patches/LineageOS-15.1/Fennec_DOS-Shim/Android.mk index 5afdcd72..9a572af8 100644 --- a/Patches/LineageOS-15.1/Fennec_DOS-Shim/Android.mk +++ b/Patches/LineageOS-15.1/Fennec_DOS-Shim/Android.mk @@ -1,5 +1,5 @@ # -# Copyright (C) 2014 The Android Open Source Project +# Copyright (C) 2016 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -23,11 +23,12 @@ include $(CLEAR_VARS) LOCAL_MODULE := FennecDOS LOCAL_MODULE_CLASS := APPS -LOCAL_MULTILIB := both LOCAL_CERTIFICATE := PRESIGNED +LOCAL_DEX_PREOPT := false +LOCAL_MODULE_TARGET_ARCH := arm LOCAL_OVERRIDES_PACKAGES := Jelly -LOCAL_DEX_PREOPT := false + LOCAL_SRC_FILES := prebuilt/Fennec_DOS-Shim.apk include $(BUILD_PREBUILT) diff --git a/PrebuiltApps b/PrebuiltApps index 518f42b0..ce74e424 160000 --- a/PrebuiltApps +++ b/PrebuiltApps @@ -1 +1 @@ -Subproject commit 518f42b01375427783ac267e342f96b3804babce +Subproject commit ce74e424e1c05e1b72af780fdca5311ff45facdd diff --git a/Scripts/LineageOS-14.1/Patch.sh b/Scripts/LineageOS-14.1/Patch.sh index 39ef179c..cc16f7d1 100755 --- a/Scripts/LineageOS-14.1/Patch.sh +++ b/Scripts/LineageOS-14.1/Patch.sh @@ -167,6 +167,10 @@ cat /tmp/ar/hosts >> rootdir/etc/hosts #Merge in our HOSTS file git revert 0217dddeb5c16903c13ff6c75213619b79ea622b d7aa1231b6a0631f506c0c23816f2cd81645b15f #Always update recovery patch -p1 < $patches"android_system_core/0001-Harden_Mounts.patch" #Harden mounts with nodev/noexec/nosuid. Disclaimer: From CopperheadOS 13.0 +enterAndClear "system/keymaster" +patch -p1 < $patches"android_system_keymaster/0001-Backport_Fixes.patch" #Fixes from 8.1, appears to fix https://jira.lineageos.org/browse/BUGBASH-590 +patch -p1 < $patches"android_system_keymaster/0002-Backport_Fixes.patch" + enterAndClear "system/vold" patch -p1 < $patches"android_system_vold/0001-AES256.patch" #Add a variable for enabling AES-256 bit encryption diff --git a/Scripts/LineageOS-14.1/Rebrand.sh b/Scripts/LineageOS-14.1/Rebrand.sh index 202ec02a..8a8d772d 100644 --- a/Scripts/LineageOS-14.1/Rebrand.sh +++ b/Scripts/LineageOS-14.1/Rebrand.sh @@ -41,7 +41,7 @@ sed -i 's|>LineageOS|>DivestOS|' res/values*/strings.xml enter "vendor/cm" sed -i 's|https://lineageos.org/legal|https://divestos.xyz/pages/about.html|' config/common.mk; -sed -i '/.*ZIPFILE=/s/lineage/divestos/' build/envsetup.sh +#sed -i '/.*ZIPFILE=/s/lineage/divestos/' build/envsetup.sh; #TODO: Enable before release and update server rm -rf bootanimation #TODO: Create a boot animation cd $base diff --git a/Scripts/LineageOS-15.1/Rebrand.sh b/Scripts/LineageOS-15.1/Rebrand.sh index f34e92c9..aed76c91 100644 --- a/Scripts/LineageOS-15.1/Rebrand.sh +++ b/Scripts/LineageOS-15.1/Rebrand.sh @@ -41,7 +41,7 @@ sed -i 's|>LineageOS|>DivestOS|' res/values*/strings.xml enter "vendor/lineage" sed -i 's|https://lineageos.org/legal|https://divestos.xyz/pages/about.html|' config/common.mk; -sed -i '/.*ZIPFILE=/s/lineage/divestos/' build/envsetup.sh +#sed -i '/.*ZIPFILE=/s/lineage/divestos/' build/envsetup.sh; #TODO: Enable before release and update server rm -rf bootanimation #TODO: Create a boot animation cd $base