19 const uint16_t random_u16 = fuzzed_data_provider.
ConsumeIntegral<uint16_t>();
20 const uint32_t random_u32 = fuzzed_data_provider.ConsumeIntegral<uint32_t>();
21 const uint64_t random_u64 = fuzzed_data_provider.ConsumeIntegral<uint64_t>();
26 std::array<uint8_t, 2> writele16_arr;
27 WriteLE16(writele16_arr.data(), random_u16);
30 std::array<uint8_t, 4> writele32_arr;
31 WriteLE32(writele32_arr.data(), random_u32);
34 std::array<uint8_t, 8> writele64_arr;
35 WriteLE64(writele64_arr.data(), random_u64);
38 std::array<uint8_t, 2> writebe16_arr;
39 WriteBE16(writebe16_arr.data(), random_u16);
42 std::array<uint8_t, 4> writebe32_arr;
43 WriteBE32(writebe32_arr.data(), random_u32);
46 std::array<uint8_t, 8> writebe64_arr;
47 WriteBE64(writebe64_arr.data(), random_u64);
50 const uint16_t readle16_result =
ReadLE16(random_bytes_2.data());
51 std::array<uint8_t, 2> readle16_arr;
52 WriteLE16(readle16_arr.data(), readle16_result);
53 assert(std::memcmp(random_bytes_2.data(), readle16_arr.data(), 2) == 0);
55 const uint32_t readle32_result =
ReadLE32(random_bytes_4.data());
56 std::array<uint8_t, 4> readle32_arr;
57 WriteLE32(readle32_arr.data(), readle32_result);
58 assert(std::memcmp(random_bytes_4.data(), readle32_arr.data(), 4) == 0);
60 const uint64_t readle64_result =
ReadLE64(random_bytes_8.data());
61 std::array<uint8_t, 8> readle64_arr;
62 WriteLE64(readle64_arr.data(), readle64_result);
63 assert(std::memcmp(random_bytes_8.data(), readle64_arr.data(), 8) == 0);
65 const uint32_t readbe32_result =
ReadBE32(random_bytes_4.data());
66 std::array<uint8_t, 4> readbe32_arr;
67 WriteBE32(readbe32_arr.data(), readbe32_result);
68 assert(std::memcmp(random_bytes_4.data(), readbe32_arr.data(), 4) == 0);
70 const uint64_t readbe64_result =
ReadBE64(random_bytes_8.data());
71 std::array<uint8_t, 8> readbe64_arr;
72 WriteBE64(readbe64_arr.data(), readbe64_result);
73 assert(std::memcmp(random_bytes_8.data(), readbe64_arr.data(), 8) == 0);
static void WriteBE16(unsigned char *ptr, uint16_t x)
static uint16_t ReadLE16(const unsigned char *ptr)
static void WriteLE16(unsigned char *ptr, uint16_t x)
static uint64_t ReadBE64(const unsigned char *ptr)
static uint64_t ReadLE64(const unsigned char *ptr)
static uint16_t ReadBE16(const unsigned char *ptr)
static uint32_t ReadLE32(const unsigned char *ptr)
static void WriteBE32(unsigned char *ptr, uint32_t x)
static void WriteLE32(unsigned char *ptr, uint32_t x)
static void WriteBE64(unsigned char *ptr, uint64_t x)
static uint32_t ReadBE32(const unsigned char *ptr)
static void WriteLE64(unsigned char *ptr, uint64_t x)
FUZZ_TARGET(crypto_common)
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...