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

fix several semgrep lint errors #207

Merged
merged 1 commit into from
Jun 21, 2024
Merged
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
5 changes: 1 addition & 4 deletions openpgp/packet/aead_crypter.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,7 @@ func (ar *aeadDecrypter) validateFinalTag(tag []byte) error {
adata = append(adata, amountBytes...)
nonce := ar.computeNextNonce()
_, err := ar.aead.Open(nil, nonce, tag, adata)
if err != nil {
return err
}
return nil
return err
}

// aeadEncrypter encrypts and writes bytes. It encrypts when necessary according
Expand Down
3 changes: 1 addition & 2 deletions openpgp/packet/compressed.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"compress/flate"
"compress/zlib"
"io"
"io/ioutil"
"strconv"

"github.com/ProtonMail/go-crypto/openpgp/errors"
Expand Down Expand Up @@ -91,7 +90,7 @@ func (c *Compressed) parse(r io.Reader) error {
}
c.Body = newDecompressionReader(r, decompressor)
case 3:
c.Body = newDecompressionReader(r, ioutil.NopCloser(bzip2.NewReader(r)))
c.Body = newDecompressionReader(r, io.NopCloser(bzip2.NewReader(r)))
default:
err = errors.UnsupportedError("unknown compression algorithm: " + strconv.Itoa(int(buf[0])))
}
Expand Down
3 changes: 1 addition & 2 deletions openpgp/packet/padding.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package packet

import (
"io"
"io/ioutil"
)

// Padding type represents a Padding Packet (Tag 21).
Expand All @@ -12,7 +11,7 @@ type Padding int

// parse just ignores the padding content.
func (pad Padding) parse(reader io.Reader) error {
_, err := io.CopyN(ioutil.Discard, reader, int64(pad))
_, err := io.CopyN(io.Discard, reader, int64(pad))
return err
}

Expand Down
5 changes: 1 addition & 4 deletions openpgp/packet/public_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -590,10 +590,7 @@ func (pk *PublicKey) SerializeSignaturePrefix(w io.Writer) error {
byte(pLength >> 8),
byte(pLength),
})
if err != nil {
return err
}
return nil
return err
}
if _, err := w.Write([]byte{0x99, byte(pLength >> 8), byte(pLength)}); err != nil {
return err
Expand Down
3 changes: 0 additions & 3 deletions openpgp/packet/symmetrically_encrypted_mdc.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,6 @@ func serializeSymmetricallyEncryptedMdc(ciphertext io.WriteCloser, c CipherFunct
if err != nil {
return nil, err
}
if err != nil {
return
}
s, prefix := NewOCFBEncrypter(block, iv, OCFBNoResync)
_, err = ciphertext.Write(prefix)
if err != nil {
Expand Down
Loading