Many fixes

This commit is contained in:
Tad 2018-03-14 14:30:40 -04:00
parent e4435f9eac
commit f5e2d2dece
8 changed files with 139 additions and 9 deletions

View File

@ -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)

View File

@ -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(&regex, version_str, kPlatformVersionMatchCount, matches, 0 /* flags */)) {
+ int not_match
+ = regexec(&regex, version_str, kPlatformVersionMatchCount, matches, 0 /* flags */);
+ regfree(&regex);
+ 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(&regex, patchlevel_str, kPlatformPatchlevelMatchCount, matches, 0 /* flags */)) {
+ int not_match
+ = regexec(&regex, patchlevel_str, kPlatformPatchlevelMatchCount, matches, 0 /* flags */);
+ regfree(&regex);
+ if (not_match) {
ALOGI("Platform patchlevel string does not match expected format. Using patchlevel 0");
return 0;
}

View File

@ -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(&regex, version_str, kPlatformVersionMatchCount, matches, 0 /* flags */);
+ int not_match =
+ regexec(&regex, version_str, kPlatformVersionMatchCount, matches, 0 /* flags */);
regfree(&regex);
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(&regex, kPlatformPatchlevelRegex, REG_EXTENDED) != 0) {
@@ -112,8 +110,8 @@
}
regmatch_t matches[kPlatformPatchlevelMatchCount];
- int not_match
- = regexec(&regex, patchlevel_str, kPlatformPatchlevelMatchCount, matches, 0 /* flags */);
+ int not_match =
+ regexec(&regex, patchlevel_str, kPlatformPatchlevelMatchCount, matches, 0 /* flags */);
regfree(&regex);
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

View File

@ -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)

@ -1 +1 @@
Subproject commit 518f42b01375427783ac267e342f96b3804babce
Subproject commit ce74e424e1c05e1b72af780fdca5311ff45facdd

View File

@ -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

View File

@ -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

View File

@ -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