2021-06-12 18:15:59 -07:00
|
|
|
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
2020-03-20 17:40:52 -07:00
|
|
|
// source: internal/pb/hdr.proto
|
|
|
|
|
|
|
|
package pb
|
|
|
|
|
2021-06-12 18:15:59 -07:00
|
|
|
import (
|
|
|
|
bytes "bytes"
|
|
|
|
fmt "fmt"
|
|
|
|
proto "github.com/gogo/protobuf/proto"
|
|
|
|
io "io"
|
|
|
|
math "math"
|
|
|
|
math_bits "math/bits"
|
|
|
|
reflect "reflect"
|
|
|
|
strings "strings"
|
|
|
|
)
|
2019-10-17 14:29:01 -07:00
|
|
|
|
|
|
|
// Reference imports to suppress errors if they are not otherwise used.
|
|
|
|
var _ = proto.Marshal
|
|
|
|
var _ = fmt.Errorf
|
|
|
|
var _ = math.Inf
|
|
|
|
|
|
|
|
// This is a compile-time assertion to ensure that this generated file
|
|
|
|
// is compatible with the proto package it is being compiled against.
|
|
|
|
// A compilation error at this line likely means your copy of the
|
|
|
|
// proto package needs to be updated.
|
2021-06-12 18:15:59 -07:00
|
|
|
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
2019-10-17 14:29:01 -07:00
|
|
|
|
2020-02-15 11:15:38 -08:00
|
|
|
//
|
|
|
|
// Every encrypted file starts with a header describing the
|
|
|
|
// Block Size, Salt, Recipient keys etc. Header represents a
|
|
|
|
// decoded version of this information. It is encoded in
|
|
|
|
// protobuf format before writing to disk.
|
2019-10-17 14:29:01 -07:00
|
|
|
type Header struct {
|
2022-11-13 11:53:00 -08:00
|
|
|
ChunkSize uint32 `protobuf:"varint,1,opt,name=chunk_size,json=chunkSize,proto3" json:"chunk_size,omitempty"`
|
|
|
|
Salt []byte `protobuf:"bytes,2,opt,name=salt,proto3" json:"salt,omitempty"`
|
|
|
|
Pk []byte `protobuf:"bytes,3,opt,name=pk,proto3" json:"pk,omitempty"`
|
|
|
|
Sender []byte `protobuf:"bytes,4,opt,name=sender,proto3" json:"sender,omitempty"`
|
|
|
|
Keys []*WrappedKey `protobuf:"bytes,5,rep,name=keys,proto3" json:"keys,omitempty"`
|
2021-06-12 18:15:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Header) Reset() { *m = Header{} }
|
|
|
|
func (*Header) ProtoMessage() {}
|
|
|
|
func (*Header) Descriptor() ([]byte, []int) {
|
|
|
|
return fileDescriptor_c715362029a696e2, []int{0}
|
|
|
|
}
|
|
|
|
func (m *Header) XXX_Unmarshal(b []byte) error {
|
|
|
|
return m.Unmarshal(b)
|
|
|
|
}
|
|
|
|
func (m *Header) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
|
|
if deterministic {
|
|
|
|
return xxx_messageInfo_Header.Marshal(b, m, deterministic)
|
|
|
|
} else {
|
|
|
|
b = b[:cap(b)]
|
|
|
|
n, err := m.MarshalToSizedBuffer(b)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return b[:n], nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
func (m *Header) XXX_Merge(src proto.Message) {
|
|
|
|
xxx_messageInfo_Header.Merge(m, src)
|
|
|
|
}
|
|
|
|
func (m *Header) XXX_Size() int {
|
|
|
|
return m.Size()
|
|
|
|
}
|
|
|
|
func (m *Header) XXX_DiscardUnknown() {
|
|
|
|
xxx_messageInfo_Header.DiscardUnknown(m)
|
2019-10-17 14:29:01 -07:00
|
|
|
}
|
|
|
|
|
2021-06-12 18:15:59 -07:00
|
|
|
var xxx_messageInfo_Header proto.InternalMessageInfo
|
2019-10-17 14:29:01 -07:00
|
|
|
|
|
|
|
func (m *Header) GetChunkSize() uint32 {
|
|
|
|
if m != nil {
|
|
|
|
return m.ChunkSize
|
|
|
|
}
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Header) GetSalt() []byte {
|
|
|
|
if m != nil {
|
|
|
|
return m.Salt
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-03-20 17:40:52 -07:00
|
|
|
func (m *Header) GetPk() []byte {
|
2019-10-17 14:29:01 -07:00
|
|
|
if m != nil {
|
2020-03-20 17:40:52 -07:00
|
|
|
return m.Pk
|
2019-10-17 14:29:01 -07:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2022-11-13 11:53:00 -08:00
|
|
|
func (m *Header) GetSender() []byte {
|
2020-03-20 17:40:52 -07:00
|
|
|
if m != nil {
|
2022-11-13 11:53:00 -08:00
|
|
|
return m.Sender
|
2019-10-17 14:29:01 -07:00
|
|
|
}
|
2020-03-20 17:40:52 -07:00
|
|
|
return nil
|
2019-10-17 14:29:01 -07:00
|
|
|
}
|
|
|
|
|
2020-03-20 17:40:52 -07:00
|
|
|
func (m *Header) GetKeys() []*WrappedKey {
|
2019-10-17 14:29:01 -07:00
|
|
|
if m != nil {
|
2020-03-20 17:40:52 -07:00
|
|
|
return m.Keys
|
2019-10-17 14:29:01 -07:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-03-20 17:40:52 -07:00
|
|
|
//
|
|
|
|
// A file encryption key is wrapped by a recipient specific public
|
|
|
|
// key. WrappedKey describes such a wrapped key.
|
|
|
|
type WrappedKey struct {
|
2022-11-13 11:53:00 -08:00
|
|
|
DKey []byte `protobuf:"bytes,1,opt,name=d_key,json=dKey,proto3" json:"d_key,omitempty"`
|
|
|
|
Nonce []byte `protobuf:"bytes,2,opt,name=nonce,proto3" json:"nonce,omitempty"`
|
2019-10-17 14:29:01 -07:00
|
|
|
}
|
|
|
|
|
2021-06-12 18:15:59 -07:00
|
|
|
func (m *WrappedKey) Reset() { *m = WrappedKey{} }
|
|
|
|
func (*WrappedKey) ProtoMessage() {}
|
|
|
|
func (*WrappedKey) Descriptor() ([]byte, []int) {
|
|
|
|
return fileDescriptor_c715362029a696e2, []int{1}
|
|
|
|
}
|
|
|
|
func (m *WrappedKey) XXX_Unmarshal(b []byte) error {
|
|
|
|
return m.Unmarshal(b)
|
|
|
|
}
|
|
|
|
func (m *WrappedKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
|
|
if deterministic {
|
|
|
|
return xxx_messageInfo_WrappedKey.Marshal(b, m, deterministic)
|
|
|
|
} else {
|
|
|
|
b = b[:cap(b)]
|
|
|
|
n, err := m.MarshalToSizedBuffer(b)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return b[:n], nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
func (m *WrappedKey) XXX_Merge(src proto.Message) {
|
|
|
|
xxx_messageInfo_WrappedKey.Merge(m, src)
|
|
|
|
}
|
|
|
|
func (m *WrappedKey) XXX_Size() int {
|
|
|
|
return m.Size()
|
|
|
|
}
|
|
|
|
func (m *WrappedKey) XXX_DiscardUnknown() {
|
|
|
|
xxx_messageInfo_WrappedKey.DiscardUnknown(m)
|
|
|
|
}
|
|
|
|
|
|
|
|
var xxx_messageInfo_WrappedKey proto.InternalMessageInfo
|
2020-03-20 17:40:52 -07:00
|
|
|
|
2020-03-23 10:44:40 -07:00
|
|
|
func (m *WrappedKey) GetDKey() []byte {
|
2019-10-17 14:29:01 -07:00
|
|
|
if m != nil {
|
2020-03-23 10:44:40 -07:00
|
|
|
return m.DKey
|
2019-10-17 14:29:01 -07:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2022-11-13 11:53:00 -08:00
|
|
|
func (m *WrappedKey) GetNonce() []byte {
|
|
|
|
if m != nil {
|
|
|
|
return m.Nonce
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2019-10-17 14:29:01 -07:00
|
|
|
func init() {
|
2020-03-20 17:40:52 -07:00
|
|
|
proto.RegisterType((*Header)(nil), "pb.header")
|
|
|
|
proto.RegisterType((*WrappedKey)(nil), "pb.wrapped_key")
|
2019-10-17 14:29:01 -07:00
|
|
|
}
|
2021-06-12 18:15:59 -07:00
|
|
|
|
|
|
|
func init() { proto.RegisterFile("internal/pb/hdr.proto", fileDescriptor_c715362029a696e2) }
|
|
|
|
|
|
|
|
var fileDescriptor_c715362029a696e2 = []byte{
|
2022-11-13 11:53:00 -08:00
|
|
|
// 262 bytes of a gzipped FileDescriptorProto
|
|
|
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0xd0, 0x3f, 0x4e, 0xf3, 0x40,
|
|
|
|
0x10, 0x05, 0xf0, 0x1d, 0xc7, 0x89, 0xf4, 0x4d, 0xf2, 0x81, 0xb4, 0xfc, 0x91, 0x1b, 0x46, 0x56,
|
|
|
|
0x68, 0x5c, 0x39, 0x12, 0x50, 0x50, 0xd3, 0xd2, 0x99, 0x03, 0x44, 0x76, 0x3c, 0x92, 0x2d, 0x47,
|
|
|
|
0xeb, 0xd5, 0xda, 0x08, 0x39, 0x15, 0x25, 0x25, 0xc7, 0xe0, 0x28, 0x94, 0x2e, 0x53, 0xe2, 0x75,
|
|
|
|
0x43, 0x99, 0x23, 0x20, 0x2d, 0x29, 0xe8, 0xde, 0xfb, 0x4d, 0xf3, 0x34, 0x78, 0x51, 0xaa, 0x96,
|
|
|
|
0x8d, 0x4a, 0xb7, 0x2b, 0x9d, 0xad, 0x8a, 0xdc, 0xc4, 0xda, 0xd4, 0x6d, 0x2d, 0x3d, 0x9d, 0x2d,
|
|
|
|
0xdf, 0x00, 0x67, 0x05, 0xa7, 0x39, 0x1b, 0x79, 0x85, 0xb8, 0x29, 0x9e, 0x55, 0xb5, 0x6e, 0xca,
|
|
|
|
0x1d, 0x07, 0x10, 0x42, 0xf4, 0x3f, 0xf9, 0xe7, 0xe4, 0xa9, 0xdc, 0xb1, 0x94, 0xe8, 0x37, 0xe9,
|
|
|
|
0xb6, 0x0d, 0xbc, 0x10, 0xa2, 0x45, 0xe2, 0xb2, 0x3c, 0x41, 0x4f, 0x57, 0xc1, 0xc4, 0x89, 0xa7,
|
|
|
|
0x2b, 0x79, 0x89, 0xb3, 0x86, 0x55, 0xce, 0x26, 0xf0, 0x9d, 0x1d, 0x9b, 0xbc, 0x46, 0xbf, 0xe2,
|
|
|
|
0xae, 0x09, 0xa6, 0xe1, 0x24, 0x9a, 0xdf, 0x9c, 0xc6, 0x3a, 0x8b, 0x5f, 0x4c, 0xaa, 0x35, 0xe7,
|
|
|
|
0xeb, 0x8a, 0xbb, 0xc4, 0x1d, 0x97, 0xf7, 0x38, 0xff, 0x83, 0xf2, 0x0c, 0xa7, 0x2e, 0xb8, 0x25,
|
|
|
|
0x8b, 0xc4, 0xcf, 0x1f, 0xb9, 0x93, 0xe7, 0x38, 0x55, 0xb5, 0xda, 0xf0, 0x71, 0xc5, 0x6f, 0x79,
|
|
|
|
0xb8, 0xeb, 0x07, 0x12, 0xfb, 0x81, 0xc4, 0x61, 0x20, 0x78, 0xb5, 0x04, 0x1f, 0x96, 0xe0, 0xd3,
|
|
|
|
0x12, 0xf4, 0x96, 0xe0, 0xcb, 0x12, 0x7c, 0x5b, 0x12, 0x07, 0x4b, 0xf0, 0x3e, 0x92, 0xe8, 0x47,
|
|
|
|
0x12, 0xfb, 0x91, 0x44, 0x36, 0x73, 0x5f, 0xb8, 0xfd, 0x09, 0x00, 0x00, 0xff, 0xff, 0x06, 0x40,
|
|
|
|
0x0b, 0xb4, 0x1e, 0x01, 0x00, 0x00,
|
2021-06-12 18:15:59 -07:00
|
|
|
}
|
|
|
|
|
2019-10-17 14:29:01 -07:00
|
|
|
func (this *Header) Equal(that interface{}) bool {
|
|
|
|
if that == nil {
|
2021-06-12 18:15:59 -07:00
|
|
|
return this == nil
|
2019-10-17 14:29:01 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
that1, ok := that.(*Header)
|
|
|
|
if !ok {
|
|
|
|
that2, ok := that.(Header)
|
|
|
|
if ok {
|
|
|
|
that1 = &that2
|
|
|
|
} else {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if that1 == nil {
|
2021-06-12 18:15:59 -07:00
|
|
|
return this == nil
|
2019-10-17 14:29:01 -07:00
|
|
|
} else if this == nil {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
if this.ChunkSize != that1.ChunkSize {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
if !bytes.Equal(this.Salt, that1.Salt) {
|
|
|
|
return false
|
|
|
|
}
|
2020-03-20 17:40:52 -07:00
|
|
|
if !bytes.Equal(this.Pk, that1.Pk) {
|
|
|
|
return false
|
|
|
|
}
|
2022-11-13 11:53:00 -08:00
|
|
|
if !bytes.Equal(this.Sender, that1.Sender) {
|
2020-03-20 17:40:52 -07:00
|
|
|
return false
|
|
|
|
}
|
2019-10-17 14:29:01 -07:00
|
|
|
if len(this.Keys) != len(that1.Keys) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
for i := range this.Keys {
|
|
|
|
if !this.Keys[i].Equal(that1.Keys[i]) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true
|
|
|
|
}
|
2020-03-20 17:40:52 -07:00
|
|
|
func (this *WrappedKey) Equal(that interface{}) bool {
|
|
|
|
if that == nil {
|
2021-06-12 18:15:59 -07:00
|
|
|
return this == nil
|
2019-10-17 14:29:01 -07:00
|
|
|
}
|
2020-03-20 17:40:52 -07:00
|
|
|
|
|
|
|
that1, ok := that.(*WrappedKey)
|
|
|
|
if !ok {
|
|
|
|
that2, ok := that.(WrappedKey)
|
|
|
|
if ok {
|
|
|
|
that1 = &that2
|
|
|
|
} else {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if that1 == nil {
|
2021-06-12 18:15:59 -07:00
|
|
|
return this == nil
|
2020-03-20 17:40:52 -07:00
|
|
|
} else if this == nil {
|
2019-10-17 14:29:01 -07:00
|
|
|
return false
|
|
|
|
}
|
2020-03-23 10:44:40 -07:00
|
|
|
if !bytes.Equal(this.DKey, that1.DKey) {
|
2019-10-17 14:29:01 -07:00
|
|
|
return false
|
|
|
|
}
|
2022-11-13 11:53:00 -08:00
|
|
|
if !bytes.Equal(this.Nonce, that1.Nonce) {
|
|
|
|
return false
|
|
|
|
}
|
2019-10-17 14:29:01 -07:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
func (this *Header) GoString() string {
|
|
|
|
if this == nil {
|
|
|
|
return "nil"
|
|
|
|
}
|
2020-03-20 17:40:52 -07:00
|
|
|
s := make([]string, 0, 9)
|
|
|
|
s = append(s, "&pb.Header{")
|
2019-10-17 14:29:01 -07:00
|
|
|
s = append(s, "ChunkSize: "+fmt.Sprintf("%#v", this.ChunkSize)+",\n")
|
|
|
|
s = append(s, "Salt: "+fmt.Sprintf("%#v", this.Salt)+",\n")
|
2020-03-20 17:40:52 -07:00
|
|
|
s = append(s, "Pk: "+fmt.Sprintf("%#v", this.Pk)+",\n")
|
2022-11-13 11:53:00 -08:00
|
|
|
s = append(s, "Sender: "+fmt.Sprintf("%#v", this.Sender)+",\n")
|
2019-10-17 14:29:01 -07:00
|
|
|
if this.Keys != nil {
|
|
|
|
s = append(s, "Keys: "+fmt.Sprintf("%#v", this.Keys)+",\n")
|
|
|
|
}
|
|
|
|
s = append(s, "}")
|
|
|
|
return strings.Join(s, "")
|
|
|
|
}
|
2020-03-20 17:40:52 -07:00
|
|
|
func (this *WrappedKey) GoString() string {
|
|
|
|
if this == nil {
|
|
|
|
return "nil"
|
|
|
|
}
|
2022-11-13 11:53:00 -08:00
|
|
|
s := make([]string, 0, 6)
|
2020-03-20 17:40:52 -07:00
|
|
|
s = append(s, "&pb.WrappedKey{")
|
2020-03-23 10:44:40 -07:00
|
|
|
s = append(s, "DKey: "+fmt.Sprintf("%#v", this.DKey)+",\n")
|
2022-11-13 11:53:00 -08:00
|
|
|
s = append(s, "Nonce: "+fmt.Sprintf("%#v", this.Nonce)+",\n")
|
2019-10-17 14:29:01 -07:00
|
|
|
s = append(s, "}")
|
|
|
|
return strings.Join(s, "")
|
|
|
|
}
|
|
|
|
func valueToGoStringHdr(v interface{}, typ string) string {
|
|
|
|
rv := reflect.ValueOf(v)
|
|
|
|
if rv.IsNil() {
|
|
|
|
return "nil"
|
|
|
|
}
|
|
|
|
pv := reflect.Indirect(rv).Interface()
|
|
|
|
return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv)
|
|
|
|
}
|
|
|
|
func (m *Header) Marshal() (dAtA []byte, err error) {
|
|
|
|
size := m.Size()
|
|
|
|
dAtA = make([]byte, size)
|
2021-06-12 18:15:59 -07:00
|
|
|
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
2019-10-17 14:29:01 -07:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return dAtA[:n], nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Header) MarshalTo(dAtA []byte) (int, error) {
|
2021-06-12 18:15:59 -07:00
|
|
|
size := m.Size()
|
|
|
|
return m.MarshalToSizedBuffer(dAtA[:size])
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|
|
|
i := len(dAtA)
|
2019-10-17 14:29:01 -07:00
|
|
|
_ = i
|
|
|
|
var l int
|
|
|
|
_ = l
|
2021-06-12 18:15:59 -07:00
|
|
|
if len(m.Keys) > 0 {
|
|
|
|
for iNdEx := len(m.Keys) - 1; iNdEx >= 0; iNdEx-- {
|
|
|
|
{
|
|
|
|
size, err := m.Keys[iNdEx].MarshalToSizedBuffer(dAtA[:i])
|
|
|
|
if err != nil {
|
|
|
|
return 0, err
|
|
|
|
}
|
|
|
|
i -= size
|
|
|
|
i = encodeVarintHdr(dAtA, i, uint64(size))
|
|
|
|
}
|
|
|
|
i--
|
|
|
|
dAtA[i] = 0x2a
|
|
|
|
}
|
2019-10-17 14:29:01 -07:00
|
|
|
}
|
2022-11-13 11:53:00 -08:00
|
|
|
if len(m.Sender) > 0 {
|
|
|
|
i -= len(m.Sender)
|
|
|
|
copy(dAtA[i:], m.Sender)
|
|
|
|
i = encodeVarintHdr(dAtA, i, uint64(len(m.Sender)))
|
2021-06-12 18:15:59 -07:00
|
|
|
i--
|
|
|
|
dAtA[i] = 0x22
|
2019-10-17 14:29:01 -07:00
|
|
|
}
|
2020-03-20 17:40:52 -07:00
|
|
|
if len(m.Pk) > 0 {
|
2021-06-12 18:15:59 -07:00
|
|
|
i -= len(m.Pk)
|
|
|
|
copy(dAtA[i:], m.Pk)
|
2020-03-20 17:40:52 -07:00
|
|
|
i = encodeVarintHdr(dAtA, i, uint64(len(m.Pk)))
|
2021-06-12 18:15:59 -07:00
|
|
|
i--
|
|
|
|
dAtA[i] = 0x1a
|
2020-03-20 17:40:52 -07:00
|
|
|
}
|
2021-06-12 18:15:59 -07:00
|
|
|
if len(m.Salt) > 0 {
|
|
|
|
i -= len(m.Salt)
|
|
|
|
copy(dAtA[i:], m.Salt)
|
|
|
|
i = encodeVarintHdr(dAtA, i, uint64(len(m.Salt)))
|
|
|
|
i--
|
|
|
|
dAtA[i] = 0x12
|
2019-10-17 14:29:01 -07:00
|
|
|
}
|
2021-06-12 18:15:59 -07:00
|
|
|
if m.ChunkSize != 0 {
|
|
|
|
i = encodeVarintHdr(dAtA, i, uint64(m.ChunkSize))
|
|
|
|
i--
|
|
|
|
dAtA[i] = 0x8
|
2020-03-20 17:40:52 -07:00
|
|
|
}
|
2021-06-12 18:15:59 -07:00
|
|
|
return len(dAtA) - i, nil
|
2019-10-17 14:29:01 -07:00
|
|
|
}
|
|
|
|
|
2020-03-20 17:40:52 -07:00
|
|
|
func (m *WrappedKey) Marshal() (dAtA []byte, err error) {
|
2019-10-17 14:29:01 -07:00
|
|
|
size := m.Size()
|
2020-03-20 17:40:52 -07:00
|
|
|
dAtA = make([]byte, size)
|
2021-06-12 18:15:59 -07:00
|
|
|
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
2020-03-20 17:40:52 -07:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return dAtA[:n], nil
|
2019-10-17 14:29:01 -07:00
|
|
|
}
|
|
|
|
|
2020-03-20 17:40:52 -07:00
|
|
|
func (m *WrappedKey) MarshalTo(dAtA []byte) (int, error) {
|
2021-06-12 18:15:59 -07:00
|
|
|
size := m.Size()
|
|
|
|
return m.MarshalToSizedBuffer(dAtA[:size])
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *WrappedKey) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|
|
|
i := len(dAtA)
|
2019-10-17 14:29:01 -07:00
|
|
|
_ = i
|
|
|
|
var l int
|
|
|
|
_ = l
|
2022-11-13 11:53:00 -08:00
|
|
|
if len(m.Nonce) > 0 {
|
|
|
|
i -= len(m.Nonce)
|
|
|
|
copy(dAtA[i:], m.Nonce)
|
|
|
|
i = encodeVarintHdr(dAtA, i, uint64(len(m.Nonce)))
|
|
|
|
i--
|
|
|
|
dAtA[i] = 0x12
|
|
|
|
}
|
2020-03-23 10:44:40 -07:00
|
|
|
if len(m.DKey) > 0 {
|
2021-06-12 18:15:59 -07:00
|
|
|
i -= len(m.DKey)
|
|
|
|
copy(dAtA[i:], m.DKey)
|
2020-03-23 10:44:40 -07:00
|
|
|
i = encodeVarintHdr(dAtA, i, uint64(len(m.DKey)))
|
2021-06-12 18:15:59 -07:00
|
|
|
i--
|
|
|
|
dAtA[i] = 0xa
|
2019-10-17 14:29:01 -07:00
|
|
|
}
|
2021-06-12 18:15:59 -07:00
|
|
|
return len(dAtA) - i, nil
|
2019-10-17 14:29:01 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
func encodeVarintHdr(dAtA []byte, offset int, v uint64) int {
|
2021-06-12 18:15:59 -07:00
|
|
|
offset -= sovHdr(v)
|
|
|
|
base := offset
|
2019-10-17 14:29:01 -07:00
|
|
|
for v >= 1<<7 {
|
|
|
|
dAtA[offset] = uint8(v&0x7f | 0x80)
|
|
|
|
v >>= 7
|
|
|
|
offset++
|
|
|
|
}
|
|
|
|
dAtA[offset] = uint8(v)
|
2021-06-12 18:15:59 -07:00
|
|
|
return base
|
2019-10-17 14:29:01 -07:00
|
|
|
}
|
|
|
|
func (m *Header) Size() (n int) {
|
2021-06-12 18:15:59 -07:00
|
|
|
if m == nil {
|
|
|
|
return 0
|
|
|
|
}
|
2019-10-17 14:29:01 -07:00
|
|
|
var l int
|
|
|
|
_ = l
|
|
|
|
if m.ChunkSize != 0 {
|
|
|
|
n += 1 + sovHdr(uint64(m.ChunkSize))
|
|
|
|
}
|
|
|
|
l = len(m.Salt)
|
|
|
|
if l > 0 {
|
|
|
|
n += 1 + l + sovHdr(uint64(l))
|
|
|
|
}
|
2020-03-20 17:40:52 -07:00
|
|
|
l = len(m.Pk)
|
|
|
|
if l > 0 {
|
|
|
|
n += 1 + l + sovHdr(uint64(l))
|
|
|
|
}
|
2022-11-13 11:53:00 -08:00
|
|
|
l = len(m.Sender)
|
2020-03-23 10:44:40 -07:00
|
|
|
if l > 0 {
|
2020-03-20 17:40:52 -07:00
|
|
|
n += 1 + l + sovHdr(uint64(l))
|
|
|
|
}
|
2019-10-17 14:29:01 -07:00
|
|
|
if len(m.Keys) > 0 {
|
|
|
|
for _, e := range m.Keys {
|
|
|
|
l = e.Size()
|
|
|
|
n += 1 + l + sovHdr(uint64(l))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return n
|
|
|
|
}
|
|
|
|
|
2020-03-20 17:40:52 -07:00
|
|
|
func (m *WrappedKey) Size() (n int) {
|
2021-06-12 18:15:59 -07:00
|
|
|
if m == nil {
|
|
|
|
return 0
|
|
|
|
}
|
2020-03-20 17:40:52 -07:00
|
|
|
var l int
|
|
|
|
_ = l
|
2020-03-23 10:44:40 -07:00
|
|
|
l = len(m.DKey)
|
2019-10-17 14:29:01 -07:00
|
|
|
if l > 0 {
|
|
|
|
n += 1 + l + sovHdr(uint64(l))
|
|
|
|
}
|
2022-11-13 11:53:00 -08:00
|
|
|
l = len(m.Nonce)
|
|
|
|
if l > 0 {
|
|
|
|
n += 1 + l + sovHdr(uint64(l))
|
|
|
|
}
|
2019-10-17 14:29:01 -07:00
|
|
|
return n
|
|
|
|
}
|
|
|
|
|
|
|
|
func sovHdr(x uint64) (n int) {
|
2021-06-12 18:15:59 -07:00
|
|
|
return (math_bits.Len64(x|1) + 6) / 7
|
2019-10-17 14:29:01 -07:00
|
|
|
}
|
|
|
|
func sozHdr(x uint64) (n int) {
|
|
|
|
return sovHdr(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
|
|
|
}
|
|
|
|
func (this *Header) String() string {
|
|
|
|
if this == nil {
|
|
|
|
return "nil"
|
|
|
|
}
|
2021-06-12 18:15:59 -07:00
|
|
|
repeatedStringForKeys := "[]*WrappedKey{"
|
|
|
|
for _, f := range this.Keys {
|
|
|
|
repeatedStringForKeys += strings.Replace(fmt.Sprintf("%v", f), "WrappedKey", "WrappedKey", 1) + ","
|
|
|
|
}
|
|
|
|
repeatedStringForKeys += "}"
|
2019-10-17 14:29:01 -07:00
|
|
|
s := strings.Join([]string{`&Header{`,
|
|
|
|
`ChunkSize:` + fmt.Sprintf("%v", this.ChunkSize) + `,`,
|
|
|
|
`Salt:` + fmt.Sprintf("%v", this.Salt) + `,`,
|
2020-03-20 17:40:52 -07:00
|
|
|
`Pk:` + fmt.Sprintf("%v", this.Pk) + `,`,
|
2022-11-13 11:53:00 -08:00
|
|
|
`Sender:` + fmt.Sprintf("%v", this.Sender) + `,`,
|
2021-06-12 18:15:59 -07:00
|
|
|
`Keys:` + repeatedStringForKeys + `,`,
|
2020-03-20 17:40:52 -07:00
|
|
|
`}`,
|
|
|
|
}, "")
|
|
|
|
return s
|
|
|
|
}
|
2019-10-17 14:29:01 -07:00
|
|
|
func (this *WrappedKey) String() string {
|
|
|
|
if this == nil {
|
|
|
|
return "nil"
|
|
|
|
}
|
|
|
|
s := strings.Join([]string{`&WrappedKey{`,
|
2020-03-23 10:44:40 -07:00
|
|
|
`DKey:` + fmt.Sprintf("%v", this.DKey) + `,`,
|
2022-11-13 11:53:00 -08:00
|
|
|
`Nonce:` + fmt.Sprintf("%v", this.Nonce) + `,`,
|
2019-10-17 14:29:01 -07:00
|
|
|
`}`,
|
|
|
|
}, "")
|
|
|
|
return s
|
|
|
|
}
|
|
|
|
func valueToStringHdr(v interface{}) string {
|
|
|
|
rv := reflect.ValueOf(v)
|
|
|
|
if rv.IsNil() {
|
|
|
|
return "nil"
|
|
|
|
}
|
|
|
|
pv := reflect.Indirect(rv).Interface()
|
|
|
|
return fmt.Sprintf("*%v", pv)
|
|
|
|
}
|
|
|
|
func (m *Header) Unmarshal(dAtA []byte) error {
|
|
|
|
l := len(dAtA)
|
|
|
|
iNdEx := 0
|
|
|
|
for iNdEx < l {
|
|
|
|
preIndex := iNdEx
|
|
|
|
var wire uint64
|
|
|
|
for shift := uint(0); ; shift += 7 {
|
|
|
|
if shift >= 64 {
|
|
|
|
return ErrIntOverflowHdr
|
|
|
|
}
|
|
|
|
if iNdEx >= l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
b := dAtA[iNdEx]
|
|
|
|
iNdEx++
|
2021-06-12 18:15:59 -07:00
|
|
|
wire |= uint64(b&0x7F) << shift
|
2019-10-17 14:29:01 -07:00
|
|
|
if b < 0x80 {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fieldNum := int32(wire >> 3)
|
|
|
|
wireType := int(wire & 0x7)
|
|
|
|
if wireType == 4 {
|
|
|
|
return fmt.Errorf("proto: header: wiretype end group for non-group")
|
|
|
|
}
|
|
|
|
if fieldNum <= 0 {
|
|
|
|
return fmt.Errorf("proto: header: illegal tag %d (wire type %d)", fieldNum, wire)
|
|
|
|
}
|
|
|
|
switch fieldNum {
|
|
|
|
case 1:
|
|
|
|
if wireType != 0 {
|
|
|
|
return fmt.Errorf("proto: wrong wireType = %d for field ChunkSize", wireType)
|
|
|
|
}
|
|
|
|
m.ChunkSize = 0
|
|
|
|
for shift := uint(0); ; shift += 7 {
|
|
|
|
if shift >= 64 {
|
|
|
|
return ErrIntOverflowHdr
|
|
|
|
}
|
|
|
|
if iNdEx >= l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
b := dAtA[iNdEx]
|
|
|
|
iNdEx++
|
2021-06-12 18:15:59 -07:00
|
|
|
m.ChunkSize |= uint32(b&0x7F) << shift
|
2019-10-17 14:29:01 -07:00
|
|
|
if b < 0x80 {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case 2:
|
|
|
|
if wireType != 2 {
|
|
|
|
return fmt.Errorf("proto: wrong wireType = %d for field Salt", wireType)
|
|
|
|
}
|
|
|
|
var byteLen int
|
|
|
|
for shift := uint(0); ; shift += 7 {
|
|
|
|
if shift >= 64 {
|
|
|
|
return ErrIntOverflowHdr
|
|
|
|
}
|
|
|
|
if iNdEx >= l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
b := dAtA[iNdEx]
|
|
|
|
iNdEx++
|
2021-06-12 18:15:59 -07:00
|
|
|
byteLen |= int(b&0x7F) << shift
|
2019-10-17 14:29:01 -07:00
|
|
|
if b < 0x80 {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if byteLen < 0 {
|
|
|
|
return ErrInvalidLengthHdr
|
|
|
|
}
|
|
|
|
postIndex := iNdEx + byteLen
|
2021-06-12 18:15:59 -07:00
|
|
|
if postIndex < 0 {
|
|
|
|
return ErrInvalidLengthHdr
|
|
|
|
}
|
2019-10-17 14:29:01 -07:00
|
|
|
if postIndex > l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
m.Salt = append(m.Salt[:0], dAtA[iNdEx:postIndex]...)
|
|
|
|
if m.Salt == nil {
|
|
|
|
m.Salt = []byte{}
|
|
|
|
}
|
|
|
|
iNdEx = postIndex
|
|
|
|
case 3:
|
|
|
|
if wireType != 2 {
|
2020-03-20 17:40:52 -07:00
|
|
|
return fmt.Errorf("proto: wrong wireType = %d for field Pk", wireType)
|
|
|
|
}
|
|
|
|
var byteLen int
|
|
|
|
for shift := uint(0); ; shift += 7 {
|
|
|
|
if shift >= 64 {
|
|
|
|
return ErrIntOverflowHdr
|
|
|
|
}
|
|
|
|
if iNdEx >= l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
b := dAtA[iNdEx]
|
|
|
|
iNdEx++
|
2021-06-12 18:15:59 -07:00
|
|
|
byteLen |= int(b&0x7F) << shift
|
2020-03-20 17:40:52 -07:00
|
|
|
if b < 0x80 {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if byteLen < 0 {
|
|
|
|
return ErrInvalidLengthHdr
|
|
|
|
}
|
|
|
|
postIndex := iNdEx + byteLen
|
2021-06-12 18:15:59 -07:00
|
|
|
if postIndex < 0 {
|
|
|
|
return ErrInvalidLengthHdr
|
|
|
|
}
|
2020-03-20 17:40:52 -07:00
|
|
|
if postIndex > l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
m.Pk = append(m.Pk[:0], dAtA[iNdEx:postIndex]...)
|
|
|
|
if m.Pk == nil {
|
|
|
|
m.Pk = []byte{}
|
|
|
|
}
|
|
|
|
iNdEx = postIndex
|
|
|
|
case 4:
|
|
|
|
if wireType != 2 {
|
2022-11-13 11:53:00 -08:00
|
|
|
return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType)
|
2019-10-17 14:29:01 -07:00
|
|
|
}
|
2020-03-23 10:44:40 -07:00
|
|
|
var byteLen int
|
2019-10-17 14:29:01 -07:00
|
|
|
for shift := uint(0); ; shift += 7 {
|
|
|
|
if shift >= 64 {
|
|
|
|
return ErrIntOverflowHdr
|
|
|
|
}
|
|
|
|
if iNdEx >= l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
b := dAtA[iNdEx]
|
|
|
|
iNdEx++
|
2021-06-12 18:15:59 -07:00
|
|
|
byteLen |= int(b&0x7F) << shift
|
2019-10-17 14:29:01 -07:00
|
|
|
if b < 0x80 {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
2020-03-23 10:44:40 -07:00
|
|
|
if byteLen < 0 {
|
2019-10-17 14:29:01 -07:00
|
|
|
return ErrInvalidLengthHdr
|
|
|
|
}
|
2020-03-23 10:44:40 -07:00
|
|
|
postIndex := iNdEx + byteLen
|
2021-06-12 18:15:59 -07:00
|
|
|
if postIndex < 0 {
|
|
|
|
return ErrInvalidLengthHdr
|
|
|
|
}
|
2020-03-20 17:40:52 -07:00
|
|
|
if postIndex > l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
2022-11-13 11:53:00 -08:00
|
|
|
m.Sender = append(m.Sender[:0], dAtA[iNdEx:postIndex]...)
|
|
|
|
if m.Sender == nil {
|
|
|
|
m.Sender = []byte{}
|
2020-03-20 17:40:52 -07:00
|
|
|
}
|
|
|
|
iNdEx = postIndex
|
|
|
|
case 5:
|
|
|
|
if wireType != 2 {
|
|
|
|
return fmt.Errorf("proto: wrong wireType = %d for field Keys", wireType)
|
|
|
|
}
|
|
|
|
var msglen int
|
|
|
|
for shift := uint(0); ; shift += 7 {
|
|
|
|
if shift >= 64 {
|
|
|
|
return ErrIntOverflowHdr
|
|
|
|
}
|
|
|
|
if iNdEx >= l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
b := dAtA[iNdEx]
|
|
|
|
iNdEx++
|
2021-06-12 18:15:59 -07:00
|
|
|
msglen |= int(b&0x7F) << shift
|
2020-03-20 17:40:52 -07:00
|
|
|
if b < 0x80 {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if msglen < 0 {
|
2019-10-17 14:29:01 -07:00
|
|
|
return ErrInvalidLengthHdr
|
|
|
|
}
|
2020-03-20 17:40:52 -07:00
|
|
|
postIndex := iNdEx + msglen
|
2021-06-12 18:15:59 -07:00
|
|
|
if postIndex < 0 {
|
|
|
|
return ErrInvalidLengthHdr
|
|
|
|
}
|
2019-10-17 14:29:01 -07:00
|
|
|
if postIndex > l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
m.Keys = append(m.Keys, &WrappedKey{})
|
|
|
|
if err := m.Keys[len(m.Keys)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
iNdEx = postIndex
|
|
|
|
default:
|
|
|
|
iNdEx = preIndex
|
|
|
|
skippy, err := skipHdr(dAtA[iNdEx:])
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2021-06-12 18:15:59 -07:00
|
|
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
2019-10-17 14:29:01 -07:00
|
|
|
return ErrInvalidLengthHdr
|
|
|
|
}
|
|
|
|
if (iNdEx + skippy) > l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
iNdEx += skippy
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if iNdEx > l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
2020-03-20 17:40:52 -07:00
|
|
|
func (m *WrappedKey) Unmarshal(dAtA []byte) error {
|
|
|
|
l := len(dAtA)
|
|
|
|
iNdEx := 0
|
|
|
|
for iNdEx < l {
|
|
|
|
preIndex := iNdEx
|
|
|
|
var wire uint64
|
|
|
|
for shift := uint(0); ; shift += 7 {
|
|
|
|
if shift >= 64 {
|
|
|
|
return ErrIntOverflowHdr
|
|
|
|
}
|
|
|
|
if iNdEx >= l {
|
2019-10-17 14:29:01 -07:00
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
2020-03-20 17:40:52 -07:00
|
|
|
b := dAtA[iNdEx]
|
|
|
|
iNdEx++
|
2021-06-12 18:15:59 -07:00
|
|
|
wire |= uint64(b&0x7F) << shift
|
2020-03-20 17:40:52 -07:00
|
|
|
if b < 0x80 {
|
|
|
|
break
|
2019-10-17 14:29:01 -07:00
|
|
|
}
|
2020-03-20 17:40:52 -07:00
|
|
|
}
|
|
|
|
fieldNum := int32(wire >> 3)
|
|
|
|
wireType := int(wire & 0x7)
|
|
|
|
if wireType == 4 {
|
|
|
|
return fmt.Errorf("proto: wrapped_key: wiretype end group for non-group")
|
|
|
|
}
|
|
|
|
if fieldNum <= 0 {
|
|
|
|
return fmt.Errorf("proto: wrapped_key: illegal tag %d (wire type %d)", fieldNum, wire)
|
|
|
|
}
|
|
|
|
switch fieldNum {
|
2020-03-23 10:44:40 -07:00
|
|
|
case 1:
|
2019-10-17 14:29:01 -07:00
|
|
|
if wireType != 2 {
|
2020-03-23 10:44:40 -07:00
|
|
|
return fmt.Errorf("proto: wrong wireType = %d for field DKey", wireType)
|
2019-10-17 14:29:01 -07:00
|
|
|
}
|
|
|
|
var byteLen int
|
|
|
|
for shift := uint(0); ; shift += 7 {
|
|
|
|
if shift >= 64 {
|
|
|
|
return ErrIntOverflowHdr
|
|
|
|
}
|
|
|
|
if iNdEx >= l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
b := dAtA[iNdEx]
|
|
|
|
iNdEx++
|
2021-06-12 18:15:59 -07:00
|
|
|
byteLen |= int(b&0x7F) << shift
|
2019-10-17 14:29:01 -07:00
|
|
|
if b < 0x80 {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if byteLen < 0 {
|
|
|
|
return ErrInvalidLengthHdr
|
|
|
|
}
|
|
|
|
postIndex := iNdEx + byteLen
|
2021-06-12 18:15:59 -07:00
|
|
|
if postIndex < 0 {
|
|
|
|
return ErrInvalidLengthHdr
|
|
|
|
}
|
2019-10-17 14:29:01 -07:00
|
|
|
if postIndex > l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
2020-03-23 10:44:40 -07:00
|
|
|
m.DKey = append(m.DKey[:0], dAtA[iNdEx:postIndex]...)
|
|
|
|
if m.DKey == nil {
|
|
|
|
m.DKey = []byte{}
|
2019-10-17 14:29:01 -07:00
|
|
|
}
|
|
|
|
iNdEx = postIndex
|
2022-11-13 11:53:00 -08:00
|
|
|
case 2:
|
|
|
|
if wireType != 2 {
|
|
|
|
return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType)
|
|
|
|
}
|
|
|
|
var byteLen int
|
|
|
|
for shift := uint(0); ; shift += 7 {
|
|
|
|
if shift >= 64 {
|
|
|
|
return ErrIntOverflowHdr
|
|
|
|
}
|
|
|
|
if iNdEx >= l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
b := dAtA[iNdEx]
|
|
|
|
iNdEx++
|
|
|
|
byteLen |= int(b&0x7F) << shift
|
|
|
|
if b < 0x80 {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if byteLen < 0 {
|
|
|
|
return ErrInvalidLengthHdr
|
|
|
|
}
|
|
|
|
postIndex := iNdEx + byteLen
|
|
|
|
if postIndex < 0 {
|
|
|
|
return ErrInvalidLengthHdr
|
|
|
|
}
|
|
|
|
if postIndex > l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
m.Nonce = append(m.Nonce[:0], dAtA[iNdEx:postIndex]...)
|
|
|
|
if m.Nonce == nil {
|
|
|
|
m.Nonce = []byte{}
|
|
|
|
}
|
|
|
|
iNdEx = postIndex
|
2019-10-17 14:29:01 -07:00
|
|
|
default:
|
|
|
|
iNdEx = preIndex
|
|
|
|
skippy, err := skipHdr(dAtA[iNdEx:])
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2021-06-12 18:15:59 -07:00
|
|
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
2019-10-17 14:29:01 -07:00
|
|
|
return ErrInvalidLengthHdr
|
|
|
|
}
|
|
|
|
if (iNdEx + skippy) > l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
iNdEx += skippy
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if iNdEx > l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
func skipHdr(dAtA []byte) (n int, err error) {
|
|
|
|
l := len(dAtA)
|
|
|
|
iNdEx := 0
|
2021-06-12 18:15:59 -07:00
|
|
|
depth := 0
|
2019-10-17 14:29:01 -07:00
|
|
|
for iNdEx < l {
|
|
|
|
var wire uint64
|
|
|
|
for shift := uint(0); ; shift += 7 {
|
|
|
|
if shift >= 64 {
|
|
|
|
return 0, ErrIntOverflowHdr
|
|
|
|
}
|
|
|
|
if iNdEx >= l {
|
|
|
|
return 0, io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
b := dAtA[iNdEx]
|
|
|
|
iNdEx++
|
|
|
|
wire |= (uint64(b) & 0x7F) << shift
|
|
|
|
if b < 0x80 {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
wireType := int(wire & 0x7)
|
|
|
|
switch wireType {
|
|
|
|
case 0:
|
|
|
|
for shift := uint(0); ; shift += 7 {
|
|
|
|
if shift >= 64 {
|
|
|
|
return 0, ErrIntOverflowHdr
|
|
|
|
}
|
|
|
|
if iNdEx >= l {
|
|
|
|
return 0, io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
iNdEx++
|
|
|
|
if dAtA[iNdEx-1] < 0x80 {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case 1:
|
|
|
|
iNdEx += 8
|
|
|
|
case 2:
|
|
|
|
var length int
|
|
|
|
for shift := uint(0); ; shift += 7 {
|
|
|
|
if shift >= 64 {
|
|
|
|
return 0, ErrIntOverflowHdr
|
|
|
|
}
|
|
|
|
if iNdEx >= l {
|
|
|
|
return 0, io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
b := dAtA[iNdEx]
|
|
|
|
iNdEx++
|
|
|
|
length |= (int(b) & 0x7F) << shift
|
|
|
|
if b < 0x80 {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if length < 0 {
|
|
|
|
return 0, ErrInvalidLengthHdr
|
|
|
|
}
|
2021-06-12 18:15:59 -07:00
|
|
|
iNdEx += length
|
2019-10-17 14:29:01 -07:00
|
|
|
case 3:
|
2021-06-12 18:15:59 -07:00
|
|
|
depth++
|
2020-03-20 17:40:52 -07:00
|
|
|
case 4:
|
2021-06-12 18:15:59 -07:00
|
|
|
if depth == 0 {
|
|
|
|
return 0, ErrUnexpectedEndOfGroupHdr
|
|
|
|
}
|
|
|
|
depth--
|
2019-10-17 14:29:01 -07:00
|
|
|
case 5:
|
|
|
|
iNdEx += 4
|
|
|
|
default:
|
|
|
|
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
|
|
|
}
|
2021-06-12 18:15:59 -07:00
|
|
|
if iNdEx < 0 {
|
|
|
|
return 0, ErrInvalidLengthHdr
|
|
|
|
}
|
|
|
|
if depth == 0 {
|
|
|
|
return iNdEx, nil
|
|
|
|
}
|
2019-10-17 14:29:01 -07:00
|
|
|
}
|
2021-06-12 18:15:59 -07:00
|
|
|
return 0, io.ErrUnexpectedEOF
|
2019-10-17 14:29:01 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
var (
|
2021-06-12 18:15:59 -07:00
|
|
|
ErrInvalidLengthHdr = fmt.Errorf("proto: negative length found during unmarshaling")
|
|
|
|
ErrIntOverflowHdr = fmt.Errorf("proto: integer overflow")
|
|
|
|
ErrUnexpectedEndOfGroupHdr = fmt.Errorf("proto: unexpected end of group")
|
2019-10-17 14:29:01 -07:00
|
|
|
)
|