Blame fuzz/gnutls_ext_raw_parse_fuzzer.c

Packit Service 991b93
/*
Packit Service 991b93
 * Copyright (C) 2019 Red Hat, Inc.
Packit Service 991b93
 *
Packit Service 991b93
 * Author: Nikos Mavrogiannopoulos
Packit Service 991b93
 *
Packit Service 991b93
 * This file is part of GnuTLS.
Packit Service 991b93
 *
Packit Service 991b93
 * The GnuTLS is free software; you can redistribute it and/or
Packit Service 991b93
 * modify it under the terms of the GNU Lesser General Public License
Packit Service 991b93
 * as published by the Free Software Foundation; either version 2.1 of
Packit Service 991b93
 * the License, or (at your option) any later version.
Packit Service 991b93
 *
Packit Service 991b93
 * This library is distributed in the hope that it will be useful, but
Packit Service 991b93
 * WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 991b93
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 991b93
 * Lesser General Public License for more details.
Packit Service 991b93
 *
Packit Service 991b93
 * You should have received a copy of the GNU Lesser General Public License
Packit Service 991b93
 * along with this program.  If not, see <https://www.gnu.org/licenses/>
Packit Service 991b93
 *
Packit Service 991b93
 */
Packit Service 991b93
Packit Service 991b93
#include <stdint.h>
Packit Service 991b93
Packit Service 991b93
#include <gnutls/gnutls.h>
Packit Service 991b93
Packit Service 991b93
#include "fuzzer.h"
Packit Service 991b93
Packit Service 991b93
static
Packit Service 991b93
int cb(void *ctx, unsigned tls_id, const unsigned char *data, unsigned data_size)
Packit Service 991b93
{
Packit Service 991b93
	return 0;
Packit Service 991b93
}
Packit Service 991b93
Packit Service 991b93
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
Packit Service 991b93
{
Packit Service 991b93
	gnutls_datum_t raw;
Packit Service 991b93
Packit Service 991b93
	raw.data = (unsigned char *)data;
Packit Service 991b93
	raw.size = size;
Packit Service 991b93
Packit Service 991b93
	gnutls_ext_raw_parse(NULL, cb, &raw, 0);
Packit Service 991b93
Packit Service 991b93
	gnutls_ext_raw_parse(NULL, cb, &raw, GNUTLS_EXT_RAW_FLAG_TLS_CLIENT_HELLO);
Packit Service 991b93
Packit Service 991b93
	gnutls_ext_raw_parse(NULL, cb, &raw, GNUTLS_EXT_RAW_FLAG_DTLS_CLIENT_HELLO);
Packit Service 991b93
Packit Service 991b93
	return 0;
Packit Service 991b93
}