diff options
author | Idan Horowitz <idan.horowitz@gmail.com> | 2022-02-15 21:22:11 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-02-16 22:21:37 +0100 |
commit | 6959e7f778683d5f24c947f09e0abccc9eb4e4a4 (patch) | |
tree | 92a567cb385ab5d1ed6ba4a476b84438ce72a89d | |
parent | 7bd409dbdf0c60365da0efa642924c85e3051efe (diff) | |
download | serenity-6959e7f778683d5f24c947f09e0abccc9eb4e4a4.zip |
LibCrypto: Exclude AESCipher{Block, Key}::to_string() from the Kernel
These use infallible Strings and are not actually used in the Kernel,
so let's just ifdef them out for now.
-rw-r--r-- | Userland/Libraries/LibCrypto/Cipher/AES.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibCrypto/Cipher/AES.h | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/Userland/Libraries/LibCrypto/Cipher/AES.cpp b/Userland/Libraries/LibCrypto/Cipher/AES.cpp index 1365834158..989134d456 100644 --- a/Userland/Libraries/LibCrypto/Cipher/AES.cpp +++ b/Userland/Libraries/LibCrypto/Cipher/AES.cpp @@ -24,6 +24,7 @@ constexpr void swap_keys(u32* keys, size_t i, size_t j) keys[j] = temp; } +#ifndef KERNEL String AESCipherBlock::to_string() const { StringBuilder builder; @@ -39,6 +40,7 @@ String AESCipherKey::to_string() const builder.appendff("{:02x}", m_rd_keys[i]); return builder.build(); } +#endif void AESCipherKey::expand_encrypt_key(ReadonlyBytes user_key, size_t bits) { diff --git a/Userland/Libraries/LibCrypto/Cipher/AES.h b/Userland/Libraries/LibCrypto/Cipher/AES.h index 3e5bfd71c7..796c653167 100644 --- a/Userland/Libraries/LibCrypto/Cipher/AES.h +++ b/Userland/Libraries/LibCrypto/Cipher/AES.h @@ -6,13 +6,16 @@ #pragma once -#include <AK/String.h> #include <AK/Vector.h> #include <LibCrypto/Cipher/Cipher.h> #include <LibCrypto/Cipher/Mode/CBC.h> #include <LibCrypto/Cipher/Mode/CTR.h> #include <LibCrypto/Cipher/Mode/GCM.h> +#ifndef KERNEL +# include <AK/String.h> +#endif + namespace Crypto { namespace Cipher { @@ -44,7 +47,9 @@ public: m_data[i] ^= ivec[i]; } +#ifndef KERNEL String to_string() const; +#endif private: constexpr static size_t data_size() { return sizeof(m_data); } @@ -57,7 +62,11 @@ struct AESCipherKey : public CipherKey { virtual void expand_encrypt_key(ReadonlyBytes user_key, size_t bits) override; virtual void expand_decrypt_key(ReadonlyBytes user_key, size_t bits) override; static bool is_valid_key_size(size_t bits) { return bits == 128 || bits == 192 || bits == 256; }; + +#ifndef KERNEL String to_string() const; +#endif + const u32* round_keys() const { return (const u32*)m_rd_keys; |