summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Dan Albert <danalbert@google.com> 2014-06-16 17:31:28 -0700
committer Dan Albert <danalbert@google.com> 2014-06-20 11:34:29 -0700
commit677d87ec50b9e8cdf88c61be07ad8c6d7f68f9dd (patch)
treed0501140f04b72c87b6d90703d7e9be74ffbcf2d
parentcd13f9da9920b42843071b4ea2d01af55b590e35 (diff)
Use openssl's SHA1 instead of bionic's.
Bionic is removing its SHA1. Change-Id: I7d15986ebac9e0f0eb7ff93457780bd90a4f1d4f
-rw-r--r--services/inputflinger/Android.mk4
-rw-r--r--services/inputflinger/EventHub.cpp14
2 files changed, 11 insertions, 7 deletions
diff --git a/services/inputflinger/Android.mk b/services/inputflinger/Android.mk
index 574c14e360..2edc07da14 100644
--- a/services/inputflinger/Android.mk
+++ b/services/inputflinger/Android.mk
@@ -27,6 +27,7 @@ LOCAL_SRC_FILES:= \
LOCAL_SHARED_LIBRARIES := \
libbinder \
+ libcrypto \
libcutils \
libinput \
liblog \
@@ -38,6 +39,9 @@ LOCAL_SHARED_LIBRARIES := \
# TODO: Move inputflinger to its own process and mark it hidden
#LOCAL_CFLAGS += -fvisibility=hidden
+LOCAL_C_INCLUDES := \
+ external/openssl/include \
+
LOCAL_CFLAGS += -Wno-unused-parameter
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
diff --git a/services/inputflinger/EventHub.cpp b/services/inputflinger/EventHub.cpp
index f274631342..dfe5d3de60 100644
--- a/services/inputflinger/EventHub.cpp
+++ b/services/inputflinger/EventHub.cpp
@@ -28,7 +28,6 @@
#include <sys/limits.h>
#include <sys/inotify.h>
#include <sys/ioctl.h>
-#include <sys/sha1.h>
#include <sys/utsname.h>
#include <unistd.h>
@@ -41,6 +40,7 @@
#include <hardware_legacy/power.h>
#include <cutils/properties.h>
+#include <openssl/sha.h>
#include <utils/Log.h>
#include <utils/Timers.h>
#include <utils/threads.h>
@@ -80,14 +80,14 @@ static inline const char* toString(bool value) {
}
static String8 sha1(const String8& in) {
- SHA1_CTX ctx;
- SHA1Init(&ctx);
- SHA1Update(&ctx, reinterpret_cast<const u_char*>(in.string()), in.size());
- u_char digest[SHA1_DIGEST_LENGTH];
- SHA1Final(digest, &ctx);
+ SHA_CTX ctx;
+ SHA1_Init(&ctx);
+ SHA1_Update(&ctx, reinterpret_cast<const u_char*>(in.string()), in.size());
+ u_char digest[SHA_DIGEST_LENGTH];
+ SHA1_Final(digest, &ctx);
String8 out;
- for (size_t i = 0; i < SHA1_DIGEST_LENGTH; i++) {
+ for (size_t i = 0; i < SHA_DIGEST_LENGTH; i++) {
out.appendFormat("%02x", digest[i]);
}
return out;