Remove use of the pointer version of RandBytes, use span always
The pointer-based crypto::RandBytes() overload can't be removed until
nearby stops using it: https://crrev.com/c/5529443 will do this.
The pointer-based base::RandBytes() will be removed next.
Bug: 40284755
Change-Id: I72c79e23e120f988b091dd2576de180a1c60d2b7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5514816
Commit-Queue: danakj <[email protected]>
Reviewed-by: Daniel Cheng <[email protected]>
Owners-Override: Daniel Cheng <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1298850}
diff --git a/base/token.cc b/base/token.cc
index 3ad4428..9cd562f 100644
--- a/base/token.cc
+++ b/base/token.cc
@@ -28,7 +28,7 @@
// Use base::RandBytes instead of crypto::RandBytes, because crypto calls the
// base version directly, and to prevent the dependency from base/ to crypto/.
- base::RandBytes(&token, sizeof(token));
+ RandBytes(byte_span_from_ref(token));
CHECK(!token.is_zero());
@@ -36,7 +36,7 @@
}
std::string Token::ToString() const {
- return base::StringPrintf("%016" PRIX64 "%016" PRIX64, words_[0], words_[1]);
+ return StringPrintf("%016" PRIX64 "%016" PRIX64, words_[0], words_[1]);
}
// static