aboutsummaryrefslogtreecommitdiff
path: root/cc/daead
diff options
context:
space:
mode:
authorjuerg <juerg@google.com>2022-05-17 07:39:38 -0700
committerCopybara-Service <copybara-worker@google.com>2022-05-17 07:40:48 -0700
commit64e38d1a08eadedf6b6c7748ba3aa67adbfcd31c (patch)
tree646cdc2cdee6058882630901c33e088fab8385ba /cc/daead
parent1ad2564be14580e59e2cef99e6e4ecd032e24eb2 (diff)
downloadtink-64e38d1a08eadedf6b6c7748ba3aa67adbfcd31c.tar.gz
Rename additional data to associated data in (d)aead wrappers.
At the same time, fix some lint warnings. PiperOrigin-RevId: 449217723
Diffstat (limited to 'cc/daead')
-rw-r--r--cc/daead/BUILD.bazel1
-rw-r--r--cc/daead/CMakeLists.txt1
-rw-r--r--cc/daead/deterministic_aead_wrapper.cc4
-rw-r--r--cc/daead/deterministic_aead_wrapper_test.cc12
4 files changed, 9 insertions, 9 deletions
diff --git a/cc/daead/BUILD.bazel b/cc/daead/BUILD.bazel
index df139fbee..473cc9e2b 100644
--- a/cc/daead/BUILD.bazel
+++ b/cc/daead/BUILD.bazel
@@ -125,7 +125,6 @@ cc_test(
"//util:status",
"//util:test_matchers",
"//util:test_util",
- "@com_google_absl//absl/memory",
"@com_google_googletest//:gtest_main",
],
)
diff --git a/cc/daead/CMakeLists.txt b/cc/daead/CMakeLists.txt
index 17da3e26d..4bfc5cd67 100644
--- a/cc/daead/CMakeLists.txt
+++ b/cc/daead/CMakeLists.txt
@@ -113,7 +113,6 @@ tink_cc_test(
DEPS
tink::daead::deterministic_aead_wrapper
gmock
- absl::memory
tink::core::deterministic_aead
tink::core::primitive_set
tink::util::status
diff --git a/cc/daead/deterministic_aead_wrapper.cc b/cc/daead/deterministic_aead_wrapper.cc
index f72edaf2e..a36ae8ee2 100644
--- a/cc/daead/deterministic_aead_wrapper.cc
+++ b/cc/daead/deterministic_aead_wrapper.cc
@@ -67,7 +67,7 @@ class DeterministicAeadSetWrapper : public DeterministicAead {
util::StatusOr<std::string>
DeterministicAeadSetWrapper::EncryptDeterministically(
absl::string_view plaintext, absl::string_view associated_data) const {
- // BoringSSL expects a non-null pointer for plaintext and additional_data,
+ // BoringSSL expects a non-null pointer for plaintext and associated_data,
// regardless of whether the size is 0.
plaintext = internal::EnsureStringNonNull(plaintext);
associated_data = internal::EnsureStringNonNull(associated_data);
@@ -83,7 +83,7 @@ DeterministicAeadSetWrapper::EncryptDeterministically(
util::StatusOr<std::string>
DeterministicAeadSetWrapper::DecryptDeterministically(
absl::string_view ciphertext, absl::string_view associated_data) const {
- // BoringSSL expects a non-null pointer for plaintext and additional_data,
+ // BoringSSL expects a non-null pointer for plaintext and associated_data,
// regardless of whether the size is 0.
associated_data = internal::EnsureStringNonNull(associated_data);
diff --git a/cc/daead/deterministic_aead_wrapper_test.cc b/cc/daead/deterministic_aead_wrapper_test.cc
index 327ac13b3..a34daac20 100644
--- a/cc/daead/deterministic_aead_wrapper_test.cc
+++ b/cc/daead/deterministic_aead_wrapper_test.cc
@@ -16,11 +16,11 @@
#include "tink/daead/deterministic_aead_wrapper.h"
+#include <memory>
#include <string>
#include <utility>
#include "gtest/gtest.h"
-#include "absl/memory/memory.h"
#include "tink/deterministic_aead.h"
#include "tink/primitive_set.h"
#include "tink/util/status.h"
@@ -116,19 +116,21 @@ TEST_F(DeterministicAeadSetWrapperTest, testBasic) {
EXPECT_TRUE(daead_result.ok()) << daead_result.status();
daead = std::move(daead_result.value());
std::string plaintext = "some_plaintext";
- std::string aad = "some_aad";
+ std::string associated_data = "some_associated_data";
- auto encrypt_result = daead->EncryptDeterministically(plaintext, aad);
+ auto encrypt_result =
+ daead->EncryptDeterministically(plaintext, associated_data);
EXPECT_TRUE(encrypt_result.ok()) << encrypt_result.status();
std::string ciphertext = encrypt_result.value();
EXPECT_PRED_FORMAT2(testing::IsSubstring, daead_name_2, ciphertext);
- auto decrypt_result = daead->DecryptDeterministically(ciphertext, aad);
+ auto decrypt_result =
+ daead->DecryptDeterministically(ciphertext, associated_data);
EXPECT_TRUE(decrypt_result.ok()) << decrypt_result.status();
EXPECT_EQ(plaintext, decrypt_result.value());
decrypt_result =
- daead->DecryptDeterministically("some bad ciphertext", aad);
+ daead->DecryptDeterministically("some bad ciphertext", associated_data);
EXPECT_FALSE(decrypt_result.ok());
EXPECT_EQ(absl::StatusCode::kInvalidArgument,
decrypt_result.status().code());