sigtool/internal/pb/hdr.pb.go

844 lines
19 KiB
Go
Raw Normal View History

2021-06-12 18:15:59 -07:00
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// 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"
)
// 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
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.
type Header struct {
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"`
SenderSign []byte `protobuf:"bytes,4,opt,name=sender_sign,json=senderSign,proto3" json:"sender_sign,omitempty"`
2021-06-12 18:15:59 -07:00
Keys []*WrappedKey `protobuf:"bytes,5,rep,name=keys,proto3" json:"keys,omitempty"`
}
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)
}
2021-06-12 18:15:59 -07:00
var xxx_messageInfo_Header proto.InternalMessageInfo
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
}
func (m *Header) GetPk() []byte {
if m != nil {
return m.Pk
}
return nil
}
func (m *Header) GetSenderSign() []byte {
if m != nil {
return m.SenderSign
}
return nil
}
func (m *Header) GetKeys() []*WrappedKey {
if m != nil {
return m.Keys
}
return nil
}
//
// A file encryption key is wrapped by a recipient specific public
// key. WrappedKey describes such a wrapped key.
type WrappedKey struct {
DKey []byte `protobuf:"bytes,1,opt,name=d_key,json=dKey,proto3" json:"d_key,omitempty"`
}
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
func (m *WrappedKey) GetDKey() []byte {
if m != nil {
return m.DKey
}
return nil
}
func init() {
proto.RegisterType((*Header)(nil), "pb.header")
proto.RegisterType((*WrappedKey)(nil), "pb.wrapped_key")
}
2021-06-12 18:15:59 -07:00
func init() { proto.RegisterFile("internal/pb/hdr.proto", fileDescriptor_c715362029a696e2) }
var fileDescriptor_c715362029a696e2 = []byte{
// 257 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0xcf, 0x31, 0x4e, 0xeb, 0x40,
0x10, 0xc6, 0xf1, 0x1d, 0xc7, 0x89, 0xf4, 0x26, 0x79, 0x20, 0x2d, 0x42, 0x72, 0xc3, 0x60, 0x99,
0xc6, 0x95, 0x23, 0x01, 0x27, 0xa0, 0xa5, 0x73, 0x0e, 0x60, 0xd9, 0x78, 0x14, 0x5b, 0x8e, 0x36,
0xab, 0xb5, 0x11, 0x72, 0x2a, 0x8e, 0x00, 0xb7, 0xe0, 0x28, 0x94, 0x2e, 0x53, 0xe2, 0x75, 0x43,
0x99, 0x23, 0x20, 0x2d, 0x0d, 0xdd, 0xa7, 0xdf, 0xbf, 0x99, 0xc1, 0xcb, 0x5a, 0x75, 0x6c, 0x54,
0xbe, 0x5b, 0xeb, 0x62, 0x5d, 0x95, 0x26, 0xd1, 0x66, 0xdf, 0xed, 0xa5, 0xa7, 0x8b, 0xe8, 0x1d,
0x70, 0x51, 0x71, 0x5e, 0xb2, 0x91, 0x57, 0x88, 0x4f, 0xd5, 0xb3, 0x6a, 0xb2, 0xb6, 0x3e, 0x70,
0x00, 0x21, 0xc4, 0xff, 0xd3, 0x7f, 0x4e, 0x36, 0xf5, 0x81, 0xa5, 0x44, 0xbf, 0xcd, 0x77, 0x5d,
0xe0, 0x85, 0x10, 0xaf, 0x52, 0xb7, 0xe5, 0x19, 0x7a, 0xba, 0x09, 0x66, 0x4e, 0x3c, 0xdd, 0xc8,
0x6b, 0x5c, 0xb6, 0xac, 0x4a, 0x36, 0x59, 0x5b, 0x6f, 0x55, 0xe0, 0xbb, 0x80, 0xbf, 0xb4, 0xa9,
0xb7, 0x4a, 0xde, 0xa0, 0xdf, 0x70, 0xdf, 0x06, 0xf3, 0x70, 0x16, 0x2f, 0x6f, 0xcf, 0x13, 0x5d,
0x24, 0x2f, 0x26, 0xd7, 0x9a, 0xcb, 0xac, 0xe1, 0x3e, 0x75, 0x31, 0x8a, 0x70, 0xf9, 0x07, 0xe5,
0x05, 0xce, 0xdd, 0x70, 0x27, 0xad, 0x52, 0xbf, 0x7c, 0xe4, 0xfe, 0xe1, 0x7e, 0x18, 0x49, 0x1c,
0x47, 0x12, 0xa7, 0x91, 0xe0, 0xd5, 0x12, 0x7c, 0x58, 0x82, 0x4f, 0x4b, 0x30, 0x58, 0x82, 0x2f,
0x4b, 0xf0, 0x6d, 0x49, 0x9c, 0x2c, 0xc1, 0xdb, 0x44, 0x62, 0x98, 0x48, 0x1c, 0x27, 0x12, 0xc5,
0xc2, 0x3d, 0x7e, 0xf7, 0x13, 0x00, 0x00, 0xff, 0xff, 0xb5, 0x7a, 0x39, 0x5a, 0x11, 0x01, 0x00,
0x00,
}
func (this *Header) Equal(that interface{}) bool {
if that == nil {
2021-06-12 18:15:59 -07:00
return this == nil
}
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
} else if this == nil {
return false
}
if this.ChunkSize != that1.ChunkSize {
return false
}
if !bytes.Equal(this.Salt, that1.Salt) {
return false
}
if !bytes.Equal(this.Pk, that1.Pk) {
return false
}
if !bytes.Equal(this.SenderSign, that1.SenderSign) {
return false
}
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
}
func (this *WrappedKey) Equal(that interface{}) bool {
if that == nil {
2021-06-12 18:15:59 -07:00
return this == nil
}
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
} else if this == nil {
return false
}
if !bytes.Equal(this.DKey, that1.DKey) {
return false
}
return true
}
func (this *Header) GoString() string {
if this == nil {
return "nil"
}
s := make([]string, 0, 9)
s = append(s, "&pb.Header{")
s = append(s, "ChunkSize: "+fmt.Sprintf("%#v", this.ChunkSize)+",\n")
s = append(s, "Salt: "+fmt.Sprintf("%#v", this.Salt)+",\n")
s = append(s, "Pk: "+fmt.Sprintf("%#v", this.Pk)+",\n")
s = append(s, "SenderSign: "+fmt.Sprintf("%#v", this.SenderSign)+",\n")
if this.Keys != nil {
s = append(s, "Keys: "+fmt.Sprintf("%#v", this.Keys)+",\n")
}
s = append(s, "}")
return strings.Join(s, "")
}
func (this *WrappedKey) GoString() string {
if this == nil {
return "nil"
}
s := make([]string, 0, 5)
s = append(s, "&pb.WrappedKey{")
s = append(s, "DKey: "+fmt.Sprintf("%#v", this.DKey)+",\n")
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])
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)
_ = 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
}
}
2021-06-12 18:15:59 -07:00
if len(m.SenderSign) > 0 {
i -= len(m.SenderSign)
copy(dAtA[i:], m.SenderSign)
i = encodeVarintHdr(dAtA, i, uint64(len(m.SenderSign)))
i--
dAtA[i] = 0x22
}
if len(m.Pk) > 0 {
2021-06-12 18:15:59 -07:00
i -= len(m.Pk)
copy(dAtA[i:], m.Pk)
i = encodeVarintHdr(dAtA, i, uint64(len(m.Pk)))
2021-06-12 18:15:59 -07:00
i--
dAtA[i] = 0x1a
}
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
}
2021-06-12 18:15:59 -07:00
if m.ChunkSize != 0 {
i = encodeVarintHdr(dAtA, i, uint64(m.ChunkSize))
i--
dAtA[i] = 0x8
}
2021-06-12 18:15:59 -07:00
return len(dAtA) - i, nil
}
func (m *WrappedKey) 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])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
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)
_ = i
var l int
_ = l
if len(m.DKey) > 0 {
2021-06-12 18:15:59 -07:00
i -= len(m.DKey)
copy(dAtA[i:], m.DKey)
i = encodeVarintHdr(dAtA, i, uint64(len(m.DKey)))
2021-06-12 18:15:59 -07:00
i--
dAtA[i] = 0xa
}
2021-06-12 18:15:59 -07:00
return len(dAtA) - i, nil
}
func encodeVarintHdr(dAtA []byte, offset int, v uint64) int {
2021-06-12 18:15:59 -07:00
offset -= sovHdr(v)
base := offset
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
}
func (m *Header) Size() (n int) {
2021-06-12 18:15:59 -07:00
if m == nil {
return 0
}
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))
}
l = len(m.Pk)
if l > 0 {
n += 1 + l + sovHdr(uint64(l))
}
l = len(m.SenderSign)
if l > 0 {
n += 1 + l + sovHdr(uint64(l))
}
if len(m.Keys) > 0 {
for _, e := range m.Keys {
l = e.Size()
n += 1 + l + sovHdr(uint64(l))
}
}
return n
}
func (m *WrappedKey) Size() (n int) {
2021-06-12 18:15:59 -07:00
if m == nil {
return 0
}
var l int
_ = l
l = len(m.DKey)
if l > 0 {
n += 1 + l + sovHdr(uint64(l))
}
return n
}
func sovHdr(x uint64) (n int) {
2021-06-12 18:15:59 -07:00
return (math_bits.Len64(x|1) + 6) / 7
}
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 += "}"
s := strings.Join([]string{`&Header{`,
`ChunkSize:` + fmt.Sprintf("%v", this.ChunkSize) + `,`,
`Salt:` + fmt.Sprintf("%v", this.Salt) + `,`,
`Pk:` + fmt.Sprintf("%v", this.Pk) + `,`,
`SenderSign:` + fmt.Sprintf("%v", this.SenderSign) + `,`,
2021-06-12 18:15:59 -07:00
`Keys:` + repeatedStringForKeys + `,`,
`}`,
}, "")
return s
}
func (this *WrappedKey) String() string {
if this == nil {
return "nil"
}
s := strings.Join([]string{`&WrappedKey{`,
`DKey:` + fmt.Sprintf("%v", this.DKey) + `,`,
`}`,
}, "")
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
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
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
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
}
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 {
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
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
}
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 {
return fmt.Errorf("proto: wrong wireType = %d for field SenderSign", 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
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
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.SenderSign = append(m.SenderSign[:0], dAtA[iNdEx:postIndex]...)
if m.SenderSign == nil {
m.SenderSign = []byte{}
}
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
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthHdr
}
postIndex := iNdEx + msglen
2021-06-12 18:15:59 -07:00
if postIndex < 0 {
return ErrInvalidLengthHdr
}
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 {
return ErrInvalidLengthHdr
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
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 {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
2021-06-12 18:15:59 -07:00
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
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 {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field DKey", 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
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
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.DKey = append(m.DKey[:0], dAtA[iNdEx:postIndex]...)
if m.DKey == nil {
m.DKey = []byte{}
}
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 {
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
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
case 3:
2021-06-12 18:15:59 -07:00
depth++
case 4:
2021-06-12 18:15:59 -07:00
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupHdr
}
depth--
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
}
}
2021-06-12 18:15:59 -07:00
return 0, io.ErrUnexpectedEOF
}
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")
)