* commit 'a642a9ea3b2288b431ecb284b94a4657ae62889d': Use openssl's SHA1 instead of bionic's.
This commit is contained in:
@ -37,10 +37,12 @@ LOCAL_SHARED_LIBRARIES := \
|
|||||||
libskia \
|
libskia \
|
||||||
libgui \
|
libgui \
|
||||||
libui \
|
libui \
|
||||||
libinput
|
libinput \
|
||||||
|
libcrypto \
|
||||||
|
|
||||||
LOCAL_C_INCLUDES := \
|
LOCAL_C_INCLUDES := \
|
||||||
external/skia/include/core
|
external/openssl/include \
|
||||||
|
external/skia/include/core \
|
||||||
|
|
||||||
LOCAL_MODULE:= libinputservice
|
LOCAL_MODULE:= libinputservice
|
||||||
|
|
||||||
|
@ -48,7 +48,8 @@
|
|||||||
#include <sys/epoll.h>
|
#include <sys/epoll.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/limits.h>
|
#include <sys/limits.h>
|
||||||
#include <sys/sha1.h>
|
|
||||||
|
#include <openssl/sha.h>
|
||||||
|
|
||||||
/* this macro is used to tell if "bit" is set in "array"
|
/* this macro is used to tell if "bit" is set in "array"
|
||||||
* it selects a byte from the array, and does a boolean AND
|
* it selects a byte from the array, and does a boolean AND
|
||||||
@ -80,14 +81,14 @@ static inline const char* toString(bool value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static String8 sha1(const String8& in) {
|
static String8 sha1(const String8& in) {
|
||||||
SHA1_CTX ctx;
|
SHA_CTX ctx;
|
||||||
SHA1Init(&ctx);
|
SHA1_Init(&ctx);
|
||||||
SHA1Update(&ctx, reinterpret_cast<const u_char*>(in.string()), in.size());
|
SHA1_Update(&ctx, reinterpret_cast<const u_char*>(in.string()), in.size());
|
||||||
u_char digest[SHA1_DIGEST_LENGTH];
|
u_char digest[SHA_DIGEST_LENGTH];
|
||||||
SHA1Final(digest, &ctx);
|
SHA1_Final(digest, &ctx);
|
||||||
|
|
||||||
String8 out;
|
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]);
|
out.appendFormat("%02x", digest[i]);
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
|
Reference in New Issue
Block a user