mutators.h (1267B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 3 * You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 #ifndef TLS_MUTATORS_H_ 6 #define TLS_MUTATORS_H_ 7 8 #include <cstddef> 9 #include <cstdint> 10 11 // Number of additional bytes in the TLS header. 12 // Used to properly skip DTLS seqnums. 13 #ifdef IS_DTLS_FUZZ 14 #define EXTRA_HEADER_BYTES 8 15 #else 16 #define EXTRA_HEADER_BYTES 0 17 #endif 18 19 namespace TlsMutators { 20 21 size_t DropRecord(uint8_t *data, size_t size, size_t maxSize, 22 unsigned int seed); 23 size_t ShuffleRecords(uint8_t *data, size_t size, size_t maxSize, 24 unsigned int seed); 25 size_t DuplicateRecord(uint8_t *data, size_t size, size_t maxSize, 26 unsigned int seed); 27 size_t TruncateRecord(uint8_t *data, size_t size, size_t maxSize, 28 unsigned int seed); 29 size_t FragmentRecord(uint8_t *data, size_t size, size_t maxSize, 30 unsigned int seed); 31 32 size_t CrossOver(const uint8_t *data1, size_t size1, const uint8_t *data2, 33 size_t size2, uint8_t *out, size_t maxOutSize, 34 unsigned int seed); 35 36 } // namespace TlsMutators 37 38 #endif // TLS_MUTATORS_H_