/aosp12/system/keymaster/tests/ |
H A D | android_keymaster_test.cpp | 2303 string ciphertext; in TEST_P() local 2349 ++ciphertext[ciphertext.size() / 2]; in TEST_P() 2400 string ciphertext; in TEST_P() local 2470 const string ciphertext = hex2str(test.ciphertext); in TEST_P() local 2606 string ciphertext; in TEST_P() local 2667 string ciphertext; in TEST_P() local 2730 string ciphertext; in TEST_P() local 2825 string ciphertext; in TEST_P() local 2865 string ciphertext; in TEST_P() local 3189 ++ciphertext[ciphertext.size() / 2]; in TEST_P() [all …]
|
H A D | android_keymaster_test_utils.cpp | 469 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() 571 return ProcessMessage(KM_PURPOSE_DECRYPT, ciphertext, begin_params, update_params); in DecryptMessage() 690 string ciphertext = in CheckAesCtrTestVector() local [all …]
|
H A D | android_keymaster_test_utils.h | 269 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,
|
H A D | key_blob_test.cpp | 122 encrypted_key_.ciphertext.begin(), encrypted_key_.ciphertext.end())); in TEST_F() 189 encrypted_key_.ciphertext.begin(), encrypted_key_.ciphertext.end()); in TEST_F()
|
/aosp12/system/keymaster/cppcose/ |
H A D | cppcose.cpp | 225 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() 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() 359 if (!ciphertext->asBstr()) return "Invalid ciphertext"; in decryptCoseEncrypt() 414 bytevec ciphertext(plaintext.size() + kAesGcmTagSize); in aesGcmEncrypt() local [all …]
|
/aosp12/system/keymaster/key_blob_utils/ |
H A D | ocb_utils.cpp | 116 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()
|
H A D | auth_encrypted_key_blob.cpp | 138 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() 228 buf = encrypted_key.ciphertext.Serialize(buf, end); in SerializeAuthEncryptedBlob() 259 !retval.encrypted_key.ciphertext.Deserialize(buf_ptr, end) || // in DeserializeAuthEncryptedBlob() 305 retval.nonce, &retval.ciphertext, &retval.tag); in EncryptKey() [all …]
|
/aosp12/hardware/interfaces/keymaster/4.0/vts/functional/ |
H A D | keymaster_hidl_hal_test.cpp | 2787 string ciphertext; in TEST_P() local 2856 ++ciphertext[ciphertext.size() / 2]; in TEST_P() 3070 const string ciphertext = hex2str(test.ciphertext); in TEST_P() local 3267 string ciphertext; in TEST_P() local 3318 string ciphertext; in TEST_P() local 3425 string ciphertext; in TEST_P() local 3516 string ciphertext; in TEST_P() local 3563 string ciphertext; in TEST_P() local 3623 string ciphertext; in TEST_P() local 3883 ++ciphertext[ciphertext.size() / 2]; in TEST_P() [all …]
|
H A D | KeymasterHidlTest.cpp | 481 EXPECT_EQ(expected_ciphertext, ciphertext); in CheckAesCtrTestVector() 549 string ciphertext = EncryptMessage(message, params, &out_params); in EncryptMessage() local 551 return ciphertext; in EncryptMessage() 559 string ciphertext = EncryptMessage(message, params, &out_params); in EncryptMessage() local 561 return ciphertext; in EncryptMessage() 569 string ciphertext = EncryptMessage(message, params, &out_params); in EncryptMessage() local 574 return ciphertext; in EncryptMessage() 586 return ciphertext; in EncryptMessage() 600 return ciphertext; in EncryptMessage() 615 return DecryptMessage(key_blob_, ciphertext, params); in DecryptMessage() [all …]
|
H A D | KeymasterHidlTest.h | 197 string DecryptMessage(const HidlBuf& key_blob, const string& ciphertext, 199 string DecryptMessage(const string& ciphertext, const AuthorizationSet& params); 200 string DecryptMessage(const string& ciphertext, BlockMode block_mode, PaddingMode padding_mode,
|
/aosp12/system/security/keystore2/src/ |
H A D | ec_crypto.rs | 97 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()
|
H A D | super_key.rs | 179 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()
|
/aosp12/system/vold/ |
H A D | KeyStorage.cpp | 380 const KeyBuffer& message, std::string* ciphertext) { in encryptWithKeymasterKey() argument 400 *ciphertext = nonce + body + mac; in encryptWithKeymasterKey() 407 const std::string nonce = ciphertext.substr(0, GCM_NONCE_BYTES); in decryptWithKeymasterKey() 408 auto bodyAndMac = ciphertext.substr(GCM_NONCE_BYTES); in decryptWithKeymasterKey() 471 std::string* ciphertext) { in encryptWithoutKeymaster() argument 475 if (!readRandomBytesOrLog(GCM_NONCE_BYTES, ciphertext)) return false; in encryptWithoutKeymaster() 488 ciphertext->resize(GCM_NONCE_BYTES + plaintext.size() + GCM_MAC_BYTES); in encryptWithoutKeymaster() 522 if (ciphertext.size() < GCM_NONCE_BYTES + GCM_MAC_BYTES) { in decryptWithoutKeymaster() 523 LOG(ERROR) << "GCM ciphertext too small: " << ciphertext.size(); in decryptWithoutKeymaster() 537 reinterpret_cast<const uint8_t*>(ciphertext.data()))) { in decryptWithoutKeymaster() [all …]
|
/aosp12/hardware/interfaces/keymaster/3.0/vts/functional/ |
H A D | keymaster_hidl_hal_test.cpp | 2926 string ciphertext; in TEST_P() local 2995 ++ciphertext[ciphertext.size() / 2]; in TEST_P() 3204 const string ciphertext = hex2str(test.ciphertext); in TEST_P() local 3401 string ciphertext; in TEST_P() local 3471 string ciphertext; in TEST_P() local 3562 string ciphertext; in TEST_P() local 3609 string ciphertext; in TEST_P() local 3668 string ciphertext; in TEST_P() local 3716 string ciphertext; in TEST_P() local 3760 string ciphertext; in TEST_P() local [all …]
|
/aosp12/frameworks/base/services/core/java/com/android/server/locksettings/ |
H A D | ManagedProfilePasswordCache.java | 118 byte[] ciphertext = cipher.doFinal(password.getCredential()); in storePassword() 120 byte[] block = Arrays.copyOf(iv, ciphertext.length + iv.length); in storePassword() 121 System.arraycopy(ciphertext, 0, block, iv.length, ciphertext.length); in storePassword() 149 byte[] ciphertext = Arrays.copyOfRange(block, 12, block.length); in retrievePassword() 154 credential = cipher.doFinal(ciphertext); in retrievePassword()
|
H A D | SyntheticPasswordCrypto.java | 68 byte[] ciphertext = Arrays.copyOfRange(blob, PROFILE_KEY_IV_SIZE, blob.length); in decrypt() 72 return cipher.doFinal(ciphertext); in decrypt() 86 byte[] ciphertext = cipher.doFinal(blob); in encrypt() 98 outputStream.write(ciphertext); in encrypt() 116 public static byte[] decrypt(byte[] keyBytes, byte[] personalisation, byte[] ciphertext) { in decrypt() argument 121 return decrypt(key, ciphertext); in decrypt()
|
/aosp12/hardware/interfaces/security/keymint/aidl/vts/functional/ |
H A D | KeyMintTest.cpp | 4478 ++ciphertext[ciphertext.size() / 2]; in TEST_P() 4678 const string ciphertext = hex2str(test.ciphertext); in TEST_P() local 4872 string ciphertext; in TEST_P() local 4915 string ciphertext; in TEST_P() local 5042 string ciphertext; in TEST_P() local 5131 string ciphertext; in TEST_P() local 5178 string ciphertext; in TEST_P() local 5219 string ciphertext; in TEST_P() local 5252 string ciphertext; in TEST_P() local 5445 ++ciphertext[ciphertext.size() / 2]; in TEST_P() [all …]
|
H A D | KeyMintAidlTestBase.cpp | 651 EXPECT_EQ(expected_ciphertext, ciphertext); in CheckAesCtrTestVector() 909 return ciphertext; in EncryptMessage() 919 return ciphertext; in EncryptMessage() 932 return ciphertext; in EncryptMessage() 944 return ciphertext; in EncryptMessage() 958 return ciphertext; in EncryptMessage() 970 return ciphertext; in EncryptMessage() 974 const string& ciphertext, in DecryptMessage() argument 987 return DecryptMessage(key_blob_, ciphertext, params); in DecryptMessage() 997 return DecryptMessage(key_blob_, ciphertext, params); in DecryptMessage() [all …]
|
H A D | KeyMintAidlTestBase.h | 202 string DecryptMessage(const vector<uint8_t>& key_blob, const string& ciphertext, 204 string DecryptMessage(const string& ciphertext, const AuthorizationSet& params); 205 string DecryptMessage(const string& ciphertext, BlockMode block_mode, PaddingMode padding_mode,
|
/aosp12/frameworks/base/services/core/java/com/android/server/locksettings/recoverablekeystore/ |
H A D | SecureBox.java | 204 byte[] ciphertext = aesGcmEncrypt(encryptionKey, randNonce, payload, header); in encrypt() 206 return concat(VERSION, randNonce, ciphertext); in encrypt() 209 VERSION, encodePublicKey(senderKeyPair.getPublic()), randNonce, ciphertext); in encrypt() 270 byte[] ciphertext = readEncryptedPayload(ciphertextBuffer, ciphertextBuffer.remaining()); in decrypt() 273 return aesGcmDecrypt(decryptionKey, randNonce, ciphertext, header); in decrypt() 335 private static byte[] aesGcmDecrypt(SecretKey key, byte[] nonce, byte[] ciphertext, byte[] aad) in aesGcmDecrypt() argument 337 return aesGcmInternal(AesGcmOperation.DECRYPT, key, nonce, ciphertext, aad); in aesGcmDecrypt()
|
/aosp12/system/keymaster/include/keymaster/key_blob_utils/ |
H A D | ocb_utils.h | 38 KeymasterKeyBlob* ciphertext, Buffer* tag); 43 const KeymasterKeyBlob& ciphertext, const Buffer& nonce,
|
H A D | auth_encrypted_key_blob.h | 48 KeymasterKeyBlob ciphertext; member
|
/aosp12/system/security/keystore2/src/crypto/ |
H A D | lib.rs | 136 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()
|
/aosp12/system/security/keystore2/src/km_compat/ |
H A D | lib.rs | 304 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()
|
/aosp12/system/security/keystore/ |
H A D | keystore_cli_v2.cpp | 396 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()
|