]> git.ipfire.org Git - thirdparty/openssl.git/blame - fuzz/ct.c
Implement EVP_MAC_do_all_ex()
[thirdparty/openssl.git] / fuzz / ct.c
CommitLineData
4a2c4c1a
BL
1/*
2 * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
3 *
0642931f 4 * Licensed under the Apache License 2.0 (the "License");
4a2c4c1a
BL
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/*
12 * Fuzz the SCT parser.
13 */
14
15#include <stdio.h>
16#include <openssl/ct.h>
d69d8f90 17#include <openssl/err.h>
4a2c4c1a
BL
18#include "fuzzer.h"
19
f3e911d5
KR
20int FuzzerInitialize(int *argc, char ***argv)
21{
d69d8f90
KR
22 OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
23 CRYPTO_free_ex_index(0, -1);
24 ERR_get_state();
90d28f05
BL
25 return 1;
26}
27
f3e911d5
KR
28int FuzzerTestOneInput(const uint8_t *buf, size_t len)
29{
4a2c4c1a 30 const uint8_t **pp = &buf;
e10aeee1 31 unsigned char *der = NULL;
4a2c4c1a 32 STACK_OF(SCT) *scts = d2i_SCT_LIST(NULL, pp, len);
e10aeee1
KR
33 if (scts != NULL) {
34 BIO *bio = BIO_new(BIO_s_null());
35 SCT_LIST_print(scts, bio, 4, "\n", NULL);
36 BIO_free(bio);
37
33e49fda
MC
38 if (i2d_SCT_LIST(scts, &der)) {
39 /* Silence unused result warning */
40 }
e10aeee1
KR
41 OPENSSL_free(der);
42
43 SCT_LIST_free(scts);
44 }
d69d8f90 45 ERR_clear_error();
4a2c4c1a
BL
46 return 0;
47}
ad4da7fb
KR
48
49void FuzzerCleanup(void)
50{
51}