diff options
author | Lenny Maiorani <lenny@serenityos.org> | 2022-02-26 10:32:08 -0700 |
---|---|---|
committer | Brian Gianforcaro <b.gianfo@gmail.com> | 2022-03-10 18:04:26 -0800 |
commit | f1c452059c130e82833a4600feeb80dbdfe55865 (patch) | |
tree | f53b7b5b06cc65a6e4c7e4845e089d68d90394a4 | |
parent | 59b7e6a213628a13114311e3e6a327a7f8ca2dc7 (diff) | |
download | serenity-f1c452059c130e82833a4600feeb80dbdfe55865.zip |
Libraries: Use default constructors/destructors in LibCrypto
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules
"The compiler is more likely to get the default semantics right and
you cannot implement these functions better than the compiler."
-rw-r--r-- | Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.h | 3 | ||||
-rw-r--r-- | Userland/Libraries/LibCrypto/Checksum/Adler32.h | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibCrypto/Checksum/CRC32.h | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibCrypto/Cipher/AES.h | 3 | ||||
-rw-r--r-- | Userland/Libraries/LibCrypto/Cipher/Cipher.h | 3 | ||||
-rw-r--r-- | Userland/Libraries/LibCrypto/PK/RSA.h | 3 |
6 files changed, 11 insertions, 7 deletions
diff --git a/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.h b/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.h index 3f91aa8d51..36cb4c1707 100644 --- a/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.h +++ b/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2020, Itamar S. <itamar8910@gmail.com> + * Copyright (c) 2022, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ @@ -31,7 +32,7 @@ public: explicit UnsignedBigInteger(const u8* ptr, size_t length); - UnsignedBigInteger() { } + UnsignedBigInteger() = default; static UnsignedBigInteger create_invalid(); diff --git a/Userland/Libraries/LibCrypto/Checksum/Adler32.h b/Userland/Libraries/LibCrypto/Checksum/Adler32.h index 3c4595465b..1f0292c020 100644 --- a/Userland/Libraries/LibCrypto/Checksum/Adler32.h +++ b/Userland/Libraries/LibCrypto/Checksum/Adler32.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, the SerenityOS developers. + * Copyright (c) 2020-2022, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ @@ -14,7 +14,7 @@ namespace Crypto::Checksum { class Adler32 : public ChecksumFunction<u32> { public: - Adler32() { } + Adler32() = default; Adler32(ReadonlyBytes data) { update(data); diff --git a/Userland/Libraries/LibCrypto/Checksum/CRC32.h b/Userland/Libraries/LibCrypto/Checksum/CRC32.h index 8853c38a52..97322f58e7 100644 --- a/Userland/Libraries/LibCrypto/Checksum/CRC32.h +++ b/Userland/Libraries/LibCrypto/Checksum/CRC32.h @@ -14,7 +14,7 @@ namespace Crypto::Checksum { class CRC32 : public ChecksumFunction<u32> { public: - CRC32() { } + CRC32() = default; CRC32(ReadonlyBytes data) { update(data); diff --git a/Userland/Libraries/LibCrypto/Cipher/AES.h b/Userland/Libraries/LibCrypto/Cipher/AES.h index 654475f61d..dd92484d59 100644 --- a/Userland/Libraries/LibCrypto/Cipher/AES.h +++ b/Userland/Libraries/LibCrypto/Cipher/AES.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2020, Ali Mohammad Pur <mpfard@serenityos.org> + * Copyright (c) 2022, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ @@ -81,7 +82,7 @@ struct AESCipherKey : public CipherKey { expand_decrypt_key(user_key, key_bits); } - virtual ~AESCipherKey() override { } + virtual ~AESCipherKey() override = default; size_t rounds() const { return m_rounds; } size_t length() const { return m_bits / 8; } diff --git a/Userland/Libraries/LibCrypto/Cipher/Cipher.h b/Userland/Libraries/LibCrypto/Cipher/Cipher.h index d8ab4d1aac..88178a1f38 100644 --- a/Userland/Libraries/LibCrypto/Cipher/Cipher.h +++ b/Userland/Libraries/LibCrypto/Cipher/Cipher.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2020, Ali Mohammad Pur <mpfard@serenityos.org> + * Copyright (c) 2022, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ @@ -82,7 +83,7 @@ struct CipherKey { virtual ReadonlyBytes bytes() const = 0; static bool is_valid_key_size(size_t) { return false; }; - virtual ~CipherKey() { } + virtual ~CipherKey() = default; protected: virtual void expand_encrypt_key(ReadonlyBytes user_key, size_t bits) = 0; diff --git a/Userland/Libraries/LibCrypto/PK/RSA.h b/Userland/Libraries/LibCrypto/PK/RSA.h index 23dc1b3bd5..0134728093 100644 --- a/Userland/Libraries/LibCrypto/PK/RSA.h +++ b/Userland/Libraries/LibCrypto/PK/RSA.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2020, Ali Mohammad Pur <mpfard@serenityos.org> + * Copyright (c) 2022, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ @@ -204,7 +205,7 @@ public: { } - ~RSA_PKCS1_EME() { } + ~RSA_PKCS1_EME() = default; virtual void encrypt(ReadonlyBytes in, Bytes& out) override; virtual void decrypt(ReadonlyBytes in, Bytes& out) override; |