diff options
author | Tucker Sylvestro <tuckeris@google.com> | 2016-10-05 14:39:39 -0400 |
---|---|---|
committer | Tucker Sylvestro <tuckeris@google.com> | 2016-10-05 14:39:39 -0400 |
commit | 28a872eb797716868770a2115a6ef55f2178df6d (patch) | |
tree | c3ca2101b7e0af862a98c96630d7ddcd9bc41723 | |
parent | 5982d8f27f009e749bbe845e1ed470e883c5b8f4 (diff) | |
download | libhardware-28a872eb797716868770a2115a6ef55f2178df6d.tar.gz |
Treat all tags as unsigned when comparing them
All tags are presumed to be unsigned, but some of them have signed
representations that are negative. This caused problems in
AuthorizationSet.Deduplicate, where TAG_APPLICATION_DATA (signed rep
of -1879047492) was being sorted before TAG_INVALID (0), which was
presumed to always be first in the list.
BUG: 30701680
Change-Id: I67047cee21fd7617248022a4674779fe80d5ddfd
-rw-r--r-- | include/hardware/keymaster_defs.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/hardware/keymaster_defs.h b/include/hardware/keymaster_defs.h index b45e785f..0f9bc27c 100644 --- a/include/hardware/keymaster_defs.h +++ b/include/hardware/keymaster_defs.h @@ -518,7 +518,7 @@ inline keymaster_key_param_t keymaster_param_date(keymaster_tag_t tag, uint64_t #define KEYMASTER_SIMPLE_COMPARE(a, b) (a < b) ? -1 : ((a > b) ? 1 : 0) inline int keymaster_param_compare(const keymaster_key_param_t* a, const keymaster_key_param_t* b) { - int retval = KEYMASTER_SIMPLE_COMPARE(a->tag, b->tag); + int retval = KEYMASTER_SIMPLE_COMPARE((uint32_t)a->tag, (uint32_t)b->tag); if (retval != 0) return retval; |