blob: 44cf5cfc11147828238a288c5993277f7e31290a [file] [log] [blame]
Shawn Willden128ffe02014-08-06 12:31:33 -06001/*
2 * Copyright 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Shawn Willden98d9b922014-08-26 08:14:10 -060017#include <keymaster/google_keymaster_messages.h>
18#include <keymaster/google_keymaster_utils.h>
Shawn Willden128ffe02014-08-06 12:31:33 -060019
20namespace keymaster {
21
Shawn Willden38f17012015-01-13 16:37:08 -070022/*
23 * Helper functions for working with key blobs.
24 */
25
26static void set_key_blob(keymaster_key_blob_t* key_blob, const void* key_material, size_t length) {
27 delete[] key_blob->key_material;
28 key_blob->key_material = dup_buffer(key_material, length);
29 key_blob->key_material_size = length;
30}
31
32static size_t key_blob_size(const keymaster_key_blob_t& key_blob) {
33 return sizeof(uint32_t) /* key size */ + key_blob.key_material_size;
34}
35
36static uint8_t* serialize_key_blob(const keymaster_key_blob_t& key_blob, uint8_t* buf,
37 const uint8_t* end) {
38 return append_size_and_data_to_buf(buf, end, key_blob.key_material, key_blob.key_material_size);
39}
40
41static bool deserialize_key_blob(keymaster_key_blob_t* key_blob, const uint8_t** buf_ptr,
42 const uint8_t* end) {
43 delete[] key_blob->key_material;
44 key_blob->key_material = 0;
45 UniquePtr<uint8_t[]> deserialized_key_material;
46 if (!copy_size_and_data_from_buf(buf_ptr, end, &key_blob->key_material_size,
47 &deserialized_key_material))
48 return false;
49 key_blob->key_material = deserialized_key_material.release();
50 return true;
51}
52
Shawn Willdenda8485e2014-08-17 08:00:01 -060053size_t KeymasterResponse::SerializedSize() const {
54 if (error != KM_ERROR_OK)
55 return sizeof(int32_t);
56 else
57 return sizeof(int32_t) + NonErrorSerializedSize();
Shawn Willden128ffe02014-08-06 12:31:33 -060058}
59
Shawn Willdenda8485e2014-08-17 08:00:01 -060060uint8_t* KeymasterResponse::Serialize(uint8_t* buf, const uint8_t* end) const {
61 buf = append_uint32_to_buf(buf, end, static_cast<uint32_t>(error));
62 if (error == KM_ERROR_OK)
63 buf = NonErrorSerialize(buf, end);
Shawn Willden128ffe02014-08-06 12:31:33 -060064 return buf;
65}
66
Shawn Willdenda8485e2014-08-17 08:00:01 -060067bool KeymasterResponse::Deserialize(const uint8_t** buf_ptr, const uint8_t* end) {
68 if (!copy_uint32_from_buf(buf_ptr, end, &error))
69 return false;
70 if (error != KM_ERROR_OK)
71 return true;
72 return NonErrorDeserialize(buf_ptr, end);
73}
74
75size_t SupportedAlgorithmsResponse::NonErrorSerializedSize() const {
76 return sizeof(uint32_t) + sizeof(uint32_t) * algorithms_length;
77}
78
79uint8_t* SupportedAlgorithmsResponse::NonErrorSerialize(uint8_t* buf, const uint8_t* end) const {
80 return append_uint32_array_to_buf(buf, end, algorithms, algorithms_length);
81}
82
83bool SupportedAlgorithmsResponse::NonErrorDeserialize(const uint8_t** buf_ptr, const uint8_t* end) {
84 delete[] algorithms;
Shawn Willdenf2282b32014-08-25 06:49:54 -060085 algorithms = NULL;
86 UniquePtr<keymaster_algorithm_t[]> deserialized_algorithms;
87 if (!copy_uint32_array_from_buf(buf_ptr, end, &deserialized_algorithms, &algorithms_length))
88 return false;
89 algorithms = deserialized_algorithms.release();
90 return true;
Shawn Willdenda8485e2014-08-17 08:00:01 -060091}
92
93GenerateKeyResponse::~GenerateKeyResponse() {
94 delete[] key_blob.key_material;
95}
96
97size_t GenerateKeyResponse::NonErrorSerializedSize() const {
Shawn Willden38f17012015-01-13 16:37:08 -070098 return key_blob_size(key_blob) + enforced.SerializedSize() + unenforced.SerializedSize();
Shawn Willdenda8485e2014-08-17 08:00:01 -060099}
100
101uint8_t* GenerateKeyResponse::NonErrorSerialize(uint8_t* buf, const uint8_t* end) const {
Shawn Willden38f17012015-01-13 16:37:08 -0700102 buf = serialize_key_blob(key_blob, buf, end);
Shawn Willdenda8485e2014-08-17 08:00:01 -0600103 buf = enforced.Serialize(buf, end);
Shawn Willdenda8485e2014-08-17 08:00:01 -0600104 return unenforced.Serialize(buf, end);
105}
106
107bool GenerateKeyResponse::NonErrorDeserialize(const uint8_t** buf_ptr, const uint8_t* end) {
Shawn Willden38f17012015-01-13 16:37:08 -0700108 return deserialize_key_blob(&key_blob, buf_ptr, end) && enforced.Deserialize(buf_ptr, end) &&
109 unenforced.Deserialize(buf_ptr, end);
Shawn Willdenda8485e2014-08-17 08:00:01 -0600110}
Shawn Willden128ffe02014-08-06 12:31:33 -0600111
Shawn Willdenda8485e2014-08-17 08:00:01 -0600112GetKeyCharacteristicsRequest::~GetKeyCharacteristicsRequest() {
113 delete[] key_blob.key_material;
114}
115
116void GetKeyCharacteristicsRequest::SetKeyMaterial(const void* key_material, size_t length) {
Shawn Willden38f17012015-01-13 16:37:08 -0700117 set_key_blob(&key_blob, key_material, length);
Shawn Willdenda8485e2014-08-17 08:00:01 -0600118}
119
120size_t GetKeyCharacteristicsRequest::SerializedSize() const {
Shawn Willden38f17012015-01-13 16:37:08 -0700121 return key_blob_size(key_blob) + additional_params.SerializedSize();
Shawn Willdenda8485e2014-08-17 08:00:01 -0600122}
123
124uint8_t* GetKeyCharacteristicsRequest::Serialize(uint8_t* buf, const uint8_t* end) const {
Shawn Willden38f17012015-01-13 16:37:08 -0700125 buf = serialize_key_blob(key_blob, buf, end);
Shawn Willdenda8485e2014-08-17 08:00:01 -0600126 return additional_params.Serialize(buf, end);
127}
128
129bool GetKeyCharacteristicsRequest::Deserialize(const uint8_t** buf_ptr, const uint8_t* end) {
Shawn Willden38f17012015-01-13 16:37:08 -0700130 return deserialize_key_blob(&key_blob, buf_ptr, end) &&
131 additional_params.Deserialize(buf_ptr, end);
Shawn Willdenda8485e2014-08-17 08:00:01 -0600132}
133
134size_t GetKeyCharacteristicsResponse::NonErrorSerializedSize() const {
Shawn Willdenf2282b32014-08-25 06:49:54 -0600135 return enforced.SerializedSize() + unenforced.SerializedSize();
Shawn Willdenda8485e2014-08-17 08:00:01 -0600136}
137
138uint8_t* GetKeyCharacteristicsResponse::NonErrorSerialize(uint8_t* buf, const uint8_t* end) const {
Shawn Willdenda8485e2014-08-17 08:00:01 -0600139 buf = enforced.Serialize(buf, end);
Shawn Willdenda8485e2014-08-17 08:00:01 -0600140 return unenforced.Serialize(buf, end);
141}
142
143bool GetKeyCharacteristicsResponse::NonErrorDeserialize(const uint8_t** buf_ptr,
144 const uint8_t* end) {
Shawn Willdenf2282b32014-08-25 06:49:54 -0600145 return enforced.Deserialize(buf_ptr, end) && unenforced.Deserialize(buf_ptr, end);
Shawn Willdenda8485e2014-08-17 08:00:01 -0600146}
147
148void BeginOperationRequest::SetKeyMaterial(const void* key_material, size_t length) {
Shawn Willden38f17012015-01-13 16:37:08 -0700149 set_key_blob(&key_blob, key_material, length);
Shawn Willdenda8485e2014-08-17 08:00:01 -0600150}
151
152size_t BeginOperationRequest::SerializedSize() const {
Shawn Willden38f17012015-01-13 16:37:08 -0700153 return sizeof(uint32_t) /* purpose */ + key_blob_size(key_blob) +
154 additional_params.SerializedSize();
Shawn Willdenda8485e2014-08-17 08:00:01 -0600155}
156
157uint8_t* BeginOperationRequest::Serialize(uint8_t* buf, const uint8_t* end) const {
158 buf = append_uint32_to_buf(buf, end, purpose);
Shawn Willden38f17012015-01-13 16:37:08 -0700159 buf = serialize_key_blob(key_blob, buf, end);
Shawn Willdenda8485e2014-08-17 08:00:01 -0600160 return additional_params.Serialize(buf, end);
161}
162
163bool BeginOperationRequest::Deserialize(const uint8_t** buf_ptr, const uint8_t* end) {
Shawn Willden38f17012015-01-13 16:37:08 -0700164 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);
Shawn Willdenda8485e2014-08-17 08:00:01 -0600167}
168
169size_t BeginOperationResponse::NonErrorSerializedSize() const {
Shawn Willden7b38f442015-01-22 13:07:34 -0700170 if (message_version == 0)
171 return sizeof(op_handle);
172 else
173 return sizeof(op_handle) + output_params.SerializedSize();
Shawn Willdenda8485e2014-08-17 08:00:01 -0600174}
175
176uint8_t* BeginOperationResponse::NonErrorSerialize(uint8_t* buf, const uint8_t* end) const {
Shawn Willden7b38f442015-01-22 13:07:34 -0700177 buf = append_uint64_to_buf(buf, end, op_handle);
178 if (message_version > 0)
179 buf = output_params.Serialize(buf, end);
180 return buf;
Shawn Willdenda8485e2014-08-17 08:00:01 -0600181}
182
183bool BeginOperationResponse::NonErrorDeserialize(const uint8_t** buf_ptr, const uint8_t* end) {
Shawn Willden7b38f442015-01-22 13:07:34 -0700184 bool retval = copy_uint64_from_buf(buf_ptr, end, &op_handle);
185 if (retval && message_version > 0)
186 retval = output_params.Deserialize(buf_ptr, end);
187 return retval;
Shawn Willdenda8485e2014-08-17 08:00:01 -0600188}
189
190size_t UpdateOperationRequest::SerializedSize() const {
Shawn Willdenba5e94d2015-02-06 17:09:23 -0700191 if (message_version == 0)
192 return sizeof(op_handle) + input.SerializedSize();
193 else
194 return sizeof(op_handle) + input.SerializedSize() + additional_params.SerializedSize();
Shawn Willdenda8485e2014-08-17 08:00:01 -0600195}
196
197uint8_t* UpdateOperationRequest::Serialize(uint8_t* buf, const uint8_t* end) const {
198 buf = append_uint64_to_buf(buf, end, op_handle);
Shawn Willdenba5e94d2015-02-06 17:09:23 -0700199 buf = input.Serialize(buf, end);
200 if (message_version > 0)
201 buf = additional_params.Serialize(buf, end);
202 return buf;
Shawn Willdenda8485e2014-08-17 08:00:01 -0600203}
204
205bool UpdateOperationRequest::Deserialize(const uint8_t** buf_ptr, const uint8_t* end) {
Shawn Willdenba5e94d2015-02-06 17:09:23 -0700206 bool retval = copy_uint64_from_buf(buf_ptr, end, &op_handle) && input.Deserialize(buf_ptr, end);
207 if (retval && message_version > 0)
208 retval = additional_params.Deserialize(buf_ptr, end);
209 return retval;
Shawn Willdenda8485e2014-08-17 08:00:01 -0600210}
211
212size_t UpdateOperationResponse::NonErrorSerializedSize() const {
Shawn Willdenb7361132014-12-08 08:15:14 -0700213 if (message_version == 0)
214 return output.SerializedSize();
215 else
216 return output.SerializedSize() + sizeof(uint32_t);
Shawn Willdenda8485e2014-08-17 08:00:01 -0600217}
218
219uint8_t* UpdateOperationResponse::NonErrorSerialize(uint8_t* buf, const uint8_t* end) const {
Shawn Willdenb7361132014-12-08 08:15:14 -0700220 buf = output.Serialize(buf, end);
221 if (message_version > 0)
222 buf = append_uint32_to_buf(buf, end, input_consumed);
223 return buf;
Shawn Willdenda8485e2014-08-17 08:00:01 -0600224}
225
226bool UpdateOperationResponse::NonErrorDeserialize(const uint8_t** buf_ptr, const uint8_t* end) {
Shawn Willdenb7361132014-12-08 08:15:14 -0700227 bool retval = output.Deserialize(buf_ptr, end);
228 if (retval && message_version > 0)
229 retval = copy_uint32_from_buf(buf_ptr, end, &input_consumed);
230 return retval;
Shawn Willdenda8485e2014-08-17 08:00:01 -0600231}
232
233size_t FinishOperationRequest::SerializedSize() const {
Shawn Willdenba5e94d2015-02-06 17:09:23 -0700234 if (message_version == 0)
235 return sizeof(op_handle) + signature.SerializedSize();
236 else
237 return sizeof(op_handle) + signature.SerializedSize() + additional_params.SerializedSize();
Shawn Willdenda8485e2014-08-17 08:00:01 -0600238}
239
240uint8_t* FinishOperationRequest::Serialize(uint8_t* buf, const uint8_t* end) const {
241 buf = append_uint64_to_buf(buf, end, op_handle);
Shawn Willdenba5e94d2015-02-06 17:09:23 -0700242 buf = signature.Serialize(buf, end);
243 if (message_version > 0)
244 buf = additional_params.Serialize(buf, end);
245 return buf;
Shawn Willdenda8485e2014-08-17 08:00:01 -0600246}
247
248bool FinishOperationRequest::Deserialize(const uint8_t** buf_ptr, const uint8_t* end) {
Shawn Willdenba5e94d2015-02-06 17:09:23 -0700249 bool retval =
250 copy_uint64_from_buf(buf_ptr, end, &op_handle) && signature.Deserialize(buf_ptr, end);
251 if (retval && message_version > 0)
252 retval = additional_params.Deserialize(buf_ptr, end);
253 return retval;
Shawn Willdenda8485e2014-08-17 08:00:01 -0600254}
255
256size_t FinishOperationResponse::NonErrorSerializedSize() const {
257 return output.SerializedSize();
258}
259
260uint8_t* FinishOperationResponse::NonErrorSerialize(uint8_t* buf, const uint8_t* end) const {
261 return output.Serialize(buf, end);
262}
263
264bool FinishOperationResponse::NonErrorDeserialize(const uint8_t** buf_ptr, const uint8_t* end) {
265 return output.Deserialize(buf_ptr, end);
266}
267
Shawn Willdencd695822015-01-26 14:06:32 -0700268size_t AddEntropyRequest::SerializedSize() const {
269 return random_data.SerializedSize();
270}
271
272uint8_t* AddEntropyRequest::Serialize(uint8_t* buf, const uint8_t* end) const {
273 return random_data.Serialize(buf, end);
274}
275
276bool AddEntropyRequest::Deserialize(const uint8_t** buf_ptr, const uint8_t* end) {
277 return random_data.Deserialize(buf_ptr, end);
278}
279
Shawn Willdenda8485e2014-08-17 08:00:01 -0600280void ImportKeyRequest::SetKeyMaterial(const void* key_material, size_t length) {
281 delete[] key_data;
282 key_data = dup_buffer(key_material, length);
283 key_data_length = length;
284}
285
286size_t ImportKeyRequest::SerializedSize() const {
Shawn Willdenf2282b32014-08-25 06:49:54 -0600287 return key_description.SerializedSize() + sizeof(uint32_t) /* key_format */ +
288 sizeof(uint32_t) /* key_data_length */ + key_data_length;
Shawn Willdenda8485e2014-08-17 08:00:01 -0600289}
290
291uint8_t* ImportKeyRequest::Serialize(uint8_t* buf, const uint8_t* end) const {
Shawn Willden437fbd12014-08-20 11:59:49 -0600292 buf = key_description.Serialize(buf, end);
Shawn Willdenda8485e2014-08-17 08:00:01 -0600293 buf = append_uint32_to_buf(buf, end, key_format);
294 return append_size_and_data_to_buf(buf, end, key_data, key_data_length);
295}
296
297bool ImportKeyRequest::Deserialize(const uint8_t** buf_ptr, const uint8_t* end) {
Shawn Willdenf2282b32014-08-25 06:49:54 -0600298 delete[] key_data;
299 key_data = NULL;
300 UniquePtr<uint8_t[]> deserialized_key_material;
301 if (!key_description.Deserialize(buf_ptr, end) ||
302 !copy_uint32_from_buf(buf_ptr, end, &key_format) ||
303 !copy_size_and_data_from_buf(buf_ptr, end, &key_data_length, &deserialized_key_material))
304 return false;
305 key_data = deserialized_key_material.release();
306 return true;
Shawn Willdenda8485e2014-08-17 08:00:01 -0600307}
308
309void ImportKeyResponse::SetKeyMaterial(const void* key_material, size_t length) {
Shawn Willden38f17012015-01-13 16:37:08 -0700310 set_key_blob(&key_blob, key_material, length);
Shawn Willdenda8485e2014-08-17 08:00:01 -0600311}
312
313size_t ImportKeyResponse::NonErrorSerializedSize() const {
Shawn Willden38f17012015-01-13 16:37:08 -0700314 return key_blob_size(key_blob) + enforced.SerializedSize() + unenforced.SerializedSize();
Shawn Willdenda8485e2014-08-17 08:00:01 -0600315}
316
317uint8_t* ImportKeyResponse::NonErrorSerialize(uint8_t* buf, const uint8_t* end) const {
Shawn Willden38f17012015-01-13 16:37:08 -0700318 buf = serialize_key_blob(key_blob, buf, end);
Shawn Willdenda8485e2014-08-17 08:00:01 -0600319 buf = enforced.Serialize(buf, end);
Shawn Willdenda8485e2014-08-17 08:00:01 -0600320 return unenforced.Serialize(buf, end);
321}
322
323bool ImportKeyResponse::NonErrorDeserialize(const uint8_t** buf_ptr, const uint8_t* end) {
Shawn Willden38f17012015-01-13 16:37:08 -0700324 return deserialize_key_blob(&key_blob, buf_ptr, end) && enforced.Deserialize(buf_ptr, end) &&
325 unenforced.Deserialize(buf_ptr, end);
Shawn Willdenda8485e2014-08-17 08:00:01 -0600326}
327
328void ExportKeyRequest::SetKeyMaterial(const void* key_material, size_t length) {
Shawn Willden38f17012015-01-13 16:37:08 -0700329 set_key_blob(&key_blob, key_material, length);
Shawn Willdenda8485e2014-08-17 08:00:01 -0600330}
331
332size_t ExportKeyRequest::SerializedSize() const {
Shawn Willdenf2282b32014-08-25 06:49:54 -0600333 return additional_params.SerializedSize() + sizeof(uint32_t) /* key_format */ +
Shawn Willden38f17012015-01-13 16:37:08 -0700334 key_blob_size(key_blob);
Shawn Willdenda8485e2014-08-17 08:00:01 -0600335}
336
337uint8_t* ExportKeyRequest::Serialize(uint8_t* buf, const uint8_t* end) const {
Shawn Willdenda8485e2014-08-17 08:00:01 -0600338 buf = additional_params.Serialize(buf, end);
339 buf = append_uint32_to_buf(buf, end, key_format);
Shawn Willden38f17012015-01-13 16:37:08 -0700340 return serialize_key_blob(key_blob, buf, end);
Shawn Willdenda8485e2014-08-17 08:00:01 -0600341}
342
343bool ExportKeyRequest::Deserialize(const uint8_t** buf_ptr, const uint8_t* end) {
Shawn Willden38f17012015-01-13 16:37:08 -0700344 return additional_params.Deserialize(buf_ptr, end) &&
345 copy_uint32_from_buf(buf_ptr, end, &key_format) &&
346 deserialize_key_blob(&key_blob, buf_ptr, end);
Shawn Willdenda8485e2014-08-17 08:00:01 -0600347}
348
349void ExportKeyResponse::SetKeyMaterial(const void* key_material, size_t length) {
350 delete[] key_data;
351 key_data = dup_buffer(key_material, length);
352 key_data_length = length;
353}
354
355size_t ExportKeyResponse::NonErrorSerializedSize() const {
356 return sizeof(uint32_t) /* key_data_length */ + key_data_length;
357}
358
359uint8_t* ExportKeyResponse::NonErrorSerialize(uint8_t* buf, const uint8_t* end) const {
360 return append_size_and_data_to_buf(buf, end, key_data, key_data_length);
361}
362
363bool ExportKeyResponse::NonErrorDeserialize(const uint8_t** buf_ptr, const uint8_t* end) {
Shawn Willdenf2282b32014-08-25 06:49:54 -0600364 delete[] key_data;
365 key_data = NULL;
366 UniquePtr<uint8_t[]> deserialized_key_material;
367 if (!copy_size_and_data_from_buf(buf_ptr, end, &key_data_length, &deserialized_key_material))
368 return false;
369 key_data = deserialized_key_material.release();
370 return true;
Shawn Willden128ffe02014-08-06 12:31:33 -0600371}
372
Shawn Willden2665e862014-11-24 14:46:21 -0700373size_t GetVersionResponse::NonErrorSerializedSize() const {
374 return sizeof(major_ver) + sizeof(minor_ver) + sizeof(subminor_ver);
375}
376
377uint8_t* GetVersionResponse::NonErrorSerialize(uint8_t* buf, const uint8_t* end) const {
378 if (buf + NonErrorSerializedSize() <= end) {
379 *buf++ = major_ver;
380 *buf++ = minor_ver;
381 *buf++ = subminor_ver;
382 } else {
383 buf += NonErrorSerializedSize();
384 }
385 return buf;
386}
387
388bool GetVersionResponse::NonErrorDeserialize(const uint8_t** buf_ptr, const uint8_t* end) {
389 if (*buf_ptr + NonErrorSerializedSize() > end)
390 return false;
391 const uint8_t* tmp = *buf_ptr;
392 major_ver = *tmp++;
393 minor_ver = *tmp++;
394 subminor_ver = *tmp++;
395 *buf_ptr = tmp;
396 return true;
397}
398
Shawn Willden9c9dd9a2015-01-14 08:31:49 -0700399void RescopeRequest::SetKeyMaterial(const void* key_material, size_t length) {
400 set_key_blob(&key_blob, key_material, length);
401}
402
403size_t RescopeRequest::SerializedSize() const {
404 return key_blob_size(key_blob) + additional_params.SerializedSize() +
405 new_authorizations.SerializedSize();
406}
407
408uint8_t* RescopeRequest::Serialize(uint8_t* buf, const uint8_t* end) const {
409 buf = serialize_key_blob(key_blob, buf, end);
410 buf = additional_params.Serialize(buf, end);
411 return new_authorizations.Serialize(buf, end);
412}
413
414bool RescopeRequest::Deserialize(const uint8_t** buf_ptr, const uint8_t* end) {
415 return deserialize_key_blob(&key_blob, buf_ptr, end) &&
416 additional_params.Deserialize(buf_ptr, end) &&
417 new_authorizations.Deserialize(buf_ptr, end);
418}
419
420void RescopeResponse::SetKeyMaterial(const void* key_material, size_t length) {
421 set_key_blob(&key_blob, key_material, length);
422}
423
424size_t RescopeResponse::NonErrorSerializedSize() const {
425 return key_blob_size(key_blob) + enforced.SerializedSize() + unenforced.SerializedSize();
426}
427
428uint8_t* RescopeResponse::NonErrorSerialize(uint8_t* buf, const uint8_t* end) const {
429 buf = serialize_key_blob(key_blob, buf, end);
430 buf = enforced.Serialize(buf, end);
431 return unenforced.Serialize(buf, end);
432}
433
434bool RescopeResponse::NonErrorDeserialize(const uint8_t** buf_ptr, const uint8_t* end) {
435 return deserialize_key_blob(&key_blob, buf_ptr, end) && enforced.Deserialize(buf_ptr, end) &&
436 unenforced.Deserialize(buf_ptr, end);
437}
438
Shawn Willden128ffe02014-08-06 12:31:33 -0600439} // namespace keymaster