Thomas Gleixner | b4d0d23 | 2019-05-20 19:08:01 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
David Howells | 2e3fadb | 2014-07-01 16:40:19 +0100 | [diff] [blame] | 2 | /* 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 Howells | 2e3fadb | 2014-07-01 16:40:19 +0100 | [diff] [blame] | 6 | */ |
| 7 | |
David Howells | 99db443 | 2015-08-05 15:22:27 +0100 | [diff] [blame] | 8 | #ifndef _CRYPTO_PKCS7_H |
| 9 | #define _CRYPTO_PKCS7_H |
| 10 | |
David Howells | e68503b | 2016-04-06 16:14:24 +0100 | [diff] [blame] | 11 | #include <linux/verification.h> |
Thiago Jung Bauermann | e201af1 | 2019-06-27 23:19:26 -0300 | [diff] [blame] | 12 | #include <linux/hash_info.h> |
David Howells | 99db443 | 2015-08-05 15:22:27 +0100 | [diff] [blame] | 13 | #include <crypto/public_key.h> |
| 14 | |
David Howells | 08815b6 | 2014-07-01 16:40:20 +0100 | [diff] [blame] | 15 | struct key; |
David Howells | 2e3fadb | 2014-07-01 16:40:19 +0100 | [diff] [blame] | 16 | struct pkcs7_message; |
| 17 | |
| 18 | /* |
| 19 | * pkcs7_parser.c |
| 20 | */ |
| 21 | extern struct pkcs7_message *pkcs7_parse_message(const void *data, |
| 22 | size_t datalen); |
| 23 | extern void pkcs7_free_message(struct pkcs7_message *pkcs7); |
| 24 | |
| 25 | extern int pkcs7_get_content_data(const struct pkcs7_message *pkcs7, |
| 26 | const void **_data, size_t *_datalen, |
David Howells | e68503b | 2016-04-06 16:14:24 +0100 | [diff] [blame] | 27 | size_t *_headerlen); |
David Howells | a473035 | 2014-07-01 16:40:19 +0100 | [diff] [blame] | 28 | |
| 29 | /* |
David Howells | 08815b6 | 2014-07-01 16:40:20 +0100 | [diff] [blame] | 30 | * pkcs7_trust.c |
| 31 | */ |
| 32 | extern int pkcs7_validate_trust(struct pkcs7_message *pkcs7, |
David Howells | bda850c | 2016-04-06 16:14:24 +0100 | [diff] [blame] | 33 | struct key *trust_keyring); |
David Howells | 08815b6 | 2014-07-01 16:40:20 +0100 | [diff] [blame] | 34 | |
| 35 | /* |
David Howells | a473035 | 2014-07-01 16:40:19 +0100 | [diff] [blame] | 36 | * pkcs7_verify.c |
| 37 | */ |
David Howells | 99db443 | 2015-08-05 15:22:27 +0100 | [diff] [blame] | 38 | extern int pkcs7_verify(struct pkcs7_message *pkcs7, |
| 39 | enum key_being_used_for usage); |
David Howells | 4ebdb76f | 2015-07-20 21:16:26 +0100 | [diff] [blame] | 40 | |
| 41 | extern int pkcs7_supply_detached_data(struct pkcs7_message *pkcs7, |
| 42 | const void *data, size_t datalen); |
David Howells | 99db443 | 2015-08-05 15:22:27 +0100 | [diff] [blame] | 43 | |
Thiago Jung Bauermann | e201af1 | 2019-06-27 23:19:26 -0300 | [diff] [blame] | 44 | extern int pkcs7_get_digest(struct pkcs7_message *pkcs7, const u8 **buf, |
| 45 | u32 *len, enum hash_algo *hash_algo); |
| 46 | |
David Howells | 99db443 | 2015-08-05 15:22:27 +0100 | [diff] [blame] | 47 | #endif /* _CRYPTO_PKCS7_H */ |