blob: 38ec7f5f90411abd8606c0de151739abb660b50f [file] [log] [blame]
Thomas Gleixnerb4d0d232019-05-20 19:08:01 +02001/* SPDX-License-Identifier: GPL-2.0-or-later */
David Howells2e3fadb2014-07-01 16:40:19 +01002/* PKCS#7 crypto data parser
3 *
4 * Copyright (C) 2012 Red Hat, Inc. All Rights Reserved.
5 * Written by David Howells (dhowells@redhat.com)
David Howells2e3fadb2014-07-01 16:40:19 +01006 */
7
David Howells99db4432015-08-05 15:22:27 +01008#ifndef _CRYPTO_PKCS7_H
9#define _CRYPTO_PKCS7_H
10
David Howellse68503b2016-04-06 16:14:24 +010011#include <linux/verification.h>
Thiago Jung Bauermanne201af12019-06-27 23:19:26 -030012#include <linux/hash_info.h>
David Howells99db4432015-08-05 15:22:27 +010013#include <crypto/public_key.h>
14
David Howells08815b62014-07-01 16:40:20 +010015struct key;
David Howells2e3fadb2014-07-01 16:40:19 +010016struct pkcs7_message;
17
18/*
19 * pkcs7_parser.c
20 */
21extern struct pkcs7_message *pkcs7_parse_message(const void *data,
22 size_t datalen);
23extern void pkcs7_free_message(struct pkcs7_message *pkcs7);
24
25extern int pkcs7_get_content_data(const struct pkcs7_message *pkcs7,
26 const void **_data, size_t *_datalen,
David Howellse68503b2016-04-06 16:14:24 +010027 size_t *_headerlen);
David Howellsa4730352014-07-01 16:40:19 +010028
29/*
David Howells08815b62014-07-01 16:40:20 +010030 * pkcs7_trust.c
31 */
32extern int pkcs7_validate_trust(struct pkcs7_message *pkcs7,
David Howellsbda850c2016-04-06 16:14:24 +010033 struct key *trust_keyring);
David Howells08815b62014-07-01 16:40:20 +010034
35/*
David Howellsa4730352014-07-01 16:40:19 +010036 * pkcs7_verify.c
37 */
David Howells99db4432015-08-05 15:22:27 +010038extern int pkcs7_verify(struct pkcs7_message *pkcs7,
39 enum key_being_used_for usage);
David Howells4ebdb76f2015-07-20 21:16:26 +010040
41extern int pkcs7_supply_detached_data(struct pkcs7_message *pkcs7,
42 const void *data, size_t datalen);
David Howells99db4432015-08-05 15:22:27 +010043
Thiago Jung Bauermanne201af12019-06-27 23:19:26 -030044extern int pkcs7_get_digest(struct pkcs7_message *pkcs7, const u8 **buf,
45 u32 *len, enum hash_algo *hash_algo);
46
David Howells99db4432015-08-05 15:22:27 +010047#endif /* _CRYPTO_PKCS7_H */