Keymint Support: Fix keymint_tags.h
authorizationValue checked the uion value tag twice instead of checking
the actual tag value.
Test: N/A
Change-Id: I348b5ac06801a04ca7243088d758374148910d39
diff --git a/security/keymint/support/include/keymint_support/keymint_tags.h b/security/keymint/support/include/keymint_support/keymint_tags.h
index 8d2fe28..43cfb63 100644
--- a/security/keymint/support/include/keymint_support/keymint_tags.h
+++ b/security/keymint/support/include/keymint_support/keymint_tags.h
@@ -326,7 +326,9 @@
inline std::optional<
std::reference_wrapper<const typename TypedTag2ValueType<TypedTag<tag_type, tag>>::type>>
authorizationValue(TypedTag<tag_type, tag> ttag, const KeyParameter& param) {
- if (TypedTag2ValueType<TypedTag<tag_type, tag>>::unionTag != param.value.getTag()) return {};
+ // We only check if the parameter has the correct tag here; accessTagValue checks if the correct
+ // union field was initialized.
+ if (tag != param.tag) return {};
return accessTagValue(ttag, param);
}