Home
last modified time | relevance | path

Searched refs:ciphertext (Results 1 – 15 of 15) sorted by relevance

/system/keymaster/key_blob_utils/
Docb_utils.cpp116 KeymasterKeyBlob* ciphertext, Buffer* tag) { in OcbEncryptKey() argument
117 assert(ciphertext && tag); in OcbEncryptKey()
129 if (!ciphertext->Reset(plaintext.key_material_size)) return KM_ERROR_MEMORY_ALLOCATION_FAILED; in OcbEncryptKey()
133 0 /* additional data length */, ciphertext->writable_data(), in OcbEncryptKey()
147 const KeymasterKeyBlob& ciphertext, const Buffer& nonce, in OcbDecryptKey() argument
161 if (!plaintext->Reset(ciphertext.key_material_size)) return KM_ERROR_MEMORY_ALLOCATION_FAILED; in OcbDecryptKey()
163 int ae_err = ae_decrypt(ctx.get(), nonce.peek_read(), ciphertext.key_material, in OcbDecryptKey()
164 ciphertext.key_material_size, nullptr /* additional data */, in OcbDecryptKey()
177 assert(ae_err == static_cast<int>(ciphertext.key_material_size)); in OcbDecryptKey()
Dauth_encrypted_key_blob.cpp138 retval.ciphertext = KeymasterKeyBlob(ciphertext_len); in AesGcmEncryptKey()
144 EVP_EncryptUpdate(ctx.get(), retval.ciphertext.writable_data(), &ciphertext_len, in AesGcmEncryptKey()
146 EVP_EncryptFinal_ex(ctx.get(), retval.ciphertext.writable_data() /* not written to */, in AesGcmEncryptKey()
177 int plaintext_len = key.encrypted_key.ciphertext.size(); in AesGcmDecryptKey()
183 key.encrypted_key.ciphertext.key_material, in AesGcmDecryptKey()
184 key.encrypted_key.ciphertext.size()) && in AesGcmDecryptKey()
197 if (key.encrypted_key.ciphertext.size() != plaintext.size() || 0 != unused_len) { in AesGcmDecryptKey()
214 encrypted_key.ciphertext.SerializedSize() + encrypted_key.tag.SerializedSize() + in SerializeAuthEncryptedBlob()
228 buf = encrypted_key.ciphertext.Serialize(buf, end); in SerializeAuthEncryptedBlob()
259 !retval.encrypted_key.ciphertext.Deserialize(buf_ptr, end) || // in DeserializeAuthEncryptedBlob()
[all …]
/system/security/keystore2/src/
Dec_crypto.rs97 let (ciphertext, iv, tag) = aes_gcm_encrypt(message, &aes_key) in encrypt_message()
99 Ok((sender_public_key, salt, iv, ciphertext, tag)) in encrypt_message()
108 ciphertext: &[u8], in decrypt_message()
115 aes_gcm_decrypt(ciphertext, iv, tag, &aes_key) in decrypt_message()
128 let (sender_public_key, salt, iv, ciphertext, tag) = in test_crypto_roundtrip()
132 recipient.decrypt_message(&sender_public_key, &salt, &iv, &ciphertext, &tag)?; in test_crypto_roundtrip()
Dsuper_key.rs179 ciphertext: Vec<u8>, // with tag appended field
184 let (mut ciphertext, nonce, mut tag) = aes_gcm_encrypt(&to_encrypt.key, key)?; in new()
185 ciphertext.append(&mut tag); in new()
186 Ok(LockedKey { algorithm: to_encrypt.algorithm, id: to_encrypt.id, nonce, ciphertext }) in new()
220 &self.ciphertext, in decrypt()
/system/keymaster/cppcose/
Dcppcose.cpp225 auto ciphertext = aesGcmEncrypt(key, nonce, in createCoseEncryptCiphertext() local
233 if (!ciphertext) return ciphertext.moveMessage(); in createCoseEncryptCiphertext()
234 return ciphertext.moveValue(); in createCoseEncryptCiphertext()
245 auto ciphertext = in constructCoseEncrypt() local
247 if (!ciphertext) return ciphertext.moveMessage(); in constructCoseEncrypt()
252 .add(*ciphertext) // Payload in constructCoseEncrypt()
273 auto& ciphertext = recipient->asArray()->get(2); in getSenderPubKeyFromCoseEncrypt() local
274 if (!ciphertext->asSimple() || !ciphertext->asSimple()->asNull()) { in getSenderPubKeyFromCoseEncrypt()
276 cppbor::prettyPrint(ciphertext.get()); in getSenderPubKeyFromCoseEncrypt()
330 auto& ciphertext = coseEncrypt->asArray()->get(kCoseEncryptPayload); in decryptCoseEncrypt() local
[all …]
/system/keymaster/tests/
Dandroid_keymaster_test.cpp1540 string ciphertext = EncryptMessage(message, KM_MODE_ECB, KM_PAD_PKCS7); in TEST_P() local
1541 string plaintext = DecryptMessage(ciphertext, KM_MODE_ECB, KM_PAD_PKCS7); in TEST_P()
1714 string ciphertext = ProcessMessage(KM_PURPOSE_ENCRYPT, message, params); in TEST_F() local
1715 string plaintext = ProcessMessage(KM_PURPOSE_DECRYPT, ciphertext, params); in TEST_F()
1836 string ciphertext = EncryptMessage(message, KM_PAD_NONE); in TEST_P() local
1837 EXPECT_EQ(256U / 8, ciphertext.size()); in TEST_P()
1840 string plaintext = DecryptMessage(ciphertext, KM_PAD_NONE); in TEST_P()
1984 string ciphertext = EncryptMessage(string(message), KM_DIGEST_SHA_2_256, KM_PAD_RSA_OAEP); in TEST_P() local
1985 EXPECT_EQ(key_size / 8, ciphertext.size()); in TEST_P()
1987 string plaintext = DecryptMessage(ciphertext, KM_DIGEST_SHA_2_256, KM_PAD_RSA_OAEP); in TEST_P()
[all …]
Dandroid_keymaster_test_utils.cpp469 string ciphertext = in EncryptMessage() local
478 return ciphertext; in EncryptMessage()
508 string ciphertext = in EncryptMessage() local
517 return ciphertext; in EncryptMessage()
527 string ciphertext = in EncryptMessage() local
536 return ciphertext; in EncryptMessage()
546 string ciphertext = in EncryptMessage() local
555 return ciphertext; in EncryptMessage()
566 string Keymaster2Test::DecryptMessage(const string& ciphertext, keymaster_padding_t padding) { in DecryptMessage() argument
571 return ProcessMessage(KM_PURPOSE_DECRYPT, ciphertext, begin_params, update_params); in DecryptMessage()
[all …]
Dandroid_keymaster_test_utils.h269 std::string DecryptMessage(const std::string& ciphertext, keymaster_padding_t padding);
270 std::string DecryptMessage(const std::string& ciphertext, keymaster_digest_t digest,
272 std::string DecryptMessage(const std::string& ciphertext, keymaster_block_mode_t block_mode,
274 std::string DecryptMessage(const std::string& ciphertext, keymaster_digest_t digest,
276 std::string DecryptMessage(const std::string& ciphertext, keymaster_digest_t digest,
278 std::string DecryptMessage(const std::string& ciphertext, keymaster_block_mode_t block_mode,
280 std::string DecryptMessage(const AuthorizationSet& update_params, const std::string& ciphertext,
283 std::string DecryptMessage(const AuthorizationSet& update_params, const std::string& ciphertext,
Dkey_blob_test.cpp122 encrypted_key_.ciphertext.begin(), encrypted_key_.ciphertext.end())); in TEST_F()
189 encrypted_key_.ciphertext.begin(), encrypted_key_.ciphertext.end()); in TEST_F()
/system/vold/
DKeyStorage.cpp380 const KeyBuffer& message, std::string* ciphertext) { in encryptWithKeymasterKey() argument
402 *ciphertext = nonce + body + mac; in encryptWithKeymasterKey()
408 const std::string& ciphertext, KeyBuffer* message) { in decryptWithKeymasterKey() argument
409 const std::string nonce = ciphertext.substr(0, GCM_NONCE_BYTES); in decryptWithKeymasterKey()
410 auto bodyAndMac = ciphertext.substr(GCM_NONCE_BYTES); in decryptWithKeymasterKey()
474 std::string* ciphertext) { in encryptWithoutKeymaster() argument
478 if (!readRandomBytesOrLog(GCM_NONCE_BYTES, ciphertext)) return false; in encryptWithoutKeymaster()
487 reinterpret_cast<const uint8_t*>(ciphertext->data()))) { in encryptWithoutKeymaster()
491 ciphertext->resize(GCM_NONCE_BYTES + plaintext.size() + GCM_MAC_BYTES); in encryptWithoutKeymaster()
494 ctx.get(), reinterpret_cast<uint8_t*>(&(*ciphertext)[0] + GCM_NONCE_BYTES), in encryptWithoutKeymaster()
[all …]
/system/keymaster/include/keymaster/key_blob_utils/
Docb_utils.h38 KeymasterKeyBlob* ciphertext, Buffer* tag);
43 const KeymasterKeyBlob& ciphertext, const Buffer& nonce,
Dauth_encrypted_key_blob.h48 KeymasterKeyBlob ciphertext; member
/system/security/keystore2/src/crypto/
Dlib.rs136 let mut ciphertext: Vec<u8> = vec![0; plaintext.len()]; in aes_gcm_encrypt() localVariable
144 ciphertext.as_mut_ptr(), in aes_gcm_encrypt()
152 Ok((ciphertext, iv, tag)) in aes_gcm_encrypt()
/system/security/keystore2/src/km_compat/
Dlib.rs304 let ciphertext = result.unwrap(); in test_begin_update_finish() localVariable
305 assert!(!ciphertext.is_empty()); in test_begin_update_finish()
320 &ciphertext, in test_begin_update_finish()
/system/security/keystore/
Dkeystore_cli_v2.cpp396 auto ciphertext = std::move(*optCiphertext); in encryptWithAuthentication() local
398 toBeSigned.insert(toBeSigned.end(), ciphertext.begin(), ciphertext.end()); in encryptWithAuthentication()
432 protobuf.set_encrypted_data(ciphertext.data(), ciphertext.size()); in encryptWithAuthentication()