X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/0f00dc4c8eb47e67bc0f148c2dd109f73a451e0a..e5b61a8dec3586f96d25bd3ef454176526ff0f69:/symm/skipjack.c diff --git a/symm/skipjack.c b/symm/skipjack.c index bd58ede..82c1a72 100644 --- a/symm/skipjack.c +++ b/symm/skipjack.c @@ -32,7 +32,6 @@ #include "blkc.h" #include "gcipher.h" #include "skipjack.h" -#include "skipjack-tab.h" /*----- Global variables --------------------------------------------------*/ @@ -40,7 +39,7 @@ const octet skipjack_keysz[] = { KSZ_SET, 10, 0 }; /*----- The Skipjack S-box ------------------------------------------------*/ -static const octet f[256] = SKIPJACK_S; +extern const octet skipjack_s[256]; /*----- Main code ---------------------------------------------------------*/ @@ -83,10 +82,10 @@ void skipjack_init(skipjack_ctx *k, const void *buf, size_t sz) #define G(x, k) do { \ octet _x = U8(x >> 8), _y = U8(x); \ - _x ^= f[_y ^ U8(k >> 24)]; \ - _y ^= f[_x ^ U8(k >> 16)]; \ - _x ^= f[_y ^ U8(k >> 8)]; \ - _y ^= f[_x ^ U8(k >> 0)]; \ + _x ^= skipjack_s[_y ^ U8(k >> 24)]; \ + _y ^= skipjack_s[_x ^ U8(k >> 16)]; \ + _x ^= skipjack_s[_y ^ U8(k >> 8)]; \ + _y ^= skipjack_s[_x ^ U8(k >> 0)]; \ x = (_x << 8) | _y; \ } while (0) @@ -128,10 +127,10 @@ void skipjack_eblk(const skipjack_ctx *k, const uint32 *s, uint32 *d) #define G_INV(x, k) do { \ octet _x = U8(x >> 8), _y = U8(x); \ - _y ^= f[_x ^ U8(k >> 0)]; \ - _x ^= f[_y ^ U8(k >> 8)]; \ - _y ^= f[_x ^ U8(k >> 16)]; \ - _x ^= f[_y ^ U8(k >> 24)]; \ + _y ^= skipjack_s[_x ^ U8(k >> 0)]; \ + _x ^= skipjack_s[_y ^ U8(k >> 8)]; \ + _y ^= skipjack_s[_x ^ U8(k >> 16)]; \ + _x ^= skipjack_s[_y ^ U8(k >> 24)]; \ x = (_x << 8) | _y; \ } while (0)