]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: The error reported in the "rgw_s3_prepare_decrypt" function is unreasonable
authorwangyingbin <ybwang0211@163.com>
Tue, 31 May 2022 08:21:37 +0000 (16:21 +0800)
committerwangyingbin <ybwang0211@163.com>
Fri, 17 Jun 2022 06:37:46 +0000 (14:37 +0800)
When decrypting the data encrypted with the "SSE-KMS" method, the "InvalidAccessKeyId" error is reported when the KMS key is unavailable, which is unreasonable.So we replaced it with EINVAL

Fixes: https://tracker.ceph.com/issues/55799
Signed-off-by: wangyingbin <ybwang0211@163.com>
src/rgw/rgw_crypt.cc
src/rgw/rgw_kms.cc

index 515a5ba78c0e0b0cba1ab9f6c971442da3411777..a740431fb8dc70ff09216b793736c1dc9ce751f4 100644 (file)
@@ -1387,7 +1387,7 @@ int rgw_s3_prepare_decrypt(struct req_state* s,
       ldpp_dout(s, 0) << "ERROR: key obtained from key_id:" <<
           key_id << " is not 256 bit size" << dendl;
       s->err.message = "KMS provided an invalid key for the given kms-keyid.";
-      return -ERR_INVALID_ACCESS_KEY;
+      return -EINVAL;
     }
 
     auto aes = std::unique_ptr<AES_256_CBC>(new AES_256_CBC(s, s->cct));
@@ -1457,7 +1457,7 @@ int rgw_s3_prepare_decrypt(struct req_state* s,
       ldpp_dout(s, 0) << "ERROR: key obtained " <<
           "is not 256 bit size" << dendl;
       s->err.message = "SSE-S3 provided an invalid key for the given keyid.";
-      return -ERR_INVALID_ACCESS_KEY;
+      return -EINVAL;
     }
 
     auto aes = std::unique_ptr<AES_256_CBC>(new AES_256_CBC(s, s->cct));
index 8d11a3248e0e79f31b0a14e431b162bf69ebf384..eec5d80daab136f1b140afeecfa13ead2cdd6714 100644 (file)
@@ -873,7 +873,7 @@ static int get_actual_key_from_conf(const DoutPrefixProvider* dpp,
 
   map<string, string>::iterator it = str_map.find(std::string(key_id));
   if (it == str_map.end())
-    return -ERR_INVALID_ACCESS_KEY;
+    return -EINVAL;
 
   std::string master_key;
   try {