20#ifndef _CRYPTO_PKCS7_H
21#define _CRYPTO_PKCS7_H
23#include "ext_headers.h"
84struct lc_pkcs7_parse_context {
85 struct lc_pkcs7_message *msg;
86 struct lc_x509_certificate *certs;
87 struct lc_x509_certificate **ppcerts;
90 const uint8_t *last_oid_data;
91 size_t last_oid_datalen;
92 unsigned int x509_index;
93 unsigned int sinfo_index;
94 size_t raw_serial_size;
95 size_t raw_issuer_size;
97 const uint8_t *raw_serial;
98 const uint8_t *raw_issuer;
99 const uint8_t *raw_skid;
100 unsigned int expect_skid : 1;
185 struct lc_pkcs7_message *pkcs7);
249 const uint8_t **data,
size_t *datalen);
326 const struct lc_pkcs7_trust_store *trust_store,
347 const uint8_t *data,
size_t datalen);
373 const uint8_t **message_digest,
374 size_t *message_digest_len,
375 const struct lc_hash **hash_algo);
402 struct lc_x509_certificate *x509);
int lc_hash(const struct lc_hash *hash, const uint8_t *in, size_t inlen, uint8_t *digest)
Calculate message digest - one-shot.
int lc_pkcs7_decode(struct lc_pkcs7_message *pkcs7, const uint8_t *data, size_t datalen)
Decode a PKCS#7 message.
int lc_pkcs7_decode_ctx_set_pkcs7(struct lc_pkcs7_parse_context *ctx, struct lc_pkcs7_message *pkcs7)
Set the PKCS#7 message definition.
void lc_pkcs7_message_clear(struct lc_pkcs7_message *pkcs7)
Clear the resources used by the PKCS#7 message parsing state.
int lc_pkcs7_decode_ctx_set_aa_content_type(struct lc_pkcs7_parse_context *ctx, enum OID oid)
Set the expected authenticated attribute ContentType OID.
void lc_pkcs7_decode_ctx_clear(struct lc_pkcs7_parse_context *ctx)
Clear the context for decoding a PKCS#7 message.
int lc_pkcs7_verify(struct lc_pkcs7_message *pkcs7, const struct lc_pkcs7_trust_store *trust_store, const struct lc_verify_rules *verify_rules)
Verify a PKCS#7 message.
int lc_pkcs7_trust_store_add(struct lc_pkcs7_trust_store *trust_store, struct lc_x509_certificate *x509)
Add a certificate to a certificate trust store.
int lc_pkcs7_decode_ctx_init(struct lc_pkcs7_parse_context *ctx)
Initialize a context for decoding a PKCS#7 message.
int lc_pkcs7_get_content_data(const struct lc_pkcs7_message *pkcs7, const uint8_t **data, size_t *datalen)
Get access to the PKCS#7 encapsulated content.
int lc_pkcs7_get_digest(struct lc_pkcs7_message *pkcs7, const uint8_t **message_digest, size_t *message_digest_len, const struct lc_hash **hash_algo)
Calculate and return the message digest of the data.
int lc_pkcs7_decode_ctx(struct lc_pkcs7_parse_context *ctx, const uint8_t *data, size_t datalen)
Decode a PKCS#7 message using the provided context.
int lc_pkcs7_supply_detached_data(struct lc_pkcs7_message *pkcs7, const uint8_t *data, size_t datalen)
Supply the data needed to verify a PKCS#7 message.
void lc_pkcs7_trust_store_clear(struct lc_pkcs7_trust_store *trust_store)
Release and clear the trust store.
uint16_t required_keyusage