mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-03 20:54:41 +02:00
record header fuzz
This commit is contained in:
@@ -935,7 +935,8 @@ enum fuzzer_type {
|
|||||||
FUZZ_HMAC = 0,
|
FUZZ_HMAC = 0,
|
||||||
FUZZ_ENCRYPT = 1,
|
FUZZ_ENCRYPT = 1,
|
||||||
FUZZ_SIGNATURE = 2,
|
FUZZ_SIGNATURE = 2,
|
||||||
FUZZ_HASH = 3
|
FUZZ_HASH = 3,
|
||||||
|
FUZZ_HEAD = 4
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef int (*CallbackFuzzer)(const unsigned char* buf, int sz, int type,
|
typedef int (*CallbackFuzzer)(const unsigned char* buf, int sz, int type,
|
||||||
|
@@ -2959,6 +2959,11 @@ static int GetRecordHeader(CYASSL* ssl, const byte* input, word32* inOutIdx,
|
|||||||
RecordLayerHeader* rh, word16 *size)
|
RecordLayerHeader* rh, word16 *size)
|
||||||
{
|
{
|
||||||
if (!ssl->options.dtls) {
|
if (!ssl->options.dtls) {
|
||||||
|
#ifdef HAVE_FUZZER
|
||||||
|
if (ssl->fuzzerCb)
|
||||||
|
ssl->fuzzerCb(input + *inOutIdx, RECORD_HEADER_SZ, FUZZ_HEAD,
|
||||||
|
ssl->ctx);
|
||||||
|
#endif
|
||||||
XMEMCPY(rh, input + *inOutIdx, RECORD_HEADER_SZ);
|
XMEMCPY(rh, input + *inOutIdx, RECORD_HEADER_SZ);
|
||||||
*inOutIdx += RECORD_HEADER_SZ;
|
*inOutIdx += RECORD_HEADER_SZ;
|
||||||
ato16(rh->length, size);
|
ato16(rh->length, size);
|
||||||
@@ -2974,6 +2979,12 @@ static int GetRecordHeader(CYASSL* ssl, const byte* input, word32* inOutIdx,
|
|||||||
*inOutIdx += 4; /* advance past rest of seq */
|
*inOutIdx += 4; /* advance past rest of seq */
|
||||||
ato16(input + *inOutIdx, size);
|
ato16(input + *inOutIdx, size);
|
||||||
*inOutIdx += LENGTH_SZ;
|
*inOutIdx += LENGTH_SZ;
|
||||||
|
#ifdef HAVE_FUZZER
|
||||||
|
if (ssl->fuzzerCb)
|
||||||
|
ssl->fuzzerCb(input + *inOutIdx - LENGTH_SZ - 8 - ENUM_LEN -
|
||||||
|
VERSION_SZ, ENUM_LEN + VERSION_SZ + 8 + LENGTH_SZ,
|
||||||
|
FUZZ_HEAD, ssl->ctx);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user