Skip to content

Commit

Permalink
Fix intermittent failures in headers tests (#145)
Browse files Browse the repository at this point in the history
Signed-off-by: setrofim <setrofim@gmail.com>
  • Loading branch information
setrofim authored May 18, 2023
1 parent 3b32cdb commit 38be1cb
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions headers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,12 +319,19 @@ func TestProtectedHeader_UnmarshalCBOR(t *testing.T) {
wantErr: "cbor: require bstr type",
},
{
name: "iv and partial iv present",
name: "iv must be bstr",
data: []byte{
0x4b, 0xa2, 0x5, 0x63, 0x66, 0x6f, 0x6f, 0x6, 0x63, 0x62, 0x61, 0x72,
0x46, 0xa1, 0x5, 0x63, 0x66, 0x6f, 0x6f,
},
wantErr: "protected header: header parameter: IV: require bstr type",
},
{
name: "partial iv must be bstr",
data: []byte{
0x46, 0xa1, 0x6, 0x63, 0x62, 0x61, 0x72,
},
wantErr: "protected header: header parameter: Partial IV: require bstr type",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down Expand Up @@ -703,12 +710,19 @@ func TestUnprotectedHeader_UnmarshalCBOR(t *testing.T) {
wantErr: "cbor: header label: int key must not be higher than 1<<63 - 1",
},
{
name: "iv and partial iv present",
name: "iv must be bstr",
data: []byte{
0xa2, 0x5, 0x63, 0x66, 0x6f, 0x6f, 0x6, 0x63, 0x62, 0x61, 0x72,
0xa1, 0x5, 0x63, 0x66, 0x6f, 0x6f,
},
wantErr: "unprotected header: header parameter: IV: require bstr type",
},
{
name: "partial iv must be bstr",
data: []byte{
0xa1, 0x6, 0x63, 0x62, 0x61, 0x72,
},
wantErr: "unprotected header: header parameter: Partial IV: require bstr type",
},
{
name: "critical present",
data: []byte{
Expand Down

0 comments on commit 38be1cb

Please sign in to comment.