Blame view

crypto/asymmetric_keys/pkcs7_parser.h 2.05 KB
b4d0d230c   Thomas Gleixner   treewide: Replace...
1
  /* SPDX-License-Identifier: GPL-2.0-or-later */
2e3fadbf7   David Howells   PKCS#7: Implement...
2
3
4
5
  /* PKCS#7 crypto data parser internal definitions
   *
   * Copyright (C) 2012 Red Hat, Inc. All Rights Reserved.
   * Written by David Howells (dhowells@redhat.com)
2e3fadbf7   David Howells   PKCS#7: Implement...
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
   */
  
  #include <linux/oid_registry.h>
  #include <crypto/pkcs7.h>
  #include "x509_parser.h"
  
  #define kenter(FMT, ...) \
  	pr_devel("==> %s("FMT")
  ", __func__, ##__VA_ARGS__)
  #define kleave(FMT, ...) \
  	pr_devel("<== %s()"FMT"
  ", __func__, ##__VA_ARGS__)
  
  struct pkcs7_signed_info {
  	struct pkcs7_signed_info *next;
  	struct x509_certificate *signer; /* Signing certificate (in msg->certs) */
99db44350   David Howells   PKCS#7: Appropria...
22
  	unsigned	index;
99db44350   David Howells   PKCS#7: Appropria...
23
  	bool		unsupported_crypto;	/* T if not usable due to missing crypto */
03bb79315   David Howells   PKCS#7: Handle bl...
24
  	bool		blacklisted;
2e3fadbf7   David Howells   PKCS#7: Implement...
25
26
27
28
29
30
31
32
  
  	/* Message digest - the digest of the Content Data (or NULL) */
  	const void	*msgdigest;
  	unsigned	msgdigest_len;
  
  	/* Authenticated Attribute data (or NULL) */
  	unsigned	authattrs_len;
  	const void	*authattrs;
99db44350   David Howells   PKCS#7: Appropria...
33
34
35
36
37
38
39
40
  	unsigned long	aa_set;
  #define	sinfo_has_content_type		0
  #define	sinfo_has_signing_time		1
  #define	sinfo_has_message_digest	2
  #define sinfo_has_smime_caps		3
  #define	sinfo_has_ms_opus_info		4
  #define	sinfo_has_ms_statement_type	5
  	time64_t	signing_time;
2e3fadbf7   David Howells   PKCS#7: Implement...
41

2e3fadbf7   David Howells   PKCS#7: Implement...
42
43
44
45
  	/* Message signature.
  	 *
  	 * This contains the generated digest of _either_ the Content Data or
  	 * the Authenticated Attributes [RFC2315 9.3].  If the latter, one of
1539dd785   Randy Dunlap   crypto: asymmetri...
46
  	 * the attributes contains the digest of the Content Data within it.
566a117a8   David Howells   PKCS#7: Make the ...
47
  	 *
1539dd785   Randy Dunlap   crypto: asymmetri...
48
  	 * This also contains the issuing cert serial number and issuer's name
566a117a8   David Howells   PKCS#7: Make the ...
49
  	 * [PKCS#7 or CMS ver 1] or issuing cert's SKID [CMS ver 3].
2e3fadbf7   David Howells   PKCS#7: Implement...
50
  	 */
566a117a8   David Howells   PKCS#7: Make the ...
51
  	struct public_key_signature *sig;
2e3fadbf7   David Howells   PKCS#7: Implement...
52
53
54
55
56
57
  };
  
  struct pkcs7_message {
  	struct x509_certificate *certs;	/* Certificate list */
  	struct x509_certificate *crl;	/* Revocation list */
  	struct pkcs7_signed_info *signed_infos;
60d65cacd   David Howells   PKCS#7: Support C...
58
  	u8		version;	/* Version of cert (1 -> PKCS#7 or CMS; 3 -> CMS) */
99db44350   David Howells   PKCS#7: Appropria...
59
  	bool		have_authattrs;	/* T if have authattrs */
2e3fadbf7   David Howells   PKCS#7: Implement...
60
61
62
63
64
65
66
  
  	/* Content Data (or NULL) */
  	enum OID	data_type;	/* Type of Data */
  	size_t		data_len;	/* Length of Data */
  	size_t		data_hdrlen;	/* Length of Data ASN.1 header */
  	const void	*data;		/* Content Data (or 0) */
  };