1 /* Copyright (c) 2017, Google Inc.
3 * Permission to use, copy, modify, and/or distribute this software for any
4 * purpose with or without fee is hereby granted, provided that the above
5 * copyright notice and this permission notice appear in all copies.
7 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
10 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
12 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
13 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
15 #ifndef OPENSSL_HEADER_PKCS7_INTERNAL_H
16 #define OPENSSL_HEADER_PKCS7_INTERNAL_H
18 #include <openssl/base.h>
20 #if defined(__cplusplus)
25 // pkcs7_parse_header reads the non-certificate/non-CRL prefix of a PKCS#7
26 // SignedData blob from |cbs| and sets |*out| to point to the rest of the
27 // input. If the input is in BER format, then |*der_bytes| will be set to a
28 // pointer that needs to be freed by the caller once they have finished
29 // processing |*out| (which will be pointing into |*der_bytes|).
31 // It returns one on success or zero on error. On error, |*der_bytes| is
33 int pkcs7_parse_header(uint8_t **der_bytes, CBS *out, CBS *cbs);
35 // pkcs7_bundle writes a PKCS#7, SignedData structure to |out| and then calls
36 // |cb| with a CBB to which certificate or CRL data can be written, and the
37 // opaque context pointer, |arg|. The callback can return zero to indicate an
40 // pkcs7_bundle returns one on success or zero on error.
41 int pkcs7_bundle(CBB *out, int (*cb)(CBB *out, const void *arg),
45 #if defined(__cplusplus)
49 #endif // OPENSSL_HEADER_PKCS7_INTERNAL_H