Lines Matching refs:buffer

39 static inline void append_to_buffer(uint8_t **buffer, const SizedBuffer *to_append) {  in append_to_buffer()  argument
40 memcpy(*buffer, &to_append->length, sizeof(to_append->length)); in append_to_buffer()
41 *buffer += sizeof(to_append->length); in append_to_buffer()
43 memcpy(*buffer, to_append->buffer.get(), to_append->length); in append_to_buffer()
44 *buffer += to_append->length; in append_to_buffer()
48 static inline gatekeeper_error_t read_from_buffer(const uint8_t **buffer, const uint8_t *end, in read_from_buffer() argument
50 if (*buffer + sizeof(target->length) > end) return ERROR_INVALID; in read_from_buffer()
52 memcpy(&target->length, *buffer, sizeof(target->length)); in read_from_buffer()
53 *buffer += sizeof(target->length); in read_from_buffer()
55 const uint8_t *buffer_end = *buffer + target->length; in read_from_buffer()
56 if (buffer_end > end || buffer_end <= *buffer) return ERROR_INVALID; in read_from_buffer()
58 target->buffer.reset(new uint8_t[target->length]); in read_from_buffer()
59 memcpy(target->buffer.get(), *buffer, target->length); in read_from_buffer()
60 *buffer += target->length; in read_from_buffer()
79 uint32_t GateKeeperMessage::Serialize(uint8_t *buffer, const uint8_t *end) const { in Serialize() argument
81 if (buffer + GetSerializedSize() > end) { in Serialize()
85 serial_header_t *header = reinterpret_cast<serial_header_t *>(buffer); in Serialize()
87 if (buffer + sizeof(serial_header_t) > end) return 0; in Serialize()
92 memcpy(buffer + sizeof(serial_header_t), &retry_timeout, sizeof(retry_timeout)); in Serialize()
96 if (buffer + sizeof(serial_header_t) + nonErrorSerializedSize() > end) in Serialize()
100 nonErrorSerialize(buffer + sizeof(*header)); in Serialize()
138 this->password_handle.buffer.reset(enrolled_password_handle->buffer.release()); in VerifyRequest()
140 this->provided_password.buffer.reset(provided_password_payload->buffer.release()); in VerifyRequest()
150 if (password_handle.buffer.get()) { in ~VerifyRequest()
151 password_handle.buffer.reset(); in ~VerifyRequest()
154 if (provided_password.buffer.get()) { in ~VerifyRequest()
155 memset_s(provided_password.buffer.get(), 0, provided_password.length); in ~VerifyRequest()
156 provided_password.buffer.reset(); in ~VerifyRequest()
165 void VerifyRequest::nonErrorSerialize(uint8_t *buffer) const { in nonErrorSerialize()
166 memcpy(buffer, &challenge, sizeof(challenge)); in nonErrorSerialize()
167 buffer += sizeof(challenge); in nonErrorSerialize()
168 append_to_buffer(&buffer, &password_handle); in nonErrorSerialize()
169 append_to_buffer(&buffer, &provided_password); in nonErrorSerialize()
175 if (password_handle.buffer.get()) { in nonErrorDeserialize()
176 password_handle.buffer.reset(); in nonErrorDeserialize()
179 if (provided_password.buffer.get()) { in nonErrorDeserialize()
180 memset_s(provided_password.buffer.get(), 0, provided_password.length); in nonErrorDeserialize()
181 provided_password.buffer.reset(); in nonErrorDeserialize()
196 this->auth_token.buffer.reset(auth_token->buffer.release()); in VerifyResponse()
208 auth_token.buffer.reset(); in ~VerifyResponse()
213 this->auth_token.buffer.reset(auth_token->buffer.release()); in SetVerificationToken()
221 void VerifyResponse::nonErrorSerialize(uint8_t *buffer) const { in nonErrorSerialize()
222 append_to_buffer(&buffer, &auth_token); in nonErrorSerialize()
223 memcpy(buffer, &request_reenroll, sizeof(request_reenroll)); in nonErrorSerialize()
227 if (auth_token.buffer.get()) { in nonErrorDeserialize()
228 auth_token.buffer.reset(); in nonErrorDeserialize()
243 this->provided_password.buffer.reset(provided_password->buffer.release()); in EnrollRequest()
247 this->enrolled_password.buffer.reset(); in EnrollRequest()
250 this->enrolled_password.buffer.reset(enrolled_password->buffer.release()); in EnrollRequest()
255 this->password_handle.buffer.reset(); in EnrollRequest()
258 this->password_handle.buffer.reset(password_handle->buffer.release()); in EnrollRequest()
270 if (provided_password.buffer.get()) { in ~EnrollRequest()
271 memset_s(provided_password.buffer.get(), 0, provided_password.length); in ~EnrollRequest()
272 provided_password.buffer.reset(); in ~EnrollRequest()
275 if (enrolled_password.buffer.get()) { in ~EnrollRequest()
276 memset_s(enrolled_password.buffer.get(), 0, enrolled_password.length); in ~EnrollRequest()
277 enrolled_password.buffer.reset(); in ~EnrollRequest()
280 if (password_handle.buffer.get()) { in ~EnrollRequest()
281 memset_s(password_handle.buffer.get(), 0, password_handle.length); in ~EnrollRequest()
282 password_handle.buffer.reset(); in ~EnrollRequest()
291 void EnrollRequest::nonErrorSerialize(uint8_t *buffer) const { in nonErrorSerialize()
292 append_to_buffer(&buffer, &provided_password); in nonErrorSerialize()
293 append_to_buffer(&buffer, &enrolled_password); in nonErrorSerialize()
294 append_to_buffer(&buffer, &password_handle); in nonErrorSerialize()
299 if (provided_password.buffer.get()) { in nonErrorDeserialize()
300 memset_s(provided_password.buffer.get(), 0, provided_password.length); in nonErrorDeserialize()
301 provided_password.buffer.reset(); in nonErrorDeserialize()
304 if (enrolled_password.buffer.get()) { in nonErrorDeserialize()
305 memset_s(enrolled_password.buffer.get(), 0, enrolled_password.length); in nonErrorDeserialize()
306 enrolled_password.buffer.reset(); in nonErrorDeserialize()
309 if (password_handle.buffer.get()) { in nonErrorDeserialize()
310 memset_s(password_handle.buffer.get(), 0, password_handle.length); in nonErrorDeserialize()
311 password_handle.buffer.reset(); in nonErrorDeserialize()
329 this->enrolled_password_handle.buffer.reset(enrolled_password_handle->buffer.release()); in EnrollResponse()
338 if (enrolled_password_handle.buffer.get()) { in ~EnrollResponse()
339 enrolled_password_handle.buffer.reset(); in ~EnrollResponse()
344 this->enrolled_password_handle.buffer.reset(enrolled_password_handle->buffer.release()); in SetEnrolledPasswordHandle()
352 void EnrollResponse::nonErrorSerialize(uint8_t *buffer) const { in nonErrorSerialize()
353 append_to_buffer(&buffer, &enrolled_password_handle); in nonErrorSerialize()
357 if (enrolled_password_handle.buffer.get()) { in nonErrorDeserialize()
358 enrolled_password_handle.buffer.reset(); in nonErrorDeserialize()