crypto: add more missing newlines
Change-Id: I158b2a8fee89c2543a0b809af8e278702466b106
This commit is contained in:
committed by
bigbiff
parent
f8d0e2156e
commit
a5283b3570
@@ -56,17 +56,17 @@ bool KeymasterOperation::updateCompletely(const std::string& input, std::string*
|
||||
auto inputBlob = blob2hidlVec(reinterpret_cast<const uint8_t*>(&*it), toRead);
|
||||
auto error = mDevice->update(mOpHandle, hidl_vec<KeyParameter>(), inputBlob, hidlCB);
|
||||
if (!error.isOk()) {
|
||||
LOG(ERROR) << "update failed: " << error.description();
|
||||
LOG(ERROR) << "update failed: " << error.description() << "\n";
|
||||
mDevice = nullptr;
|
||||
return false;
|
||||
}
|
||||
if (km_error != ErrorCode::OK) {
|
||||
LOG(ERROR) << "update failed, code " << int32_t(km_error);
|
||||
LOG(ERROR) << "update failed, code " << int32_t(km_error) << "\n";
|
||||
mDevice = nullptr;
|
||||
return false;
|
||||
}
|
||||
if (inputConsumed > toRead) {
|
||||
LOG(ERROR) << "update reported too much input consumed";
|
||||
LOG(ERROR) << "update reported too much input consumed\n";
|
||||
mDevice = nullptr;
|
||||
return false;
|
||||
}
|
||||
@@ -88,11 +88,11 @@ bool KeymasterOperation::finish(std::string* output) {
|
||||
hidl_vec<uint8_t>(), hidlCb);
|
||||
mDevice = nullptr;
|
||||
if (!error.isOk()) {
|
||||
LOG(ERROR) << "finish failed: " << error.description();
|
||||
LOG(ERROR) << "finish failed: " << error.description() << "\n";
|
||||
return false;
|
||||
}
|
||||
if (km_error != ErrorCode::OK) {
|
||||
LOG(ERROR) << "finish failed, code " << int32_t(km_error);
|
||||
LOG(ERROR) << "finish failed, code " << int32_t(km_error) << "\n";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -114,27 +114,27 @@ Keymaster::Keymaster() {
|
||||
|
||||
auto error = mDevice->generateKey(inParams.hidl_data(), hidlCb);
|
||||
if (!error.isOk()) {
|
||||
LOG(ERROR) << "generate_key failed: " << error.description();
|
||||
LOG(ERROR) << "generate_key failed: " << error.description() << "\n";
|
||||
return false;
|
||||
}
|
||||
if (km_error != ErrorCode::OK) {
|
||||
LOG(ERROR) << "generate_key failed, code " << int32_t(km_error);
|
||||
LOG(ERROR) << "generate_key failed, code " << int32_t(km_error) << "\n";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}*/
|
||||
|
||||
bool Keymaster::deleteKey(const std::string& key) {
|
||||
LOG(ERROR) << "NOT deleting key in TWRP";
|
||||
LOG(ERROR) << "NOT deleting key in TWRP\n";
|
||||
return false;
|
||||
/*auto keyBlob = blob2hidlVec(key);
|
||||
auto error = mDevice->deleteKey(keyBlob);
|
||||
if (!error.isOk()) {
|
||||
LOG(ERROR) << "delete_key failed: " << error.description();
|
||||
LOG(ERROR) << "delete_key failed: " << error.description() << "\n";
|
||||
return false;
|
||||
}
|
||||
if (ErrorCode(error) != ErrorCode::OK) {
|
||||
LOG(ERROR) << "delete_key failed, code " << uint32_t(ErrorCode(error));
|
||||
LOG(ERROR) << "delete_key failed, code " << uint32_t(ErrorCode(error)) << "\n";
|
||||
return false;
|
||||
}
|
||||
return true;*/
|
||||
@@ -153,11 +153,11 @@ bool Keymaster::upgradeKey(const std::string& oldKey, const AuthorizationSet& in
|
||||
};
|
||||
auto error = mDevice->upgradeKey(oldKeyBlob, inParams.hidl_data(), hidlCb);
|
||||
if (!error.isOk()) {
|
||||
LOG(ERROR) << "upgrade_key failed: " << error.description();
|
||||
LOG(ERROR) << "upgrade_key failed: " << error.description() << "\n";
|
||||
return false;
|
||||
}
|
||||
if (km_error != ErrorCode::OK) {
|
||||
LOG(ERROR) << "upgrade_key failed, code " << int32_t(km_error);
|
||||
LOG(ERROR) << "upgrade_key failed, code " << int32_t(km_error) << "\n";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -207,7 +207,7 @@ using namespace ::android::vold;
|
||||
int keymaster_compatibility_cryptfs_scrypt() {
|
||||
Keymaster dev;
|
||||
if (!dev) {
|
||||
LOG(ERROR) << "Failed to initiate keymaster session";
|
||||
LOG(ERROR) << "Failed to initiate keymaster session\n";
|
||||
return -1;
|
||||
}
|
||||
return dev.isSecure();
|
||||
@@ -224,11 +224,11 @@ int keymaster_compatibility_cryptfs_scrypt() {
|
||||
Keymaster dev;
|
||||
std::string key;
|
||||
if (!dev) {
|
||||
LOG(ERROR) << "Failed to initiate keymaster session";
|
||||
LOG(ERROR) << "Failed to initiate keymaster session\n";
|
||||
return -1;
|
||||
}
|
||||
if (!key_buffer || !key_out_size) {
|
||||
LOG(ERROR) << __FILE__ << ":" << __LINE__ << ":Invalid argument";
|
||||
LOG(ERROR) << __FILE__ << ":" << __LINE__ << ":Invalid argument\n";
|
||||
return -1;
|
||||
}
|
||||
if (key_out_size) {
|
||||
@@ -276,11 +276,11 @@ int keymaster_sign_object_for_cryptfs_scrypt(const uint8_t* key_blob,
|
||||
{
|
||||
Keymaster dev;
|
||||
if (!dev) {
|
||||
LOG(ERROR) << "Failed to initiate keymaster session";
|
||||
LOG(ERROR) << "Failed to initiate keymaster session\n";
|
||||
return -1;
|
||||
}
|
||||
if (!key_blob || !object || !signature_buffer || !signature_buffer_size) {
|
||||
LOG(ERROR) << __FILE__ << ":" << __LINE__ << ":Invalid argument";
|
||||
LOG(ERROR) << __FILE__ << ":" << __LINE__ << ":Invalid argument\n";
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -303,7 +303,7 @@ int keymaster_sign_object_for_cryptfs_scrypt(const uint8_t* key_blob,
|
||||
std::string newKey;
|
||||
bool ret = dev.upgradeKey(key, paramBuilder, &newKey);
|
||||
if(ret == false) {
|
||||
LOG(ERROR) << "Error upgradeKey: ";
|
||||
LOG(ERROR) << "Error upgradeKey: \n";
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -312,7 +312,7 @@ int keymaster_sign_object_for_cryptfs_scrypt(const uint8_t* key_blob,
|
||||
}
|
||||
|
||||
if (key_buffer_size < newKey.size()) {
|
||||
LOG(ERROR) << "key buffer size is too small";
|
||||
LOG(ERROR) << "key buffer size is too small\n";
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -322,24 +322,24 @@ int keymaster_sign_object_for_cryptfs_scrypt(const uint8_t* key_blob,
|
||||
}
|
||||
|
||||
if (op.errorCode() != ErrorCode::OK) {
|
||||
LOG(ERROR) << "Error starting keymaster signature transaction: " << int32_t(op.errorCode());
|
||||
LOG(ERROR) << "Error starting keymaster signature transaction: " << int32_t(op.errorCode()) << "\n";
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!op.updateCompletely(input, &output)) {
|
||||
LOG(ERROR) << "Error sending data to keymaster signature transaction: "
|
||||
<< uint32_t(op.errorCode());
|
||||
<< uint32_t(op.errorCode()) << "\n";
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!op.finish(&output)) {
|
||||
LOG(ERROR) << "Error finalizing keymaster signature transaction: " << int32_t(op.errorCode());
|
||||
LOG(ERROR) << "Error finalizing keymaster signature transaction: " << int32_t(op.errorCode()) << "\n";
|
||||
return -1;
|
||||
}
|
||||
|
||||
*signature_buffer = reinterpret_cast<uint8_t*>(malloc(output.size()));
|
||||
if (*signature_buffer == nullptr) {
|
||||
LOG(ERROR) << "Error allocation buffer for keymaster signature";
|
||||
LOG(ERROR) << "Error allocation buffer for keymaster signature\n";
|
||||
return -1;
|
||||
}
|
||||
*signature_buffer_size = output.size();
|
||||
|
||||
Reference in New Issue
Block a user