summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'keymaster/4.0/support/keymaster_utils.cpp')
-rw-r--r--keymaster/4.0/support/keymaster_utils.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/keymaster/4.0/support/keymaster_utils.cpp b/keymaster/4.0/support/keymaster_utils.cpp
index bc610aa3..729e1c1d 100644
--- a/keymaster/4.0/support/keymaster_utils.cpp
+++ b/keymaster/4.0/support/keymaster_utils.cpp
@@ -19,8 +19,24 @@
19 19
20namespace android { 20namespace android {
21namespace hardware { 21namespace hardware {
22
23inline static bool operator<(const hidl_vec<uint8_t>& a, const hidl_vec<uint8_t>& b) {
24 return memcmp(a.data(), b.data(), std::min(a.size(), b.size())) == -1;
25}
26
27template <size_t SIZE>
28inline static bool operator<(const hidl_array<uint8_t, SIZE>& a,
29 const hidl_array<uint8_t, SIZE>& b) {
30 return memcmp(a.data(), b.data(), SIZE) == -1;
31}
32
22namespace keymaster { 33namespace keymaster {
23namespace V4_0 { 34namespace V4_0 {
35
36bool operator<(const HmacSharingParameters& a, const HmacSharingParameters& b) {
37 return std::tie(a.seed, a.nonce) < std::tie(b.seed, b.nonce);
38}
39
24namespace support { 40namespace support {
25 41
26template <typename T, typename InIter> 42template <typename T, typename InIter>