Blame


1 7d2a2ace 2024-01-24 op /*
2 7d2a2ace 2024-01-24 op * Copyright (c) 2021, 2023, 2024 Omar Polo <op@omarpolo.com>
3 7d2a2ace 2024-01-24 op * Copyright (c) 2019 Renaud Allard <renaud@allard.it>
4 7d2a2ace 2024-01-24 op * Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv>
5 7d2a2ace 2024-01-24 op * Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
6 7d2a2ace 2024-01-24 op * Copyright (c) 2008 Reyk Floeter <reyk@openbsd.org>
7 7d2a2ace 2024-01-24 op *
8 7d2a2ace 2024-01-24 op * Permission to use, copy, modify, and distribute this software for any
9 7d2a2ace 2024-01-24 op * purpose with or without fee is hereby granted, provided that the above
10 7d2a2ace 2024-01-24 op * copyright notice and this permission notice appear in all copies.
11 7d2a2ace 2024-01-24 op *
12 7d2a2ace 2024-01-24 op * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13 7d2a2ace 2024-01-24 op * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14 7d2a2ace 2024-01-24 op * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15 7d2a2ace 2024-01-24 op * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16 7d2a2ace 2024-01-24 op * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17 7d2a2ace 2024-01-24 op * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18 7d2a2ace 2024-01-24 op * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 7d2a2ace 2024-01-24 op */
20 7d2a2ace 2024-01-24 op
21 d35e18b3 2024-02-04 op struct iri;
22 d35e18b3 2024-02-04 op
23 f0e62b85 2024-02-15 op /* client certificate */
24 f0e62b85 2024-02-15 op struct ccert {
25 f0e62b85 2024-02-15 op char *host;
26 f0e62b85 2024-02-15 op char *port;
27 f0e62b85 2024-02-15 op char *path;
28 f0e62b85 2024-02-15 op char *cert;
29 d35e18b3 2024-02-04 op
30 f0e62b85 2024-02-15 op #define CERT_OK 0x00
31 f0e62b85 2024-02-15 op #define CERT_TEMP 0x01
32 f0e62b85 2024-02-15 op #define CERT_TEMP_DEL 0x02
33 f0e62b85 2024-02-15 op int flags;
34 f0e62b85 2024-02-15 op };
35 f0e62b85 2024-02-15 op
36 f0e62b85 2024-02-15 op struct cstore {
37 f0e62b85 2024-02-15 op struct ccert *certs;
38 f0e62b85 2024-02-15 op size_t len;
39 f0e62b85 2024-02-15 op size_t cap;
40 f0e62b85 2024-02-15 op };
41 f0e62b85 2024-02-15 op
42 f0e62b85 2024-02-15 op extern struct cstore cert_store;
43 f0e62b85 2024-02-15 op extern char **identities;
44 f0e62b85 2024-02-15 op
45 d35e18b3 2024-02-04 op int certs_init(const char *);
46 d35e18b3 2024-02-04 op const char *ccert(const char *);
47 71bc1636 2024-02-06 op const char *cert_for(struct iri *, int *);
48 5a39f593 2024-02-05 op int cert_save_for(const char *, struct iri *, int);
49 4fdc9933 2024-02-05 op int cert_delete_for(const char *, struct iri *, int);
50 d35e18b3 2024-02-04 op int cert_open(const char *);
51 f0e62b85 2024-02-15 op int cert_new(const char *, const char *, int);