mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-14 22:30:40 +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(
|
std::unique_ptr<OpenSSLCertificate> OpenSSLCertificate::FromPEMString(
|
||||||
const std::string& pem_string) {
|
absl::string_view pem_string) {
|
||||||
BIO* bio = BIO_new_mem_buf(const_cast<char*>(pem_string.c_str()), -1);
|
BIO* bio = BIO_new_mem_buf(const_cast<char*>(pem_string.data()), -1);
|
||||||
if (!bio) {
|
if (!bio) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -208,7 +208,7 @@ bool OpenSSLCertificate::GetSignatureDigestAlgorithm(
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OpenSSLCertificate::ComputeDigest(const std::string& algorithm,
|
bool OpenSSLCertificate::ComputeDigest(absl::string_view algorithm,
|
||||||
unsigned char* digest,
|
unsigned char* digest,
|
||||||
size_t size,
|
size_t size,
|
||||||
size_t* length) const {
|
size_t* length) const {
|
||||||
|
@ -216,7 +216,7 @@ bool OpenSSLCertificate::ComputeDigest(const std::string& algorithm,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OpenSSLCertificate::ComputeDigest(const X509* x509,
|
bool OpenSSLCertificate::ComputeDigest(const X509* x509,
|
||||||
const std::string& algorithm,
|
absl::string_view algorithm,
|
||||||
unsigned char* digest,
|
unsigned char* digest,
|
||||||
size_t size,
|
size_t size,
|
||||||
size_t* length) {
|
size_t* length) {
|
||||||
|
|
|
@ -37,7 +37,7 @@ class OpenSSLCertificate final : public SSLCertificate {
|
||||||
OpenSSLKeyPair* key_pair,
|
OpenSSLKeyPair* key_pair,
|
||||||
const SSLIdentityParams& params);
|
const SSLIdentityParams& params);
|
||||||
static std::unique_ptr<OpenSSLCertificate> FromPEMString(
|
static std::unique_ptr<OpenSSLCertificate> FromPEMString(
|
||||||
const std::string& pem_string);
|
absl::string_view pem_string);
|
||||||
|
|
||||||
~OpenSSLCertificate() override;
|
~OpenSSLCertificate() override;
|
||||||
|
|
||||||
|
@ -54,14 +54,14 @@ class OpenSSLCertificate final : public SSLCertificate {
|
||||||
bool operator!=(const OpenSSLCertificate& other) const;
|
bool operator!=(const OpenSSLCertificate& other) const;
|
||||||
|
|
||||||
// Compute the digest of the certificate given algorithm
|
// Compute the digest of the certificate given algorithm
|
||||||
bool ComputeDigest(const std::string& algorithm,
|
bool ComputeDigest(absl::string_view algorithm,
|
||||||
unsigned char* digest,
|
unsigned char* digest,
|
||||||
size_t size,
|
size_t size,
|
||||||
size_t* length) const override;
|
size_t* length) const override;
|
||||||
|
|
||||||
// Compute the digest of a certificate as an X509 *
|
// Compute the digest of a certificate as an X509 *
|
||||||
static bool ComputeDigest(const X509* x509,
|
static bool ComputeDigest(const X509* x509,
|
||||||
const std::string& algorithm,
|
absl::string_view algorithm,
|
||||||
unsigned char* digest,
|
unsigned char* digest,
|
||||||
size_t size,
|
size_t size,
|
||||||
size_t* length);
|
size_t* length);
|
||||||
|
|
|
@ -70,12 +70,12 @@ std::unique_ptr<OpenSSLIdentity> OpenSSLIdentity::CreateInternal(
|
||||||
|
|
||||||
// static
|
// static
|
||||||
std::unique_ptr<OpenSSLIdentity> OpenSSLIdentity::CreateWithExpiration(
|
std::unique_ptr<OpenSSLIdentity> OpenSSLIdentity::CreateWithExpiration(
|
||||||
const std::string& common_name,
|
absl::string_view common_name,
|
||||||
const KeyParams& key_params,
|
const KeyParams& key_params,
|
||||||
time_t certificate_lifetime) {
|
time_t certificate_lifetime) {
|
||||||
SSLIdentityParams params;
|
SSLIdentityParams params;
|
||||||
params.key_params = key_params;
|
params.key_params = key_params;
|
||||||
params.common_name = common_name;
|
params.common_name = std::string(common_name);
|
||||||
time_t now = time(nullptr);
|
time_t now = time(nullptr);
|
||||||
params.not_before = now + kCertificateWindowInSeconds;
|
params.not_before = now + kCertificateWindowInSeconds;
|
||||||
params.not_after = now + certificate_lifetime;
|
params.not_after = now + certificate_lifetime;
|
||||||
|
@ -90,8 +90,8 @@ std::unique_ptr<OpenSSLIdentity> OpenSSLIdentity::CreateForTest(
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<SSLIdentity> OpenSSLIdentity::CreateFromPEMStrings(
|
std::unique_ptr<SSLIdentity> OpenSSLIdentity::CreateFromPEMStrings(
|
||||||
const std::string& private_key,
|
absl::string_view private_key,
|
||||||
const std::string& certificate) {
|
absl::string_view certificate) {
|
||||||
std::unique_ptr<OpenSSLCertificate> cert(
|
std::unique_ptr<OpenSSLCertificate> cert(
|
||||||
OpenSSLCertificate::FromPEMString(certificate));
|
OpenSSLCertificate::FromPEMString(certificate));
|
||||||
if (!cert) {
|
if (!cert) {
|
||||||
|
@ -110,8 +110,8 @@ std::unique_ptr<SSLIdentity> OpenSSLIdentity::CreateFromPEMStrings(
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<SSLIdentity> OpenSSLIdentity::CreateFromPEMChainStrings(
|
std::unique_ptr<SSLIdentity> OpenSSLIdentity::CreateFromPEMChainStrings(
|
||||||
const std::string& private_key,
|
absl::string_view private_key,
|
||||||
const std::string& certificate_chain) {
|
absl::string_view certificate_chain) {
|
||||||
BIO* bio = BIO_new_mem_buf(certificate_chain.data(),
|
BIO* bio = BIO_new_mem_buf(certificate_chain.data(),
|
||||||
rtc::dchecked_cast<int>(certificate_chain.size()));
|
rtc::dchecked_cast<int>(certificate_chain.size()));
|
||||||
if (!bio)
|
if (!bio)
|
||||||
|
|
|
@ -29,17 +29,17 @@ namespace rtc {
|
||||||
class OpenSSLIdentity final : public SSLIdentity {
|
class OpenSSLIdentity final : public SSLIdentity {
|
||||||
public:
|
public:
|
||||||
static std::unique_ptr<OpenSSLIdentity> CreateWithExpiration(
|
static std::unique_ptr<OpenSSLIdentity> CreateWithExpiration(
|
||||||
const std::string& common_name,
|
absl::string_view common_name,
|
||||||
const KeyParams& key_params,
|
const KeyParams& key_params,
|
||||||
time_t certificate_lifetime);
|
time_t certificate_lifetime);
|
||||||
static std::unique_ptr<OpenSSLIdentity> CreateForTest(
|
static std::unique_ptr<OpenSSLIdentity> CreateForTest(
|
||||||
const SSLIdentityParams& params);
|
const SSLIdentityParams& params);
|
||||||
static std::unique_ptr<SSLIdentity> CreateFromPEMStrings(
|
static std::unique_ptr<SSLIdentity> CreateFromPEMStrings(
|
||||||
const std::string& private_key,
|
absl::string_view private_key,
|
||||||
const std::string& certificate);
|
absl::string_view certificate);
|
||||||
static std::unique_ptr<SSLIdentity> CreateFromPEMChainStrings(
|
static std::unique_ptr<SSLIdentity> CreateFromPEMChainStrings(
|
||||||
const std::string& private_key,
|
absl::string_view private_key,
|
||||||
const std::string& certificate_chain);
|
absl::string_view certificate_chain);
|
||||||
~OpenSSLIdentity() override;
|
~OpenSSLIdentity() override;
|
||||||
|
|
||||||
OpenSSLIdentity(const OpenSSLIdentity&) = delete;
|
OpenSSLIdentity(const OpenSSLIdentity&) = delete;
|
||||||
|
|
Loading…
Reference in a new issue