summaryrefslogtreecommitdiff
path: root/security/keymint/support/authorization_set.cpp
diff options
context:
space:
mode:
authorJanis Danisevskis <jdanis@google.com>2020-12-17 10:05:15 -0800
committerJanis Danisevskis <jdanis@google.com>2020-12-18 08:34:20 -0800
commit5ba093377c40a2ce976093d046f3723feae9c953 (patch)
tree3c689726c2abaf52711bb1b848e51a52eb7d112f /security/keymint/support/authorization_set.cpp
parent83fa6413ac4e0d5af8782bb9e806f1fa02a56347 (diff)
Revise keymint_tags.h
* replace NullOr with std::optional. * Add mising tag. * Undefine helper macros so that keymint_tags.h can be used together with keymaster_tags.h * Check if KeyParameterValue variant matches KeyParameterTag in accessors. Test: VtsAidlKeyMintTargetTest Change-Id: I6c951071f30fd27c8c21a2e8cc86f421a3bc37d9
Diffstat (limited to 'security/keymint/support/authorization_set.cpp')
-rw-r--r--security/keymint/support/authorization_set.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/security/keymint/support/authorization_set.cpp b/security/keymint/support/authorization_set.cpp
index 37b6cd1ff3..f98851cfa2 100644
--- a/security/keymint/support/authorization_set.cpp
+++ b/security/keymint/support/authorization_set.cpp
@@ -106,10 +106,11 @@ bool AuthorizationSet::erase(int index) {
return false;
}
-NullOr<const KeyParameter&> AuthorizationSet::GetEntry(Tag tag) const {
+std::optional<std::reference_wrapper<const KeyParameter>> AuthorizationSet::GetEntry(
+ Tag tag) const {
int pos = find(tag);
if (pos == -1) return {};
- return data_[pos];
+ return std::reference_wrapper(data_[pos]);
}
AuthorizationSetBuilder& AuthorizationSetBuilder::RsaKey(uint32_t key_size,