|
Packit Service |
084de1 |
/*
|
|
Packit Service |
084de1 |
* Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
|
|
Packit Service |
084de1 |
*
|
|
Packit Service |
084de1 |
* Licensed under the OpenSSL licenses, (the "License");
|
|
Packit Service |
084de1 |
* you may not use this file except in compliance with the License.
|
|
Packit Service |
084de1 |
* You may obtain a copy of the License at
|
|
Packit Service |
084de1 |
* https://www.openssl.org/source/license.html
|
|
Packit Service |
084de1 |
* or in the file LICENSE in the source distribution.
|
|
Packit Service |
084de1 |
*/
|
|
Packit Service |
084de1 |
|
|
Packit Service |
084de1 |
/*
|
|
Packit Service |
084de1 |
* Test configuration parsing.
|
|
Packit Service |
084de1 |
*/
|
|
Packit Service |
084de1 |
|
|
Packit Service |
084de1 |
#include <openssl/conf.h>
|
|
Packit Service |
084de1 |
#include <openssl/err.h>
|
|
Packit Service |
084de1 |
#include "fuzzer.h"
|
|
Packit Service |
084de1 |
|
|
Packit Service |
084de1 |
int FuzzerInitialize(int *argc, char ***argv)
|
|
Packit Service |
084de1 |
{
|
|
Packit Service |
084de1 |
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
|
|
Packit Service |
084de1 |
ERR_get_state();
|
|
Packit Service |
084de1 |
return 1;
|
|
Packit Service |
084de1 |
}
|
|
Packit Service |
084de1 |
|
|
Packit Service |
084de1 |
int FuzzerTestOneInput(const uint8_t *buf, size_t len)
|
|
Packit Service |
084de1 |
{
|
|
Packit Service |
084de1 |
CONF *conf;
|
|
Packit Service |
084de1 |
BIO *in;
|
|
Packit Service |
084de1 |
long eline;
|
|
Packit Service |
084de1 |
|
|
Packit Service |
084de1 |
if (len == 0)
|
|
Packit Service |
084de1 |
return 0;
|
|
Packit Service |
084de1 |
|
|
Packit Service |
084de1 |
conf = NCONF_new(NULL);
|
|
Packit Service |
084de1 |
in = BIO_new(BIO_s_mem());
|
|
Packit Service |
084de1 |
OPENSSL_assert((size_t)BIO_write(in, buf, len) == len);
|
|
Packit Service |
084de1 |
NCONF_load_bio(conf, in, &eline;;
|
|
Packit Service |
084de1 |
NCONF_free(conf);
|
|
Packit Service |
084de1 |
BIO_free(in);
|
|
Packit Service |
084de1 |
ERR_clear_error();
|
|
Packit Service |
084de1 |
|
|
Packit Service |
084de1 |
return 0;
|
|
Packit Service |
084de1 |
}
|
|
Packit Service |
084de1 |
|
|
Packit Service |
084de1 |
void FuzzerCleanup(void)
|
|
Packit Service |
084de1 |
{
|
|
Packit Service |
084de1 |
}
|