1// Copyright 2018 The Fuchsia Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#include "util.h" 6 7#include <string.h> 8 9#include <zircon/assert.h> 10 11namespace optee { 12 13UuidView::UuidView(const uint8_t* data, size_t size) 14 : ptr_{data} { 15 ZX_DEBUG_ASSERT(data); 16 ZX_DEBUG_ASSERT(size == kUuidSize); 17} 18 19void UuidView::ToUint64Pair(uint64_t* out_hi, uint64_t* out_low) const { 20 ZX_DEBUG_ASSERT(out_hi); 21 ZX_DEBUG_ASSERT(out_low); 22 23 // REE and TEE always share the same endianness so the treatment of UUID bytes is the same on 24 // both sides. 25 ::memcpy(out_hi, ptr_, sizeof(*out_hi)); 26 ::memcpy(out_low, ptr_ + sizeof(*out_hi), sizeof(*out_low)); 27} 28 29} // namespace optee 30