diff options
author | Paul Crowley <paulcrowley@google.com> | 2020-02-18 21:30:03 -0800 |
---|---|---|
committer | Paul Crowley <paulcrowley@google.com> | 2020-02-19 12:21:32 -0800 |
commit | 47212f0c707c0e81f8de2ab19e9c661addb9eed0 (patch) | |
tree | 685a7d1b162f60e04800a5f88621f58e342fff8e /libfscrypt/include/fscrypt | |
parent | da95b3f323f1ba535be8d583b366f1cfdba8e1c8 (diff) | |
download | extras-47212f0c707c0e81f8de2ab19e9c661addb9eed0.tar.gz |
fscrypt option parsing depends on ro.product.first_api_level
We'd like to change what the defaults are for fscrypt as we get new
and better things, but we don't want to break old devices. So we
arrange for the behavior to depend on the API version the device
launched with.
In addition, we can now supply a default if any of the three fields
are blank, meaning that clients like get_volume_file_encryption_options
don't have to separately specify defaults.
Right now we use the API level to choose between version 1 and version
2 being default, and as a further guard against anyone using the
deprecated FSCRYPT_POLICY_FLAGS_PAD_4 on new devices.
Bug: 147107322
Test: atest fscrypt
Test: Various Cuttlefish configurations
Change-Id: I43c94c1051c61d2b051355dcd428c44c279a3c75
Diffstat (limited to 'libfscrypt/include/fscrypt')
-rw-r--r-- | libfscrypt/include/fscrypt/fscrypt.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libfscrypt/include/fscrypt/fscrypt.h b/libfscrypt/include/fscrypt/fscrypt.h index 18fb4fc3..c780c7ce 100644 --- a/libfscrypt/include/fscrypt/fscrypt.h +++ b/libfscrypt/include/fscrypt/fscrypt.h @@ -47,10 +47,18 @@ struct EncryptionPolicy { void BytesToHex(const std::string& bytes, std::string* hex); +unsigned int GetFirstApiLevel(); + bool OptionsToString(const EncryptionOptions& options, std::string* options_string); +bool OptionsToStringForApiLevel(unsigned int first_api_level, const EncryptionOptions& options, + std::string* options_string); + bool ParseOptions(const std::string& options_string, EncryptionOptions* options); +bool ParseOptionsForApiLevel(unsigned int first_api_level, const std::string& options_string, + EncryptionOptions* options); + bool EnsurePolicy(const EncryptionPolicy& policy, const std::string& directory); } // namespace fscrypt |