Add an AuthorizationSet method to count tag instances.
Change-Id: Ibaf05fd8061db9155cd5ecc7318c6031990d290e
diff --git a/authorization_set.cpp b/authorization_set.cpp
index 124baba..2586b40 100644
--- a/authorization_set.cpp
+++ b/authorization_set.cpp
@@ -412,6 +412,13 @@
indirect_data_size_ = indirect_data_pos - indirect_data_;
}
+size_t AuthorizationSet::GetTagCount(keymaster_tag_t tag) const {
+ size_t count = 0;
+ for (int pos = -1; (pos = find(tag, pos)) != -1;)
+ ++count;
+ return count;
+}
+
bool AuthorizationSet::GetTagValueEnum(keymaster_tag_t tag, uint32_t* val) const {
int pos = find(tag);
if (pos == -1) {