/system/keymaster/key_blob_utils/ |
D | integrity_assured_key_blob.cpp | 82 KeymasterKeyBlob* key_blob) { in SerializeIntegrityAssuredBlob() argument 89 if (!key_blob->Reset(size)) in SerializeIntegrityAssuredBlob() 92 uint8_t* p = key_blob->writable_data(); in SerializeIntegrityAssuredBlob() 94 p = key_material.Serialize(p, key_blob->end()); in SerializeIntegrityAssuredBlob() 95 p = hw_enforced.Serialize(p, key_blob->end()); in SerializeIntegrityAssuredBlob() 96 p = sw_enforced.Serialize(p, key_blob->end()); in SerializeIntegrityAssuredBlob() 98 return ComputeHmac(key_blob->key_material, p - key_blob->key_material, hidden, p); in SerializeIntegrityAssuredBlob() 101 keymaster_error_t DeserializeIntegrityAssuredBlob(const KeymasterKeyBlob& key_blob, in DeserializeIntegrityAssuredBlob() argument 106 const uint8_t* p = key_blob.begin(); in DeserializeIntegrityAssuredBlob() 107 const uint8_t* end = key_blob.end(); in DeserializeIntegrityAssuredBlob() [all …]
|
D | auth_encrypted_key_blob.cpp | 34 KeymasterKeyBlob* key_blob) { in SerializeAuthEncryptedBlob() argument 39 if (!key_blob->Reset(size)) in SerializeAuthEncryptedBlob() 42 uint8_t* buf = key_blob->writable_data(); in SerializeAuthEncryptedBlob() 43 const uint8_t* end = key_blob->key_material + key_blob->key_material_size; in SerializeAuthEncryptedBlob() 51 if (buf != key_blob->key_material + key_blob->key_material_size) in SerializeAuthEncryptedBlob() 57 static keymaster_error_t DeserializeUnversionedBlob(const KeymasterKeyBlob& key_blob, in DeserializeUnversionedBlob() argument 62 const uint8_t* tmp = key_blob.key_material; in DeserializeUnversionedBlob() 64 const uint8_t* end = tmp + key_blob.key_material_size; in DeserializeUnversionedBlob() 82 keymaster_error_t DeserializeAuthEncryptedBlob(const KeymasterKeyBlob& key_blob, in DeserializeAuthEncryptedBlob() argument 87 if (!key_blob.key_material || key_blob.key_material_size == 0) in DeserializeAuthEncryptedBlob() [all …]
|
/system/security/keystore/ |
D | keyblob_utils.cpp | 49 uint8_t* add_softkey_header(uint8_t* key_blob, size_t key_blob_length) { in add_softkey_header() argument 54 memcpy(key_blob, SOFT_KEY_MAGIC, sizeof(SOFT_KEY_MAGIC)); in add_softkey_header() 56 return key_blob + sizeof(SOFT_KEY_MAGIC); in add_softkey_header() 59 bool is_softkey(const uint8_t* key_blob, const size_t key_blob_length) { in is_softkey() argument 64 return !memcmp(key_blob, SOFT_KEY_MAGIC, sizeof(SOFT_KEY_MAGIC)); in is_softkey()
|
D | legacy_keymaster_device_wrapper.cpp | 223 keymaster_key_blob_t key_blob{nullptr, 0}; in generateKey() local 229 auto rc = keymaster_device_->generate_key(keymaster_device_, &kmParams, &key_blob, in generateKey() 234 resultKeyBlob = kmBlob2hidlVec(key_blob); in generateKey() 243 if (key_blob.key_material) free(const_cast<uint8_t*>(key_blob.key_material)); in generateKey() 288 keymaster_key_blob_t key_blob{nullptr, 0}; in importKey() local 296 &key_blob, &key_characteristics); in importKey() 300 resultKeyBlob = kmBlob2hidlVec(key_blob); in importKey() 308 if (key_blob.key_material) free(const_cast<uint8_t*>(key_blob.key_material)); in importKey() 402 keymaster_key_blob_t key_blob = {}; in upgradeKey() local 408 &kmUpgradeParams, &key_blob); in upgradeKey() [all …]
|
/system/keymaster/android_keymaster/ |
D | android_keymaster_messages.cpp | 26 static void set_key_blob(keymaster_key_blob_t* key_blob, const void* key_material, size_t length) { in set_key_blob() argument 27 delete[] key_blob->key_material; in set_key_blob() 28 key_blob->key_material = dup_buffer(key_material, length); in set_key_blob() 29 key_blob->key_material_size = length; in set_key_blob() 32 static size_t key_blob_size(const keymaster_key_blob_t& key_blob) { in key_blob_size() argument 33 return sizeof(uint32_t) /* key size */ + key_blob.key_material_size; in key_blob_size() 36 static uint8_t* serialize_key_blob(const keymaster_key_blob_t& key_blob, uint8_t* buf, in serialize_key_blob() argument 38 return append_size_and_data_to_buf(buf, end, key_blob.key_material, key_blob.key_material_size); in serialize_key_blob() 41 static bool deserialize_key_blob(keymaster_key_blob_t* key_blob, const uint8_t** buf_ptr, in deserialize_key_blob() argument 43 delete[] key_blob->key_material; in deserialize_key_blob() [all …]
|
D | android_keymaster.cpp | 232 KeymasterKeyBlob key_blob; in GenerateKey() local 235 response->error = factory->GenerateKey(request.key_description, &key_blob, in GenerateKey() 238 response->key_blob = key_blob.release(); in GenerateKey() 249 context_->ParseKeyBlob(KeymasterKeyBlob(request.key_blob), request.additional_params, in GetKeyCharacteristics() 269 response->error = LoadKey(request.key_blob, request.additional_params, &key_factory, &key); in BeginOperation() 289 if (!context_->enforcement_policy()->CreateKeyId(request.key_blob, &key_id)) return; in BeginOperation() 381 context_->ParseKeyBlob(KeymasterKeyBlob(request.key_blob), request.additional_params, &key); in ExportKey() 400 response->error = LoadKey(request.key_blob, request.attest_params, in AttestKey() 427 response->error = context_->UpgradeKeyBlob(KeymasterKeyBlob(request.key_blob), in UpgradeKey() 446 KeymasterKeyBlob key_blob; in ImportKey() local [all …]
|
/system/keymaster/legacy_support/ |
D | keymaster0_engine.cpp | 86 uint8_t* key_blob = nullptr; in GenerateRsaKey() local 87 if (keymaster0_device_->generate_keypair(keymaster0_device_, TYPE_RSA, ¶ms, &key_blob, in GenerateRsaKey() 92 unique_ptr<uint8_t, Malloc_Delete> key_blob_deleter(key_blob); in GenerateRsaKey() 93 key_material->key_material = dup_buffer(key_blob, key_material->key_material_size); in GenerateRsaKey() 102 uint8_t* key_blob = nullptr; in GenerateEcKey() local 103 if (keymaster0_device_->generate_keypair(keymaster0_device_, TYPE_EC, ¶ms, &key_blob, in GenerateEcKey() 108 unique_ptr<uint8_t, Malloc_Delete> key_blob_deleter(key_blob); in GenerateEcKey() 109 key_material->key_material = dup_buffer(key_blob, key_material->key_material_size); in GenerateEcKey() 120 uint8_t* key_blob = nullptr; in ImportKey() local 122 to_import.key_material_size, &key_blob, in ImportKey() [all …]
|
D | ec_keymaster0_key.cpp | 37 KeymasterKeyBlob* key_blob, in GenerateKey() argument 40 if (!key_blob || !hw_enforced || !sw_enforced) in GenerateKey() 44 return super::GenerateKey(key_description, key_blob, hw_enforced, sw_enforced); in GenerateKey() 64 return blob_maker_.CreateKeyBlob(key_description, KM_ORIGIN_UNKNOWN, key_material, key_blob, in GenerateKey()
|
D | keymaster_passthrough_engine.cpp | 213 KeymasterKeyBlob* key_blob, in GenerateKey() argument 216 assert(key_blob); in GenerateKey() 225 key_blob->key_material = dup_buffer(blob.key_material, blob.key_material_size); in GenerateKey() 226 key_blob->key_material_size = blob.key_material_size; in GenerateKey() 236 KeymasterKeyBlob* key_blob, in GenerateKey() argument 239 assert(key_blob); in GenerateKey() 248 key_blob->key_material = dup_buffer(blob.key_material, blob.key_material_size); in GenerateKey() 249 key_blob->key_material_size = blob.key_material_size; in GenerateKey()
|
D | rsa_keymaster0_key.cpp | 37 KeymasterKeyBlob* key_blob, in GenerateKey() argument 40 if (!key_blob || !hw_enforced || !sw_enforced) in GenerateKey() 66 return blob_maker_.CreateKeyBlob(key_description, KM_ORIGIN_UNKNOWN, key_material, key_blob, in GenerateKey()
|
D | ec_keymaster1_key.cpp | 65 KeymasterKeyBlob* key_blob, in GenerateKey() argument 79 return engine_->GenerateKey(key_params_copy, key_blob, hw_enforced, sw_enforced); in GenerateKey()
|
/system/keymaster/include/keymaster/key_blob_utils/ |
D | integrity_assured_key_blob.h | 33 KeymasterKeyBlob* key_blob); 35 keymaster_error_t DeserializeIntegrityAssuredBlob(const KeymasterKeyBlob& key_blob, 41 keymaster_error_t DeserializeIntegrityAssuredBlob_NoHmacCheck(const KeymasterKeyBlob& key_blob,
|
D | auth_encrypted_key_blob.h | 33 KeymasterKeyBlob* key_blob); 35 keymaster_error_t DeserializeAuthEncryptedBlob(const KeymasterKeyBlob& key_blob,
|
/system/keymaster/tests/ |
D | key_blob_test.cpp | 307 KeymasterKeyBlob key_blob(blob); in TEST_F() local 311 DeserializeIntegrityAssuredBlob(key_blob, hidden_, &key_material_, &hw_enforced_, in TEST_F() 316 key_blob, &ciphertext_, &hw_enforced_, &sw_enforced_, &nonce_, &tag_); in TEST_F() 331 KeymasterKeyBlob key_blob(blob); in TEST_F() local 332 EXPECT_NE(nullptr, key_blob.key_material); in TEST_F() 333 EXPECT_EQ(0U, key_blob.key_material_size); in TEST_F() 336 DeserializeIntegrityAssuredBlob(key_blob, hidden_, &key_material_, &hw_enforced_, in TEST_F() 340 DeserializeAuthEncryptedBlob(key_blob, &ciphertext_, &hw_enforced_, &sw_enforced_, in TEST_F() 348 KeymasterKeyBlob key_blob(blob); in TEST_F() local 349 EXPECT_EQ(nullptr, key_blob.key_material); in TEST_F() [all …]
|
D | android_keymaster_messages_test.cpp | 143 rsp.key_blob.key_material = dup_array(TEST_DATA); in TEST() 144 rsp.key_blob.key_material_size = array_length(TEST_DATA); in TEST() 158 rsp.key_blob.key_material = dup_array(TEST_DATA); in TEST() 159 rsp.key_blob.key_material_size = array_length(TEST_DATA); in TEST() 166 EXPECT_EQ(0U, deserialized->key_blob.key_material_size); in TEST() 178 EXPECT_EQ(3U, deserialized->key_blob.key_material_size); in TEST() 179 EXPECT_EQ(0, memcmp(deserialized->key_blob.key_material, "foo", 3)); in TEST() 205 EXPECT_EQ(3U, deserialized->key_blob.key_material_size); in TEST() 206 EXPECT_EQ(0, memcmp(deserialized->key_blob.key_material, "foo", 3)); in TEST() 409 EXPECT_EQ(msg.key_blob.key_material_size, deserialized->key_blob.key_material_size); in TEST() [all …]
|
D | android_keymaster_test_utils.h | 410 uint8_t** key_blob, size_t* key_blob_length) { in counting_generate_keypair() 412 int result = device(dev)->generate_keypair(device(dev), key_type, key_params, key_blob, in counting_generate_keypair() 415 munge_blob(*key_blob, *key_blob_length); in counting_generate_keypair() 420 const size_t key_length, uint8_t** key_blob, in counting_import_keypair() 424 device(dev)->import_keypair(device(dev), key, key_length, key_blob, key_blob_length); in counting_import_keypair() 426 munge_blob(*key_blob, *key_blob_length); in counting_import_keypair() 431 const uint8_t* key_blob, const size_t key_blob_length, in counting_get_keypair_public() 434 std::unique_ptr<uint8_t[]> dup_blob(unmunge_blob(key_blob, key_blob_length)); in counting_get_keypair_public() 439 static int counting_delete_keypair(const struct keymaster0_device* dev, const uint8_t* key_blob, in counting_delete_keypair() 442 if (key_blob && key_blob_length > 0) in counting_delete_keypair() [all …]
|
/system/core/trusty/keymaster/include/trusty_keymaster/legacy/ |
D | trusty_keymaster_device.h | 50 keymaster_key_blob_t* key_blob, 52 keymaster_error_t get_key_characteristics(const keymaster_key_blob_t* key_blob, 58 const keymaster_blob_t* key_data, keymaster_key_blob_t* key_blob, 101 keymaster_key_blob_t* key_blob, 104 const keymaster_key_blob_t* key_blob, 112 keymaster_key_blob_t* key_blob,
|
/system/keymaster/include/keymaster/ |
D | android_keymaster_messages.h | 285 key_blob.key_material = nullptr; in KeymasterResponse() 286 key_blob.key_material_size = 0; in KeymasterResponse() 294 keymaster_key_blob_t key_blob; member 302 key_blob.key_material = nullptr; in KeymasterMessage() 303 key_blob.key_material_size = 0; in KeymasterMessage() 316 keymaster_key_blob_t key_blob; member 333 key_blob.key_material = nullptr; in KeymasterMessage() 334 key_blob.key_material_size = 0; in KeymasterMessage() 336 ~BeginOperationRequest() { delete[] key_blob.key_material; } in ~BeginOperationRequest() 348 keymaster_key_blob_t key_blob; member [all …]
|
D | soft_keymaster_device.h | 139 keymaster_key_blob_t* key_blob, 142 const keymaster_key_blob_t* key_blob, 150 keymaster_key_blob_t* key_blob, 188 keymaster_key_blob_t* key_blob, 191 const keymaster_key_blob_t* key_blob, 199 keymaster_key_blob_t* key_blob,
|
/system/keymaster/contexts/ |
D | soft_keymaster_device.cpp | 741 keymaster_key_blob_t* key_blob, keymaster_key_characteristics_t** characteristics) { in generate_key() argument 745 if (!key_blob) in generate_key() 755 return km1_dev->generate_key(km1_dev, params, key_blob, characteristics); in generate_key() 762 key_blob->key_material_size = response.key_blob.key_material_size; in generate_key() 763 uint8_t* tmp = reinterpret_cast<uint8_t*>(malloc(key_blob->key_material_size)); in generate_key() 766 memcpy(tmp, response.key_blob.key_material, response.key_blob.key_material_size); in generate_key() 767 key_blob->key_material = tmp; in generate_key() 787 keymaster_key_blob_t* key_blob, in generate_key() argument 795 if (!key_blob) in generate_key() 826 keymaster_error_t error = km1_dev->generate_key(km1_dev, &request.key_description, key_blob, in generate_key() [all …]
|
/system/keymaster/include/keymaster/legacy_support/ |
D | keymaster1_legacy_support.h | 72 KeymasterKeyBlob* key_blob, AuthorizationSet* hw_enforced, in GenerateKey() argument 75 return software_digest_factory_.GenerateKey(key_description, key_blob, hw_enforced, in GenerateKey() 78 return passthrough_factory_.GenerateKey(key_description, key_blob, hw_enforced, in GenerateKey() 146 KeymasterKeyBlob* key_blob, AuthorizationSet* hw_enforced,
|
D | keymaster_passthrough_key.h | 44 KeymasterKeyBlob* key_blob, AuthorizationSet* hw_enforced, in GenerateKey() argument 46 return engine_->GenerateKey(key_description, key_blob, hw_enforced, sw_enforced); in GenerateKey()
|
/system/keymaster/km_openssl/ |
D | symmetric_key.cpp | 34 KeymasterKeyBlob* key_blob, in GenerateKey() argument 37 if (!key_blob || !hw_enforced || !sw_enforced) in GenerateKey() 60 return blob_maker_.CreateKeyBlob(key_description, KM_ORIGIN_GENERATED, key_material, key_blob, in GenerateKey()
|
D | openssl_utils.cpp | 112 keymaster_error_t EvpKeyToKeyMaterial(const EVP_PKEY* pkey, KeymasterKeyBlob* key_blob) { in EvpKeyToKeyMaterial() argument 117 if (!key_blob->Reset(key_data_size)) in EvpKeyToKeyMaterial() 120 uint8_t* tmp = key_blob->writable_data(); in EvpKeyToKeyMaterial()
|
D | rsa_key_factory.cpp | 53 KeymasterKeyBlob* key_blob, in GenerateKey() argument 56 if (!key_blob || !hw_enforced || !sw_enforced) in GenerateKey() 99 return blob_maker_.CreateKeyBlob(authorizations, KM_ORIGIN_GENERATED, key_material, key_blob, in GenerateKey()
|