VirtualBox

source: vbox/trunk/src/libs/openssl-3.3.2/fuzz/smime.c@ 108403

最後變更 在這個檔案從108403是 108206,由 vboxsync 提交於 5 週 前

openssl-3.3.2: Exported all files to OSE and removed .scm-settings ​bugref:10757

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 1.2 KB
 
1/*
2 * Copyright 2023 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 "fuzzer.h"
12#include <openssl/err.h>
13#include <openssl/pkcs7.h>
14#include <openssl/x509.h>
15#include <stdio.h>
16
17int FuzzerInitialize(int *argc, char ***argv)
18{
19 return 1;
20}
21
22int FuzzerTestOneInput(const uint8_t *buf, size_t len)
23{
24 BIO *b = BIO_new_mem_buf(buf, len);
25 PKCS7 *p7 = SMIME_read_PKCS7(b, NULL);
26
27 if (p7 != NULL) {
28 STACK_OF(PKCS7_SIGNER_INFO) *p7si = PKCS7_get_signer_info(p7);
29 int i;
30
31 for (i = 0; i < sk_PKCS7_SIGNER_INFO_num(p7si); i++) {
32 STACK_OF(X509_ALGOR) *algs;
33
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);
38 }
39 PKCS7_free(p7);
40 }
41
42 BIO_free(b);
43 ERR_clear_error();
44 return 0;
45}
46
47void FuzzerCleanup(void)
48{
49}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette