Merge "Make CTS not HEH the default post Q"
This commit is contained in:
commit
39969f0288
1 changed files with 10 additions and 5 deletions
15
FsCrypt.cpp
15
FsCrypt.cpp
|
@ -231,13 +231,18 @@ static bool install_storage_key(const std::string& mountpoint, const EncryptionO
|
||||||
|
|
||||||
// Retrieve the options to use for encryption policies on adoptable storage.
|
// Retrieve the options to use for encryption policies on adoptable storage.
|
||||||
static bool get_volume_file_encryption_options(EncryptionOptions* options) {
|
static bool get_volume_file_encryption_options(EncryptionOptions* options) {
|
||||||
auto contents_mode =
|
// If we give the empty string, libfscrypt will use the default (currently XTS)
|
||||||
android::base::GetProperty("ro.crypto.volume.contents_mode", "aes-256-xts");
|
auto contents_mode = android::base::GetProperty("ro.crypto.volume.contents_mode", "");
|
||||||
|
// HEH as default was always a mistake. Use the libfscrypt default (CTS)
|
||||||
|
// for devices launching on versions above Android 10.
|
||||||
|
auto first_api_level = GetFirstApiLevel();
|
||||||
|
constexpr uint64_t pre_gki_level = 29;
|
||||||
auto filenames_mode =
|
auto filenames_mode =
|
||||||
android::base::GetProperty("ro.crypto.volume.filenames_mode", "aes-256-heh");
|
android::base::GetProperty("ro.crypto.volume.filenames_mode",
|
||||||
|
first_api_level > pre_gki_level ? "" : "aes-256-heh");
|
||||||
auto options_string = android::base::GetProperty("ro.crypto.volume.options",
|
auto options_string = android::base::GetProperty("ro.crypto.volume.options",
|
||||||
contents_mode + ":" + filenames_mode + ":v1");
|
contents_mode + ":" + filenames_mode);
|
||||||
if (!ParseOptions(options_string, options)) {
|
if (!ParseOptionsForApiLevel(first_api_level, options_string, options)) {
|
||||||
LOG(ERROR) << "Unable to parse volume encryption options: " << options_string;
|
LOG(ERROR) << "Unable to parse volume encryption options: " << options_string;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue