Lines Matching refs:end

37                                    const uint8_t* end) {  in serialize_key_blob()  argument
38 return append_size_and_data_to_buf(buf, end, key_blob.key_material, key_blob.key_material_size); in serialize_key_blob()
42 const uint8_t* end) { in deserialize_key_blob() argument
46 if (!copy_size_and_data_from_buf(buf_ptr, end, &key_blob->key_material_size, in deserialize_key_blob()
57 static uint8_t* serialize_blob(const keymaster_blob_t& blob, uint8_t* buf, const uint8_t* end) { in serialize_blob() argument
58 return append_size_and_data_to_buf(buf, end, blob.data, blob.data_length); in serialize_blob()
61 static bool deserialize_blob(keymaster_blob_t* blob, const uint8_t** buf_ptr, const uint8_t* end) { in deserialize_blob() argument
65 if (!copy_size_and_data_from_buf(buf_ptr, end, &blob->data_length, &deserialized_blob)) in deserialize_blob()
78 uint8_t* KeymasterResponse::Serialize(uint8_t* buf, const uint8_t* end) const { in Serialize()
79 buf = append_uint32_to_buf(buf, end, static_cast<uint32_t>(error)); in Serialize()
81 buf = NonErrorSerialize(buf, end); in Serialize()
85 bool KeymasterResponse::Deserialize(const uint8_t** buf_ptr, const uint8_t* end) { in Deserialize() argument
86 if (!copy_uint32_from_buf(buf_ptr, end, &error)) in Deserialize()
90 return NonErrorDeserialize(buf_ptr, end); in Deserialize()
101 uint8_t* GenerateKeyResponse::NonErrorSerialize(uint8_t* buf, const uint8_t* end) const { in NonErrorSerialize()
102 buf = serialize_key_blob(key_blob, buf, end); in NonErrorSerialize()
103 buf = enforced.Serialize(buf, end); in NonErrorSerialize()
104 return unenforced.Serialize(buf, end); in NonErrorSerialize()
107 bool GenerateKeyResponse::NonErrorDeserialize(const uint8_t** buf_ptr, const uint8_t* end) { in NonErrorDeserialize() argument
108 return deserialize_key_blob(&key_blob, buf_ptr, end) && enforced.Deserialize(buf_ptr, end) && in NonErrorDeserialize()
109 unenforced.Deserialize(buf_ptr, end); in NonErrorDeserialize()
124 uint8_t* GetKeyCharacteristicsRequest::Serialize(uint8_t* buf, const uint8_t* end) const { in Serialize()
125 buf = serialize_key_blob(key_blob, buf, end); in Serialize()
126 return additional_params.Serialize(buf, end); in Serialize()
129 bool GetKeyCharacteristicsRequest::Deserialize(const uint8_t** buf_ptr, const uint8_t* end) { in Deserialize() argument
130 return deserialize_key_blob(&key_blob, buf_ptr, end) && in Deserialize()
131 additional_params.Deserialize(buf_ptr, end); in Deserialize()
138 uint8_t* GetKeyCharacteristicsResponse::NonErrorSerialize(uint8_t* buf, const uint8_t* end) const { in NonErrorSerialize()
139 buf = enforced.Serialize(buf, end); in NonErrorSerialize()
140 return unenforced.Serialize(buf, end); in NonErrorSerialize()
144 const uint8_t* end) { in NonErrorDeserialize() argument
145 return enforced.Deserialize(buf_ptr, end) && unenforced.Deserialize(buf_ptr, end); in NonErrorDeserialize()
157 uint8_t* BeginOperationRequest::Serialize(uint8_t* buf, const uint8_t* end) const { in Serialize()
158 buf = append_uint32_to_buf(buf, end, purpose); in Serialize()
159 buf = serialize_key_blob(key_blob, buf, end); in Serialize()
160 return additional_params.Serialize(buf, end); in Serialize()
163 bool BeginOperationRequest::Deserialize(const uint8_t** buf_ptr, const uint8_t* end) { in Deserialize() argument
164 return copy_uint32_from_buf(buf_ptr, end, &purpose) && in Deserialize()
165 deserialize_key_blob(&key_blob, buf_ptr, end) && in Deserialize()
166 additional_params.Deserialize(buf_ptr, end); in Deserialize()
176 uint8_t* BeginOperationResponse::NonErrorSerialize(uint8_t* buf, const uint8_t* end) const { in NonErrorSerialize()
177 buf = append_uint64_to_buf(buf, end, op_handle); in NonErrorSerialize()
179 buf = output_params.Serialize(buf, end); in NonErrorSerialize()
183 bool BeginOperationResponse::NonErrorDeserialize(const uint8_t** buf_ptr, const uint8_t* end) { in NonErrorDeserialize() argument
184 bool retval = copy_uint64_from_buf(buf_ptr, end, &op_handle); in NonErrorDeserialize()
186 retval = output_params.Deserialize(buf_ptr, end); in NonErrorDeserialize()
197 uint8_t* UpdateOperationRequest::Serialize(uint8_t* buf, const uint8_t* end) const { in Serialize()
198 buf = append_uint64_to_buf(buf, end, op_handle); in Serialize()
199 buf = input.Serialize(buf, end); in Serialize()
201 buf = additional_params.Serialize(buf, end); in Serialize()
205 bool UpdateOperationRequest::Deserialize(const uint8_t** buf_ptr, const uint8_t* end) { in Deserialize() argument
206 bool retval = copy_uint64_from_buf(buf_ptr, end, &op_handle) && input.Deserialize(buf_ptr, end); in Deserialize()
208 retval = additional_params.Deserialize(buf_ptr, end); in Deserialize()
233 uint8_t* UpdateOperationResponse::NonErrorSerialize(uint8_t* buf, const uint8_t* end) const { in NonErrorSerialize()
234 buf = output.Serialize(buf, end); in NonErrorSerialize()
236 buf = append_uint32_to_buf(buf, end, input_consumed); in NonErrorSerialize()
238 buf = output_params.Serialize(buf, end); in NonErrorSerialize()
242 bool UpdateOperationResponse::NonErrorDeserialize(const uint8_t** buf_ptr, const uint8_t* end) { in NonErrorDeserialize() argument
243 bool retval = output.Deserialize(buf_ptr, end); in NonErrorDeserialize()
245 retval = copy_uint32_from_buf(buf_ptr, end, &input_consumed); in NonErrorDeserialize()
247 retval = output_params.Deserialize(buf_ptr, end); in NonErrorDeserialize()
272 uint8_t* FinishOperationRequest::Serialize(uint8_t* buf, const uint8_t* end) const { in Serialize()
273 buf = append_uint64_to_buf(buf, end, op_handle); in Serialize()
274 buf = signature.Serialize(buf, end); in Serialize()
276 buf = additional_params.Serialize(buf, end); in Serialize()
278 buf = input.Serialize(buf, end); in Serialize()
282 bool FinishOperationRequest::Deserialize(const uint8_t** buf_ptr, const uint8_t* end) { in Deserialize() argument
284 copy_uint64_from_buf(buf_ptr, end, &op_handle) && signature.Deserialize(buf_ptr, end); in Deserialize()
286 retval = additional_params.Deserialize(buf_ptr, end); in Deserialize()
288 retval = input.Deserialize(buf_ptr, end); in Deserialize()
299 uint8_t* FinishOperationResponse::NonErrorSerialize(uint8_t* buf, const uint8_t* end) const { in NonErrorSerialize()
300 buf = output.Serialize(buf, end); in NonErrorSerialize()
302 buf = output_params.Serialize(buf, end); in NonErrorSerialize()
306 bool FinishOperationResponse::NonErrorDeserialize(const uint8_t** buf_ptr, const uint8_t* end) { in NonErrorDeserialize() argument
307 bool retval = output.Deserialize(buf_ptr, end); in NonErrorDeserialize()
309 retval = output_params.Deserialize(buf_ptr, end); in NonErrorDeserialize()
317 uint8_t* AddEntropyRequest::Serialize(uint8_t* buf, const uint8_t* end) const { in Serialize()
318 return random_data.Serialize(buf, end); in Serialize()
321 bool AddEntropyRequest::Deserialize(const uint8_t** buf_ptr, const uint8_t* end) { in Deserialize() argument
322 return random_data.Deserialize(buf_ptr, end); in Deserialize()
336 uint8_t* ImportKeyRequest::Serialize(uint8_t* buf, const uint8_t* end) const { in Serialize()
337 buf = key_description.Serialize(buf, end); in Serialize()
338 buf = append_uint32_to_buf(buf, end, key_format); in Serialize()
339 return append_size_and_data_to_buf(buf, end, key_data, key_data_length); in Serialize()
342 bool ImportKeyRequest::Deserialize(const uint8_t** buf_ptr, const uint8_t* end) { in Deserialize() argument
346 if (!key_description.Deserialize(buf_ptr, end) || in Deserialize()
347 !copy_uint32_from_buf(buf_ptr, end, &key_format) || in Deserialize()
348 !copy_size_and_data_from_buf(buf_ptr, end, &key_data_length, &deserialized_key_material)) in Deserialize()
362 uint8_t* ImportKeyResponse::NonErrorSerialize(uint8_t* buf, const uint8_t* end) const { in NonErrorSerialize()
363 buf = serialize_key_blob(key_blob, buf, end); in NonErrorSerialize()
364 buf = enforced.Serialize(buf, end); in NonErrorSerialize()
365 return unenforced.Serialize(buf, end); in NonErrorSerialize()
368 bool ImportKeyResponse::NonErrorDeserialize(const uint8_t** buf_ptr, const uint8_t* end) { in NonErrorDeserialize() argument
369 return deserialize_key_blob(&key_blob, buf_ptr, end) && enforced.Deserialize(buf_ptr, end) && in NonErrorDeserialize()
370 unenforced.Deserialize(buf_ptr, end); in NonErrorDeserialize()
382 uint8_t* ExportKeyRequest::Serialize(uint8_t* buf, const uint8_t* end) const { in Serialize()
383 buf = additional_params.Serialize(buf, end); in Serialize()
384 buf = append_uint32_to_buf(buf, end, key_format); in Serialize()
385 return serialize_key_blob(key_blob, buf, end); in Serialize()
388 bool ExportKeyRequest::Deserialize(const uint8_t** buf_ptr, const uint8_t* end) { in Deserialize() argument
389 return additional_params.Deserialize(buf_ptr, end) && in Deserialize()
390 copy_uint32_from_buf(buf_ptr, end, &key_format) && in Deserialize()
391 deserialize_key_blob(&key_blob, buf_ptr, end); in Deserialize()
404 uint8_t* ExportKeyResponse::NonErrorSerialize(uint8_t* buf, const uint8_t* end) const { in NonErrorSerialize()
405 return append_size_and_data_to_buf(buf, end, key_data, key_data_length); in NonErrorSerialize()
408 bool ExportKeyResponse::NonErrorDeserialize(const uint8_t** buf_ptr, const uint8_t* end) { in NonErrorDeserialize() argument
412 if (!copy_size_and_data_from_buf(buf_ptr, end, &key_data_length, &deserialized_key_material)) in NonErrorDeserialize()
426 uint8_t* DeleteKeyRequest::Serialize(uint8_t* buf, const uint8_t* end) const { in Serialize()
427 return serialize_key_blob(key_blob, buf, end); in Serialize()
430 bool DeleteKeyRequest::Deserialize(const uint8_t** buf_ptr, const uint8_t* end) { in Deserialize() argument
431 return deserialize_key_blob(&key_blob, buf_ptr, end); in Deserialize()
438 uint8_t* GetVersionResponse::NonErrorSerialize(uint8_t* buf, const uint8_t* end) const { in NonErrorSerialize()
439 if (buf + NonErrorSerializedSize() <= end) { in NonErrorSerialize()
449 bool GetVersionResponse::NonErrorDeserialize(const uint8_t** buf_ptr, const uint8_t* end) { in NonErrorDeserialize() argument
450 if (*buf_ptr + NonErrorSerializedSize() > end) in NonErrorDeserialize()
472 uint8_t* AttestKeyRequest::Serialize(uint8_t* buf, const uint8_t* end) const { in Serialize()
473 buf = serialize_key_blob(key_blob, buf, end); in Serialize()
474 return attest_params.Serialize(buf, end); in Serialize()
477 bool AttestKeyRequest::Deserialize(const uint8_t** buf_ptr, const uint8_t* end) { in Deserialize() argument
478 return deserialize_key_blob(&key_blob, buf_ptr, end) && attest_params.Deserialize(buf_ptr, end); in Deserialize()
518 uint8_t* AttestKeyResponse::NonErrorSerialize(uint8_t* buf, const uint8_t* end) const { in NonErrorSerialize()
519 buf = append_uint32_to_buf(buf, end, certificate_chain.entry_count); in NonErrorSerialize()
521 buf = append_size_and_data_to_buf(buf, end, certificate_chain.entries[i].data, in NonErrorSerialize()
527 bool AttestKeyResponse::NonErrorDeserialize(const uint8_t** buf_ptr, const uint8_t* end) { in NonErrorDeserialize() argument
529 if (!copy_uint32_from_buf(buf_ptr, end, &entry_count) || !AllocateChain(entry_count)) in NonErrorDeserialize()
535 if (!copy_size_and_data_from_buf(buf_ptr, end, &data_length, &data)) in NonErrorDeserialize()
556 uint8_t* UpgradeKeyRequest::Serialize(uint8_t* buf, const uint8_t* end) const { in Serialize()
557 buf = serialize_key_blob(key_blob, buf, end); in Serialize()
558 return upgrade_params.Serialize(buf, end); in Serialize()
561 bool UpgradeKeyRequest::Deserialize(const uint8_t** buf_ptr, const uint8_t* end) { in Deserialize() argument
562 return deserialize_key_blob(&key_blob, buf_ptr, end) && in Deserialize()
563 upgrade_params.Deserialize(buf_ptr, end); in Deserialize()
574 uint8_t* UpgradeKeyResponse::NonErrorSerialize(uint8_t* buf, const uint8_t* end) const { in NonErrorSerialize()
575 return serialize_key_blob(upgraded_key, buf, end); in NonErrorSerialize()
578 bool UpgradeKeyResponse::NonErrorDeserialize(const uint8_t** buf_ptr, const uint8_t* end) { in NonErrorDeserialize() argument
579 return deserialize_key_blob(&upgraded_key, buf_ptr, end); in NonErrorDeserialize()
586 uint8_t* HmacSharingParameters::Serialize(uint8_t* buf, const uint8_t* end) const { in Serialize()
587 buf = serialize_blob(seed, buf, end); in Serialize()
588 return append_to_buf(buf, end, nonce, sizeof(nonce)); in Serialize()
591 bool HmacSharingParameters::Deserialize(const uint8_t** buf_ptr, const uint8_t* end) { in Deserialize() argument
592 return deserialize_blob(&seed, buf_ptr, end) && in Deserialize()
593 copy_from_buf(buf_ptr, end, nonce, sizeof(nonce)); in Deserialize()
604 uint8_t* HmacSharingParametersArray::Serialize(uint8_t* buf, const uint8_t* end) const { in Serialize()
605 buf = append_uint32_to_buf(buf, end, num_params); in Serialize()
607 buf = params_array[i].Serialize(buf, end); in Serialize()
612 bool HmacSharingParametersArray::Deserialize(const uint8_t** buf_ptr, const uint8_t* end) { in Deserialize() argument
613 if (!copy_uint32_from_buf(buf_ptr, end, &num_params)) return false; in Deserialize()
617 if (!params_array[i].Deserialize(buf_ptr, end)) return false; in Deserialize()
626 uint8_t* ComputeSharedHmacResponse::NonErrorSerialize(uint8_t* buf, const uint8_t* end) const { in NonErrorSerialize()
627 return serialize_blob(sharing_check, buf, end); in NonErrorSerialize()
630 bool ComputeSharedHmacResponse::NonErrorDeserialize(const uint8_t** buf_ptr, const uint8_t* end) { in NonErrorDeserialize() argument
631 return deserialize_blob(&sharing_check, buf_ptr, end); in NonErrorDeserialize()
642 uint8_t* ImportWrappedKeyRequest::Serialize(uint8_t* buf, const uint8_t* end) const { in Serialize()
643 buf = serialize_key_blob(wrapped_key, buf, end); in Serialize()
644 buf = serialize_key_blob(wrapping_key, buf, end); in Serialize()
645 buf = serialize_key_blob(masking_key, buf, end); in Serialize()
646 buf = additional_params.Serialize(buf, end); in Serialize()
647 buf = append_uint64_to_buf(buf, end, password_sid); in Serialize()
648 return append_uint64_to_buf(buf, end, biometric_sid); in Serialize()
651 bool ImportWrappedKeyRequest::Deserialize(const uint8_t** buf_ptr, const uint8_t* end) { in Deserialize() argument
652 return deserialize_key_blob(&wrapped_key, buf_ptr, end) && in Deserialize()
653 deserialize_key_blob(&wrapping_key, buf_ptr, end) && in Deserialize()
654 deserialize_key_blob(&masking_key, buf_ptr, end) && in Deserialize()
655 additional_params.Deserialize(buf_ptr, end) && in Deserialize()
656 copy_uint64_from_buf(buf_ptr, end, &password_sid) && in Deserialize()
657 copy_uint64_from_buf(buf_ptr, end, &biometric_sid); in Deserialize()
680 uint8_t* ImportWrappedKeyResponse::NonErrorSerialize(uint8_t* buf, const uint8_t* end) const { in NonErrorSerialize()
681 buf = serialize_key_blob(key_blob, buf, end); in NonErrorSerialize()
682 buf = enforced.Serialize(buf, end); in NonErrorSerialize()
683 return unenforced.Serialize(buf, end); in NonErrorSerialize()
686 bool ImportWrappedKeyResponse::NonErrorDeserialize(const uint8_t** buf_ptr, const uint8_t* end) { in NonErrorDeserialize() argument
687 return deserialize_key_blob(&key_blob, buf_ptr, end) && enforced.Deserialize(buf_ptr, end) && in NonErrorDeserialize()
688 unenforced.Deserialize(buf_ptr, end); in NonErrorDeserialize()
696 uint8_t* HardwareAuthToken::Serialize(uint8_t* buf, const uint8_t* end) const { in Serialize()
697 buf = append_uint64_to_buf(buf, end, challenge); in Serialize()
698 buf = append_uint64_to_buf(buf, end, user_id); in Serialize()
699 buf = append_uint64_to_buf(buf, end, authenticator_id); in Serialize()
700 buf = append_uint32_to_buf(buf, end, authenticator_type); in Serialize()
701 buf = append_uint64_to_buf(buf, end, timestamp); in Serialize()
702 return serialize_blob(mac, buf, end); in Serialize()
705 bool HardwareAuthToken::Deserialize(const uint8_t** buf_ptr, const uint8_t* end) { in Deserialize() argument
706 return copy_uint64_from_buf(buf_ptr, end, &challenge) && in Deserialize()
707 copy_uint64_from_buf(buf_ptr, end, &user_id) && in Deserialize()
708 copy_uint64_from_buf(buf_ptr, end, &authenticator_id) && in Deserialize()
709 copy_uint32_from_buf(buf_ptr, end, &authenticator_type) && in Deserialize()
710 copy_uint64_from_buf(buf_ptr, end, &timestamp) && // in Deserialize()
711 deserialize_blob(&mac, buf_ptr, end); in Deserialize()
719 uint8_t* VerificationToken::Serialize(uint8_t* buf, const uint8_t* end) const { in Serialize()
720 buf = append_uint64_to_buf(buf, end, challenge); in Serialize()
721 buf = append_uint64_to_buf(buf, end, timestamp); in Serialize()
722 buf = parameters_verified.Serialize(buf, end); in Serialize()
723 buf = append_uint32_to_buf(buf, end, security_level); in Serialize()
724 return serialize_blob(mac, buf, end); in Serialize()
727 bool VerificationToken::Deserialize(const uint8_t** buf_ptr, const uint8_t* end) { in Deserialize() argument
728 return copy_uint64_from_buf(buf_ptr, end, &challenge) && in Deserialize()
729 copy_uint64_from_buf(buf_ptr, end, &timestamp) && in Deserialize()
730 parameters_verified.Deserialize(buf_ptr, end) && in Deserialize()
731 copy_uint32_from_buf(buf_ptr, end, &security_level) && in Deserialize()
732 deserialize_blob(&mac, buf_ptr, end); in Deserialize()