MCPcopy Create free account
hub / github.com/ElementsProject/elements / FUZZ_TARGET

Function FUZZ_TARGET

src/test/fuzz/crypto_aes256.cpp:14–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12#include <vector>
13
14FUZZ_TARGET(crypto_aes256)
15{
16 FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()};
17 const std::vector<uint8_t> key = ConsumeFixedLengthByteVector(fuzzed_data_provider, AES256_KEYSIZE);
18
19 AES256Encrypt encrypt{key.data()};
20 AES256Decrypt decrypt{key.data()};
21
22 LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 10000) {
23 const std::vector<uint8_t> plaintext = ConsumeFixedLengthByteVector(fuzzed_data_provider, AES_BLOCKSIZE);
24 std::vector<uint8_t> ciphertext(AES_BLOCKSIZE);
25 encrypt.Encrypt(ciphertext.data(), plaintext.data());
26 std::vector<uint8_t> decrypted_plaintext(AES_BLOCKSIZE);
27 decrypt.Decrypt(decrypted_plaintext.data(), ciphertext.data());
28 assert(decrypted_plaintext == plaintext);
29 }
30}

Callers

nothing calls this directly

Calls 6

ConsumeBoolMethod · 0.80
dataMethod · 0.45
sizeMethod · 0.45
EncryptMethod · 0.45
DecryptMethod · 0.45

Tested by

no test coverage detected