19 const bool pad = fuzzed_data_provider.ConsumeBool();
26 std::vector<uint8_t> ciphertext(plaintext.size() +
AES_BLOCKSIZE);
27 const int encrypt_ret = encrypt.Encrypt(plaintext.data(), plaintext.size(), ciphertext.data());
28 ciphertext.resize(encrypt_ret);
29 std::vector<uint8_t> decrypted_plaintext(ciphertext.size());
30 const int decrypt_ret = decrypt.Decrypt(ciphertext.data(), ciphertext.size(), decrypted_plaintext.data());
31 decrypted_plaintext.resize(decrypt_ret);
32 assert(decrypted_plaintext == plaintext || (!pad && plaintext.size() %
AES_BLOCKSIZE != 0 && encrypt_ret == 0 && decrypt_ret == 0));
static const int AES256_KEYSIZE
static const int AES_BLOCKSIZE
FUZZ_TARGET(crypto_aes256cbc)
#define LIMITED_WHILE(condition, limit)
Can be used to limit a theoretically unbounded loop.
std::vector< B > ConsumeFixedLengthByteVector(FuzzedDataProvider &fuzzed_data_provider, const size_t length) noexcept
Returns a byte vector of specified size regardless of the number of remaining bytes available from th...
std::vector< B > ConsumeRandomLengthByteVector(FuzzedDataProvider &fuzzed_data_provider, const std::optional< size_t > &max_length=std::nullopt) noexcept