Add output params to BeginOperation messages.
Change-Id: I111b32612ec0ffc8e652759412a9e59a9269ddcd
diff --git a/google_keymaster_messages.cpp b/google_keymaster_messages.cpp
index 13fb3f2..dea11ba 100644
--- a/google_keymaster_messages.cpp
+++ b/google_keymaster_messages.cpp
@@ -163,15 +163,24 @@
}
size_t BeginOperationResponse::NonErrorSerializedSize() const {
- return sizeof(op_handle);
+ if (message_version == 0)
+ return sizeof(op_handle);
+ else
+ return sizeof(op_handle) + output_params.SerializedSize();
}
uint8_t* BeginOperationResponse::NonErrorSerialize(uint8_t* buf, const uint8_t* end) const {
- return append_uint64_to_buf(buf, end, op_handle);
+ buf = append_uint64_to_buf(buf, end, op_handle);
+ if (message_version > 0)
+ buf = output_params.Serialize(buf, end);
+ return buf;
}
bool BeginOperationResponse::NonErrorDeserialize(const uint8_t** buf_ptr, const uint8_t* end) {
- return copy_uint64_from_buf(buf_ptr, end, &op_handle);
+ bool retval = copy_uint64_from_buf(buf_ptr, end, &op_handle);
+ if (retval && message_version > 0)
+ retval = output_params.Deserialize(buf_ptr, end);
+ return retval;
}
size_t UpdateOperationRequest::SerializedSize() const {