Home
last modified time | relevance | path

Searched refs:nonce (Results 1 – 25 of 26) sorted by relevance

12

/system/core/trusty/keymaster/keymint/
DTrustySharedSecret.cpp31 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/
DAndroidSharedSecret.cpp40 params->nonce = {std::begin(response.params.nonce), std::end(response.params.nonce)}; in getSharedSecretParameters()
51 if (sizeof(request.params_array.params_array[i].nonce) != params[i].nonce.size()) { in computeSharedSecret()
54 memcpy(request.params_array.params_array[i].nonce, params[i].nonce.data(), in computeSharedSecret()
55 params[i].nonce.size()); in computeSharedSecret()
DAndroidKeymaster4Device.cpp246 static_assert(sizeof(response.params.nonce) == params.nonce.size(), "Nonce sizes don't match"); in getHmacSharingParameters()
247 memcpy(params.nonce.data(), response.params.nonce, params.nonce.size()); in getHmacSharingParameters()
260 static_assert(sizeof(request.params_array.params_array[i].nonce) == in computeSharedHmac()
261 decltype(params[i].nonce)::size(), in computeSharedHmac()
263 memcpy(request.params_array.params_array[i].nonce, params[i].nonce.data(), in computeSharedHmac()
264 params[i].nonce.size()); in computeSharedHmac()
/system/keymaster/key_blob_utils/
Dauth_encrypted_key_blob.cpp43 Buffer nonce; in generate_nonce() local
44 if (!nonce.Reinitialize(size)) { in generate_nonce()
49 random.GenerateRandom(nonce.peek_write(), size); in generate_nonce()
50 nonce.advance_write(size); in generate_nonce()
51 return nonce; in generate_nonce()
120 Buffer nonce, // in AesGcmEncryptKey() argument
139 retval.nonce = move(nonce); in AesGcmEncryptKey()
143 retval.nonce.peek_read()) && in AesGcmEncryptKey()
181 key.encrypted_key.nonce.peek_read()) && in AesGcmDecryptKey()
213 size_t size = 1 /* version byte */ + encrypted_key.nonce.SerializedSize() + in SerializeAuthEncryptedBlob()
[all …]
Docb_utils.cpp115 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()
Docb.c761 static block gen_offset_from_nonce(ae_ctx* ctx, const void* nonce) { in gen_offset_from_nonce() argument
785 tmp.u32[1] = ((uint32_t*)nonce)[0]; in gen_offset_from_nonce()
786 tmp.u32[2] = ((uint32_t*)nonce)[1]; in gen_offset_from_nonce()
787 tmp.u32[3] = ((uint32_t*)nonce)[2]; in gen_offset_from_nonce()
938 int ae_encrypt(ae_ctx* ctx, const void* nonce, const void* pt, int pt_len, const void* ad, in ae_encrypt() argument
951 if (nonce) { in ae_encrypt()
952 ctx->offset = gen_offset_from_nonce(ctx, nonce); in ae_encrypt()
1155 int ae_decrypt(ae_ctx* ctx, const void* nonce, const void* ct, int ct_len, const void* ad, in ae_decrypt() argument
1176 if (nonce) { in ae_decrypt()
1177 ctx->offset = gen_offset_from_nonce(ctx, nonce); in ae_decrypt()
[all …]
/system/keymaster/km_openssl/
Dsoft_keymaster_enforcement.cpp83 RAND_bytes(saved_params_.nonce, 32); in GetHmacSharingParameters()
87 memcpy(params->nonce, saved_params_.nonce, sizeof(params->nonce)); in GetHmacSharingParameters()
141 return a.seed == b.seed && !memcmp(a.nonce, b.nonce, sizeof(a.nonce)); in operator ==()
157 *context_chunks_pos++ = {params.nonce, sizeof(params.nonce)}; in ComputeSharedHmac()
/system/keymaster/cppcose/
Dcppcose.cpp32 const bytevec& nonce, in aesGcmInitAndProcessAad() argument
41 nonce.data(), encrypt ? 1 : 0)) { in aesGcmInitAndProcessAad()
222 ErrMsgOr<bytevec> createCoseEncryptCiphertext(const bytevec& key, const bytevec& nonce, in createCoseEncryptCiphertext() argument
225 auto ciphertext = aesGcmEncrypt(key, nonce, in createCoseEncryptCiphertext()
237 ErrMsgOr<cppbor::Array> constructCoseEncrypt(const bytevec& key, const bytevec& nonce, in constructCoseEncrypt() argument
246 createCoseEncryptCiphertext(key, nonce, encryptProtectedHeader, plaintextPayload, aad); in constructCoseEncrypt()
251 .add(cppbor::Map().add(IV, nonce).canonicalize()) // Unprotected in constructCoseEncrypt()
354 auto& nonce = unprotParms->asMap()->get(IV); in decryptCoseEncrypt() local
355 if (!nonce || !nonce->asBstr() || nonce->asBstr()->value().size() != kAesGcmNonceLength) { in decryptCoseEncrypt()
367 return aesGcmDecrypt(key, nonce->asBstr()->value(), aad, ciphertext->asBstr()->value()); in decryptCoseEncrypt()
[all …]
/system/keymaster/include/keymaster/key_blob_utils/
Docb_utils.h37 const KeymasterKeyBlob& plaintext, const Buffer& nonce,
43 const KeymasterKeyBlob& ciphertext, const Buffer& nonce,
Dae.h94 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,
Dauth_encrypted_key_blob.h49 Buffer nonce; member
/system/keymaster/include/keymaster/cppcose/
Dcppcose.h268 ErrMsgOr<bytevec> createCoseEncryptCiphertext(const bytevec& key, const bytevec& nonce,
270 ErrMsgOr<cppbor::Array> constructCoseEncrypt(const bytevec& key, const bytevec& nonce,
286 ErrMsgOr<bytevec /* ciphertextWithTag */> aesGcmEncrypt(const bytevec& key, const bytevec& nonce,
289 ErrMsgOr<bytevec /* plaintext */> aesGcmDecrypt(const bytevec& key, const bytevec& nonce,
/system/core/trusty/keymaster/4.0/
DTrustyKeymaster4Device.cpp279 static_assert(sizeof(response.params.nonce) == params.nonce.size(), "Nonce sizes don't match"); in getHmacSharingParameters()
280 memcpy(params.nonce.data(), response.params.nonce, params.nonce.size()); in getHmacSharingParameters()
292 static_assert(sizeof(request.params_array.params_array[i].nonce) == in computeSharedHmac()
293 decltype(params[i].nonce)::size(), in computeSharedHmac()
295 memcpy(request.params_array.params_array[i].nonce, params[i].nonce.data(), in computeSharedHmac()
296 params[i].nonce.size()); in computeSharedHmac()
/system/keymaster/tests/
Dandroid_keymaster_test_utils.h275 keymaster_padding_t padding, const std::string& nonce);
279 keymaster_padding_t padding, const std::string& nonce);
282 const std::string& nonce);
285 const std::string& nonce);
293 void CheckAesOcbTestVector(const std::string& key, const std::string& nonce,
296 void CheckAesCtrTestVector(const std::string& key, const std::string& nonce,
Dandroid_keymaster_test_utils.cpp595 keymaster_padding_t padding, const string& nonce) { in DecryptMessage() argument
600 begin_params.push_back(TAG_NONCE, nonce.data(), nonce.size()); in DecryptMessage()
606 keymaster_padding_t padding, const string& nonce) { in DecryptMessage() argument
611 begin_params.push_back(TAG_NONCE, nonce.data(), nonce.size()); in DecryptMessage()
629 keymaster_padding_t padding, const string& nonce) { in DecryptMessage() argument
634 begin_params.push_back(TAG_NONCE, nonce.data(), nonce.size()); in DecryptMessage()
676 void Keymaster2Test::CheckAesCtrTestVector(const string& key, const string& nonce, in CheckAesCtrTestVector() argument
687 begin_params.push_back(TAG_NONCE, nonce.data(), nonce.size()); in CheckAesCtrTestVector()
Dkey_blob_test.cpp158 encrypted_key_.nonce.begin(), encrypted_key_.nonce.end()); in TEST_F()
/system/core/trusty/utils/rpmb_dev/
Drpmb_protocol.h53 struct rpmb_nonce nonce; member
Drpmb_dev.c410 s->res[i].nonce = s->cmd[0].nonce; in rpmb_dev_process_cmd()
/system/core/trusty/confirmationui/
DREADME20 uses a constant nonce.
/system/vold/
DKeyStorage.cpp394 std::string nonce(nonceBlob.value().get().begin(), nonceBlob.value().get().end()); in encryptWithKeymasterKey() local
395 if (!checkSize("nonce", nonce.size(), GCM_NONCE_BYTES)) return false; in encryptWithKeymasterKey()
402 *ciphertext = nonce + body + mac; in encryptWithKeymasterKey()
409 const std::string nonce = ciphertext.substr(0, GCM_NONCE_BYTES); in decryptWithKeymasterKey() local
412 .Authorization(km::TAG_NONCE, nonce) in decryptWithKeymasterKey()
/system/keymaster/android_keymaster/
Dandroid_keymaster_messages.cpp737 return blob_size(seed) + sizeof(nonce); in SerializedSize()
742 return append_to_buf(buf, end, nonce, sizeof(nonce)); in Serialize()
747 copy_from_buf(buf_ptr, end, nonce, sizeof(nonce)); in Deserialize()
Dandroid_keymaster.cpp497 std::vector<uint8_t> nonce(kAesGcmNonceLength, 0 /* value */); in GenerateCsr() local
498 if (GenerateRandom(nonce.data(), nonce.size()) != KM_ERROR_OK) { in GenerateCsr()
503 auto coseEncrypted = constructCoseEncrypt(*sessionKey, nonce, in GenerateCsr()
/system/keymaster/include/keymaster/
Dandroid_keymaster_messages.h762 HmacSharingParameters() : seed({}) { memset(nonce, 0, sizeof(nonce)); } in HmacSharingParameters()
765 memcpy(nonce, other.nonce, sizeof(nonce)); in HmacSharingParameters()
775 uint8_t nonce[32]; member
/system/security/keystore2/src/km_compat/
Dkm_compat.cpp375 std::copy(ssp.nonce.begin(), ssp.nonce.end(), legacyHsp.nonce.data()); in convertSharedSecretParameterToLegacy()
877 std::copy(params.nonce.data(), params.nonce.data() + params.nonce.elementCount(), in getSharedSecretParameters()
878 std::back_inserter(_aidl_return->nonce)); in getSharedSecretParameters()
/system/security/keystore2/src/
Dsuper_key.rs178 nonce: Vec<u8>, field
184 let (mut ciphertext, nonce, mut tag) = aes_gcm_encrypt(&to_encrypt.key, key)?; in new()
186 Ok(LockedKey { algorithm: to_encrypt.algorithm, id: to_encrypt.id, nonce, ciphertext }) in new()
209 KeyParameterValue::Nonce(self.nonce.clone()), in decrypt()

12