magic.h: Put the CAPAB_... definitions together, under the big comment.
[secnet] / magic.h
CommitLineData
ff05a229 1/* Magic numbers used within secnet */
c215a4bc
IJ
2/*
3 * This file is part of secnet.
4 * See README for full list of copyright holders.
5 *
6 * secnet is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by
9c6a8729 8 * the Free Software Foundation; either version 3 of the License, or
c215a4bc
IJ
9 * (at your option) any later version.
10 *
11 * secnet is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * version 3 along with secnet; if not, see
18 * https://www.gnu.org/licenses/gpl.html.
19 */
ff05a229
SE
20
21#ifndef magic_h
22#define magic_h
23
5b5f297f
IJ
24#define LABEL_NAK 0x00000000
25#define LABEL_MSG0 0x00020200
26#define LABEL_MSG1 0x01010101
27#define LABEL_MSG2 0x02020202
28#define LABEL_MSG3 0x03030303
29#define LABEL_MSG3BIS 0x13030313
30#define LABEL_MSG4 0x04040404
31#define LABEL_MSG5 0x05050505
32#define LABEL_MSG6 0x06060606
33#define LABEL_MSG7 0x07070707
34#define LABEL_MSG8 0x08080808
35#define LABEL_MSG9 0x09090909
dd9209d1 36#define LABEL_PROD 0x0a0a0a0a
ff05a229 37
5b5f297f 38/*
3dc839ce
MW
39 * The capability mask is a set of bits, one for each optional feature
40 * supported. The capability numbers for transforms are set in the
41 * configuration (and should correspond between the two sites), although
42 * there are sensible defaults.
5b5f297f 43 *
3dc839ce
MW
44 * Advertising a nonzero capability mask promises that the receiver
45 * understands LABEL_MSG3BIS messages, which contain an additional byte
46 * specifying the transform capability number actually chosen by the MSG3
47 * sender.
5b5f297f
IJ
48 *
49 * Aside from that, an empty bitmask is treated the same as
92cc0bca 50 * 1u<<CAPAB_BIT_ANCIENTTRANSFORM
5b5f297f
IJ
51 */
52
ceacd890
MW
53/* uses of the 32-bit capability bitmap */
54#define CAPAB_EARLY CAPAB_PRIORITY_MOBILE
55#define CAPAB_TRANSFORM_MASK 0x0000ffff
56#define CAPAB_PRIORITY_MOBILE 0x80000000 /* mobile site has MSG1 priority */
57/* remaining bits are unused */
58
5b5f297f 59/* bit indices, 0 is ls bit */
92cc0bca
MW
60#define CAPAB_BIT_USER_MIN 0
61#define CAPAB_BIT_USER_MAX 7
62#define CAPAB_BIT_SERPENT256CBC 8
63#define CAPAB_BIT_EAXSERPENT 9
64#define CAPAB_BIT_MAX 15
5b5f297f 65
92cc0bca 66#define CAPAB_BIT_ANCIENTTRANSFORM CAPAB_BIT_SERPENT256CBC
09a385fb 67
ff05a229 68#endif /* magic_h */