mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-12 21:30:45 +01:00
Update missing absl::string_view adoption in openssl files under rtc_base/
Bug: webrtc:13579 webrtc:13870 Change-Id: Ia549285f1a60f41397c04f7bc2acdee684544ec3 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/256722 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Ali Tofigh <alito@webrtc.org> Cr-Commit-Position: refs/heads/main@{#36328}
This commit is contained in:
parent
48aeb965fa
commit
58d861c47f
4 changed files with 18 additions and 18 deletions
|
@ -144,8 +144,8 @@ std::unique_ptr<OpenSSLCertificate> OpenSSLCertificate::Generate(
|
|||
}
|
||||
|
||||
std::unique_ptr<OpenSSLCertificate> OpenSSLCertificate::FromPEMString(
|
||||
const std::string& pem_string) {
|
||||
BIO* bio = BIO_new_mem_buf(const_cast<char*>(pem_string.c_str()), -1);
|
||||
absl::string_view pem_string) {
|
||||
BIO* bio = BIO_new_mem_buf(const_cast<char*>(pem_string.data()), -1);
|
||||
if (!bio) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ bool OpenSSLCertificate::GetSignatureDigestAlgorithm(
|
|||
return true;
|
||||
}
|
||||
|
||||
bool OpenSSLCertificate::ComputeDigest(const std::string& algorithm,
|
||||
bool OpenSSLCertificate::ComputeDigest(absl::string_view algorithm,
|
||||
unsigned char* digest,
|
||||
size_t size,
|
||||
size_t* length) const {
|
||||
|
@ -216,7 +216,7 @@ bool OpenSSLCertificate::ComputeDigest(const std::string& algorithm,
|
|||
}
|
||||
|
||||
bool OpenSSLCertificate::ComputeDigest(const X509* x509,
|
||||
const std::string& algorithm,
|
||||
absl::string_view algorithm,
|
||||
unsigned char* digest,
|
||||
size_t size,
|
||||
size_t* length) {
|
||||
|
|
|
@ -37,7 +37,7 @@ class OpenSSLCertificate final : public SSLCertificate {
|
|||
OpenSSLKeyPair* key_pair,
|
||||
const SSLIdentityParams& params);
|
||||
static std::unique_ptr<OpenSSLCertificate> FromPEMString(
|
||||
const std::string& pem_string);
|
||||
absl::string_view pem_string);
|
||||
|
||||
~OpenSSLCertificate() override;
|
||||
|
||||
|
@ -54,14 +54,14 @@ class OpenSSLCertificate final : public SSLCertificate {
|
|||
bool operator!=(const OpenSSLCertificate& other) const;
|
||||
|
||||
// Compute the digest of the certificate given algorithm
|
||||
bool ComputeDigest(const std::string& algorithm,
|
||||
bool ComputeDigest(absl::string_view algorithm,
|
||||
unsigned char* digest,
|
||||
size_t size,
|
||||
size_t* length) const override;
|
||||
|
||||
// Compute the digest of a certificate as an X509 *
|
||||
static bool ComputeDigest(const X509* x509,
|
||||
const std::string& algorithm,
|
||||
absl::string_view algorithm,
|
||||
unsigned char* digest,
|
||||
size_t size,
|
||||
size_t* length);
|
||||
|
|
|
@ -70,12 +70,12 @@ std::unique_ptr<OpenSSLIdentity> OpenSSLIdentity::CreateInternal(
|
|||
|
||||
// static
|
||||
std::unique_ptr<OpenSSLIdentity> OpenSSLIdentity::CreateWithExpiration(
|
||||
const std::string& common_name,
|
||||
absl::string_view common_name,
|
||||
const KeyParams& key_params,
|
||||
time_t certificate_lifetime) {
|
||||
SSLIdentityParams params;
|
||||
params.key_params = key_params;
|
||||
params.common_name = common_name;
|
||||
params.common_name = std::string(common_name);
|
||||
time_t now = time(nullptr);
|
||||
params.not_before = now + kCertificateWindowInSeconds;
|
||||
params.not_after = now + certificate_lifetime;
|
||||
|
@ -90,8 +90,8 @@ std::unique_ptr<OpenSSLIdentity> OpenSSLIdentity::CreateForTest(
|
|||
}
|
||||
|
||||
std::unique_ptr<SSLIdentity> OpenSSLIdentity::CreateFromPEMStrings(
|
||||
const std::string& private_key,
|
||||
const std::string& certificate) {
|
||||
absl::string_view private_key,
|
||||
absl::string_view certificate) {
|
||||
std::unique_ptr<OpenSSLCertificate> cert(
|
||||
OpenSSLCertificate::FromPEMString(certificate));
|
||||
if (!cert) {
|
||||
|
@ -110,8 +110,8 @@ std::unique_ptr<SSLIdentity> OpenSSLIdentity::CreateFromPEMStrings(
|
|||
}
|
||||
|
||||
std::unique_ptr<SSLIdentity> OpenSSLIdentity::CreateFromPEMChainStrings(
|
||||
const std::string& private_key,
|
||||
const std::string& certificate_chain) {
|
||||
absl::string_view private_key,
|
||||
absl::string_view certificate_chain) {
|
||||
BIO* bio = BIO_new_mem_buf(certificate_chain.data(),
|
||||
rtc::dchecked_cast<int>(certificate_chain.size()));
|
||||
if (!bio)
|
||||
|
|
|
@ -29,17 +29,17 @@ namespace rtc {
|
|||
class OpenSSLIdentity final : public SSLIdentity {
|
||||
public:
|
||||
static std::unique_ptr<OpenSSLIdentity> CreateWithExpiration(
|
||||
const std::string& common_name,
|
||||
absl::string_view common_name,
|
||||
const KeyParams& key_params,
|
||||
time_t certificate_lifetime);
|
||||
static std::unique_ptr<OpenSSLIdentity> CreateForTest(
|
||||
const SSLIdentityParams& params);
|
||||
static std::unique_ptr<SSLIdentity> CreateFromPEMStrings(
|
||||
const std::string& private_key,
|
||||
const std::string& certificate);
|
||||
absl::string_view private_key,
|
||||
absl::string_view certificate);
|
||||
static std::unique_ptr<SSLIdentity> CreateFromPEMChainStrings(
|
||||
const std::string& private_key,
|
||||
const std::string& certificate_chain);
|
||||
absl::string_view private_key,
|
||||
absl::string_view certificate_chain);
|
||||
~OpenSSLIdentity() override;
|
||||
|
||||
OpenSSLIdentity(const OpenSSLIdentity&) = delete;
|
||||
|
|
Loading…
Reference in a new issue