chiark / gitweb /
make-secnet-sites: Fix error handling if caller is in wrong group
[secnet.git] / pubkeys.h
1 /*
2  * This file is part of secnet.
3  * See README for full list of copyright holders.
4  *
5  * secnet is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  * 
10  * secnet is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License for more details.
14  * 
15  * You should have received a copy of the GNU General Public License
16  * version 3 along with secnet; if not, see
17  * https://www.gnu.org/licenses/gpl.html.
18  */
19
20 #ifndef pubkeys_h
21 #define pubkeys_h
22
23 #include "secnet.h"
24
25 /*----- shared with site.c -----*/
26
27 struct peer_pubkey {
28     struct sigkeyid id;
29     struct sigpubkey_if *pubkey;
30 };
31
32 struct peer_keyset {
33     int refcount;
34     serialt serial;
35     int nkeys;
36     struct peer_pubkey keys[MAX_SIG_KEYS];
37 };
38
39 extern struct peer_keyset *
40 keyset_load(const char *path, struct buffer_if *data_buf,
41             struct log_if *log, int logcl_enoent);
42
43 extern void keyset_dispose(struct peer_keyset **ks);
44
45 static inline struct peer_keyset *keyset_dup(struct peer_keyset *in) {
46     in->refcount++;
47     return in;
48 }
49
50 extern bool_t
51 pubkey_want(struct peer_keyset *building /* refcount and serial undef */,
52             struct sigkeyid *id, const struct sigscheme_info *scheme);
53
54 #endif /* pubkeys_h */