Home | History | Annotate | Line # | Download | only in fuzz
conf.c revision 1.1
      1  1.1  christos /*
      2  1.1  christos  * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
      3  1.1  christos  *
      4  1.1  christos  * Licensed under the OpenSSL licenses, (the "License");
      5  1.1  christos  * you may not use this file except in compliance with the License.
      6  1.1  christos  * You may obtain a copy of the License at
      7  1.1  christos  * https://www.openssl.org/source/license.html
      8  1.1  christos  * or in the file LICENSE in the source distribution.
      9  1.1  christos  */
     10  1.1  christos 
     11  1.1  christos /*
     12  1.1  christos  * Test configuration parsing.
     13  1.1  christos  */
     14  1.1  christos 
     15  1.1  christos #include <openssl/conf.h>
     16  1.1  christos #include "fuzzer.h"
     17  1.1  christos 
     18  1.1  christos int FuzzerInitialize(int *argc, char ***argv) {
     19  1.1  christos     return 1;
     20  1.1  christos }
     21  1.1  christos 
     22  1.1  christos int FuzzerTestOneInput(const uint8_t *buf, size_t len) {
     23  1.1  christos     CONF *conf;
     24  1.1  christos     BIO *in;
     25  1.1  christos     long eline;
     26  1.1  christos 
     27  1.1  christos     if (len == 0)
     28  1.1  christos         return 0;
     29  1.1  christos 
     30  1.1  christos     conf = NCONF_new(NULL);
     31  1.1  christos     in = BIO_new(BIO_s_mem());
     32  1.1  christos     OPENSSL_assert((size_t)BIO_write(in, buf, len) == len);
     33  1.1  christos     NCONF_load_bio(conf, in, &eline);
     34  1.1  christos     NCONF_free(conf);
     35  1.1  christos     BIO_free(in);
     36  1.1  christos 
     37  1.1  christos     return 0;
     38  1.1  christos }
     39