]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blame - crypto/asymmetric_keys/x509_parser.h
Merge tag 'pci-v5.11-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaa...
[mirror_ubuntu-hirsute-kernel.git] / crypto / asymmetric_keys / x509_parser.h
CommitLineData
b4d0d230 1/* SPDX-License-Identifier: GPL-2.0-or-later */
c26fd69f
DH
2/* X.509 certificate parser internal definitions
3 *
4 * Copyright (C) 2012 Red Hat, Inc. All Rights Reserved.
5 * Written by David Howells (dhowells@redhat.com)
c26fd69f
DH
6 */
7
57be4a78 8#include <linux/time.h>
c26fd69f 9#include <crypto/public_key.h>
146aa8b1 10#include <keys/asymmetric-type.h>
c26fd69f
DH
11
12struct x509_certificate {
13 struct x509_certificate *next;
84aabd46 14 struct x509_certificate *signer; /* Certificate that signed this one */
c26fd69f 15 struct public_key *pub; /* Public key details */
77d0910d 16 struct public_key_signature *sig; /* Signature parameters */
c26fd69f
DH
17 char *issuer; /* Name of certificate issuer */
18 char *subject; /* Name of certificate subject */
b92e6570 19 struct asymmetric_key_id *id; /* Issuer + Serial number */
8dd60980 20 struct asymmetric_key_id *skid; /* Subject + subjectKeyId (optional) */
fd19a3d1
DH
21 time64_t valid_from;
22 time64_t valid_to;
c26fd69f 23 const void *tbs; /* Signed data */
b426beb6
DH
24 unsigned tbs_size; /* Size of signed data */
25 unsigned raw_sig_size; /* Size of sigature */
26 const void *raw_sig; /* Signature data */
84aabd46
DH
27 const void *raw_serial; /* Raw serial number in ASN.1 */
28 unsigned raw_serial_size;
29 unsigned raw_issuer_size;
30 const void *raw_issuer; /* Raw issuer name in ASN.1 */
31 const void *raw_subject; /* Raw subject name in ASN.1 */
32 unsigned raw_subject_size;
dd2f6c44
DH
33 unsigned raw_skid_size;
34 const void *raw_skid; /* Raw subjectKeyId in ASN.1 */
84aabd46
DH
35 unsigned index;
36 bool seen; /* Infinite recursion prevention */
37 bool verified;
6c2dc5ae
DH
38 bool self_signed; /* T if self-signed (check unsupported_sig too) */
39 bool unsupported_key; /* T if key uses unsupported crypto */
40 bool unsupported_sig; /* T if signature uses unsupported crypto */
43652956 41 bool blacklisted;
c26fd69f
DH
42};
43
44/*
45 * x509_cert_parser.c
46 */
47extern void x509_free_certificate(struct x509_certificate *cert);
48extern struct x509_certificate *x509_cert_parse(const void *data, size_t datalen);
fd19a3d1
DH
49extern int x509_decode_time(time64_t *_t, size_t hdrlen,
50 unsigned char tag,
51 const unsigned char *value, size_t vlen);
b426beb6
DH
52
53/*
54 * x509_public_key.c
55 */
56extern int x509_get_sig_params(struct x509_certificate *cert);
6c2dc5ae 57extern int x509_check_for_self_signed(struct x509_certificate *cert);