diff options
author | Nikita Ioffe <ioffe@google.com> | 2020-02-27 17:19:33 +0000 |
---|---|---|
committer | Nikita Ioffe <ioffe@google.com> | 2020-03-04 12:19:07 +0000 |
commit | c577ac4e9303b36b0314ce865dcaba605c3ca238 (patch) | |
tree | 12ac843a628a68a686b520b44ec288a9048cf6d8 /libfscrypt/include/fscrypt | |
parent | c4b5c59477f202e15a52c78203062cc21614f349 (diff) | |
download | extras-c577ac4e9303b36b0314ce865dcaba605c3ca238.tar.gz |
libfscrypt: Add == and != operators for EncryptionPolicy/Options
Test: atest libfscrypt_unit_test
Bug: 143970043
Change-Id: Ibb8ee68513d4f04c1a64773768cc5ded9f7425ca
Merged-In: Ibb8ee68513d4f04c1a64773768cc5ded9f7425ca
(cherry picked from commit e6e61f778c409b08b2799c5281b5db74325bc801)
Diffstat (limited to 'libfscrypt/include/fscrypt')
-rw-r--r-- | libfscrypt/include/fscrypt/fscrypt.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libfscrypt/include/fscrypt/fscrypt.h b/libfscrypt/include/fscrypt/fscrypt.h index c780c7ce..78b12560 100644 --- a/libfscrypt/include/fscrypt/fscrypt.h +++ b/libfscrypt/include/fscrypt/fscrypt.h @@ -61,6 +61,24 @@ bool ParseOptionsForApiLevel(unsigned int first_api_level, const std::string& op bool EnsurePolicy(const EncryptionPolicy& policy, const std::string& directory); +inline bool operator==(const EncryptionOptions& lhs, const EncryptionOptions& rhs) { + return (lhs.version == rhs.version) && (lhs.contents_mode == rhs.contents_mode) && + (lhs.filenames_mode == rhs.filenames_mode) && (lhs.flags == rhs.flags) && + (lhs.use_hw_wrapped_key == rhs.use_hw_wrapped_key); +} + +inline bool operator!=(const EncryptionOptions& lhs, const EncryptionOptions& rhs) { + return !(lhs == rhs); +} + +inline bool operator==(const EncryptionPolicy& lhs, const EncryptionPolicy& rhs) { + return lhs.key_raw_ref == rhs.key_raw_ref && lhs.options == rhs.options; +} + +inline bool operator!=(const EncryptionPolicy& lhs, const EncryptionPolicy& rhs) { + return !(lhs == rhs); +} + } // namespace fscrypt } // namespace android |