Merge "[gatekeeperd] copy uid to local before passing to u_map"
am: fe8213f0dd
* commit 'fe8213f0dd254a1210ba56126e07a21b433c4f75':
[gatekeeperd] copy uid to local before passing to u_map
This commit is contained in:
commit
a9a2eaeadc
|
@ -25,8 +25,10 @@ extern "C" {
|
|||
#include <crypto_scrypt.h>
|
||||
}
|
||||
|
||||
#include <base/memory.h>
|
||||
#include <UniquePtr.h>
|
||||
#include <gatekeeper/gatekeeper.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <unordered_map>
|
||||
|
||||
|
@ -150,14 +152,15 @@ public:
|
|||
}
|
||||
|
||||
bool DoVerify(const password_handle_t *expected_handle, const SizedBuffer &password) {
|
||||
FastHashMap::const_iterator it = fast_hash_map_.find(expected_handle->user_id);
|
||||
uint64_t user_id = android::base::get_unaligned(&expected_handle->user_id);
|
||||
FastHashMap::const_iterator it = fast_hash_map_.find(user_id);
|
||||
if (it != fast_hash_map_.end() && VerifyFast(it->second, password)) {
|
||||
return true;
|
||||
} else {
|
||||
if (GateKeeper::DoVerify(expected_handle, password)) {
|
||||
uint64_t salt;
|
||||
GetRandom(&salt, sizeof(salt));
|
||||
fast_hash_map_[expected_handle->user_id] = ComputeFastHash(password, salt);
|
||||
fast_hash_map_[user_id] = ComputeFastHash(password, salt);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ include $(CLEAR_VARS)
|
|||
LOCAL_MODULE := gatekeeperd-unit-tests
|
||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
|
||||
LOCAL_CFLAGS += -g -Wall -Werror -std=gnu++11 -Wno-missing-field-initializers
|
||||
LOCAL_SHARED_LIBRARIES := libgatekeeper libcrypto
|
||||
LOCAL_SHARED_LIBRARIES := libgatekeeper libcrypto libbase
|
||||
LOCAL_STATIC_LIBRARIES := libscrypt_static
|
||||
LOCAL_C_INCLUDES := external/scrypt/lib/crypto
|
||||
LOCAL_SRC_FILES := \
|
||||
|
|
Loading…
Reference in New Issue