Skip to content

Commit

Permalink
fix several semgrep lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitris committed Jun 5, 2024
1 parent f4e1152 commit 47fca30
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 15 deletions.
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

0 comments on commit 47fca30

Please sign in to comment.