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 #include <openssl/x509.h>
12c7da899bSchristos #include <openssl/bio.h>
1313d40330Schristos #include <openssl/err.h>
14c7da899bSchristos #include "fuzzer.h"
15c7da899bSchristos
FuzzerInitialize(int * argc,char *** argv)1613d40330Schristos int FuzzerInitialize(int *argc, char ***argv)
1713d40330Schristos {
1813d40330Schristos OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
19*b0d17251Schristos ERR_clear_error();
2013d40330Schristos CRYPTO_free_ex_index(0, -1);
21c7da899bSchristos return 1;
22c7da899bSchristos }
23c7da899bSchristos
FuzzerTestOneInput(const uint8_t * buf,size_t len)2413d40330Schristos int FuzzerTestOneInput(const uint8_t *buf, size_t len)
2513d40330Schristos {
26c7da899bSchristos const unsigned char *p = buf;
27c7da899bSchristos unsigned char *der = NULL;
28c7da899bSchristos
29c7da899bSchristos X509_CRL *crl = d2i_X509_CRL(NULL, &p, len);
30c7da899bSchristos if (crl != NULL) {
31c7da899bSchristos BIO *bio = BIO_new(BIO_s_null());
32c7da899bSchristos X509_CRL_print(bio, crl);
33c7da899bSchristos BIO_free(bio);
34c7da899bSchristos
35c7da899bSchristos i2d_X509_CRL(crl, &der);
36c7da899bSchristos OPENSSL_free(der);
37c7da899bSchristos
38c7da899bSchristos X509_CRL_free(crl);
39c7da899bSchristos }
4013d40330Schristos ERR_clear_error();
4113d40330Schristos
42c7da899bSchristos return 0;
43c7da899bSchristos }
4413d40330Schristos
FuzzerCleanup(void)4513d40330Schristos void FuzzerCleanup(void)
4613d40330Schristos {
4713d40330Schristos }
48