(buf []byte, blockSize int)
| 175 | } |
| 176 | |
| 177 | func appendPadding(buf []byte, blockSize int) []byte { |
| 178 | paddingBytes := blockSize - (len(buf) % blockSize) |
| 179 | padding := make([]byte, paddingBytes) |
| 180 | padding[len(padding)-1] = byte(paddingBytes) //nolint:gosec // paddingBytes <= blockSize, which is at most 16 for AES |
| 181 | return append(buf, padding...) |
| 182 | } |
| 183 | |
| 184 | // ErrDecryptionFailed is returned for a ciphertext whose decrypted bytes |
| 185 | // are not valid: in CBC mode, when the padding is not. It carries no detail, |
no outgoing calls