summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortyiu <tyiu@google.com>2023-04-04 00:13:18 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-04-04 00:13:18 +0000
commit3e2b0a151db3e87c428d7df69c47098ba3d0102d (patch)
tree307f0c942893b868c99c408671be180978e3fc73
parentb218143d95d241509954a82050c747ee18bdffc8 (diff)
parentbc9a36a8bede9dbe2d3c3d3cc9eb33fa8c35149f (diff)
downloadnative-3e2b0a151db3e87c428d7df69c47098ba3d0102d.tar.gz
RESTRICT AUTOMERGE: Fix HMAC Compare time attack am: ca8d670c16 am: bc9a36a8be
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/21804206 Change-Id: Iee531f2b1673596d7007788a0a94b780c06457d3 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--services/inputflinger/dispatcher/InputDispatcher.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp
index 4ad9f42cdb..c6dd6217d3 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>
@@ -4433,7 +4434,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;