Home | History | Annotate | Download | only in android_keymaster

Lines Matching refs:end

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