diff options
author | Timothy Yiu <tyiu@google.com> | 2023-04-03 23:17:20 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2023-04-03 23:17:20 +0000 |
commit | b3191a4aa787227f2859e3bb3f78e3ffbfd2a797 (patch) | |
tree | 08071ecfe638cc424d689efcb1ee572fcc85bab9 | |
parent | ac3b73286abc8f620ea26c4f5f3ceb827e9c6cf4 (diff) | |
parent | ca8d670c1656a6a47ef0f31fdfe1744d75fe5543 (diff) | |
download | native-b3191a4aa787227f2859e3bb3f78e3ffbfd2a797.tar.gz |
Merge "RESTRICT AUTOMERGE: Fix HMAC Compare time attack" into tm-dev
-rw-r--r-- | services/inputflinger/dispatcher/InputDispatcher.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp index 5e9427ad87..da461285f5 100644 --- a/services/inputflinger/dispatcher/InputDispatcher.cpp +++ b/services/inputflinger/dispatcher/InputDispatcher.cpp @@ -27,6 +27,7 @@ #include <ftl/enum.h> #include <gui/SurfaceComposerClient.h> #include <input/InputDevice.h> +#include <openssl/mem.h> #include <powermanager/PowerManager.h> #include <unistd.h> #include <utils/Trace.h> @@ -4422,7 +4423,7 @@ std::unique_ptr<VerifiedInputEvent> InputDispatcher::verifyInputEvent(const Inpu if (calculatedHmac == INVALID_HMAC) { return nullptr; } - if (calculatedHmac != event.getHmac()) { + if (0 != CRYPTO_memcmp(calculatedHmac.data(), event.getHmac().data(), calculatedHmac.size())) { return nullptr; } return result; |