mirror of
https://github.com/minio/minio.git
synced 2025-11-07 21:02:58 -05:00
cleanup ignored static analysis (#16767)
This commit is contained in:
@@ -38,8 +38,8 @@ import (
|
||||
//
|
||||
// The same context must be provided when decrypting the
|
||||
// ciphertext.
|
||||
func EncryptBytes(KMS kms.KMS, plaintext []byte, context kms.Context) ([]byte, error) {
|
||||
ciphertext, err := Encrypt(KMS, bytes.NewReader(plaintext), context)
|
||||
func EncryptBytes(k kms.KMS, plaintext []byte, context kms.Context) ([]byte, error) {
|
||||
ciphertext, err := Encrypt(k, bytes.NewReader(plaintext), context)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -49,8 +49,8 @@ func EncryptBytes(KMS kms.KMS, plaintext []byte, context kms.Context) ([]byte, e
|
||||
// DecryptBytes decrypts the ciphertext using a key managed by the KMS.
|
||||
// The same context that have been used during encryption must be
|
||||
// provided.
|
||||
func DecryptBytes(KMS kms.KMS, ciphertext []byte, context kms.Context) ([]byte, error) {
|
||||
plaintext, err := Decrypt(KMS, bytes.NewReader(ciphertext), context)
|
||||
func DecryptBytes(k kms.KMS, ciphertext []byte, context kms.Context) ([]byte, error) {
|
||||
plaintext, err := Decrypt(k, bytes.NewReader(ciphertext), context)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -62,13 +62,13 @@ func DecryptBytes(KMS kms.KMS, ciphertext []byte, context kms.Context) ([]byte,
|
||||
//
|
||||
// The same context must be provided when decrypting the
|
||||
// ciphertext.
|
||||
func Encrypt(KMS kms.KMS, plaintext io.Reader, ctx kms.Context) (io.Reader, error) {
|
||||
func Encrypt(k kms.KMS, plaintext io.Reader, ctx kms.Context) (io.Reader, error) {
|
||||
algorithm := sio.AES_256_GCM
|
||||
if !fips.Enabled && !sioutil.NativeAES() {
|
||||
algorithm = sio.ChaCha20Poly1305
|
||||
}
|
||||
|
||||
key, err := KMS.GenerateKey(context.Background(), "", ctx)
|
||||
key, err := k.GenerateKey(context.Background(), "", ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -116,7 +116,7 @@ func Encrypt(KMS kms.KMS, plaintext io.Reader, ctx kms.Context) (io.Reader, erro
|
||||
// Decrypt decrypts the ciphertext using a key managed by the KMS.
|
||||
// The same context that have been used during encryption must be
|
||||
// provided.
|
||||
func Decrypt(KMS kms.KMS, ciphertext io.Reader, context kms.Context) (io.Reader, error) {
|
||||
func Decrypt(k kms.KMS, ciphertext io.Reader, context kms.Context) (io.Reader, error) {
|
||||
const (
|
||||
MaxMetadataSize = 1 << 20 // max. size of the metadata
|
||||
Version = 1
|
||||
@@ -149,7 +149,7 @@ func Decrypt(KMS kms.KMS, ciphertext io.Reader, context kms.Context) (io.Reader,
|
||||
return nil, fmt.Errorf("config: unsupported encryption algorithm: %q is not supported in FIPS mode", metadata.Algorithm)
|
||||
}
|
||||
|
||||
key, err := KMS.DecryptKey(metadata.KeyID, metadata.KMSKey, context)
|
||||
key, err := k.DecryptKey(metadata.KeyID, metadata.KMSKey, context)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user