1c7da899bSchristos /* 2c7da899bSchristos * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. 3c7da899bSchristos * 4*b0d17251Schristos * Licensed under the Apache License 2.0 (the "License"); 5c7da899bSchristos * you may not use this file except in compliance with the License. 6c7da899bSchristos * You may obtain a copy of the License at 7c7da899bSchristos * https://www.openssl.org/source/license.html 8c7da899bSchristos * or in the file LICENSE in the source distribution. 9c7da899bSchristos */ 10c7da899bSchristos 11c7da899bSchristos /* 12c7da899bSchristos * Test configuration parsing. 13c7da899bSchristos */ 14c7da899bSchristos 15c7da899bSchristos #include <openssl/conf.h> 1613d40330Schristos #include <openssl/err.h> 17c7da899bSchristos #include "fuzzer.h" 18c7da899bSchristos FuzzerInitialize(int * argc,char *** argv)1913d40330Schristosint FuzzerInitialize(int *argc, char ***argv) 2013d40330Schristos { 2113d40330Schristos OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL); 22*b0d17251Schristos ERR_clear_error(); 23c7da899bSchristos return 1; 24c7da899bSchristos } 25c7da899bSchristos FuzzerTestOneInput(const uint8_t * buf,size_t len)2613d40330Schristosint FuzzerTestOneInput(const uint8_t *buf, size_t len) 2713d40330Schristos { 28c7da899bSchristos CONF *conf; 29c7da899bSchristos BIO *in; 30c7da899bSchristos long eline; 31c7da899bSchristos 32c7da899bSchristos if (len == 0) 33c7da899bSchristos return 0; 34c7da899bSchristos 35c7da899bSchristos conf = NCONF_new(NULL); 36c7da899bSchristos in = BIO_new(BIO_s_mem()); 37c7da899bSchristos OPENSSL_assert((size_t)BIO_write(in, buf, len) == len); 38c7da899bSchristos NCONF_load_bio(conf, in, &eline); 39c7da899bSchristos NCONF_free(conf); 40c7da899bSchristos BIO_free(in); 4113d40330Schristos ERR_clear_error(); 42c7da899bSchristos 43c7da899bSchristos return 0; 44c7da899bSchristos } 4513d40330Schristos FuzzerCleanup(void)4613d40330Schristosvoid FuzzerCleanup(void) 4713d40330Schristos { 4813d40330Schristos } 49