File: certs.h

package info (click to toggle)
libreswan 5.2-2.3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 81,644 kB
  • sloc: ansic: 129,988; sh: 32,018; xml: 20,646; python: 10,303; makefile: 3,022; javascript: 1,506; sed: 574; yacc: 511; perl: 264; awk: 52
file content (81 lines) | stat: -rw-r--r-- 2,500 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/* Certificate support for IKE authentication
 * Copyright (C) 2002-2004 Andreas Steffen, Zuercher Hochschule Winterthur
 * Copyright (C) 2003-2006 Michael Richardson <mcr@xelerance.com>
 * Copyright (C) 2009 Paul Wouters <paul@xelerance.com>
 * Copyright (C) 2009 Avesh Agarwal <avagarwa@redhat.com>
 * Copyright (C) 2012-2013 Paul Wouters <paul@libreswan.org>
 * Copyright (C) 2017 Paul Wouters <pwouters@redhat.com>
 * Copyright (C) 2013 Tuomo Soini <tis@foobar.fi>
 * Copyright (C) 2013 Matt Rogers <mrogers@redhat.com>
 * Copyright (C) 2019 Andrew Cagney <cagney@gnu.org>
 * Copyright (C) 2019 D. Hugh Redelmeier <hugh@mimosa.com>
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2 of the License, or (at your
 * option) any later version.  See <https://www.gnu.org/licenses/gpl2.txt>.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * for more details.
 *
 */

#ifndef CERTS_H
#define CERTS_H

/* workaround for NSS/NSPR bug on MIPS with cert.h */
#ifndef _ABIO32
# define _ABIO32        1
#endif

#ifndef _ABIN32
# define _ABIN32        2
#endif

#ifndef _ABI64
# define _ABI64         3
#endif

#include <cert.h> /* NSS */
#include "x509.h"

struct show;

/* advance warning of imminent expiry of
 * cacerts, public keys, and crls
 * unused: OCSP_CERT_WARNING_INTERVAL	(30 * secs_per_day)
 * unused: ACERT_WARNING_INTERVAL	(1 * secs_per_day)
 * unused: CA_CERT_WARNING_INTERVAL	(30 * secs_per_day)
 * unused: CRL_WARNING_INTERVAL		(7 * secs_per_day)
 */
#define PUBKEY_WARNING_INTERVAL		(14 * secs_per_day)

/* certificate access structure
 * currently X.509 certificates are supported
 */
typedef struct cert {
	CERTCertificate *nss_cert;	/* CERT_X509_SIGNATURE */
} cert_t;

const char *cert_nickname(const struct cert *cert);
enum ike_cert_type cert_ike_type(const struct cert *cert);
shunk_t cert_der(const struct cert *cert);

extern void list_certs(struct show *s);

/*
 * Maintain a list of certificates.
 */

struct certs {
	CERTCertificate *cert;	/* never NULL */
	struct certs *next;
};

void release_certs(struct certs **head);
void add_cert(struct certs **head, CERTCertificate *cert);
CERTCertificate *make_end_cert_first(struct certs **head);

#endif