aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarret Kelly <gdk@google.com>2019-05-21 15:18:20 -0400
committerGarret Kelly <gdk@google.com>2019-05-21 15:19:34 -0400
commit33b5e38acfce52b537bf82e3f5d3cadf6e627976 (patch)
tree2c4ea6f287be23d742aa74c73c6956a8efc043a0
parent53ef156e633540c9732cab949930e3c4df74eaa3 (diff)
downloadandroid-33b5e38acfce52b537bf82e3f5d3cadf6e627976.tar.gz
keymaster: Fix callback invocations
Fix a pair of sites where a HIDL callback is being invoked potentially more than once, or invalid data is being after an error has already been reported to the caller. Bug: None Test: None Signed-off-by: Garret Kelly <gdk@google.com> Change-Id: Ifd8e5d8c30705485a9a1ff191a80f1ae9c2d751a
-rw-r--r--hals/keymaster/KeymasterDevice.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/hals/keymaster/KeymasterDevice.cpp b/hals/keymaster/KeymasterDevice.cpp
index 61614e9..c312262 100644
--- a/hals/keymaster/KeymasterDevice.cpp
+++ b/hals/keymaster/KeymasterDevice.cpp
@@ -346,6 +346,7 @@ Return<void> KeymasterDevice::getHmacSharingParameters(
if (ec != ErrorCode::OK) {
_hidl_cb(ec, HmacSharingParameters());
+ return Void();
}
const std::string & nonce = response.hmac_sharing_params().nonce();
@@ -717,6 +718,7 @@ Return<void> KeymasterDevice::attestKey(
::strftime(not_after_str, sizeof(not_after_str),
"%y%m%d%H%M%SZ", gmtime(&not_after)) == 0) {
_hidl_cb(ErrorCode::UNKNOWN_ERROR, hidl_vec<hidl_vec<uint8_t> >{});
+ return Void();
}
startRequest.mutable_blob()->set_blob(&keyToAttest[0], keyToAttest.size());