Run clang-format over ext4crypt related code
The formatting here is inconsistent with Android house style; use
clang-format to bring it back into line.
Change-Id: Id1fe6ff54e9b668ca88c3fc021ae0a5bdd1327eb
diff --git a/Keymaster.h b/Keymaster.h
index dd20ef9..cf692f3 100644
--- a/Keymaster.h
+++ b/Keymaster.h
@@ -38,28 +38,31 @@
// in the destructor if it is unfinished. Methods log failures
// to LOG(ERROR).
class KeymasterOperation {
-public:
- ~KeymasterOperation() { if (mDevice) mDevice->abort(mDevice, mOpHandle); }
+ public:
+ ~KeymasterOperation() {
+ if (mDevice) mDevice->abort(mDevice, mOpHandle);
+ }
// Is this instance valid? This is false if creation fails, and becomes
// false on finish or if an update fails.
- explicit operator bool() {return mDevice != nullptr;}
+ explicit operator bool() { return mDevice != nullptr; }
// Call "update" repeatedly until all of the input is consumed, and
// concatenate the output. Return true on success.
- bool updateCompletely(const std::string &input, std::string *output);
+ bool updateCompletely(const std::string& input, std::string* output);
// Finish; pass nullptr for the "output" param.
bool finish();
// Finish and write the output to this string.
- bool finishWithOutput(std::string *output);
+ bool finishWithOutput(std::string* output);
// Move constructor
KeymasterOperation(KeymasterOperation&& rhs) {
mOpHandle = rhs.mOpHandle;
mDevice = rhs.mDevice;
rhs.mDevice = nullptr;
}
-private:
- KeymasterOperation(keymaster1_device_t *d, keymaster_operation_handle_t h):
- mDevice {d}, mOpHandle {h} {}
- keymaster1_device_t *mDevice;
+
+ private:
+ KeymasterOperation(keymaster1_device_t* d, keymaster_operation_handle_t h)
+ : mDevice{d}, mOpHandle{h} {}
+ keymaster1_device_t* mDevice;
keymaster_operation_handle_t mOpHandle;
DISALLOW_COPY_AND_ASSIGN(KeymasterOperation);
friend class Keymaster;
@@ -68,40 +71,39 @@
// Wrapper for a keymaster1_device_t representing an open connection
// to the keymaster, which is closed in the destructor.
class Keymaster {
-public:
+ public:
Keymaster();
- ~Keymaster() { if (mDevice) keymaster1_close(mDevice); }
+ ~Keymaster() {
+ if (mDevice) keymaster1_close(mDevice);
+ }
// false if we failed to open the keymaster device.
- explicit operator bool() {return mDevice != nullptr;}
+ explicit operator bool() { return mDevice != nullptr; }
// Generate a key in the keymaster from the given params.
- bool generateKey(const AuthorizationSet &inParams, std::string *key);
+ bool generateKey(const AuthorizationSet& inParams, std::string* key);
// If the keymaster supports it, permanently delete a key.
- bool deleteKey(const std::string &key);
+ bool deleteKey(const std::string& key);
// Begin a new cryptographic operation, collecting output parameters.
- KeymasterOperation begin(
- keymaster_purpose_t purpose,
- const std::string &key,
- const AuthorizationSet &inParams,
- AuthorizationSet *outParams);
+ KeymasterOperation begin(keymaster_purpose_t purpose, const std::string& key,
+ const AuthorizationSet& inParams, AuthorizationSet* outParams);
// Begin a new cryptographic operation; don't collect output parameters.
- KeymasterOperation begin(
- keymaster_purpose_t purpose,
- const std::string &key,
- const AuthorizationSet &inParams);
-private:
- keymaster1_device_t *mDevice;
+ KeymasterOperation begin(keymaster_purpose_t purpose, const std::string& key,
+ const AuthorizationSet& inParams);
+
+ private:
+ keymaster1_device_t* mDevice;
DISALLOW_COPY_AND_ASSIGN(Keymaster);
};
template <keymaster_tag_t Tag>
-inline AuthorizationSetBuilder& addStringParam(AuthorizationSetBuilder &¶ms,
- TypedTag<KM_BYTES, Tag> tag, const std::string& val) {
+inline AuthorizationSetBuilder& addStringParam(AuthorizationSetBuilder&& params,
+ TypedTag<KM_BYTES, Tag> tag,
+ const std::string& val) {
return params.Authorization(tag, val.data(), val.size());
}
template <keymaster_tag_t Tag>
-inline void addStringParam(AuthorizationSetBuilder *params,
- TypedTag<KM_BYTES, Tag> tag, const std::string& val) {
+inline void addStringParam(AuthorizationSetBuilder* params, TypedTag<KM_BYTES, Tag> tag,
+ const std::string& val) {
params->Authorization(tag, val.data(), val.size());
}