1 |
81 |
rehayes |
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
2 |
|
|
Bob Hayes -- August 10, 2010
|
3 |
|
|
|
4 |
|
|
SKIPJACK ENCRYPT/DECRYPT for xgate RISC processor core
|
5 |
|
|
|
6 |
|
|
Version 0.1 Basic SKIPJACK Encrypt and Decrypt modules for the Xgate
|
7 |
|
|
processor. These routines do the basic codebook encrypt and decrypt
|
8 |
|
|
functions, other modes of use such as output feedback,cipher feedback and
|
9 |
|
|
cipher block chaining can be added at the host code level or the routines
|
10 |
|
|
could be expanded to incorporate the required functionality.
|
11 |
|
|
|
12 |
|
|
This implementation is believed to be compliant with the SKIPJACK algorithm
|
13 |
|
|
as described in "SKIPJACK and KEA Algorithm Specifications" Version 2.0
|
14 |
|
|
dated 29 May 1998, which is available from the National Institute for
|
15 |
|
|
Standards and Technology:
|
16 |
|
|
http://csrc.nist.gov/groups/STM/cavp/documents/skipjack/skipjack.pdf
|
17 |
|
|
|
18 |
|
|
The algorithm encrypts a 64 bit block of data with an 80 bit key running
|
19 |
|
|
through the encryption loop 32 times. The encrypt/decrypt function has been
|
20 |
|
|
verified by running the key and plain text and cypher test given in the
|
21 |
|
|
specification document.(Some have noted that this only verifies about half
|
22 |
|
|
of the entries in the F Table.)
|
23 |
|
|
|
24 |
|
|
Basic encryption process takes approx. 6468 cycles
|
25 |
|
|
Basic decryption process takes approx. 6786 cycles
|
26 |
|
|
|
27 |
|
|
The code has several sections that are only needed for the Verilog test bench
|
28 |
|
|
and can be deleted in normal use. There is also some additional initialization
|
29 |
|
|
code that only needs to be done once and could be replaced by the host putting
|
30 |
|
|
the correct values in the appropriate RAM locations. These sections are marked
|
31 |
|
|
in the code. The starting address of the F Table in memory shouldn't be critical
|
32 |
|
|
although starting on a 256 byte boundary is convenient for debugging. The
|
33 |
|
|
algorithm variables use 8 bit address offset calculations so care should be
|
34 |
|
|
taken if the key is saved in a memory range that crosses an 8 bit addressing
|
35 |
83 |
rehayes |
boundary. The G function is coded as a subroutine that is called twice, some
|
36 |
|
|
speed could be gained if this code is placed in-line at the expense of a
|
37 |
|
|
small increase in code size.
|
38 |
81 |
rehayes |
|
39 |
|
|
|