Skip to content

Commit

Permalink
Keystore 2.0: Add keystore2 support to the keystore-engine.
Browse files Browse the repository at this point in the history
Test: ???
Bug: 173546268
Bug: 171305607
Bug: 175068876
Change-Id: Ib44a8787d31a994453ab56022546cfbc5b76516e
  • Loading branch information
Janis Danisevskis committed Feb 24, 2021
1 parent 5eeb3d1 commit 670122f
Show file tree
Hide file tree
Showing 4 changed files with 453 additions and 3 deletions.
7 changes: 7 additions & 0 deletions keystore-engine/Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ cc_library_shared {
srcs: [
"android_engine.cpp",
"keystore_backend_binder.cpp",
"keystore2_engine.cpp",
],

cflags: [
Expand All @@ -36,7 +37,9 @@ cc_library_shared {
],

shared_libs: [
"android.system.keystore2-V1-ndk_platform",
"libbinder",
"libbinder_ndk",
"libcrypto",
"libcutils",
"libhidlbase",
Expand All @@ -58,6 +61,7 @@ cc_library_shared {
srcs: [
"android_engine.cpp",
"keystore_backend_hidl.cpp",
"keystore2_engine.cpp",
],

cflags: [
Expand All @@ -68,7 +72,10 @@ cc_library_shared {
],

shared_libs: [
"android.system.keystore2-V1-ndk_platform",
"[email protected]",
"libbase",
"libbinder_ndk",
"libcrypto",
"liblog",
"libhidlbase",
Expand Down
9 changes: 6 additions & 3 deletions keystore-engine/android_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@
#define LOG_TAG "keystore-engine"

#include <pthread.h>
#include <sys/socket.h>
#include <stdarg.h>
#include <string.h>
#include <unistd.h>

#include <log/log.h>

Expand All @@ -41,6 +38,8 @@

#include <memory>

#include "keystore2_engine.h"

#ifndef BACKEND_WIFI_HIDL
#include "keystore_backend_binder.h"
#else
Expand Down Expand Up @@ -335,6 +334,10 @@ EVP_PKEY* EVP_PKEY_from_keystore(const char* key_id) __attribute__((visibility("
EVP_PKEY* EVP_PKEY_from_keystore(const char* key_id) {
ALOGV("EVP_PKEY_from_keystore(\"%s\")", key_id);

if (auto ks2_key = EVP_PKEY_from_keystore2(key_id)) {
return ks2_key;
}

ensure_keystore_engine();

uint8_t *pubkey = nullptr;
Expand Down
Loading

0 comments on commit 670122f

Please sign in to comment.