mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 23:57:34 +00:00
Everywhere: Rename ASSERT => VERIFY
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED) Since all of these checks are done in release builds as well, let's rename them to VERIFY to prevent confusion, as everyone is used to assertions being compiled out in release. We can introduce a new ASSERT macro that is specifically for debug checks, but I'm doing this wholesale conversion first since we've accumulated thousands of these already, and it's not immediately obvious which ones are suitable for ASSERT.
This commit is contained in:
parent
b33a6a443e
commit
5d180d1f99
725 changed files with 3448 additions and 3448 deletions
|
@ -66,7 +66,7 @@ public:
|
|||
|
||||
// FIXME: We should have two of these encrypt/decrypt functions that
|
||||
// we SFINAE out based on whether the Cipher mode needs an ivec
|
||||
ASSERT(!ivec.is_empty());
|
||||
VERIFY(!ivec.is_empty());
|
||||
const auto* iv = ivec.data();
|
||||
|
||||
m_cipher_block.set_padding_mode(cipher.padding_mode());
|
||||
|
@ -77,7 +77,7 @@ public:
|
|||
m_cipher_block.overwrite(in.slice(offset, block_size));
|
||||
m_cipher_block.apply_initialization_vector(iv);
|
||||
cipher.encrypt_block(m_cipher_block, m_cipher_block);
|
||||
ASSERT(offset + block_size <= out.size());
|
||||
VERIFY(offset + block_size <= out.size());
|
||||
__builtin_memcpy(out.offset(offset), m_cipher_block.bytes().data(), block_size);
|
||||
iv = out.offset(offset);
|
||||
length -= block_size;
|
||||
|
@ -88,7 +88,7 @@ public:
|
|||
m_cipher_block.overwrite(in.slice(offset, length));
|
||||
m_cipher_block.apply_initialization_vector(iv);
|
||||
cipher.encrypt_block(m_cipher_block, m_cipher_block);
|
||||
ASSERT(offset + block_size <= out.size());
|
||||
VERIFY(offset + block_size <= out.size());
|
||||
__builtin_memcpy(out.offset(offset), m_cipher_block.bytes().data(), block_size);
|
||||
iv = out.offset(offset);
|
||||
}
|
||||
|
@ -105,14 +105,14 @@ public:
|
|||
|
||||
auto& cipher = this->cipher();
|
||||
|
||||
ASSERT(!ivec.is_empty());
|
||||
VERIFY(!ivec.is_empty());
|
||||
const auto* iv = ivec.data();
|
||||
|
||||
auto block_size = cipher.block_size();
|
||||
|
||||
// if the data is not aligned, it's not correct encrypted data
|
||||
// FIXME (ponder): Should we simply decrypt as much as we can?
|
||||
ASSERT(length % block_size == 0);
|
||||
VERIFY(length % block_size == 0);
|
||||
|
||||
m_cipher_block.set_padding_mode(cipher.padding_mode());
|
||||
size_t offset { 0 };
|
||||
|
@ -123,7 +123,7 @@ public:
|
|||
cipher.decrypt_block(m_cipher_block, m_cipher_block);
|
||||
m_cipher_block.apply_initialization_vector(iv);
|
||||
auto decrypted = m_cipher_block.bytes();
|
||||
ASSERT(offset + decrypted.size() <= out.size());
|
||||
VERIFY(offset + decrypted.size() <= out.size());
|
||||
__builtin_memcpy(out.offset(offset), decrypted.data(), decrypted.size());
|
||||
iv = slice;
|
||||
length -= block_size;
|
||||
|
|
|
@ -160,7 +160,7 @@ protected:
|
|||
{
|
||||
size_t length;
|
||||
if (in) {
|
||||
ASSERT(in->size() <= out.size());
|
||||
VERIFY(in->size() <= out.size());
|
||||
length = in->size();
|
||||
if (length == 0)
|
||||
return;
|
||||
|
@ -172,8 +172,8 @@ protected:
|
|||
|
||||
// FIXME: We should have two of these encrypt/decrypt functions that
|
||||
// we SFINAE out based on whether the Cipher mode needs an ivec
|
||||
ASSERT(!ivec.is_empty());
|
||||
ASSERT(ivec.size() >= IV_length());
|
||||
VERIFY(!ivec.is_empty());
|
||||
VERIFY(ivec.size() >= IV_length());
|
||||
|
||||
m_cipher_block.set_padding_mode(cipher.padding_mode());
|
||||
|
||||
|
@ -192,7 +192,7 @@ protected:
|
|||
}
|
||||
auto write_size = min(block_size, length);
|
||||
|
||||
ASSERT(offset + write_size <= out.size());
|
||||
VERIFY(offset + write_size <= out.size());
|
||||
__builtin_memcpy(out.offset(offset), m_cipher_block.bytes().data(), write_size);
|
||||
|
||||
increment(iv);
|
||||
|
|
|
@ -73,7 +73,7 @@ public:
|
|||
// 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
|
||||
{
|
||||
ASSERT(!ivec.is_empty());
|
||||
VERIFY(!ivec.is_empty());
|
||||
|
||||
static ByteBuffer dummy;
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ protected:
|
|||
}
|
||||
default:
|
||||
// FIXME: support other padding modes
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue