Coverage Report

Created: 2025-03-09 06:52

/src/libressl.fuzzers/crl.c
Line
Count
Source (jump to first uncovered line)
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
#include <openssl/x509.h>
12
#include <openssl/bio.h>
13
#include <openssl/err.h>
14
#include "fuzzer.h"
15
16
int FuzzerInitialize(int *argc, char ***argv)
17
16
{
18
16
    OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
19
16
    return 1;
20
16
}
21
22
int FuzzerTestOneInput(const uint8_t *buf, size_t len)
23
17.0k
{
24
17.0k
    const unsigned char *p = buf;
25
17.0k
    unsigned char *der = NULL;
26
27
17.0k
    X509_CRL *crl = d2i_X509_CRL(NULL, &p, len);
28
17.0k
    if (crl != NULL) {
29
11.9k
        BIO *bio = BIO_new(BIO_s_null());
30
11.9k
        X509_CRL_print(bio, crl);
31
11.9k
        BIO_free(bio);
32
33
11.9k
        i2d_X509_CRL(crl, &der);
34
11.9k
        OPENSSL_free(der);
35
36
11.9k
        X509_CRL_free(crl);
37
11.9k
    }
38
17.0k
    ERR_clear_error();
39
40
17.0k
    return 0;
41
17.0k
}
42
43
void FuzzerCleanup(void)
44
0
{
45
0
}