Move crypto/proto_utils and crypto/status_utils from anonymous_tokens/cpp/crypto to anonymous_tokens/cpp/shared

PiperOrigin-RevId: 518872252
diff --git a/build/source_list.bzl b/build/source_list.bzl
index fa0436c..540c832 100644
--- a/build/source_list.bzl
+++ b/build/source_list.bzl
@@ -1549,9 +1549,7 @@
     "blind_sign_auth/anonymous_tokens/cpp/crypto/blinder.h",
     "blind_sign_auth/anonymous_tokens/cpp/crypto/constants.h",
     "blind_sign_auth/anonymous_tokens/cpp/crypto/crypto_utils.h",
-    "blind_sign_auth/anonymous_tokens/cpp/crypto/proto_utils.h",
     "blind_sign_auth/anonymous_tokens/cpp/crypto/rsa_blinder.h",
-    "blind_sign_auth/anonymous_tokens/cpp/crypto/status_utils.h",
     "blind_sign_auth/anonymous_tokens/cpp/crypto/testing_utils.h",
     "blind_sign_auth/blind_sign_auth.h",
     "blind_sign_auth/blind_sign_auth_interface.h",
@@ -1564,7 +1562,6 @@
 blind_sign_auth_srcs = [
     "blind_sign_auth/anonymous_tokens/cpp/client/anonymous_tokens_rsa_bssa_client.cc",
     "blind_sign_auth/anonymous_tokens/cpp/crypto/crypto_utils.cc",
-    "blind_sign_auth/anonymous_tokens/cpp/crypto/proto_utils.cc",
     "blind_sign_auth/anonymous_tokens/cpp/crypto/rsa_blinder.cc",
     "blind_sign_auth/anonymous_tokens/cpp/crypto/testing_utils.cc",
     "blind_sign_auth/blind_sign_auth.cc",
@@ -1576,7 +1573,6 @@
 blind_sign_auth_tests_srcs = [
     "blind_sign_auth/anonymous_tokens/cpp/client/anonymous_tokens_rsa_bssa_client_test.cc",
     "blind_sign_auth/anonymous_tokens/cpp/crypto/at_crypto_utils_test.cc",
-    "blind_sign_auth/anonymous_tokens/cpp/crypto/proto_utils_test.cc",
     "blind_sign_auth/anonymous_tokens/cpp/crypto/rsa_blinder_test.cc",
     "blind_sign_auth/blind_sign_auth_test.cc",
     "blind_sign_auth/cached_blind_sign_auth_test.cc",
diff --git a/build/source_list.gni b/build/source_list.gni
index 4ed9659..1338611 100644
--- a/build/source_list.gni
+++ b/build/source_list.gni
@@ -1549,9 +1549,7 @@
     "src/quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/blinder.h",
     "src/quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/constants.h",
     "src/quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/crypto_utils.h",
-    "src/quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/proto_utils.h",
     "src/quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/rsa_blinder.h",
-    "src/quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/status_utils.h",
     "src/quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/testing_utils.h",
     "src/quiche/blind_sign_auth/blind_sign_auth.h",
     "src/quiche/blind_sign_auth/blind_sign_auth_interface.h",
@@ -1564,7 +1562,6 @@
 blind_sign_auth_srcs = [
     "src/quiche/blind_sign_auth/anonymous_tokens/cpp/client/anonymous_tokens_rsa_bssa_client.cc",
     "src/quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/crypto_utils.cc",
-    "src/quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/proto_utils.cc",
     "src/quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/rsa_blinder.cc",
     "src/quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/testing_utils.cc",
     "src/quiche/blind_sign_auth/blind_sign_auth.cc",
@@ -1576,7 +1573,6 @@
 blind_sign_auth_tests_srcs = [
     "src/quiche/blind_sign_auth/anonymous_tokens/cpp/client/anonymous_tokens_rsa_bssa_client_test.cc",
     "src/quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/at_crypto_utils_test.cc",
-    "src/quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/proto_utils_test.cc",
     "src/quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/rsa_blinder_test.cc",
     "src/quiche/blind_sign_auth/blind_sign_auth_test.cc",
     "src/quiche/blind_sign_auth/cached_blind_sign_auth_test.cc",
diff --git a/build/source_list.json b/build/source_list.json
index 4588b18..8af9756 100644
--- a/build/source_list.json
+++ b/build/source_list.json
@@ -1548,9 +1548,7 @@
     "quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/blinder.h",
     "quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/constants.h",
     "quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/crypto_utils.h",
-    "quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/proto_utils.h",
     "quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/rsa_blinder.h",
-    "quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/status_utils.h",
     "quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/testing_utils.h",
     "quiche/blind_sign_auth/blind_sign_auth.h",
     "quiche/blind_sign_auth/blind_sign_auth_interface.h",
@@ -1563,7 +1561,6 @@
   "blind_sign_auth_srcs": [
     "quiche/blind_sign_auth/anonymous_tokens/cpp/client/anonymous_tokens_rsa_bssa_client.cc",
     "quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/crypto_utils.cc",
-    "quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/proto_utils.cc",
     "quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/rsa_blinder.cc",
     "quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/testing_utils.cc",
     "quiche/blind_sign_auth/blind_sign_auth.cc",
@@ -1575,7 +1572,6 @@
   "blind_sign_auth_tests_srcs": [
     "quiche/blind_sign_auth/anonymous_tokens/cpp/client/anonymous_tokens_rsa_bssa_client_test.cc",
     "quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/at_crypto_utils_test.cc",
-    "quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/proto_utils_test.cc",
     "quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/rsa_blinder_test.cc",
     "quiche/blind_sign_auth/blind_sign_auth_test.cc",
     "quiche/blind_sign_auth/cached_blind_sign_auth_test.cc"
diff --git a/quiche/blind_sign_auth/anonymous_tokens/cpp/client/anonymous_tokens_rsa_bssa_client.cc b/quiche/blind_sign_auth/anonymous_tokens/cpp/client/anonymous_tokens_rsa_bssa_client.cc
index 6bd2209..04bb95a 100644
--- a/quiche/blind_sign_auth/anonymous_tokens/cpp/client/anonymous_tokens_rsa_bssa_client.cc
+++ b/quiche/blind_sign_auth/anonymous_tokens/cpp/client/anonymous_tokens_rsa_bssa_client.cc
@@ -26,8 +26,8 @@
 #include "absl/time/time.h"
 #include "quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/constants.h"
 #include "quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/crypto_utils.h"
-#include "quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/proto_utils.h"
-#include "quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/status_utils.h"
+#include "quiche/blind_sign_auth/anonymous_tokens/cpp/shared/proto_utils.h"
+#include "quiche/blind_sign_auth/anonymous_tokens/cpp/shared/status_utils.h"
 #include "quiche/blind_sign_auth/anonymous_tokens/proto/anonymous_tokens.pb.h"
 #include "openssl/rand.h"
 
diff --git a/quiche/blind_sign_auth/anonymous_tokens/cpp/client/anonymous_tokens_rsa_bssa_client_test.cc b/quiche/blind_sign_auth/anonymous_tokens/cpp/client/anonymous_tokens_rsa_bssa_client_test.cc
index 9a317f4..13c83d7 100644
--- a/quiche/blind_sign_auth/anonymous_tokens/cpp/client/anonymous_tokens_rsa_bssa_client_test.cc
+++ b/quiche/blind_sign_auth/anonymous_tokens/cpp/client/anonymous_tokens_rsa_bssa_client_test.cc
@@ -22,9 +22,9 @@
 #include "quiche/common/platform/api/quiche_test.h"
 #include "quiche/common/test_tools/quiche_test_utils.h"
 #include "absl/time/time.h"
-#include "quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/proto_utils.h"
-#include "quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/status_utils.h"
 #include "quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/testing_utils.h"
+#include "quiche/blind_sign_auth/anonymous_tokens/cpp/shared/proto_utils.h"
+#include "quiche/blind_sign_auth/anonymous_tokens/cpp/shared/status_utils.h"
 #include "quiche/blind_sign_auth/anonymous_tokens/proto/anonymous_tokens.pb.h"
 #include "openssl/base.h"
 #include "openssl/rsa.h"
diff --git a/quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/crypto_utils.cc b/quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/crypto_utils.cc
index e870b4d..e543759 100644
--- a/quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/crypto_utils.cc
+++ b/quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/crypto_utils.cc
@@ -28,7 +28,7 @@
 #include "absl/strings/str_cat.h"
 #include "absl/strings/string_view.h"
 #include "quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/constants.h"
-#include "quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/status_utils.h"
+#include "quiche/blind_sign_auth/anonymous_tokens/cpp/shared/status_utils.h"
 #include "quiche/blind_sign_auth/anonymous_tokens/proto/anonymous_tokens.pb.h"
 #include "openssl/err.h"
 #include "openssl/hkdf.h"
diff --git a/quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/proto_utils.cc b/quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/proto_utils.cc
deleted file mode 100644
index 3129725..0000000
--- a/quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/proto_utils.cc
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright 2023 Google LLC
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//    https://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/proto_utils.h"
-
-namespace private_membership {
-namespace anonymous_tokens {
-
-absl::StatusOr<AnonymousTokensUseCase> ParseUseCase(
-    absl::string_view use_case) {
-  AnonymousTokensUseCase parsed_use_case;
-  if (!AnonymousTokensUseCase_Parse(std::string(use_case), &parsed_use_case) ||
-      parsed_use_case == ANONYMOUS_TOKENS_USE_CASE_UNDEFINED) {
-    return absl::InvalidArgumentError(
-        "Invalid / undefined use case cannot be parsed.");
-  }
-  return parsed_use_case;
-}
-
-absl::StatusOr<absl::Time> TimeFromProto(
-    const quiche::protobuf::Timestamp& proto) {
-  const auto sec = proto.seconds();
-  const auto ns = proto.nanos();
-  // sec must be [0001-01-01T00:00:00Z, 9999-12-31T23:59:59.999999999Z]
-  if (sec < -62135596800 || sec > 253402300799) {
-    return absl::InvalidArgumentError(absl::StrCat("seconds=", sec));
-  }
-  if (ns < 0 || ns > 999999999) {
-    return absl::InvalidArgumentError(absl::StrCat("nanos=", ns));
-  }
-  return absl::FromUnixSeconds(proto.seconds()) +
-         absl::Nanoseconds(proto.nanos());
-}
-
-absl::StatusOr<quiche::protobuf::Timestamp> TimeToProto(absl::Time time) {
-  quiche::protobuf::Timestamp proto;
-  const int64_t seconds = absl::ToUnixSeconds(time);
-  proto.set_seconds(seconds);
-  proto.set_nanos((time - absl::FromUnixSeconds(seconds)) /
-                  absl::Nanoseconds(1));
-  // seconds must be [0001-01-01T00:00:00Z, 9999-12-31T23:59:59.999999999Z]
-  if (seconds < -62135596800 || seconds > 253402300799) {
-    return absl::InvalidArgumentError(absl::StrCat("seconds=", seconds));
-  }
-  const int64_t ns = proto.nanos();
-  if (ns < 0 || ns > 999999999) {
-    return absl::InvalidArgumentError(absl::StrCat("nanos=", ns));
-  }
-  return proto;
-}
-
-}  // namespace anonymous_tokens
-}  // namespace private_membership
diff --git a/quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/proto_utils.h b/quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/proto_utils.h
deleted file mode 100644
index 067bf5f..0000000
--- a/quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/proto_utils.h
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2023 Google LLC
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//    https://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef THIRD_PARTY_ANONYMOUS_TOKENS_CPP_CRYPTO_PROTO_UTILS_H_
-#define THIRD_PARTY_ANONYMOUS_TOKENS_CPP_CRYPTO_PROTO_UTILS_H_
-
-#include "quiche/blind_sign_auth/proto/timestamp.pb.h"
-#include "absl/status/statusor.h"
-#include "absl/strings/string_view.h"
-#include "absl/time/time.h"
-#include "quiche/blind_sign_auth/anonymous_tokens/proto/anonymous_tokens.pb.h"
-// #include "quiche/common/platform/api/quiche_export.h"
-
-namespace private_membership {
-namespace anonymous_tokens {
-
-// Returns AnonymousTokensUseCase parsed from a string_view.
-absl::StatusOr<AnonymousTokensUseCase> QUICHE_EXPORT ParseUseCase(
-    absl::string_view use_case);
-
-// Takes in quiche::protobuf::Timestamp and converts it to absl::Time.
-//
-// Timestamp is defined here:
-// https://developers.google.com/protocol-buffers/docs/reference/quiche.protobuf#timestamp
-absl::StatusOr<absl::Time> QUICHE_EXPORT TimeFromProto(
-    const quiche::protobuf::Timestamp& proto);
-
-// Takes in absl::Time and converts it to quiche::protobuf::Timestamp.
-//
-// Timestamp is defined here:
-// https://developers.google.com/protocol-buffers/docs/reference/quiche.protobuf#timestamp
-absl::StatusOr<quiche::protobuf::Timestamp> QUICHE_EXPORT TimeToProto(
-    absl::Time time);
-
-}  // namespace anonymous_tokens
-}  // namespace private_membership
-
-#endif  // THIRD_PARTY_ANONYMOUS_TOKENS_CPP_CRYPTO_PROTO_UTILS_H_
diff --git a/quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/proto_utils_test.cc b/quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/proto_utils_test.cc
deleted file mode 100644
index 45dfe9c..0000000
--- a/quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/proto_utils_test.cc
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright 2023 Google LLC
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//    https://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/proto_utils.h"
-
-#include "quiche/blind_sign_auth/proto/timestamp.pb.h"
-#include "quiche/common/platform/api/quiche_test.h"
-#include "quiche/common/test_tools/quiche_test_utils.h"
-#include "absl/status/status.h"
-#include "absl/status/statusor.h"
-#include "absl/time/time.h"
-#include "quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/testing_utils.h"
-#include "quiche/blind_sign_auth/anonymous_tokens/proto/anonymous_tokens.pb.h"
-
-namespace private_membership {
-namespace anonymous_tokens {
-namespace {
-
-TEST(ProtoUtilsTest, EmptyUseCase) {
-  EXPECT_THAT(ParseUseCase("").status().code(),
-              absl::StatusCode::kInvalidArgument);
-}
-
-TEST(ProtoUtilsTest, InvalidUseCase) {
-  EXPECT_THAT(ParseUseCase("NOT_A_USE_CASE").status().code(),
-              absl::StatusCode::kInvalidArgument);
-}
-
-TEST(ProtoUtilsTest, UndefinedUseCase) {
-  EXPECT_THAT(
-      ParseUseCase("ANONYMOUS_TOKENS_USE_CASE_UNDEFINED").status().code(),
-      absl::StatusCode::kInvalidArgument);
-}
-
-TEST(ProtoUtilsTest, ValidUseCase) {
-  ANON_TOKENS_QUICHE_EXPECT_OK_AND_ASSIGN(AnonymousTokensUseCase use_case,
-                                   ParseUseCase("TEST_USE_CASE"));
-  EXPECT_EQ(use_case, AnonymousTokensUseCase::TEST_USE_CASE);
-}
-
-TEST(ProtoUtilsTest, TimeFromProtoGood) {
-  quiche::protobuf::Timestamp timestamp;
-  timestamp.set_seconds(1234567890);
-  timestamp.set_nanos(12345);
-  ANON_TOKENS_QUICHE_EXPECT_OK_AND_ASSIGN(absl::Time time, TimeFromProto(timestamp));
-  ASSERT_EQ(time, absl::FromUnixNanos(1234567890000012345));
-}
-
-TEST(ProtoUtilsTest, TimeFromProtoBad) {
-  quiche::protobuf::Timestamp proto;
-  proto.set_nanos(-1);
-  EXPECT_THAT(TimeFromProto(proto).status().code(),
-              absl::StatusCode::kInvalidArgument);
-
-  proto.set_nanos(0);
-  proto.set_seconds(253402300800);
-  EXPECT_THAT(TimeFromProto(proto).status().code(),
-              absl::StatusCode::kInvalidArgument);
-}
-
-TEST(ProtoUtilsTest, TimeToProtoGood) {
-  quiche::protobuf::Timestamp proto;
-  ANON_TOKENS_QUICHE_EXPECT_OK_AND_ASSIGN(
-      proto, TimeToProto(absl::FromUnixSeconds(1596762373)));
-  EXPECT_EQ(proto.seconds(), 1596762373);
-  EXPECT_EQ(proto.nanos(), 0);
-
-  ANON_TOKENS_QUICHE_EXPECT_OK_AND_ASSIGN(
-      proto, TimeToProto(absl::FromUnixMillis(1596762373123L)));
-  EXPECT_EQ(proto.seconds(), 1596762373);
-  EXPECT_EQ(proto.nanos(), 123000000);
-}
-
-TEST(ProtoUtilsTest, TimeToProtoBad) {
-  absl::StatusOr<quiche::protobuf::Timestamp> proto;
-  proto = TimeToProto(absl::FromUnixSeconds(253402300800));
-  EXPECT_THAT(proto.status().code(), absl::StatusCode::kInvalidArgument);
-}
-
-}  // namespace
-}  // namespace anonymous_tokens
-}  // namespace private_membership
diff --git a/quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/rsa_blinder.cc b/quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/rsa_blinder.cc
index a630051..385ab05 100644
--- a/quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/rsa_blinder.cc
+++ b/quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/rsa_blinder.cc
@@ -22,7 +22,7 @@
 #include "absl/status/status.h"
 #include "quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/constants.h"
 #include "quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/crypto_utils.h"
-#include "quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/status_utils.h"
+#include "quiche/blind_sign_auth/anonymous_tokens/cpp/shared/status_utils.h"
 #include "quiche/blind_sign_auth/anonymous_tokens/proto/anonymous_tokens.pb.h"
 #include "openssl/digest.h"
 #include "openssl/rsa.h"
diff --git a/quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/status_utils.h b/quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/status_utils.h
deleted file mode 100644
index e0bd70d..0000000
--- a/quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/status_utils.h
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2023 Google LLC
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//    https://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef THIRD_PARTY_ANONYMOUS_TOKENS_CPP_CRYPTO_STATUS_UTILS_H_
-#define THIRD_PARTY_ANONYMOUS_TOKENS_CPP_CRYPTO_STATUS_UTILS_H_
-
-#include "absl/base/optimization.h"
-#include "absl/status/status.h"
-
-namespace private_membership {
-namespace anonymous_tokens {
-
-#define _ANON_TOKENS_STATUS_MACROS_CONCAT_NAME(x, y) \
-  _ANON_TOKENS_STATUS_MACROS_CONCAT_IMPL(x, y)
-#define _ANON_TOKENS_STATUS_MACROS_CONCAT_IMPL(x, y) x##y
-
-#define ANON_TOKENS_ASSIGN_OR_RETURN(lhs, rexpr)                             \
-  _ANON_TOKENS_ASSIGN_OR_RETURN_IMPL(                                        \
-      _ANON_TOKENS_STATUS_MACROS_CONCAT_NAME(_status_or_val, __LINE__), lhs, \
-      rexpr)
-
-#define _ANON_TOKENS_ASSIGN_OR_RETURN_IMPL(statusor, lhs, rexpr) \
-  auto statusor = (rexpr);                                       \
-  if (ABSL_PREDICT_FALSE(!statusor.ok())) {                      \
-    return statusor.status();                                    \
-  }                                                              \
-  lhs = *std::move(statusor)
-
-#define ANON_TOKENS_RETURN_IF_ERROR(expr)                  \
-  do {                                                     \
-    auto _status = (expr);                                 \
-    if (ABSL_PREDICT_FALSE(!_status.ok())) return _status; \
-  } while (0)
-
-}  // namespace anonymous_tokens
-}  // namespace private_membership
-
-#endif  // THIRD_PARTY_ANONYMOUS_TOKENS_CPP_CRYPTO_STATUS_UTILS_H_
diff --git a/quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/testing_utils.cc b/quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/testing_utils.cc
index 323a714..38b43aa 100644
--- a/quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/testing_utils.cc
+++ b/quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/testing_utils.cc
@@ -29,7 +29,7 @@
 #include "absl/strings/string_view.h"
 #include "quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/constants.h"
 #include "quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/crypto_utils.h"
-#include "quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/status_utils.h"
+#include "quiche/blind_sign_auth/anonymous_tokens/cpp/shared/status_utils.h"
 #include "openssl/rsa.h"
 
 namespace private_membership {
diff --git a/quiche/blind_sign_auth/blind_sign_auth.cc b/quiche/blind_sign_auth/blind_sign_auth.cc
index 413eb64..aa6e5b2 100644
--- a/quiche/blind_sign_auth/blind_sign_auth.cc
+++ b/quiche/blind_sign_auth/blind_sign_auth.cc
@@ -20,7 +20,7 @@
 #include "absl/strings/escaping.h"
 #include "absl/strings/str_cat.h"
 #include "absl/types/span.h"
-#include "quiche/blind_sign_auth/anonymous_tokens/cpp/crypto/proto_utils.h"
+#include "quiche/blind_sign_auth/anonymous_tokens/cpp/shared/proto_utils.h"
 #include "quiche/blind_sign_auth/anonymous_tokens/proto/anonymous_tokens.pb.h"
 #include "quiche/blind_sign_auth/blind_sign_http_response.h"
 #include "quiche/common/platform/api/quiche_logging.h"