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
This commit is contained in:
Janis Danisevskis 2021-01-31 12:33:21 -08:00
parent 45a8fe6521
commit 2d5868b4e0

View file

@ -326,7 +326,9 @@ template <TagType tag_type, Tag tag>
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);
}