refactor: use a more straightforward return value

Signed-off-by: fuyangpengqi <995764973@qq.com>
This commit is contained in:
fuyangpengqi 2025-02-18 13:56:25 +08:00
parent 68d477670c
commit ae956727b7

View file

@ -110,7 +110,7 @@ func aesCTRXOR(key, inText, iv []byte) ([]byte, error) {
stream := cipher.NewCTR(aesBlock, iv) stream := cipher.NewCTR(aesBlock, iv)
outText := make([]byte, len(inText)) outText := make([]byte, len(inText))
stream.XORKeyStream(outText, inText) stream.XORKeyStream(outText, inText)
return outText, err return outText, nil
} }
func aesCBCDecrypt(key, cipherText, iv []byte) ([]byte, error) { func aesCBCDecrypt(key, cipherText, iv []byte) ([]byte, error) {
@ -125,7 +125,7 @@ func aesCBCDecrypt(key, cipherText, iv []byte) ([]byte, error) {
if plaintext == nil { if plaintext == nil {
return nil, ErrDecrypt return nil, ErrDecrypt
} }
return plaintext, err return plaintext, nil
} }
// From https://leanpub.com/gocrypto/read#leanpub-auto-block-cipher-modes // From https://leanpub.com/gocrypto/read#leanpub-auto-block-cipher-modes