/system/keymint/common/src/crypto/ |
D | aes.rs | 17 use super::{nonce, Rng}; 88 nonce: [u8; BLOCK_SIZE], 93 nonce: [u8; BLOCK_SIZE], 98 nonce: [u8; BLOCK_SIZE], 107 GcmTag12 { nonce: [u8; GCM_NONCE_SIZE] }, 108 GcmTag13 { nonce: [u8; GCM_NONCE_SIZE] }, 109 GcmTag14 { nonce: [u8; GCM_NONCE_SIZE] }, 110 GcmTag15 { nonce: [u8; GCM_NONCE_SIZE] }, 111 GcmTag16 { nonce: [u8; GCM_NONCE_SIZE] }, 148 let nonce: [u8; BLOCK_SIZE] = in new() localVariable [all …]
|
D | des.rs | 17 use super::{nonce, Rng}; 69 nonce: [u8; BLOCK_SIZE], 74 nonce: [u8; BLOCK_SIZE], 103 let nonce: [u8; BLOCK_SIZE] = nonce(BLOCK_SIZE, caller_nonce, rng)? in new() localVariable 107 PaddingMode::None => Ok(Mode::CbcNoPadding { nonce }), in new() 108 PaddingMode::Pkcs7 => Ok(Mode::CbcPkcs7Padding { nonce }), in new()
|
/system/security/mls/mls-rs-crypto-boringssl/src/ |
D | aead.rs | 94 nonce: &[u8], in seal() 102 if nonce.len() != self.nonce_size() { in seal() 104 len: nonce.len(), in seal() 109 let nonce_array = nonce[..self.nonce_size()].try_into()?; in seal() 133 nonce: &[u8], in open() 144 if nonce.len() != self.nonce_size() { in open() 146 len: nonce.len(), in open() 151 let nonce_array = nonce[..self.nonce_size()].try_into()?; in open() 212 let nonce = vec![42u8; aead.nonce_size()]; in seal_and_open() localVariable 215 let ciphertext = aead.seal(&key, plaintext, None, &nonce).unwrap(); in seal_and_open() [all …]
|
/system/core/trusty/keymaster/keymint/ |
D | TrustySharedSecret.cpp | 31 params->nonce = {std::begin(response.params.nonce), std::end(response.params.nonce)}; in getSharedSecretParameters() 42 if (sizeof(request.params_array.params_array[i].nonce) != params[i].nonce.size()) { in computeSharedSecret() 45 memcpy(request.params_array.params_array[i].nonce, params[i].nonce.data(), in computeSharedSecret() 46 params[i].nonce.size()); in computeSharedSecret()
|
/system/keymaster/ng/ |
D | AndroidSharedSecret.cpp | 40 params->nonce = {std::begin(response.params.nonce), std::end(response.params.nonce)}; in getSharedSecretParameters() 55 if (sizeof(request.params_array.params_array[i].nonce) != params[i].nonce.size()) { in computeSharedSecret() 58 memcpy(request.params_array.params_array[i].nonce, params[i].nonce.data(), in computeSharedSecret() 59 params[i].nonce.size()); in computeSharedSecret()
|
D | AndroidKeymaster4Device.cpp | 252 static_assert(sizeof(response.params.nonce) == params.nonce.size(), "Nonce sizes don't match"); in getHmacSharingParameters() 253 memcpy(params.nonce.data(), response.params.nonce, params.nonce.size()); in getHmacSharingParameters() 267 static_assert(sizeof(request.params_array.params_array[i].nonce) == in computeSharedHmac() 268 decltype(params[i].nonce)::size(), in computeSharedHmac() 270 memcpy(request.params_array.params_array[i].nonce, params[i].nonce.data(), in computeSharedHmac() 271 params[i].nonce.size()); in computeSharedHmac()
|
/system/keymaster/key_blob_utils/ |
D | auth_encrypted_key_blob.cpp | 43 Buffer nonce; in generate_nonce() local 44 if (!nonce.Reinitialize(size)) return KM_ERROR_MEMORY_ALLOCATION_FAILED; in generate_nonce() 46 random.GenerateRandom(nonce.peek_write(), size); in generate_nonce() 47 nonce.advance_write(size); in generate_nonce() 48 return nonce; in generate_nonce() 131 Buffer nonce) { in AesGcmEncryptKey() argument 144 retval.nonce = std::move(nonce); in AesGcmEncryptKey() 148 retval.nonce.peek_read()) && in AesGcmEncryptKey() 182 key.encrypted_key.nonce.peek_read()) && in AesGcmDecryptKey() 211 size_t size = 1 /* version byte */ + encrypted_key.nonce.SerializedSize() + in SerializeAuthEncryptedBlob() [all …]
|
D | ocb_utils.cpp | 115 const KeymasterKeyBlob& plaintext, const Buffer& nonce, in OcbEncryptKey() argument 119 if (nonce.available_read() != OCB_NONCE_LENGTH) return KM_ERROR_INVALID_ARGUMENT; in OcbEncryptKey() 131 int ae_err = ae_encrypt(ctx.get(), nonce.peek_read(), plaintext.key_material, in OcbEncryptKey() 147 const KeymasterKeyBlob& ciphertext, const Buffer& nonce, in OcbDecryptKey() argument 151 if (nonce.available_read() != OCB_NONCE_LENGTH || tag.available_read() != OCB_TAG_LENGTH) in OcbDecryptKey() 163 int ae_err = ae_decrypt(ctx.get(), nonce.peek_read(), ciphertext.key_material, in OcbDecryptKey()
|
D | ocb.c | 757 static block gen_offset_from_nonce(ae_ctx* ctx, const void* nonce) { in gen_offset_from_nonce() argument 781 tmp.u32[1] = ((uint32_t*)nonce)[0]; in gen_offset_from_nonce() 782 tmp.u32[2] = ((uint32_t*)nonce)[1]; in gen_offset_from_nonce() 783 tmp.u32[3] = ((uint32_t*)nonce)[2]; in gen_offset_from_nonce() 934 int ae_encrypt(ae_ctx* ctx, const void* nonce, const void* pt, int pt_len, const void* ad, in ae_encrypt() argument 947 if (nonce) { in ae_encrypt() 948 ctx->offset = gen_offset_from_nonce(ctx, nonce); in ae_encrypt() 1151 int ae_decrypt(ae_ctx* ctx, const void* nonce, const void* ct, int ct_len, const void* ad, in ae_decrypt() argument 1172 if (nonce) { in ae_decrypt() 1173 ctx->offset = gen_offset_from_nonce(ctx, nonce); in ae_decrypt() [all …]
|
/system/keymint/ta/src/ |
D | secret.rs | 26 let mut nonce = vec_try![0u8; 32]?; in get_shared_secret_params() localVariable 27 self.imp.rng.fill_bytes(&mut nonce); in get_shared_secret_params() 28 self.shared_secret_params = Some(SharedSecretParameters { seed: Vec::new(), nonce }); in get_shared_secret_params() 70 if param.nonce.len() != 32 { in shared_secret_context() 71 return Err(km_err!(InvalidArgument, "nonce len {} not 32", param.nonce.len())); in shared_secret_context() 73 result.try_extend_from_slice(¶m.nonce)?; in shared_secret_context()
|
/system/keymaster/km_openssl/ |
D | soft_keymaster_enforcement.cpp | 95 RAND_bytes(saved_params_.nonce, 32); in GetHmacSharingParameters() 99 memcpy(params->nonce, saved_params_.nonce, sizeof(params->nonce)); in GetHmacSharingParameters() 153 return a.seed == b.seed && !memcmp(a.nonce, b.nonce, sizeof(a.nonce)); in operator ==() 169 *context_chunks_pos++ = {params.nonce, sizeof(params.nonce)}; in ComputeSharedHmac()
|
/system/chre/apps/nearby/location/lbs/contexthub/nanoapps/nearby/ |
D | presence_crypto_mic.cc | 53 uint8_t nonce[kAdvNonceSizeSaltDe] = {0}; in decrypt() local 57 STR_LEN_NO_TERM(kAdvNonceInfoSaltDe), nonce, ARRAY_SIZE(nonce)); in decrypt() 61 if (aesCtrInit(&ctx, decryption_key, nonce, AES_128_KEY_TYPE) < 0) { in decrypt()
|
/system/authgraph/boringssl/src/ |
D | aes.rs | 42 nonce: &Nonce12, in encrypt() 45 let mut crypter = ossl!(Crypter::new(cipher, Mode::Encrypt, &key.0, Some(&nonce.0)))?; in encrypt() 65 nonce: &Nonce12, in decrypt() 68 let mut crypter = ossl!(Crypter::new(cipher, Mode::Decrypt, &key.0, Some(&nonce.0)))?; in decrypt()
|
D | rng.rs | 25 fn fill_bytes(&self, nonce: &mut [u8]) { in fill_bytes() 26 openssl::rand::rand_bytes(nonce).unwrap(); // safe: BoringSSL's RAND_bytes() never fails in fill_bytes()
|
/system/keymint/boringssl/src/ |
D | aes.rs | 58 crypto::aes::CipherMode::CbcNoPadding { nonce: n } in begin() 59 | crypto::aes::CipherMode::CbcPkcs7Padding { nonce: n } => { in begin() 67 if let crypto::aes::CipherMode::CbcPkcs7Padding { nonce: _ } = mode { in begin() 75 crypto::aes::CipherMode::Ctr { nonce: n } => { in begin() 101 crypto::aes::GcmMode::GcmTag12 { nonce: n } in begin_aead() 102 | crypto::aes::GcmMode::GcmTag13 { nonce: n } in begin_aead() 103 | crypto::aes::GcmMode::GcmTag14 { nonce: n } in begin_aead() 104 | crypto::aes::GcmMode::GcmTag15 { nonce: n } in begin_aead() 105 | crypto::aes::GcmMode::GcmTag16 { nonce: n } => { in begin_aead()
|
D | des.rs | 50 crypto::des::Mode::CbcNoPadding { nonce: n } in begin() 51 | crypto::des::Mode::CbcPkcs7Padding { nonce: n } => { in begin() 55 if let crypto::des::Mode::CbcPkcs7Padding { nonce: _ } = mode { in begin()
|
/system/keymaster/include/keymaster/key_blob_utils/ |
D | ocb_utils.h | 37 const KeymasterKeyBlob& plaintext, const Buffer& nonce, 43 const KeymasterKeyBlob& ciphertext, const Buffer& nonce,
|
D | ae.h | 94 int ae_encrypt(ae_ctx* ctx, const void* nonce, const void* pt, int pt_len, const void* ad, 124 int ae_decrypt(ae_ctx* ctx, const void* nonce, const void* ct, int ct_len, const void* ad,
|
/system/authgraph/tests/src/ |
D | lib.rs | 161 let nonce = Nonce12(*b"1243567890ab"); in test_aes_gcm_roundtrip() localVariable 162 let ct = aes.encrypt(&key, msg, aad, &nonce).unwrap(); in test_aes_gcm_roundtrip() 163 let pt = aes.decrypt(&key, &ct, aad, &nonce).unwrap(); in test_aes_gcm_roundtrip() 173 assert!(aes.decrypt(&bad_key, &ct, aad, &nonce).is_err()); in test_aes_gcm_roundtrip() 174 assert!(aes.decrypt(&key, &bad_ct, aad, &nonce).is_err()); in test_aes_gcm_roundtrip() 175 assert!(aes.decrypt(&key, &ct, bad_aad, &nonce).is_err()); in test_aes_gcm_roundtrip() 249 let nonce = Nonce12(hex::decode(test.iv).unwrap().try_into().unwrap()); in test_aes_gcm() localVariable 254 let got = aes.encrypt(&key, &msg, &aad, &nonce).unwrap(); in test_aes_gcm() 257 let got_pt = aes.decrypt(&key, &got, &aad, &nonce).unwrap(); in test_aes_gcm() 488 nonce: peer_nonce, in test_key_exchange_init() [all …]
|
/system/keymint/common/src/keyblob/ |
D | legacy.rs | 69 pub nonce: Vec<u8>, field 97 + self.nonce.len() in serialize() 107 result.extend_from_slice(&(self.nonce.len() as u32).to_ne_bytes()); in serialize() 108 result.extend_from_slice(&self.nonce); in serialize() 150 let nonce = consume_vec(&mut data)?; in deserialize() localVariable 170 nonce, in deserialize()
|
/system/keymaster/cppcose/ |
D | cppcose.cpp | 40 const bytevec& nonce, in aesGcmInitAndProcessAad() argument 49 nonce.data(), encrypt ? 1 : 0)) { in aesGcmInitAndProcessAad() 457 ErrMsgOr<bytevec> createCoseEncryptCiphertext(const bytevec& key, const bytevec& nonce, in createCoseEncryptCiphertext() argument 460 auto ciphertext = aesGcmEncrypt(key, nonce, in createCoseEncryptCiphertext() 472 ErrMsgOr<cppbor::Array> constructCoseEncrypt(const bytevec& key, const bytevec& nonce, in constructCoseEncrypt() argument 481 createCoseEncryptCiphertext(key, nonce, encryptProtectedHeader, plaintextPayload, aad); in constructCoseEncrypt() 486 .add(cppbor::Map().add(IV, nonce).canonicalize()) // Unprotected in constructCoseEncrypt() 608 auto& nonce = unprotParms->asMap()->get(IV); in decryptCoseEncrypt() local 609 if (!nonce || !nonce->asBstr() || nonce->asBstr()->value().size() != kAesGcmNonceLength) { in decryptCoseEncrypt() 621 return aesGcmDecrypt(key, nonce->asBstr()->value(), aad, ciphertext->asBstr()->value()); in decryptCoseEncrypt() [all …]
|
/system/security/keystore2/tests/ |
D | keystore2_client_test_utils.rs | 366 nonce: &mut Option<Vec<u8>>, in perform_sample_sym_key_encrypt_op() 374 if let Some(value) = nonce { in perform_sample_sym_key_encrypt_op() 375 op_params = op_params.nonce(value.to_vec()); in perform_sample_sym_key_encrypt_op() 385 if op_response.parameters.is_some() && nonce.is_none() { in perform_sample_sym_key_encrypt_op() 386 *nonce = get_op_nonce(&op_response.parameters.unwrap()); in perform_sample_sym_key_encrypt_op() 397 nonce: &mut Option<Vec<u8>>, in perform_sample_sym_key_decrypt_op() 405 if let Some(value) = nonce { in perform_sample_sym_key_decrypt_op() 406 op_params = op_params.nonce(value.to_vec()); in perform_sample_sym_key_decrypt_op() 448 nonce: Vec<u8>, in encrypt_secure_key() 456 .nonce(nonce) in encrypt_secure_key()
|
D | keystore2_client_import_keys_tests.rs | 99 nonce: &[u8], in build_secure_key_wrapper() 112 nonce.to_vec(), in build_secure_key_wrapper() 131 create_wrapped_key(&encrypted_secure_key, &encrypted_transport_key, nonce, &gcm_tag) in build_secure_key_wrapper() 431 let mut nonce = [0; 12]; in keystore2_create_wrapped_key_and_import_wrapped_key_success() localVariable 432 rand_bytes(&mut nonce).unwrap(); in keystore2_create_wrapped_key_and_import_wrapped_key_success() 452 &nonce, in keystore2_create_wrapped_key_and_import_wrapped_key_success() 488 let mut nonce = [0; 12]; in keystore2_create_wrapped_key_with_invalid_aad_and_import_wrapped_key_fail() localVariable 489 rand_bytes(&mut nonce).unwrap(); in keystore2_create_wrapped_key_with_invalid_aad_and_import_wrapped_key_fail() 508 &nonce, in keystore2_create_wrapped_key_with_invalid_aad_and_import_wrapped_key_fail()
|
/system/keymint/common/src/keyblob/legacy/ |
D | tests.rs | 106 nonce: vec![0xaa], in test_serialize_encrypted_keyblob() 139 nonce: vec![0xaa], in test_serialize_encrypted_keyblob() 174 nonce: vec![0xaa], in test_serialize_encrypted_keyblob()
|
/system/authgraph/core/src/ |
D | traits.rs | 64 nonce: &Nonce12, in encrypt() 72 nonce: &Nonce12, in decrypt() 148 fn fill_bytes(&self, nonce: &mut [u8]); in fill_bytes()
|