Debian Codegraph @

TODO

raw
1 hey emacs, show me an -*- mode: outline -*-
2
3 * misc
4 ** cleanup octet-stream: positions are either INDEX or POSITION, not both
5 The latter requires :SHADOW adjustments in Ironclad's DEFPACKAGE.
6
7 * ciphers to add
8
9 CAST6
10 MARS
11 ...others?...
12
13 * add OpenPGP functions
14
15 This would involve writing some simple base64 encoding and decoding.
16 I'm not sure how to add this and achieve the right amount of generality
17 and functionality. Just writing an OpenPGP parser is straightforward,
18 but determining what to do with the data is a little more complicated.
19
20 * make a condition hierarchy for the library
21
22 Some conditions have been added as of 0.7, but there probably need to be
23 more, with helpful messages along the way.
24
25 * remove generic function calls from inner loops
26
27 ENCRYPT-WITH-MODE, by virtue of calling <CIPHER>-ENCRYPT-BLOCK on
28 every iteration of the loop, requires <CIPHER>-ENCRYPT-BLOCK to
29 repeatedly extract the cipher-specific data from the provided cipher
30 context. No idea if this is a bottleneck (probably not).
31
32 Doing this extraction on every iteration of the loop is overhead,
33 though--unnecessary overhead compared to a C implementation. Pulling
34 the extraction out of the loop in a clean, cipher-independent manner is
35 probably pretty hairy, however.
36
37 * figure out interface for extra cipher creation parameters
38
39 RC5, for instance, is configurable in the number of rounds. The number
40 of rounds must be fixed the way the current system works. Configuring
41 the number of rounds for TEA and XTEA would be another example of where
42 this is useful. Surely there are other reasons, too.
43
44 * add more cipher modes of operation
45
46 CBC with ciphertext stealing (CBC-CTS) (this would require some sort
47 of ENCRYPT-FINAL-BLOCK interface so we would know when to perform the
48 ciphertext stealing)
49 PCBC, for all those Lispers who want to implement Kerberos 4
50 OpenPGP CFB
51
52 * efficient 32-bit implementations of SHA2-{512,384}
53
54 These digests are currently implemented with straight 64-bit arithmetic,
55 which is elegant, but causes a lot of consing on 32-bit platforms. Is
56 it worth spending the time to tweak these?
57
58 * add other MACs
59
60 The NESSIE project has a boatload of MAC recommendations with test
61 vectors and everything. Adding other MACs would help with cleaning up
62 the MAC interface (or lack thereof).
63
64 * add other digests
65
66 Are there any other reputable hash functions?
67
68 * figure out interface for stream ciphers
69
70 WiderWake 4+1
71 SEAL (intellectual property issues, although that doesn't seem to stop
72 many other crypto libraries)
73
74 * blue-sky ideas
75
76 ** implementation-specific algorithm implementations
77
78 Ironclad is written with implementations that are capable of performing
79 32-bit unboxed arithmetic in mind. However, there is no reason to leave
80 other implementations out in the cold. I particularly have in mind
81 ABCL, whose clean Java integration could facilitate using Java's crypto
82 routines for many of the algorithms Ironclad provides.
83
84 Using 32-bit integer arithmetic in LispWorks (SYSTEM:INT32-*) and
85 DEF*LAPFUNCTION in ClozureCL, along with architecture-specific VOPs
86 and/or DEF{KNOWN,OPTIMIZER,TRANSFORM} in SBCL/CMUCL are other ways of
87 doing this.
88
89 ** compilable encryption and decryption routines
90
91 One trick that's commonly used in high-performance crypto libraries is
92 unrolling inner loops of ciphers, which are generally Feistel networks
93 of some sort. This transformation has many benefits: avoiding jumps and
94 compiling more efficient code for structure accesses, to name two.
95 Ironclad features unrolled loops in various places (e.g. the CAST5 and
96 Blowfish ciphers). Unrolled loops can be particularly helpful in Common
97 Lisp because the compiler can often optimize away things like array
98 bounds checks.
99
100 Unfortunately, this tends to limit the libraries to only handling a
101 fixed number of rounds (or other configurable parameters of block
102 ciphers). Accomodating variable numbers of rounds makes life easier for
103 the truly paranoid and is more in the spirit of the ciphers as
104 originally designed.
105
106 One way of getting around this limitation would be to use Common Lisp's
107 provision of the COMPILE function at create-the-cipher time. One could
108 compile--on demand--specialized encryption/decryption routines that only
109 accommodated a fixed number of rounds (or other static configuration
110 parameters). This facility would be particularly helpful for those
111 ciphers whose round keys are variable in the number of rounds chosen;
112 bounds checking for accesses to these keys could be done away with
113 entirely (except perhaps for a check to ensure the round key vector is
114 of the proper length and type). Furthermore, the round keys could
115 actually be compiled directly into the code--as 32-bit constant
116 arguments on the x86, for example. Such a change would necessarily make
117 the compiled routines key-specific, but perhaps that would be OK.
118
119 (When reading the specifications for Blowfish and Twofish, the authors
120 make much of this capability by citing screaming performance numbers for
121 this scenario while noting that modifying the code for each individual
122 key is difficult. In Ironclad, providing three differing levels of
123 generality--general, n-rounds-specific, and key-specific--would be
124 relatively easy compared to the difficulty of doing it in C.)
125
126 Changes to MAKE-CIPHER--a keyword argument specifying the level of
127 specialization--would be necessary. Extensive changes to the individual
128 block ciphers would also be necessary. Perhaps this sort of facility
129 need not be added to all ciphers; the common ones could come first
130 (e.g. AES) and less-common ones would be converted as people contributed
131 patches or needs were found for them.
132
133 ** use word-aligned loads when possible
134
135 The current code uses byte loads + shifts and ors to fetch
136 (UNSIGNED-BYTE 32) values out of a (SIMPLE-ARRAY (UNSIGNED-BYTE 8) (*)).
137 Some implementations (I have in mind particularly SBCL and CMUCL) could
138 use a more efficient mechanism if the offset of the (UNSIGNED-BYTE 32)
139 value was known to be four-byte aligned. Once this was done for each
140 encryption/decryption function for a particular block cipher, the
141 high-level generic functions could call efficient versions if possible,
142 eliminating some overhead.
143
144 There is actually some (SBCL) support for this in cipher.lisp, in the
145 alternate definition for WITH-WORDS. It doesn't make that much of a
146 difference--at least not in the case where WITH-WORDS needs to check for
147 alignment and safety. It might be a win if there were several
148 different *-ENCRYPT-BLOCK functions and the high-level ones knew which
149 one to call, but...
150
151 * add option to allow INTEGER-TO-OCTETS to output directly to a buffer
152
153 This could be handy in certain internals, e.g. in GENERATE-BLOCKS.