aboutsummaryrefslogtreecommitdiff
path: root/cc/mac/aes_cmac_key_manager.h
diff options
context:
space:
mode:
authorlizatretyakova <lizatretyakova@google.com>2021-11-03 07:14:35 -0700
committerCopybara-Service <copybara-worker@google.com>2021-11-03 07:15:26 -0700
commitff026423b0da6bc390f614a4c64c4b1fa52266f2 (patch)
treebb33ec388737f4df508fa328bed9e2fa8ba09af3 /cc/mac/aes_cmac_key_manager.h
parent29a17e19e56a69fa262912580b5901bc1491de98 (diff)
downloadtink-ff026423b0da6bc390f614a4c64c4b1fa52266f2.tar.gz
Replace the deprecated crypto::tink::util::error::INVALID_ARGUMENT usages with its absl version absl::StatusCode::kInvalidArgument.
This CL is a part of Tink migration to using absl::Status{,Or} and absl::StatusCode. PiperOrigin-RevId: 407329629
Diffstat (limited to 'cc/mac/aes_cmac_key_manager.h')
-rw-r--r--cc/mac/aes_cmac_key_manager.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/cc/mac/aes_cmac_key_manager.h b/cc/mac/aes_cmac_key_manager.h
index 3e103810b..c25fa93a8 100644
--- a/cc/mac/aes_cmac_key_manager.h
+++ b/cc/mac/aes_cmac_key_manager.h
@@ -19,6 +19,7 @@
#include <string>
#include "absl/memory/memory.h"
+#include "absl/status/status.h"
#include "absl/strings/str_cat.h"
#include "tink/core/key_type_manager.h"
#include "tink/key_manager.h"
@@ -71,7 +72,7 @@ class AesCmacKeyManager
if (!status.ok()) return status;
if (key.key_value().size() != kKeySizeInBytes) {
return crypto::tink::util::Status(
- util::error::INVALID_ARGUMENT,
+ absl::StatusCode::kInvalidArgument,
"Invalid AesCmacKey: key_value wrong length.");
}
return ValidateParams(key.params());
@@ -81,7 +82,7 @@ class AesCmacKeyManager
const google::crypto::tink::AesCmacKeyFormat& key_format) const override {
if (key_format.key_size() != kKeySizeInBytes) {
return crypto::tink::util::Status(
- crypto::tink::util::error::INVALID_ARGUMENT,
+ absl::StatusCode::kInvalidArgument,
"Invalid AesCmacKeyFormat: invalid key_size.");
}
return ValidateParams(key_format.params());
@@ -101,12 +102,12 @@ class AesCmacKeyManager
crypto::tink::util::Status ValidateParams(
const google::crypto::tink::AesCmacParams& params) const {
if (params.tag_size() < kMinTagSizeInBytes) {
- return util::Status(util::error::INVALID_ARGUMENT,
+ return util::Status(absl::StatusCode::kInvalidArgument,
absl::StrCat("Invalid AesCmacParams: tag_size ",
params.tag_size(), " is too small."));
}
if (params.tag_size() > kMaxTagSizeInBytes) {
- return util::Status(util::error::INVALID_ARGUMENT,
+ return util::Status(absl::StatusCode::kInvalidArgument,
absl::StrCat("Invalid AesCmacParams: tag_size ",
params.tag_size(), " is too big."));
}