diff options
Diffstat (limited to 'keymaster/4.0/support/keymaster_utils.cpp')
-rw-r--r-- | keymaster/4.0/support/keymaster_utils.cpp | 16 |
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 | ||
20 | namespace android { | 20 | namespace android { |
21 | namespace hardware { | 21 | namespace hardware { |
22 | |||
23 | inline 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 | |||
27 | template <size_t SIZE> | ||
28 | inline 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 | |||
22 | namespace keymaster { | 33 | namespace keymaster { |
23 | namespace V4_0 { | 34 | namespace V4_0 { |
35 | |||
36 | bool operator<(const HmacSharingParameters& a, const HmacSharingParameters& b) { | ||
37 | return std::tie(a.seed, a.nonce) < std::tie(b.seed, b.nonce); | ||
38 | } | ||
39 | |||
24 | namespace support { | 40 | namespace support { |
25 | 41 | ||
26 | template <typename T, typename InIter> | 42 | template <typename T, typename InIter> |