2
0

conf.c 1020 B

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