diff options
author | Luden <luden@ghostmail.com> | 2016-03-12 10:32:55 +0100 |
---|---|---|
committer | Ziyan <jaraidaniel@gmail.com> | 2016-04-03 15:09:23 +0200 |
commit | 0e66f2b8f1c4330d7d51754be42b40964da69ecd (patch) | |
tree | 510acbb8c7b96b6badd29a938d29e31e563a1318 /keymaster | |
parent | dc6b868c8b679d9be855d6e5e22b7cf4d9c84559 (diff) | |
download | device_samsung_tuna-0e66f2b8f1c4330d7d51754be42b40964da69ecd.zip device_samsung_tuna-0e66f2b8f1c4330d7d51754be42b40964da69ecd.tar.gz device_samsung_tuna-0e66f2b8f1c4330d7d51754be42b40964da69ecd.tar.bz2 |
Ported keymaster_tuna to keymaster0 interface.
keymaster_tuna.cpp almost exactly matches keymaster HAL 0 interface,
only several small changes were needed.
Note the change in the flags (KEYMASTER_BLOBS_ARE_STANDALONE): this
is required for hardware backed storage of the disk encryption key
to function, see keymaster_check_compatibility() function in
system/vold/cryptfs.c
Change-Id: I207455efeb73cee26f08d2cfd12aa4fb91ccec23
Diffstat (limited to 'keymaster')
-rw-r--r-- | keymaster/Android.mk | 2 | ||||
-rw-r--r-- | keymaster/keymaster_tuna.cpp | 12 |
2 files changed, 8 insertions, 6 deletions
diff --git a/keymaster/Android.mk b/keymaster/Android.mk index 885812f..10846df 100644 --- a/keymaster/Android.mk +++ b/keymaster/Android.mk @@ -29,7 +29,7 @@ LOCAL_SRC_FILES := \ LOCAL_C_INCLUDES := \ libcore/include \ external/openssl/include \ - hardware/ti/omap4xxx/security/tf_sdk/include + hardware/ti/omap4/security/tf_sdk/include LOCAL_CFLAGS := -fvisibility=hidden -Wall -Werror diff --git a/keymaster/keymaster_tuna.cpp b/keymaster/keymaster_tuna.cpp index 4385f23..1c31355 100644 --- a/keymaster/keymaster_tuna.cpp +++ b/keymaster/keymaster_tuna.cpp @@ -25,7 +25,7 @@ #include <cutils/log.h> #include <hardware/hardware.h> -#include <hardware/keymaster.h> +#include <hardware/keymaster0.h> #include <openssl/bn.h> #include <openssl/err.h> @@ -38,6 +38,8 @@ #include <UniquePtr.h> +typedef keymaster0_device keymaster_device_t; +typedef keymaster0_device keymaster_device; /** The size of a key ID in bytes */ #define ID_LENGTH 32 @@ -219,7 +221,7 @@ static ByteArray* bignum_to_array(const BIGNUM* bn) { Unique_CK_BYTE bytes(new CK_BYTE[bignumSize]); unsigned char* tmp = reinterpret_cast<unsigned char*>(bytes.get()); - if (BN_bn2bin(bn, tmp) != bignumSize) { + if (int(BN_bn2bin(bn, tmp)) != bignumSize) { ALOGE("public exponent size wasn't what was expected"); return NULL; } @@ -606,7 +608,7 @@ static int tee_import_keypair(const keymaster_device_t* dev, return keyblob_save(objId.get(), key_blob, key_blob_length); } -static int tee_get_keypair_public(const struct keymaster_device* dev, +static int tee_get_keypair_public(const keymaster_device* dev, const uint8_t* key_blob, const size_t key_blob_length, uint8_t** x509_data, size_t* x509_data_length) { @@ -708,7 +710,7 @@ static int tee_get_keypair_public(const struct keymaster_device* dev, return 0; } -static int tee_delete_keypair(const struct keymaster_device* dev, +static int tee_delete_keypair(const keymaster_device* dev, const uint8_t* key_blob, const size_t key_blob_length) { CryptoSession session(reinterpret_cast<CK_SESSION_HANDLE>(dev->context)); @@ -896,7 +898,7 @@ static int tee_open(const hw_module_t* module, const char* name, dev->common.version = 1; dev->common.module = (struct hw_module_t*) module; dev->common.close = tee_close; - dev->flags = 0; + dev->flags = KEYMASTER_BLOBS_ARE_STANDALONE; dev->generate_keypair = tee_generate_keypair; dev->import_keypair = tee_import_keypair; |