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
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::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 @@
// 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());
}
};