Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions coev/cbor.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ func coevTags() cbor.TagSet {
func initCBOREncMode() (en cbor.EncMode, err error) {
encOpt := cbor.EncOptions{
Sort: cbor.SortCoreDeterministic,
IndefLength: cbor.IndefLengthForbidden,
IndefLength: cbor.IndefLengthAllowed,
TimeTag: cbor.EncTagRequired,
}
return encOpt.EncModeWithTags(coevTags())
}

func initCBORDecMode() (dm cbor.DecMode, err error) {
decOpt := cbor.DecOptions{
IndefLength: cbor.IndefLengthForbidden,
IndefLength: cbor.IndefLengthAllowed,
}
return decOpt.DecModeWithTags(coevTags())
}
Expand Down
4 changes: 2 additions & 2 deletions comid/cbor.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ func comidTags() cbor.TagSet {
func initCBOREncMode() (en cbor.EncMode, err error) {
encOpt := cbor.EncOptions{
Sort: cbor.SortCoreDeterministic,
IndefLength: cbor.IndefLengthForbidden,
IndefLength: cbor.IndefLengthAllowed,
TimeTag: cbor.EncTagRequired,
}
return encOpt.EncModeWithTags(comidTags())
}

func initCBORDecMode() (dm cbor.DecMode, err error) {
decOpt := cbor.DecOptions{
IndefLength: cbor.IndefLengthForbidden,
IndefLength: cbor.IndefLengthAllowed,
}
return decOpt.DecModeWithTags(comidTags())
}
Expand Down
4 changes: 2 additions & 2 deletions comid/tdx/cbor.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ func tdxTags() cbor.TagSet {
func initCBOREncMode() (en cbor.EncMode, err error) {
encOpt := cbor.EncOptions{
Sort: cbor.SortCoreDeterministic,
IndefLength: cbor.IndefLengthForbidden,
IndefLength: cbor.IndefLengthAllowed,
TimeTag: cbor.EncTagRequired,
}
return encOpt.EncModeWithTags(tdxTags())
}

func initCBORDecMode() (dm cbor.DecMode, err error) {
decOpt := cbor.DecOptions{
IndefLength: cbor.IndefLengthForbidden,
IndefLength: cbor.IndefLengthAllowed,
}
return decOpt.DecModeWithTags(tdxTags())
}
Expand Down
4 changes: 2 additions & 2 deletions corim/cbor.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ func corimTags() cbor.TagSet {

func initCBOREncMode() (en cbor.EncMode, err error) {
encOpt := cbor.EncOptions{
IndefLength: cbor.IndefLengthForbidden,
IndefLength: cbor.IndefLengthAllowed,
TimeTag: cbor.EncTagRequired,
}
return encOpt.EncModeWithTags(corimTags())
}

func initCBORDecMode() (dm cbor.DecMode, err error) {
decOpt := cbor.DecOptions{
IndefLength: cbor.IndefLengthForbidden,
IndefLength: cbor.IndefLengthAllowed,
TimeTag: cbor.DecTagRequired,
}
return decOpt.DecModeWithTags(corimTags())
Expand Down
7 changes: 7 additions & 0 deletions coserv/quads.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ type RefValQuad struct {
RVTriple *comid.ValueTriple `cbor:"2,keyasint"`
}

// EndorsedValQuad represents an endorsed-values result quad as per CoSERV
// It mirrors RefValQuad but carries endorsed values instead of reference values
type EndorsedValQuad struct {
Authorities *[]comid.CryptoKey `cbor:"1,keyasint"`
EVTriple *comid.ValueTriple `cbor:"2,keyasint"`
}

type AKQuad struct {
Authorities *[]comid.CryptoKey `cbor:"1,keyasint"`
AKTriple *comid.KeyTriple `cbor:"2,keyasint"`
Expand Down
18 changes: 15 additions & 3 deletions coserv/resultset.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (
)

type ResultSet struct {
RVQ *[]RefValQuad `cbor:"0,keyasint,omitempty"`
AKQ *[]AKQuad `cbor:"3,keyasint,omitempty"`
// TODO(tho) add endorsed values
RVQ *[]RefValQuad `cbor:"0,keyasint,omitempty"`
EVQ *[]EndorsedValQuad `cbor:"1,keyasint,omitempty"`
AKQ *[]AKQuad `cbor:"3,keyasint,omitempty"`
// TODO(tho) add CoTS
Expiry *time.Time `cbor:"10,keyasint"`
SourceArtifacts *[]cmw.CMW `cbor:"11,keyasint,omitempty"`
Expand All @@ -35,6 +35,17 @@ func (o *ResultSet) AddReferenceValues(v RefValQuad) *ResultSet {
return o
}

// AddEndorsedValues adds the supplied endorsed-values quad to the target ResultSet
func (o *ResultSet) AddEndorsedValues(v EndorsedValQuad) *ResultSet {
if o.EVQ == nil {
o.EVQ = new([]EndorsedValQuad)
}

*o.EVQ = append(*o.EVQ, v)

return o
}

// AddAttestationKeys adds the supplied ak quad to the target ResultSet
func (o *ResultSet) AddAttestationKeys(v AKQuad) *ResultSet {
if o.AKQ == nil {
Expand Down Expand Up @@ -68,6 +79,7 @@ func (o ResultSet) Valid() error {
if o.Expiry == nil {
return errors.New("missing mandatory expiry")
}
// Nothing else to validate structurally here; combinations are checked at Coserv level
// The coherency between query and results must be checked by the Coserv's
// Valid()
return nil
Expand Down
4 changes: 2 additions & 2 deletions cots/cbor.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ func cotsTags() cbor.TagSet {

func initCBOREncMode() (en cbor.EncMode, err error) {
encOpt := cbor.EncOptions{
IndefLength: cbor.IndefLengthForbidden,
IndefLength: cbor.IndefLengthAllowed,
TimeTag: cbor.EncTagRequired,
}
return encOpt.EncModeWithTags(cotsTags())
}

func initCBORDecMode() (dm cbor.DecMode, err error) {
decOpt := cbor.DecOptions{
IndefLength: cbor.IndefLengthForbidden,
IndefLength: cbor.IndefLengthAllowed,
TimeTag: cbor.DecTagRequired,
}
return decOpt.DecModeWithTags(cotsTags())
Expand Down
4 changes: 2 additions & 2 deletions extensions/cbor.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ var (
func initCBOREncMode() (en cbor.EncMode, err error) {
encOpt := cbor.EncOptions{
Sort: cbor.SortCoreDeterministic,
IndefLength: cbor.IndefLengthForbidden,
IndefLength: cbor.IndefLengthAllowed,
TimeTag: cbor.EncTagRequired,
}
return encOpt.EncMode()
}

func initCBORDecMode() (dm cbor.DecMode, err error) {
decOpt := cbor.DecOptions{
IndefLength: cbor.IndefLengthForbidden,
IndefLength: cbor.IndefLengthAllowed,
}
return decOpt.DecMode()
}
Expand Down