From 121fedaa46cadbc06142c3bda6c5e52d45d3c8d2 Mon Sep 17 00:00:00 2001 From: Seth Moore Date: Mon, 11 Dec 2023 10:31:15 -0800 Subject: [PATCH] Replace string copies with const-ref Change-Id: Ie3ea65cc81aa8b9a92a7718ca2003440a3189a4b Test: Treehugger --- .../keymint/support/include/remote_prov/remote_prov_utils.h | 5 +++-- security/keymint/support/remote_prov_utils.cpp | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/security/keymint/support/include/remote_prov/remote_prov_utils.h b/security/keymint/support/include/remote_prov/remote_prov_utils.h index 3b02fadaf4..b8c69eb7d6 100644 --- a/security/keymint/support/include/remote_prov/remote_prov_utils.h +++ b/security/keymint/support/include/remote_prov/remote_prov_utils.h @@ -17,6 +17,7 @@ #pragma once #include +#include #include #include "aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.h" @@ -129,8 +130,8 @@ struct JsonOutput { * "name": * } */ -JsonOutput jsonEncodeCsrWithBuild(const std::string instance_name, - const cppbor::Array& csr, const std::string serialno_prop); +JsonOutput jsonEncodeCsrWithBuild(const std::string& instance_name, const cppbor::Array& csr, + const std::string& serialno_prop); /** * Parses a DeviceInfo structure from the given CBOR data. The parsed data is then validated to diff --git a/security/keymint/support/remote_prov_utils.cpp b/security/keymint/support/remote_prov_utils.cpp index ecfdfd2b33..a830041d64 100644 --- a/security/keymint/support/remote_prov_utils.cpp +++ b/security/keymint/support/remote_prov_utils.cpp @@ -337,8 +337,8 @@ ErrMsgOr> validateBcc(const cppbor::Array* bcc, return result; } -JsonOutput jsonEncodeCsrWithBuild(const std::string instance_name, const cppbor::Array& csr, - const std::string serialno_prop) { +JsonOutput jsonEncodeCsrWithBuild(const std::string& instance_name, const cppbor::Array& csr, + const std::string& serialno_prop) { const std::string kFingerprintProp = "ro.build.fingerprint"; if (!::android::base::WaitForPropertyCreation(kFingerprintProp)) {