blob: 91949f92bc72deea1f71869e2c2d228905577f57 [file] [log] [blame]
David Howells2e3fadb2014-07-01 16:40:19 +01001/* PKCS#7 crypto data parser internal definitions
2 *
3 * Copyright (C) 2012 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11
12#include <linux/oid_registry.h>
13#include <crypto/pkcs7.h>
14#include "x509_parser.h"
15
16#define kenter(FMT, ...) \
17 pr_devel("==> %s("FMT")\n", __func__, ##__VA_ARGS__)
18#define kleave(FMT, ...) \
19 pr_devel("<== %s()"FMT"\n", __func__, ##__VA_ARGS__)
20
21struct pkcs7_signed_info {
22 struct pkcs7_signed_info *next;
23 struct x509_certificate *signer; /* Signing certificate (in msg->certs) */
24 unsigned index;
25 bool trusted;
26
27 /* Message digest - the digest of the Content Data (or NULL) */
28 const void *msgdigest;
29 unsigned msgdigest_len;
30
31 /* Authenticated Attribute data (or NULL) */
32 unsigned authattrs_len;
33 const void *authattrs;
34
35 /* Issuing cert serial number and issuer's name */
David Howells46963b72014-09-16 17:36:13 +010036 struct asymmetric_key_id *signing_cert_id;
David Howells2e3fadb2014-07-01 16:40:19 +010037
38 /* Message signature.
39 *
40 * This contains the generated digest of _either_ the Content Data or
41 * the Authenticated Attributes [RFC2315 9.3]. If the latter, one of
42 * the attributes contains the digest of the the Content Data within
43 * it.
44 */
45 struct public_key_signature sig;
46};
47
48struct pkcs7_message {
49 struct x509_certificate *certs; /* Certificate list */
50 struct x509_certificate *crl; /* Revocation list */
51 struct pkcs7_signed_info *signed_infos;
52
53 /* Content Data (or NULL) */
54 enum OID data_type; /* Type of Data */
55 size_t data_len; /* Length of Data */
56 size_t data_hdrlen; /* Length of Data ASN.1 header */
57 const void *data; /* Content Data (or 0) */
58};