Pārlūkot izejas kodu

LibCrypto: Use default instead of an empty constructor/destructor

Default implementations allow for more optimizations.
See: https://pvs-studio.com/en/docs/warnings/v832/
Brian Gianforcaro 3 gadi atpakaļ
vecāks
revīzija
dba5710efa

+ 1 - 1
Userland/Libraries/LibCrypto/Cipher/Mode/CBC.h

@@ -19,7 +19,7 @@ class CBC : public Mode<T> {
 public:
 public:
     constexpr static size_t IVSizeInBits = 128;
     constexpr static size_t IVSizeInBits = 128;
 
 
-    virtual ~CBC() { }
+    virtual ~CBC() = default;
     template<typename... Args>
     template<typename... Args>
     explicit constexpr CBC<T>(Args... args)
     explicit constexpr CBC<T>(Args... args)
         : Mode<T>(args...)
         : Mode<T>(args...)

+ 1 - 1
Userland/Libraries/LibCrypto/Cipher/Mode/CTR.h

@@ -88,7 +88,7 @@ class CTR : public Mode<T> {
 public:
 public:
     constexpr static size_t IVSizeInBits = 128;
     constexpr static size_t IVSizeInBits = 128;
 
 
-    virtual ~CTR() { }
+    virtual ~CTR() = default;
 
 
     // Must intercept `Intent`, because AES must always be set to
     // Must intercept `Intent`, because AES must always be set to
     // Encryption, even when decrypting AES-CTR.
     // Encryption, even when decrypting AES-CTR.

+ 1 - 1
Userland/Libraries/LibCrypto/Cipher/Mode/GCM.h

@@ -24,7 +24,7 @@ class GCM : public CTR<T, IncrementFunction> {
 public:
 public:
     constexpr static size_t IVSizeInBits = 128;
     constexpr static size_t IVSizeInBits = 128;
 
 
-    virtual ~GCM() { }
+    virtual ~GCM() = default;
 
 
     template<typename... Args>
     template<typename... Args>
     explicit constexpr GCM<T>(Args... args)
     explicit constexpr GCM<T>(Args... args)

+ 1 - 1
Userland/Libraries/LibCrypto/Cipher/Mode/Mode.h

@@ -17,7 +17,7 @@ namespace Cipher {
 template<typename T>
 template<typename T>
 class Mode {
 class Mode {
 public:
 public:
-    virtual ~Mode() { }
+    virtual ~Mode() = default;
 
 
     virtual void encrypt(ReadonlyBytes in, Bytes& out, ReadonlyBytes ivec = {}, Bytes* ivec_out = nullptr) = 0;
     virtual void encrypt(ReadonlyBytes in, Bytes& out, ReadonlyBytes ivec = {}, Bytes* ivec_out = nullptr) = 0;
     virtual void decrypt(ReadonlyBytes in, Bytes& out, ReadonlyBytes ivec = {}) = 0;
     virtual void decrypt(ReadonlyBytes in, Bytes& out, ReadonlyBytes ivec = {}) = 0;

+ 1 - 3
Userland/Libraries/LibCrypto/PK/PK.h

@@ -25,9 +25,7 @@ public:
     {
     {
     }
     }
 
 
-    PKSystem()
-    {
-    }
+    PKSystem() = default;
 
 
     virtual void encrypt(ReadonlyBytes in, Bytes& out) = 0;
     virtual void encrypt(ReadonlyBytes in, Bytes& out) = 0;
     virtual void decrypt(ReadonlyBytes in, Bytes& out) = 0;
     virtual void decrypt(ReadonlyBytes in, Bytes& out) = 0;

+ 1 - 3
Userland/Libraries/LibCrypto/PK/RSA.h

@@ -60,9 +60,7 @@ public:
     {
     {
     }
     }
 
 
-    RSAPrivateKey()
-    {
-    }
+    RSAPrivateKey() = default;
 
 
     const Integer& modulus() const { return m_modulus; }
     const Integer& modulus() const { return m_modulus; }
     const Integer& private_exponent() const { return m_private_exponent; }
     const Integer& private_exponent() const { return m_private_exponent; }