xref: /linux/include/crypto/pkcs7.h (revision e201af16)
1b4d0d230SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
22e3fadbfSDavid Howells /* PKCS#7 crypto data parser
32e3fadbfSDavid Howells  *
42e3fadbfSDavid Howells  * Copyright (C) 2012 Red Hat, Inc. All Rights Reserved.
52e3fadbfSDavid Howells  * Written by David Howells (dhowells@redhat.com)
62e3fadbfSDavid Howells  */
72e3fadbfSDavid Howells 
899db4435SDavid Howells #ifndef _CRYPTO_PKCS7_H
999db4435SDavid Howells #define _CRYPTO_PKCS7_H
1099db4435SDavid Howells 
11e68503bdSDavid Howells #include <linux/verification.h>
12*e201af16SThiago Jung Bauermann #include <linux/hash_info.h>
1399db4435SDavid Howells #include <crypto/public_key.h>
1499db4435SDavid Howells 
1508815b62SDavid Howells struct key;
162e3fadbfSDavid Howells struct pkcs7_message;
172e3fadbfSDavid Howells 
182e3fadbfSDavid Howells /*
192e3fadbfSDavid Howells  * pkcs7_parser.c
202e3fadbfSDavid Howells  */
212e3fadbfSDavid Howells extern struct pkcs7_message *pkcs7_parse_message(const void *data,
222e3fadbfSDavid Howells 						 size_t datalen);
232e3fadbfSDavid Howells extern void pkcs7_free_message(struct pkcs7_message *pkcs7);
242e3fadbfSDavid Howells 
252e3fadbfSDavid Howells extern int pkcs7_get_content_data(const struct pkcs7_message *pkcs7,
262e3fadbfSDavid Howells 				  const void **_data, size_t *_datalen,
27e68503bdSDavid Howells 				  size_t *_headerlen);
28a4730357SDavid Howells 
29a4730357SDavid Howells /*
3008815b62SDavid Howells  * pkcs7_trust.c
3108815b62SDavid Howells  */
3208815b62SDavid Howells extern int pkcs7_validate_trust(struct pkcs7_message *pkcs7,
33bda850cdSDavid Howells 				struct key *trust_keyring);
3408815b62SDavid Howells 
3508815b62SDavid Howells /*
36a4730357SDavid Howells  * pkcs7_verify.c
37a4730357SDavid Howells  */
3899db4435SDavid Howells extern int pkcs7_verify(struct pkcs7_message *pkcs7,
3999db4435SDavid Howells 			enum key_being_used_for usage);
404ebdb76fSDavid Howells 
414ebdb76fSDavid Howells extern int pkcs7_supply_detached_data(struct pkcs7_message *pkcs7,
424ebdb76fSDavid Howells 				      const void *data, size_t datalen);
4399db4435SDavid Howells 
44*e201af16SThiago Jung Bauermann extern int pkcs7_get_digest(struct pkcs7_message *pkcs7, const u8 **buf,
45*e201af16SThiago Jung Bauermann 			    u32 *len, enum hash_algo *hash_algo);
46*e201af16SThiago Jung Bauermann 
4799db4435SDavid Howells #endif /* _CRYPTO_PKCS7_H */
48