Merge "Keymint Support: Fix keymint_tags.h" am: 736d935157 am: 3686d22043 am: 8c49bc611e am: 24a732cd14

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1566354

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I4f20db5e37cff69ad4a5eff82d83a6b7fd2c6446
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);
 }