-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2fish_avr.cfg
60 lines (47 loc) · 2.17 KB
/
2fish_avr.cfg
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
/*
tinyTwofish implementation for tinyAVR (ATtiny25/45/85)
Copyright (C) 2014 Marc Schoolderman
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
KEY_SIZE = 128
/* we can share code between keysched. and encryption. should we?
note that this is incompatible with 'UNROLL_round_h' */
INLINE_round_g = 0
/* options controlling various size vs. speed tradeoffs */
UNROLL_round_h = 0
UNROLL_round_g = 1
UNROLL_keypair = 0
UNROLL_enc = 0
UNROLL_swap = 1
INLINE_whiten = 0
UNROLL_whiten = 1
/* precompute the roundkeys */
TAB_key = 1
/* precompute the sbox, not possible in sram on attiny */
TAB_sbox = 0
/* use a precomputed qbox */
TAB_q = 1
/* should we "omit the last swap"? setting this to 0 means we are no longer a true Twofish.
if UNROLL_enc=1, setting to 0 saves a handful instructions. otherwise only has disadvantages */
OMIT_last_swap = 1
/* where do we expect the q-table to reside?
if TAB_q = 0, this controls inlining the q-box call (0 = INLINE) */
SRAM_q = 0
/* if set to 0, the caller should allocate and pass pointers to the roundkeys, allows for fast switching and saves some code size but makes things slightly more bureaucratic.
note that the sbox is always allocated statically. */
STATIC = 1 /* TAB_sbox */
/* size of the sbox-key + round-keys in bytes, do not alter this */
MASTERKEY_OFS = KEY_SIZE/16
SCHEDULE_SIZE = MASTERKEY_OFS + 40*4*TAB_key + KEY_SIZE/8*!TAB_key