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}
diff --git a/rtc_base/openssl_certificate.cc b/rtc_base/openssl_certificate.cc
index 802787d..faed72b 100644
--- a/rtc_base/openssl_certificate.cc
+++ b/rtc_base/openssl_certificate.cc
@@ -144,8 +144,8 @@
 }
 
 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 @@
   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 X509* x509,
-                                       const std::string& algorithm,
+                                       absl::string_view algorithm,
                                        unsigned char* digest,
                                        size_t size,
                                        size_t* length) {
diff --git a/rtc_base/openssl_certificate.h b/rtc_base/openssl_certificate.h
index b2debbe..3f1b8c82 100644
--- a/rtc_base/openssl_certificate.h
+++ b/rtc_base/openssl_certificate.h
@@ -37,7 +37,7 @@
       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 @@
   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);
diff --git a/rtc_base/openssl_identity.cc b/rtc_base/openssl_identity.cc
index 3794d98..1864978 100644
--- a/rtc_base/openssl_identity.cc
+++ b/rtc_base/openssl_identity.cc
@@ -70,12 +70,12 @@
 
 // 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<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::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)
diff --git a/rtc_base/openssl_identity.h b/rtc_base/openssl_identity.h
index 63f46b3..a737210 100644
--- a/rtc_base/openssl_identity.h
+++ b/rtc_base/openssl_identity.h
@@ -29,17 +29,17 @@
 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;