/system/keymaster/key_blob_utils/ |
D | ocb_utils.cpp | 115 const KeymasterKeyBlob& plaintext, const Buffer& nonce, in OcbEncryptKey() argument 129 if (!ciphertext->Reset(plaintext.key_material_size)) return KM_ERROR_MEMORY_ALLOCATION_FAILED; in OcbEncryptKey() 131 int ae_err = ae_encrypt(ctx.get(), nonce.peek_read(), plaintext.key_material, in OcbEncryptKey() 132 plaintext.key_material_size, nullptr /* additional data */, in OcbEncryptKey() 140 assert(ae_err == static_cast<int>(plaintext.key_material_size)); in OcbEncryptKey() 148 const Buffer& tag, KeymasterKeyBlob* plaintext) { in OcbDecryptKey() argument 149 assert(plaintext); in OcbDecryptKey() 161 if (!plaintext->Reset(ciphertext.key_material_size)) return KM_ERROR_MEMORY_ALLOCATION_FAILED; in OcbDecryptKey() 165 0 /* additional data length */, plaintext->writable_data(), in OcbDecryptKey() 170 plaintext->Clear(); in OcbDecryptKey()
|
D | auth_encrypted_key_blob.cpp | 118 const KeymasterKeyBlob& plaintext, // in AesGcmEncryptKey() argument 134 int ciphertext_len = plaintext.size(); in AesGcmEncryptKey() 145 plaintext.key_material, plaintext.size()) && in AesGcmEncryptKey() 154 if (plaintext.size() != static_cast<size_t>(ciphertext_len) || 0 != unused_len || in AesGcmEncryptKey() 179 KeymasterKeyBlob plaintext(plaintext_len); in AesGcmDecryptKey() local 182 EVP_DecryptUpdate(ctx.get(), plaintext.writable_data(), &plaintext_len, in AesGcmDecryptKey() 191 if (!EVP_DecryptFinal_ex(ctx.get(), plaintext.writable_data() /* not written to */, in AesGcmDecryptKey() 197 if (key.encrypted_key.ciphertext.size() != plaintext.size() || 0 != unused_len) { in AesGcmDecryptKey() 201 return plaintext; in AesGcmDecryptKey() 290 EncryptedKey EncryptKey(const KeymasterKeyBlob& plaintext, AuthEncryptedBlobFormat format, in EncryptKey() argument [all …]
|
/system/keymaster/tests/ |
D | android_keymaster_test.cpp | 1541 string plaintext = DecryptMessage(ciphertext, KM_MODE_ECB, KM_PAD_PKCS7); in TEST_P() local 1542 EXPECT_EQ(message, plaintext); in TEST_P() 1715 string plaintext = ProcessMessage(KM_PURPOSE_DECRYPT, ciphertext, params); in TEST_F() local 1717 EXPECT_EQ(message, plaintext); in TEST_F() 1840 string plaintext = DecryptMessage(ciphertext, KM_PAD_NONE); in TEST_P() local 1842 EXPECT_EQ(expected_plaintext, plaintext); in TEST_P() 1987 string plaintext = DecryptMessage(ciphertext, KM_DIGEST_SHA_2_256, KM_PAD_RSA_OAEP); in TEST_P() local 1988 EXPECT_EQ(message, plaintext); in TEST_P() 2003 string plaintext = in TEST_P() local 2005 EXPECT_EQ(message, plaintext); in TEST_P() [all …]
|
D | key_blob_test.cpp | 135 KeymasterKeyBlob plaintext = DecryptKey(move(deserialized), hidden_, master_key_, &error); in TEST_F() local 137 ASSERT_EQ(key_material_.size(), plaintext.size()); in TEST_F() 138 EXPECT_TRUE(std::equal(key_material_.begin(), key_material_.end(), plaintext.begin())); in TEST_F()
|
/system/keymaster/include/keymaster/key_blob_utils/ |
D | ocb_utils.h | 37 const KeymasterKeyBlob& plaintext, const Buffer& nonce, 44 const Buffer& tag, KeymasterKeyBlob* plaintext);
|
D | auth_encrypted_key_blob.h | 63 EncryptedKey EncryptKey(const KeymasterKeyBlob& plaintext, AuthEncryptedBlobFormat format,
|
/system/vold/ |
D | KeyStorage.cpp | 473 static bool encryptWithoutKeymaster(const std::string& preKey, const KeyBuffer& plaintext, in encryptWithoutKeymaster() argument 491 ciphertext->resize(GCM_NONCE_BYTES + plaintext.size() + GCM_MAC_BYTES); in encryptWithoutKeymaster() 495 &outlen, reinterpret_cast<const uint8_t*>(plaintext.data()), plaintext.size())) { in encryptWithoutKeymaster() 499 if (outlen != static_cast<int>(plaintext.size())) { in encryptWithoutKeymaster() 500 LOG(ERROR) << "GCM ciphertext length should be " << plaintext.size() << " was " << outlen; in encryptWithoutKeymaster() 505 reinterpret_cast<uint8_t*>(&(*ciphertext)[0] + GCM_NONCE_BYTES + plaintext.size()), in encryptWithoutKeymaster() 516 plaintext.size()))) { in encryptWithoutKeymaster() 524 KeyBuffer* plaintext) { in decryptWithoutKeymaster() argument 544 *plaintext = KeyBuffer(ciphertext.size() - GCM_NONCE_BYTES - GCM_MAC_BYTES); in decryptWithoutKeymaster() 546 if (1 != EVP_DecryptUpdate(ctx.get(), reinterpret_cast<uint8_t*>(&(*plaintext)[0]), &outlen, in decryptWithoutKeymaster() [all …]
|
/system/keymaster/cppcose/ |
D | cppcose.cpp | 410 const bytevec& plaintext) { in aesGcmEncrypt() argument 414 bytevec ciphertext(plaintext.size() + kAesGcmTagSize); in aesGcmEncrypt() 416 if (!EVP_CipherUpdate(ctx->get(), ciphertext.data(), &outlen, plaintext.data(), in aesGcmEncrypt() 417 plaintext.size())) { in aesGcmEncrypt() 420 assert(plaintext.size() == static_cast<uint64_t>(outlen)); in aesGcmEncrypt() 428 ciphertext.data() + plaintext.size())) { in aesGcmEncrypt() 442 bytevec plaintext(ciphertextWithTag.size() - kAesGcmTagSize); in aesGcmDecrypt() local 444 if (!EVP_CipherUpdate(ctx->get(), plaintext.data(), &outlen, ciphertextWithTag.data(), in aesGcmDecrypt() 448 assert(plaintext.size() == static_cast<uint64_t>(outlen)); in aesGcmDecrypt() 460 return plaintext; in aesGcmDecrypt()
|
/system/keymaster/contexts/ |
D | pure_soft_keymaster_context.cpp | 507 Buffer encrypted_key, plaintext; in UnwrapKey() local 508 if (!plaintext.Reinitialize(secure_key.key_material_size + tag.data_length)) { in UnwrapKey() 530 error = aes_operation->Update(update_params, encrypted_key, &update_outparams, &plaintext, in UnwrapKey() 537 &finish_out_params, &plaintext); in UnwrapKey() 540 *wrapped_key_material = {plaintext.peek_read(), plaintext.available_read()}; in UnwrapKey() 541 if (!wrapped_key_material->key_material && plaintext.peek_read()) { in UnwrapKey()
|
/system/security/keystore2/src/crypto/ |
D | lib.rs | 124 pub fn aes_gcm_encrypt(plaintext: &[u8], key: &[u8]) -> Result<(Vec<u8>, Vec<u8>, Vec<u8>), Error> { in aes_gcm_encrypt() 136 let mut ciphertext: Vec<u8> = vec![0; plaintext.len()]; in aes_gcm_encrypt() 143 plaintext.as_ptr(), in aes_gcm_encrypt() 145 plaintext.len(), in aes_gcm_encrypt()
|
/system/keymaster/include/keymaster/cppcose/ |
D | cppcose.h | 288 const bytevec& plaintext);
|