]>
git.ipfire.org Git - thirdparty/openssl.git/blob - fuzz/smime.c
2 * Copyright 2023 The OpenSSL Project Authors. All Rights Reserved.
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.
12 #include <openssl/err.h>
13 #include <openssl/pkcs7.h>
14 #include <openssl/x509.h>
17 int FuzzerInitialize(int *argc
, char ***argv
)
22 int FuzzerTestOneInput(const uint8_t *buf
, size_t len
)
24 BIO
*b
= BIO_new_mem_buf(buf
, len
);
25 PKCS7
*p7
= SMIME_read_PKCS7(b
, NULL
);
28 STACK_OF(PKCS7_SIGNER_INFO
) *p7si
= PKCS7_get_signer_info(p7
);
31 for (i
= 0; i
< sk_PKCS7_SIGNER_INFO_num(p7si
); i
++) {
32 STACK_OF(X509_ALGOR
) *algs
;
34 PKCS7_cert_from_signer_info(p7
,
35 sk_PKCS7_SIGNER_INFO_value(p7si
, i
));
36 algs
= PKCS7_get_smimecap(sk_PKCS7_SIGNER_INFO_value(p7si
, i
));
37 sk_X509_ALGOR_pop_free(algs
, X509_ALGOR_free
);
47 void FuzzerCleanup(void)