mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 11:27:35 +00:00
Everywhere: Run clang-format
This commit is contained in:
parent
0376c127f6
commit
086969277e
1665 changed files with 8479 additions and 8479 deletions
|
@ -197,13 +197,13 @@ void AESCipherKey::expand_decrypt_key(ReadonlyBytes user_key, size_t bits)
|
|||
}
|
||||
}
|
||||
|
||||
void AESCipher::encrypt_block(const AESCipherBlock& in, AESCipherBlock& out)
|
||||
void AESCipher::encrypt_block(AESCipherBlock const& in, AESCipherBlock& out)
|
||||
{
|
||||
u32 s0, s1, s2, s3, t0, t1, t2, t3;
|
||||
size_t r { 0 };
|
||||
|
||||
const auto& dec_key = key();
|
||||
const auto* round_keys = dec_key.round_keys();
|
||||
auto const& dec_key = key();
|
||||
auto const* round_keys = dec_key.round_keys();
|
||||
|
||||
s0 = get_key(in.bytes().offset_pointer(0)) ^ round_keys[0];
|
||||
s1 = get_key(in.bytes().offset_pointer(4)) ^ round_keys[1];
|
||||
|
@ -289,13 +289,13 @@ void AESCipher::encrypt_block(const AESCipherBlock& in, AESCipherBlock& out)
|
|||
// clang-format on
|
||||
}
|
||||
|
||||
void AESCipher::decrypt_block(const AESCipherBlock& in, AESCipherBlock& out)
|
||||
void AESCipher::decrypt_block(AESCipherBlock const& in, AESCipherBlock& out)
|
||||
{
|
||||
u32 s0, s1, s2, s3, t0, t1, t2, t3;
|
||||
size_t r { 0 };
|
||||
|
||||
const auto& dec_key = key();
|
||||
const auto* round_keys = dec_key.round_keys();
|
||||
auto const& dec_key = key();
|
||||
auto const* round_keys = dec_key.round_keys();
|
||||
|
||||
s0 = get_key(in.bytes().offset_pointer(0)) ^ round_keys[0];
|
||||
s1 = get_key(in.bytes().offset_pointer(4)) ^ round_keys[1];
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
: CipherBlock(mode)
|
||||
{
|
||||
}
|
||||
AESCipherBlock(const u8* data, size_t length, PaddingMode mode = PaddingMode::CMS)
|
||||
AESCipherBlock(u8 const* data, size_t length, PaddingMode mode = PaddingMode::CMS)
|
||||
: AESCipherBlock(mode)
|
||||
{
|
||||
CipherBlock::overwrite(data, length);
|
||||
|
@ -40,7 +40,7 @@ public:
|
|||
virtual Bytes bytes() override { return Bytes { m_data, sizeof(m_data) }; }
|
||||
|
||||
virtual void overwrite(ReadonlyBytes) override;
|
||||
virtual void overwrite(const u8* data, size_t size) override { overwrite({ data, size }); }
|
||||
virtual void overwrite(u8 const* data, size_t size) override { overwrite({ data, size }); }
|
||||
|
||||
virtual void apply_initialization_vector(ReadonlyBytes ivec) override
|
||||
{
|
||||
|
@ -68,9 +68,9 @@ struct AESCipherKey : public CipherKey {
|
|||
String to_string() const;
|
||||
#endif
|
||||
|
||||
const u32* round_keys() const
|
||||
u32 const* round_keys() const
|
||||
{
|
||||
return (const u32*)m_rd_keys;
|
||||
return (u32 const*)m_rd_keys;
|
||||
}
|
||||
|
||||
AESCipherKey(ReadonlyBytes user_key, size_t key_bits, Intent intent)
|
||||
|
@ -114,11 +114,11 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual const AESCipherKey& key() const override { return m_key; };
|
||||
virtual AESCipherKey const& key() const override { return m_key; };
|
||||
virtual AESCipherKey& key() override { return m_key; };
|
||||
|
||||
virtual void encrypt_block(const BlockType& in, BlockType& out) override;
|
||||
virtual void decrypt_block(const BlockType& in, BlockType& out) override;
|
||||
virtual void encrypt_block(BlockType const& in, BlockType& out) override;
|
||||
virtual void decrypt_block(BlockType const& in, BlockType& out) override;
|
||||
|
||||
#ifndef KERNEL
|
||||
virtual String class_name() const override
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
virtual ReadonlyBytes bytes() const = 0;
|
||||
|
||||
virtual void overwrite(ReadonlyBytes) = 0;
|
||||
virtual void overwrite(const u8* data, size_t size) { overwrite({ data, size }); }
|
||||
virtual void overwrite(u8 const* data, size_t size) { overwrite({ data, size }); }
|
||||
|
||||
virtual void apply_initialization_vector(ReadonlyBytes ivec) = 0;
|
||||
|
||||
|
@ -102,15 +102,15 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual const KeyType& key() const = 0;
|
||||
virtual KeyType const& key() const = 0;
|
||||
virtual KeyType& key() = 0;
|
||||
|
||||
constexpr static size_t block_size() { return BlockType::block_size(); }
|
||||
|
||||
PaddingMode padding_mode() const { return m_padding_mode; }
|
||||
|
||||
virtual void encrypt_block(const BlockType& in, BlockType& out) = 0;
|
||||
virtual void decrypt_block(const BlockType& in, BlockType& out) = 0;
|
||||
virtual void encrypt_block(BlockType const& in, BlockType& out) = 0;
|
||||
virtual void decrypt_block(BlockType const& in, BlockType& out) = 0;
|
||||
|
||||
#ifndef KERNEL
|
||||
virtual String class_name() const = 0;
|
||||
|
|
|
@ -99,7 +99,7 @@ public:
|
|||
// FIXME: Add back the default intent parameter once clang-11 is the default in GitHub Actions.
|
||||
// Once added back, remove the parameter where it's constructed in get_random_bytes in Kernel/Random.h.
|
||||
template<typename KeyType, typename... Args>
|
||||
explicit constexpr CTR(const KeyType& user_key, size_t key_bits, Intent, Args... args)
|
||||
explicit constexpr CTR(KeyType const& user_key, size_t key_bits, Intent, Args... args)
|
||||
: Mode<T>(user_key, key_bits, Intent::Encryption, args...)
|
||||
{
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ public:
|
|||
this->encrypt_or_stream(&in, out, ivec, ivec_out);
|
||||
}
|
||||
|
||||
void key_stream(Bytes& out, const Bytes& ivec = {}, Bytes* ivec_out = nullptr)
|
||||
void key_stream(Bytes& out, Bytes const& ivec = {}, Bytes* ivec_out = nullptr)
|
||||
{
|
||||
this->encrypt_or_stream(nullptr, out, ivec, ivec_out);
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ private:
|
|||
protected:
|
||||
constexpr static IncrementFunctionType increment {};
|
||||
|
||||
void encrypt_or_stream(const ReadonlyBytes* in, Bytes& out, ReadonlyBytes ivec, Bytes* ivec_out = nullptr)
|
||||
void encrypt_or_stream(ReadonlyBytes const* in, Bytes& out, ReadonlyBytes ivec, Bytes* ivec_out = nullptr)
|
||||
{
|
||||
size_t length;
|
||||
if (in) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue