Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openpgp/packet: fix dropped test errors #186

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
15 changes: 15 additions & 0 deletions openpgp/packet/aead_encrypted_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ func TestAeadEmptyStream(t *testing.T) {
}
// decrypted plaintext can be read from 'rc'
rc, err := packet.decrypt(key)
if err != nil {
t.Errorf("Error decrypting packet: %s", err)
}

_, err = readDecryptedStream(rc)
if err != nil {
Expand All @@ -97,6 +100,9 @@ func TestAeadEmptyStream(t *testing.T) {
}
// decrypted plaintext can be read from 'rc'
rc, err = packet.decrypt(key)
if err != nil {
t.Errorf("Error decrypting packet: %s", err)
}

_, err = readDecryptedStream(rc)
if err == nil {
Expand Down Expand Up @@ -127,6 +133,9 @@ func TestAeadNilConfigStream(t *testing.T) {
}
// decrypted plaintext can be read from 'rc'
rc, err := packet.decrypt(key)
if err != nil {
t.Errorf("Error decrypting packet: %s", err)
}

got, err := readDecryptedStream(rc)
if err != nil {
Expand Down Expand Up @@ -161,6 +170,9 @@ func TestAeadStreamRandomizeSlow(t *testing.T) {
}
// decrypted plaintext can be read from 'rc'
rc, err := packet.decrypt(key)
if err != nil {
t.Errorf("Error decrypting packet: %s", err)
}

got, err := readDecryptedStream(rc)
if err != nil {
Expand Down Expand Up @@ -206,6 +218,9 @@ func TestAeadCorruptStreamRandomizeSlow(t *testing.T) {
return
}
rc, err := packet.decrypt(key)
if err != nil {
t.Errorf("Error decrypting packet: %s", err)
}
got, err := readDecryptedStream(rc)
if err == nil || err == io.EOF {
t.Errorf("No error raised when decrypting corrupt stream")
Expand Down
3 changes: 3 additions & 0 deletions openpgp/packet/compressed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ func TestCompressDecompressRandomizeFast(t *testing.T) {
wcomp.Close()
// Read the packet and decompress
p, err := Read(w)
if err != nil {
t.Fatal(err)
}
c, ok := p.(*Compressed)
if !ok {
t.Error("didn't find Compressed packet")
Expand Down
5 changes: 4 additions & 1 deletion openpgp/packet/symmetric_key_encrypted_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ func TestSerializeSymmetricKeyEncryptedV5RandomizeSlow(t *testing.T) {
}

key, err := SerializeSymmetricKeyEncrypted(&buf, passphrase, config)
if err != nil {
t.Errorf("failed to serialize encrypted symmetric key: %s", err)
}
p, err := Read(&buf)
if err != nil {
t.Errorf("failed to reparse %s", err)
Expand Down Expand Up @@ -151,7 +154,7 @@ func TestSerializeSymmetricKeyEncryptedCiphersV4(t *testing.T) {
config := &Config{
DefaultCipher: cipher,
S2KConfig: &s2k.Config{
S2KMode: s2ktype,
S2KMode: s2ktype,
PassphraseIsHighEntropy: true,
},
}
Expand Down