Home
last modified time | relevance | path

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

/system/keymaster/key_blob_utils/
Dauth_encrypted_key_blob.cpp33 const Buffer& nonce, const Buffer& tag, in SerializeAuthEncryptedBlob() argument
35 size_t size = 1 /* version byte */ + nonce.SerializedSize() + in SerializeAuthEncryptedBlob()
46 buf = nonce.Serialize(buf, end); in SerializeAuthEncryptedBlob()
60 AuthorizationSet* sw_enforced, Buffer* nonce, in DeserializeUnversionedBlob() argument
66 if (!nonce->reserve(OCB_NONCE_LENGTH) || !tag->reserve(OCB_TAG_LENGTH)) in DeserializeUnversionedBlob()
69 if (!copy_from_buf(buf_ptr, end, nonce->peek_write(), OCB_NONCE_LENGTH) || in DeserializeUnversionedBlob()
77 if (!nonce->advance_write(OCB_NONCE_LENGTH) || !tag->advance_write(OCB_TAG_LENGTH)) in DeserializeUnversionedBlob()
85 AuthorizationSet* sw_enforced, Buffer* nonce, in DeserializeAuthEncryptedBlob() argument
99 !nonce->Deserialize(buf_ptr, end) || nonce->available_read() != OCB_NONCE_LENGTH || in DeserializeAuthEncryptedBlob()
132 sw_enforced, nonce, tag); in DeserializeAuthEncryptedBlob()
Docb_utils.cpp120 const KeymasterKeyBlob& plaintext, const Buffer& nonce, in OcbEncryptKey() argument
124 if (nonce.available_read() != OCB_NONCE_LENGTH) in OcbEncryptKey()
139 int ae_err = ae_encrypt(ctx.get(), nonce.peek_read(), plaintext.key_material, in OcbEncryptKey()
156 const KeymasterKeyBlob& ciphertext, const Buffer& nonce, in OcbDecryptKey() argument
160 if (nonce.available_read() != OCB_NONCE_LENGTH || tag.available_read() != OCB_TAG_LENGTH) in OcbDecryptKey()
175 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 …]
Dsoftware_keyblobs.cpp248 Buffer nonce, tag; in ParseOcbAuthEncryptedBlob() local
251 hw_enforced, sw_enforced, &nonce, &tag); in ParseOcbAuthEncryptedBlob()
255 if (nonce.available_read() != OCB_NONCE_LENGTH || tag.available_read() != OCB_TAG_LENGTH) in ParseOcbAuthEncryptedBlob()
259 nonce, tag, key_material); in ParseOcbAuthEncryptedBlob()
/system/core/adb/pairing_auth/
Daes_128_gcm.cpp50 std::vector<uint8_t> nonce(EVP_AEAD_nonce_length(EVP_AEAD_CTX_aead(context_.get())), 0); in Encrypt() local
51 memcpy(nonce.data(), &enc_sequence_, sizeof(enc_sequence_)); in Encrypt()
53 if (!EVP_AEAD_CTX_seal(context_.get(), out, &written_sz, out_len, nonce.data(), nonce.size(), in Encrypt()
66 std::vector<uint8_t> nonce(EVP_AEAD_nonce_length(EVP_AEAD_CTX_aead(context_.get())), 0); in Decrypt() local
67 memcpy(nonce.data(), &dec_sequence_, sizeof(dec_sequence_)); in Decrypt()
69 if (!EVP_AEAD_CTX_open(context_.get(), out, &written_sz, out_len, nonce.data(), nonce.size(), in Decrypt()
/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/include/keymaster/key_blob_utils/
Dauth_encrypted_key_blob.h32 const Buffer& nonce, const Buffer& tag,
38 AuthorizationSet* sw_enforced, Buffer* nonce,
Docb_utils.h38 const KeymasterKeyBlob& plaintext, const Buffer& nonce,
44 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,
/system/keymaster/ng/
DAndroidKeymaster4Device.cpp249 static_assert(sizeof(response.params.nonce) == params.nonce.size(), "Nonce sizes don't match"); in getHmacSharingParameters()
250 memcpy(params.nonce.data(), response.params.nonce, params.nonce.size()); in getHmacSharingParameters()
263 static_assert(sizeof(request.params_array.params_array[i].nonce) == in computeSharedHmac()
264 decltype(params[i].nonce)::size(), in computeSharedHmac()
266 memcpy(request.params_array.params_array[i].nonce, params[i].nonce.data(), in computeSharedHmac()
267 params[i].nonce.size()); in computeSharedHmac()
/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.cpp569 keymaster_padding_t padding, const string& nonce) { in DecryptMessage() argument
574 begin_params.push_back(TAG_NONCE, nonce.data(), nonce.size()); in DecryptMessage()
580 keymaster_padding_t padding, const string& nonce) { in DecryptMessage() argument
585 begin_params.push_back(TAG_NONCE, nonce.data(), nonce.size()); in DecryptMessage()
592 keymaster_padding_t padding, const string& nonce) { in DecryptMessage() argument
597 begin_params.push_back(TAG_NONCE, nonce.data(), nonce.size()); in DecryptMessage()
640 void Keymaster2Test::CheckAesCtrTestVector(const string& key, const string& nonce, in CheckAesCtrTestVector() argument
651 begin_params.push_back(TAG_NONCE, nonce.data(), nonce.size()); in CheckAesCtrTestVector()
Dandroid_keymaster_test_utils.h274 keymaster_padding_t padding, const std::string& nonce);
276 keymaster_padding_t padding, const std::string& nonce);
279 const std::string& nonce);
282 const std::string& nonce);
290 void CheckAesOcbTestVector(const std::string& key, const std::string& nonce,
293 void CheckAesCtrTestVector(const std::string& key, const std::string& nonce,
Dandroid_keymaster_test.cpp2681 const char* nonce; member
2720 const string nonce = hex2str(test.nonce); in TEST_P() local
2723 CheckAesCtrTestVector(key, nonce, plaintext, ciphertext); in TEST_P()
3024 uint8_t nonce[] = { in TEST_P() local
3040 begin_params.push_back(TAG_NONCE, nonce, sizeof(nonce)); in TEST_P()
4316 nonces.push_back(ToByteString(param.nonce)); in CopyNonces()
4364 EXPECT_EQ(ToByteString(paramsVec[0].nonce), ToByteString(paramsVec[1].nonce)) in TEST_F()
4434 uint8_t byte_to_tweak = rand() % sizeof(params[param_to_tweak].nonce); in TEST_F()
4436 params[param_to_tweak].nonce[byte_to_tweak] ^= (1 << bit_to_tweak); in TEST_F()
/system/core/trusty/utils/rpmb_dev/
Drpmb_protocol.h53 struct rpmb_nonce nonce; member
Drpmb_dev.c409 s->res[i].nonce = s->cmd[0].nonce; in rpmb_dev_process_cmd()
/system/vold/
DKeyStorage.cpp284 std::string nonce(reinterpret_cast<const char*>(&nonceBlob.value()[0]), in encryptWithKeymasterKey()
286 if (!checkSize("nonce", nonce.size(), GCM_NONCE_BYTES)) return false; in encryptWithKeymasterKey()
293 *ciphertext = nonce + body + mac; in encryptWithKeymasterKey()
302 auto nonce = ciphertext.substr(0, GCM_NONCE_BYTES); in decryptWithKeymasterKey() local
305 km::support::blob2hidlVec(nonce)); in decryptWithKeymasterKey()
/system/core/trusty/confirmationui/
DREADME20 uses a constant nonce.
/system/keymaster/android_keymaster/
Dandroid_keymaster_messages.cpp583 return blob_size(seed) + sizeof(nonce); in SerializedSize()
588 return append_to_buf(buf, end, nonce, sizeof(nonce)); in Serialize()
593 copy_from_buf(buf_ptr, end, nonce, sizeof(nonce)); in Deserialize()
/system/keymaster/include/keymaster/
Dandroid_keymaster_messages.h698 HmacSharingParameters() : seed({}) { memset(nonce, 0, sizeof(nonce)); } in HmacSharingParameters()
701 memcpy(nonce, other.nonce, sizeof(nonce)); in HmacSharingParameters()
711 uint8_t nonce[32]; member