Internal refactor.

PiperOrigin-RevId: 493970269
This commit is contained in:
Suet-Fei Li
2022-12-08 12:47:57 -08:00
committed by Copybara-Service
parent fcfec33a7c
commit a8ca18f477
15 changed files with 16 additions and 22 deletions
+2 -2
View File
@@ -61,9 +61,10 @@ cc_library(
"-Ithird_party",
],
deps = [
"//internal/platform:logging",
"@boringssl//:crypto",
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/log",
"@com_google_absl//absl/log:check",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/types:optional",
"@com_google_absl//absl/types:span",
@@ -94,7 +95,6 @@ cc_test(
],
deps = [
":crypto",
"//internal/platform/implementation/g3", # build_cleaner: keep
"@com_github_protobuf_matchers//protobuf-matchers",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/types:span",
+1
View File
@@ -21,6 +21,7 @@
#include <string>
#include <vector>
#include "absl/log/check.h"
#include "absl/types/span.h"
#include "internal/crypto/nearby_base.h"
#include "internal/crypto/openssl_util.h"
+1 -1
View File
@@ -23,8 +23,8 @@
#include <utility>
#include <vector>
#include "absl/log/check.h"
#include "internal/crypto/openssl_util.h"
#include "internal/platform/logging.h"
#include <openssl/bn.h>
#include <openssl/bytestring.h>
#include <openssl/ec.h>
-1
View File
@@ -17,7 +17,6 @@
#include <memory>
#include "internal/crypto/ec_signature_creator_impl.h"
#include "internal/platform/logging.h"
namespace crypto {
+3 -2
View File
@@ -22,12 +22,13 @@
#include <utility>
#include <vector>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/strings/string_view.h"
#include "absl/types/span.h"
#include "internal/crypto/nearby_base.h"
#include "internal/crypto/openssl_util.h"
#include "internal/crypto/symmetric_key.h"
#include "internal/platform/logging.h"
#include <openssl/aes.h>
#include <openssl/evp.h>
@@ -193,7 +194,7 @@ absl::optional<size_t> Encryptor::CryptCTR(bool do_encrypt,
absl::Span<const uint8_t> input,
absl::Span<uint8_t> output) {
if (iv_.size() != AES_BLOCK_SIZE) {
NEARBY_LOGS(ERROR) << "Counter value not set in CTR mode.";
LOG(ERROR) << "Counter value not set in CTR mode.";
return absl::nullopt;
}
+1 -1
View File
@@ -21,10 +21,10 @@
#include <string>
#include <vector>
#include "absl/log/check.h"
#include "absl/strings/string_view.h"
#include "internal/crypto/hkdf.h"
#include "internal/crypto/hmac.h"
#include "internal/platform/logging.h"
#include <openssl/digest.h>
namespace crypto {
+1 -1
View File
@@ -19,12 +19,12 @@
#include <algorithm>
#include <string>
#include "absl/log/check.h"
#include "internal/crypto/hmac.h"
#include "internal/crypto/nearby_base.h"
#include "internal/crypto/openssl_util.h"
#include "internal/crypto/secure_util.h"
#include "internal/crypto/symmetric_key.h"
#include "internal/platform/logging.h"
namespace crypto {
+1 -1
View File
@@ -18,8 +18,8 @@
#include <limits>
#include <string>
#include "absl/log/check.h"
#include "absl/types/span.h"
#include "internal/platform/logging.h"
namespace nearbybase {
+2 -8
View File
@@ -19,8 +19,8 @@
#include <string>
#include "absl/log/log.h"
#include "absl/strings/string_view.h"
#include "internal/platform/logging.h"
#include <openssl/crypto.h>
#include <openssl/err.h>
@@ -38,7 +38,7 @@ namespace {
// error queue and return, otherwise it will continue calling this function
// until all errors have been removed from the queue.
int OpenSSLErrorCallback(const char* str, size_t len, void* context) {
NEARBY_LOGS(VERBOSE) << "\t" << absl::string_view(str, len);
LOG(INFO) << "\t" << absl::string_view(str, len);
return 1;
}
@@ -50,13 +50,7 @@ void EnsureOpenSSLInit() {
}
void ClearOpenSSLERRStack() {
if (NEARBY_LOG_IS_ON(VERBOSE)) {
uint32_t error_num = ERR_peek_error();
if (error_num == 0) return;
ERR_print_errors_cb(&OpenSSLErrorCallback, nullptr);
} else {
ERR_clear_error();
}
}
} // namespace crypto
-1
View File
@@ -19,7 +19,6 @@
#include <string.h>
#include "internal/crypto/crypto_export.h"
#include "internal/platform/logging.h"
namespace crypto {
+1 -1
View File
@@ -20,9 +20,9 @@
#include <utility>
#include <vector>
#include "absl/log/check.h"
#include "absl/types/span.h"
#include "internal/crypto/openssl_util.h"
#include "internal/platform/logging.h"
#include <openssl/bn.h>
#include <openssl/bytestring.h>
#include <openssl/evp.h>
+1 -1
View File
@@ -16,8 +16,8 @@
#include <memory>
#include "absl/log/check.h"
#include "internal/crypto/openssl_util.h"
#include "internal/platform/logging.h"
#include <openssl/bytestring.h>
#include <openssl/digest.h>
#include <openssl/evp.h>
+1 -1
View File
@@ -22,9 +22,9 @@
#include <string>
#include <utility>
#include "absl/log/check.h"
#include "internal/crypto/nearby_base.h"
#include "internal/crypto/openssl_util.h"
#include "internal/platform/logging.h"
#include <openssl/evp.h>
#include <openssl/rand.h>
@@ -122,7 +122,6 @@ cc_library(
"//connections:__subpackages__",
"//fastpair:__subpackages__",
"//internal/analytics:__subpackages__",
"//internal/crypto:__subpackages__",
"//internal/platform:__subpackages__",
"//internal/proto/analytics:__subpackages__",
"//location/nearby/cpp/fastpair:__subpackages__",
@@ -38,6 +38,7 @@ cc_library(
textual_hdrs = glob(["**/*.h"]),
visibility = [
"//connections/windows:__subpackages__",
"//internal:__subpackages__",
"//internal/platform/implementation/windows:__subpackages__",
],
)