From 61c5cc8eb5ca36aad420eee35b756fc5327ed206 Mon Sep 17 00:00:00 2001 From: Benjamin Wright Date: Fri, 26 Oct 2018 17:50:00 -0700 Subject: [PATCH] Makes OpenSSL concrete implementations final. OpenSSL implementations are all final implementations of their more abstract SSL variants. This should be both documented and enforced by the use of the final keyword to indicate to future WebRTC contributors that this is the intended depth of inheritance and it shouldn't be extended again. Hopefully this minor change will help keep the code simpler to maintain going forward. Bug: webrtc:9860 Change-Id: Ie22de722214e3b209c3d7727a93ac819c112434e Reviewed-on: https://webrtc-review.googlesource.com/c/108203 Reviewed-by: Karl Wiberg Commit-Queue: Benjamin Wright Cr-Commit-Position: refs/heads/master@{#25401} --- rtc_base/openssladapter.h | 2 +- rtc_base/opensslcertificate.h | 2 +- rtc_base/openssldigest.h | 2 +- rtc_base/opensslidentity.h | 4 ++-- rtc_base/opensslstreamadapter.h | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/rtc_base/openssladapter.h b/rtc_base/openssladapter.h index e77575e129..2e3a355f43 100644 --- a/rtc_base/openssladapter.h +++ b/rtc_base/openssladapter.h @@ -32,7 +32,7 @@ namespace rtc { -class OpenSSLAdapter : public SSLAdapter, public MessageHandler { +class OpenSSLAdapter final : public SSLAdapter, public MessageHandler { public: static bool InitializeSSL(); static bool CleanupSSL(); diff --git a/rtc_base/opensslcertificate.h b/rtc_base/opensslcertificate.h index 40de0216c4..088725c0d7 100644 --- a/rtc_base/opensslcertificate.h +++ b/rtc_base/opensslcertificate.h @@ -28,7 +28,7 @@ class OpenSSLKeyPair; // OpenSSLCertificate encapsulates an OpenSSL X509* certificate object, // which is also reference counted inside the OpenSSL library. -class OpenSSLCertificate : public SSLCertificate { +class OpenSSLCertificate final : public SSLCertificate { public: // X509 object has its reference count incremented. So the caller and // OpenSSLCertificate share ownership. diff --git a/rtc_base/openssldigest.h b/rtc_base/openssldigest.h index 78986f5af7..82dc9a96cd 100644 --- a/rtc_base/openssldigest.h +++ b/rtc_base/openssldigest.h @@ -20,7 +20,7 @@ namespace rtc { // An implementation of the digest class that uses OpenSSL. -class OpenSSLDigest : public MessageDigest { +class OpenSSLDigest final : public MessageDigest { public: // Creates an OpenSSLDigest with |algorithm| as the hash algorithm. explicit OpenSSLDigest(const std::string& algorithm); diff --git a/rtc_base/opensslidentity.h b/rtc_base/opensslidentity.h index 21bee91d36..fcf7debf90 100644 --- a/rtc_base/opensslidentity.h +++ b/rtc_base/opensslidentity.h @@ -27,7 +27,7 @@ namespace rtc { // OpenSSLKeyPair encapsulates an OpenSSL EVP_PKEY* keypair object, // which is reference counted inside the OpenSSL library. -class OpenSSLKeyPair { +class OpenSSLKeyPair final { public: explicit OpenSSLKeyPair(EVP_PKEY* pkey) : pkey_(pkey) { RTC_DCHECK(pkey_ != nullptr); @@ -58,7 +58,7 @@ class OpenSSLKeyPair { // Holds a keypair and certificate together, and a method to generate // them consistently. -class OpenSSLIdentity : public SSLIdentity { +class OpenSSLIdentity final : public SSLIdentity { public: static OpenSSLIdentity* GenerateWithExpiration(const std::string& common_name, const KeyParams& key_params, diff --git a/rtc_base/opensslstreamadapter.h b/rtc_base/opensslstreamadapter.h index 927fe2bde5..358f7f3166 100644 --- a/rtc_base/opensslstreamadapter.h +++ b/rtc_base/opensslstreamadapter.h @@ -56,7 +56,7 @@ class SSLCertChain; /////////////////////////////////////////////////////////////////////////////// -class OpenSSLStreamAdapter : public SSLStreamAdapter { +class OpenSSLStreamAdapter final : public SSLStreamAdapter { public: explicit OpenSSLStreamAdapter(StreamInterface* stream); ~OpenSSLStreamAdapter() override;