diff options
Diffstat (limited to 'Userland/Libraries/LibCrypto/Cipher')
-rw-r--r-- | Userland/Libraries/LibCrypto/Cipher/AES.h | 7 | ||||
-rw-r--r-- | Userland/Libraries/LibCrypto/Cipher/Cipher.h | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibCrypto/Cipher/Mode/CBC.h | 12 | ||||
-rw-r--r-- | Userland/Libraries/LibCrypto/Cipher/Mode/CTR.h | 12 | ||||
-rw-r--r-- | Userland/Libraries/LibCrypto/Cipher/Mode/GCM.h | 12 | ||||
-rw-r--r-- | Userland/Libraries/LibCrypto/Cipher/Mode/Mode.h | 8 |
6 files changed, 45 insertions, 8 deletions
diff --git a/Userland/Libraries/LibCrypto/Cipher/AES.h b/Userland/Libraries/LibCrypto/Cipher/AES.h index 796c653167..654475f61d 100644 --- a/Userland/Libraries/LibCrypto/Cipher/AES.h +++ b/Userland/Libraries/LibCrypto/Cipher/AES.h @@ -119,7 +119,12 @@ public: virtual void encrypt_block(const BlockType& in, BlockType& out) override; virtual void decrypt_block(const BlockType& in, BlockType& out) override; - virtual String class_name() const override { return "AES"; } +#ifndef KERNEL + virtual String class_name() const override + { + return "AES"; + } +#endif protected: AESCipherKey m_key; diff --git a/Userland/Libraries/LibCrypto/Cipher/Cipher.h b/Userland/Libraries/LibCrypto/Cipher/Cipher.h index 436ff6e2f2..d8ab4d1aac 100644 --- a/Userland/Libraries/LibCrypto/Cipher/Cipher.h +++ b/Userland/Libraries/LibCrypto/Cipher/Cipher.h @@ -111,7 +111,9 @@ public: virtual void encrypt_block(const BlockType& in, BlockType& out) = 0; virtual void decrypt_block(const BlockType& in, BlockType& out) = 0; +#ifndef KERNEL virtual String class_name() const = 0; +#endif protected: virtual ~Cipher() = default; diff --git a/Userland/Libraries/LibCrypto/Cipher/Mode/CBC.h b/Userland/Libraries/LibCrypto/Cipher/Mode/CBC.h index a32a0874e3..9cc3210a7e 100644 --- a/Userland/Libraries/LibCrypto/Cipher/Mode/CBC.h +++ b/Userland/Libraries/LibCrypto/Cipher/Mode/CBC.h @@ -6,11 +6,14 @@ #pragma once -#include <AK/String.h> #include <AK/StringBuilder.h> #include <AK/StringView.h> #include <LibCrypto/Cipher/Mode/Mode.h> +#ifndef KERNEL +# include <AK/String.h> +#endif + namespace Crypto { namespace Cipher { @@ -26,6 +29,7 @@ public: { } +#ifndef KERNEL virtual String class_name() const override { StringBuilder builder; @@ -33,8 +37,12 @@ public: builder.append("_CBC"); return builder.build(); } +#endif - virtual size_t IV_length() const override { return IVSizeInBits / 8; } + virtual size_t IV_length() const override + { + return IVSizeInBits / 8; + } virtual void encrypt(ReadonlyBytes in, Bytes& out, ReadonlyBytes ivec = {}, Bytes* ivec_out = nullptr) override { diff --git a/Userland/Libraries/LibCrypto/Cipher/Mode/CTR.h b/Userland/Libraries/LibCrypto/Cipher/Mode/CTR.h index 8a0d557083..979ca281ed 100644 --- a/Userland/Libraries/LibCrypto/Cipher/Mode/CTR.h +++ b/Userland/Libraries/LibCrypto/Cipher/Mode/CTR.h @@ -6,11 +6,14 @@ #pragma once -#include <AK/String.h> #include <AK/StringBuilder.h> #include <AK/StringView.h> #include <LibCrypto/Cipher/Mode/Mode.h> +#ifndef KERNEL +# include <AK/String.h> +#endif + namespace Crypto { namespace Cipher { @@ -101,6 +104,7 @@ public: { } +#ifndef KERNEL virtual String class_name() const override { StringBuilder builder; @@ -108,8 +112,12 @@ public: builder.append("_CTR"); return builder.build(); } +#endif - virtual size_t IV_length() const override { return IVSizeInBits / 8; } + virtual size_t IV_length() const override + { + return IVSizeInBits / 8; + } virtual void encrypt(ReadonlyBytes in, Bytes& out, ReadonlyBytes ivec = {}, Bytes* ivec_out = nullptr) override { diff --git a/Userland/Libraries/LibCrypto/Cipher/Mode/GCM.h b/Userland/Libraries/LibCrypto/Cipher/Mode/GCM.h index d5cb048ba9..b50713bd69 100644 --- a/Userland/Libraries/LibCrypto/Cipher/Mode/GCM.h +++ b/Userland/Libraries/LibCrypto/Cipher/Mode/GCM.h @@ -7,13 +7,16 @@ #pragma once #include <AK/OwnPtr.h> -#include <AK/String.h> #include <AK/StringBuilder.h> #include <AK/StringView.h> #include <LibCrypto/Authentication/GHash.h> #include <LibCrypto/Cipher/Mode/CTR.h> #include <LibCrypto/Verification.h> +#ifndef KERNEL +# include <AK/String.h> +#endif + namespace Crypto { namespace Cipher { @@ -40,6 +43,7 @@ public: m_ghash = Authentication::GHash(m_auth_key); } +#ifndef KERNEL virtual String class_name() const override { StringBuilder builder; @@ -47,8 +51,12 @@ public: builder.append("_GCM"); return builder.build(); } +#endif - virtual size_t IV_length() const override { return IVSizeInBits / 8; } + virtual size_t IV_length() const override + { + return IVSizeInBits / 8; + } // FIXME: This overload throws away the auth stuff, think up a better way to return more than a single bytebuffer. virtual void encrypt(ReadonlyBytes in, Bytes& out, ReadonlyBytes ivec = {}, Bytes* = nullptr) override diff --git a/Userland/Libraries/LibCrypto/Cipher/Mode/Mode.h b/Userland/Libraries/LibCrypto/Cipher/Mode/Mode.h index 0daf56eac6..6546c5a9c8 100644 --- a/Userland/Libraries/LibCrypto/Cipher/Mode/Mode.h +++ b/Userland/Libraries/LibCrypto/Cipher/Mode/Mode.h @@ -35,8 +35,14 @@ public: return ByteBuffer::create_uninitialized(input_size + T::block_size() - remainder); } +#ifndef KERNEL virtual String class_name() const = 0; - T& cipher() { return m_cipher; } +#endif + + T& cipher() + { + return m_cipher; + } protected: virtual void prune_padding(Bytes& data) |