Skip to content

Commit

Permalink
Linter fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pontus committed Mar 7, 2024
1 parent fbe47ec commit b691fc6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
3 changes: 3 additions & 0 deletions model/headers/headers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,9 @@ func TestReEncryptedHeaderReplacementAndAddition(t *testing.T) {
// Test DEL copying when reencryption, i.e. when the DEL is not replaced. Encrypt back for the original recipient

newRecipientSecretKey, err := keys.ReadPrivateKey(strings.NewReader(newRecipientSec), []byte("password"))
if err != nil {
t.Errorf("Failed creating new recipient secret key: %v", err)
}

newerReaderPublicKey, err := keys.ReadPublicKey(strings.NewReader(crypt4ghX25519Pub))
if err != nil {
Expand Down
11 changes: 9 additions & 2 deletions streaming/streaming_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1422,7 +1422,7 @@ func TestReEncryptedHeaderReplacementAndAdditionFileRead(t *testing.T) {
newReaderPublicKeyList = append(newReaderPublicKeyList, newReaderPublicKey)

// create a new data edit list, pass over a segment boundary for sports
del := headers.DataEditListHeaderPacket{PacketType: headers.PacketType{headers.DataEditList}, NumberLengths: 2, Lengths: []uint64{65500, 100}}
del := headers.DataEditListHeaderPacket{PacketType: headers.PacketType{PacketType: headers.DataEditList}, NumberLengths: 2, Lengths: []uint64{65500, 100}}

newHeader, err := headers.ReEncryptHeader(oldHeader, readerSecretKey, newReaderPublicKeyList, del)
if err != nil {
Expand All @@ -1445,6 +1445,9 @@ func TestReEncryptedHeaderReplacementAndAdditionFileRead(t *testing.T) {

newFile := io.MultiReader(buffer, inFile)
c4ghReader, err := NewCrypt4GHReader(newFile, newReaderSecretKey, nil)
if err != nil {
t.Errorf("Opening of reencrypted stream failed: %v", err)
}

readBackWithDel := make([]byte, 100000)
delRead, err := c4ghReader.Read(readBackWithDel)
Expand All @@ -1463,7 +1466,11 @@ func TestReEncryptedHeaderReplacementAndAdditionFileRead(t *testing.T) {
t.Errorf("Opening of unencrypted source file failed: %v", err)
}

sourceFile.Seek(65500, 0)
pos, err := sourceFile.Seek(65500, 0)
if err != nil || pos != 65500 {
t.Errorf("Seeking in unencrypted source file failed (%v) or returned wrong position (%d vs 65500)", err, pos)
}

sourceBytes := make([]byte, 400)
sourceRead, err := sourceFile.Read(sourceBytes)
if err != nil || sourceRead != 400 {
Expand Down

0 comments on commit b691fc6

Please sign in to comment.