Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Thomas Fossati <tho.ietf@gmail.com>
  • Loading branch information
qmuntal and thomas-fossati authored Jun 23, 2022
1 parent 75ae2ed commit 835e89e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions headers.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func (h UnprotectedHeader) MarshalCBOR() ([]byte, error) {
return nil, err
}
if err := ensureNoCritical(h); err != nil {
return nil, err
return nil, fmt.Errorf("unprotected header: %w", err)
}
if err := ensureHeaderIV(h); err != nil {
return nil, fmt.Errorf("unprotected header: %w", err)
Expand Down Expand Up @@ -215,7 +215,7 @@ func (h *UnprotectedHeader) UnmarshalCBOR(data []byte) error {
return err
}
if err := ensureNoCritical(header); err != nil {
return err
return fmt.Errorf("unprotected header: %w")
}
if err := ensureHeaderIV(header); err != nil {
return fmt.Errorf("unprotected header: %w", err)
Expand Down Expand Up @@ -412,7 +412,7 @@ func ensureHeaderIV(h map[interface{}]interface{}) error {
// Reference: https://datatracker.ietf.org/doc/html/rfc8152#section-3.1
func ensureNoCritical(h map[interface{}]interface{}) error {
if hasLabel(h, HeaderLabelCritical) {
return errors.New("unprotected header: crit parameter must be places in the protected header")
return errors.New("unexpected crit parameter found")
}
return nil
}
Expand Down

0 comments on commit 835e89e

Please sign in to comment.