github.com/linuxboot/fiano@v1.2.0/pkg/amd/manifest/internal.go (about) 1 // Copyright 2019 the LinuxBoot Authors. All rights reserved 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package manifest 6 7 import ( 8 "encoding/binary" 9 "io" 10 ) 11 12 func readAndCountSize(r io.Reader, order binary.ByteOrder, data interface{}, counter *uint64) error { 13 if err := binary.Read(r, order, data); err != nil { 14 return err 15 } 16 if counter != nil { 17 *counter += uint64(binary.Size(data)) 18 } 19 return nil 20 }