summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Prichard <rprichard@google.com>2024-02-12 18:02:47 -0800
committerRyan Prichard <rprichard@google.com>2024-02-12 18:03:00 -0800
commit4f45c51217398fe6c788a51754d348d19b714ca5 (patch)
tree1901fa67fa153ee30458b49000f025e4f6661c85
parent813b3f8eb45841e97c76c0a09195530c720371a3 (diff)
downloadkeymaster-4f45c51217398fe6c788a51754d348d19b714ca5.tar.gz
Replace basic_string_view<uint8_t> with std::span
In newer versions of libc++, std::char_traits<T> is no longer defined for non-character types, and a result, std::basic_string_view<uint8_t> is also no longer defined. See https://discourse.llvm.org/t/deprecating-std-string-t-for-non-character-t/66779. Bug: 175635923 Test: m MODULES-IN-system-keymaster Change-Id: Iad46abe378c2a1201b769601cd743cebb497d036
-rw-r--r--android_keymaster/remote_provisioning_utils.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/android_keymaster/remote_provisioning_utils.cpp b/android_keymaster/remote_provisioning_utils.cpp
index 7d9b7ec..fb06850 100644
--- a/android_keymaster/remote_provisioning_utils.cpp
+++ b/android_keymaster/remote_provisioning_utils.cpp
@@ -14,10 +14,13 @@
* limitations under the License.
*/
-#include "keymaster/cppcose/cppcose.h"
-#include <keymaster/logger.h>
#include <keymaster/remote_provisioning_utils.h>
-#include <string_view>
+
+#include <algorithm>
+#include <span>
+
+#include <keymaster/cppcose/cppcose.h>
+#include <keymaster/logger.h>
namespace keymaster {
@@ -40,7 +43,7 @@ using cppcose::OCTET_KEY_PAIR;
using cppcose::P256;
using cppcose::verifyAndParseCoseSign1;
-using byte_view = std::basic_string_view<uint8_t>;
+using byte_view = std::span<const uint8_t>;
struct KeyInfo {
CoseKeyCurve curve;
@@ -49,7 +52,8 @@ struct KeyInfo {
// that all root keys are EDDSA.
bool operator==(const KeyInfo& other) const {
- return curve == other.curve && pubkey == other.pubkey;
+ return curve == other.curve &&
+ std::equal(pubkey.begin(), pubkey.end(), other.pubkey.begin(), other.pubkey.end());
}
};